public class VTextLayout<T> extends VText
Modifier and Type | Field and Description |
---|---|
static int |
INSERTION_INDEX_UNDEFINED |
font, fontSize, lcoef, mainFont, oldcoef, oldlcoef, paddingX, paddingY, pc, scaleFactor, text, text_anchor, TEXT_ANCHOR_END, TEXT_ANCHOR_MIDDLE, TEXT_ANCHOR_START, 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 |
---|
VTextLayout(double x,
double y,
int z,
Color c,
Color bkg,
String t,
short ta,
Font f,
float scale,
float alpha) |
VTextLayout(double x,
double y,
int z,
Color c,
String t) |
VTextLayout(double x,
double y,
int z,
Color c,
String t,
short ta,
Font f) |
VTextLayout(double x,
double y,
int z,
Color c,
String t,
short ta,
Font f,
float scale) |
VTextLayout(double x,
double y,
int z,
Color c,
String t,
short ta,
Font f,
float scale,
float alpha) |
VTextLayout(String t) |
Modifier and Type | Method and Description |
---|---|
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.
|
static void |
editEvent(VTextLayout tl,
KeyEvent e)
Default implementation of common edit key events.
|
Point2D.Double |
getBounds(int i)
Get the width and height of the bounding box in virtual space.
|
int |
getCaretPosition()
Get the caret's position within the string.
|
static Color |
getHighlightColor() |
Shape |
getJava2DShape()
Get the Java2D Shape corresponding to this Glyph.
|
double |
getSize()
Get glyph's size (size of bounding circle).
|
static Color |
getStrongCaretColor()
Get the color used to paint the strong caret.
|
TextLayout |
getTextLayout()
Get the underlyoing AWT TextLayout instance.
|
static Color |
getWeakCaretColor()
Get the color used to paint the weak caret.
|
TextHitInfo |
hitTestChar(int jpx,
int jpy,
Camera c)
Returns a TextHitInfo corresponding to the specified point.
|
TextHitInfo |
hitTestChar(int jpx,
int jpy,
Camera c,
int dx,
int dy)
Returns a TextHitInfo corresponding to the specified point.
|
void |
invalidate()
Force computation of text's bounding box at next call to draw().
|
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.
|
static void |
setCaretColors(Color sc,
Color wc)
Set the strong and weak caret colors.
|
void |
setCaretPosition(int ii)
Set the caret's position within the string.
|
void |
setFont(Font f)
Change the Font used to display this specific text object.
|
static void |
setHighlightColor(Color c) |
void |
setHighlightPosition(int firstEndPoint,
int secondEndPoint) |
void |
updateCaretPosition(int jpx,
int jpy,
Camera c)
Update the caret position to the point corresponding to the provided coordinates.
|
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.
|
addCamera, fillsView, getBorderColor, getFont, getMainFont, getOrient, getPadding, getScale, getText, getTextAnchor, getTextDisplayedAsSegCoef, highlight, initCams, isScaleIndependent, orientTo, removeCamera, reSize, setBorderColor, setMainFont, setPadding, setScale, setScaleIndependent, setText, setTextAnchor, setTextDisplayedAsSegCoef, sizeTo, usesSpecificFont, validBounds
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 int INSERTION_INDEX_UNDEFINED
public VTextLayout(String t)
t
- text stringpublic VTextLayout(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 VTextLayout(double x, double y, int z, Color c, String t, short ta, Font f)
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 VTextLayout(double x, double y, int z, Color c, String t, short ta, Font f, 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_*)f
- font used to render this TextLayoutscale
- scaleFactor w.r.t original image sizepublic VTextLayout(double x, double y, int z, Color c, String t, short ta, Font f, 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_*)f
- font used to render this TextLayoutscale
- scaleFactor w.r.t original image sizealpha
- in [0;1.0]. 0 is fully transparent, 1 is opaquepublic VTextLayout(double x, double y, int z, Color c, Color bkg, String t, short ta, Font f, 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_*)f
- font used to render this TextLayoutscale
- scaleFactor w.r.t original image sizealpha
- in [0;1.0]. 0 is fully transparent, 1 is opaquepublic TextLayout getTextLayout()
public static void setCaretColors(Color sc, Color wc)
sc
- strong caret colorwc
- weak caret colorpublic static Color getStrongCaretColor()
public static Color getWeakCaretColor()
public void setCaretPosition(int ii)
ii
- insertion index (offset) in the TextLayout. Pass INSERTION_INDEX_UNDEFINED to remove the caret.public int getCaretPosition()
public TextHitInfo hitTestChar(int jpx, int jpy, Camera c)
jpx
- click coordinates, in JPanel coordinates.jpy
- click coordinates, in JPanel coordinates.c
- camera observing the TextLayout.public TextHitInfo hitTestChar(int jpx, int jpy, Camera c, int dx, int dy)
jpx
- click coordinates, in JPanel coordinates.jpy
- click coordinates, in JPanel coordinates.c
- camera observing the TextLayout.dx
- x-offest for hit test, typically used to give a Portal horizontal offset w.r.t the parent view's top left corner (JPanel coordinates).dy
- y-offest for hit test, typically used to give a Portal horizontal offset w.r.t the parent view's top left corner (JPanel coordinates).public void updateCaretPosition(int jpx, int jpy, Camera c)
jpx
- click coordinates, in JPanel coordinates.jpy
- click coordinates, in JPanel coordinates.c
- camera observing the TextLayout.public static void setHighlightColor(Color c)
public static Color getHighlightColor()
public void setHighlightPosition(int firstEndPoint, int secondEndPoint)
public void invalidate()
invalidate
in class VText
VText.validBounds(int i)
,
getBounds(int i)
public double getSize()
getSize
in class VText
getBounds(int i)
,
VText.validBounds(int i)
,
invalidate()
public boolean visibleInRegion(double wb, double nb, double eb, double sb, int i)
Glyph
visibleInRegion
in class VText
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 VText
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 coordInside(int jpx, int jpy, Camera c, double cvx, double cvy)
Glyph
coordInside
in class VText
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 VText
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 VText
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 VText
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 VText
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 VText
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 VText
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 Point2D.Double getBounds(int i)
getBounds
in class VText
i
- index of camera (Camera.getIndex())VText.validBounds(int i)
,
invalidate()
public void setFont(Font f)
setFont
in class VText
f
- set to null to use the default fontVText.usesSpecificFont()
,
VText.getFont()
public Shape getJava2DShape()
Glyph
getJava2DShape
in class VText
public static void editEvent(VTextLayout tl, KeyEvent e)
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.