Initial Development of ArcGIS Server-custom tools

Source: Internet
Author: User
In fact, this can only be counted as one reading note. CJ has long written about how to customize the tool. I just went into depth and sorted it out. It can be used for fast query.

ArcGIS 9.2 Server Enterprise for Windows custom tool

In the web app generated by the server, the tool buttons on the page can be divided into two types:

L command: a command is an element on a JSP page that triggers a server side action without any further interaction on the client. an example of a command in the sample application is the "zoom to full extent" button. once the user clicks the button, a method is called on the server. Does not interact with users through the interface.
L tool: A tool has further client side interaction before calling a method on the server. an example of a tool in this application is "zoom to rectangle ". once the user clicks the button, drags a rectangle over the map indicating the area they want to zoom to, and then a method is called on the server. Interact with the user through the interface.

Custom tools

I. inherited Interfaces
PublicInterfaceCom. ESRI. ADF. Web. Faces. event.Maptoolaction {
Void execute (mapevent event );
}
The lmaptoolaction interface represents the server tool activated by the mapcontrol event. The system has preset the class that inherits this interface:
Pantoolaction (translation ),
Zoomintoolaction (zoom in ),
Zoomouttoolaction (zoom out)
Lmapcontrol creates a mapevent event and sends it to the execute (mapevent) function of the tool class of the inherited interface. The business logic for the tool shocould be implemented in this method according to the event.

II. The Tag expression of the tool on the JSP page is as follows:

[Copy to clipboard] [-]

Code:

<AGS: Tool
Serveraction = "com. ESRI. ADF. Web. Faces. event. zoomintoolaction"
Clientaction = "esrimaprectangle"
Clientpostback = "true"
/>


3. Register managed-bean to register the written class as a managed-bean to the faces-config.xml and useWebcontextInstance as its initialization parameter:

[Copy to clipboard] [-]

Code:

<Managed-bean>
<Managed-bean-Name> toolclass </managed-bean-Name>
<Managed-bean-class> com. brsc. mytoolclass </managed-bean-class>
<Managed-bean-scope> request </managed-bean-scope>
<Managed-property>
<Property-Name> webcontext </property-Name>
<Value >#{ mapcontext} </value>
</Managed-property>
</Managed-bean>


Iv. Notes:
1. Tag in JSPServeractionThe write class that inherits the maptoolaction interface (full name) represents the operations to be performed on the tool server [Execute (mapevent event)]
You can also use any managed bean function as the tool's corresponding method, as long as this function uses the following declaration:
Public void anymethodname (mapevent event)
JSP label usageServermethod, As follows:
<AGS: ToolServermethod= "# {Bean. anymethodname}".../>
In this way, mapcontrol also passes the appropriate mapevent event to this function.

2. Tag in JSPClientactionWrite client mouse selection method:

[Copy to clipboard] [-]

Code:

Esrimappoint
Esrimapline
Esrimaprectangle Quadrilateral
Esrimapcircle circle
Esrimapoval oval
Esrimappolyline multi-line
Esrimappolygon Polygon
Esrimappan mobile




Corresponding to the geometric shape of the server end (figure)

3. mapevent indicates the events generated by operations on the client.
Public webgeometryGetwebgeometry ()Function to obtain the geometric shape of the client input.
// ReturnsWebgeometryInScreen coordinatesCorresponding
// The client action was med by the user.
To obtain the shape generated by the client. These geomentry coordinates are generally screen coordinates, which must be convertedMap coordinates.
The general operation is as follows:

[Copy to clipboard] [-]

Code:

Public void mytoolmethod (mapevent event ){
Webcontext CTX = event. getwebcontext ();
Webgeometry screengeom = event. getwebgeometry ();
Webgeometry mapgeom = screen. tomapgeometry (CTX. getwebmap ());
...
}



4. Tag in JSPClientpostback
LSet to false. Refresh the map and refresh the page;
LSet to true. Only refresh the map without refreshing the page;

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.