|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfr.inria.zvtm.glyphs.Glyph
fr.inria.zvtm.glyphs.ClosedShape
fr.inria.zvtm.glyphs.VSwingComponent
public class VSwingComponent
Wrapper for Swing components.
Example:
JButton b = new JButton("Button 1");
b.setSize(100,50);
vs.addGlyph(new VSwingComponent(200, 0, 0, b));
| Field Summary | |
|---|---|
double |
ar
Aspect ratio: width divided by height (read-only). |
AffineTransform |
at
For internal use. |
fr.inria.zvtm.glyphs.projection.RProjectedCoordsP[] |
pc
For internal use. |
double |
scaleFactor
For internal use. |
double |
trueCoef
For internal use. |
double |
vh
Height in virtual space (read-only). |
double |
vw
Width in virtual space (read-only). |
boolean |
zoomSensitive
For internal use. |
| Fields inherited from class fr.inria.zvtm.glyphs.ClosedShape |
|---|
bColor, borderColor, cursorInsideFColor, HSVb |
| Fields inherited from class fr.inria.zvtm.glyphs.Glyph |
|---|
alphaC, coef, color, cursorInsideColor, ENTERED_GLYPH, EXITED_GLYPH, fColor, HSV, NO_CURSOR_EVENT, orient, sensit, size, stickedTo, stroke, visible, vx, vy, vz |
| Fields inherited from interface fr.inria.zvtm.glyphs.Translucent |
|---|
acO |
| Constructor Summary | |
|---|---|
VSwingComponent(double x,
double y,
int z,
JComponent c)
Instantiate a Swing component at (x, y) with original scale. |
|
VSwingComponent(double x,
double y,
int z,
JComponent c,
double scale)
Instantiate a Swing component at (x, y) with a custom scale. |
|
VSwingComponent(double x,
double y,
int z,
JComponent c,
double scale,
double or,
float alpha)
Instantiate a Swing component at (x, y) with a custom scale. |
|
VSwingComponent(double x,
double y,
int z,
JComponent c,
double scale,
float alpha)
Instantiate a Swing component at (x, y) with a custom scale. |
|
VSwingComponent(JComponent c)
Instantiate a Swing component at (0, 0) with original scale. |
|
| Method Summary | |
|---|---|
void |
addCamera(int verifIndex)
Create new projected coordinates. |
Object |
clone()
|
boolean |
coordInside(int jpx,
int jpy,
int camIndex,
double cvx,
double cvy)
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. |
static void |
forceLayout(Container container)
Utility function: to ensure proper display, it is necessary to set the size of 'standalone' Components, or to force the layout of Containers. |
double[] |
getBounds()
Get the bounding box of this Glyph in virtual space coordinates. |
JComponent |
getComponent()
Get the Swing component displayed. |
double |
getHeight()
Get width in virtual space. |
Shape |
getJava2DShape()
Get the Java2D Shape corresponding to this Glyph. |
double |
getOrient()
Get the glyph's orientation. |
double |
getSize()
Get glyph's size (diameter of bounding circle). |
double |
getWidth()
Get width in virtual space. |
void |
initCams(int nbCam)
Initialize projected coordinates. |
boolean |
isZoomSensitive()
Indicates whether the Swing component is scaled according to camera's altitude. |
short |
mouseInOut(int jpx,
int jpy,
int camIndex,
double cvx,
double cvy)
Method used internally for firing picking-related events. |
void |
orientTo(double angle)
Set the glyph's absolute orientation. |
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 |
resetMouseIn()
Reset memory of cursor being inside the glyph. |
void |
resetMouseIn(int i)
Reset memory of cursor being inside the glyph for projected coordinates associated with camera at index i. |
void |
reSize(double factor)
Set glyph's size by multiplying its bounding circle diameter by a factor. |
void |
setComponent(JComponent c)
Set Swing component to be displayed. |
void |
setHeight(double h)
Set height in virtual space. |
static void |
setSizeToPreferred(Component cmp)
Utility function: to ensure proper display, it is necessary to set the size of 'standalone' Components, or to force the layout of Containers. |
void |
setWidth(double w)
Set width in virtual space. |
void |
setZoomSensitive(boolean b)
Set to false if the Swing component should not be scaled according to camera's altitude. |
void |
sizeTo(double s)
Set glyph's size by setting its bounding circle's diameter. |
boolean |
visibleInDisc(double dvx,
double dvy,
double dvr,
Shape dvs,
int camIndex,
int jpx,
int jpy,
int dpr)
The disc is actually approximated to its bounding box here. |
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. |
| Methods inherited from class fr.inria.zvtm.glyphs.ClosedShape |
|---|
addHSVbColor, getBorderColor, getDefaultBorderColor, getHSVbColor, highlight, isBorderDrawn, isFilled, setBorderColor, setCursorInsideFillColor, setDrawBorder, setFilled, setHSVbColor |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public double vw
public double vh
public double ar
public AffineTransform at
public fr.inria.zvtm.glyphs.projection.RProjectedCoordsP[] pc
public boolean zoomSensitive
public double scaleFactor
public double trueCoef
| Constructor Detail |
|---|
public VSwingComponent(JComponent c)
c - Swing component to be displayed
public VSwingComponent(double x,
double y,
int z,
JComponent c)
x - coordinate in virtual spacey - coordinate in virtual spacez - z-index (pass 0 if you do not use z-ordering)c - Swing component to be displayed
public VSwingComponent(double x,
double y,
int z,
JComponent c,
double scale)
x - coordinate in virtual spacey - coordinate in virtual spacez - z-index (pass 0 if you do not use z-ordering)c - Swing component to be displayedscale - scaleFactor w.r.t original component size
public VSwingComponent(double x,
double y,
int z,
JComponent c,
double scale,
float alpha)
x - coordinate in virtual spacey - coordinate in virtual spacez - z-index (pass 0 if you do not use z-ordering)c - Swing component to be displayedscale - scaleFactor w.r.t original component sizealpha - in [0;1.0]. 0 is fully transparent, 1 is opaque
public VSwingComponent(double x,
double y,
int z,
JComponent c,
double scale,
double or,
float alpha)
x - coordinate in virtual spacey - coordinate in virtual spacez - z-index (pass 0 if you do not use z-ordering)c - Swing component to be displayedscale - scaleFactor w.r.t original component sizeor - orientationalpha - in [0;1.0]. 0 is fully transparent, 1 is opaque| Method Detail |
|---|
public void initCams(int nbCam)
Glyph
initCams in class GlyphnbCam - current number of cameras in the virtual spaceGlyph.addCamera(int verifIndex),
Glyph.removeCamera(int index)public void addCamera(int verifIndex)
Glyph
addCamera in class GlyphverifIndex - 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 GlyphGlyph.initCams(int nbCam),
Glyph.addCamera(int verifIndex)public void resetMouseIn()
Glyph
resetMouseIn in class Glyphpublic void resetMouseIn(int i)
Glyph
resetMouseIn in class Glyphpublic double getOrient()
Glyph
getOrient in class Glyphpublic void orientTo(double angle)
orientTo in class Glyphangle - in [0:2Pi[public double getSize()
Glyph
getSize in class Glyphpublic void setWidth(double w)
RectangularShape
setWidth in interface RectangularShapepublic void setHeight(double h)
RectangularShape
setHeight in interface RectangularShapepublic double getWidth()
RectangularShape
getWidth in interface RectangularShapepublic double getHeight()
RectangularShape
getHeight in interface RectangularShapepublic void sizeTo(double s)
Glyph
sizeTo in class GlyphGlyph.reSize(double factor)public void reSize(double factor)
Glyph
reSize in class GlyphGlyph.sizeTo(double s)public double[] getBounds()
getBounds in class Glyphpublic void setComponent(JComponent c)
public JComponent getComponent()
public void setZoomSensitive(boolean b)
isZoomSensitive()public boolean isZoomSensitive()
setZoomSensitive(boolean b)
public boolean fillsView(double w,
double h,
int camIndex)
Glyph
fillsView in class Glyph
public boolean coordInside(int jpx,
int jpy,
int camIndex,
double cvx,
double cvy)
Glyph
coordInside in class Glyphjpx - 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 coordinates
public boolean visibleInRegion(double wb,
double nb,
double eb,
double sb,
int i)
Glyph
visibleInRegion in class Glyphwb - 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 visibleInDisc(double dvx,
double dvy,
double dvr,
Shape dvs,
int camIndex,
int jpx,
int jpy,
int dpr)
visibleInDisc in class Glyph
public short mouseInOut(int jpx,
int jpy,
int camIndex,
double cvx,
double cvy)
Glyph
mouseInOut in class Glyphjpx - 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 coordinates
public void project(Camera c,
Dimension d)
Glyph
project in class Glyphc - camerad - dimension of View using camera c
public void projectForLens(Camera c,
int lensWidth,
int lensHeight,
float lensMag,
double lensx,
double lensy)
Glyph
projectForLens in class Glyphc - 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 camera
public void draw(Graphics2D g,
int vW,
int vH,
int i,
Stroke stdS,
AffineTransform stdT,
int dx,
int dy)
Glyph
draw in class Glyphg - 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 offset
public void drawForLens(Graphics2D g,
int vW,
int vH,
int i,
Stroke stdS,
AffineTransform stdT,
int dx,
int dy)
Glyph
drawForLens in class Glyphg - 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 Shape getJava2DShape()
Glyph
getJava2DShape in class Glyphpublic Object clone()
clone in class Glyphpublic static void setSizeToPreferred(Component cmp)
forceLayout(Container container)public static void forceLayout(Container container)
setSizeToPreferred(Component cmp)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||