Package gov.nih.mipav.model.algorithms
Class ContourPlot.GenericRenderer<T extends ContourPlot.Renderable>
- java.lang.Object
-
- gov.nih.mipav.model.algorithms.ContourPlot.GenericRenderer<T>
-
- All Implemented Interfaces:
ContourPlot.AdaptableView
,ContourPlot.PDFRenderer
,ContourPlot.Renderer
- Direct Known Subclasses:
ContourPlot.LinesRenderer
,ContourPlot.TextRenderer
,ContourPlot.TrianglesRenderer
- Enclosing class:
- ContourPlot
public abstract class ContourPlot.GenericRenderer<T extends ContourPlot.Renderable> extends java.lang.Object implements ContourPlot.Renderer, ContourPlot.AdaptableView
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
isEnabled
protected java.util.LinkedList<T>
itemsToRender
protected java.awt.geom.Rectangle2D
view
-
Constructor Summary
Constructors Constructor Description GenericRenderer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ContourPlot.GenericRenderer<T>
addItemToRender(T item)
Adds an item to this renderer'sitemsToRender
list.java.util.LinkedList<T>
getItemsToRender()
boolean
isEnabled()
Whether this renderer is enabled or not.boolean
removeItemToRender(T item)
Removes an item from this renderer'sitemsToRender
list.void
setView(java.awt.geom.Rectangle2D view)
Sets the view rectangle that is the range of coordinates to be projected onto the view port.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface gov.nih.mipav.model.algorithms.ContourPlot.PDFRenderer
renderPDF
-
Methods inherited from interface gov.nih.mipav.model.algorithms.ContourPlot.Renderer
renderFallback
-
-
-
-
Field Detail
-
itemsToRender
protected java.util.LinkedList<T extends ContourPlot.Renderable> itemsToRender
-
view
protected java.awt.geom.Rectangle2D view
-
isEnabled
protected boolean isEnabled
-
-
Method Detail
-
addItemToRender
public ContourPlot.GenericRenderer<T> addItemToRender(T item)
Adds an item to this renderer'sitemsToRender
list. The renderer will take care of callingRenderable#initGL()
during its#render(int, int, int, int)
method and will as well callRenderable#updateGL(boolean)
ifContourPlot.Renderable.isDirty()
.- Parameters:
item
- to add- Returns:
- this for chaining
-
removeItemToRender
public boolean removeItemToRender(T item)
Removes an item from this renderer'sitemsToRender
list.- Parameters:
item
- to remove- Returns:
- true when successfully removed, else false (e.g. when not contained in list)
-
isEnabled
public boolean isEnabled()
Description copied from interface:ContourPlot.Renderer
Whether this renderer is enabled or not. By default a renderer is enabled and will render upon#render(int, int, int, int)
or#renderSVG(org.w3c.dom.Document, org.w3c.dom.Element, int, int)
. When disabled those methods return right away and will not render anything.- Specified by:
isEnabled
in interfaceContourPlot.Renderer
- Returns:
- true when active
-
getItemsToRender
public java.util.LinkedList<T> getItemsToRender()
- Returns:
- the list of items to render.
-
setView
public void setView(java.awt.geom.Rectangle2D view)
Description copied from interface:ContourPlot.AdaptableView
Sets the view rectangle that is the range of coordinates to be projected onto the view port.For example when setting a view rectangle of (x=-1,y=-1,w=2,h=2) given a viewport of size (w=100,h=100), then a point with coordinates (x=0,y=0) will be projected to (x=50,y=50) on the viewport. A point with coordinates (x=-1,y=-1) will be projected to (x=0,y=0).
When setting the view rectangle to null, then no projection is happening and the coordinates are mapped directly to view port coordinates. E.g. coordinates (40,40) will be (40,40) on the viewport, as if the view rectangles size was coupled to the viewport size.
- Specified by:
setView
in interfaceContourPlot.AdaptableView
- Parameters:
view
- the view rectangle (can be null)
-
-