public abstract class Glyph<T> extends Object implements Cloneable, Translucent
Modifier and Type | Field and Description |
---|---|
AlphaComposite |
alphaC
AlphaComposite used to paint glyph if not opaque.
|
protected double |
coef |
protected Color |
color |
protected Color |
cursorInsideColor |
static short |
ENTERED_GLYPH
Value sent to cursor when it enters this glyph.
|
static short |
EXITED_GLYPH
Value sent to cursor when it exits this glyph.
|
protected Color |
fColor |
protected float[] |
HSV |
static short |
NO_CURSOR_EVENT
Value sent to cursor when it neither enters nor exit this glyph.
|
protected double |
orient
Glyph's orientation in [0:2Pi[ (read-only).
|
protected boolean |
sensit |
protected double |
size
Diameter of bounding circle (read-only).
|
Object |
stickedTo
Object to which this glyph is sticked (could be a VCursor, a Camera or a Glyph).
|
protected Stroke |
stroke
For internal use.
|
protected boolean |
visible |
double |
vx
Horizontal coordinate of the glyph's geomatrical center, in virtual space.
|
double |
vy
Vertical coordinate of the glyph's geomatrical center, in virtual space.
|
protected int |
vz
z-index
|
acO
Constructor and Description |
---|
Glyph() |
Modifier and Type | Method and Description |
---|---|
abstract void |
addCamera(int verifIndex)
Create new projected coordinates.
|
void |
addHSVbColor(float h,
float s,
float v)
Set the glyph's border color (absolute value, HSV color space).
|
void |
addHSVColor(float h,
float s,
float v)
Set the glyph's main color (absolute value, HSV color space).
|
Object |
clone() |
boolean |
containedInRegion(double wb,
double nb,
double eb,
double sb,
int i)
Method used internally to find out if it is necessary to project and draw the glyph through a lens for a given camera.
|
abstract boolean |
coordInside(int jpx,
int jpy,
Camera c,
double cvx,
double cvy)
Detect whether the given point is inside this glyph or not.
|
abstract boolean |
coordInsideP(int jpx,
int jpy,
Camera c)
Detect whether the given point is inside this glyph or not.
|
abstract boolean |
coordInsideV(double cvx,
double cvy,
Camera c)
Detect whether the given point is inside this glyph or not.
|
abstract void |
draw(Graphics2D g,
int vW,
int vH,
int i,
Stroke stdS,
AffineTransform stdT,
int dx,
int dy)
Draw this glyph.
|
abstract void |
drawForLens(Graphics2D g,
int vW,
int vH,
int i,
Stroke stdS,
AffineTransform stdT,
int dx,
int dy)
Draw this glyph through a lens.
|
abstract boolean |
fillsView(double w,
double h,
int camIndex)
Find out if this glyph completely fills a view.
|
Color |
getBorderColor()
Get the glyph's border color (use getColor for text, paths, segments, etc.).
|
double[] |
getBounds()
Get the bounding box of this Glyph in virtual space coordinates.
|
Color |
getColor()
Get the glyph's current main color.
|
Color |
getDefaultColor()
Get the glyph's default main color.
|
static Color |
getDefaultCursorInsideHighlightColor() |
float[] |
getHSVbColor()
Get border color's HSV components.
|
float[] |
getHSVColor()
Get main color's HSV components.
|
abstract Shape |
getJava2DShape()
Get the Java2D Shape corresponding to this Glyph.
|
Point2D.Double |
getLocation()
Get the coordinates of the glyph's geometrical center.
|
abstract double |
getOrient()
Get the glyph's orientation.
|
T |
getOwner()
Get the object this glyph represents in the client application.
|
abstract double |
getSize()
Get glyph's size (diameter of bounding circle).
|
Glyph[] |
getStickedGlyphArray()
Get the list of glyphs sticked to this one.
|
Stroke |
getStroke()
Get the stroke used to paint glyph's border.
|
float |
getTranslucencyValue()
Get alpha channel value (translucency).
|
String |
getType()
Get the type of this glyph.
|
int |
getZindex()
Get this object's z-index.
|
abstract void |
highlight(boolean b,
Color selectedColor)
Highlight this glyph to give visual feedback when the cursor is inside it.
|
abstract void |
initCams(int nbCam)
Initialize projected coordinates.
|
boolean |
isBorderDrawn()
Indicates whether the glyph's border is drawn or not.
|
boolean |
isFilled()
Indicates whether this glyph's interior is filled or not.
|
boolean |
isSelected()
Get this glyph's selection status.
|
boolean |
isSensitive()
Indicates whether ZVTM sends events related to cursor entry/exit in/from this glyph or not.
|
boolean |
isVisible()
Get this glyph's visibility status.
|
boolean |
isVisibleThroughLens()
Get this glyph's visibility status when seen through a lens.
|
void |
move(double x,
double y)
Translate the glyph by (x,y) - relative translation.
|
void |
moveTo(double x,
double y)
Translate the glyph to (x,y) - absolute translation.
|
abstract void |
orientTo(double angle)
Set the glyph's absolute orientation.
|
abstract void |
project(Camera c,
Dimension d)
Project glyph w.r.t a given camera's coordinate system, prior to actual painting.
|
abstract void |
projectForLens(Camera c,
int lensWidth,
int lensHeight,
float lensMag,
double lensx,
double lensy)
Project glyph w.r.t a given camera's coordinate system, prior to actual painting through a lens.
|
void |
propagateMove(double x,
double y)
Propagate this glyph's movement to all glyphs constrained by this one.
|
abstract void |
removeCamera(int index)
Dispose of projected coordinates.
|
abstract void |
reSize(double factor)
Set glyph's size by multiplying its bounding circle diameter by a factor.
|
void |
select(boolean b)
Select this glyph.
|
void |
setBorderColor(Color c)
Set the glyph's border color (use setColor for text, paths, segments, etc.).
|
void |
setColor(Color c)
Set the glyph's main color.
|
void |
setCursorInsideHighlightColor(Color c)
Set the glyph's border color when cursor is inside it.
|
static void |
setDefaultCursorInsideHighlightColor(Color c) |
void |
setHSVbColor(float h,
float s,
float v)
Set the glyph's border color (absolute value, HSV color space).
|
void |
setHSVColor(float h,
float s,
float v)
Set the glyph's main color (absolute value, HSV color space).
|
void |
setOwner(T t)
Set the object this glyph represents in the client application.
|
void |
setSensitivity(boolean b)
Make this glyph sensitive (or not).
|
void |
setStroke(Stroke s)
Set a custom stroke to paint glyph's border.
|
void |
setTranslucencyValue(float alpha)
Set alpha channel value (translucency).
|
void |
setType(String t)
Set the type of this glyph.
|
void |
setVisible(boolean b)
Make this glyph (in)visible (the glyph remains sensitive to cursor in/out events).
Use methods VirtualSpace.show(Glyph g) and VirtualSpace.hide(Glyph g) to make a glyph both (in)visible and (in)sensitive. |
void |
setZindex(int z)
FOR INTERNAL USE ONLY.
|
abstract void |
sizeTo(double s)
Set glyph's size by setting its bounding circle's diameter.
|
void |
stick(Glyph g)
Attach a glyph to this one.
|
static void |
stickToGlyph(Glyph g1,
Glyph g2)
Stick glyph g1 to glyph g2.
|
String |
toString()
Get a string representation of this glyph.
|
void |
unstick(Glyph g)
Unattach a glyph from this one.
|
void |
unstickAllGlyphs()
Unattach all glyphs attached to this one.
|
static void |
unstickAllGlyphs(Glyph g)
Unstick all glyphs sticked to Glyph g.
|
static void |
unstickFromGlyph(Glyph g1,
Glyph g2)
Unstick glyph g1 from glyph g2.
|
boolean |
visibleInDisc(double dvx,
double dvy,
double dvr,
Shape dvs,
int camIndex,
int jpx,
int jpy,
int dpr)
Find out if a glyph is visible in a circular area.
|
boolean |
visibleInRegion(double wb,
double nb,
double eb,
double sb,
int i)
Method used internally to find out if it is necessary to project and draw this glyph for a given camera.
|
boolean |
visibleInViewport(double wb,
double nb,
double eb,
double sb,
Camera c) |
public double vx
public double vy
protected int vz
protected double size
sizeTo(double s)
,
reSize(double factor)
,
getSize()
protected double orient
getOrient()
,
orientTo(double angle)
protected boolean visible
protected boolean sensit
protected Color color
protected float[] HSV
protected Color fColor
protected Color cursorInsideColor
public AlphaComposite alphaC
protected Stroke stroke
public Object stickedTo
public static final short ENTERED_GLYPH
public static final short EXITED_GLYPH
public static final short NO_CURSOR_EVENT
protected double coef
public T getOwner()
public void setOwner(T t)
t
- provided by client application, null by default.public String getType()
public void setType(String t)
t
- arbitrary string, set by client application. Null if not set.public String toString()
public void move(double x, double y)
moveTo(double x, double y)
public void moveTo(double x, double y)
move(double x, double y)
public Point2D.Double getLocation()
public abstract double getSize()
public abstract void sizeTo(double s)
reSize(double factor)
public abstract void reSize(double factor)
sizeTo(double s)
public abstract double getOrient()
public abstract void orientTo(double angle)
angle
- in [0:2Pi[public int getZindex()
public void setZindex(int z)
public void setSensitivity(boolean b)
public boolean isSensitive()
public void setVisible(boolean b)
b
- true to make glyph visible, false to make it invisibleVirtualSpace.show(Glyph g)
,
VirtualSpace.hide(Glyph g)
public boolean isVisible()
public boolean isVisibleThroughLens()
public static void setDefaultCursorInsideHighlightColor(Color c)
public static Color getDefaultCursorInsideHighlightColor()
public boolean isFilled()
public boolean isBorderDrawn()
public void setCursorInsideHighlightColor(Color c)
c
- set to null to keep the original color.public void setColor(Color c)
public void setBorderColor(Color c)
setColor(Color c)
public void setHSVColor(float h, float s, float v)
h
- hue in [0.0, 1.0]s
- saturation in [0.0, 1.0]v
- value (brightness) in [0.0, 1.0]addHSVColor(float h,float s,float v)
public void addHSVColor(float h, float s, float v)
h
- hue so that the final hue is in [0.0, 1.0]s
- saturation so that the final saturation is in [0.0, 1.0]v
- value so that the final value (brightness) is in [0.0, 1.0]\setHSVColor(float h,float s,float v)
public void setHSVbColor(float h, float s, float v)
h
- hue in [0.0, 1.0]s
- saturation in [0.0, 1.0]v
- value (brightness) in [0.0, 1.0]addHSVbColor(float h,float s,float v)
public void addHSVbColor(float h, float s, float v)
h
- hue so that the final hue is in [0.0, 1.0]s
- saturation so that the final saturation is in [0.0, 1.0]v
- value so that the final value (brightness) is in [0.0, 1.0]setHSVbColor(float h,float s,float v)
public float[] getHSVColor()
public float[] getHSVbColor()
public Color getColor()
getDefaultColor()
public Color getDefaultColor()
getColor()
public Color getBorderColor()
getColor()
public abstract void highlight(boolean b, Color selectedColor)
public void setTranslucencyValue(float alpha)
setTranslucencyValue
in interface Translucent
alpha
- in [0;1.0]. 0 is fully transparent, 1 is opaquepublic float getTranslucencyValue()
getTranslucencyValue
in interface Translucent
public void select(boolean b)
b
- true to select glyph, false to unselect itpublic boolean isSelected()
public void setStroke(Stroke s)
s
- stroke (null to set standard 1px-thick stroke)public Stroke getStroke()
public void propagateMove(double x, double y)
public void stick(Glyph g)
g
- glyph to be attached to this onepublic void unstick(Glyph g)
g
- glyph to be unattached from this onepublic void unstickAllGlyphs()
public Glyph[] getStickedGlyphArray()
public abstract void project(Camera c, Dimension d)
c
- camerad
- dimension of View using camera cpublic abstract void projectForLens(Camera c, int lensWidth, int lensHeight, float lensMag, double lensx, double lensy)
c
- cameralensWidth
- width of lens activated in View using this cameralensHeight
- height of lens activated in View using this cameralensMag
- magnification factor of lens activated in View using this cameralensx
- horizontal coordinateof lens activated in View using this cameralensy
- vertical coordinate of lens activated in View using this camerapublic abstract void draw(Graphics2D g, int vW, int vH, int i, Stroke stdS, AffineTransform stdT, int dx, int dy)
g
- graphics context in which the glyph should be drawnvW
- associated View width (used by some closed shapes to determine if it is worth painting the glyph's border)vH
- associated View height (used by some closed shapes to determine if it is worth painting the glyph's border)i
- camera index in the virtual space containing the glyphstdS
- default strokestdT
- identity transformdx
- horizontal offsetdy
- vertical offsetpublic abstract void drawForLens(Graphics2D g, int vW, int vH, int i, Stroke stdS, AffineTransform stdT, int dx, int dy)
g
- graphics context in which the glyph should be drawnvW
- associated View width (used by some closed shapes to determine if it is worth painting the glyph's border)vH
- associated View height (used by some closed shapes to determine if it is worth painting the glyph's border)i
- camera index in the virtual space containing the glyphstdS
- default strokestdT
- identity transformdx
- horizontal offsetdy
- vertical offsetpublic abstract void initCams(int nbCam)
nbCam
- current number of cameras in the virtual spaceaddCamera(int verifIndex)
,
removeCamera(int index)
public abstract void addCamera(int verifIndex)
verifIndex
- camera index, just to be sure that the number of projected coordinates is consistent with the number of cameras.initCams(int nbCam)
,
removeCamera(int index)
public abstract void removeCamera(int index)
initCams(int nbCam)
,
addCamera(int verifIndex)
public abstract boolean coordInside(int jpx, int jpy, Camera c, double cvx, double cvy)
jpx
- provide projected JPanel coordinates of the associated view, not virtual space coordinatesjpy
- provide projected JPanel coordinates of the associated view, not virtual space coordinatescvx
- virtual space coordinatescvy
- virtual space coordinatesc
- camera through which the glyph is observed (only a few types of Glyph actually require this information: SICircle, SIRectangle, VText)coordInsideV(double cvx, double cvy, Camera c)
,
coordInsideP(int jpx, int jpy, Camera c)
public abstract boolean coordInsideV(double cvx, double cvy, Camera c)
cvx
- virtual space coordinatescvy
- virtual space coordinatesc
- camera through which the glyph is observed (only a few types of Glyph actually require this information: SICircle, SIRectangle, VText)coordInside(int jpx, int jpy, Camera c, double cvx, double cvy)
,
coordInsideP(int jpx, int jpy, Camera c)
public abstract boolean coordInsideP(int jpx, int jpy, Camera c)
jpx
- provide projected JPanel coordinates of the associated view, not virtual space coordinatesjpy
- provide projected JPanel coordinates of the associated view, not virtual space coordinatesc
- camera through which the glyph is observedcoordInsideV(double cvx, double cvy, Camera c)
,
coordInside(int jpx, int jpy, Camera c, double cvx, double cvy)
public boolean visibleInRegion(double wb, double nb, double eb, double sb, int i)
wb
- west region boundary (virtual space coordinates)nb
- north region boundary (virtual space coordinates)eb
- east region boundary (virtual space coordinates)sb
- south region boundary (virtual space coordinates)i
- camera index (useuful only for some glyph classes redefining this method)public boolean visibleInViewport(double wb, double nb, double eb, double sb, Camera c)
public boolean containedInRegion(double wb, double nb, double eb, double sb, int i)
wb
- west region boundary (virtual space coordinates)nb
- north region boundary (virtual space coordinates)eb
- east region boundary (virtual space coordinates)sb
- south region boundary (virtual space coordinates)i
- camera index (useuful only for some glyph classes redefining this method)public abstract boolean fillsView(double w, double h, int camIndex)
public boolean visibleInDisc(double dvx, double dvy, double dvr, Shape dvs, int camIndex, int jpx, int jpy, int dpr)
public double[] getBounds()
public static void stickToGlyph(Glyph g1, Glyph g2)
public static void unstickFromGlyph(Glyph g1, Glyph g2)
public static void unstickAllGlyphs(Glyph g)
public abstract Shape getJava2DShape()
Copyright © 2000-2002 Xerox Corporation. All Rights Reserved
Copyright © 2003 World Wide Web Consortium. All Rights Reserved
Copyright © 2004-2015 INRIA. All Rights Reserved
Licensed under the GNU LGPL. For full terms see the file COPYING.