王朝网络
分享
 
 
 

ArcIMS学习之 定制HTML VIEWER笔记

王朝html/css/js·作者佚名  2006-01-10
宽屏版  字体: |||超大  

一、HTML VIEWER简介:

1。默认的HTML VIEWER由一组HTML页和JS文件(JavaScript)组成,这些HTML页和JS文件由ArcIMS Designer定制生成。

2。对于HTML Viewer,我们所做的功能扩展可以包括:

* 改变框架布局

* 修改工具条

* 增加自己的功能

* 改变图形外观

* 插入自己的图标

3。ArcIMS Designer定制的网站默认在Web容器的home目录的\default-web-app\Website 目录下

二、HTML Viewer文件结构:

1。由一组HTML文件,一个参数文件ArcIMSparam.js及两个目录--JavaScript和images组成。

站点目录

|

| HTML Pages

| ArcIMSparam.js

|

|---- JavaScript目录//包含JavaScript函数库,定义了用户可操作的地图功能,包括了HTML Viewer的大部分操作 。

| //可以通过定制这些JavaScript程序为自己的工具按扭增加功能。如热连接等。

|---- images 目录 //包含用于页面上按钮,图标及标记的显示。当新建站点时,可以用自己的标志代替这些原有的影像

2。ArcIMSparam.js与HTML Pages

HTML Viewer的一个重要的参数文件是位于站点目录下的ArcIMSparam.js文件。这个文件包含了一组影响站点外观和工作方式的JavaScript变量。对HTML Viewer大部分的定制都可以通过改变这些变量 的值来完成。ArcIMSparam.js包含的主要变量可以用来

* 改变所用的地图服务和地图范围

* 设置图例的初始化显示

* 定义acetate层的指北针,版权文字

* 定义属性字段的显示

* 改变工具和工具条

HTML Viewer默认入口是Default.htm。它的处理了四个任务

1>创建页面标题,

2>确定所用的浏览器类型,

3>建立URL解析规则

4>生成用于定义页面布局框架的viewer.htm文件。

Viewer.htm定义了HTML Viewer的结构,而不是内容,他将浏览器划分为多个区域。每个区域通过HTML文件获得内容。其他的HTML文件则为框架添加内容。

一般关系如下:

先装入MapFrame.html于MapFrame中,再由MapFrame打开TocFrame其中装入toc.htm,所以在toc.htm用MapFrame的内容时,

var t;

if(opener){

t=opener.parent.MapFrame;

}else{

t=parent.MapFrame;

}

因为,MapFrame.html包含了aimsCustom.js、aimsXML.js、ArcIMSparam.js,因而将添加的函数放入aimsCustom.js(包括构造发送XML的函数和处理XML的函数useCustomFunction)后在各自框架中调用MapFrame中新加的函数!

以添加定位功能为例,一般是在aimsCustom.js中加入函数,如function addressLocation(x,y,name)

其中先保存上一幅地图的范围,再调用sendMapXML()获得新地图

发送request

saveLastExtent()

Arguments:

None

Returned Value:

None

Description:

Function that saves the last map extent.

Uses: eLeft, eRight, eTop, and eBottom.

Called by: displayAttributeData in aimsIDentify.js; fullExtent, startExtent, zoomToPoint,

zoomToEnvelope, zoomScale, zoomButton, and panButton in aimsMap.js;

ovMapClick, zoomin, zoomout, stopZoomBox, stopZoomOutBox, stopPan, and pan in

aimsNavigation.js; and showHighlight in aimsSelect.js.

Sets: lastLeft, lastRight, lastTop, and lastBottom.

File:

aimsMap.js

Syntax:

sendMapXML()

Arguments:

None

Returned Value:

None

Description:

Sends an ArcXML request to obtain a new map image to the MapServer.

会用到的变量为: debugOn and imsURL.

Calls: beforeMapRefresh and showRetrieveMap in aimsMap.js and writeXML and sendToServer in

aimsXML.js.

Called by: bufferIt in aimsBuffer.js; clickFunction in aimsClick.js; processStartExtent in

aimsCommon.js; parseGeocodeResults in aimsGeocode; displayAttributeData in

aimsIDentify.js; fullExtent, startExtent, zoomBack, zoomToPoint, zoomToEnvelope,

zoomScale, zoomButton, and panButton in aimsMap.js; ovMapClick, zoomin, zoomout,

stopZoomBox, stopZoomOutBox, stopPan, and pan in aimsNavigation.js; showHighlight

in aimsSelect.js; and process XML in aimsXML.js.

在aimsXML.js文件中的sendMapXML()函数内容为:

function sendMapXML() {

beforeMapRefresh();

showRetrieveMap();

var theText = writeXML();

if (debugOn==2) alert(msgList[12] + theText);

sendToServer(imsURL,theText,1);

}

其中:writeXML()写出对新地图的request XML,要修改就对writeXML()进行修改

writeXML()

Arguments:

None

Returned Value:

String ArcXML request string to be sent to the ImageServer.

Description:

Writes an ArcXML request for a new map image. This is the default request sent for a main map display image.

用到的变量为: eLeft, eRight, eTop, eBottom, iHeight, iWidth, aimsLayersPresent, toggleVisible, layerCount,

aimsClassRenderPresent, mapBackColor, aimsLegendPresent, legendVisible, aimsBufferPresent,

showBuffer, aimsSelectPresent, showGeocode, geocodeX, geocodeY, geocodePointColor,

geocodePointSize, geocodeLabel, aimsClickPresent, clickCount, selectColor, clickType,

clickMarkerColor, clickMarkerType, clickMarkerSize, aimsCustomPresent, drawCopyright,

CopyrightCoords, CopyrightText, CopyrightStyle, CopyrightSize, CopyrightFont, CopyrightColor,

CopyrightBackground, CopyrightBGColor, CopyrightGlow, CopyrightGlowColor, drawNorthArrow,

NorthArrowType, NorthArrowSize, NorthArrowCoords, NorthArrowAngle, drawScaleBar,

ScaleBarbackColor, ScaleBarFont, ScaleBarStyle, ScaleBarColor, MapUnits, scalebarFontColor,

ScaleBarUnits, ScaleBarPrecision, ScaleBarSize, ScaleBarWidth, drawModeOnMap, modeBlurb,

modeMapColor, and modeMapGlow and LayerVisible, LayerID, clickPointX, and clickPointY arrays.

Calls: addSpecialRenderToMap in aimsClassRender.js (custom sample); addBufferToMap in aimsBuffer.js;

addLegendToMap in aimsLegend.js; addCustomToMap1, addCustomToMap2, addCustomToMap3,

and addCustomToMap4 in aimsCustom.js; addSelectToMap in aimsSelect.js; and getScaleBarDistance

in aimsMap.js.

Called by: clickAddPoint, resetClick, and deleteClick in aimsClick.js; getLegend in

aimsLegend.js; getPrintMap in aimsPrint.js; clearSelection in aimsSelect.js; and

sendMapXML and justGetMap in aimsXML.js.

File:

aimsXML.js

其中sendMapXML()函数最后调用:

sendToServer(URLString,XMLRequest,theType)

Arguments:

URLString -- String containing service URL for request.

XMLRequest -- String containing ArcXML request.

theType -- Numeric representing mode number to be passed to XMLMode. Used by processXML in passing ArcXML response to appropriate function for processing.

Returned Value:

None

Description:

Used to pass ArcXML requests on to the server(s). This function updates the form in the PostFrame page

(jsForm.htm) with the current request and processing function name.

Calls: showRetrieveMap, hideRetrieveMap, and hideRetrieveData in aimsMap.js.

Called by: functions sending ArcXML requests to the server(s).

File:

aimsXML.js

////////////////////////////////////////////////////////////////////////

// aimsCustom.js

// 缺省生成的aimsCustom.js是添加用于定制函数的模版

////////////////////////////////////////////////////////////////////////

//***************************************地址匹配函数******************************************

/*

* 函数名 addressLocation

* 描 述 在地图上显示地址匹配坐标点

* 参数说明 x,y:地址匹配坐标点的地图坐标

* name :地址匹配点的地图标识

* 返回结果 无

* 使用的公共变量 limitRight limitLeft limitTop limitBottom selectPointMargin

*

* aimsMap.js中的

* eLeft (Numeric/Dynamic) Current extent left (minimum x-coordinate).

* Formerly called left.

* eRight (Numeric/Dynamic) Current extent right (maximum x-coordinate).

* Formerly called right.

* eTop (Numeric/Dynamic) Current extent top (maximum y-coordinate).

* Formerly called top.

* eBottom (Numeric/Dynamic) Current extent bottom (minimum y-coordinate).

* Formerly called bottom.

* showGeocode (Boolean/Dynamic) If true, map request will include

* command to draw point at geocodeX, geocodeY

* with an optional label. Updated by viewer on

* response of address match request or

* zoomToPoint() function.

* geocodeX (Numeric/Dynamic) Geocode point x-coordinate. Updated by

* viewer on address match response or

* by zoomToPoint().

* geocodeY (Numeric/Dynamic) Geocode point y-coordinate. Updated by

* viewer on address match response or

* by zoomToPoint().

* 调 用 sendMapXML(aimsXML.js)

* 被调用

*/

function addressLocation(x,y,name){

legendVisible=false;

hasTOC=false;

var mWMargin = 0;

var mHMargin = 0;

mWMargin = Math.abs(limitRight-limitLeft) * (selectPointMargin/10);

mHMargin = Math.abs(limitTop-limitBottom) * (selectPointMargin/10);

saveLastExtent();

eLeft = parseFloat(x) - parseFloat(mWMargin);

eRight = parseFloat(x) + parseFloat(mWMargin);

eTop = parseFloat(y) + parseFloat(mHMargin);

eBottom = parseFloat(y) - parseFloat(mHMargin);

showGeocode=true;

geocodeX=x;

geocodeY=y;

geocodeLabel=name;

sendMapXML();

}

/*****************************************************************************

* aimsXML.js

* send the created xml request to map server

*/

function sendMapXML() {

// ask for the Main map

//window.onerror=clearError;

beforeMapRefresh();

//window.onerror=resetError;

showRetrieveMap();

var theText = writeXML();

if (debugOn==2) alert(msgList[12] + theText);

//alert(theText);

//hasTOC=false;

sendToServer(imsURL,theText,1);

}

/*****************************************************************************

*function writeXML()

接收response

processXML(theReplyIn)

Arguments:

theReplyIn--String containing returned ArcXML response.

Returned Value:

None

Description:

Passes the ArcXML response to the appropriate function for processing. The key global is XMLMode,which determines which function to call,即设定XMLMode就可以决定processXML(theReplyIn)调用哪个分析response XML的函数。

Calls: appropriate function to parse ArcXML response.

Called by: passXML in dynamic connector-created page in PostFrame on loading.

File:

aimsXML.js

全局变量XMLMode的值<1000,由processXML(theReplyIn)调用其默认函数,>1000即用户自定义时,processXML(theReplyIn)调用useCustomFunction()函数。全局变量XMLMode在aimsXML.js中定义(见Customizing ArcIMS: HTML Viewer第308<315>页)。

useCustomFunction(theReply)

Arguments:

theReply String containing returned ArcXML response.

Returned Value:

None

Description:

Available for custom processing of returned ArcXML responses. The function processXML will call this function if the value of the global XMLMode is 1,000 or greater.

Uses: XMLMode.

Calls: hideLayer in aimsDHTML.js.

Called by: processXML in aimsXML.js.

File:

aimsCustom.js

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
>>返回首页<<
推荐阅读
 
 
频道精选
 
静静地坐在废墟上,四周的荒凉一望无际,忽然觉得,凄凉也很美
© 2005- 王朝网络 版权所有