Package hec.gfx2d
Class GfxLabelItem
java.lang.Object
hec.gfx2d.GfxTextObject
hec.gfx2d.GfxLabelItem
GfxLabelItem class used by MapCanvas to prevent cluttering of text on screen
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
east positionstatic final int
north positionstatic final int
northeast positionstatic final int
northwest positionstatic final String[]
the positions as stringsstatic final int
south positionstatic final int
southeast positionstatic final int
southwest positionstatic final int
west position -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new GfxLabelItem objectGfxLabelItem
(String txt, int x, int y, int pos, int offset, float priority, Font font, Color fg, Color bg, boolean drawBorder, Graphics g) Create a new GfxLabelItem objectGfxLabelItem
(String txt, int x, int y, int pos, int size, float priority, Font font, Color fg, Color bg, Graphics g) Create a new GfxLabelItem objectGfxLabelItem
(String txt, int x, int y, int pos, int iconWidth, int iconHeight, float priority, Font font, Color fg, Color bg, boolean drawBorder, Graphics g) Create a new GfxLabelItem object -
Method Summary
Modifier and TypeMethodDescriptionvoid
Method DescriptionGets the Bounds attribute of the GfxLabelItem objectGets the LocalRect attribute of the GfxLabelItem objectGets the LocalRect attribute of the GfxLabelItem objectgetText()
Gets the Text attribute of the GfxLabelItem objectboolean
intersects
(GfxTextObject obj) Method Description
-
Field Details
-
EAST
public static final int EASTeast position- See Also:
-
NORTHEAST
public static final int NORTHEASTnortheast position- See Also:
-
NORTH
public static final int NORTHnorth position- See Also:
-
NORTHWEST
public static final int NORTHWESTnorthwest position- See Also:
-
WEST
public static final int WESTwest position- See Also:
-
SOUTHWEST
public static final int SOUTHWESTsouthwest position- See Also:
-
SOUTH
public static final int SOUTHsouth position- See Also:
-
SOUTHEAST
public static final int SOUTHEASTsoutheast position- See Also:
-
POSITION_STRINGS
the positions as strings
-
-
Constructor Details
-
GfxLabelItem
public GfxLabelItem(String txt, int x, int y, int pos, int iconWidth, int iconHeight, float priority, Font font, Color fg, Color bg, boolean drawBorder, Graphics g) Create a new GfxLabelItem object- Parameters:
txt
- the text to displayx
- the x positiony
- the y positionpos
- the position NORTH, SOURTH etciconWidth
- the width of the iconiconHeight
- the height of the iconpriority
- the priority. -1 always draw. otherwise higher priority takes precidence of lower when labels overlapfont
- the font to usefg
- the foreground colorbg
- the background colordrawBorder
- whether to draw a border or notg
- the graphics context to draw in
-
GfxLabelItem
public GfxLabelItem(String txt, int x, int y, int pos, int size, float priority, Font font, Color fg, Color bg, Graphics g) Create a new GfxLabelItem object- Parameters:
txt
- the text to displayx
- the x positiony
- the y positionpos
- the position NORTH, SOURTH etcsize
- the icon sizepriority
- the priority. -1 always draw. otherwise higher priority takes precidence of lower when labels overlap * @param font the font to usefg
- the foreground colorbg
- the background colorg
- the graphics context to draw in
-
GfxLabelItem
public GfxLabelItem(String txt, int x, int y, float priority, Font font, Color fg, Color bg, Graphics g) Create a new GfxLabelItem object- Parameters:
txt
- the text to displayx
- the x positiony
- the y positionpriority
- the priority. -1 always draw. otherwise higher priority takes precidence of lower when labels overlapfont
- the font to usefg
- the foreground colorbg
- the background colorg
- the graphics context to draw in
-
GfxLabelItem
public GfxLabelItem(String txt, int x, int y, int pos, int offset, float priority, Font font, Color fg, Color bg, boolean drawBorder, Graphics g) Create a new GfxLabelItem object- Parameters:
txt
- the text to displayx
- the x positiony
- the y positionpos
- the position NORTH, SOURTH etcoffset
-priority
- the priority. -1 always draw. otherwise higher priority takes precidence of lower when labels overlapfont
- the font to usefg
- the foreground colorbg
- the background colordrawBorder
- whether to draw a border or notg
- the graphics context to draw in
-
-
Method Details
-
intersects
Method Description- Overrides:
intersects
in classGfxTextObject
- Parameters:
obj
- Description- Returns:
- Description
-
getBounds
Gets the Bounds attribute of the GfxLabelItem object- Specified by:
getBounds
in classGfxTextObject
- Returns:
- The Bounds value
-
getLocalRect
Gets the LocalRect attribute of the GfxLabelItem object- Returns:
- The LocalRect value
-
getLocalRect
Gets the LocalRect attribute of the GfxLabelItem object- Parameters:
rc
- Description- Returns:
- The LocalRect value
-
draw
Method Description- Specified by:
draw
in classGfxTextObject
- Parameters:
g
- Description
-
getText
Gets the Text attribute of the GfxLabelItem object- Returns:
- The Text value
-