new GeometryGeoText(x, y, text)
Usage
import { GeometryGeoText } from '@supermapgis/iclient-ol';
new GeometryGeoText(x, y, text);<script type="text/javascript" src="https://iclient.supermap.io/dist/openlayers/iclient-ol.js"></script>
<script>
new ol.supermap.Geometry.GeoText({paramsNames});
// 弃用的写法
new SuperMap.Geometry.GeoText(x, y, text);
</script>
common/commontypes/geometry/GeoText.js, line 12
| Name | Type | Description |
|---|---|---|
x |
number |
x 坐标。 |
y |
number |
y 坐标。 |
text |
string |
标签中的文本内容。 |
API Relations
Returned by:
GeometryGeoText.clone.
Extends
GeometryGeoText
-> Geometry
Members
-
boundsBounds
-
几何对象的范围。
-
bsInfoObject
-
标签范围的基础信息。
Properties:
Name Type Description wnumber bounds 的宽度。
hnumber bounds 的高度。
-
idstring
-
几何对象的唯一标识符。
-
parentGeometry
-
父类几何对象。
-
SRIDnumber
-
投影坐标参数。通过该参数,服务器判断几何对象的坐标参考系是否与数据集相同,如果不同,则在数据入库前进行投影变换。
Example
var geometry= new Geometry(); geometry. SRID=4326; -
textstring
-
标签中的文本内容。
-
xnumber
-
横坐标。
-
ynumber
-
纵坐标。
Methods
-
calculateBounds()
common/commontypes/geometry/GeoText.js, line 94 -
计算标签对象的范围。
-
inherited clearBounds()
common/commontypes/Geometry.js, line 85 -
清除几何对象的边界。 如果该对象有父类,也会清除父类几何对象的边界。
-
clone(){GeometryGeoText}
common/commontypes/geometry/GeoText.js, line 81 -
克隆标签对象。
Returns:
Type Description GeometryGeoText 克隆后的标签对象。 -
destroy()
common/commontypes/geometry/GeoText.js, line 61 -
销毁文本标签类。
-
inherited extendBounds(newBounds)
common/commontypes/Geometry.js, line 98 -
扩展现有边界以包含新边界。如果尚未设置几何边界,则设置新边界。
Name Type Description newBoundsBounds 几何对象的边界。
-
inherited getArea(){number}
common/commontypes/Geometry.js, line 145 -
计算几何对象的面积 ,此方法需要在子类中定义。
Returns:
Type Description number 计算后的对象面积。 -
获得几何图形的边界。如果没有设置边界,可通过计算获得。
Returns:
Type Description Bounds 几何对象的边界。 -
getCentroid(){GeometryPoint}
common/commontypes/geometry/GeoText.js, line 72 -
获取标签对象的质心。
Returns:
Type Description GeometryPoint 标签对象的质心。 -
getLabelPxBoundsByLabel(locationPixel, labelWidth, labelHeight, style){Bounds}
common/commontypes/geometry/GeoText.js, line 103 -
根据绘制好的标签获取文字标签的像素范围,参数的单位是像素;此方法相对于 getLabelPxBoundsByText 效率较低,但支持所有格式的文本。
Name Type Description locationPixelObject 标签的位置点,该对象含有属性 x(横坐标),属性 y(纵坐标)。
labelWidthstring 标签的宽度,如:“90px”。
labelHeightstring 标签的高度。
styleObject 标签的 style。
Returns:
Type Description Bounds 标签的像素范围。 -
getLabelPxBoundsByText(locationPixel, style){Bounds}
common/commontypes/geometry/GeoText.js, line 176 -
根据文本内容获取文字标签的像素范围。
Name Type Description locationPixelObject 标签的位置点,该对象含有属性 x(横坐标),属性 y(纵坐标)。
styleObject 标签的样式。
Returns:
Type Description Bounds 标签的像素范围。 -
getLabelPxSize(style){Object}
common/commontypes/geometry/GeoText.js, line 243 -
获取 label 的像素大小。
Name Type Description styleObject 标签样式。
Returns:
Type Description Object 标签大小对象,属性 w 表示标签的宽度,属性 h 表示标签的高度。 -
getTextCount(text){Object}
common/commontypes/geometry/GeoText.js, line 295 -
获取 text 中的字符个数。
Name Type Description textstring 字符串。
Returns:
Type Description Object 字符个数统计结果,属性 cnC 表示中文字符个数,属性 enC 表示英文字符个数,属性 textC 表示字符总个数。 -
inherited getVertices(nodes){Array}
common/commontypes/Geometry.js, line 136 -
返回几何图形的所有顶点的列表(需要在子类中实现此方法)。
Name Type Description nodesboolean 可选 如果是 true,线则只返回线的末端点,如果 false,仅仅返回顶点,如果没有设置,则返回顶点。
Returns:
Type Description Array 几何图形的顶点列表。 -
inherited setBounds(bounds)
common/commontypes/Geometry.js, line 73 -
设置几何对象的边界。
Name Type Description boundsBounds 范围。