DLRectShape Class Reference

An object used to represent a rectangle. More...

#include <DLRectShape.h>

Inheritance diagram for DLRectShape:

DLShape List of all members.

Public Member Functions

 DLRectShape ()
 DLRectShape (const DLRectShape &orig)
const DLRectShapeoperator= (const DLRectShape &right)
 DLRectShape (int x1, int y1, int w1, int h1)
 DLRectShape (const DLZone &z)
 DLRectShape (const DLPoint &upperleft, const DLPoint &lowerright)
virtual ~DLRectShape ()
void dlDrawShape (DLImage *image)
int dlGetX () const
int dlGetY () const
int dlGetWidth () const
int dlGetHeight () const
void dlSetX (int xPoint)
void dlSetY (int yPoint)
void dlSetHeight (int height)
void dlSetWidth (int width)

Protected Attributes

int x
 position of rectangle, X coordinate
int y
 position of rectangle, Y coordinate
int w
 width of rectangle
int h
 height of rectangle

Detailed Description

An object used to represent a rectangle.

DLRectShape is a shape object that represents a rectangle by a point (x,y) representing its origin, or upper-left corner, and its width and height. The DLRectShape object can also be used to draw a rectangle onto a DLImage with a desired line color and fill color.

Typical usage:

 // load an image
 DLImage myImage("myfile.tif");
 // define the point
 DLRectShape rect(1,1, 20,40);
 //Set the line and fill color to DL_BLANCHEDALMOND
 rect.dlSetLineColor(DLColor(DL_BLANCHEDALMOND));
 rect.dlSetFillColor(DLColor(DL_BLANCHEDALMOND));
 //Draws the rectangle onto a DLImage
 rect.dlDrawShape(&myImage);

Definition at line 31 of file DLRectShape.h.


Constructor & Destructor Documentation

DLRectShape::DLRectShape (  )  [inline]

Default DLRectShape constructor

Definition at line 38 of file DLRectShape.h.

DLRectShape::DLRectShape ( const DLRectShape orig  ) 

DLRectShape Copy Constructor

Parameters:
orig DLRectShape to be copied

DLRectShape::DLRectShape ( int  x1,
int  y1,
int  w1,
int  h1 
) [inline]

DLRectShape constructor. It takes a point on the image for the rectangle origin, and width and height.

Parameters:
x1 column, or x-coordinate of the point
y1 row, or y-coordinate of the point
w1 width of rectangle
h1 height of rectangle

Definition at line 59 of file DLRectShape.h.

References h, w, x, and y.

DLRectShape::DLRectShape ( const DLZone z  )  [inline]

DLRectShape constructor. It takes a DLZone and will construct a drawable Rectangle shape based on the details of the DLZone

Parameters:
z DLZone containing Recatangle Shape Information

Definition at line 67 of file DLRectShape.h.

References DLZone::dlGetZoneHeight(), DLZone::dlGetZoneOrigin(), DLZone::dlGetZoneWidth(), h, w, DLPoint::x, x, DLPoint::y, and y.

DLRectShape::DLRectShape ( const DLPoint upperleft,
const DLPoint lowerright 
) [inline]

DLRectShape constructor. It takes two DLPoints detailing the upperleft and lower right points of the Rectangle to be created

Parameters:
upperleft DLPoint containing upperleft point of the DLRectShape
lowerright DLPoint containing lowerright point of the DLRectShape

Definition at line 81 of file DLRectShape.h.

References h, w, DLPoint::x, x, DLPoint::y, and y.

virtual DLRectShape::~DLRectShape (  )  [inline, virtual]

Default DLRectShape Destructor

Definition at line 92 of file DLRectShape.h.


Member Function Documentation

const DLRectShape& DLRectShape::operator= ( const DLRectShape right  ) 

Assignment operator

Parameters:
right DLRectShape to be copied

void DLRectShape::dlDrawShape ( DLImage image  )  [virtual]

Draws the rectangle shape onto an image

Parameters:
image image to draw onto, passed by pointer (see above code example)

Implements DLShape.

int DLRectShape::dlGetX (  )  const [inline]

Get X

Returns:
column, or x-coordinate of the rectangle's origin

Definition at line 105 of file DLRectShape.h.

References x.

int DLRectShape::dlGetY (  )  const [inline]

Get Y

Returns:
row, or y-coordinate of the rectangle's origin

Definition at line 110 of file DLRectShape.h.

References y.

int DLRectShape::dlGetWidth (  )  const [inline]

Get Width

Returns:
width of the rectangle

Definition at line 115 of file DLRectShape.h.

References w.

int DLRectShape::dlGetHeight (  )  const [inline]

Get Height

Returns:
height of the rectangle

Definition at line 120 of file DLRectShape.h.

References h.

void DLRectShape::dlSetX ( int  xPoint  )  [inline]

Set rectangle's origin, or upper-left point.

Parameters:
xPoint column, or x-coordinate of the rectangle's origin

Definition at line 126 of file DLRectShape.h.

References x.

void DLRectShape::dlSetY ( int  yPoint  )  [inline]

Set rectangle's origin, or upper-left point.

Parameters:
yPoint row, or y-coordinate of the rectangle's origin

Definition at line 131 of file DLRectShape.h.

References y.

void DLRectShape::dlSetHeight ( int  height  )  [inline]

Set height

Parameters:
height new height of rectangle

Definition at line 136 of file DLRectShape.h.

References h.

void DLRectShape::dlSetWidth ( int  width  )  [inline]

Set width

Parameters:
width new width of rectangle

Definition at line 141 of file DLRectShape.h.


Member Data Documentation

int DLRectShape::x [protected]

position of rectangle, X coordinate

Definition at line 141 of file DLRectShape.h.

Referenced by dlGetX(), DLRectShape(), and dlSetX().

int DLRectShape::y [protected]

position of rectangle, Y coordinate

Definition at line 147 of file DLRectShape.h.

Referenced by dlGetY(), DLRectShape(), and dlSetY().

int DLRectShape::w [protected]

width of rectangle

Definition at line 149 of file DLRectShape.h.

Referenced by dlGetWidth(), and DLRectShape().

int DLRectShape::h [protected]

height of rectangle

Definition at line 151 of file DLRectShape.h.

Referenced by dlGetHeight(), DLRectShape(), and dlSetHeight().


The documentation for this class was generated from the following file:

DOCLIB is being developed under contract by a collaboration between:
The Laboratory for Language and Media Processing
Unviersity of Maryland, College Park
and
Booz | Allen | Hamilton

All Rights Reserved, 2003-2007