ArcGIS flex API scaling-geometric chart

Source: Internet
Author: User
Tags polyline

ArcGIS flex API provides several common geometric figures, such as points, lines, and surfaces. When more geometric figures are needed, you need to expand the geometry in ArcGIS flex API. The general idea is to expand the polygon and the polyline of the linear ry. Polygon consists of an array of rings, while polyline consists of a path. Both ring and path are essentially an array of mappoint.

Take a star as an example:

Package gispace. arcgisapiex. geometry {import COM. ESRI. AGS. spatialreference; import COM. ESRI. AGS. geometry. mappoint; import COM. ESRI. AGS. geometry. polygon;/*** pentagram * @ author ropp **/public class Pentagon extends polygon {private var pointnum: Int = 5; /***** @ Param center point * @ Param majorradius long radius * @ Param minorradius short radius * @ Param spatialreference space reference **/Public Function Pentagon (center: mappoint, majorradius: number, minorradius: Number, spatialreference: spatialreference = NULL) {super (null, spatialreference); this. addring (getpoints (center, majorradius, minorradius);} private function getpoints (center: mappoint, majorradius: Number, minorradius: Number): Array {var X: Number; var y: number; var angle: Number; var points: array = []; var DIFF: Number = math. PI/This. pointnum; For (var I: Int = 0; I <this. pointnum; I ++) {angle = math. pI * 2 * I/This. pointnum; X = center. X + majorradius * Math. sin (angle); y = center. Y + majorradius * Math. cos (angle); points. push (New mappoint (x, y); angle + = diff; X = center. X + minorradius * Math. sin (angle); y = center. Y + minorradius * Math. cos (angle); points. push (New mappoint (x, y);} return points ;}}}

 

Based on the above understanding, we provide an extension of ArcGIS flex API geometry to implement the geometric figures shown in, including the arc, circle, elliptical, pentagram, isosceles polygon, and slice.

Instance code: http://download.csdn.net/detail/gispace/4323079

Source code: http://download.csdn.net/detail/gispace/4336435

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.