org.omegahat.Graphics.Primitives
Class RectRegionDescription

java.lang.Object
  |
  +--org.omegahat.Graphics.Primitives.RectRegionDescription
All Implemented Interfaces:
RegionDescriptionInt
Direct Known Subclasses:
AllocatorRectRegionDescription

public class RectRegionDescription
extends java.lang.Object
implements RegionDescriptionInt

Class the provides a symbolic description of a rectangular region area for different coordinate systems, etc.


Field Summary
protected  UDouble height
           
protected  int hJust
          The horizontal justification, default LEFT.
protected  int vJust
          The vertical justification, default BOTTOM.
protected  UDouble width
           
protected  UDouble x
           
protected  UDouble y
           
 
Constructor Summary
RectRegionDescription()
          Create the default region description that occupies all of its parent's space.
RectRegionDescription(double x, double y, double width, double height)
          Specify the location and dimensions of the region being described, assuming Normalized Parent Coordinates (NPC).
RectRegionDescription(double x, double y, double width, double height, int unit)
          Specify the location and dimensions of the region being described, using the specified unit type for all values.
RectRegionDescription(UDouble x, UDouble y, UDouble width, UDouble height)
          Specify the location and dimension of the region description, allowing each to have its own unit.
 
Method Summary
 RectRegion compute(ScaleInt sx, ScaleInt sy, int parentOrigin, double widthCM, double heightCM, int fontSize, GraphicalContainerInt parentId)
          Compute the actual bounding box described by this region description in terms of the normalized dimensions of its parent container, that is NPC.
 UDouble getHeight()
          Accessor for height field
 int getHJust()
          Accessor for hJust field
 int getVJust()
          Accessor for vJust field
 UDouble getWidth()
          Accessor for width field
 UDouble getX()
          Accessor for x field
 UDouble getY()
          Accessor for y field
 double justifyX(double x, double width)
          return the x co-ordinate justifying a region of width across, using the internal horizontal justification of this object.
 double justifyY(double y, double height)
          return the y co-ordinate justifying a region of width across, using the internal vertical justification of this object.
 UDouble setHeight(UDouble value)
          Accessor for setting height field
 int setHJust(int value)
          Accessor for setting hJust field
 int setVJust(int value)
          Accessor for setting vJust field
 UDouble setWidth(UDouble value)
          Accessor for setting width field
 UDouble setX(UDouble value)
          Accessor for setting x field
 UDouble setY(UDouble value)
          Accessor for setting y field
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x

protected UDouble x

y

protected UDouble y

width

protected UDouble width

height

protected UDouble height

hJust

protected int hJust
The horizontal justification, default LEFT.

Should only be set to one of the symbolic constants in class Justification.


vJust

protected int vJust
The vertical justification, default BOTTOM.

Should only be set to one of the symbolic constants in class Justification.

Constructor Detail

RectRegionDescription

public RectRegionDescription()
Create the default region description that occupies all of its parent's space.

RectRegionDescription

public RectRegionDescription(double x,
                             double y,
                             double width,
                             double height)
Specify the location and dimensions of the region being described, assuming Normalized Parent Coordinates (NPC). So all the values should be between 0 and 1.

RectRegionDescription

public RectRegionDescription(double x,
                             double y,
                             double width,
                             double height,
                             int unit)
Specify the location and dimensions of the region being described, using the specified unit type for all values.

RectRegionDescription

public RectRegionDescription(UDouble x,
                             UDouble y,
                             UDouble width,
                             UDouble height)
Specify the location and dimension of the region description, allowing each to have its own unit.
Method Detail

compute

public RectRegion compute(ScaleInt sx,
                          ScaleInt sy,
                          int parentOrigin,
                          double widthCM,
                          double heightCM,
                          int fontSize,
                          GraphicalContainerInt parentId)
Description copied from interface: RegionDescriptionInt
Compute the actual bounding box described by this region description in terms of the normalized dimensions of its parent container, that is NPC.
Specified by:
compute in interface RegionDescriptionInt
Following copied from interface: org.omegahat.Graphics.Primitives.RegionDescriptionInt
Parameters:
sx - parent container's horizontal ScaleInt object for transforming coordinates in that space.
sy - parent container's vertical ScaleInt object for transforming coordinates in that space.

justifyX

public double justifyX(double x,
                       double width)
return the x co-ordinate justifying a region of width across, using the internal horizontal justification of this object.

justifyY

public double justifyY(double y,
                       double height)
return the y co-ordinate justifying a region of width across, using the internal vertical justification of this object.

getHJust

public int getHJust()
Accessor for hJust field
Specified by:
getHJust in interface RegionDescriptionInt

setHJust

public int setHJust(int value)
Accessor for setting hJust field
Specified by:
setHJust in interface RegionDescriptionInt

getVJust

public int getVJust()
Accessor for vJust field
Specified by:
getVJust in interface RegionDescriptionInt

setVJust

public int setVJust(int value)
Accessor for setting vJust field
Specified by:
setVJust in interface RegionDescriptionInt

getWidth

public UDouble getWidth()
Accessor for width field
Specified by:
getWidth in interface RegionDescriptionInt

setWidth

public UDouble setWidth(UDouble value)
Accessor for setting width field
Specified by:
setWidth in interface RegionDescriptionInt

getHeight

public UDouble getHeight()
Accessor for height field
Specified by:
getHeight in interface RegionDescriptionInt

setHeight

public UDouble setHeight(UDouble value)
Accessor for setting height field
Specified by:
setHeight in interface RegionDescriptionInt

getY

public UDouble getY()
Accessor for y field
Specified by:
getY in interface RegionDescriptionInt

setY

public UDouble setY(UDouble value)
Accessor for setting y field
Specified by:
setY in interface RegionDescriptionInt

getX

public UDouble getX()
Accessor for x field
Specified by:
getX in interface RegionDescriptionInt

setX

public UDouble setX(UDouble value)
Accessor for setting x field
Specified by:
setX in interface RegionDescriptionInt

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object