HTML VIEWER定制笔记
ArcIMS学习之 HTML Viewer定制笔记 续二(2.Servlet与请求响应过程)
4. Servlet Connector的入口Servlet:
com.esri.esrimap.Esrimap 参数
ServiceName ArcIMS 服务名
ClientVersion ArcIMS 版本号
Form true请求来自HTML的Form
Encode
* 请求重定向 CustomService 参数
原因:
影像虚拟服务(Image MapService) 不提供"属性信息","几何信息","地理编码"等的功能,所以请求被重定向到其它的虚拟服务。
即:
When sending a request other than GET_IMAGE to an image MapService,redirection is required;
Redirection is achieved in action attribute of the PostForm:
GET_FEATURES
CustomService = Query
GET_GEOCODE
CustomService = Geocode
GET_EXTRACT
CustomService = Extract
Http://caesar1:8888/servlet/com.esri.esrimap.Esrimap?ServiceName=Beijing&CustomService=Query&ClientVersion=3.1&Form=true
5.PostForm
ArcXMLRequest(required) ArcXML request being sent to the server
JavaScriptFunction(optional) 指定 jsForm.htm 中的处理response 函数名,默认为passXML()
RedireURL(optional)
BgColor(optional)
FormCharset(optional)
6.请求与响应的过程:
1>Request --> Servlet Connector -->Application Server
Servlet Connector对传来的Request进行解析,只传给Application Server :
* ServiceName
* ArcXMLRequest
其余参数由Servlet Connector保留对响应(Response)的格式设置
2>对Servlet Connector的调用为:
http://hostName/servlet/com.esri.esrimap.Esrimap
3>响应:Application Server将参数传递给 Spatial Server,Spatial Server将响应
(Response)返回给 Application Server,所有的 Response只有两种:
* ArcXML 包含属性信息、图片的URL(HTML Viewer只能处理这一种)
* Feature Stream 二进制压缩要素流
4>the Servlet Connector Creates a new HTML page based on
* Value of the input elements specified in the request
* Default values of the input elements
* The Response ArcXML
ArcIMS学习之 HTML Viewer定制笔记 续三(3.请求&响应)
请求
一、最基本函数:
sendToServer --> htmlSendToServer
提交表单 PostForm
(aimsXML.js)
参数:
URLString
XMLRequest Request ArcXML
theType XMLMode的值,默认为1,GET_IMAGE
sendToServer将 theType 赋给XMLMode,然后调用htmlSendToServer提交表单。
二、GET_SERVICE_INFO
由 getStartExtent()构造,并调用sendToServer(imsURL,theString,3);(aimsCommon.js)
具体调用关系为:
viewer.htm在所有Frame装完后,onload一个doIt()--> checkParams --> startMap -->startUp -->getStartExtent
(startMap、startUp、getStartExtent都在aimsCommon.js)
三、GET_IMAGE
首次的 GET_IMAGE 是在对GET_SERVICE_INFO的响应中调用的(case 3);
sendMapXML()
writeXML()构造得到 Map 图的 ArcXML
响应
一、处理响应最基本函数:
aimsXML.js中的:
processXML(XMLResponse)根据 XMLMode 处理相关 Response
function processXML(theReplyIn) {
...
switch(XMLMode) {
case 1: //得到地图GET_IMAGE
...
default: //XMLMode >= 1000交给用户定制处理
if (XMLMode >= 1000) {
useCustomFunction(theReply);
} else {
alert(theReply + msgList[19]);
}
}
二、
case 3: GET_SERVICE_INFO
保存查到的地图最大值,调用 ProcessStartExtent(theReply) (aimsCommon.js)
-->sendMapXML(){
writeXML();
sendToServer(,,1);
}
三、用户定制:
processXML 中当 XMLMode大于1000时,为用户定制处理:
default://XMLMode >= 1000交给用户定制处理
// send any responses to custom requests off to the custom handler
// XMLMode >= 1000 are reserved for custom requests/responses
if (XMLMode >= 1000) {
useCustomFunction(theReply);
useCustomFunction(theReply)在aimsCustom.js中
接收的Servlet为com.esri.esrimap.Esrimap
ArcIMS学习之 HTML Viewer定制笔记 续四(4.动态效果DHTML)
一、CSS基础:
Html:
<DIV id="xxx" style="background-color:blue;
left:20px;top:20px;
position:absolute;
visibility:visible;
z-index:0">
</DIV>
Javascript:
document.getElementById("xxx").style.visibility="hidden";
参数说明:
<DIV id="xxx" style=""></DIV>
将其包括的其他HTML元素或文本应用到指定的样式规则(CSS)中,也称“容器”。
background-color 背景色,Javascript为:xxx.style.backgroundColor
clip 剪切指定部分来显示;其语法为:
.style.clip="rect(top,right,bottom,left)";
注意此参数的顺序不寻常;
例:style.clip='rect(20 400 500 30)';
left、top 与容器的相对位置
position 指定位置规则如何使用,多个元素设绝对位置(absolute)可实现重叠
visibility CSS图层是否可见,有二值:visible 和 hidden
z-index 指定元素重叠顺序,0位最底层,大于0的整数为上层,默认都为0层
二、ArcIMS使用(aimsDHTML.js)
1.创建CSS层:
function createLayer(name, inleft, intop, width, height, visible, content) {
var layer;
if (isNav4) {
document.writeln('<layer name="' + name + '" left=' + inleft + ' top=' + intop + ' width=' + width + ' height=' + height + ' visibility=' + (visible ? '"show"' : '"hide"') + '>');
document.writeln(content);
document.writeln('</layer>');
} else {
document.writeln('<div id="' + name + '" style="position:absolute; overflow:hidden; left:' + inleft + 'px; top:' + intop + 'px; width:' + width + 'px; height:' + height + 'px;' + '; z-index:1; visibility:' + (visible ? 'visible;' : 'hidden;') + '">');
document.writeln(content);
document.writeln('</div>');
}
}
只要将要放入层内的内容写好调用createLayer即可;
2.显示、隐藏层
2.1辅助函数:
得到层:
function getLayer(name) {
if (isNav4)
return(document.layers[name]);
else if (isIE4) {
layer = eval('document.all.' + name + '.style');
return(layer);
} else if (is5up) {
var theObj = document.getElementById(name);
return theObj.style
}
else
return(null);
}
2.2显示、隐藏层
function showLayer(name){
getLayer(name).visibility="visible";
}
function hideLayer(name){
getLayer(name).visibility="hidden";
}
先将MapFrame中所有图片<IMG>都创建为层,这样可实现显示和隐藏功能。
ArcIMS学习之 HTML Viewer定制笔记 续五(5.Javascript纪要)
1.另一个Frame中的JavaScript变量:
var 可在其他框架中使用:
Frame名.变量名 来调用
2.<Table>中
<TR> -- Table Row
<TD> -- Table Data
3.<IMG>元素
<IMG src="图片路径" alt="提示">
4.DOM 模型
+ forms[]
| images[]
+ frames [] -- document -| anchors[]
| document | ...
| navigator + applets[]
window --| history
| status 属性
+ location
5.事件
1> onClick ,onLoad 等不是 事件处理函数(event handler)而是 事件 (event);
2> 对照表
------------------+------------------------
Object | Event
------------------+------------------------
window,FrameSet | onLoad
Frame | onUnload
------------------+------------------------
Button,IMG,Frame | onClick
| onMouseDown
| onMouseUp
| onMouseMove
------------------+------------------------
3>事件处理函数
function startUp(){
document.onmousedown = maptool;//maptool是函数名
}
function maptool(){
...
}
<body onload = "startUp()">
4>
event.clientX
event.clientY 鼠标坐标,相对于包容窗口左上角
event.offsetX
event.offsetY 鼠标坐标,相对于源元素位置
5>onUnload事件含义:
Browser已经离开使用框架、document网页,在转入其它页之前的事件

浙公网安备 33010602011771号