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