BlueViewer is an example of secondary ArcIMS Development Based on. NET Link. It contains the most basic functions of WebGIS. For more information about the ArcIMS architecture and its introduction, see my another article "ArcIMS architecture". For an introduction to the. NET Link connector, see ArcIMS connector --. NET Link usage. Mars wrote an article on ArcIMS and made a simple analysis of BlueViewer.
Using. NET Link for Secondary Development of ArcIMS is not complicated, but many people who have just come into contact with GIS are still confused about JavaScript and ArcXML. This article analyzes the BlueViewer map loading and display mechanism to see how the entire code runs. The code language uses C #.
When HTML, ArcExplorer, and JavaViewer clients are used for development, you need to use JavaScript on the client to write and encapsulate ArcXML. Although the transmission process of ArcXML becomes relatively simple, however, human endurance is definitely a great test. Therefore, we generally recommend that you use various ArcIMS connectors for secondary development. BlueViewer is based on. NET Link for secondary development.
The main function of the connector is to encapsulate the request as ArcXML and transmit it to the ArcIMS Application Server Based on the client request, and extract the results (generally images) sent from the ArcIMS application server ), send to the client to respond to user requests. On the client side, the user's operations on the map and map display are still controlled by JavaScript. However, compared with the ArcXML writing on the client side, the workload should be reduced a lot, and the development method is more in line with OOP, where. NET Link is not very good in Object-Oriented aspects, but ASP. NET development ,. NET Link is the best choice.
The following is an analysis of the Map Display process started by the program.
----------------------------------------
There are five hidden fields in default. aspx: hvMinX, hvMinY, hvMaxX, hvMaxY, and hvMapPage. The first four objects describe the display range of the current map, and the last return the url of the map. The first step to start a program is to initialize these values, which are described in detail in default. aspx. cs.
Protected void Page_Load (object sender, System. EventArgs e)
{
If (! (IsPostBack ))
{
Session. Add ("VALID_USER", true );
HvMapPage. Value = "MakeMap. aspx ";
}
If (Request. queryString ["XMIN"] = null | Request. queryString ["YMIN"] = null | Request. queryString ["XMAX"] = null | Request. queryString ["YMAX"] = null ))
{
HvMinX. Value = System. Configuration. ConfigurationSettings. deleettings ["DEFAULT_EXTENT_XMIN"];
HvMinY. Value = System. Configuration. ConfigurationSettings. deleettings ["DEFAULT_EXTENT_YMIN"];
HvMaxX. Value = System. Configuration. ConfigurationSettings. deleettings ["DEFAULT_EXTENT_XMAX"];
HvMaxY. Value = System. Configuration. ConfigurationSettings. deleettings ["DEFAULT_EXTENT_YMAX"];
}
Else
{
HvMinX. Value = Request. QueryString ["XMIN"];
HvMinY. Value = Request. QueryString ["YMIN"];
HvMaxX. Value = Request. QueryString ["XMAX"];
HvMaxY. Value = Request. QueryString ["YMAX"];
}
}
In the <body/> of default. aspx, onload calls the startUp () method of main. js. In startUp (), four methods are called: posLoadingImage (), posBorder (), posBorderNavigation (), and posTools, they represent the "Loading" icon when the image is loaded, the zoom-in and zoom-out frame, the position of the orientation moving icon (A), and the position of the entire tool Status Bar (B, the position of the icon that depends on the orientation ). Then, use handleToolClick () to determine whether the current mouse operation is Zoom In or out (iToolMode = 1) or move the layer (iToolMode = 2 ), use m_txtXCoord and m_txtYCoord to initialize the display of the current X/Y coordinate (C ).
M_imgMapCanvas.onload = hideWaitImage;
This code shows the client's state cleanup work before the server responds to user operations. hideWaitImage is mainly used to clear the user's zoom-in and zoom-out boxes and hide the "Loading" icon.
So far, the program has completed all the work before sending ArcXML to the ArcIMS application server, including the display of the program interface and the client's response to the user interface operations. Next, is the user request sending and system server (Web application server, ArcIMS application server, and ArcIMS space server) response to the user request. This describes the process of starting a program and does not involve the actual operations on the map. However, the operations on the map are nothing more than a bunch of JavaScript code, it does not have much impact on subsequent program response processes. The submit () method is used to send a request and return the system server response.
Function submit (){
Var sURL = m_hvMapPage.value + "? XMIN = "+
M_mapViewer.getExtent (). getLeft () +
"& YMIN =" + m_mapViewer.getExtent (). getBottom () +
"& XMAX =" + m_mapViewer.getExtent (). getRight () +
"& YMAX =" + m_mapViewer.getExtent (). getTop () +
"& WIDTH =" + m_mapViewer.getTagWidth () +
"& HEIGHT =" + m_mapViewer.getTagHeight ();
UpdateZoomLevel (m_mapViewer.getLevel ());
ShowWaitImage ();
If (navigator. userAgent. indexOf ('netscape6/6')>-1 ){
M_lTimerID = setInterval ("hideWaitImageForNetscape6 ();", 100 );
}
M_imgMapCanvas.src = sURL;
PersistExtent ();
}
In default. hvMapPage in Page_Load () of aspx. value has been assigned as "MakeMap. aspx ", MakeMap is called. the aspx page starts its Page_Load () process. In this process, the ArcXML sending and system server response are encapsulated based on user requests. For specific procedures, see ArcIMS connector --. NET Link usage. The page returns the url of the image you need, defines the display range of the current map, assigns parameters to submit (), and passes persistExtent () methods The map ranges are stored in four hidden domains: hvMinX, hvMinY, hvMaxX, and hvMaxY.
At this point, the program completes the entire startup process, as shown in the interface. When users request services for operations, except for JavaScript operations, the other processes are basically the same. Familiar with JavaScript and XML, understanding the architecture and service request process of ArcIMS, and carrying out secondary development of. NET Link is still not complex. In the age of Ajax, the client request service and the process of responding to client requests were implemented using Ajax, which can get rid of the limitations of the frame framework and improve the logic structure of the Code, enhance the user experience of WebGIS.