|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jpicedt.graphic.view.highlighter.DefaultHighlighter
public class DefaultHighlighter
Default implementation of the Highlighter
interface.
Field Summary | |
---|---|
protected Rectangle2D.Double |
bounds
Cache for highlighter bounds. |
protected Element |
element
highlighted Element |
protected DefaultHighlighterFactory |
factory
factory |
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 | |
---|---|
DefaultHighlighter(Element element,
DefaultHighlighterFactory f)
|
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()
Returns the bounds of this Highlighter This will determine the clipping rectangle passed as a parameter to repaint in the hosting view |
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() ; null otherwise. |
boolean |
intersect(Rectangle2D r,
ArrayList<Element> list)
If this highligher intersects the given rectangle, add the associated Element (or a child Element if it's more appropriate, for instance for composite views) to the given list, and returns true. |
void |
paint(Graphics2D g,
Rectangle2D allocation,
double scale)
Render the Highlighter to the given graphic context. |
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 could be, for instance, tangents in the case of a Bezier curve, the outline in the case of an ellipse, etc. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected DefaultHighlighterFactory factory
protected Element element
Element
protected PointIndexIterator pointIndexIterator
protected Shape shape
protected Rectangle2D.Double bounds
protected Rectangle2D rectBuffer
protected PicPoint ptBuffer
Constructor Detail |
---|
public DefaultHighlighter(Element element, DefaultHighlighterFactory f)
element
- the Element
to be highlightedMethod Detail |
---|
public Element getElement()
Highlighter
getElement
in interface Highlighter
Element
.public HighlighterFactory getHighlighterFactory()
HighlighterFactory
implementation that is feeding the view hierarchy.
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)
BARBELL_SIZE
. Finally, if shape
(see syncShape()
) is non-null,
it gets appended to the bounding rectangle.
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 current zoom factor.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)
shape
member if it's non-null (see the syncShape()
method), then
control-points by delegating to a DefaultPointIndexIterator
, using the highlighter color if the given allocation intersects the bounds
of this view,
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 clippingpublic PointIndexIterator getControlPointsIterator()
public Rectangle2D getBounds()
Highlighter
getBounds
in interface Highlighter
public HitInfo hitTest(PEMouseEvent e)
getControlPointsIterator()
; null otherwise.
hitTest
in interface Highlighter
public boolean intersect(Rectangle2D r, ArrayList<Element> list)
intersect
in interface Highlighter
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |