Package gov.nih.mipav.model.algorithms
Class ContourPlot.Text
java.lang.Object
gov.nih.mipav.model.algorithms.ContourPlot.Text
- All Implemented Interfaces:
ContourPlot.Renderable
- Enclosing class:
ContourPlot
Abstract class for
ContourPlot.Renderables representing text that can be rendered using the
ContourPlot.TextRenderer.
A text object describes a line of characters together with the following attributes:
- fontsize (e.g. 12 pts.)
- font style (e.g. Font
Font.BOLD) - color
- origin - the bottom left corner of the rectangle enclosing the text
- angle - the rotation of the text (around origin)
- picking color - the picking color with which the text is rendered into the (invisible) picking color attachment
of an
. This color may serve as an identifier of the object that can be queried from a location of the rendering canvas. It may take on a value in range of 0xff000001 to 0xffffffff (16.777.214 possible values) or 0.
invalid reference
FBO
- Author:
- hageldave
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new Text object with the specified string and font configuration.Creates a new Text object with the specified string and font configuration.Creates a new Text object with the specified string and font configuration. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()disposes of the GL resources of this text object, i.e deletes the vertex array.floatgetAngle()getColor()floatfloatfloatfloatintfloatfloatfloatfloathide(boolean hide) Hides or unhides this Text object, i.e. sets theisHidden()field value.booleanintersects(Rectangle2D rect) tests if thisContourPlot.Renderableintersects or contains the specified rectangle.booleanisDirty()if true, indicates that a call tois necessary to sync this objects GL resources to its current state.invalid reference
#updateGL(boolean)booleanisHidden()Indicates whether this Renderable is hidden i.e. will not be drawn.setAngle(double angle) Sets the rotation angle in radian by which this text object is rotated around its origin.voidsetBackground(int argb) Sets the background color of the text, per default this is transparent black (0x00000000) which wont be visible.voidsetBackground(Color background) Sets the background color of the text, per default this is transparent black (0x00000000) which wont be visible.setColor(int argb) Sets the color of this text in integer packed ARGB format.Sets the color of this textsetDirty()Sets theisDirty()state of this renderable to true.setOrigin(int x, int y) Sets the origin of this text object, i.e. the bottom left corner of the rectangle enclosing the text, the text's location so to saySets the origin of this text object, i.e. the bottom left corner of the rectangle enclosing the text, the text's location so to saysetPickColor(int pickColor) Sets the picking color of thisContourPlot.Textobject.setTextString(String txtStr) Sets the string of this text.
-
Field Details
-
fontsize
public final int fontsize -
style
public final int style -
textSize
-
color
-
background
-
pickColor
protected int pickColor -
origin
-
angle
protected float angle -
txtStr
-
isDirty
protected boolean isDirty
-
-
Constructor Details
-
Text
Creates a new Text object with the specified string and font configuration.- Parameters:
textstr- the text to be displayedfontsize- point size of the fontstyle- of the font - one ofFont.PLAIN,Font.BOLD,Font.ITALICor bitwise union BOLD|ITALIC.textcolor- color of the text
-
Text
Creates a new Text object with the specified string and font configuration.- Parameters:
textstr- the text to be displayedfontsize- point size of the fontstyle- of the font - one ofFont.PLAIN,Font.BOLD,Font.ITALICor bitwise union BOLD|ITALIC.textcolor- color of the text (integer packed ARGB)
-
Text
Creates a new Text object with the specified string and font configuration.- Parameters:
textstr- the text to be displayedfontsize- point size of the fontstyle- of the font - one ofFont.PLAIN,Font.BOLD,Font.ITALICor bitwise union BOLD|ITALIC.
-
-
Method Details
-
setTextString
Sets the string of this text. Only characters that are ASCII printable (more precisely ASCII characters [32..126]) will be displayed, other characters are mapped to whitespace for rendering. This set theisDirty()state of thisContourPlot.Renderableto true.- Parameters:
txtStr- the text string this object should display.- Returns:
- this for chaining
-
getTextString
- Returns:
- the String this text object displays
-
intersects
Description copied from interface:ContourPlot.Renderabletests if thisContourPlot.Renderableintersects or contains the specified rectangle.- Specified by:
intersectsin interfaceContourPlot.Renderable- Parameters:
rect- rectangle to test- Returns:
- true when intersecting
-
setDirty
Sets theisDirty()state of this renderable to true. This indicates that ancall is necessary to sync GL resources.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
-
close
public void close()disposes of the GL resources of this text object, i.e deletes the vertex array. -
setColor
Sets the color of this text- Parameters:
color- to set- Returns:
- this for chaining
-
setColor
Sets the color of this text in integer packed ARGB format. e.g. 0xff00ff00 for opaque green.- Parameters:
argb- integer packed ARGB color value- Returns:
- this for chaining
-
getColor
- Returns:
- this text's color
-
setBackground
Sets the background color of the text, per default this is transparent black (0x00000000) which wont be visible.- Parameters:
background- color
-
setBackground
public void setBackground(int argb) Sets the background color of the text, per default this is transparent black (0x00000000) which wont be visible.- Parameters:
argb- integer packed ARGB color value
-
getBackground
-
getColorR
public float getColorR()- Returns:
- normalized red channel of this text's color (in [0,1])
-
getColorG
public float getColorG()- Returns:
- normalized green channel of this text's color (in [0,1])
-
getColorB
public float getColorB()- Returns:
- normalized blue channel of this text's color (in [0,1])
-
getColorA
public float getColorA()- Returns:
- normalized alpha channel of this text's color (in [0,1])
-
setPickColor
Sets the picking color of thisContourPlot.Textobject. The picking color is the color with which quads of the individual characters are rendered into the (invisible) picking color attachment of an. This color may serve as an identifier of the object that can be queried from a location of the rendering canvas. It may take on a value in range of 0xff000001 to 0xffffffff (16.777.214 possible values).invalid reference
FBO- Parameters:
pickColor- opaque integer packed RGB value, 0 or one in [0xff000001..0xffffffff]. When a transparent color is specified its alpha channel will be set to 0xff to make it opaque.- Returns:
- this for chaining
-
getPickColor
public int getPickColor()- Returns:
- the picking color of this
ContourPlot.Textobject
-
getPickColorR
public float getPickColorR()- Returns:
- the normalized red channel of the picking color (in [0,1])
-
getPickColorG
public float getPickColorG()- Returns:
- the normalized green channel of the picking color (in [0,1])
-
getPickColorB
public float getPickColorB()- Returns:
- the normalized blue channel of the picking color (in [0,1])
-
getPickColorA
public float getPickColorA()- Returns:
- the normalized alpha channel of the picking color (in [0,1])
-
getTextSize
- Returns:
- the dimensions in pixels of this text object
-
getBounds
- Returns:
- the bounding rectangle of this text
-
getBoundsWithRotation
- Returns:
- the bounding rectangle of this text with its rotation taken into account.
-
getOrigin
- Returns:
- the origin of this text object, i.e. the bottom left corner of the rectangle enclosing the text, the text's location so to say
-
setOrigin
Sets the origin of this text object, i.e. the bottom left corner of the rectangle enclosing the text, the text's location so to say- Parameters:
origin- to set- Returns:
- this for chaining
-
setOrigin
Sets the origin of this text object, i.e. the bottom left corner of the rectangle enclosing the text, the text's location so to say- Parameters:
x- coordinate of originy- coordinate of origin- Returns:
- this for chaining
-
getAngle
public float getAngle()- Returns:
- the rotation angle in radian by which this text object is rotated around its origin.
-
setAngle
Sets the rotation angle in radian by which this text object is rotated around its origin.- Parameters:
angle- rotation angle- Returns:
- this for chaining
-
isHidden
public boolean isHidden()Description copied from interface:ContourPlot.RenderableIndicates whether this Renderable is hidden i.e. will not be drawn.- Specified by:
isHiddenin interfaceContourPlot.Renderable- Returns:
- true when hidden
-
hide
Hides or unhides this Text object, i.e. sets theisHidden()field value. When hidden, renderers will not draw it.- Parameters:
hide- true when hiding- Returns:
- this for chaining
-