casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
casa::DSRectangle Class Reference

Implementation of a rectangle. More...

#include <DSRectangle.h>

Inheritance diagram for casa::DSRectangle:
casa::DSPoly casa::DSClosed casa::DSBasic casa::DisplayShape casa::DSPixelRectangle casa::DSScreenRectangle casa::DSSquare casa::DSWorldRectangle

List of all members.

Public Member Functions

 DSRectangle ()
 Constructors and Destructors.
 DSRectangle (const Float &xPos, const Float &yPos, const Float &width, const Float &height, const Bool &handles=False, const Bool &drawHandles=False)
 DSRectangle (const DSRectangle &other)
virtual ~DSRectangle ()
virtual void move (const Float &dX, const Float &dY)
 Standard DisplayShape functions.
virtual void rotate (const Float &angle)
 Rotate the shape about its center by a set angle (angle in degrees).
virtual void rotateAbout (const Float &angle, const Float &aboutX, const Float &aboutY)
virtual void setCenter (const Float &xPos, const Float &yPos)
 Sets the center of the DisplayShape.
virtual void changePoint (const Vector< Float > &pos)
 Changes the closest point to the supplied location to that location.
virtual void changePoint (const Vector< Float > &newPoints, const Int whichOne)
 Changes the nth point making up the DisplayShape ot the specified location.
virtual void addPoint (const Vector< Float > &toAdd)
 Polygon specific functions, add, delete and set points, all in pixels.
virtual void setHeight (const Float &height)
 Rectangle specific.
virtual void setWidth (const Float &width)
virtual Float getHeight ()
virtual Float getWidth ()
virtual Bool setOptions (const Record &settings)
 Get and set options.
virtual Record getOptions ()
 Get and set options.
virtual Matrix< FloatmakeAsPoly (const Float &xPos, const Float &yPos, const Float &width, const Float &height)
 Using supplied parameters, make a polygon of four points representing the rectangle.

Protected Member Functions

virtual Float getAngle ()

Private Member Functions

virtual void setDefaultOptions ()
 
   

virtual void setAngle (const Float &newAngle)

Private Attributes

Float itsAngle
 Always valid.
Bool itsValid
Float itsCenter
 Ony used during the set-up period.
Float itsWidth
Float itsHeight

Detailed Description

Implementation of a rectangle.

Prerequisite

Etymology

DSRectangle is a method of managing the drawing of a rectangle onto a PixelCanvas.

Synopsis

DSRectangle is simply a DSPoly with only four points. It has overloaded certain functions however, which cause it to behave as a rectangle when having its points moved etc. It calculates its width and height from points returned from DSPoly when needed.

There are generally two ways to make DisplayShape(s); To create them in "one hit" by providing arguments to the constructor, or by using the default constructor and then the "setOptions" method. A simple interface for all classes inheriting from the DisplayShape class is provided by DisplayShapeInterface .

Motivation

The need to draw rectangles on screen.

Example

To Do

Definition at line 80 of file DSRectangle.h.


Constructor & Destructor Documentation

Constructors and Destructors.

casa::DSRectangle::DSRectangle ( const Float xPos,
const Float yPos,
const Float width,
const Float height,
const Bool handles = False,
const Bool drawHandles = False 
)
virtual casa::DSRectangle::~DSRectangle ( ) [virtual]

Member Function Documentation

virtual void casa::DSRectangle::addPoint ( const Vector< Float > &  newPoint) [virtual]

Polygon specific functions, add, delete and set points, all in pixels.

Add point decides the best place in the array to insert the new point. Similarly, deletePoints(const Vector<Float>& remove) deletes the point closest to that provided.

Reimplemented from casa::DSPoly.

virtual void casa::DSRectangle::changePoint ( const Vector< Float > &  newPos) [virtual]

Changes the closest point to the supplied location to that location.

Reimplemented from casa::DSPoly.

Reimplemented in casa::DSSquare, casa::DSWorldRectangle, and casa::DSScreenRectangle.

virtual void casa::DSRectangle::changePoint ( const Vector< Float > &  newPoint,
const Int  nPoint 
) [virtual]

Changes the nth point making up the DisplayShape ot the specified location.

Reimplemented from casa::DSPoly.

Reimplemented in casa::DSSquare, casa::DSWorldRectangle, and casa::DSScreenRectangle.

virtual Float casa::DSRectangle::getAngle ( ) [protected, virtual]
virtual Float casa::DSRectangle::getHeight ( ) [virtual]
virtual Record casa::DSRectangle::getOptions ( ) [virtual]

Get and set options.

Reimplemented from casa::DSPoly.

Reimplemented in casa::DSSquare, casa::DSWorldRectangle, casa::DSScreenRectangle, and casa::DSPixelRectangle.

virtual Float casa::DSRectangle::getWidth ( ) [virtual]
virtual Matrix<Float> casa::DSRectangle::makeAsPoly ( const Float xPos,
const Float yPos,
const Float width,
const Float height 
) [virtual]

Using supplied parameters, make a polygon of four points representing the rectangle.

This can then be used to create / alter a DSPoly.

virtual void casa::DSRectangle::move ( const Float dX,
const Float dY 
) [virtual]

Standard DisplayShape functions.

Reimplemented from casa::DSPoly.

Reimplemented in casa::DSWorldRectangle, and casa::DSScreenRectangle.

virtual void casa::DSRectangle::rotate ( const Float angle) [virtual]

Rotate the shape about its center by a set angle (angle in degrees).

Reimplemented from casa::DSPoly.

Reimplemented in casa::DSWorldRectangle, and casa::DSScreenRectangle.

virtual void casa::DSRectangle::rotateAbout ( const Float angle,
const Float aboutX,
const Float aboutY 
) [virtual]

Reimplemented from casa::DSPoly.

virtual void casa::DSRectangle::setAngle ( const Float newAngle) [private, virtual]
virtual void casa::DSRectangle::setCenter ( const Float xPos,
const Float yPos 
) [virtual]

Sets the center of the DisplayShape.

Reimplemented from casa::DSPoly.

Reimplemented in casa::DSWorldRectangle, and casa::DSScreenRectangle.

virtual void casa::DSRectangle::setDefaultOptions ( ) [private, virtual]

   

Used to set up the class when default constructor called

Reimplemented from casa::DSPoly.

virtual void casa::DSRectangle::setHeight ( const Float height) [virtual]

Rectangle specific.

Get / set width and height in pixels.

virtual Bool casa::DSRectangle::setOptions ( const Record settings) [virtual]

Get and set options.

Reimplemented from casa::DSPoly.

Reimplemented in casa::DSSquare, casa::DSWorldRectangle, casa::DSScreenRectangle, and casa::DSPixelRectangle.

virtual void casa::DSRectangle::setWidth ( const Float width) [virtual]

Member Data Documentation

Always valid.

Definition at line 129 of file DSRectangle.h.

Ony used during the set-up period.

Definition at line 133 of file DSRectangle.h.

Definition at line 133 of file DSRectangle.h.

Definition at line 130 of file DSRectangle.h.

Definition at line 133 of file DSRectangle.h.


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