Class: GeoText

SuperMap.Geometry.GeoText

Text label class.

new SuperMap.Geometry.GeoText(x, y, text)

GeoText.js, line 10
Name Type Description
x float

x-cooridnate.

y float

y-cooridnate.

text string

The text of the label.

Extends

Members

Bounds of the geometric object.

bsInfoObject

the base information of the label bounds and including two attributes:

Properties:
Name Type Description
w number

width of the bounds.

h number

height of the bounds.

idstring

The unique identifier of the geometric object.

This is set when a Geometry is added as component of another geometry

SRIDinterger

Projection coordinate parameter. By this parameter, server will determine whether the geometry object's coordinate reference is as the same as dataset, if not, then change projection before adding into database.

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

textstring

The text of the label.

xfloat

x-coordinate.

yfloat

y-coordinate.

Methods

calculateBounds()

GeoText.js, line 88

Calculate the bounds of the label object.

inherited clearBounds()

Geometry.js, line 82

clear bounds of the geometric object. If the object has a parent class, it also clears the bounds of the parent class geometry object.

clone(){SuperMap.Geometry.GeoText}

GeoText.js, line 75

Clone the label object.

Returns:
Type Description
SuperMap.Geometry.GeoText Cloned the label object.

destroy()

GeoText.js, line 55

Destroy the text label class.

inherited extendBounds(newBounds)

Geometry.js, line 95

Extend the existing bounds to include the new bounds. If geometry's bounds is not yet set, then set a new Bounds.

Name Type Description
newBounds SuperMap.Bounds

New bounds.

inherited getArea(){float}

Geometry.js, line 144

Calculating the area of the geometric object. This method needs to be realized in the subclass.

Returns:
Type Description
float The area of the collection by summing its parts

inherited getBounds(){SuperMap.Bounds}

Geometry.js, line 112

Gets the boundary of the geometric graphic. If not set, it can be acquired through computing.

Returns:
Type Description
SuperMap.Bounds Returns the bounds of the geometry.

getCentroid(){SuperMap.Geometry.Point}

GeoText.js, line 66

Get the centroid of the label object.

Returns:
Type Description
SuperMap.Geometry.Point The centroid of the label object.

getLabelPxBoundsByLabel(locationPixel, labelWidth, labelHeight, style){SuperMap.Bounds}

GeoText.js, line 97

Get the pixel bounds of the text label according to the drawn label. The unit of the parameter is pixel; This function is less efficient than getLabelPxBoundsByText,but support all formats of text.

Name Type Description
locationPixel Object

Location point of the label,this object Contains the attribute x (abscissa) and the attribute y (ordinate).

labelWidth string

width of the label, for example:"90px".

labelHeight string

height of the label.

style Object

Style of the label.

Returns:
Type Description
SuperMap.Bounds The pixel bounds of the label.

getLabelPxBoundsByText(locationPixel, style){SuperMap.Bounds}

GeoText.js, line 171

Get the pixel bounds of the text label according to the text content.

Name Type Description
locationPixel Object

Location point of the label,this object Contains the attribute x (abscissa) and the attribute y (ordinate).

style Object

Style of the label.

Returns:
Type Description
SuperMap.Bounds The pixel bounds of the label.

getLabelPxSize(style){Object}

GeoText.js, line 238

Get the pixel size of the label.

Name Type Description
style Object

Style of the label.

Returns:
Type Description
Object The object of the label size. Attribute w express the width id the label. Attribute h express the height id the label.

getTextCount(text){Object}

GeoText.js, line 290

Get the number of characters in text.

Name Type Description
text string

Text.

Returns:
Type Description
Object Statistical results of character number. Attribute cnC represent the number of Chinese characters, attribute enC represent the number of English characters, attribute textC represent the total number of characters.

inherited getVertices(nodes){Array}

Geometry.js, line 135

Returns the list of all vertices of the geometric graphic. (This method needs to be realized in the subclass).

Name Type Description
nodes boolean optional

If true, only returns the end point of a line; if false, only returns the vertex; and default is to return the vertex.

Returns:
Type Description
Array A list of all vertices in the geometry.

inherited setBounds(bounds)

Geometry.js, line 70

Set bounds of the geometric object.

Name Type Description
bounds SuperMap.Bounds

bounds.