ArcGIS for flex Study Notes (1)

Source: Internet
Author: User
Tags polyline
Preliminary understanding

A map consists of layers, elements, and styles. There are N layers on the map, and there are n elements on the layer. Each element can store points, lines, and surfaces, and each element can set a style, if an image or text is displayed, you can create an mxml component and set it to the element.

Both the surface and line are composed of points.

Add point

1. initialize the graphicslayer.

2. Obtain the coordinate point and mappoint.

3. Create an element, graphic.

4. Set the style symbol.

5. add elements to the layer, which is the Layer Created in step 1.

Add line

An additional step is taken on the basis of adding a vertex.

Obtain multiple points. You can instantiate a line Object and add the line to the point.

// Construct line Object var pline: polyline = new polyline (); // Add point data to line pline. addpath (xydata );

The other steps are the same. xydata is a mappoint array.

Add a plane

Like the logic for adding a line, a plane is composed of N points. The core code is as follows:

                var area:Polygon=new Polygon();                area.addRing(xydataArea);
Layer

Layers are added sequentially, such as the zindex attribute of HTML. The first attribute to be added is shown below. If you want to add a plane and a line at the same time, and the line is to be clicked, the layer of the line should be above the surface.

Highlighted and flashing

Create a symboltoggleeffect object, set its style, start the animation in the Mouseover event, and end the animation in the mouseout event.

Private Static Var symboltoggleeffect: simplefilterstoggleeffect; // highlighted object Private Static Var filtermarker: glowfilter = NULL; // highlighted Style Private Static Var simfilterarray: array = []; // filter the object array public static function drawvehareaover (EVT: mouseevent): void {If (symboltoggleeffect) symboltoggleeffect. end (); var targetgarphic: graphic = EVT. currenttarget as graphic; // obtain the layer var layer: graphicslayer = getarealayer (); // find the slow Punch area layer. If yes, VAR currarea: graphic = findgraphicbyattr (layer, "areaid", targetgarphic. attributes. userid); If (currarea) {currarea. visible = true; // start to highlight if (! Symboltoggleeffect) {If (! Filtermarker) {initsyle () ;}symboltoggleeffect = new simplefilterstoggleeffect (currarea, null, simfilterarray, 500);} symboltoggleeffect. play () ;}// Ang is the initialization Private Static function initsyle (): void {// highlight style if (! Filtermarker) {var objselectedhouse: Object = rglobal. mapurlarraylist ["featurestyles"]. selecthouse; filtermarker = new glowfilter (); filtermarker. color = objselectedhouse. fillcolor; filtermarker. blurx = 20; filtermarker. blury = 20; filtermarker. alpha = objselectedhouse. fillopacity; filtermarker. strength = 2; simfilterarray. push (filtermarker) ;}}/* line element removal */public static function drawvehareaout (EVT: mouseevent): void {If (symboltoggleeffect) symboltoggleeffect. end (); var targetgarphic: graphic = EVT. currenttarget as graphic; // obtain the layer var layer: graphicslayer = getarealayer (); // find the buffer layer. If yes, hide var currarea: graphic = findgraphicbyattr (layer, "areaid ", targetgarphic. attributes. userid); If (currarea) {currarea. visible = false ;}}

 

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.