GRect Class Reference

[libgfc Index] [libgfc Hierarchy] [Headers]


a rectangle ADT class More...

#include <src/gadt_rect.h>

Inherits: GSpatial

Public Members


Detailed Description

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