How to select a circular area in ArcIMS application development?

Source: Internet
Author: User

InArcIMSOfWeb GISIn application developmentHTML viewer,OrActiveX ConnectorOrJava ConnectorWe often need to provide a circular selection tool to select the center and radius on the map, and then find the elements in a layer within the circular area. In this case, because the circle center is not from a point layer, and this circle is not generated by the point elements in the layer through the bufferArcIMSProvidedBufferThe buffer function cannot be called directly. In this case, we can adopt other alternatives.

Process description

In this article, we use the inner Polygon method of the circle. The principle is to generate an inner close to the circle according to the provided center and radius.48Edges, and then combine them with the polygon objectFilterTo query the space. Of course, the closer the number of edges of the inner polygon is to the circle, the more accurate the query result is. ExampleCodeAs follows:

// Java
Public polygon createcirlepolygon (point PNT, double dradius ){
Double sinetheta, cosinetheta, twopi;
Int numpoints = 48 ;//Number of edges of the inner Polygon
Polygon poly = new polygon ();
Points PNTs = new points ();
Twopi = 3.1415*2.0;
//Create a polygon
For (INT I = 0; I <numpoints; I ++)

{
Point CPT = new point ();
Sinetheta = math. Sin (twopi * (I * 1.0/numpoints ));
Cosinetheta = math. Cos (twopi * (I * 1.0/numpoints ));
CPT. setx (PNT. getx () + dradius * cosinetheta );
CPT. sety (PNT. Gety () + dradius * sinetheta );
PNTs. addpointobject (CPT );

}
PNTs. addpointobject (PNTs. getpointobject (0 ));
Ring = new ring ();
Ring. setpoints (PNTs );
Poly. addring (ring );
Return poly;
}

// ASP. NET
Public imspolympus Gon createcirlepolygon (imspoint PNT, double dradius)
{
Imspolympus Gon poly = new imspolympus Gon ();
Double sinetheta, cosinetheta, twopi;
Int numpoints = 48 ;//Number of edges of the inner Polygon

Imspoints PNTs = new imspoints ();
Twopi = 3.1415*2.0;

//Create a polygon
For (INT I = 0; I <numpoints; I ++)
{
Imspoint CPT = new imspoint ();
Sinetheta = math. Sin (twopi * (I * 1.0/numpoints ));
Cosinetheta = math. Cos (twopi * (I * 1.0/numpoints ));
CPT. x = (PNT. x + dradius * cosinetheta );
CPT. Y = (PNT. Y + dradius * sinetheta );
PNTs. Add (CPT );
}
PNTs. Add (PNTs [0]);
Imsparts parts = new imsparts ();
Parts. Add (PNTs );
Poly. parts = parts;
Return poly;
}

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.