Summary
Methods:
setFromOptions |
根据扇形的扇心、半径、起始角度、结束角度(逆时针方向)创建扇形 |
getBBox |
获取扇形的三维包围盒 |
getCoordSeqs |
获取扇形的坐标序列数组,其长度为1。 |
getCtrlPoints |
获取控制点的几何数组 |
getType |
获取几何体类型 |
setCtrlPoints |
重新设置扇形的控制点。 |
toPolygon |
将扇形转化为面几何体 |
Constructor
new Sector(points)
使用点几何体作为控制点构造扇形,控制点数量为3,且不可以重复。
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(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:basetype~Coordinate}, 半径,同地图单位, 开始角度, 结束角度)
-
根据扇形的扇心、半径、起始角度、结束角度(逆时针方向)创建扇形
Parameters:
Name Type Description options
Object 可选项
{@module:basetype~Coordinate}
扇心坐标
半径,同地图单位
Number 开始角度
Number 结束角度
Number Returns:
-{@module:geomext~Sector}
-
getBBox() → {module:basetype~BBox}
-
获取扇形的三维包围盒
-
getCoordSeqs() → {Array.<module:basetype~CoordSeq>}
-
获取扇形的坐标序列数组,其长度为1。
Example
let coordSeqs = sectorGeom.getCoordSeqs();
-
getCtrlPoints() → {Array.<module:geom~Point>}
-
获取控制点的几何数组
Example
let points = geomext.getCtrlPoints();
-
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();