Experience of developing Web GIS using ArcGIS Server (2)

Source: Internet
Author: User

We know that the map component and TOC component provided by. Net ADF are all standard Asp.net components. These components generate the corresponding htmlCode, Show yourself. In general, viewstate is used to save the status and generate the _ dopostback (JavaScript) function. When necessary, JavaScript is used to call the function and return client data to the server, to stimulate the response of the server. In short, we can analyze the generated HTML page to see how the Asp.net component runs.
Now, press F5 to run the homepage, and then viewSource codeTake a look:

1. First, we will see the ID, mapidclick, start and other JavaScript Functions, which are generated by the template and defined in the default. aspx file. The ID function has two rows:
VaR iddiv = Document. getelementbyid ("mapdiv_map1 ");
If (iddiv! = NULL) iddiv. onmousedown = mapidclick;

As you can see, these functions are used to process the map identify (click to query.
Why is it here? Why is it defined here only by the JavaScript code for clicking the query? Why is it not handled here? This is because the toolbar component provides default processing methods for amplification, zoom-out, and translation, but identify does not, which makes it easier to expand. The following code contains a line <ESRI: tool tooltip = "identify" defaultimage = "images/identify.gif" clienttoolaction = "ID ()" name = "identify"...>, we can see that this call is generated by the template (and this call can be modified ). We can see this in further analysis.

2. Next, there are several hidden domains, including the _ viewstate hidden domain and the _ dopostback function. These are generated by the Asp.net component and used to submit data to the server, to interact with the server.

3. We can see some Code that introduces the JS script file:
<Script language = "JavaScript" src = "/aspnet_client/esri_arcgis_server_webcontrols/9_1/JavaScript/common. js"> </SCRIPT>
<Script language = "JavaScript" src = "/aspnet_client/esri_arcgis_server_webcontrols/9_1/JavaScript/map_functions.js"> </SCRIPT>
<Script language = "JavaScript" src = "/aspnet_client/esri_arcgis_server_webcontrols/9_1/JavaScript/overview_functions.js"> </SCRIPT>
<Script language = "JavaScript" src = "/aspnet_client/esri_arcgis_server_webcontrols/9_1/JavaScript/toolbar_functions.js"> </SCRIPT>
We can see that a total of four JS script files are introduced, and the addresses of these files are also strange, not in the same virtual directory as the current website, but in http: // localhost // aspnet_client/esri_arcgis_server_webcontrols/9_1/JavaScript directory. You can find these files in the C:/inetpub/webroot/aspnet_client/esri_arcgis_server_webcontrols/9_1/JavaScript/folder. Originally, to facilitate reuse, when installing ArcGIS Server Program A virtual directory has been created to provide these shared resources. In the first-level directory of this folder, you can also see the images and treeimages sub-directories, as well as the Treeview. HTC file.
Once you know the hiding place of these JavaScript files, you can read these JavaScript files one by one and find that they are mainly used to interact with browsers.

4. Next, the HTML code of the TOC component. The code snippet is as follows:
<Tvns: treenode expanded = "false" defaultstyle = "color: Silver;" imageurl = "/aspnet_client/esri_arcgis_server_webcontrols/9_1/images/outscale.gif" checkbox = "false">
Road note <tvns: treenode expanded = "true" imageurl = "ESRI. Web. Controls. mimeimage. aspx? Imgid = default. aspx_toc1_0_1_0_0 & amp; nocache = true "> </tvns: treenode>
This piece of code has a special feature: imageurl = "ESRI. web. controls. mimeimage. aspx... ", this ESRI. web. controls. mimeimage. what is aspx? Is it a webpage? Find out in the machine and find that this webpage does not exist at all. So what is its sacredness? Can it be used as an image address? Let's take a look.

5. <Div id = 'overviewmap1backdrop' style = 'position: absolute; left: 16px; top: 400px; width: 204px; Height: 124px;

Z-INDEX: 104; border-color: lightsteelblue; border-width: 3px; border-style: solid; overflow: hidden; '>
<Table cellspacing = 0 cellpadding = 0 style = 'width: 198px; Height: 118px; overflow: hidden; '> <tr> <TD id = ovcell_overviewmap1> </TD> </tr> </table>
</Div>
Is the code of the eagleeye navigation chart. How can I only have an empty Div layer and an empty table? Alas, it's relatively simple. I'm too lazy to analyze it. You can find it yourself ~

6. There is nothing special about the code of the toolbar component:
<TD nowrap width = "29" Height = "32" align = 'center'
Id = "toolbar1zoomin"
Onmousedown = "toolbarmousedown ('toolbar1', 'zoomin', 'tool', event );"
Onmouseover = "toolbarmouseover ('toolbar1', 'zoomin ');"
Onmouseout = "toolbarmouseout ('toolbar1', 'zoomin ');"
Style = "background-color: lightsteelblue; font-family: Arial; font-size: smaller; font-weight: bold ;"
> </TD>

7. the following code generates the map component:
<Script language = "JavaScript" id = "cs_dynamic_map1">
Maps [mapcounter] = new mapcreation ('map1', 0, mapcounter, 502,378, 'mapdiv _ map1', 'black', 2 );
Mapurl [mapcounter] = "ESRI. Web. Controls. mimeimage. aspx? Imgid = default. aspx-Map1 & Ct = 5 ";
Makemapdiv (mapcounter, 'map1', 'esri. Web. Controls. mimeimage. aspx? Imgid = default. aspx-Map1 & Ct = 5', 'mapcell _ map1 ','');
Mapcounter ++;
Mapdragrectangle ('map1', 'zoomin', true );
</SCRIPT>
I saw the mimeimage! What exactly is it?
If you are not familiar with Asp.net, it may be difficult to crack this secret.
In Asp.net, all requests are processed through httphandler. What is httphandler? As long as the class implemented in the ihttphandler interface can be used as an httphandler. In the Web. config or machine. config file, you can define which requests can be processed by httphandler. Check the Web. config file without these declarations. Take a look at mapchine. the config file is in Windows \ Microsoft. net \ framework \ v1.1.4322 directory, open it with notepad, find ESRI. web. controls. mimeimage. aspx, good guy. It's really here!
<Httphandlers>
<Add verb = "*" Path = "ESRI. web. controls. mimeimage. aspx "type =" ESRI. arcGIS. server. webcontrols. imagehandler, ESRI. arcGIS. server. webcontrols, version = 9.1.0.722, culture = neutral, publickeytoken = 8fc3cc631e44ad86 "/>
The original ESRI. Web. Controls. mimeimage. aspx request can be processed by ESRI. ArcGIS. server. webcontrols. imagehandler. In Visual Studio, you can view the ESRI. ArcGIS. server. webcontrols. dll file in the image browser. You can see the imagehandler class, which actually implements the ihttphandler interface. It's actually quite simple. We can also write a class to execute custom requests.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.