|
GeoSoft API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object GPositional GText
Class for representing text within graphics.
Text is not added directly to coordinates in the canvas, but associated with geometric elements of the scene and positioned through rendering hints. GText objects can have their own style, but will inherit unset style elements from their segment owner.
Typical usage:
GSegment segment = new GSegment(); segment.setText (new GText ("Revenue", GPosition.TOP | GPosition.WEST));Note that a text is typically associated with a GSegment at a time where the GSegment is without geometry. The text position is not determined until the rendering step anyway.
Constructor Summary | |
GText()
Create empty text object with default position hint. |
|
GText(String text)
Create text object with default position hint. |
|
GText(String text,
int positionHint)
Create text object with specified position hint. |
Method Summary | |
int |
getPositionHint()
Return position hint of this positional. |
GStyle |
getStyle()
Get style of this GText. |
String |
getText()
Return text content of this text element. |
void |
setPositionHint(int positionHint)
Set position hint for this positional. |
void |
setStyle(GStyle style)
Set new style for this object. |
void |
setText(String text)
Set text content of this text element. |
Methods inherited from class Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public GText(String text, int positionHint)
text
- Text string to associate with text. Can be null
or empty.positionHint
- Position preferences.GPositional.setPositionHint(int)
public GText(String text)
text
- Text string to associate with text. Can be null or empty.public GText()
Method Detail |
public void setText(String text)
text
- Text content. Can be null or empty.public String getText()
public void setPositionHint(int positionHint)
Position hints is a or'ed list of:
Line position hints are interpreted as follows:
For the above, the given point becomes the initial approach for positioning. If this initial position is outside the window (and position hint not explicitly set to GPosition.STATIC) the text is moved along the polyline till it becomes fully visible.
If text position hint is GPosition.MIDDLE, the initial position is the center of the polyline bounding box. If this point is not visble the text is not rendered.
At this point an anchor point is found for the text. Now the point positioning text hints are examined:
If a point positioing hint is not given, the defualt is GPosition.CENTER unless line position hint is GPosition.TOP (implying GPosition.NORTH), GPosition.BOTTOM (implying GPosition.SOUTH), GPosition.LEFT (implying GPosition.WEST) or GPosition:RIGHT (implying GPosition.EAST).
Now, if the text in this location overlap an already positioned text, it is further adjusted (unless position hint is not explicitly set to GPosition.STATIC as discussed above). It is again moved along the polyline till a free location is found. If this cannot be acheived, the text is not rendered
positionHint
- Position hint for this positional.GPosition
public int getPositionHint()
GPositional.setPositionHint(int).
public void setStyle(GStyle style)
style
- Style for this object.public GStyle getStyle()
|
GeoSoft API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |