Post) How to Select a circular area in Application Development of ArcIMS?

Source: Internet
Author: User
Content summary
In the Application Development of ArcIMS-based Web GIS, whether through HTML Viewer, ActiveX Connector or Java Connector, we often need to provide circular selection tools, select any 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 buffer, therefore, the Buffer function provided by ArcIMS 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 a 48-side Inner Shape close to the Circle Based on the provided center and radius, and then use this polygon object and Filter to 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. The sample code is as 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 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.