Package gov.nih.mipav.model.algorithms
Class ContourPlot.Legend
java.lang.Object
gov.nih.mipav.model.algorithms.ContourPlot.Legend
- All Implemented Interfaces:
ContourPlot.PDFRenderer,ContourPlot.Renderable,ContourPlot.Renderer
- Enclosing class:
ContourPlot
public static class ContourPlot.Legend
extends Object
implements ContourPlot.Renderable, ContourPlot.Renderer
The Legend class is
ContourPlot.Renderable and its own ContourPlot.Renderer at once.
It is intended to be used to display labels and corresponding visual representatives
such as a colored ContourPlot.Glyph or line segment, in order to explain the meaning
of the contents of a visualization.
To add items to the legend, the methods
and
invalid reference
#addGlyphLabel(Glyph, int, String)addLineLabel(double, int, String) can be used.
The layout of the items is very similar to FlowLayout in which the items
are positioned next to each other until no more space is available to the right
and a line break happens, then positioning continues in the next row.
A slight difference is that glyph labels are always first in order and followed by
line labels.
Layouting happens on
.invalid reference
#updateGL(boolean)
- Author:
- hageldave
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classprotected static classprotected static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ArrayList<ContourPlot.Legend.ColormapLabel> protected ContourPlot.ColorSchemeprotected ContourPlot.CompleteRendererprotected Map<ContourPlot.Glyph, ContourPlot.Points> protected ArrayList<ContourPlot.Legend.GlyphLabel> protected booleanprotected booleanprotected ArrayList<ContourPlot.Legend.LineLabel> protected Map<Integer, ContourPlot.Lines> protected LinkedList<ContourPlot.Text> protected LinkedList<ContourPlot.Triangles> protected intprotected int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddLineLabel(double thickness, int color, int strokePattern, String labeltxt, int pickColor) Adds a label for a line to this legend.addLineLabel(double thickness, int color, String labeltxt) Adds a label for a line to this legend.addLineLabel(double thickness, int color, String labeltxt, int pickColor) Adds a label for a line to this legend.booleanintersects(Rectangle2D rect) Always return false.booleanisDirty()if true, indicates that a call tois necessary to sync this objects GL resources to its current state.invalid reference
#updateGL(boolean)booleanWhether this renderer is enabled or not.voidrenderFallback(Graphics2D g, 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.voidsetColorScheme(ContourPlot.ColorScheme colorScheme) setDirty()Sets theisDirty()state of this legend to true.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface gov.nih.mipav.model.algorithms.ContourPlot.Renderable
isHidden
-
Field Details
-
glyphLabels
-
lineLabels
-
colormapLabels
-
glyph2points
-
pattern2lines
-
triangles
-
texts
-
delegate
-
isDirty
protected boolean isDirty -
viewPortWidth
protected int viewPortWidth -
viewPortHeight
protected int viewPortHeight -
isEnabled
protected boolean isEnabled -
colorScheme
-
-
Constructor Details
-
Legend
public Legend()
-
-
Method Details
-
setColorScheme
-
setDirty
Sets theisDirty()state of this legend to true. This indicates that a call tois necessary to sync GL resources with this legends state.invalid reference
#updateGL(boolean)- Returns:
- this for chaining
-
isDirty
public boolean isDirty()Description copied from interface:ContourPlot.Renderableif true, indicates that a call tois necessary to sync this objects GL resources to its current state.invalid reference
#updateGL(boolean)- Specified by:
isDirtyin interfaceContourPlot.Renderable- Returns:
- true if dirty
-
renderFallback
Description copied from interface:ContourPlot.RendererRenders thisContourPlot.Renderer's 'scene'. This is the fallback path in case OpenGL based rendering throughis not available.invalid reference
#render(int, int, int, int)- 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
-
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 uponorinvalid reference
#render(int, int, int, int). When disabled those methods return right away and will not render anything.invalid reference
#renderSVG(org.w3c.dom.Document, org.w3c.dom.Element, int, int)- Specified by:
isEnabledin interfaceContourPlot.Renderer- Returns:
- true when active
-
intersects
Always return false.- Specified by:
intersectsin interfaceContourPlot.Renderable- Parameters:
rect- rectangle to test- Returns:
- true when intersecting
-
addLineLabel
public ContourPlot.Legend addLineLabel(double thickness, int color, int strokePattern, String labeltxt, int pickColor) Adds a label for a line to this legend.- Parameters:
thickness- of the line to appear in front of the label textcolor- integer packed ARGB color value of the glyphstrokePattern- lines stroke pattern (see)invalid reference
Lines#setStrokePattern(int)labeltxt- text of the labelpickColor- picking color (see)invalid reference
FBOCanvas- Returns:
- this for chaining
-
addLineLabel
Adds a label for a line to this legend.- Parameters:
thickness- of the line to appear in front of the label textcolor- integer packed ARGB color value of the glyphlabeltxt- text of the labelpickColor- picking color (see)invalid reference
FBOCanvas- Returns:
- this for chaining
-
addLineLabel
Adds a label for a line to this legend.- Parameters:
thickness- of the line to appear in front of the label textcolor- integer packed ARGB color value of the glyphlabeltxt- text of the label- Returns:
- this for chaining
-