Dynamic plotting (1.2) based on ArcGIS Flex API, arcgisflex
Dynamic plotting API 1.2, compared with the previous version (click to enter), this version adds support for basic plotting symbols, including:
Single point, multi-point, line, hand-drawn line, polygon, hand-drawn polygon, and rectangle, and provide corresponding editing functions.
Edit multiple points, as shown in.
Indicates the tank with a single point, And a multi point indicates the battle fleet.
The instance code is as follows:
Private var plotDrawTool: PlotDrawTool; private var plotEditTool: PlotEditTool; private var outline: SimpleLineSymbol = new SimpleLineSymbol ("solid", 0xff0000, 1, 1); private var markerOutline: simpleLineSymbol = new SimpleLineSymbol ("dash", 0x000000, 1, 2); private var tank: PictureMarkerSymbol = new PictureMarkerSymbol ("assets/tank.png"); private var plane: pictureMarkerSymbol = new versions ("assets/plane.png"); private var markerSymbol: SimpleMarkerSymbol = new SimpleMarkerSymbol ("circle", 25, 0xff0000, 1, 0, 0, 0, markerOutline ); private var multiMarkerSymbol: SimpleMarkerSymbol = new SimpleMarkerSymbol ("circle", 25, 0x00ff00, 1, 0, 0, 0, markerOutline); private var lineSymbol: simpleLineSymbol = new SimpleLineSymbol ("dash", 0x0000ff, 1, 2); private var fillSymbol: SimpleFillSymbol = new SimpleFillSymbol ("solid", 0x00ff00, 0.5, outline ); private static const STATE_MOVE_SCALE_ROTATE: int = 0; private static const STATE_EDIT_CONTROL_POINTS: int = 1; private var editState: int = 0; private var activePlot: Graphic; private function init (): void {// instantiate the plotting tool this. plotDrawTool = new PlotDrawTool (map); // listens to the DRAW_END event and obtains plotthis after drawing. plotDrawTool. addEventListener (PlotDrawEvent. DRAW_END, drawEndHandler); // instantiate the editing tool this. plotEditTool = new PlotEditTool (map);} private function drawEndHandler (event: PlotDrawEvent): void {// set the rendering symbol var geometry: Geometry = event for the plot. plotGraphic. geometry; if (geometry is Polygon) event. plotGraphic. symbol = fillSymbol; else if (geometry is Polyline) event. plotGraphic. symbol = lineSymbol; else if (geometry is MapPoint) event. plotGraphic. symbol = tank; else if (geometry is Multipoint) event. plotGraphic. symbol = plane; // display this. graphicsLayer. add (event. plotGraphic); // sets the event response when the mouse clicks the event. plotGraphic. addEventListener (MouseEvent. CLICK, graphicClickHandler);} private function graphicClickHandler (event: MouseEvent): void {var graphic: Graphic = event. currentTarget as Graphic; if (graphic = this. activePlot) {if (this. editState = STATE_MOVE_SCALE_ROTATE) {// enable the move + edit control point status this. plotEditTool. activate (PlotEditTool. MOVE | PlotEditTool. EDIT_CONTROL_POINTS, graphic); this. editState = STATE_EDIT_CONTROL_POINTS;} else {// enable the Movement + rotation and scaling status this. plotEditTool. activate (PlotEditTool. MOVE | PlotEditTool. SCALE_ROTATE, graphic); this. editState = STATE_MOVE_SCALE_ROTATE;} else {this. activePlot = graphic; this. plotEditTool. activate (PlotEditTool. MOVE | PlotEditTool. EDIT_CONTROL_POINTS, graphic); this. editState = STATE_EDIT_CONTROL_POINTS ;}}
Click to download the sample code
You are welcome to use and provide feedback.
QQ: 21587252 email: gispace@yeah.net
You can also join the dynamic plotting discussion QQ Group318659439To discuss the specific requirements and implementation.
What is the difference between arcgis api for flex and flex? Just import the api in flex? Or two completely different things.
A flex development component can be referenced. The component provides visual components and access interfaces to implement many GIS functions, however, the presentation of special effects is more practical through as3.
ArcGIS API for Flex release
1. ArcServer releases the map service...
2. Deploy your web application in iis or tomcat. For release and use, the main issue of cross-origin flex is to place a cross-origin Configuration Policy of crossdomain. xml in the webroot server. This policy can be applied online... Otherwise, you cannot access the map service in ArcServer...
3. Enter the URL to view your application.