|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjpicedt.graphic.view.DefaultHighlighterFactory.DefaultHighlighter
Default implementation of the Highlighter interface.
Field Summary | |
protected Rectangle2D.Double |
bounds
cache for highlighter bounds |
protected Element |
element
highlighted Element |
protected PointIndexIterator |
pointIndexIterator
iterator over visible control-points |
protected PicPoint |
ptBuffer
buffer used by paint only ; may be safely used by subclasses as well |
protected Rectangle2D |
rectBuffer
buffer used by paint only ; may be safely used by subclasses as well |
protected Shape |
shape
highlighter shape ; should be null if N/A in subclass |
Constructor Summary | |
DefaultHighlighterFactory.DefaultHighlighter(Element element)
|
Method Summary | |
void |
changedUpdate(DrawingEvent.EventType eventType,
double scale)
Give notification from the model that a change occured for an element's highlighting this highlighter is responsible for rendering. |
Rectangle2D |
getBounds()
|
protected PointIndexIterator |
getControlPointsIterator()
Returns an iterator over control-points that should be displayed by the hightligher. |
Element |
getElement()
returns the higlighted Element |
HighlighterFactory |
getHighlighterFactory()
Fetches the HighlighterFactory implementation that is feeding the view hierarchy. |
HitInfo |
hitTest(PEMouseEvent e)
Current implementation returns a HitInfo.Point if a click occured on one of the controlled-point indices returned by getControlPointsIterator() ; return null otherwise. |
void |
paint(Graphics2D g,
Rectangle2D allocation,
double scale)
Render the Highlighter to the given graphic context. Current implementation paints end-points by delegating to a DefaultPointIndexIterator ,
using the highlighter color if the given
allocation intersects the bounds of this view,
then iterates over the shapes array, and paints any non-null element. |
protected void |
syncBounds(double scale)
Synchronizes the highlighter's bounding rectangle (aka clip) with the model ; "bounds" is first computed from the set of visible control-points, then its size gets increased by BARBELL_SIZE. |
protected void |
syncShape(double scale)
Synchronize the shape needed to paint this highlighter, with the model ; This implementation does nothing. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Element element
protected PointIndexIterator pointIndexIterator
protected Shape shape
protected Rectangle2D.Double bounds
protected Rectangle2D rectBuffer
protected PicPoint ptBuffer
Constructor Detail |
public DefaultHighlighterFactory.DefaultHighlighter(Element element)
element
- the Element to be highlightedMethod Detail |
public Element getElement()
public HighlighterFactory getHighlighterFactory()
getHighlighterFactory
in interface Highlighter
public void changedUpdate(DrawingEvent.EventType eventType, double scale)
syncShape()
if it's a DrawingEvent.GEOMETRY_CHANGE
syncBounds()
if it's a DrawingEvent.GEOMETRY_CHANGE
changedUpdate
in interface Highlighter
protected void syncBounds(double scale)
scale
- The current scale factor from-model-to-screen for the Graphics2D context ;
this may be used to scale down line thickess, etc... so that e.g. barbells appear with the
same size on the screen whatever the scale factor being set to the graphic context.protected void syncShape(double scale)
scale
- The current scale factor from-model-to-screen for the Graphics2D context ;
this may be used to scale down line thickess, etc... so that e.g. barbells appear with the
same size on the screen whatever the scale factor being set to the graphic context.public void paint(Graphics2D g, Rectangle2D allocation, double scale)
DefaultPointIndexIterator
,
using the highlighter color if the given
allocation intersects the bounds of this view,
then iterates over the shapes
array, and paints any non-null element.
paint
in interface Highlighter
scale
- The current scale factor from-model-to-screen for the Graphics2D context ;
this may be used to scale down line thickess, etc... so that e.g. barbells appear with the
same size on the screen whatever the scale factor being set to the graphic context.allocation
- current clippingprotected PointIndexIterator getControlPointsIterator()
public Rectangle2D getBounds()
getBounds
in interface Highlighter
public HitInfo hitTest(PEMouseEvent e)
getControlPointsIterator()
; return null otherwise.
hitTest
in interface Highlighter
|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |