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.CompleteRenderercomprises aContourPlot.LinesRenderer, aPointsRenderer, aContourPlot.TextRendererand 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.Renderables to this Renderer either use the public attributestriangles,lines,#curves,#points,textto directly access the desired renderer or use theaddItemToRender(Renderable)method.- Author:
- hageldave
-
-
Field Summary
Fields Modifier and Type Field Description (package private) booleanisEnabledstatic intLINContourPlot.LinesRendererlinesprivate ContourPlot.Renderer[]rendererLUTprivate int[]renderOrderContourPlot.TextRenderertextstatic intTRIContourPlot.TrianglesRenderertrianglesstatic intTXT
-
Constructor Summary
Constructors Constructor Description CompleteRenderer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ContourPlot.CompleteRendereraddItemToRender(ContourPlot.Renderable item)Adds the specified item to the corresponding renderer.booleanisEnabled()Whether this renderer is enabled or not.voidrenderFallback(java.awt.Graphics2D g, java.awt.Graphics2D p, int w, int h)Renders thisContourPlot.Renderer's 'scene'.voidrenderPDF(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.voidsetView(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.RendererWhether 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:
isEnabledin 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.RendererRenders 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:
renderFallbackin 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.PDFRendererRenders this PDFRenderers contents, that is creating pdf elements and appending them to the specified page within the corresponding document.- Specified by:
renderPDFin 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.PointsandContourPlot.Textare 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:
setViewin interfaceContourPlot.AdaptableView- Parameters:
rect- the view rectangle (can be null)
-
-