本文共 1137 字,大约阅读时间需要 3 分钟。
package com.gis{ import com.esri.ags.SpatialReference; import com.esri.ags.geometry.MapPoint; import com.esri.ags.geometry.Polygon; public class Circle extends Polygon { private var pointNum:int = 100; /** * @param center 圆心 * @param radius 半径 * @param spatialReference 空间参考 * */ public function Circle(center:MapPoint, radius:Number, spatialReference:SpatialReference=null) { super(null, spatialReference); this.addRing(getPoints(center, radius)); } private function getPoints(center:MapPoint, radius:Number):Array { var x:Number; var y:Number; var points:Array=[]; var angle:Number; for (var i:int=0; i < this.pointNum; i++) { angle = Math.PI * 2 * i / this.pointNum; x=center.x + radius * Math.sin(angle); y=center.y + radius * Math.cos(angle); points.push(new MapPoint(x, y)); } return points; } }}
转载地址:http://kzqwa.baihongyu.com/