sgtplot
Class LabelDrawer2D
- java.lang.Object
-
- sgtplot.LabelDrawer2D
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, LabelDrawer
public class LabelDrawer2D extends java.lang.Object implements LabelDrawer, java.lang.Cloneable
Implements label drawing using Java2D functionality.- Since:
- 2.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description LabelDrawer2D(java.lang.String lbl, double hgt, Point2D.Double loc, int valign, int halign)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description LabelDrawercopy()voiddraw(org.freehep.graphics2d.VectorGraphics g)Used internally by sgtplot.doublegetAngle()Get label drawing angle.java.awt.RectanglegetBounds()Get the label bounds in device units.Rectangle2D.DoublegetBoundsP()Get the label reference location in physcial coordinates.java.awt.ColorgetColor()Get the color.java.awt.FontgetFont()Get the font.intgetHAlign()Get the horizontal alignment.doublegetHeightP()Get the label height in physical coordinates.LayergetLayer()Get the layer.java.awt.PointgetLocation()Get the label position in device coordinates.Point2D.DoublegetLocationP()Get the label reference location in physcial coordinates.intgetOrientation()Get the origentation.floatgetStringHeight(org.freehep.graphics2d.VectorGraphics g2)Get the string height in device units.floatgetStringWidth(org.freehep.graphics2d.VectorGraphics g)Get the string width in device units.java.lang.StringgetText()Get the label text.intgetVAlign()Get the vertical alignment.booleanisVisible()Is label visible?voidsetAngle(double angle)Draw label at arbitrary rotation.voidsetBounds(int x, int y, int width, int height)Set the label bounds in device units.voidsetColor(java.awt.Color clr)Set the color.voidsetFont(java.awt.Font font)Set the font.voidsetHAlign(int halign)Set the horizontal alignment.voidsetHeightP(double hgt)Set the height of the label in physical coordinates.voidsetLayer(Layer layer)Used internally by sgtplot.voidsetLocation(java.awt.Point loc)Set the label position in device coordinates.voidsetLocationP(Point2D.Double loc)Set the label reference location in physcial coordinates.voidsetOrientation(int orient)Set the orientation.voidsetText(java.lang.String lbl)Set the label text.voidsetVAlign(int valign)Set the vertical alignment.voidsetVisible(boolean vis)Set visibility of label.
-
-
-
Constructor Detail
-
LabelDrawer2D
public LabelDrawer2D(java.lang.String lbl, double hgt, Point2D.Double loc, int valign, int halign)
-
-
Method Detail
-
copy
public LabelDrawer copy()
-
draw
public void draw(org.freehep.graphics2d.VectorGraphics g) throws LayerNotFoundExceptionDescription copied from interface:LabelDrawerUsed internally by sgtplot.- Specified by:
drawin interfaceLabelDrawer- Throws:
LayerNotFoundException
-
setText
public void setText(java.lang.String lbl)
Description copied from interface:LabelDrawerSet the label text.- Specified by:
setTextin interfaceLabelDrawer- Parameters:
lbl- the label text
-
getText
public java.lang.String getText()
Description copied from interface:LabelDrawerGet the label text.- Specified by:
getTextin interfaceLabelDrawer- Returns:
- the label text
-
setColor
public void setColor(java.awt.Color clr)
Description copied from interface:LabelDrawerSet the color.- Specified by:
setColorin interfaceLabelDrawer- See Also:
Color
-
getColor
public java.awt.Color getColor()
Description copied from interface:LabelDrawerGet the color.- Specified by:
getColorin interfaceLabelDrawer- Returns:
- The current color of the label.
-
setFont
public void setFont(java.awt.Font font)
Description copied from interface:LabelDrawerSet the font.- Specified by:
setFontin interfaceLabelDrawer- See Also:
Font
-
getFont
public java.awt.Font getFont()
Description copied from interface:LabelDrawerGet the font.- Specified by:
getFontin interfaceLabelDrawer- Returns:
- The current font for the label.
-
setLayer
public void setLayer(Layer layer)
Description copied from interface:LabelDrawerUsed internally by sgtplot.- Specified by:
setLayerin interfaceLabelDrawer
-
getLayer
public Layer getLayer()
Description copied from interface:LabelDrawerGet the layer.- Specified by:
getLayerin interfaceLabelDrawer- Returns:
- the layer object.
-
setOrientation
public void setOrientation(int orient)
Description copied from interface:LabelDrawerSet the orientation. The orientation can be HORIZONTAL or VERTICAL.- Specified by:
setOrientationin interfaceLabelDrawer- Parameters:
orient- The orientation.
-
getOrientation
public int getOrientation()
Description copied from interface:LabelDrawerGet the origentation.- Specified by:
getOrientationin interfaceLabelDrawer- Returns:
- the orientation
-
setHAlign
public void setHAlign(int halign)
Description copied from interface:LabelDrawerSet the horizontal alignment. The alignment can be LEFT, CENTER, or RIGHT.- Specified by:
setHAlignin interfaceLabelDrawer
-
getHAlign
public int getHAlign()
Description copied from interface:LabelDrawerGet the horizontal alignment.- Specified by:
getHAlignin interfaceLabelDrawer- Returns:
- the horizontal alignment.
-
setVAlign
public void setVAlign(int valign)
Description copied from interface:LabelDrawerSet the vertical alignment. The alignment can be TOP, MIDDLE, or BOTTOM.- Specified by:
setVAlignin interfaceLabelDrawer
-
getVAlign
public int getVAlign()
Description copied from interface:LabelDrawerGet the vertical alignment.- Specified by:
getVAlignin interfaceLabelDrawer- Returns:
- the vertical alignment.
-
setLocation
public void setLocation(java.awt.Point loc)
Description copied from interface:LabelDrawerSet the label position in device coordinates.- Specified by:
setLocationin interfaceLabelDrawer- Parameters:
loc- label position
-
getLocation
public java.awt.Point getLocation()
Description copied from interface:LabelDrawerGet the label position in device coordinates.- Specified by:
getLocationin interfaceLabelDrawer- Returns:
- the label position
-
setBounds
public void setBounds(int x, int y, int width, int height)Description copied from interface:LabelDrawerSet the label bounds in device units.- Specified by:
setBoundsin interfaceLabelDrawer- Parameters:
x- x location of labely- y location of labelwidth- label widthheight- label height
-
getBounds
public java.awt.Rectangle getBounds()
Description copied from interface:LabelDrawerGet the label bounds in device units.- Specified by:
getBoundsin interfaceLabelDrawer- Returns:
- the label bounds
-
setLocationP
public void setLocationP(Point2D.Double loc)
Description copied from interface:LabelDrawerSet the label reference location in physcial coordinates.- Specified by:
setLocationPin interfaceLabelDrawer- Parameters:
loc- physical location of label
-
getLocationP
public Point2D.Double getLocationP()
Description copied from interface:LabelDrawerGet the label reference location in physcial coordinates.- Specified by:
getLocationPin interfaceLabelDrawer- Returns:
- the labels position.
-
getBoundsP
public Rectangle2D.Double getBoundsP()
Description copied from interface:LabelDrawerGet the label reference location in physcial coordinates.- Specified by:
getBoundsPin interfaceLabelDrawer- Returns:
- the labels position.
-
setAngle
public void setAngle(double angle)
Description copied from interface:LabelDrawerDraw label at arbitrary rotation. Warning: Rotated labels are not drawn very well when using JDK1.1. For best results use JDK1.2 or newer.- Specified by:
setAnglein interfaceLabelDrawer
-
getAngle
public double getAngle()
Description copied from interface:LabelDrawerGet label drawing angle.- Specified by:
getAnglein interfaceLabelDrawer
-
setHeightP
public void setHeightP(double hgt)
Description copied from interface:LabelDrawerSet the height of the label in physical coordinates.- Specified by:
setHeightPin interfaceLabelDrawer- Parameters:
hgt- The label height.
-
getHeightP
public double getHeightP()
Description copied from interface:LabelDrawerGet the label height in physical coordinates.- Specified by:
getHeightPin interfaceLabelDrawer- Returns:
- The label height.
-
setVisible
public void setVisible(boolean vis)
Description copied from interface:LabelDrawerSet visibility of label.- Specified by:
setVisiblein interfaceLabelDrawer
-
isVisible
public boolean isVisible()
Description copied from interface:LabelDrawerIs label visible?- Specified by:
isVisiblein interfaceLabelDrawer
-
getStringWidth
public float getStringWidth(org.freehep.graphics2d.VectorGraphics g)
Description copied from interface:LabelDrawerGet the string width in device units.- Specified by:
getStringWidthin interfaceLabelDrawer
-
getStringHeight
public float getStringHeight(org.freehep.graphics2d.VectorGraphics g2)
Description copied from interface:LabelDrawerGet the string height in device units.- Specified by:
getStringHeightin interfaceLabelDrawer
-
-
DMelt 3.0 © DataMelt by jWork.ORG