public class VText<T> extends ClosedShape
VTextLayout
,
VTextOr
Modifier and Type | Field and Description |
---|---|
protected Font |
font |
protected float |
fontSize
Font size in pixels (read-only).
|
protected double |
lcoef |
protected static Font |
mainFont |
protected double |
oldcoef |
protected double |
oldlcoef |
int |
paddingX
Offset between text and vertical borders
|
int |
paddingY
Offset betwenn text and horizontal borders
|
protected fr.inria.zvtm.glyphs.projection.ProjText[] |
pc
For internal use.
|
protected float |
scaleFactor |
protected String |
text |
protected short |
text_anchor |
static short |
TEXT_ANCHOR_END
Text alignment (for text anchor) used to align a VText (vx,vy coordinates coincides with end of String).
|
static short |
TEXT_ANCHOR_MIDDLE
Text alignment (for text anchor) used to align a VText (vx,vy coordinates coincides with middle of String).
|
static short |
TEXT_ANCHOR_START
Text alignment (for text anchor) used to align a VText (vx,vy coordinates coincides with start of String).
|
protected boolean |
zoomSensitive |
bColor, borderColor, cursorInsideFColor, HSVb
alphaC, coef, color, cursorInsideColor, ENTERED_GLYPH, EXITED_GLYPH, fColor, HSV, NO_CURSOR_EVENT, orient, sensit, size, stickedTo, stroke, visible, vx, vy, vz
acO
Constructor and Description |
---|
VText(double x,
double y,
int z,
Color c,
Color bkg,
String t,
short ta,
float scale,
float alpha) |
VText(double x,
double y,
int z,
Color c,
String t) |
VText(double x,
double y,
int z,
Color c,
String t,
short ta) |
VText(double x,
double y,
int z,
Color c,
String t,
short ta,
float scale) |
VText(double x,
double y,
int z,
Color c,
String t,
short ta,
float scale,
float alpha) |
VText(String t) |
Modifier and Type | Method and Description |
---|---|
void |
addCamera(int verifIndex)
Create new projected coordinates.
|
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.
|
boolean |
coordInside(int jpx,
int jpy,
Camera c,
double cvx,
double cvy)
Detect whether the given point is inside this glyph or not.
|
boolean |
coordInsideP(int jpx,
int jpy,
Camera c)
not implemented for VText.
|
boolean |
coordInsideV(double cvx,
double cvy,
Camera c)
Detect whether the given point is inside this glyph or not.
|
void |
draw(Graphics2D g,
int vW,
int vH,
int i,
Stroke stdS,
AffineTransform stdT,
int dx,
int dy)
Draw this glyph.
|
void |
drawForLens(Graphics2D g,
int vW,
int vH,
int i,
Stroke stdS,
AffineTransform stdT,
int dx,
int dy)
Draw this glyph through a lens.
|
boolean |
fillsView(double w,
double h,
int camIndex)
Find out if this glyph completely fills a view.
|
Color |
getBorderColor()
Get the text's background color.
|
Point2D.Double |
getBounds(int i)
Get the width and height of the bounding box in virtual space.
|
Font |
getFont()
Get the Font used to display this specific text object.
|
Shape |
getJava2DShape()
Get the Java2D Shape corresponding to this Glyph.
|
static Font |
getMainFont()
returns default font used by glyphs
|
double |
getOrient()
Get the glyph's orientation.
|
Point |
getPadding() |
float |
getScale()
Get the scale factor for this text.
|
double |
getSize()
Get glyph's size (size of bounding circle).
|
String |
getText()
Get text painted by this glyph.
|
short |
getTextAnchor()
Get text anchor.
|
static float |
getTextDisplayedAsSegCoef()
Get the value under which a VText is drawn as a point/segment instead of an actual text (considered too small to be read).
|
void |
highlight(boolean b,
Color selectedColor)
Highlight this glyph to give visual feedback when the cursor is inside it.
|
void |
initCams(int nbCam)
Initialize projected coordinates.
|
void |
invalidate()
Force computation of text's bounding box at next call to draw().
|
boolean |
isScaleIndependent()
Indicates whether the text is scaled according to camera's altitude.
|
void |
orientTo(double angle)
Cannot be reoriented.
|
void |
project(Camera c,
Dimension d)
Project glyph w.r.t a given camera's coordinate system, prior to actual painting.
|
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 |
removeCamera(int index)
Dispose of projected coordinates.
|
void |
reSize(double factor)
No effect.
|
void |
setBorderColor(Color c)
Set the text's background color.
|
void |
setFont(Font f)
Change the Font used to display this specific text object.
|
static void |
setMainFont(Font f)
set default font used by glyphs
|
void |
setPadding(int x,
int y) |
void |
setScale(float s)
Set the scale factor for this text.
|
void |
setScaleIndependent(boolean b)
Set to true if the text should not be scaled according to camera's altitude.
|
void |
setText(String t)
Set text that should be painted.
|
void |
setTextAnchor(short ta)
Set the text anchor
|
static void |
setTextDisplayedAsSegCoef(float f)
Set the value under which a VText is drawn as a point/segment instead of an actual text (considered too small to be read).
|
void |
sizeTo(double factor)
No effect.
|
boolean |
usesSpecificFont()
Indicates whether this glyph is using a special font.
|
boolean |
validBounds(int i)
Indicates whether the bounds of the text are valid at this time or not.
|
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.
|
addHSVbColor, getDefaultBorderColor, getHSVbColor, isBorderDrawn, isFilled, setCursorInsideFillColor, setDrawBorder, setFilled, setHSVbColor
addHSVColor, getBounds, getColor, getDefaultColor, getDefaultCursorInsideHighlightColor, getHSVColor, getLocation, getOwner, getStickedGlyphArray, getStroke, getTranslucencyValue, getType, getZindex, isSelected, isSensitive, isVisible, isVisibleThroughLens, move, moveTo, propagateMove, select, setColor, setCursorInsideHighlightColor, setDefaultCursorInsideHighlightColor, setHSVColor, setOwner, setSensitivity, setStroke, setTranslucencyValue, setType, setVisible, setZindex, stick, stickToGlyph, toString, unstick, unstickAllGlyphs, unstickAllGlyphs, unstickFromGlyph, visibleInViewport
public static final short TEXT_ANCHOR_START
public static final short TEXT_ANCHOR_MIDDLE
public static final short TEXT_ANCHOR_END
protected short text_anchor
protected fr.inria.zvtm.glyphs.projection.ProjText[] pc
protected boolean zoomSensitive
protected static Font mainFont
protected float fontSize
protected Font font
protected String text
protected float scaleFactor
protected double lcoef
protected double oldcoef
protected double oldlcoef
public int paddingX
public int paddingY
public VText(String t)
t
- text stringpublic VText(double x, double y, int z, Color c, String t)
x
- coordinate in virtual spacey
- coordinate in virtual spacez
- z-index (pass 0 if you do not use z-ordering)c
- fill colort
- text stringpublic VText(double x, double y, int z, Color c, String t, short ta)
x
- coordinate in virtual spacey
- coordinate in virtual spacez
- z-index (pass 0 if you do not use z-ordering)c
- fill colort
- text stringta
- text-anchor (for alignment: one of TEXT_ANCHOR_*)public VText(double x, double y, int z, Color c, String t, short ta, float scale)
x
- coordinate in virtual spacey
- coordinate in virtual spacez
- z-index (pass 0 if you do not use z-ordering)c
- fill colort
- text stringta
- text-anchor (for alignment: one of TEXT_ANCHOR_*)scale
- scaleFactor w.r.t original image sizepublic VText(double x, double y, int z, Color c, String t, short ta, float scale, float alpha)
x
- coordinate in virtual spacey
- coordinate in virtual spacez
- z-index (pass 0 if you do not use z-ordering)c
- fill colort
- text stringta
- text-anchor (for alignment: one of TEXT_ANCHOR_*)scale
- scaleFactor w.r.t original image sizealpha
- in [0;1.0]. 0 is fully transparent, 1 is opaquepublic VText(double x, double y, int z, Color c, Color bkg, String t, short ta, float scale, float alpha)
x
- coordinate in virtual spacey
- coordinate in virtual spacez
- z-index (pass 0 if you do not use z-ordering)c
- fill colorbkg
- background color (null if not painted)t
- text stringta
- text-anchor (for alignment: one of TEXT_ANCHOR_*)scale
- scaleFactor w.r.t original image sizealpha
- in [0;1.0]. 0 is fully transparent, 1 is opaquepublic static Font getMainFont()
public static void setMainFont(Font f)
public void initCams(int nbCam)
Glyph
initCams
in class Glyph
nbCam
- current number of cameras in the virtual spaceGlyph.addCamera(int verifIndex)
,
Glyph.removeCamera(int index)
public void addCamera(int verifIndex)
Glyph
addCamera
in class Glyph
verifIndex
- camera index, just to be sure that the number of projected coordinates is consistent with the number of cameras.Glyph.initCams(int nbCam)
,
Glyph.removeCamera(int index)
public void removeCamera(int index)
Glyph
removeCamera
in class Glyph
Glyph.initCams(int nbCam)
,
Glyph.addCamera(int verifIndex)
public void sizeTo(double factor)
sizeTo
in class Glyph
setScale(float s)
public void reSize(double factor)
reSize
in class Glyph
setScale(float s)
public void orientTo(double angle)
public double getSize()
getSize
in class Glyph
getBounds(int i)
,
validBounds(int i)
,
invalidate()
public double getOrient()
Glyph
public void setScaleIndependent(boolean b)
b
- false by default.isScaleIndependent()
public boolean isScaleIndependent()
setScaleIndependent(boolean b)
public static void setTextDisplayedAsSegCoef(float f)
f
- value compared to the product of the font size by the projection value. Default is 0.5.
Raising this value implies that more text that was still displayed as a string will be displayed as a segment and conversely.public static float getTextDisplayedAsSegCoef()
public void setBorderColor(Color c)
setBorderColor
in class ClosedShape
c
- background fill color. null if background should not be painted.Glyph.setColor(Color c)
public Color getBorderColor()
getBorderColor
in class ClosedShape
ClosedShape.getDefaultBorderColor()
public boolean visibleInRegion(double wb, double nb, double eb, double sb, int i)
Glyph
visibleInRegion
in class Glyph
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 containedInRegion(double wb, double nb, double eb, double sb, int i)
Glyph
containedInRegion
in class Glyph
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 fillsView(double w, double h, int camIndex)
Glyph
public boolean coordInside(int jpx, int jpy, Camera c, double cvx, double cvy)
Glyph
coordInside
in class Glyph
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 observed (only a few types of Glyph actually require this information: SICircle, SIRectangle, VText)cvx
- virtual space coordinatescvy
- virtual space coordinatesGlyph.coordInsideV(double cvx, double cvy, Camera c)
,
Glyph.coordInsideP(int jpx, int jpy, Camera c)
public boolean coordInsideV(double cvx, double cvy, Camera c)
Glyph
coordInsideV
in class Glyph
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)Glyph.coordInside(int jpx, int jpy, Camera c, double cvx, double cvy)
,
Glyph.coordInsideP(int jpx, int jpy, Camera c)
public boolean coordInsideP(int jpx, int jpy, Camera c)
coordInsideP
in class Glyph
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 observedGlyph.coordInsideV(double cvx, double cvy, Camera c)
,
Glyph.coordInside(int jpx, int jpy, Camera c, double cvx, double cvy)
public boolean visibleInDisc(double dvx, double dvy, double dvr, Shape dvs, int camIndex, int jpx, int jpy, int dpr)
Glyph
visibleInDisc
in class Glyph
public void project(Camera c, Dimension d)
Glyph
public void projectForLens(Camera c, int lensWidth, int lensHeight, float lensMag, double lensx, double lensy)
Glyph
projectForLens
in class Glyph
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 void draw(Graphics2D g, int vW, int vH, int i, Stroke stdS, AffineTransform stdT, int dx, int dy)
Glyph
draw
in class Glyph
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 void drawForLens(Graphics2D g, int vW, int vH, int i, Stroke stdS, AffineTransform stdT, int dx, int dy)
Glyph
drawForLens
in class Glyph
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 void setText(String t)
public void setScale(float s)
s
- scale factorpublic float getScale()
public void invalidate()
validBounds(int i)
,
getBounds(int i)
public Point2D.Double getBounds(int i)
i
- index of camera (Camera.getIndex())validBounds(int i)
,
invalidate()
public boolean validBounds(int i)
getBounds(int i)
,
invalidate()
public void setFont(Font f)
f
- set to null to use the default fontusesSpecificFont()
,
getFont()
public Font getFont()
usesSpecificFont()
,
setFont(Font f)
public boolean usesSpecificFont()
setFont(Font f)
,
getFont()
public String getText()
public void setTextAnchor(short ta)
ta
- one of TEXT_ANCHOR_START, TEXT_ANCHOR_MIDDLE, TEXT_ANCHOR_ENDpublic short getTextAnchor()
public Shape getJava2DShape()
Glyph
getJava2DShape
in class Glyph
public void highlight(boolean b, Color selectedColor)
highlight
in class ClosedShape
public void setPadding(int x, int y)
public Point getPadding()
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.