|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jdrawing.AbstractDrawingModelCache org.jdrawing.QuadTreeDrawingModelCache
This implementation of DrawingModelCache
optimizes
drawing operations by splitting all the drawing area into
quadrants recursively and caching elements contained in each quadrant.
Field Summary | |
static int |
MIN_CELL_SIZE
Minimal cell size in pixels. |
Constructor Summary | |
QuadTreeDrawingModelCache()
|
Method Summary | |
void |
elementsAdded(DrawingModelEvent event)
Invoked after elements have been inserted into the model. |
void |
elementsChanged(DrawingModelEvent event)
Invoked after elements have been changed in some way. |
void |
elementsRemoved(DrawingModelEvent event)
Invoked after elements have been removed from the model. |
java.lang.Object[] |
getElementsForPoint(java.awt.geom.Point2D point)
Returns elements which contain a given point. |
java.lang.Object[] |
getElementsForRectangle(java.awt.geom.Rectangle2D rectangle)
Returns elements necessary for repainting a given area. |
java.awt.geom.Rectangle2D |
getModelBounds2D()
Returns the high precision bounding box of all elements of the model. |
void |
modelChanged(DrawingModelEvent event)
Invoked after the model has drastically changed in some way. |
void |
setElementRenderer(DrawingElementRenderer renderer)
Sets the DrawingElementRenderer that will be used in this cache.
|
void |
setModel(DrawingModel model)
Sets the DrawingModel that will be cached by this cache. |
Methods inherited from class org.jdrawing.AbstractDrawingModelCache |
addDrawingModelCacheListener, fireAreaChanged, fireDrawingChanged, getDrawingModelCacheListeners, getElementRenderer, getModel, getModelBounds, removeDrawingModelCacheListener |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int MIN_CELL_SIZE
Constructor Detail |
public QuadTreeDrawingModelCache()
Method Detail |
public java.awt.geom.Rectangle2D getModelBounds2D()
public java.lang.Object[] getElementsForRectangle(java.awt.geom.Rectangle2D rectangle)
rectangle
- area that will be repainted
public java.lang.Object[] getElementsForPoint(java.awt.geom.Point2D point)
point
- the Point2D
return elements containing given pointpublic void setModel(DrawingModel model)
DrawingModel
that will be cached by this cache.
setModel
in interface DrawingModelCache
setModel
in class AbstractDrawingModelCache
model
- the DrawingModel
that is to be cachedpublic void setElementRenderer(DrawingElementRenderer renderer)
DrawingElementRenderer
that will be used in this cache.
Renderer is used to obtain the bounds of an element of the model.
setElementRenderer
in interface DrawingModelCache
setElementRenderer
in class AbstractDrawingModelCache
renderer
- the DrawingElementRenderer
that is to be usedpublic void elementsAdded(DrawingModelEvent event)
elementsAdded
in interface DrawingModelListener
elementsAdded
in class AbstractDrawingModelCache
event
- DrawingModelEvent object encapsulating event
informationpublic void elementsRemoved(DrawingModelEvent event)
elementsRemoved
in interface DrawingModelListener
elementsRemoved
in class AbstractDrawingModelCache
event
- DrawingModelEvent object encapsulating event
informationpublic void elementsChanged(DrawingModelEvent event)
elementsChanged
in interface DrawingModelListener
elementsChanged
in class AbstractDrawingModelCache
event
- DrawingModelEvent object encapsulating event
informationpublic void modelChanged(DrawingModelEvent event)
modelChanged
in interface DrawingModelListener
modelChanged
in class AbstractDrawingModelCache
event
- DrawingModelEvent object encapsulating event
information
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |