fr.inria.zvtm.glyphs
Class Composite

java.lang.Object
  extended by fr.inria.zvtm.glyphs.Glyph
      extended by fr.inria.zvtm.glyphs.Composite
All Implemented Interfaces:
Translucent, Cloneable

public class Composite
extends Glyph

Composite glyph.


Field Summary
 
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
Composite()
           
 
Method Summary
 void addCamera(int index)
          Create new projected coordinates.
 void addChild(Glyph child)
          Adds a child Glyph to this Composite.
 Composite clone()
          
 void computeBounds()
          Re-computes the bounds of this Composite.
 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.
 double[] getBounds()
          Get the bounding box of this Glyph in virtual space coordinates.
 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).
 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.
 short mouseInOut(int jpx, int jpy, int camIndex, double cvx, double cvy)
          Method used internally for firing picking-related events.
 void move(double dx, double dy)
          Translate the glyph by (x,y) - relative translation.
 void moveTo(double x, double y)
          Translate the glyph to (x,y) - absolute translation.
 void orientTo(double angle)
          Set the glyph's absolute orientation.
 List<Glyph> peekAtChildren()
          Returns part of the internal state of this Composite.
 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.
 boolean removeChild(Glyph child)
          Removes a child Glyph from this Composite.
 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 sizeTo(double newSize)
          Set glyph's size by setting its bounding circle's diameter.
 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.Glyph
addHSVbColor, addHSVColor, containedInRegion, getBorderColor, getColor, getDefaultColor, getDefaultCursorInsideHighlightColor, getHSVbColor, getHSVColor, getLocation, getOwner, getStickedGlyphArray, getStroke, getTranslucencyValue, getType, getZindex, isBorderDrawn, isFilled, isSelected, isSensitive, isVisible, isVisibleThroughLens, propagateMove, select, setBorderColor, setColor, setCursorInsideHighlightColor, setDefaultCursorInsideHighlightColor, setHSVbColor, setHSVColor, setOwner, setSensitivity, setStroke, setTranslucencyValue, setType, setVisible, setZindex, stick, stickToGlyph, toString, unstick, unstickAllGlyphs, unstickAllGlyphs, unstickFromGlyph, visibleInDisc, visibleInViewport
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Composite

public Composite()
Method Detail

addChild

public void addChild(Glyph child)
Adds a child Glyph to this Composite. Do not add the children to the virtual space.

Parameters:
child - Glyph to add

removeChild

public boolean removeChild(Glyph child)
Removes a child Glyph from this Composite.

Parameters:
child - Glyph to remove
Returns:
true if child has been removed, false otherwise

peekAtChildren

public List<Glyph> peekAtChildren()
Returns part of the internal state of this Composite. Look, but do not touch!


getBounds

public double[] getBounds()
Description copied from class: Glyph
Get the bounding box of this Glyph in virtual space coordinates.

Overrides:
getBounds in class Glyph
Returns:
west, north, east and south bounds in virtual space.

clone

public Composite clone()

Overrides:
clone in class Glyph

fillsView

public boolean fillsView(double w,
                         double h,
                         int camIndex)
Find out if this glyph completely fills a view. (In which case it is not necessary to repaint objects below it in the drawing stack). If implemented, this method should be very efficient, as it is used by an optional top-down clipping algorithm. Otherwise it might cost more time than it can potentially save. Until now it has only been implemented for non-reorientable rectangles and was activated only for treemap-like representations in which a lot of rectangles can potentially overlap each other.

Specified by:
fillsView in class Glyph

mouseInOut

public short mouseInOut(int jpx,
                        int jpy,
                        int camIndex,
                        double cvx,
                        double cvy)
Method used internally for firing picking-related events.

Specified by:
mouseInOut in class Glyph
Parameters:
jpx - provide projected JPanel coordinates of the associated view, not virtual space coordinates
jpy - provide projected JPanel coordinates of the associated view, not virtual space coordinates
cvx - virtual space coordinates
cvy - virtual space coordinates
Returns:
VCursor.ENTERED_GLYPH if cursor has entered the glyph, VCursor.EXITED_GLYPH if it has exited the glyph, VCursor.NO_CURSOR_EVENT if nothing has changed (meaning the cursor was already inside or outside it)

resetMouseIn

public void resetMouseIn()
Reset memory of cursor being inside the glyph.

Specified by:
resetMouseIn in class Glyph

resetMouseIn

public void resetMouseIn(int i)
Reset memory of cursor being inside the glyph for projected coordinates associated with camera at index i.

Specified by:
resetMouseIn in class Glyph

coordInside

public boolean coordInside(int jpx,
                           int jpy,
                           int camIndex,
                           double cvx,
                           double cvy)
Detect whether the given point is inside this glyph or not.

Specified by:
coordInside in class Glyph
Parameters:
jpx - provide projected JPanel coordinates of the associated view, not virtual space coordinates
jpy - provide projected JPanel coordinates of the associated view, not virtual space coordinates
cvx - virtual space coordinates
cvy - virtual space coordinates

removeCamera

public void removeCamera(int index)
Description copied from class: Glyph
Dispose of projected coordinates. If a camera is removed from the virtual space to which this glyphs belongs, the corresponding projected coordinates should be deleted. the array of projected coordinates should not be modified however, because other cameras' index remain the same. The corresponding index in the array should just be set to null.

Specified by:
removeCamera in class Glyph
See Also:
Glyph.initCams(int nbCam), Glyph.addCamera(int verifIndex)

addCamera

public void addCamera(int index)
Description copied from class: Glyph
Create new projected coordinates. Called internally to create new projected coordinates to use with the new camera.

Specified by:
addCamera in class Glyph
Parameters:
index - camera index, just to be sure that the number of projected coordinates is consistent with the number of cameras.
See Also:
Glyph.initCams(int nbCam), Glyph.removeCamera(int index)

initCams

public void initCams(int nbCam)
Description copied from class: Glyph
Initialize projected coordinates. Called internally when glyph is created in order to create the initial set of projected coordinates w.r.t the number of cameras in the virtual space.

Specified by:
initCams in class Glyph
Parameters:
nbCam - current number of cameras in the virtual space
See Also:
Glyph.addCamera(int verifIndex), Glyph.removeCamera(int index)

drawForLens

public void drawForLens(Graphics2D g,
                        int vW,
                        int vH,
                        int i,
                        Stroke stdS,
                        AffineTransform stdT,
                        int dx,
                        int dy)
Description copied from class: Glyph
Draw this glyph through a lens.

Specified by:
drawForLens in class Glyph
Parameters:
g - graphics context in which the glyph should be drawn
vW - 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 glyph
stdS - default stroke
stdT - identity transform
dx - horizontal offset
dy - vertical offset

draw

public void draw(Graphics2D g,
                 int vW,
                 int vH,
                 int i,
                 Stroke stdS,
                 AffineTransform stdT,
                 int dx,
                 int dy)
Description copied from class: Glyph
Draw this glyph.

Specified by:
draw in class Glyph
Parameters:
g - graphics context in which the glyph should be drawn
vW - 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 glyph
stdS - default stroke
stdT - identity transform
dx - horizontal offset
dy - vertical offset

projectForLens

public void projectForLens(Camera c,
                           int lensWidth,
                           int lensHeight,
                           float lensMag,
                           double lensx,
                           double lensy)
Description copied from class: Glyph
Project glyph w.r.t a given camera's coordinate system, prior to actual painting through a lens. Called internally.

Specified by:
projectForLens in class Glyph
Parameters:
c - camera
lensWidth - width of lens activated in View using this camera
lensHeight - height of lens activated in View using this camera
lensMag - magnification factor of lens activated in View using this camera
lensx - horizontal coordinateof lens activated in View using this camera
lensy - vertical coordinate of lens activated in View using this camera

project

public void project(Camera c,
                    Dimension d)
Description copied from class: Glyph
Project glyph w.r.t a given camera's coordinate system, prior to actual painting. Called internally.

Specified by:
project in class Glyph
Parameters:
c - camera
d - dimension of View using camera c

highlight

public void highlight(boolean b,
                      Color selectedColor)
Description copied from class: Glyph
Highlight this glyph to give visual feedback when the cursor is inside it.

Specified by:
highlight in class Glyph

orientTo

public void orientTo(double angle)
Description copied from class: Glyph
Set the glyph's absolute orientation.

Specified by:
orientTo in class Glyph
Parameters:
angle - in [0:2Pi[

getOrient

public double getOrient()
Description copied from class: Glyph
Get the glyph's orientation.

Specified by:
getOrient in class Glyph

reSize

public void reSize(double factor)
Description copied from class: Glyph
Set glyph's size by multiplying its bounding circle diameter by a factor.

Specified by:
reSize in class Glyph
See Also:
Glyph.sizeTo(double s)

sizeTo

public void sizeTo(double newSize)
Description copied from class: Glyph
Set glyph's size by setting its bounding circle's diameter.

Specified by:
sizeTo in class Glyph
See Also:
Glyph.reSize(double factor)

move

public void move(double dx,
                 double dy)
Description copied from class: Glyph
Translate the glyph by (x,y) - relative translation.

Overrides:
move in class Glyph
See Also:
Glyph.moveTo(double x, double y)

moveTo

public void moveTo(double x,
                   double y)
Description copied from class: Glyph
Translate the glyph to (x,y) - absolute translation.

Overrides:
moveTo in class Glyph
See Also:
Glyph.move(double x, double y)

visibleInRegion

public boolean visibleInRegion(double wb,
                               double nb,
                               double eb,
                               double sb,
                               int i)
Description copied from class: Glyph
Method used internally to find out if it is necessary to project and draw this glyph for a given camera.

Overrides:
visibleInRegion in class Glyph
Parameters:
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)
Returns:
true if the glyph is currently visible in the region delimited by wb, nb, eb, sb, symbolising the region seen through a camera

computeBounds

public void computeBounds()
Re-computes the bounds of this Composite. This method is called automatically after external operations affecting the Composite size (such as adding or deleting a child) but should be called manually after modifying a child's size or position.


getSize

public double getSize()
Description copied from class: Glyph
Get glyph's size (diameter of bounding circle).

Specified by:
getSize in class Glyph

getJava2DShape

public Shape getJava2DShape()
Description copied from class: Glyph
Get the Java2D Shape corresponding to this Glyph. Virtual Space coordinates.

Specified by:
getJava2DShape in class Glyph


Copyright © 2000-2002 Xerox Corporation. All Rights Reserved
Copyright © 2003 World Wide Web Consortium. All Rights Reserved
Copyright © 2004-2011 INRIA. All Rights Reserved
Licensed under the GNU LGPL. For full terms see the file COPYING.