Analysis of flex point plane/line plane intersection

Source: Internet
Author: User
Tags polyline

<FX: declarations>
<! -- Place non-visual elements (such as services and value objects) Here -->
<! -- Used for Geometric Analysis (intersection) -->
<ESRI: geometryservice id = "geoser" url = "" intersectcomplete = "geoser_intersectcompletehandler (event)" fault = "geoser_faulthandler (event)"/>
<! -- Query the geometric information of featurelayer -->
<ESRI: querytask id = "qt1" showbusycursor = "true" useamf = "false" url = ""/>
<ESRI: query ID = "Q1" outspatialreference = "{mymap. spatialreference}" returngeometry = "true"/>

</FX: declarations>

<ESRI: Map id = "mymap" logovisible = "false" zoomslidervisible = "false" scalebarvisible = "true">
<ESRI: arcgisdynamicmapservicelayer id = "baselayer" visible = "false" load = "callhtml ()"/>
<ESRI: featurelayer id = "featurelayer" visible = "true" graphicadd = "featurelayer_graphicaddhandler (event)"/>
<ESRI: graphicslayer id = "graphicslayer" visible = "true"/>
</ESRI: Map>

<S: button id = "btnfx" label = "analyze the actual sea area" Click = "FX (event)"/>

 

Script:

Private var arr: array = NULL;
Private var arrsname: array = NULL;
Private var strval: String = "";
Private var index: Int = 0;

// When loading the page, query the featurelayer's geometric information stored in arr and the name stored in arrsname to obtain the corresponding name at intersection.
Private function doquery (): void
{
Qt1.url = featurelayer. url. Replace ("featureserver", "mapserver ");

Q1.where = "1 = 1 ";
Q1.outfields = new array (["sea name"]);

Qt1.execute (Q1, new asyncresponder (onresult, onfault ));
Function onresult (featureset: featureset, Token: Object = NULL): void
{
// No code needed in this simple sample, since
// Graphics layer is bound to the query result using
// Graphicprovider = "invalid querytask.exe cutelstresult. Features }"

VaR arrnew: array = new array (featureset. features );
Arr = new array ();
Arrsname = new array ();
For (var I: Int = 0; I <arrnew [0]. length; I ++)
{
Arr. Push (arrnew [0] [I]. Geometry );

Arrsname. Push (arrnew [0] [I]. Attributes. Sea name );
}
}
Function onfault (Info: object, Token: Object = NULL): void
{
Alert. Show (info. tostring (), "query problem ");
}
}

 

// Result of intersection of line and Surface
Protected function geoser_intersectcompletehandler (Event: geometryserviceevent): void
{

// Todo auto-generated method stub arrval is the surface geometric object featurelayer, arrsname is the name of the stored sea area, and arrarea stores the source data whose surface name information is the drop-down box.
VaR arrval: array = event. result as array;
For (var I: Int = 0; I <arrval. length; I ++)
{
VaR mypolygon: polyline = arrval [I] As polyline;
// If the intersection object is not empty
If (mypolygon. extent. xmax> 0)
{
VaR D: extent = mypolygon. extent;
Arrdg1 [Index]. areaname = arrsname [I]. tostring ();

For (var j: Int = 0; j <arrarea. length; j ++)
{
If (arrarea [J]. Label = arrdg1 [Index]. areaname)
{
Arrdg1 [Index]. sindex = J;
Dg1.dataprovider = arrdg1;
Break;
}
}

Break;
}
}
Index ++;

If (Index = arrdg1.length)
{
// Remove the cursor in the green state
Cursormanager. removebusycursor ();
}
}

 

Public Function FX (Event: mouseevent): void
{

// Set the busy green state of the cursor
Cursormanager. setbusycursor ();

Strval = ""; // clear
Index = 0;
For (var I: Int = 0; I <graphicslayer. numgraphics; I ++)
{
VaR gra: graphic = graphicslayer. getchildat (I) as graphic;
If (GRA. Id. indexof ("P _") = 0)
{
// The assembly line is used for intersection when an intersection surface object is obtained
VaR MP: mappoint = gra. Geometry as mappoint;
VaR MP1: mappoint = new mappoint (MP. x + 0.0001, MP. Y + 0.0001 );
VaR MP2: mappoint = new mappoint (MP. x-0.0001, MP. y-0.0001 );

VaR P: polyline = new polyline (new array ([MP2, MP, MP1]), mymap. spatialreference );

If (index % 4 = 0)
Strval + = gra. Id. substr (2) + ": {" + index + "} \ n ";
Else
Strval + = gra. Id. substr (2) + ": {" + index + "}";

Index ++;
Geoser. Intersect (ARR, P, null );

}
}

Index = 0;
}

 

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.