Class: GeometryPoint

GeometryPoint

点几何对象类。

new GeometryPoint(x, y, type, tag)

Usage
// 浏览器
<script type="text/javascript" src="https://iclient.supermap.io/dist/openlayers/iclient-ol.js"></script>
<script>
  new ol.supermap.Geometry.Point(x, y, type, tag);
  
  // 弃用的写法
  new SuperMap.Geometry.Point(x, y, type, tag);

</script>

// ES6 Import
import { GeometryPoint } from '@supermap/iclient-ol';

new GeometryPoint(x, y, type, tag);

common/commontypes/geometry/Point.js, line 8
Name Type Default Description
x number

x 坐标。

y number

y 坐标。

type string 'Point' 可选

点的类型。

tag number 可选

额外的属性,比如插值分析中的 Z 值。

Example
var point = new GeometryPoint(-111.04, 45.68);

Extends

Members

boundsBounds

几何对象的范围。

idstring

几何对象的唯一标识符。

parentGeometry

父类几何对象。

SRIDnumber

投影坐标参数。通过该参数,服务器判断 Geometry 对象的坐标参考系是否与数据集相同,如果不同,则在数据入库前进行投影变换。

Example
var geometry= new Geometry();
geometry. SRID=4326;

tagstring

用来存储额外的属性,比如插值分析中的 Z 值。

typestring

用来存储点的类型。

xnumber

横坐标。

ynumber

纵坐标。

Methods

calculateBounds()

common/commontypes/geometry/Point.js, line 71

计算点对象的范围。

inherited clearBounds()

common/commontypes/Geometry.js, line 85

清除几何对象的 bounds。 如果该对象有父类,也会清除父类几何对象的 bounds。

clone(){GeometryPoint}

common/commontypes/geometry/Point.js, line 55

克隆点对象。

Returns:
Type Description
GeometryPoint 克隆后的点对象。

destroy()

common/commontypes/geometry/Point.js, line 121

释放点对象的资源。

equals(geom){boolean}

common/commontypes/geometry/Point.js, line 80

判断两个点对象是否相等。如果两个点对象具有相同的坐标,则认为是相等的。

Name Type Description
geom GeometryPoint

需要判断的点对象。

Returns:
Type Description
boolean 两个点对象是否相等(true 为相等,false 为不等)。
Example
var point= new GeometryPoint(0,0);
var point1={x:0,y:0};
var result= point.equals(point1);

inherited extendBounds(newBounds)

common/commontypes/Geometry.js, line 98

扩展现有边界以包含新边界。如果尚未设置几何边界,则设置新边界。

Name Type Description
newBounds Bounds

几何对象的 bounds。

inherited getArea(){number}

common/commontypes/Geometry.js, line 145

计算几何对象的面积 ,此方法需要在子类中定义。

Returns:
Type Description
number 计算后的对象面积。

inherited getBounds(){Bounds}

common/commontypes/Geometry.js, line 113

获得几何图形的边界。如果没有设置边界,可通过计算获得。

Returns:
Type Description
Bounds 几何对象的边界。

getVertices(){Array}

common/commontypes/geometry/Point.js, line 132

获取几何图形所有顶点的列表。

Returns:
Type Description
Array 几何图形的顶点列表。

move(x, y)

common/commontypes/geometry/Point.js, line 100

沿着 x、y 轴的正方向上按照给定的位移移动点对象,move 不仅改变了几何对象的位置并且清理了边界缓存。

Name Type Description
x number

x 轴正方向上的偏移量。

y number

y 轴正方向上偏移量。

inherited setBounds(bounds)

common/commontypes/Geometry.js, line 73

设置几何对象的 bounds。

Name Type Description
bounds Bounds

范围。

toShortString(){string}

common/commontypes/geometry/Point.js, line 112

将 x/y 坐标转换成简单字符串。

Returns:
Type Description
string 字符串代表点对象。(ex. "5, 42")