|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.diamondspin.DSStroke
public class DSStroke
DSStroke is a digital ink marker the user can draw with. It may be on top of the table,of an other element or to initiate an action.
Copyright 2002-2009 DiamondSpin project. All Rights Reserved. Permission to use, copy, modify and distribute this software and its documentation for educational, research and non-profit purposes, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and the following three paragraphs appear in all copies. To request Permission to incorporate this software into commercial products contact one of the authors of the project.
IN NO EVENT SHALL THE AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE AUTHORS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. THE AUTHORS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE AUTHORS HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
Field Summary | |
---|---|
protected boolean |
active
|
protected double |
alpha
|
protected DSElement |
AttachedElement1
|
protected double |
beta
|
protected Color |
color1
|
protected double |
d
|
protected DSTabletopPane |
dsTabletopPane
|
static int |
FINISHED
|
protected int |
idOwner
|
static int |
INITED
The state of the stroke under construction |
protected int |
maxX
|
protected int |
maxY
|
static int |
MIN_DIST_POINTS
|
protected int |
minX
|
protected int |
minY
|
static int |
STARTED
|
protected int |
state
|
protected ArrayList<DSPoint> |
strokePoints
all the points of the stroke |
protected ArrayList<Float> |
strokeSizes
|
protected ArrayList<Long> |
strokeTimes
|
Fields inherited from interface org.diamondspin.DSElement |
---|
HIGH_QUALITY, LOW_QUALITY |
Constructor Summary | |
---|---|
DSStroke(DSTabletopPane dsTabletopPane_Arg)
Constructor without color (User's Color by default) |
|
DSStroke(DSTabletopPane dsTabletopPane_Arg,
Color Color_Arg)
Constructor with color |
|
DSStroke(DSTabletopPane dsTabletopPane_Arg,
Color Color_Arg,
DSElement AttachedElement_Arg)
Constructor with color |
|
DSStroke(DSTabletopPane dsTabletopPane_Arg,
DSElement AttachedElement_Arg)
Constructor without color but with attached element (User's Color by default) |
|
DSStroke(DSTabletopPane dsTabletopPane_Arg,
Polygon Polygon_Arg,
Color Color_Arg,
DSElement AttachedElement_Arg)
Constructor with color and polygon |
Method Summary | |
---|---|
boolean |
acceptSlavery(DSElement dsElement)
obviously strokes can belong to other things |
boolean |
acceptSlaveryRelease()
tells if I accept to be released |
void |
addDSElementListener(DSElementListener DSElementListener_Arg)
we do not use this yet |
void |
addPoint(DSPoint pos,
Float size,
long timestamp)
Add a point in the stroke |
DSStroke |
clone()
duplicate this element |
boolean |
doesContain(double x_Arg,
double y_Arg)
Description of the Method. |
void |
erasePointsAround(Point pos,
double radius)
erase all the point close enough to the given position |
void |
finish()
|
double |
getAbsoluteScale()
Strokes ar not subject to scale and inner rotation |
double |
getAlpha()
The degrees of freedom of the DSElements are their distance to the center, their angle comparing to the right direction (from center to the ful right), a scale (for zooming features) and |
DSElement |
getAttachedElement()
|
double |
getBeta()
The angle around its center |
Color |
getColor()
Gets the color attribute of the DSStroke object |
double |
getD()
The degrees of freedom of the DSElements are their distance to the center, their angle comparing to the right direction (from center to the ful right), a scale (for zooming features) and |
DSPoint |
getFirstPoint()
|
int |
getHeight()
Elements are displayed around their center (not around their top left corner) Width and Height are the amount of space used by the repaint. |
int |
getIDOwner()
Gets the iDOwner attribute of the DSWindow object -1 means no owner |
DSPoint |
getIntervalX()
return the maxi and mini point on the x axis |
DSPoint |
getIntervalY()
return the maxi and mini point on the y axis (which is rotated !) |
int |
getNbPoints()
return the number of points |
DSPoint |
getPoint(int index_arg)
|
Polygon |
getPolygon()
|
double |
getScale()
The degrees of freedom of the DSElements are their distance to the center, their angle comparing to the right direction (from center to the ful right), a scale (for zooming features) and |
double |
getSize(int index_arg)
|
int |
getState()
Gets the state attribute of the DSStroke object |
DSTabletopPane |
getTabletopPane()
|
protected ArrayList<DSPoint> |
getThePoints()
Gets the thePoints attribute of the DSStroke object |
long |
getTime(int index_arg)
|
AffineTransform |
getTransform()
The matrix decribing how this element is transformed before rendering |
Polygon |
getUndeformedPolygon()
|
int |
getWidth()
Elements are displayed around their center (not around their top left corner) Width and Height are the amount of space used by the repaint. |
boolean |
grabElement(int dx_Arg,
int dy_Arg)
The stroke cannot be dragged |
boolean |
isActive()
in the centralized architecture we have some elements are in the views and one or few element are handled directly by the DSTabletopPane as drag&dropped elements. |
boolean |
isBetaAbs()
indicate how to use beta. |
boolean |
isMouseTarget(MouseEvent mouseEvent_Arg)
the stroke can draw everywhere ! |
boolean |
isVisible()
|
void |
mirrorX(double xAxis)
mirror all the point of the stroke around a vertical line |
void |
mirrorY(double yAxis)
mirror all the point of the stroke around a horizontal line |
void |
mouseClicked(MouseEvent mouseEvent_Arg)
unused mouse callbacks |
void |
mouseDragged(MouseEvent mouseEvent_Arg)
drag = one more point |
void |
mouseEntered(MouseEvent mouseEvent_Arg)
unused mouse callbacks |
void |
mouseExited(MouseEvent mouseEvent_Arg)
unused mouse callbacks |
void |
mouseMoved(MouseEvent mouseEvent_Arg)
unused mouse callbacks |
void |
mousePressed(MouseEvent mouseEvent_Arg)
Handle a mouse event |
void |
mouseReleased(MouseEvent event)
a last point for the road, close the polygon and notify dsTabletopPane |
void |
moveElementCenterTo(Point2D.Double touchPoint)
can be used to make the element change its position to be centered under the given point |
void |
paint(Graphics graphics_arg)
Call the other paint(). |
void |
paint(Graphics2D graphics_Arg,
int quality_Arg)
Paint the stroke at a given quality level |
void |
paintCurve(Graphics2D g,
Color color)
draw a nice curve along the points given in parameter as a vector. |
void |
paintTransformed(Graphics2D Graphics_Arg,
AffineTransform AffineTransform_Arg)
Paint the stroke with a given transformation (not the one using the internal d,alpha of the stroke) |
void |
removeDSElementListener(DSElementListener DSElementListener_Arg)
remove a listener |
void |
removeLastPoint()
remove the last point in the stroke |
void |
reset()
Reset the stroke |
void |
revealPoints(double size)
reveal the hidden points of the stroke (the ones with size 0) |
void |
setActive(boolean active_Arg)
change if the component is active or not (with shadow = is selected) |
void |
setAlpha(double alpha)
Sets the alpha attribute of the DSStroke object |
void |
setAttachedElement(DSElement DSElement_Arg)
set the attached element to this stroke. |
void |
setBeta(double beta)
The angle around its center |
void |
setBetaAbs(boolean betaAbs)
change how to use beta. |
void |
setColor(Color Color_Arg)
Sets the color attribute of the DSStroke object |
void |
setD(double d)
change the distance to the center of the circular layout |
void |
setIDOwner(int id)
set the user id of the owner of this object (-1 is no owner) |
void |
setScale(double scale)
The degrees of freedom of the DSElements are their distance to the center, their angle comparing to the right direction (from center to the ful right), a scale (for zooming features) and |
void |
setSize(int width_Arg,
int height_Arg)
do nothing because a stroke cannot be resized |
void |
setTabletopPane(DSTabletopPane dsTabletopPane_Arg)
|
void |
setVisible(boolean visible_Arg)
say if the component is visible |
String |
toString()
|
void |
translate(int dx,
int dy)
translate all the point of the stroke |
DSPoint |
untransformPoint(double x_Arg,
double y_Arg)
transform a point into local-cartesian coordinate system |
void |
unTransformStroke(AffineTransform AffineTransform_Arg)
transform the points of the stroke so they become relative to the global frame then retransform with the given matrix. |
void |
zoomTransformStroke(double ZoomFactor_Arg)
transform the points by changing the size and applying a zoom factor to all of them without modifying the point locations |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected ArrayList<DSPoint> strokePoints
protected ArrayList<Float> strokeSizes
protected ArrayList<Long> strokeTimes
public static final int MIN_DIST_POINTS
public static final int INITED
public static final int STARTED
public static final int FINISHED
protected int state
protected int idOwner
protected DSElement AttachedElement1
protected transient DSTabletopPane dsTabletopPane
protected double d
protected double alpha
protected double beta
protected int minX
protected int minY
protected int maxX
protected int maxY
protected Color color1
protected boolean active
Constructor Detail |
---|
public DSStroke(DSTabletopPane dsTabletopPane_Arg)
dsTabletopPane_Arg
- the container in which the frame existspublic DSStroke(DSTabletopPane dsTabletopPane_Arg, DSElement AttachedElement_Arg)
dsTabletopPane_Arg
- the container in which the frame existspublic DSStroke(DSTabletopPane dsTabletopPane_Arg, Color Color_Arg)
Color_Arg
- the color of the strokepublic DSStroke(DSTabletopPane dsTabletopPane_Arg, Color Color_Arg, DSElement AttachedElement_Arg)
Color_Arg
- the color of the strokepublic DSStroke(DSTabletopPane dsTabletopPane_Arg, Polygon Polygon_Arg, Color Color_Arg, DSElement AttachedElement_Arg)
Polygon_Arg
- the points of the strokeColor_Arg
- the color of the strokeMethod Detail |
---|
public DSTabletopPane getTabletopPane()
public void setTabletopPane(DSTabletopPane dsTabletopPane_Arg)
public double getD()
DSElement
getD
in interface DSElement
public void setD(double d)
setD
in interface DSElement
d
- The new d valuepublic int getState()
public void setAlpha(double alpha)
setAlpha
in interface DSElement
alpha
- The new alpha valuepublic void setVisible(boolean visible_Arg)
setVisible
in interface DSElement
visible_Arg
- The new visibility valuepublic boolean isVisible()
isVisible
in interface DSElement
protected ArrayList<DSPoint> getThePoints()
public double getAlpha()
DSElement
getAlpha
in interface DSElement
public void setColor(Color Color_Arg)
Color_Arg
- The new color valuepublic Color getColor()
public DSElement getAttachedElement()
public void setAttachedElement(DSElement DSElement_Arg)
public DSPoint getIntervalX()
public DSPoint getIntervalY()
public Polygon getPolygon()
public Polygon getUndeformedPolygon()
public void unTransformStroke(AffineTransform AffineTransform_Arg)
public void zoomTransformStroke(double ZoomFactor_Arg)
public void translate(int dx, int dy)
public void mirrorX(double xAxis)
public void mirrorY(double yAxis)
public void paint(Graphics graphics_arg)
paint
in interface DSElement
graphics_arg
- Description of the Parameterpublic AffineTransform getTransform()
DSElement
getTransform
in interface DSElement
public void paint(Graphics2D graphics_Arg, int quality_Arg)
paint
in interface DSElement
graphics_Arg
- a graphic context on the general componentquality_Arg
- quality of the drawingpublic void paintTransformed(Graphics2D Graphics_Arg, AffineTransform AffineTransform_Arg)
Graphics_Arg
- a graphic context on the general componentpublic DSPoint getFirstPoint()
public DSPoint getPoint(int index_arg)
public double getSize(int index_arg)
public long getTime(int index_arg)
public void paintCurve(Graphics2D g, Color color)
g
- the graphics to draw with.color
- the color of the curvepublic void reset()
public void erasePointsAround(Point pos, double radius)
pos
- around what position we are going o erase pointsradius
- how far from the given position erasing will be effectivepublic void revealPoints(double size)
size
- the new size of the revealed portionspublic int getNbPoints()
public final void addPoint(DSPoint pos, Float size, long timestamp)
pos
- The point to add to the list of points in the strokepublic void removeLastPoint()
public void mousePressed(MouseEvent mouseEvent_Arg)
mousePressed
in interface MouseListener
mousePressed
in interface DSElement
mouseEvent_Arg
- Description of the Parameterpublic void mouseDragged(MouseEvent mouseEvent_Arg)
mouseDragged
in interface MouseMotionListener
mouseDragged
in interface DSElement
mouseEvent_Arg
- Description of the Parameterpublic void mouseReleased(MouseEvent event)
mouseReleased
in interface MouseListener
mouseReleased
in interface DSElement
event
- Description of the Parameterpublic void mouseMoved(MouseEvent mouseEvent_Arg)
mouseMoved
in interface MouseMotionListener
mouseMoved
in interface DSElement
mouseEvent_Arg
- Description of the Parameterpublic void mouseClicked(MouseEvent mouseEvent_Arg)
mouseClicked
in interface MouseListener
mouseClicked
in interface DSElement
mouseEvent_Arg
- Description of the Parameterpublic void mouseEntered(MouseEvent mouseEvent_Arg)
mouseEntered
in interface MouseListener
mouseEvent_Arg
- Description of the Parameterpublic void mouseExited(MouseEvent mouseEvent_Arg)
mouseExited
in interface MouseListener
mouseEvent_Arg
- Description of the Parameterpublic DSPoint untransformPoint(double x_Arg, double y_Arg)
public boolean doesContain(double x_Arg, double y_Arg)
doesContain
in interface DSElement
x_Arg
- the x axis coordinate of the point to test.y_Arg
- the y axis coordinate of the point to test.
public void moveElementCenterTo(Point2D.Double touchPoint)
moveElementCenterTo
in interface DSElement
touchPoint
- (the cartesian point under which to center the element)public double getAbsoluteScale()
getAbsoluteScale
in interface DSElement
public double getScale()
DSElement
getScale
in interface DSElement
public void setScale(double scale)
DSElement
setScale
in interface DSElement
scale
- The new scale valuepublic double getBeta()
DSElement
getBeta
in interface DSElement
public void setBeta(double beta)
DSElement
setBeta
in interface DSElement
beta
- The new beta valuepublic boolean isBetaAbs()
DSElement
isBetaAbs
in interface DSElement
public void setBetaAbs(boolean betaAbs)
DSElement
setBetaAbs
in interface DSElement
public void setIDOwner(int id)
setIDOwner
in interface DSElement
id
- The new iDOwner valuepublic int getIDOwner()
getIDOwner
in interface DSElement
public boolean isMouseTarget(MouseEvent mouseEvent_Arg)
isMouseTarget
in interface DSElement
mouseEvent_Arg
- Description of the Parameter
public boolean grabElement(int dx_Arg, int dy_Arg)
grabElement
in interface DSElement
dx_Arg
- Description of the Parameterdy_Arg
- Description of the Parameterpublic void addDSElementListener(DSElementListener DSElementListener_Arg)
addDSElementListener
in interface DSElement
DSElementListener_Arg
- The feature to be added to the DSElementListener attributepublic void removeDSElementListener(DSElementListener DSElementListener_Arg)
DSElement
removeDSElementListener
in interface DSElement
DSElementListener_Arg
- Description of the Parameterpublic int getWidth()
getWidth
in interface DSElement
public int getHeight()
getHeight
in interface DSElement
public boolean isActive()
DSElement
isActive
in interface DSElement
public void setActive(boolean active_Arg)
setActive
in interface DSElement
active_Arg
- The new active valuepublic void setSize(int width_Arg, int height_Arg)
setSize
in interface DSElement
width_Arg
- The new size valueheight_Arg
- The new size valuepublic DSStroke clone()
clone
in class Object
public boolean acceptSlavery(DSElement dsElement)
acceptSlavery
in interface DSElement
dsElement
- the possible master
public boolean acceptSlaveryRelease()
acceptSlaveryRelease
in interface DSElement
public void finish()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |