sgtplot
Class Ruler
- java.lang.Object
-
- sgtplot.Ruler
-
- All Implemented Interfaces:
- java.lang.Cloneable, LayerChild, Selectable
public class Ruler extends java.lang.Object implements java.lang.Cloneable, LayerChild
Description of Class Ruler- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field and Description static intBOTH_SIDESDraw the tics on both sides of the axes.static intHORIZONTALOrient Key horizontally.static intNEGATIVE_SIDEPlace the label and/or tic on the negative side of the axis.static intNO_LABELDo not draw a label and/or tic.static intPOSITIVE_SIDEPlace the label and/or tic on the positive side of the axis.static intVERTICALOrient Key vertically.
-
Constructor Summary
Constructors Constructor and Description Ruler()Default constructor for Ruler.Ruler(java.lang.String ident)Constructor for Ruler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description LayerChildcopy()Create a copy of theLayerChild.voiddraw(org.freehep.graphics2d.VectorGraphics g)Draw theLayerChild.java.awt.RectanglegetBounds()Get the bounding box for the axis in device units.Rectangle2D.DoublegetBoundsP()Get the bounding box for the axis in physical units.java.lang.StringgetId()Set the axis identifier.java.awt.ColorgetLabelColor()java.awt.FontgetLabelFont()Get the label font.java.lang.StringgetLabelFormat()doublegetLabelHeightP()Get the label height.intgetLabelInterval()intgetLabelPosition()Get the label position.doublegetLargeTicHeightP()Get the large tic height.LayergetLayer()Get the associatedLayer.java.awt.ColorgetLineColor()intgetNumberSmallTics()Get the number of small tics between large tics.intgetOrientation()Get axis orientationAbstractPanegetPane()GetAbstractPaneof theLayerChild.Range2DgetRangeU()intgetSignificantDigits()doublegetSmallTicHeightP()Get the small tic height.intgetTicPosition()Get the tic position.SGLabelgetTitle()Get the axis title.booleanisSelectable()Returns true if the current state is selectable.booleanisSelected()Returns true if the object's selected property is set.booleanisVisible()Check ifLayerChildis visible.voidmodified(java.lang.String mess)Used by sgtplot internally.voidsetBounds(int x, int y, int width, int height)voidsetBounds(java.awt.Rectangle r)voidsetBoundsP(Rectangle2D.Double bounds)Set the bounding box for the axis in physical units.voidsetId(java.lang.String id)Set the axis identifier.voidsetLabelColor(java.awt.Color labelColor)voidsetLabelFont(java.awt.Font fnt)Set the label font.voidsetLabelFormat(java.lang.String labelFormat)voidsetLabelHeightP(double lhgt)Set the label height in physical units.voidsetLabelInterval(int labelInterval)voidsetLabelPosition(int labp)Set the label position.voidsetLargeTicHeightP(double lthgt)Set the large tic height in physical units.voidsetLayer(Layer l)Associate aLayerwith theLayerChild.voidsetLineColor(java.awt.Color lineColor)voidsetNumberSmallTics(int nstic)Set the number of small tics between large tics.voidsetOrientation(int orient)Set ruler orientation.voidsetRangeU(Range2D range)Change the user unit range ofRulervoidsetSelectable(boolean select)Set the Selectable property.voidsetSelected(boolean sel)Sets the selected property.voidsetSignificantDigits(int sigDigits)voidsetSmallTicHeightP(double sthgt)Set the small tic height in physical units.voidsetTicPosition(int tpos)Set the tic position.voidsetTitle(SGLabel title)Set the axis title.voidsetVisible(boolean visible)Set visibility for aLayerChild.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface sgtplot.LayerChild
toString
-
-
-
-
Field Detail
-
HORIZONTAL
public static final int HORIZONTAL
Orient Key horizontally.- See Also:
- Constant Field Values
-
VERTICAL
public static final int VERTICAL
Orient Key vertically.- See Also:
- Constant Field Values
-
POSITIVE_SIDE
public static final int POSITIVE_SIDE
Place the label and/or tic on the positive side of the axis. The right side of VERTICAL axes and the top of HORIZONTAL axes.- See Also:
- Constant Field Values
-
NEGATIVE_SIDE
public static final int NEGATIVE_SIDE
Place the label and/or tic on the negative side of the axis. The left side of VERTICAL axes and the bottom of HORIZONTAL axes.- See Also:
- Constant Field Values
-
NO_LABEL
public static final int NO_LABEL
Do not draw a label and/or tic.- See Also:
- Constant Field Values
-
BOTH_SIDES
public static final int BOTH_SIDES
Draw the tics on both sides of the axes.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Ruler
public Ruler()
Default constructor for Ruler.
-
Ruler
public Ruler(java.lang.String ident)
Constructor for Ruler. Sets the ruler identifier and initializes the defaults. Default values are:numberSmallTics = 0 largeTicHeightP = 0.1 smallTicHeightP = 0.05 ticPosition = NEGATIVE_SIDE labelPosition = NEGATIVE_SIDE labelInterval = 2 labelFont = Font("Helvetica", Font.ITALIC, 10); labelHeightP = 0.15 significantDigits = 2; labelFormat = "" title = null orientation = HORIZONTAL Id = ""- Parameters:
id- axis identification
-
-
Method Detail
-
copy
public LayerChild copy()
Description copied from interface:LayerChildCreate a copy of theLayerChild.- Specified by:
copyin interfaceLayerChild- Returns:
- A copy of the
LayerChild.
-
setSelected
public void setSelected(boolean sel)
Description copied from interface:SelectableSets the selected property.- Specified by:
setSelectedin interfaceSelectable- Parameters:
sel- true if selected, false if not.
-
isSelected
public boolean isSelected()
Description copied from interface:SelectableReturns true if the object's selected property is set.- Specified by:
isSelectedin interfaceSelectable- Returns:
- true if selected, false if not.
-
setSelectable
public void setSelectable(boolean select)
Description copied from interface:SelectableSet the Selectable property.- Specified by:
setSelectablein interfaceSelectable- Parameters:
select- if true object is selectable
-
isSelectable
public boolean isSelectable()
Description copied from interface:SelectableReturns true if the current state is selectable.- Specified by:
isSelectablein interfaceSelectable- Returns:
- true if selectable
-
setLargeTicHeightP
public void setLargeTicHeightP(double lthgt)
Set the large tic height in physical units.- Parameters:
lthgt- large tic height.
-
getLargeTicHeightP
public double getLargeTicHeightP()
Get the large tic height.- Returns:
- large tic height in physcial units.
-
setNumberSmallTics
public void setNumberSmallTics(int nstic)
Set the number of small tics between large tics.- Parameters:
nstic- number of small tics.
-
getNumberSmallTics
public int getNumberSmallTics()
Get the number of small tics between large tics.- Returns:
- number of small tics.
-
setSmallTicHeightP
public void setSmallTicHeightP(double sthgt)
Set the small tic height in physical units.- Parameters:
sthgt- small tic height.
-
getSmallTicHeightP
public double getSmallTicHeightP()
Get the small tic height.- Returns:
- small tic height in physical units.
-
setTicPosition
public void setTicPosition(int tpos)
Set the tic position. Tic position can be POSITIVE_SIDE, NEGATIVE_SIDE, or BOTH_SIDES.- Parameters:
tpos- tic position
-
getTicPosition
public int getTicPosition()
Get the tic position.- Returns:
- tic position
-
setLabelPosition
public void setLabelPosition(int labp)
Set the label position. Label position can be POSITIVE_SIDE, NEGATIVE_SIDE, and NO_LABEL.- Parameters:
lapb- label position.
-
getLabelPosition
public int getLabelPosition()
Get the label position.- Returns:
- label position
-
setLabelFont
public void setLabelFont(java.awt.Font fnt)
Set the label font.- Parameters:
fnt- label font
-
getLabelFont
public java.awt.Font getLabelFont()
Get the label font.- Returns:
- label font
-
setLabelHeightP
public void setLabelHeightP(double lhgt)
Set the label height in physical units.- Parameters:
lhgt- label height.
-
getLabelHeightP
public double getLabelHeightP()
Get the label height.- Returns:
- label height
-
setId
public void setId(java.lang.String id)
Set the axis identifier.- Specified by:
setIdin interfaceLayerChild- Parameters:
id- identifier
-
getId
public java.lang.String getId()
Set the axis identifier.- Specified by:
getIdin interfaceLayerChild- Parameters:
id- identifier- Returns:
LayerChildidentification.
-
setLayer
public void setLayer(Layer l)
Description copied from interface:LayerChildAssociate aLayerwith theLayerChild.- Specified by:
setLayerin interfaceLayerChild- Parameters:
l- Parent layer.
-
getLayer
public Layer getLayer()
Description copied from interface:LayerChildGet the associatedLayer.- Specified by:
getLayerin interfaceLayerChild- Returns:
- Associated layer
-
getPane
public AbstractPane getPane()
Description copied from interface:LayerChildGetAbstractPaneof theLayerChild.- Specified by:
getPanein interfaceLayerChild
-
modified
public void modified(java.lang.String mess)
Description copied from interface:LayerChildUsed by sgtplot internally.- Specified by:
modifiedin interfaceLayerChild
-
setRangeU
public void setRangeU(Range2D range)
Change the user unit range ofRuler
-
getRangeU
public Range2D getRangeU()
-
setBoundsP
public void setBoundsP(Rectangle2D.Double bounds)
Set the bounding box for the axis in physical units.
-
getBoundsP
public Rectangle2D.Double getBoundsP()
Get the bounding box for the axis in physical units.- Returns:
- bounding box
-
setOrientation
public void setOrientation(int orient)
Set ruler orientation. Allowed orientations are HORIZONATAL and VERTICAL.- Parameters:
or- orientation
-
getOrientation
public int getOrientation()
Get axis orientation- Returns:
- axis orientation
-
setTitle
public void setTitle(SGLabel title)
Set the axis title.- Parameters:
title- axis title
-
getTitle
public SGLabel getTitle()
Get the axis title.- Returns:
- axis title
-
getBounds
public java.awt.Rectangle getBounds()
Get the bounding box for the axis in device units.- Specified by:
getBoundsin interfaceSelectable- Returns:
- bounding box
-
setBounds
public void setBounds(java.awt.Rectangle r)
-
setBounds
public void setBounds(int x, int y, int width, int height)
-
draw
public void draw(org.freehep.graphics2d.VectorGraphics g)
Description copied from interface:LayerChildDraw theLayerChild.- Specified by:
drawin interfaceLayerChild- Parameters:
g- Graphics context
-
isVisible
public boolean isVisible()
Description copied from interface:LayerChildCheck ifLayerChildis visible.- Specified by:
isVisiblein interfaceLayerChild- Returns:
- true if visible
-
setVisible
public void setVisible(boolean visible)
Description copied from interface:LayerChildSet visibility for aLayerChild.- Specified by:
setVisiblein interfaceLayerChild- Parameters:
visible- visible if true
-
getLabelInterval
public int getLabelInterval()
- Since:
- 3.0
-
setLabelInterval
public void setLabelInterval(int labelInterval)
- Since:
- 3.0
-
getSignificantDigits
public int getSignificantDigits()
- Since:
- 3.0
-
setSignificantDigits
public void setSignificantDigits(int sigDigits)
- Since:
- 3.0
-
getLabelFormat
public java.lang.String getLabelFormat()
- Since:
- 3.0
-
setLabelFormat
public void setLabelFormat(java.lang.String labelFormat)
- Since:
- 3.0
-
getLabelColor
public java.awt.Color getLabelColor()
- Since:
- 3.0
-
setLabelColor
public void setLabelColor(java.awt.Color labelColor)
- Since:
- 3.0
-
getLineColor
public java.awt.Color getLineColor()
- Since:
- 3.0
-
setLineColor
public void setLineColor(java.awt.Color lineColor)
- Since:
- 3.0
-
-
DMelt 3.0 © DataMelt by jWork.ORG