geomext~RegularHexagon(centerPoint, borderPoint)

正六边形

Summary

Methods:
clone

复制拓展几何对象。

getBBox

获取拓展几何的三维包围盒

getCoordSeqs

获取正六边形的坐标序列数组,其长度为1。

getType

获取几何体类型

setCtrlPoints

重新设置正六边形的控制点。

toPolygon

将正六边形转化为普通多边形

Constructor

new RegularHexagon(centerPoint, borderPoint)

使用点几何体作为控制点构造正六边形,控制点数量为2,且不可以重复。

Parameters:
Name Type Description
centerPoint module:geom~Point

控制点1,即正六边形的中心点。

borderPoint module:geom~Point

控制点2,即正六边形的边上的一个顶点。

Throws:
TypeError -

参数中,中心点和边顶点必须是Point的实例,否则抛出异常。

Example
let pnt1 = new hmap.geom.Point(new hmap.basetype.Coordinate(120,30,0));
let pnt2 = new hmap.geom.Point(new hmap.basetype.Coordinate(120,31,0));
let circleGeom = new hmap.geomext.Circle(pnt1,pnt2,20);

Methods

clone() → {module:geomext~GeometryExt}

复制拓展几何对象。

Returns:
module:geomext~GeometryExt -

拓展几何对象。

getBBox() → {module:basetype~BBox}

获取拓展几何的三维包围盒

Returns:
module:basetype~BBox -

返回三维包围盒

getCoordSeqs() → {Array.<module:basetype~CoordSeq>}

获取正六边形的坐标序列数组,其长度为1。

Returns:
Array.<module:basetype~CoordSeq> -

坐标序列数组

Example
let coordSeqs = geom.getCoordSeqs();

getType() → {String}

获取几何体类型

Returns:
String -

几何体类型,参见GeometryExtType

Example
let type = geom.getType();

setCtrlPoints(points)

重新设置正六边形的控制点。

Parameters:
Name Type Description
points Array.<module:geom~Point>

点几何体数组。数组长度小于2或非数组类型,则抛出构造异常;当数组长度大于2时,取前2个点几何体作为控制点。

Throws:
RangeError | TypeError -

当数组长度小于2或非数组类型,抛出异常。

Example
let point1 = new hmap.geom.Point(new hmap.basetype.Coordinate(120,30,0));
 let point2 = new hmap.geom.Point(new hmap.basetype.Coordinate(122,30,0));
 geom.setCtrlPoints([point1,point2]);

toPolygon() → {module:geom~Polygon}

将正六边形转化为普通多边形

Returns:
module:geom~Polygon -

普通多边形

Example
let polygon = geom.toPolygon();