org.jhotdraw.samples.svg.figures
Class SVGBezierFigure
- java.lang.Object
-
- org.jhotdraw.beans.AbstractBean
-
- org.jhotdraw.draw.AbstractFigure
-
- org.jhotdraw.draw.AbstractAttributedFigure
-
- org.jhotdraw.draw.BezierFigure
-
- org.jhotdraw.samples.svg.figures.SVGBezierFigure
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Figure, DOMStorable
public class SVGBezierFigure extends BezierFigure
SVGBezierFigure is not an actual SVG element, it is used by SVGPathFigure to represent a single BezierPath segment within an SVG path.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface org.jhotdraw.draw.Figure
CONNECTABLE_PROPERTY, REMOVABLE_PROPERTY, SELECTABLE_PROPERTY, TRANSFORMABLE_PROPERTY
-
-
Constructor Summary
Constructors Constructor and Description SVGBezierFigure()Creates a new instance.SVGBezierFigure(boolean isClosed)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.util.Collection<Handle>createHandles(SVGPathFigure pathFigure, int detailLevel)intfindSegment(java.awt.geom.Point2D.Double find, double tolerance)Gets the segment of the polyline that is hit by the given Point2D.Double.voidflattenTransform()Transforms all coords of the figure by the current TRANSFORM attribute and then sets the TRANSFORM attribute to null.java.awt.geom.Rectangle2D.DoublegetDrawingArea()Returns the drawing area of the figure as a Rectangle.booleanhandleMouseClick(java.awt.geom.Point2D.Double p, java.awt.event.MouseEvent evt, DrawingView view)Handles a mouse click.voidinvalidate()Invalidates cached data of the Figure.booleanjoinSegments(java.awt.geom.Point2D.Double join, double tolerance)Joins two segments into one if the given Point2D.Double hits a node of the polyline.intsplitSegment(java.awt.geom.Point2D.Double split, double tolerance)Splits the segment at the given Point2D.Double if a segment was hit.voidtransform(java.awt.geom.AffineTransform tx)Transforms the shape of the Figure.-
Methods inherited from class org.jhotdraw.draw.BezierFigure
addNode, addNode, chop, clone, contains, createHandles, findCompatibleConnector, findConnector, findNode, getBezierPath, getBounds, getCenter, getEndPoint, getNode, getNodeCount, getOutermostPoint, getPoint, getPoint, getPointOnPath, getStartPoint, getTransformRestoreData, isClosed, joinSegments, layout, read, removeNode, restoreTransformTo, set, setBezierPath, setBounds, setClosed, setEndPoint, setNode, setPoint, setPoint, setStartPoint, splitSegment, write
-
Methods inherited from class org.jhotdraw.draw.AbstractAttributedFigure
draw, get, getAttributes, getAttributesRestoreData, getStroke, getStrokeMiterLimitFactor, hasAttribute, isAttributeEnabled, removeAttribute, restoreAttributesTo, setAttributeEnabled, setAttributes
-
Methods inherited from class org.jhotdraw.draw.AbstractFigure
addFigureListener, addNotify, changed, findFigureInside, fireAreaInvalidated, fireFigureChanged, getActions, getConnectors, getCursor, getDecomposition, getLayer, getPreferredSize, getTool, getToolTipText, handleDrop, includes, isConnectable, isRemovable, isSelectable, isTransformable, isVisible, remap, removeFigureListener, removeNotify, requestRemove, setBounds, setConnectable, setRemovable, setSelectable, setTransformable, setVisible, toString, willChange
-
Methods inherited from class org.jhotdraw.beans.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jhotdraw.draw.Figure
addPropertyChangeListener, removePropertyChangeListener
-
-
-
-
Constructor Detail
-
SVGBezierFigure
public SVGBezierFigure()
Creates a new instance.
-
SVGBezierFigure
public SVGBezierFigure(boolean isClosed)
-
-
Method Detail
-
createHandles
public java.util.Collection<Handle> createHandles(SVGPathFigure pathFigure, int detailLevel)
-
handleMouseClick
public boolean handleMouseClick(java.awt.geom.Point2D.Double p, java.awt.event.MouseEvent evt, DrawingView view)Description copied from class:BezierFigureHandles a mouse click.- Specified by:
handleMouseClickin interfaceFigure- Overrides:
handleMouseClickin classBezierFigure- Parameters:
p- The location of the mouse event.evt- The mouse event.view- The drawing view which is the source of the mouse event.- Returns:
- Returns true, if the event was consumed.
-
transform
public void transform(java.awt.geom.AffineTransform tx)
Description copied from interface:FigureTransforms the shape of the Figure. Transformations using double precision arithmethics are inherently lossy operations. Therefore it is recommended to use getTransformRestoreData() restoreTransformTo() to provide lossless undo/redo functionality.This is a basic operation which does not fire events. Use the following code sequence, if you need event firing:
figure.willChange(); figure.transform(...); figure.changed();
- Specified by:
transformin interfaceFigure- Overrides:
transformin classBezierFigure- Parameters:
tx- The transformation.- See Also:
Figure.getTransformRestoreData(),Figure.restoreTransformTo(java.lang.Object)
-
getDrawingArea
public java.awt.geom.Rectangle2D.Double getDrawingArea()
Description copied from interface:FigureReturns the drawing area of the figure as a Rectangle.The drawing area is used to inform
DrawingViewabout the area that is needed to draw this figure.The drawing area needs to be large enough, to take line width, line caps and other decorations into account that exceed the bounds of the Figure.
- Specified by:
getDrawingAreain interfaceFigure- Overrides:
getDrawingAreain classBezierFigure
-
findSegment
public int findSegment(java.awt.geom.Point2D.Double find, double tolerance)Gets the segment of the polyline that is hit by the given Point2D.Double.- Overrides:
findSegmentin classBezierFigure- Parameters:
find- a Point on the bezier pathtolerance- a tolerance, tolerance should take into account the line width, plus 2 divided by the zoom factor.- Returns:
- the index of the segment or -1 if no segment was hit.
-
joinSegments
public boolean joinSegments(java.awt.geom.Point2D.Double join, double tolerance)Joins two segments into one if the given Point2D.Double hits a node of the polyline.- Overrides:
joinSegmentsin classBezierFigure- Parameters:
join- a Point at a node on the bezier pathtolerance- a tolerance, tolerance should take into account the line width, plus 2 divided by the zoom factor.- Returns:
- true if the two segments were joined.
-
splitSegment
public int splitSegment(java.awt.geom.Point2D.Double split, double tolerance)Splits the segment at the given Point2D.Double if a segment was hit.- Overrides:
splitSegmentin classBezierFigure- Parameters:
split- a Point on (or near) a segment of the bezier pathtolerance- a tolerance, tolerance should take into account the line width, plus 2 divided by the zoom factor.- Returns:
- the index of the segment or -1 if no segment was hit.
-
flattenTransform
public void flattenTransform()
Transforms all coords of the figure by the current TRANSFORM attribute and then sets the TRANSFORM attribute to null.
-
invalidate
public void invalidate()
Description copied from class:AbstractFigureInvalidates cached data of the Figure. This method must execute fast, because it can be called very often.- Overrides:
invalidatein classBezierFigure
-
-
DataMelt 3.0 © DataMelt by jWork.ORG