ru.biosoft.graphics
Class Ruler

java.lang.Object
  extended byru.biosoft.graphics.View
      extended byru.biosoft.graphics.CompositeView
          extended byru.biosoft.graphics.Ruler

public class Ruler
extends CompositeView

Ruler.

Version:
1.5.1, 21 October 1997
Author:
Fedor A. Kolpakov

Field Summary
protected  java.awt.Point anchor
          Point, that corresponds min value on the ruler axis.
static int GENE
          Ruler type: GENE/ USUAL.
static int HORIZONTAL
          Ruler type: HORIZONTAL/VERTICAL
protected  boolean isReversed
          True, if scale direction is reversed, that is min > max value.
static int LABELS_MAJOR_SHOW
          Ruler type: LABELS_MAJOR_SHOW/ABSENT.
static int LABELS_MAJOR_UP
          Ruler type: LABELS_MAJOR_UP/LABELS_MAJOR_DOWN.
static int LABELS_MINOR_SHOW
          Ruler type: LABELS_MINOR_SHOW/ABSENT.
static int LABELS_MINOR_UP
          Ruler type: LABELS_MINOR_UP/LABELS_MINOR_DOWN.
protected  float max
          Maximum ruler value.
protected  float min
          Minimum ruler value.
protected  RulerOptions options
          Options for painting.
protected  float scale
          The scale: number of pixels according to interaval by length 1.0
protected  float step
          Ruler step (for major ticks).
static int TICKS_MAJOR_DOWN
          Ruler type: TICKS_MAJOR_DOWN/ABSENT.
static int TICKS_MAJOR_UP
          Ruler type: TICKS_MAJOR_UP/ABSENT.
static int TICKS_MINOR_DOWN
          Ruler type: TICKS_MINOR_DOWN/ABSENT.
static int TICKS_MINOR_UP
          Ruler type: TICKS_MINOR_UP/ABSENT.
protected  int tPerT
          Number of minor ticks for one interval before major ticks.
protected  int type
          Ruler type.
 
Fields inherited from class ru.biosoft.graphics.CompositeView
children, DELTA, rect, REL, X_CC, X_LC, X_LL, X_LR, X_RC, X_RL, X_RR, X_UN, Y_BB, Y_BC, Y_BT, Y_CC, Y_TB, Y_TC, Y_TT, Y_UN
 
Fields inherited from class ru.biosoft.graphics.View
ACTIVE, at, BASELINE, BOTTOM, CENTER, HIDE, LEFT, model, RIGHT, shape, TOP
 
Constructor Summary
Ruler(int type, java.awt.Point anchor, float scale, int min, int max, RulerOptions rulerOptions, java.awt.Graphics graphics)
          (pens, brushes, Fonts, margins etc.) needed to ruler painting.
 
Method Summary
protected  void initSize(java.awt.Graphics graphics)
          Init the ruler.
protected  void initSizeUsingTicksAndLabels(float step, float stepMajor, java.awt.Point pFrom, Pen pTicks, ColorFont fLabel, java.awt.Graphics graphics, int tickUB, int tickDB, int decDig, java.awt.Dimension textOffset, boolean ticksShow, boolean labelsShow, boolean labelsUp)
           
 void move(java.awt.Point p)
          Moves the ruler (left/bottom axis end) to the specified point.
 void offset(java.awt.Dimension d)
          Shifts the ruler image by the specified distance.
 void paint(java.awt.Graphics2D graphics)
          Paint the ruler.
protected  void paintTicksAndLabels(float step, float stepMajor, java.awt.Point pFrom, Pen pTicks, ColorFont fLabel, java.awt.Graphics graphics, int tickUB, int tickDB, int decDig, java.awt.Dimension textOffset, boolean ticksShow, boolean labelsShow, boolean labelsUp)
           
 
Methods inherited from class ru.biosoft.graphics.CompositeView
add, add, add, elementAt, getBounds, getChildren, getDeepestActive, getDeepestActive, getLocation, insert, intersects, move, recursiveRemove, remove, scale, size, updateBounds
 
Methods inherited from class ru.biosoft.graphics.View
getModel, getShape, isActive, isVisible, setActive, setLocation, setLocation, setModel, setToScale, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HORIZONTAL

public static int HORIZONTAL
Ruler type: HORIZONTAL/VERTICAL


GENE

public static int GENE
Ruler type: GENE/ USUAL. If GENE, the position zero absent.


TICKS_MAJOR_UP

public static int TICKS_MAJOR_UP
Ruler type: TICKS_MAJOR_UP/ABSENT. For vertical ruler this is mean: TICKS_MAJOR_LEFT/ABSENT.


TICKS_MAJOR_DOWN

public static int TICKS_MAJOR_DOWN
Ruler type: TICKS_MAJOR_DOWN/ABSENT. For vertical ruler this is mean: TICKS_MAJOR_RIGHT/ABSENT.


TICKS_MINOR_UP

public static int TICKS_MINOR_UP
Ruler type: TICKS_MINOR_UP/ABSENT. For vertical ruler this is mean: TICKS_MINOR_LEFT/ABSENT.


TICKS_MINOR_DOWN

public static int TICKS_MINOR_DOWN
Ruler type: TICKS_MINOR_DOWN/ABSENT. For vertical ruler this is mean: TICKS_MINOR_RIGHT/ABSENT.


LABELS_MAJOR_SHOW

public static int LABELS_MAJOR_SHOW
Ruler type: LABELS_MAJOR_SHOW/ABSENT.


LABELS_MAJOR_UP

public static int LABELS_MAJOR_UP
Ruler type: LABELS_MAJOR_UP/LABELS_MAJOR_DOWN. For vertical ruler this is mean: LABELS_MAJOR_LEFT/LABELS_MAJOR_RIGHT


LABELS_MINOR_SHOW

public static int LABELS_MINOR_SHOW
Ruler type: LABELS_MINOR_SHOW/ABSENT.


LABELS_MINOR_UP

public static int LABELS_MINOR_UP
Ruler type: LABELS_MINOR_UP/LABELS_MINOR_DOWN. For vertical ruler this is mean: LABELS_MINOR_LEFT/LABELS_MINOR_RIGHT


type

protected int type
Ruler type.


min

protected float min
Minimum ruler value.


max

protected float max
Maximum ruler value.


step

protected float step
Ruler step (for major ticks).


tPerT

protected int tPerT
Number of minor ticks for one interval before major ticks.


scale

protected float scale
The scale: number of pixels according to interaval by length 1.0


isReversed

protected boolean isReversed
True, if scale direction is reversed, that is min > max value.


anchor

protected java.awt.Point anchor
Point, that corresponds min value on the ruler axis.


options

protected RulerOptions options
Options for painting.

Constructor Detail

Ruler

public Ruler(int type,
             java.awt.Point anchor,
             float scale,
             int min,
             int max,
             RulerOptions rulerOptions,
             java.awt.Graphics graphics)
(pens, brushes, Fonts, margins etc.) needed to ruler painting.

Used GraphicContext attributes:


 Pen              Pen_Ruler_Axis
 Pen              Pen_Ruler_Ticks

 ColorFont            Font_Ruler_Labels_Major
 ColorFont            Font_Ruler_Labels_Minor

 Dimension        Margin_Ruler_Text

 Dimension        Size_Ruler_TickSize*
 Dimension        Size_Ruler_DecDig*

 * number of signs after comma
      width  - for major labels
      height - for minor labels

 

Method Detail

initSize

protected void initSize(java.awt.Graphics graphics)
Init the ruler.


initSizeUsingTicksAndLabels

protected void initSizeUsingTicksAndLabels(float step,
                                           float stepMajor,
                                           java.awt.Point pFrom,
                                           Pen pTicks,
                                           ColorFont fLabel,
                                           java.awt.Graphics graphics,
                                           int tickUB,
                                           int tickDB,
                                           int decDig,
                                           java.awt.Dimension textOffset,
                                           boolean ticksShow,
                                           boolean labelsShow,
                                           boolean labelsUp)

move

public void move(java.awt.Point p)
Moves the ruler (left/bottom axis end) to the specified point.

Overrides:
move in class View
Parameters:
p - the specified point.

offset

public void offset(java.awt.Dimension d)
Shifts the ruler image by the specified distance.

Parameters:
d - the distance.

paintTicksAndLabels

protected void paintTicksAndLabels(float step,
                                   float stepMajor,
                                   java.awt.Point pFrom,
                                   Pen pTicks,
                                   ColorFont fLabel,
                                   java.awt.Graphics graphics,
                                   int tickUB,
                                   int tickDB,
                                   int decDig,
                                   java.awt.Dimension textOffset,
                                   boolean ticksShow,
                                   boolean labelsShow,
                                   boolean labelsUp)

paint

public void paint(java.awt.Graphics2D graphics)
Paint the ruler.

Overrides:
paint in class CompositeView


Copyright © 2001-2003 Biosof.Ru. All Rights Reserved.