Ajax in ArcGIS Web Application Development Framework (ADF)

Source: Internet
Author: User
I hope you will understand the built-in Ajax in. Net well before reading this article. If you do not understand it very well, I suggest you read my previous blog post. Net built-in Ajax working principles first.

The Web application development framework of ESRI ArcGIS Server 9.2 fully utilizes the callback Technology in ASP. NET. Let's take a look at how to use callback in the default application created using the Visual Studio template.

The default webmapapplication class corresponding to default. aspx implements the icallbackeventhandler interface. We will use the identify tool to gain an in-depth understanding of the application development framework. In the load event processor of the webmapapplication class, call New mapidentify (map1) to initialize the identify tool. The setupidentify method is called in the constructor of the mapidentify class. This method first generates a client script by calling the getcallbackeventreference method, and then calls registerclientscriptblock to register a JavaScript function named identifycallbackfunctionstring, which calls the generated client script. In the display_mapidentify.js file, the mapidclick function (identify event processor) calls the identifycallbackfunctionstring function, triggering the raisecallbackevent method of the webmapapplication class. The raisecallbackevent method not only processes identify tools, but also other tools. This example includes disabling applications and obtaining copyrighted text. To determine which tool initiated the method call in this method, you need to include in the input parameter that indicates the call "identity ". At the same time, because other information may be required in the input parameters, such as the identify tool, not only need to indicate the identity of the caller, but also the X and Y coordinates of the current user click. To interpret all the information in the raisecallbackevent method, this example uses the "parameter name 1 = parameter value 1 & parameter name 2 = parameter value 2" formula. For example, in the mapidclick function, "controlid = map1 & controltype = map & eventarg = mapidentify & map1_mode = mapidentify & Minx =" + zleft + "& miny =" + ztop the raisecallbackevent method (or a WebService method called in raisecallbackevent, A custom class method), by calling split ("&". the tochararray () method places each "parameter name = parameter value" in an array, then, separate "parameter name" from "parameter value" by creating a hash table. The specific code is as follows: String [] keyvaluepairs; // array containing "="
String [] keyValue; // only an array of strings
Namevaluecollection m_querystring = new namevaluecollection (); // a set of key-value pairs

Keyvaluepairs = eventargument. Split ("&". tochararray (); // eventargument is the parameter passed in by the client.
If (keyvaluepairs. length> 0) // If the passed parameter is arga = arg1 & argb = arg2 ...... Format, that is, more than one parameter
{
For (INT I = 0; I <keyvaluepairs. length; I ++)
{
KeyValue = keyvaluepairs. getvalue (I). tostring (). Split ("=". tochararray ());
M_querystring. Add (keyValue [0], keyValue [1]);
}
}
Else // only one passed Parameter
{
KeyValue = eventargument. Split ("=". tochararray ());
If (keyValue. length> 0) // If a parameter is passed
{
M_querystring. Add (keyValue [0], keyValue [1]);
}
}
// Call the parameter value through htquerystring ["eventarg "].
Return "the name of the tool you selected is:" + m_querystring ["eventarg"]. tostring (); after executing the appeal code, you only need to call m_querystring ["eventarg"] to determine which tool to start the method call. For the identify tool, the value is mapidentify. After the call tool is identified as identify, the raisecallbackevent method calls the identify method of the mapidentify class to obtain the returned value.
By parsing Ajax in ARCserver ADF, it is not difficult to understand why the map refresh in the WebGIS product developed by ARCserver ADF is so fast .............

Related Article

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.