JHotDraw 7.0.9

org.jhotdraw.samples.svg.figures
Class SVGBezierFigure

java.lang.Object
  extended by org.jhotdraw.draw.AbstractFigure
      extended by org.jhotdraw.draw.AbstractAttributedFigure
          extended by org.jhotdraw.draw.BezierFigure
              extended by 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.

Version:
1.0 April 14, 2007 Created.
Author:
Werner Randelshofer
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jhotdraw.draw.BezierFigure
path
 
Fields inherited from class org.jhotdraw.draw.AbstractFigure
changingDepth, listenerList
 
Constructor Summary
SVGBezierFigure()
          Creates a new instance.
SVGBezierFigure(boolean isClosed)
           
 
Method Summary
 java.util.Collection<Handle> createHandles(SVGPathFigure pathFigure, int detailLevel)
           
 void flattenTransform()
          Transforms all coords of the figure by the current TRANSFORM attribute and then sets the TRANSFORM attribute to null.
 java.awt.geom.Rectangle2D.Double getDrawingArea()
          Returns the drawing area of the figure as a Rectangle.
 boolean handleMouseClick(java.awt.geom.Point2D.Double p, java.awt.event.MouseEvent evt, DrawingView view)
          Handles a mouse click.
 void invalidate()
          Informs that a figure needs to be redrawn.
 void transform(java.awt.geom.AffineTransform tx)
          Transforms the shape of the Figure.
 
Methods inherited from class org.jhotdraw.draw.BezierFigure
addNode, addNode, canConnect, chop, clone, contains, createHandles, drawCaps, drawFill, drawStroke, findCompatibleConnector, findConnector, findNode, findSegment, getBezierPath, getBounds, getCappedPath, getCenter, getEndPoint, getNode, getNodeCount, getOutermostPoint, getPoint, getPoint, getPointOnPath, getStartPoint, getTransformRestoreData, isClosed, joinSegments, joinSegments, layout, read, readPoints, removeAllNodes, removeNode, restoreTransformTo, setAttribute, setBezierPath, setBounds, setClosed, setEndPoint, setNode, setPoint, setPoint, setStartPoint, splitSegment, splitSegment, validate, write, writePoints
 
Methods inherited from class org.jhotdraw.draw.AbstractAttributedFigure
applyAttributesTo, draw, drawText, getAttribute, getAttributeKey, getAttributes, getAttributesRestoreData, getStroke, getStrokeMiterLimitFactor, hasAttribute, isAttributeEnabled, readAttributes, removeAttribute, restoreAttributesTo, setAttributeEnabled, setAttributes, writeAttributes
 
Methods inherited from class org.jhotdraw.draw.AbstractFigure
addFigureListener, addNotify, basicClone, changed, findFigureInside, fireAreaInvalidated, fireAreaInvalidated, fireAttributeChanged, fireFigureAdded, fireFigureChanged, fireFigureChanged, fireFigureChanged, fireFigureHandlesChanged, fireFigureRemoved, fireFigureRequestRemove, fireUndoableEditHappened, getActions, getChangingDepth, getConnectors, getCursor, getDecomposition, getDrawing, getFontRenderContext, getLayer, getLock, getPreferredSize, getTool, getToolTipText, handleDrop, includes, isChanging, isInteractive, isVisible, remap, remap, removeFigureListener, removeNotify, requestRemove, setBounds, setInteractive, setVisible, toString, willChange
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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: BezierFigure
Handles a mouse click.

Specified by:
handleMouseClick in interface Figure
Overrides:
handleMouseClick in class BezierFigure
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: Figure
Transforms 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. After the transform has finished, the bounds of the decorator figure are changed to match the transformed bounds of the figure.

This is a basic operation which does not fire events. Use the following code sequence, if you need event firing:

 aFigure.willChange();
 aFigure.transform(...);
 aFigure.changed();
 

Specified by:
transform in interface Figure
Overrides:
transform in class BezierFigure
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: Figure
Returns the drawing area of the figure as a Rectangle. The drawing area is used to improve the performance of GraphicView, for example for clipping of repaints and for clipping of mouse events.

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:
getDrawingArea in interface Figure
Overrides:
getDrawingArea in class BezierFigure

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: AbstractFigure
Informs that a figure needs to be redrawn.

Specified by:
invalidate in interface Figure
Overrides:
invalidate in class BezierFigure

Copyright 1996-2007 (c) JHotDraw.org.
Some rights reserved.