Summary
Methods:
getBBox |
获取Cardinal曲线的三维包围盒 |
getCoordSeq |
获取Cardinal曲线的坐标序列 |
getLength |
计算Cardinal曲线组成点连线的长度 |
getType |
获取几何体类型 |
setCtrlPoints |
重新设置Cardinal曲线的控制点。 |
toLine |
将Cardinal曲线转化为线几何体 |
Constructor
new CardinalCurve(points)
使用点几何体作为控制点构造Cardinal曲线,注意控制点数量至少为3,且不可以重复。
Parameters:
Name | Type | Description |
---|---|---|
points |
Array.<module:geom~Point> | 点几何体数组,数组长度小于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(120,31,0));
let point3 = new hmap.geom.Point(new hmap.basetype.Coordinate(121,31,0));
let cardinalGeom = new hmap.geomext.CardinalCurve([point1,point2,point3]);
Methods
-
getBBox() → {module:basetype~BBox}
-
获取Cardinal曲线的三维包围盒
-
getCoordSeq() → {module:basetype~CoordSeq}
-
获取Cardinal曲线的坐标序列
Example
let coordSeq = cardinalGeom.getCoordSeq();
-
getLength(srid) → {Number}
-
计算Cardinal曲线组成点连线的长度
Parameters:
Name Type Description srid
String 坐标系类型
Returns:
Number -线段的三维长度,单位米。
Example
let length = cardinalGeom.getLength(4326);
-
getType() → {String}
-
获取几何体类型
Example
let type = cardinalGeom.getType();
-
setCtrlPoints(points)
-
重新设置Cardinal曲线的控制点。
Parameters:
Name Type Description points
Array.<module:geom~Point> 点几何体数组,数组长度小于3或非数组类型,则抛出构造异常。
Throws:
RangeError | TypeError -数组长度小于3或非数组类型,则抛出构造异常。
Example
let point1 = new hmap.geom.Point(new hmap.basetype.Coordinate(122,30,0)); let point2 = new hmap.geom.Point(new hmap.basetype.Coordinate(120,32,0)); let point3 = new hmap.geom.Point(new hmap.basetype.Coordinate(121,32,0)); cardinalGeom.setCtrlPoints([point1,point2,point3]);
-
toLine() → {module:geom~Line}
-
将Cardinal曲线转化为线几何体
Example
let line = cardinalGeom.toLine();