|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jdrawing.AbstractDrawingModelCache org.jdrawing.GridDrawingModelCache
This implementation of DrawingModelCache
optimizes
drawing operations by splitting all the drawing area into rectangular
cells and caching elements intersecting each cell.
Constructor Summary | |
GridDrawingModelCache()
|
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.awt.Dimension |
getCellSize()
Return size of cells used by this cache. |
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 neccessary for repainting given area. Elements are returned in order suitable for painting. |
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 |
setCellSize(java.awt.Dimension cellSize)
Set size for rectangular cells. |
void |
setModel(DrawingModel model)
Sets the DrawingModel that will be cached by this cache.
|
void |
setRenderer(DrawingRenderer renderer)
Sets the DrawingRenderer that will be used in this cache.
|
Methods inherited from class org.jdrawing.AbstractDrawingModelCache |
addDrawingModelCacheListener, fireAreaChanged, fireDrawingChanged, getDrawingModelCacheListeners, getModel, getModelBounds, getRenderer, removeDrawingModelCacheListener |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public GridDrawingModelCache()
Method Detail |
public void setModel(DrawingModel model)
DrawingModelCache
DrawingModel
that will be cached by this cache.
If model is null
, then set this DrawingModelCache
to do not cache any DrawingModel
.
setModel
in interface DrawingModelCache
setModel
in class AbstractDrawingModelCache
public void setRenderer(DrawingRenderer renderer)
DrawingModelCache
DrawingRenderer
that will be used in this cache.
If renderer is null
, then set this DrawingModelCache
to do not use any DrawingRenderer
.
Renderer is used to obtain the bounds of an element of the model.
setRenderer
in interface DrawingModelCache
setRenderer
in class AbstractDrawingModelCache
public void setCellSize(java.awt.Dimension cellSize)
cellSize
- new size for cells
java.lang.IllegalArgumentException
- if cellSize is null
public java.awt.Dimension getCellSize()
public java.awt.geom.Rectangle2D getModelBounds2D()
DrawingModelCache
getModelBounds2D
in interface DrawingModelCache
public java.lang.Object[] getElementsForRectangle(java.awt.geom.Rectangle2D rectangle)
getElementsForRectangle
in interface DrawingModelCache
rectangle
- area that will be repainted
java.lang.IllegalArgumentException
- if rectangle is null
public java.lang.Object[] getElementsForPoint(java.awt.geom.Point2D point)
DrawingModelCache
getElementsForPoint
in interface DrawingModelCache
point
- the Point2D
return elements containing given pointpublic void elementsAdded(DrawingModelEvent event)
DrawingModelListener
elementsAdded
in interface DrawingModelListener
elementsAdded
in class AbstractDrawingModelCache
event
- DrawingModelEvent object encapsulating event
informationpublic void elementsRemoved(DrawingModelEvent event)
DrawingModelListener
elementsRemoved
in interface DrawingModelListener
elementsRemoved
in class AbstractDrawingModelCache
event
- DrawingModelEvent object encapsulating event
informationpublic void elementsChanged(DrawingModelEvent event)
DrawingModelListener
elementsChanged
in interface DrawingModelListener
elementsChanged
in class AbstractDrawingModelCache
event
- DrawingModelEvent object encapsulating event
informationpublic void modelChanged(DrawingModelEvent event)
DrawingModelListener
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 |