public class DPath<T> extends Glyph implements RectangularShape
VSegment
Modifier and Type | Field and Description |
---|---|
static short |
DRAW_GENERAL_PATH
Draw the general path that gets compiled each time we make a change to the DPath (default).
|
static short |
DRAW_SUBPATHS
Iterate on the path's components (each line, quad curve, cubic curve) and draw them step by step.
|
fr.inria.zvtm.glyphs.projection.ProjectedCoords[] |
pc
For internal use.
|
double |
vh
Height in virtual space.
|
double |
vw
Width in virtual space.
|
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 |
---|
DPath() |
DPath(double x,
double y,
int z,
Color c)
Drawing method: DRAW_GENERAL_PATH.
|
DPath(double x,
double y,
int z,
Color c,
float alpha)
Drawing method: DRAW_GENERAL_PATH.
|
DPath(double x,
double y,
int z,
Color c,
float alpha,
short m) |
DPath(int z)
Drawing method: DRAW_GENERAL_PATH.
|
DPath(PathIterator pi,
int z,
Color c)
Drawing method: DRAW_GENERAL_PATH.
|
DPath(PathIterator pi,
int z,
Color c,
float alpha)
Drawing method: DRAW_GENERAL_PATH.
|
Modifier and Type | Method and Description |
---|---|
void |
addCamera(int verifIndex)
Create new projected coordinates.
|
void |
addCbCurve(double x,
double y,
double x1,
double y1,
double x2,
double y2,
boolean abs)
Add a new cubic curve to the path, from current point to point (x,y), controlled by (x1,y1)
|
void |
addQdCurve(double x,
double y,
double x1,
double y1,
boolean abs)
Add a new quadratic curve to the path, from current point to point (x,y), controlled by (x1,y1)
|
void |
addSegment(double x,
double y,
boolean abs)
Add a new segment to the path, from current point to point (x,y).
|
Object |
clone()
Not implemented yet.
|
void |
computeBounds() |
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)
Not supported in DPath.
|
boolean |
coordInsideP(int jpx,
int jpy,
Camera c)
Not supported in DPath.
|
boolean |
coordInsideV(double cvx,
double cvy,
Camera c)
Not supported in DPath.
|
boolean |
coordsInsideBoundingBox(double x,
double y) |
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.
|
void |
edit(Point2D.Double[] points,
boolean abs)
Transform DPath by translating each of the points
|
void |
editElement(int index,
double sx,
double sy,
double ex,
double ey,
Point2D.Double[] ctrlPoints,
boolean abs)
Edit coordinates of start, end and control points of the element in DPath
|
boolean |
fillsView(double w,
double h,
int camIndex)
Find out if this glyph completely fills a view.
|
Point2D.Double[] |
getAllPointsCoordinates()
Get coordinates of each point in the path including control points.
|
double[] |
getBounds()
Get the bounding box of this Glyph in virtual space coordinates.
|
short |
getDrawingMethod()
The drawing method employed.
|
Point2D.Double[] |
getElementPointsCoordinates(int index)
Get coordinates of the start, end and control points of the element
|
int |
getElementsCount()
Get total number of elements in the path
|
int |
getElementType(int index)
Get element's type
|
Point2D.Double |
getEndPoint() |
double |
getEndPointX() |
double |
getEndPointY() |
double |
getEndTangentOrientation()
Get orientation of the tangent to the end of the path.
|
static Point2D.Double[] |
getFlattenedCoordinates(DPath path,
Point2D.Double startPoint,
Point2D.Double endPoint,
boolean abs)
Calculates coordinates of all DPath's points (including control points) to display the DPath as a line.
|
double |
getHeight()
Get the vertical distance from northern-most point to the southern-most one.
|
GeneralPath |
getJava2DGeneralPath()
Get the Java2D GeneralPath representing this DPath in virtual space coordinates.
|
PathIterator |
getJava2DPathIterator()
Get the Java2D path iterator representing this DPath.
|
Shape |
getJava2DShape()
Get the Java2D Shape corresponding to this Glyph.
|
int |
getNumberOfPoints() |
double |
getOrient()
Get the glyph's orientation.
|
double |
getSize()
Get glyph's size (diameter of bounding circle).
|
Point2D.Double |
getStartPoint() |
double |
getStartPointX() |
double |
getStartPointY() |
double |
getStartTangentOrientation()
Get orientation of the tangent to the start of the path.
|
PathIterator |
getSVGPathIterator()
Get an SVG-compatible path iterator for this DPath.
|
double |
getWidth()
Get the horizontal distance from western-most point to the eastern-most one.
|
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 |
jump(double x,
double y,
boolean abs)
Add a new 'gap' to the path (move without drawing anything), from current point to point (x,y).
|
void |
move(double x,
double y)
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)
No effect.
|
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 |
setDrawingMethod(short m)
Specify what drawing method to use to paint this path.
|
void |
setHeight(double h)
Not implemented yet.
|
void |
setPath(PathIterator pi) |
void |
setWidth(double w)
Not implemented yet.
|
void |
sizeTo(double s)
No effect.
|
void |
updateJava2DGeneralPath()
Update the Java2D GeneralPath representing this DPath.
|
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.
|
addHSVbColor, addHSVColor, 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, visibleInViewport
public static final short DRAW_GENERAL_PATH
public static final short DRAW_SUBPATHS
public fr.inria.zvtm.glyphs.projection.ProjectedCoords[] pc
public double vw
public double vh
public DPath()
public DPath(int z)
z
- z-index (pass 0 if you do not use z-ordering)public DPath(double x, double y, int z, Color c)
x
- start coordinate in virtual spacey
- start coordinate in virtual spacez
- z-index (pass 0 if you do not use z-ordering)c
- colorpublic DPath(double x, double y, int z, Color c, float alpha)
x
- start coordinate in virtual spacey
- start coordinate in virtual spacez
- z-index (pass 0 if you do not use z-ordering)c
- coloralpha
- alpha channel value in [0;1.0] 0 is fully transparent, 1 is opaquepublic DPath(double x, double y, int z, Color c, float alpha, short m)
x
- start coordinate in virtual spacey
- start coordinate in virtual spacez
- z-index (pass 0 if you do not use z-ordering)c
- coloralpha
- alpha channel value in [0;1.0] 0 is fully transparent, 1 is opaquem
- method to draw this glyph.
public DPath(PathIterator pi, int z, Color c)
pi
- PathIterator describing this path (virtual space coordinates)z
- z-index (pass 0 if you do not use z-ordering)c
- colorpublic DPath(PathIterator pi, int z, Color c, float alpha)
pi
- PathIterator describing this path (virtual space coordinates)z
- z-index (pass 0 if you do not use z-ordering)c
- coloralpha
- alpha channel value in [0;1.0] 0 is fully transparent, 1 is opaquepublic void setPath(PathIterator pi)
public void addCbCurve(double x, double y, double x1, double y1, double x2, double y2, boolean abs)
x
- x coordinate of end point in virtual spacey
- y coordinate of end point in virtual spacex1
- x coordinate of 1st control point in virtual spacey1
- y coordinate of 1st control point in virtual spacex2
- x coordinate of 2nd control point in virtual spacey2
- y coordinate of 2nd control point in virtual spaceabs
- true if coordinates should be interpreted as absolute coordinates, false if coordinates should be interpreted as relative coordinates (w.r.t last point)public void addQdCurve(double x, double y, double x1, double y1, boolean abs)
x
- x coordinate of end point in virtual spacey
- y coordinate of end point in virtual spacex1
- x coordinate of control point in virtual spacey1
- y coordinate of control point in virtual spaceabs
- true if coordinates should be interpreted as absolute coordinates, false if coordinates should be interpreted as relative coordinates (w.r.t last point)public void addSegment(double x, double y, boolean abs)
x
- x coordinate of end point in virtual spacey
- y coordinate of end point in virtual spaceabs
- true if coordinates should be interpreted as absolute coordinates, false if coordinates should be interpreted as relative coordinates (w.r.t last point)public void jump(double x, double y, boolean abs)
x
- x coordinate of end point in virtual spacey
- y coordinate of end point in virtual spaceabs
- true if coordinates should be interpreted as absolute coordinates, false if coordinates should be interpreted as relative coordinates (w.r.t last point)public double getWidth()
getWidth
in interface RectangularShape
public double getHeight()
getHeight
in interface RectangularShape
public void setWidth(double w)
setWidth
in interface RectangularShape
public void setHeight(double h)
setHeight
in interface RectangularShape
public Point2D.Double getStartPoint()
public Point2D.Double getEndPoint()
public double getStartPointX()
public double getStartPointY()
public double getEndPointX()
public double getEndPointY()
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 s)
sizeTo
in class Glyph
Glyph.reSize(double factor)
public void reSize(double factor)
reSize
in class Glyph
Glyph.sizeTo(double s)
public void move(double x, double y)
move
in class Glyph
moveTo(double x, double y)
public void moveTo(double x, double y)
moveTo
in class Glyph
move(double x, double y)
public void orientTo(double angle)
public double getSize()
Glyph
public void computeBounds()
public double[] getBounds()
public boolean coordsInsideBoundingBox(double x, double y)
public double getOrient()
Glyph
public boolean fillsView(double w, double h, int camIndex)
Glyph
public boolean coordInside(int jpx, int jpy, Camera c, double cvx, double cvy)
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)
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 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 setDrawingMethod(short m)
m
- method to draw this glyph.
public short getDrawingMethod()
public 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 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 visibleInDisc(double dvx, double dvy, double dvr, Shape dvs, int camIndex, int jpx, int jpy, int dpr)
visibleInDisc
in class Glyph
public void highlight(boolean b, Color selectedColor)
public void editElement(int index, double sx, double sy, double ex, double ey, Point2D.Double[] ctrlPoints, boolean abs)
index
- index of the element in the DPathsx
- x coordinate of the element's start pointsy
- y coordinate of the element's start pointex
- x coordinate of the element's end pointey
- y coordinate of the element's end pointctrlPoints
- list of the points that contain coordinates of the control point(s) (in case of QD/CB curve)abs
- indicates whether to use absolute coordinates or relativepublic void edit(Point2D.Double[] points, boolean abs)
points
- List of new coordinates for each point. Example order could be: startPoint, controlPoint1, controlPoint2, endPoint, controlPoint1, endPoint, endPoint ...abs
- whether to use absolute coordinates or relativepublic int getElementsCount()
public int getElementType(int index)
index
- index of the element in the DPathpublic Point2D.Double[] getElementPointsCoordinates(int index)
index
- index of the element in the DPathpublic int getNumberOfPoints()
public Point2D.Double[] getAllPointsCoordinates()
public static Point2D.Double[] getFlattenedCoordinates(DPath path, Point2D.Double startPoint, Point2D.Double endPoint, boolean abs)
path
- DPath to be flattenstartPoint
- Start point of desired lineendPoint
- End point of desired lineabs
- whether to use absolute valuespublic PathIterator getSVGPathIterator()
public void updateJava2DGeneralPath()
public GeneralPath getJava2DGeneralPath()
public Shape getJava2DShape()
Glyph
getJava2DShape
in class Glyph
public PathIterator getJava2DPathIterator()
public double getStartTangentOrientation()
public double getEndTangentOrientation()
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.