Class: GeometryRectangle

GeometryRectangle

矩形几何对象类。

new GeometryRectangle(x, y, width, height)

Usage
import { GeometryRectangle } from '@supermapgis/iclient-leaflet';

new GeometryRectangle(x, y, width, height);
<script type="text/javascript" src="https://iclient.supermap.io/dist/leaflet/iclient-leaflet.js"></script>
<script>
  new L.supermap.Geometry.Rectangle({paramsNames});
  // 弃用的写法
  new SuperMap.Geometry.Rectangle(x, y, width, height);
</script>
common/commontypes/geometry/Rectangle.js, line 7
Name Type Description
x number

矩形左下角点的横坐标。

y number

矩形左下角点的纵坐标。

width number

矩形的宽度。

height number

矩形的高度。

Example
//x 为矩形左下角点的横坐标;y 为矩形左下角点的纵坐标;w 为矩形的宽度;h 为矩形的高度
 var x = 1;
 var y = 2;
 var w = 10;
 var h = 20;
 var recttangle = new GeometryRectangle(x, y, w, h);

Extends

GeometryRectangle -> Geometry

Members

boundsBounds

几何对象的范围。

heightnumber

矩形的高度。

idstring

几何对象的唯一标识符。

parentGeometry

父类几何对象。

SRIDnumber

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

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

widthnumber

矩形的宽度。

xnumber

矩形左下角点的横坐标。

ynumber

矩形左下角点的纵坐标。

Methods

calculateBounds()

common/commontypes/geometry/Rectangle.js, line 61

计算出此矩形对象的 bounds。

inherited clearBounds()

common/commontypes/Geometry.js, line 85

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

inherited clone(){Geometry}

common/commontypes/Geometry.js, line 63

克隆几何图形。克隆的几何图形不设置非标准的属性。

Returns:
Type Description
Geometry 克隆的几何图形。

inherited destroy()

common/commontypes/Geometry.js, line 52

解构 Geometry 类,释放资源。

inherited extendBounds(newBounds)

common/commontypes/Geometry.js, line 98

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

Name Type Description
newBounds Bounds

几何对象的边界。

getArea(){number}

common/commontypes/geometry/Rectangle.js, line 72

获取矩形对象的面积。

Returns:
Type Description
number 矩形对象面积。

inherited getBounds(){Bounds}

common/commontypes/Geometry.js, line 113

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

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

inherited getVertices(nodes){Array}

common/commontypes/Geometry.js, line 136

返回几何图形的所有顶点的列表(需要在子类中实现此方法)。

Name Type Description
nodes boolean 可选

如果是 true,线则只返回线的末端点,如果 false,仅仅返回顶点,如果没有设置,则返回顶点。

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

inherited setBounds(bounds)

common/commontypes/Geometry.js, line 73

设置几何对象的边界。

Name Type Description
bounds Bounds

范围。