Summary
Methods:
setFromOptions |
根据扇形的扇心、半径、起始角度、结束角度(逆时针方向)创建扇形 |
clone |
复制拓展几何对象。 |
getBBox |
获取扇形的三维包围盒 |
getCoordSeqs |
获取扇形的坐标序列数组,其长度为1。 |
getType |
获取几何体类型 |
setCtrlPoints |
重新设置扇形的控制点。 |
toPolygon |
将扇形转化为面几何体 |
Constructor
new Sector(points, isSurround)
使用点几何体作为控制点构造扇形,控制点数量为3,不可以重复,扇形以第一个控制点为扇心,以第二个控制点为圆弧起点,逆时针方向以第三个控制点为圆弧终点。
Parameters:
Name | Type | Default | Description |
---|---|---|---|
points |
Array.<module:geom~Point> | 点几何体数组,数组长度小于3或非数组类型时,则抛出构造异常;当数组长度大于3时,取前3个点几何体作为控制点。 |
|
isSurround |
Boolean | false | 扇形两个边的角度相等的情况下,是否需要环绕,如果环绕,第二个变角度会增加360度。 |
Throws:
RangeError
|
TypeError
-
数组长度小于3或非数组类型,则抛出构造异常。
Example
let point1 = new hmap.geom.Point(new hmap.basetype.Coordinate(120,30,0));
let point2 = new hmap.geom.Point(new hmap.basetype.Coordinate(121,30,0));
let point3 = new hmap.geom.Point(new hmap.basetype.Coordinate(121,31,0));
let sectorGeom = new hmap.geomext.Sector([point1,point2,point3]);
Methods
-
static setFromOptions(options) → {module:geomext~Sector}
-
根据扇形的扇心、半径、起始角度、结束角度(逆时针方向)创建扇形
Parameters:
Name Type Description options
Object 可选项
Name Type Description center
module:basetype~Coordinate 扇心坐标
radius
Number 半径,同地图单位,可以通过地图对象上的getDegreePerMeter和getMeterPerDegree方法,对地图单位进行度和米的转换。
startAngle
Number 开始角度,单位为度,正东方向为0度方向
endAngle
Number 结束角度,与开始角度的角度差最大为360,正东方向为0度方向
Returns:
module:geomext~Sector -
clone() → {module:geomext~GeometryExt}
-
复制拓展几何对象。
-
getBBox() → {module:basetype~BBox}
-
获取扇形的三维包围盒
-
getCoordSeqs() → {Array.<module:basetype~CoordSeq>}
-
获取扇形的坐标序列数组,其长度为1。
Example
let coordSeqs = sectorGeom.getCoordSeqs();
-
getType() → {String}
-
获取几何体类型
Example
let type = sectorGeom.getType();
-
setCtrlPoints(points)
-
重新设置扇形的控制点。
Parameters:
Name Type Description points
Array.<module:geom~Point> 点几何体数组,数组长度小于3或非数组类型时,则抛出构造异常;当数组长度大于3时,取前3个点几何体作为控制点。
Throws:
RangeError | TypeError -数组长度小于3或非数组类型,则抛出构造异常。
Example
let point1 = new hmap.geom.Point(new hmap.basetype.Coordinate(121,30,0)); let point2 = new hmap.geom.Point(new hmap.basetype.Coordinate(122,30,0)); let point3 = new hmap.geom.Point(new hmap.basetype.Coordinate(122,31,0)); sectorGeom.setCtrlPoints([point1,point2,point3]);
-
toPolygon() → {module:geom~Polygon}
-
将扇形转化为面几何体
Example
let polygon = sectorGeom.toPolygon();