com.supermap.data

Class 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 of TextPart . All the parts of a GeoText object apply the same style, namely they are all displayed with the text style of this GeoText.

    • 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
      • GeoText

        public GeoText(TextPart part,
                       TextStyle textStyle)
        Creates a new GeoText object according to the specified arguments.
        Parameters:
        part - The specified GeoText3D of Subobject.
        textStyle - The textStyle object specified.
    • 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 of TextPart is controlled by getRotation() and setRotation().

        Returns:
        The text style of the text object.
        See Also:
        TextStyle
        Example:
        Please refer to the example for the TextStyle class.
      • 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 of TextPart is controlled by getRotation() and setRotation().

        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. See Environment.
        Overrides:
        isEmpty in class Geometry
        Returns:
        returns true if the GeoText object is empty.Otherwise,false.
      • addPart

        public int addPart(TextPart part)
        Adds a TextPart to the GeoText object.
        Parameters:
        part - An object of the TextPart class.
        Returns:
        If the TextPart is added successfully, returns an index of the textpart; Otherwise, returns -1.
        Example:
        Please refer to the example for the TextStyle class.
      • 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.
        Specified by:
        clone in class Geometry
        Returns:
        The new GeoText3D object generated from the clone operation.
      • dispose

        public void dispose()
        Release the resource occupy by this object.
        Overrides:
        dispose in class Geometry