Package com.pixelmed.display
Class TextAnnotationPositioned
- java.lang.Object
-
- com.pixelmed.display.TextAnnotationPositioned
-
public class TextAnnotationPositioned extends java.lang.Object
A class to encapsulate a text annotation positioned left or right and top or bottom with row offset relative to an abstract rectanglular frame.
-
-
Constructor Summary
Constructors Constructor Description TextAnnotationPositioned(java.lang.String string, boolean fromLeft, boolean fromTop, int textRow)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
drawHorizontallyCenteredString(java.lang.String string, boolean fromTop, java.awt.Graphics2D g2d, java.awt.Component window, int topAndBottomMargin)
static void
drawPositionedString(TextAnnotationPositioned annotation, java.awt.Graphics2D g2d, int displayedAreaWidth, int displayedAreaHeight, int topAndBottomMargin, int leftAndRightMargin)
static void
drawPositionedString(TextAnnotationPositioned annotation, java.awt.Graphics2D g2d, java.awt.Component window, int topAndBottomMargin, int leftAndRightMargin)
static void
drawPositionedString(TextAnnotationPositioned annotation, java.awt.Graphics2D g2d, java.awt.FontMetrics fontMetrics, int stringHeight, int displayedAreaWidth, int displayedAreaHeight, int topAndBottomMargin, int leftAndRightMargin)
static void
drawPositionedString(java.lang.String string, boolean fromLeft, boolean fromTop, int textRow, java.awt.Graphics2D g2d, java.awt.Component window, int topAndBottomMargin, int leftAndRightMargin)
static void
drawPositionedString(java.lang.String string, boolean fromLeft, boolean fromTop, int textRow, java.awt.Graphics2D g2d, java.awt.FontMetrics fontMetrics, int stringHeight, int displayedAreaWidth, int displayedAreaHeight, int topAndBottomMargin, int leftAndRightMargin)
static void
drawVerticallyCenteredString(java.lang.String string, boolean fromLeft, java.awt.Graphics2D g2d, java.awt.Component window, int leftAndRightMargin)
static void
drawVerticallyCenteredString(java.lang.String string, boolean fromLeft, java.awt.Graphics2D g2d, java.awt.Component window, int verticalOffset, int leftAndRightMargin)
java.lang.String
getString()
Get the text of the annotation.int
getTextRow()
Get the text row.boolean
isLeft()
Get the position relative to the left or right of the frame.boolean
isTop()
Get the position relative to the top or bottom of the frame.
-
-
-
Constructor Detail
-
TextAnnotationPositioned
public TextAnnotationPositioned(java.lang.String string, boolean fromLeft, boolean fromTop, int textRow)
- Parameters:
string
- the annotationfromLeft
- true if positioned at the left of the frame, false if rightfromTop
- true if positioned at the top of the frame, false if bottomtextRow
- the number of text rows from the top or bottom (numbered from 0)
-
-
Method Detail
-
getString
public java.lang.String getString()
Get the text of the annotation.
- Returns:
- the annotation
-
isLeft
public boolean isLeft()
Get the position relative to the left or right of the frame.
- Returns:
- true if positioned at the left of the frame, false if right
-
isTop
public boolean isTop()
Get the position relative to the top or bottom of the frame.
- Returns:
- true if positioned at the top of the frame, false if bottom
-
getTextRow
public int getTextRow()
Get the text row.
- Returns:
- the number of text rows from the top or bottom (numbered from 0)
-
drawPositionedString
public static void drawPositionedString(TextAnnotationPositioned annotation, java.awt.Graphics2D g2d, java.awt.Component window, int topAndBottomMargin, int leftAndRightMargin)
- Parameters:
annotation
- the text and position to be drawng2d
- the drawing contextwindow
- the actual component being drawn intotopAndBottomMargin
- the margin to allow at the top and bottom of the frame, in pixelsleftAndRightMargin
- the margin to allow at the left and right of the frame, in pixels
-
drawPositionedString
public static void drawPositionedString(TextAnnotationPositioned annotation, java.awt.Graphics2D g2d, int displayedAreaWidth, int displayedAreaHeight, int topAndBottomMargin, int leftAndRightMargin)
- Parameters:
annotation
- the text and position to be drawng2d
- the drawing contextdisplayedAreaWidth
- the width of the frame being drawn into, in pixelsdisplayedAreaHeight
- the height of the frame being drawn into, in pixelstopAndBottomMargin
- the margin to allow at the top and bottom of the frame, in pixelsleftAndRightMargin
- the margin to allow at the left and right of the frame, in pixels
-
drawPositionedString
public static void drawPositionedString(TextAnnotationPositioned annotation, java.awt.Graphics2D g2d, java.awt.FontMetrics fontMetrics, int stringHeight, int displayedAreaWidth, int displayedAreaHeight, int topAndBottomMargin, int leftAndRightMargin)
- Parameters:
annotation
- the text and position to be drawng2d
- the drawing contextfontMetrics
- the font metrics (already extracted from g2d, with which it must be consistent)stringHeight
- the height used for all rows of text (already extracted from fontMetrics, with which it must be consistent)displayedAreaWidth
- the width of the frame being drawn into, in pixelsdisplayedAreaHeight
- the height of the frame being drawn into, in pixelstopAndBottomMargin
- the margin to allow at the top and bottom of the frame, in pixelsleftAndRightMargin
- the margin to allow at the left and right of the frame, in pixels
-
drawPositionedString
public static void drawPositionedString(java.lang.String string, boolean fromLeft, boolean fromTop, int textRow, java.awt.Graphics2D g2d, java.awt.Component window, int topAndBottomMargin, int leftAndRightMargin)
- Parameters:
string
- the text to be drawnfromLeft
- true if positioned at the left of the frame, false if rightfromTop
- true if positioned at the top of the frame, false if bottomtextRow
- the number of text rows from the top or bottom (numbered from 0)g2d
- the drawing contextwindow
- the actual component being drawn intotopAndBottomMargin
- the margin to allow at the top and bottom of the frame, in pixelsleftAndRightMargin
- the margin to allow at the left and right of the frame, in pixels
-
drawPositionedString
public static void drawPositionedString(java.lang.String string, boolean fromLeft, boolean fromTop, int textRow, java.awt.Graphics2D g2d, java.awt.FontMetrics fontMetrics, int stringHeight, int displayedAreaWidth, int displayedAreaHeight, int topAndBottomMargin, int leftAndRightMargin)
- Parameters:
string
- the text to be drawnfromLeft
- true if positioned at the left of the frame, false if rightfromTop
- true if positioned at the top of the frame, false if bottomtextRow
- the number of text rows from the top or bottom (numbered from 0)g2d
- the drawing contextfontMetrics
- the font metrics (already extracted from g2d, with which it must be consistent)stringHeight
- the height used for all rows of text (already extracted from fontMetrics, with which it must be consistent)displayedAreaWidth
- the width of the frame being drawn into, in pixelsdisplayedAreaHeight
- the height of the frame being drawn into, in pixelstopAndBottomMargin
- the margin to allow at the top and bottom of the frame, in pixelsleftAndRightMargin
- the margin to allow at the left and right of the frame, in pixels
-
drawVerticallyCenteredString
public static void drawVerticallyCenteredString(java.lang.String string, boolean fromLeft, java.awt.Graphics2D g2d, java.awt.Component window, int leftAndRightMargin)
- Parameters:
string
- the text to be drawnfromLeft
- true if positioned at the left of the frame, false if rightg2d
- the drawing contextwindow
- the actual component being drawn intoleftAndRightMargin
- the margin to allow at the left and right of the frame, in pixels
-
drawVerticallyCenteredString
public static void drawVerticallyCenteredString(java.lang.String string, boolean fromLeft, java.awt.Graphics2D g2d, java.awt.Component window, int verticalOffset, int leftAndRightMargin)
- Parameters:
string
- the text to be drawnfromLeft
- true if positioned at the left of the frame, false if rightg2d
- the drawing contextwindow
- the actual component being drawn intoverticalOffset
- a downwards offset from the vertical center, in text rows (not pixels)leftAndRightMargin
- the margin to allow at the left and right of the frame, in pixels
-
drawHorizontallyCenteredString
public static void drawHorizontallyCenteredString(java.lang.String string, boolean fromTop, java.awt.Graphics2D g2d, java.awt.Component window, int topAndBottomMargin)
- Parameters:
string
- the text to be drawnfromTop
- true if positioned at the top of the frame, false if bottomg2d
- the drawing contextwindow
- the actual component being drawn intotopAndBottomMargin
- the margin to allow at the top and bottom of the frame, in pixels
-
-