Synergy Home Page

au.edu.swin.synergy.math
Class BScalarRect

java.lang.Object
  |
  +--au.edu.swin.synergy.math.BScalarRect

public class BScalarRect
extends Object
implements Serializable, BSaveable

A rectangle, that uses scalars as it's internal value...

Author:
Imron Alston
Copyright Belongs To:
team synergy 1999
See Also:
Serialized Form

Field Summary
protected static String kDefaultHeight
           
protected static String kDefaultWidth
           
protected static String kDefaultX
           
protected static String kDefaultY
           
protected static String kKeyHeight
           
protected static String kKeyWidth
           
protected static String kKeyX
           
protected static String kKeyY
           
static int kNegNeg
           
static int kNegPos
           
static int kOutBottom
           
static int kOutLeft
           
static int kOutNone
           
static int kOutRight
           
static int kOutTop
           
static int kPosNeg
           
static int kPosPos
           
 
Constructor Summary
BScalarRect()
           
BScalarRect(BScalarRect sRect)
           
BScalarRect(int x, int y, int width, int height)
           
BScalarRect(Rectangle rect)
           
 
Method Summary
 void addXYToWH()
           
 boolean contains(BScalarPoint pt)
           
 boolean contains(BScalarRect rect)
           
 boolean contains(Point pt)
           
 void decBoundsByXY(BScalarRect rect)
           
 void decWH(BScalarPoint pt)
           
 void decWH(int x, int y)
           
 void decWIncH(BScalarPoint pt)
           
 void decXY(BScalarPoint pt)
           
 void decXY(BScalarRect rect)
           
 void decXY(int x, int y)
           
 void getBounds(Rectangle rect)
           
 int getHeight()
           
 int getQuadrant()
          Returns the quadrant of the rectangle...i.e the positive-negative relation between the the pos, and the size of the rect....
 int getWidth()
           
 int getX()
           
 int getY()
           
 void incBounds(BScalarPoint pt)
           
 void incWDecH(BScalarPoint pt)
           
 void incWH(BScalarPoint pt)
           
 void incWH(int w, int h)
           
 void incXY(BScalar x, BScalar y)
           
 void incXY(BScalarPoint pt)
           
 void incXY(BScalarRect rect)
           
 void incXY(int x, int y)
           
 boolean intersects(BScalarRect rect)
           
 boolean load(BDataFile file)
          loads the BScalarRect from a BDataFile
 int outcode(BScalarPoint pt)
           
 int outcode(int posX, int posY)
           
 int outcode(Point pt)
           
protected  int outcodeScalar(int posX, int posY)
           
 boolean save(BDataFile file)
          saves the rect to a datafile
 void scale(BScalar scale)
           
 void setBounds(BScalarRect rect)
           
 void setBounds(int x, int y, int width, int height)
           
 void setBounds(Rectangle rect)
           
 void setBoundsFrom2Points(BScalarPoint p1, BScalarPoint p2)
           
 void setBoundsFrom4Points(BScalarPoint p1, BScalarPoint p2, BScalarPoint p3, BScalarPoint p4)
           
 void setBoundsFromLine(BScalarRect rect)
           
 void setBoundsFromPoly(Vector pt)
           
 void setMinimumWH(int w, int h)
           
 void setSize(int width, int height)
           
 void setWH(BScalarPoint pt)
           
 void setWH(int w, int h)
           
 void setXY(BScalarPoint pt)
           
 void setXY(BScalarRect rect)
           
 String toString()
           
 void union(BScalarRect rect)
          sets the value of this bscalarrect to the smallest sized rectangle that contains the union of both rects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

kPosPos

public static final int kPosPos

kPosNeg

public static final int kPosNeg

kNegPos

public static final int kNegPos

kNegNeg

public static final int kNegNeg

kOutNone

public static final int kOutNone

kOutTop

public static final int kOutTop

kOutBottom

public static final int kOutBottom

kOutLeft

public static final int kOutLeft

kOutRight

public static final int kOutRight

kKeyX

protected static final String kKeyX

kDefaultX

protected static final String kDefaultX

kKeyY

protected static final String kKeyY

kDefaultY

protected static final String kDefaultY

kKeyWidth

protected static final String kKeyWidth

kDefaultWidth

protected static final String kDefaultWidth

kKeyHeight

protected static final String kKeyHeight

kDefaultHeight

protected static final String kDefaultHeight
Constructor Detail

BScalarRect

public BScalarRect(int x,
                   int y,
                   int width,
                   int height)

BScalarRect

public BScalarRect(Rectangle rect)

BScalarRect

public BScalarRect(BScalarRect sRect)

BScalarRect

public BScalarRect()
Method Detail

setBounds

public final void setBounds(Rectangle rect)

setBounds

public final void setBounds(int x,
                            int y,
                            int width,
                            int height)

setBounds

public final void setBounds(BScalarRect rect)

setBoundsFromPoly

public final void setBoundsFromPoly(Vector pt)

setBoundsFrom4Points

public final void setBoundsFrom4Points(BScalarPoint p1,
                                       BScalarPoint p2,
                                       BScalarPoint p3,
                                       BScalarPoint p4)

setBoundsFrom2Points

public final void setBoundsFrom2Points(BScalarPoint p1,
                                       BScalarPoint p2)

setBoundsFromLine

public final void setBoundsFromLine(BScalarRect rect)

setMinimumWH

public final void setMinimumWH(int w,
                               int h)

setSize

public final void setSize(int width,
                          int height)

intersects

public final boolean intersects(BScalarRect rect)

contains

public final boolean contains(Point pt)

contains

public final boolean contains(BScalarPoint pt)

contains

public final boolean contains(BScalarRect rect)

setXY

public final void setXY(BScalarPoint pt)

setXY

public final void setXY(BScalarRect rect)

incXY

public final void incXY(int x,
                        int y)

decXY

public final void decXY(int x,
                        int y)

decWH

public final void decWH(int x,
                        int y)

decWH

public final void decWH(BScalarPoint pt)

decXY

public final void decXY(BScalarPoint pt)

decXY

public final void decXY(BScalarRect rect)

incXY

public final void incXY(BScalar x,
                        BScalar y)

incXY

public final void incXY(BScalarPoint pt)

incXY

public final void incXY(BScalarRect rect)

incWH

public final void incWH(int w,
                        int h)

incWH

public final void incWH(BScalarPoint pt)

incWDecH

public final void incWDecH(BScalarPoint pt)

decWIncH

public final void decWIncH(BScalarPoint pt)

incBounds

public final void incBounds(BScalarPoint pt)

decBoundsByXY

public final void decBoundsByXY(BScalarRect rect)

setWH

public final void setWH(int w,
                        int h)

setWH

public final void setWH(BScalarPoint pt)

scale

public final void scale(BScalar scale)

getBounds

public final void getBounds(Rectangle rect)

union

public final void union(BScalarRect rect)
sets the value of this bscalarrect to the smallest sized rectangle that contains the union of both rects.

getX

public final int getX()

getY

public final int getY()

addXYToWH

public final void addXYToWH()

getHeight

public final int getHeight()

getWidth

public final int getWidth()

toString

public final String toString()
Overrides:
toString in class Object

getQuadrant

public final int getQuadrant()
Returns the quadrant of the rectangle...i.e the positive-negative relation between the the pos, and the size of the rect....

outcode

public final int outcode(int posX,
                         int posY)

outcode

public final int outcode(Point pt)

outcode

public final int outcode(BScalarPoint pt)

outcodeScalar

protected final int outcodeScalar(int posX,
                                  int posY)

load

public boolean load(BDataFile file)
loads the BScalarRect from a BDataFile
Specified by:
load in interface BSaveable
Parameters:
file - the BDataFile that contains the rect

save

public boolean save(BDataFile file)
saves the rect to a datafile
Specified by:
save in interface BSaveable
Parameters:
file - the datafile to save the rect in

Synergy Home Page