Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.xerox.VTM.glyphs
Class VText  view VText download VText.java

java.lang.Object
  extended bycom.xerox.VTM.glyphs.Glyph
      extended bycom.xerox.VTM.glyphs.VText
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
VTextOr

public class VText
extends Glyph
implements java.lang.Cloneable

Standalone Text (font properties are set in the view, but can be changed for each VText using setSpecialFont()) vx and vy are coordinates of lower-left corner of String because it would be too time-consuming to compute the String's center (needs to be computed at each repaint: it requires access to Graphics2D) (besides it makes the VTM unstable)


Field Summary
(package private)  java.awt.geom.AffineTransform at
           
(package private)  ProjText[] pc
           
private  short text_anchor
           
static short TEXT_ANCHOR_END
          text alignment (for text anchor) used to align a VText relative to its (vx,vy coordinates coincides with end of String)
static short TEXT_ANCHOR_MIDDLE
          text alignment (for text anchor) used to align a VText relative to its (vx,vy coordinates coincides with middle of String)
static short TEXT_ANCHOR_START
          text alignment (for text anchor) used to align a VText relative to its (vx,vy coordinates coincides with start of String)
(package private)  boolean zoomSensitive
           
 
Fields inherited from class com.xerox.VTM.glyphs.Glyph
bColor, borderColor, cGlyph, coef, color, dashedContour, DEFAULT_STROKE_WIDTH, dependants, filled, font, fontSize, fontSizePolicy, HSV, HSVb, ID, mouseInsideColor, orient, owner, paintBorder, selected, selectedColor, sensit, size, stickedGlyphs, stickedTo, stroke, strokeWidth, text, textHeight, textPos, textWidth, type, visible, vsm, vx, vy, vz
 
Constructor Summary
VText(long x, long y, float z, java.awt.Color c, java.lang.String t)
           
VText(long x, long y, float z, java.awt.Color c, java.lang.String t, short ta)
           
VText(java.lang.String t)
           
 
Method Summary
 void addCamera(int verifIndex)
          used internally to create new projected coordinates to use with the new camera
 java.lang.Object clone()
          returns a clone of this object (only basic information is cloned for now: shape, orientation, position, size)
 boolean coordInside(int x, int y, int camIndex)
          detects whether the given point is inside this glyph or not
 void draw(java.awt.Graphics2D g, int vW, int vH, int i, java.awt.Stroke stdS, java.awt.geom.AffineTransform stdT)
          draw glyph
 boolean drawMe(long w1, long h1, long w2, long h2, int i)
          used to find out if it is necessary to project and draw the glyph in the current view
 boolean fillsView(long w, long h, int camIndex)
          used to find out if glyph completely fills the view (in which case it is not necessary to repaint objects at a lower altitude)
 com.xerox.VTM.engine.LongPoint getBounds(int i)
          returns width and height of the bounding box as a Point (so this is not a real Point)
 float getOrient()
          get orientation
 float getSize()
          get size (always =1)
 short getTextAnchor()
          get text anchor (one of TEXT_ANCHOR_START, TEXT_ANCHOR_MIDDLE, TEXT_ANCHOR_END)
 void initCams(int nbCam)
          called when glyph is created in order to create the initial set of projected coordinates wrt the number of cameras in the space
 void invalidate()
          force computing of text's bounding box at next paint call
 boolean isZoomSensitive()
          if false, text size is not sensitive to zoom
 int mouseInOut(int x, int y, int camIndex)
          returns 1 if mouse has entered the glyph, -1 if it has exited the glyph, 0 if nothing has changed (meaning it was already inside or outside it)
 void orientTo(float angle)
          set orientation (absolute) - has no effect
 void project(com.xerox.VTM.engine.Camera c, com.xerox.VTM.engine.ViewPanel v)
          project shape in camera coord sys prior to actual painting
 void removeCamera(int index)
          if a camera is removed from the virtual space, we should delete the corresponding projected coordinates, but do not modify the array it self because we do not want to change other cameras' index - just point to null
 void resetMouseIn(int i)
          reset prevMouseIn for projected coordinates nb i
 void reSize(float factor)
          set size (relative) - has no effect
 void setSpecialFont(java.awt.Font f)
          change font for this specific text object - f=null to get back to default font
 void setText(java.lang.String t)
          set text that should be painted with this glyph - override Glyph method to call invalidate
 void setTextAnchor(short ta)
          Set the text anchor
 void setZoomSensitive(boolean b)
          if false, text size is not sensitive to zoom
 void sizeTo(float factor)
          set size (absolute) - has no effect
 boolean validBounds(int i)
          tells whether the bounds of the text are valid at this time or not (can be invalid if the thread in charge of painting has not dealt with this glyph since invalidate() was called on it) - might be useful to test this before calling getBounds()
 
Methods inherited from class com.xerox.VTM.glyphs.Glyph
addDependant, addHSVbColor, addHSVColor, getCGlyph, getColor, getColorb, getDependants, getFillStatus, getFont, getHSVbColor, getHSVColor, getID, getLocation, getOwner, getPaintBorderStatus, getStickedGlyphs, getStroke, getStrokeWidth, getText, getType, isSelected, isSensitive, isVisible, move, moveTo, propagateMove, removeDependant, select, setBorderColor, setCGlyph, setColor, setDashed, setFill, setFontSizePolicy, setHSVbColor, setHSVColor, setID, setMouseInsideColor, setOwner, setPaintBorder, setSelectedColor, setSensitivity, setStroke, setStrokeWidth, setTextPos, setType, setVisible, setVSM, stick, toString, unstick, usesSpecialFont
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TEXT_ANCHOR_START

public static short TEXT_ANCHOR_START
text alignment (for text anchor) used to align a VText relative to its (vx,vy coordinates coincides with start of String)


TEXT_ANCHOR_MIDDLE

public static short TEXT_ANCHOR_MIDDLE
text alignment (for text anchor) used to align a VText relative to its (vx,vy coordinates coincides with middle of String)


TEXT_ANCHOR_END

public static short TEXT_ANCHOR_END
text alignment (for text anchor) used to align a VText relative to its (vx,vy coordinates coincides with end of String)


text_anchor

private short text_anchor

at

java.awt.geom.AffineTransform at

pc

ProjText[] pc

zoomSensitive

boolean zoomSensitive
Constructor Detail

VText

public VText(java.lang.String t)

VText

public VText(long x,
             long y,
             float z,
             java.awt.Color c,
             java.lang.String t)

VText

public VText(long x,
             long y,
             float z,
             java.awt.Color c,
             java.lang.String t,
             short ta)
Method Detail

initCams

public void initCams(int nbCam)
called when glyph is created in order to create the initial set of projected coordinates wrt the number of cameras in the space

Specified by:
initCams in class Glyph

addCamera

public void addCamera(int verifIndex)
used internally to create new projected coordinates to use with the new camera

Specified by:
addCamera in class Glyph

removeCamera

public void removeCamera(int index)
if a camera is removed from the virtual space, we should delete the corresponding projected coordinates, but do not modify the array it self because we do not want to change other cameras' index - just point to null

Specified by:
removeCamera in class Glyph

resetMouseIn

public void resetMouseIn(int i)
reset prevMouseIn for projected coordinates nb i

Specified by:
resetMouseIn in class Glyph

sizeTo

public void sizeTo(float factor)
set size (absolute) - has no effect

Specified by:
sizeTo in class Glyph

reSize

public void reSize(float factor)
set size (relative) - has no effect

Specified by:
reSize in class Glyph

orientTo

public void orientTo(float angle)
set orientation (absolute) - has no effect

Specified by:
orientTo in class Glyph

getSize

public float getSize()
get size (always =1)

Specified by:
getSize in class Glyph

getOrient

public float getOrient()
get orientation

Specified by:
getOrient in class Glyph

setZoomSensitive

public void setZoomSensitive(boolean b)
if false, text size is not sensitive to zoom


isZoomSensitive

public boolean isZoomSensitive()
if false, text size is not sensitive to zoom


drawMe

public boolean drawMe(long w1,
                      long h1,
                      long w2,
                      long h2,
                      int i)
used to find out if it is necessary to project and draw the glyph in the current view

Overrides:
drawMe in class Glyph

fillsView

public boolean fillsView(long w,
                         long h,
                         int camIndex)
used to find out if glyph completely fills the view (in which case it is not necessary to repaint objects at a lower altitude)

Specified by:
fillsView in class Glyph

coordInside

public boolean coordInside(int x,
                           int y,
                           int camIndex)
detects whether the given point is inside this glyph or not

Specified by:
coordInside in class Glyph

mouseInOut

public int mouseInOut(int x,
                      int y,
                      int camIndex)
returns 1 if mouse has entered the glyph, -1 if it has exited the glyph, 0 if nothing has changed (meaning it was already inside or outside it)

Specified by:
mouseInOut in class Glyph

project

public void project(com.xerox.VTM.engine.Camera c,
                    com.xerox.VTM.engine.ViewPanel v)
project shape in camera coord sys prior to actual painting

Specified by:
project in class Glyph

draw

public void draw(java.awt.Graphics2D g,
                 int vW,
                 int vH,
                 int i,
                 java.awt.Stroke stdS,
                 java.awt.geom.AffineTransform stdT)
draw glyph

Specified by:
draw in class Glyph

setText

public void setText(java.lang.String t)
set text that should be painted with this glyph - override Glyph method to call invalidate

Overrides:
setText in class Glyph

invalidate

public void invalidate()
force computing of text's bounding box at next paint call


getBounds

public com.xerox.VTM.engine.LongPoint getBounds(int i)
returns width and height of the bounding box as a Point (so this is not a real Point)


validBounds

public boolean validBounds(int i)
tells whether the bounds of the text are valid at this time or not (can be invalid if the thread in charge of painting has not dealt with this glyph since invalidate() was called on it) - might be useful to test this before calling getBounds()


setSpecialFont

public void setSpecialFont(java.awt.Font f)
change font for this specific text object - f=null to get back to default font

Overrides:
setSpecialFont in class Glyph

setTextAnchor

public void setTextAnchor(short ta)
Set the text anchor


getTextAnchor

public short getTextAnchor()
get text anchor (one of TEXT_ANCHOR_START, TEXT_ANCHOR_MIDDLE, TEXT_ANCHOR_END)


clone

public java.lang.Object clone()
returns a clone of this object (only basic information is cloned for now: shape, orientation, position, size)

Specified by:
clone in class Glyph