Package gov.nih.mipav.model.algorithms
Class ContourPlot.CompleteRenderer
- java.lang.Object
-
- gov.nih.mipav.model.algorithms.ContourPlot.CompleteRenderer
-
- All Implemented Interfaces:
ContourPlot.AdaptableView
,ContourPlot.PDFRenderer
,ContourPlot.Renderer
- Enclosing class:
- ContourPlot
public class ContourPlot.CompleteRenderer extends java.lang.Object implements ContourPlot.Renderer, ContourPlot.AdaptableView
TheContourPlot.CompleteRenderer
comprises aContourPlot.LinesRenderer
, aPointsRenderer
, aContourPlot.TextRenderer
and aContourPlot.TrianglesRenderer
. It thus can render the most important graphical elements for a scientific 2D visualization (hence its name).The order in which these Renderers are processed by default is:
This implies that Lines will be drawn over Triangles, Curves over Lines, Points over Curves, and Text over Points. Using the#setRenderOrder(int, int, int, int, int)
method the order of renderers can be changed.To add
ContourPlot.Renderable
s to this Renderer either use the public attributestriangles
,lines
,#curves
,#points
,text
to directly access the desired renderer or use theaddItemToRender(Renderable)
method.- Author:
- hageldave
-
-
Field Summary
Fields Modifier and Type Field Description (package private) boolean
isEnabled
static int
LIN
ContourPlot.LinesRenderer
lines
private ContourPlot.Renderer[]
rendererLUT
private int[]
renderOrder
ContourPlot.TextRenderer
text
static int
TRI
ContourPlot.TrianglesRenderer
triangles
static int
TXT
-
Constructor Summary
Constructors Constructor Description CompleteRenderer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ContourPlot.CompleteRenderer
addItemToRender(ContourPlot.Renderable item)
Adds the specified item to the corresponding renderer.boolean
isEnabled()
Whether this renderer is enabled or not.void
renderFallback(java.awt.Graphics2D g, java.awt.Graphics2D p, int w, int h)
Renders thisContourPlot.Renderer
's 'scene'.void
renderPDF(org.apache.pdfbox.pdmodel.PDDocument doc, org.apache.pdfbox.pdmodel.PDPage page, int x, int y, int w, int h)
Renders this PDFRenderers contents, that is creating pdf elements and appending them to the specified page within the corresponding document.void
setView(java.awt.geom.Rectangle2D rect)
Sets the view matrix for each of the renderers
-
-
-
Field Detail
-
lines
public final ContourPlot.LinesRenderer lines
-
text
public final ContourPlot.TextRenderer text
-
triangles
public final ContourPlot.TrianglesRenderer triangles
-
rendererLUT
private final ContourPlot.Renderer[] rendererLUT
-
TRI
public static final int TRI
- See Also:
- Constant Field Values
-
LIN
public static final int LIN
- See Also:
- Constant Field Values
-
TXT
public static final int TXT
- See Also:
- Constant Field Values
-
renderOrder
private final int[] renderOrder
-
isEnabled
boolean isEnabled
-
-
Method Detail
-
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
-
renderFallback
public void renderFallback(java.awt.Graphics2D g, java.awt.Graphics2D p, int w, int h)
Description copied from interface:ContourPlot.Renderer
Renders thisContourPlot.Renderer
's 'scene'. This is the fallback path in case OpenGL based rendering through#render(int, int, int, int)
is not available.- Specified by:
renderFallback
in interfaceContourPlot.Renderer
- Parameters:
g
- main graphics object for drawing onto the framebufferp
- graphics object for drawing onto the picking framebuffer (invisible but used for picking)w
- width of the current viewport in pixelsh
- height of the current viewport in pixels
-
renderPDF
public void renderPDF(org.apache.pdfbox.pdmodel.PDDocument doc, org.apache.pdfbox.pdmodel.PDPage page, int x, int y, int w, int h)
Description copied from interface:ContourPlot.PDFRenderer
Renders this PDFRenderers contents, that is creating pdf elements and appending them to the specified page within the corresponding document.- Specified by:
renderPDF
in interfaceContourPlot.PDFRenderer
- Parameters:
doc
- the PDF document holding the pagepage
- page in pdf doc to which elements are to be appendedx
- x coordinate of the current viewporty
- y coordinate of the current viewportw
- width of the current viewporth
- height of the current viewport
-
addItemToRender
public ContourPlot.CompleteRenderer addItemToRender(ContourPlot.Renderable item)
Adds the specified item to the corresponding renderer. Only instances ofContourPlot.Triangles
,ContourPlot.Lines
,ContourPlot.Points
andContourPlot.Text
are accepted, other item types result in anIllegalArgumentException
.- Parameters:
item
- to add- Returns:
- this for chaining
- Throws:
java.lang.IllegalArgumentException
- when unsupported type of item is specified.
-
setView
public void setView(java.awt.geom.Rectangle2D rect)
Sets the view matrix for each of the renderers- Specified by:
setView
in interfaceContourPlot.AdaptableView
- Parameters:
rect
- the view rectangle (can be null)
-
-