默认头像
论坛版主
论坛版主
  • 注册日期2006-12-17
  • 发帖数155
  • QQ
  • 铜币53枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:2584回复:0

使用ArcXML在HTML Viewer中动态添加数据层

楼主#
更多 发布于:2006-12-21 12:25
');
if (isSecond) document.write('');
}
if (parent.MapFrame.canLoad) {
// Load MapService. . . requires aimsGeneric.js
document.write('');
}

改成:
if (parent.MapFrame.allowOptions) {
// Options. . . requiers aimsOptions.js... allowOptions is set to true in

this file
document.write('');
if (isSecond) document.write('');
}
if (parent.MapFrame.addDynLayer) {
document.write('');
if (isSecond) document.write('');
}

if (parent.MapFrame.canLoad) {
// Load MapService. . . requires aimsGeneric.js
document.write('');
}

6.为了添加动态图层,请求新的地图图片,进行如下编辑:
A.在文本编辑器中打开aimsClick.js.在clickFunction()函数中将下列代码:
function clickFunction (toolName) {
if (hasLayer("measureBox"))
hideLayer("measureBox");
switch(toolName) {

// Zooming functions
case "zoomin":
改成:
function clickFunction (toolName) {
if (hasLayer("measureBox"))
hideLayer("measureBox");
switch(toolName) {
// Zooming functions
case "CustomAXL":

if (aimsCustomPresent){
aimsCustomPresent=false
} else {
aimsCustomPresent=true;
}

parent.MapFrame.sendMapXML();

break;

case "zoomin":
当aimsCustomPresent为true时,aimsXML.js文件中writeXML()函数中下面这行代码会调用

aimsCustom.js文件中的addCustomToMap1()函数.
if (aimsCustomPresent) theString += addCustomToMap1();
注:每次有更新地图图片的请求时,writeXML() 都会被调用.
7.在文本编辑器中打开aimsCustom.js,作下列改动:
A.将这行代码"aimsCustomPresent=true;"改成aimsCustomPresent=false;
B.将addCustomToMap1() 函数中的代码段:
function addCustomToMap1(){
var customString = "";
/*
customString += 'n';
customString += 'nn';
customString += '
font="ARIAL" fontcolor="' + modeMapColor + '" ';
customString += 'threed="TRUE" glowing="' + modeMapGlow + '"

/>n
n
';
customString += 'n
n';
*/
return customString;
}
改成:
function addCustomToMap1(){
var customString = "";
customString += 'n';
customString += 'n';
customString += '
n';
customString += '
id="2">n';
customString += '
workspace="shp_ws-1" />n';
customString += 'n';
customString += 'n';
customString += '
n';
customString += '
n';
return customString;
}
8.保存所有的文件
9.在浏览器中打开WEB站点.注:会弹出消息框,显示客户端的ArcXML(REQUEST)已经发送到服务

器,且收到服务器返回的ArcXML()(RESPONSE).
10.点击工具栏中的扳手图标.我们定制的ArcXML字符串就添加到了GET_IMAGE请求中发送到

ArcIMS服务器.你可以看到一个REQUEST(包含aimsCustom.js里addCustomToMap1()中的字符串

)和一个RESPONSE(包含输出的图片的位置)

"MAP"这个ArcXML标签有"dynamic"属性,可以不修改mapservice(地图服务)的AXL配置文件而

是将图层动态地添加到mapservice.本文将为HTML Viewer中实现此功能举例.

过程描述

下面的例子将动态地将cities.shp shapefile添加到包含states.shp的图像地图服务中.可以

在ArcIMS产品的例子只找到这两个数据集.

1.在Author或文本编辑器中新建AXL文件,states shapefile是其唯一的层.
2.在文本编辑器中打开该AXL文件,将Map元素作如下改动:
改为:
3.启动Administrator,根据该AXL文件新建一个图像地图服务.然后启动Designer,用这个地图

服务建立一个HTML Viewer的Web站点.接受缺省值.
4.修改deBugOn变量值,查看送到ArcIMS服务器的ArcXML:
A.在文本编辑器中打开ArcIMSParams.js,搜索deBugOn,并修改成:deBugOn = 3;
B.在文件头加上一行:addDynLayer = true;
5.在HTML Viewer的工具栏上加一个按钮.当点击该按钮,会生成添加一个新的数据层ArcXML代

码,并将该段代码加到对地图图片的请求中去.

在文本编辑器中打开toolbar.htm,然后在文件末尾将下列代码:
if (parent.MapFrame.allowOptions) {
// Options. . . requiers aimsOptions.js... allowOptions is set to true in

this file
document.write('

');
document.write('
vspace=1 border=0 alt=" ' + t.buttonList[40] + '"

onmousedown="parent.MapFrame.writeOptionForm();" onmouseover="window.status=' '

+ t.buttonList[40] + ''">');
isSecond = !isSecond
document.writeln('
');
document.write('
vspace=1 border=0 alt=" ' + t.buttonList[41] + '"

onmousedown="parent.MapFrame.loadMapForm();" onmouseover="window.status=' ' +

t.buttonList[41] + ''">');
document.writeln('
');
document.write('
vspace=1 border=0 alt=" ' + t.buttonList[40] + '"

onmousedown="parent.MapFrame.writeOptionForm();" onmouseover="window.status=' '

+ t.buttonList[40] + ''">');
isSecond = !isSecond
document.writeln('
');
document.write('
vspace=1 border=0 alt="Add Dynamic Layer"

onmousedown="parent.MapFrame.clickFunction('CustomAXL');"

onmouseover="window.status='Add Dynamic Layer '">');
isSecond = !isSecond
document.writeln('
');
document.write('
vspace=1 border=0 alt=" ' + t.buttonList[41] + '"

onmousedown="parent.MapFrame.loadMapForm();" onmouseover="window.status=' ' +

t.buttonList[41] + ''">');
document.writeln('
喜欢0 评分0
默认头像

返回顶部