Package ucar.unidata.ui.drawing
Class Glyph
java.lang.Object
ucar.unidata.ui.drawing.Glyph
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
LineGlyph
,PolyGlyph
,RectangleGlyph
Base (abstract) class for representing things that are drawn on
the screen. Holds some basic attributes (but no positional attrs)
and has a facility for recreating itself via xml.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_int
_more_static final int
_more_static final Color
_more_static Hashtable
_more_static final int
Some global constsstatic final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String[]
_more_static final String[]
_more_static final int
_more_static final String
_more_boolean
_more__more_ -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Hook for when the size or position of this glyph is changedboolean
_more_protected Object
clone()
_more_abstract double
distance
(int x, int y) _more_static double
distance
(int x1, int y1, int x2, int y2) Utility method for distance between two pointsvoid
doRemove()
_more_static String
_more_getAttrs()
_more__more_getBackground
(Color dflt) _more_boolean
_more_abstract Rectangle
_more_getCreateCommand
(DisplayCanvas canvas, AWTEvent event, int x, int y) _more_static Cursor
_more_boolean
_more__more_getId()
_more_int
_more_getMoveCommand
(DisplayCanvas canvas, AWTEvent event, int x, int y) _more_boolean
_more_static Point2D
getPointOnRect
(String pt, Rectangle2D r) _more_static Point2D
getPointOnRect
(String pt, Rectangle2D r, Point2D point) _more_static String
getRectPointName
(String rectPoint) _more__more_getStretchPoint
(int x, int y) _more_static String
getStretchPoint
(RectangularShape r, int x, int y) _more_boolean
_more_getXml()
Return the string used to recreate mevoid
initDone()
_more__more_abstract void
moveBy
(int x, int y) _more_abstract void
moveTo
(int x, int y) _more_void
_more_void
paint
(Graphics g, DisplayCanvas c) _more_void
_more_void
By default paint little black rectangles at the corners and the sidesstatic void
paintSelectionPoints
(Graphics g, RectangularShape r, int size) By default paint little black rectangles at the corners and the sidesboolean
pickable()
_more_void
A Glyph can write out a persistent copy of itself as a set of attribute/value pairs.void
set my named atttribute to valuevoid
_more_void
setBeingCreated
(boolean b) _more_void
setFilled
(boolean c) _more_void
_more_void
_more_void
setLineWidth
(int value) _more_void
setParent
(CompositeGlyph newParent) _more_void
setPoints
(int[] p, int cnt) Hook for setting points from the attribute linevoid
setStretchy
(boolean b) _more__more_static String
_more_static String
stretchTo
(Rectangle bounds, int x, int y, String pt, boolean correct, boolean symetric, boolean equalSides) _more_static Rectangle
_more_transformOutput
(DisplayCanvas canvas, Point r) _more_transformOutput
(DisplayCanvas canvas, Rectangle r) _more_int
transformOutputX
(DisplayCanvas canvas, int x) _more_int
transformOutputY
(DisplayCanvas canvas, int x) _more_
-
Field Details
-
TAG_GLYPH
_more_- See Also:
-
ATTR_CLASS
_more_- See Also:
-
PT_CENTER
_more_- See Also:
-
PT_V_UPPER
_more_- See Also:
-
PT_V_MIDDLE
_more_- See Also:
-
PT_V_LOWER
_more_- See Also:
-
PT_H_LEFT
_more_- See Also:
-
PT_H_MIDDLE
_more_- See Also:
-
PT_H_RIGHT
_more_- See Also:
-
PT_UL
_more_- See Also:
-
PT_UM
_more_- See Also:
-
PT_UR
_more_- See Also:
-
PT_ML
_more_- See Also:
-
PT_MM
_more_- See Also:
-
PT_MR
_more_- See Also:
-
PT_LL
_more_- See Also:
-
PT_LM
_more_- See Also:
-
PT_LR
_more_- See Also:
-
RECTPOINTS
_more_ -
RECTPOINTNAMES
_more_ -
PT_PREFIX
_more_- See Also:
-
PT_P1
_more_- See Also:
-
PT_P2
_more_- See Also:
-
ATTR_CHILDREN
_more_- See Also:
-
ATTR_COLOR
_more_- See Also:
-
ATTR_BGCOLOR
_more_- See Also:
-
ATTR_FILL
_more_- See Also:
-
ATTR_HEIGHT
_more_- See Also:
-
ATTR_IMAGE
_more_- See Also:
-
ATTR_LINEWIDTH
_more_- See Also:
-
ATTR_PARENT
_more_- See Also:
-
ATTR_PTS
_more_- See Also:
-
ATTR_STRETCHY
_more_- See Also:
-
ATTR_TEXT
_more_- See Also:
-
ATTR_TYPE
_more_- See Also:
-
ATTR_WIDTH
_more_- See Also:
-
idToGlyph
_more_ -
MIN_DISTANCE_TO_STRETCH
public static final int MIN_DISTANCE_TO_STRETCHSome global consts- See Also:
-
SEL_WIDTH
public static final int SEL_WIDTH_more_- See Also:
-
H_SEL_WIDTH
public static final int H_SEL_WIDTH_more_- See Also:
-
highlightColor
_more_ -
underline
public boolean underline_more_ -
url
_more_ -
baseline
public int baseline_more_
-
-
Constructor Details
-
Glyph
public Glyph()_more_
-
-
Method Details
-
getCursor
_more_- Parameters:
rectPoint
- _more_- Returns:
- _more_
-
getRectPointName
_more_- Parameters:
rectPoint
-- Returns:
- _more_
-
paintSelectionPoints
By default paint little black rectangles at the corners and the sides- Parameters:
g
- The graphics to paint intor
- The rectangle to decoratesize
- Box size
-
flipY
_more_- Parameters:
pt
-- Returns:
- _more_
-
getPointOnRect
_more_- Parameters:
pt
-r
-- Returns:
- _more_
-
toRect
_more_- Parameters:
r
- _more_- Returns:
- _more_
-
getStretchPoint
_more_- Parameters:
r
- _more_x
-y
-- Returns:
- _more_
-
getPointOnRect
_more_- Parameters:
pt
- The point specr
- The rectanglepoint
- The point to set- Returns:
- _more_
-
stretchTo
_more_- Parameters:
bounds
-x
-y
-pt
-- Returns:
- _more_
-
stretchTo
public static String stretchTo(Rectangle bounds, int x, int y, String pt, boolean correct, boolean symetric, boolean equalSides) _more_- Parameters:
bounds
- _more_x
-y
-pt
-correct
-symetric
- _more_equalSides
- _more_- Returns:
- _more_
-
getStretchy
public boolean getStretchy()_more_- Returns:
- _more_
-
setStretchy
public void setStretchy(boolean b) _more_- Parameters:
b
-
-
setBeingCreated
public void setBeingCreated(boolean b) _more_- Parameters:
b
-
-
getBeingCreated
public boolean getBeingCreated()_more_- Returns:
- _more_
-
initDone
public void initDone()_more_ -
setId
_more_- Parameters:
newId
-
-
getId
_more_- Returns:
- _more_
-
doRemove
public void doRemove()_more_ -
setParent
_more_- Parameters:
newParent
-
-
pickable
public boolean pickable()_more_- Returns:
- _more_
-
notifyChange
public void notifyChange()_more_ -
getCreateCommand
_more_- Parameters:
canvas
-event
-x
-y
-- Returns:
- _more_
-
getMoveCommand
_more_- Parameters:
canvas
-event
-x
-y
-- Returns:
- _more_
-
clone
_more_- Overrides:
clone
in classObject
- Returns:
- _more_
- Throws:
CloneNotSupportedException
-
getPersistent
public boolean getPersistent()_more_- Returns:
- _more_
-
canStretch
public boolean canStretch()_more_- Returns:
- _more_
-
boundsChanged
public void boundsChanged()Hook for when the size or position of this glyph is changed -
setPoints
public void setPoints(int[] p, int cnt) Hook for setting points from the attribute line- Parameters:
p
-cnt
-
-
setForeground
_more_- Parameters:
c
-
-
getForeground
_more_- Returns:
- _more_
-
setBackground
_more_- Parameters:
c
-
-
getBackground
_more_- Returns:
- _more_
-
getBackground
_more_- Parameters:
dflt
-- Returns:
- _more_
-
setLineWidth
public void setLineWidth(int value) _more_- Parameters:
value
-
-
getLineWidth
public int getLineWidth()_more_- Returns:
- _more_
-
setFilled
public void setFilled(boolean c) _more_- Parameters:
c
-
-
getFilled
public boolean getFilled()_more_- Returns:
- _more_
-
processAttrs
A Glyph can write out a persistent copy of itself as a set of attribute/value pairs. This method parses the line of attr/values of the form: ATTR=VALUE;ATTR=VALUE;- Parameters:
s
-
-
setAttr
set my named atttribute to value- Parameters:
name
-value
-
-
getXml
Return the string used to recreate me- Returns:
- _more_
-
makeAttr
_more_- Parameters:
name
-value
-- Returns:
- _more_
-
getAttrs
_more_- Returns:
- _more_
-
paint
_more_- Parameters:
g
-c
-
-
paintSelection
By default paint little black rectangles at the corners and the sides- Parameters:
g
-c
-
-
paintHighlight
_more_- Parameters:
g
-c
-
-
distance
public abstract double distance(int x, int y) _more_- Parameters:
x
-y
-- Returns:
- _more_
-
moveBy
public abstract void moveBy(int x, int y) _more_- Parameters:
x
-y
-
-
moveTo
public abstract void moveTo(int x, int y) _more_- Parameters:
x
-y
-
-
getBounds
_more_- Returns:
- _more_
-
getRepaintBounds
_more_- Returns:
- _more_
-
getStretchPoint
_more_- Parameters:
x
-y
-- Returns:
- _more_
-
stretchTo
_more_- Parameters:
x
-y
-pt
-correct
-- Returns:
- _more_
-
distance
public static double distance(int x1, int y1, int x2, int y2) Utility method for distance between two points- Parameters:
x1
-y1
-x2
-y2
-- Returns:
- _more_
-
transformOutputX
_more_- Parameters:
canvas
-x
-- Returns:
- _more_
-
transformOutputY
_more_- Parameters:
canvas
-x
-- Returns:
- _more_
-
transformOutput
_more_- Parameters:
canvas
-r
-- Returns:
- _more_
-
transformOutput
_more_- Parameters:
canvas
-r
-- Returns:
- _more_
-