GRect Class Reference
[libgfc Index] [libgfc Hierarchy]
[Headers]
a rectangle ADT class More...
#include <src/gadt_rect.h>
Inherits: GSpatial
Public Members
- GRect ()
- GRect (Coord xLow, Coord yLow, Coord xUp, Coord yUp)
- GRect (const GRect& other)
- GRect& operator= (const GRect& other)
- virtual ~GRect ()
- virtual GType type (void) const
- virtual uint32 getPSize () const
- virtual Result input (const char* in)
- virtual Result output (char*& out)
- virtual Result pack (DataPipe& p)
- virtual Result unpack (DataPipe& p)
- virtual Result mbr (GRect& b) const
- virtual int cmp (const GADT& other) const
- virtual Result init (void)
- virtual GADT* clone () const
- virtual Result scale (double xf, double yf, double zf=1)
- virtual Result translate (double xf, double yf, double zf=1)
- virtual Result rotate (double, bool)
- virtual Result transform (const GMatrix&)
- inline Coord getXL () const
- inline Coord getYL () const
- inline Coord getXH () const
- inline Coord getYH () const
- inline void setXL (Coord x)
- inline void setYL (Coord y)
- inline void setXH (Coord x)
- inline void setYH (Coord y)
- inline void set (Coord xLow, Coord yLow, Coord xHi, Coord yHi)
- inline Coord getWidth (void) const
- inline Coord getHeight (void) const
- inline double area () const
- double distance (const GRect& other) const
- inline double perimeter () const
- inline bool isValid () const
- bool equals (const GRect& other) const
- void enlarge (const GRect& other)
- void centroid (Coord& x, Coord& y)
- virtual int covers (const GSpatial& a) const
- virtual int intersects (const GSpatial& a) const
a rectangle ADT class.
Setup the lower corner (the corner with lower
coordinates) and the upper corner. Then you can check whether
it covers or intersects other types of spatial objects, among
other functionalities.
inline Coord getXL() const [public]
return the smaller X coordinate
inline Coord getYL() const [public]
return the smaller Y coordinate
inline Coord getXH() const [public]
return the higher X coordinate
inline Coord getYH() const [public]
return the hither Y coordinate
inline void setXL(Coord x) [public]
set the value of lower X coordinate
inline void setYL(Coord y) [public]
set the value of lower Y coordinate
inline void setXH(Coord x) [public]
set the value of higher X coordinate
inline void setYH(Coord y) [public]
set the value of higher Y coordinate
inline void set(Coord xLow, Coord yLow, Coord xHi, Coord yHi) [public]
set the coordinates for the two corners.
xLow/yLow is the lower corner; xHi/yHi the higher corner.
double distance(const GRect& other) const [public]
return the distance between the centroids of the two rectangles.
inline bool isValid() const [public]
check if the rectangle contains valid coordinates.
a rectangle is invalid if A: any of the coordinates are of
InvalidCoord value, or B: the lower coordinate values are
greater than the higher coordinates.
bool equals(const GRect& other) const [public]
check whehter two rectangles are the same
void enlarge(const GRect& other) [public]
if the "other" rectangle covers or intersects with this one,
then enlarge this rectangle to just contain the other one;
otherwise (the other rect is inside this one) do nothing.
void centroid(Coord& x, Coord& y) [public]
get the centroid of the rectangle
int covers(const GSpatial& a) const [public virtual]
check if the rectangle covers another geometry object;
possible types of objects are: Rect, Point, Segment, Polyline, Ring, Polygon.
int intersects(const GSpatial& a) const [public virtual]
check if the rectangle intersects another object
possible types of objects are: Rect, Circle, Polyline, Ring, Segment, Polygon
Documentation generated by lqian@lqian-sun on Wed Jul 14 09:36:10 EDT 1999
|
Kdoc
|