org.jdrawing
Interface DrawingModelCache

All Known Implementing Classes:
AbstractDrawingModelCache

public interface DrawingModelCache

The interface that defines a model cache for JDrawing. The model cache is responsible for selecting elements necessary for repainting a specific area, calculating a bounding rectangle of the model, and searching for elements containing a given point.

See Also:
DrawingModel, DrawingElementRenderer

Method Summary
 void addDrawingModelCacheListener(DrawingModelCacheListener listener)
          Adds a listener which will be notified about changes in this model 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.
 java.awt.Rectangle getModelBounds()
          Returns the bounding box of all elements of the model.
 java.awt.geom.Rectangle2D getModelBounds2D()
          Returns the high precision bounding box of all elements of the model.
 void removeDrawingModelCacheListener(DrawingModelCacheListener listener)
          Removes a listener from the list that is notified about changes in this model cache.
 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.
 

Method Detail

setModel

public void setModel(DrawingModel model)
Sets the DrawingModel that will be cached by this cache.

Parameters:
model - the DrawingModel that is to be cached

setElementRenderer

public void setElementRenderer(DrawingElementRenderer renderer)
Sets the DrawingElementRenderer that will be used in this cache. Renderer is used to obtain the bounds of an element of the model.

Parameters:
renderer - the DrawingElementRenderer that is to be used

getModelBounds

public java.awt.Rectangle getModelBounds()
Returns the bounding box of all elements of the model.

Returns:
the bounding box of all elements of the model

getModelBounds2D

public java.awt.geom.Rectangle2D getModelBounds2D()
Returns the high precision bounding box of all elements of the model.

Returns:
the high precision bounding box of all elements of the model

getElementsForRectangle

public java.lang.Object[] getElementsForRectangle(java.awt.geom.Rectangle2D rectangle)
Returns elements neccessary for repainting given area. Elements are returned in order suitable for painting.

Parameters:
rectangle - area that will be repainted
Returns:
elements neccessary for repainting

getElementsForPoint

public java.lang.Object[] getElementsForPoint(java.awt.geom.Point2D point)
Returns elements which contain a given point. Elements are returned in order, suitable for painting.

Parameters:
point - the Point2D return elements containing given point

addDrawingModelCacheListener

public void addDrawingModelCacheListener(DrawingModelCacheListener listener)
Adds a listener which will be notified about changes in this model cache.

Parameters:
listener - the DrawingModelCacheListener

removeDrawingModelCacheListener

public void removeDrawingModelCacheListener(DrawingModelCacheListener listener)
Removes a listener from the list that is notified about changes in this model cache.

Parameters:
listener - the DrawingModelCacheListener