com.supermap.data
Class GeoText
- java.lang.Object
-
- com.supermap.data.Geometry
-
- com.supermap.data.GeoText
-
public class GeoText extends Geometry
The GeoText class derives from the
Geometry
class. This class is mainly used to label the geographical features and make necessary descriptions for them. A GeoText object is composed of one or more parts, each part is called a subobject of the GeoText object, each subobject is a instance ofTextPart
. All the parts of a GeoText object apply the same style, namely they are all displayed with the text style of this GeoText.
-
-
Constructor Summary
Constructors Constructor and Description GeoText()
Constructs a new GeoText object.GeoText(GeoText geoText)
Initializes a new instance according to the specified GeoText object.GeoText(TextPart part)
Creates a new GeoText object according to the specified arguments.GeoText(TextPart part, TextStyle textStyle)
Creates a new GeoText object according to the specified arguments.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description int
addPart(TextPart part)
Adds a TextPart to the GeoText object.GeoText
clone()
Returns a copy of the current GeoText object.void
dispose()
Release the resource occupy by this object.TextPart
getPart(int index)
Deletes the parts of GeoText with the specified index.int
getPartCount()
Returns the count of parts of the GeoText object.java.lang.String
getText()
Returns the content of the GeoText object.TextStyle
getTextStyle()
Returns the text style of the GeoText object.boolean
insertPart(int index, TextPart part)
Inserts a TextPart object in the GeoText object at the specified index.boolean
isEmpty()
Determines whether the GeoText3D object is empty, that is it has on subobjects.boolean
removePart(int index)
Removes the parts of GeoText with the specified index.boolean
setPart(int index, TextPart part)
Modify the part of the GeoText object with the specified index, that is replace the original part with new part.void
setTextStyle(TextStyle textStyle)
Sets the text style of the GeoText object.
-
-
-
Constructor Detail
-
GeoText
public GeoText()
Constructs a new GeoText object.
-
GeoText
public GeoText(GeoText geoText)
Initializes a new instance according to the specified GeoText object.- Parameters:
geoText
- The specified GeoText3D object.
-
GeoText
public GeoText(TextPart part)
Creates a new GeoText object according to the specified arguments.- Parameters:
part
- TextPart Subobject- See Also:
TextPart
-
-
Method Detail
-
getText
public java.lang.String getText()
Returns the content of the GeoText object. If the GeoText has multiple parts, its value will be the sum of the strings of all the parts.- Returns:
- The content of the text object.
- Default:
- The default is a null string.
-
getPartCount
public int getPartCount()
Returns the count of parts of the GeoText object. After being cleared, the count of the parts is 0.- Returns:
- The count of parts contained in the GeoText object.
- Default:
- The default value is 0.
-
getTextStyle
public TextStyle getTextStyle()
Returns the text style of the GeoText object. The TextStyle is used to specify the font, width, height and color of displaying the GeoText object.Note: GeoText.getTextStyle().setRotation() does not support
TextPart
, the rotation angle ofTextPart
is controlled bygetRotation()
andsetRotation()
.
-
setTextStyle
public void setTextStyle(TextStyle textStyle)
Sets the text style of the GeoText object. The TextStyle is used to specify the font, width, height and color of displaying the GeoText object.Note: GeoText.getTextStyle().setRotation() does not support
TextPart
, the rotation angle ofTextPart
is controlled bygetRotation()
andsetRotation()
.- Parameters:
textStyle
- The text style of the text object.- See Also:
TextStyle
-
isEmpty
public boolean isEmpty()
Determines whether the GeoText3D object is empty, that is it has on subobjects. The determine precision used is equal-zero precision by default. SeeEnvironment
.
-
addPart
public int addPart(TextPart part)
Adds a TextPart to the GeoText object.
-
getPart
public TextPart getPart(int index)
Deletes the parts of GeoText with the specified index.- Parameters:
index
- The subobject index.- Returns:
- The subobject with the specified index.
- Throws:
java.lang.IndexOutOfBoundsException
- If index is less than 0 or larger then the count of parts of the GeoText object.
-
insertPart
public boolean insertPart(int index, TextPart part)
Inserts a TextPart object in the GeoText object at the specified index.- Parameters:
index
- The index where the TextPart is to be inserted,specially, the index value is greater than zero and is less than the number of the parts of the GeoText objects.part
- The TextPart object to insert.- Returns:
- Returns true If successful; otherwise false.
- Throws:
java.lang.IndexOutOfBoundsException
- If index is less than 0 or larger then the count of parts of the GeoText object.- See Also:
addPart(TextPart)
,removePart(int)
-
removePart
public boolean removePart(int index)
Removes the parts of GeoText with the specified index.- Parameters:
index
- the parts of GeoText with the specified index.- Returns:
- returns true If successful; otherwise false.
- Throws:
java.lang.IndexOutOfBoundsException
- If index is less than 0 or larger then the count of parts of the GeoText object.
-
setPart
public boolean setPart(int index, TextPart part)
Modify the part of the GeoText object with the specified index, that is replace the original part with new part.- Parameters:
index
- the parts of GeoText with the specified index.part
- the parts of GeoText- Returns:
- true if the setting is successful, or false otherwise.
- Throws:
java.lang.IndexOutOfBoundsException
- If index is less than 0 or larger then the count of parts of the GeoText object.
-
clone
public GeoText clone()
Returns a copy of the current GeoText object.
-
-