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::DSPoly Class Reference

Implementation of a Polygon. More...

#include <DSPoly.h>

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

List of all members.

Public Member Functions

 DSPoly ()
 Constructors and destructor.
 DSPoly (const DSPoly &other)
 DSPoly (const Matrix< Float > &points, const Bool &handles=False, const Bool &drawHandles=False)
virtual ~DSPoly ()
virtual void draw (PixelCanvas *pc)
 General DisplayShape functions.
virtual void rotate (const Float &angle)
 Rotate the shape about its center by a set angle (angle in degrees).
virtual Bool inObject (const Float &xPos, const Float &yPos)
 Is the supplied point within the DisplayShape?
virtual void scale (const Float &scale)
 Scale the shape about its center by the scaleFactor.
virtual void move (const Float &dX, const Float &dY)
virtual void changePoint (const Vector< Float > &newLocation)
 Changes the closest point to the supplied location to that location.
virtual void changePoint (const Vector< Float > &newLocation, const Int point)
 Changes the nth point making up the DisplayShape ot the specified location.
virtual void setCenter (const Float &xPos, const Float &yPos)
 Sets the center of the DisplayShape.
virtual Vector< FloatgetCenter ()
 Returns the center of the DisplayShape (x,y).
virtual void rotateAbout (const Float &angle, const Float &aboutX, const Float &aboutY)
virtual void addPoint (const Vector< Float > &newPoint)
 Polygon specific functions, add, delete and set points, all in pixels.
virtual void deletePoint (const Vector< Float > &removePoint)
virtual void deletePoint (const Int nPoint)
virtual void setPoints (const Matrix< Float > &newPoints)
virtual Record getOptions ()
 Get and set options.
virtual Bool setOptions (const Record &settings)

Protected Member Functions

virtual Matrix< FloatgetPoints ()

Private Member Functions

virtual void setDefaultOptions ()
 
   

virtual Float getArea ()

Private Attributes

Matrix< FloatitsPoints
 
   

Vector< FloatitsPolyCenter
Bool itsValidPoints
Bool itsValidCenter

Detailed Description

Implementation of a Polygon.

Prerequisite

Etymology

DSPoly is a method of managing the drawing of a polygon onto a PixelCanvas.

Synopsis

DSPoly allows for the management of a polygon, including the addition and deletion of points.

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

To enable display of circles onto a pixel canvas.

Example

Definition at line 73 of file DSPoly.h.


Constructor & Destructor Documentation

Constructors and destructor.

casa::DSPoly::DSPoly ( const DSPoly other)
casa::DSPoly::DSPoly ( const Matrix< Float > &  points,
const Bool handles = False,
const Bool drawHandles = False 
)
virtual casa::DSPoly::~DSPoly ( ) [virtual]

Member Function Documentation

virtual void casa::DSPoly::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::DisplayShape.

Reimplemented in casa::DSRectangle, casa::DSWorldPoly, and casa::DSScreenPoly.

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

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

Implements casa::DisplayShape.

Reimplemented in casa::DSRectangle, casa::DSSquare, casa::DSWorldPoly, casa::DSScreenPoly, casa::DSWorldRectangle, and casa::DSScreenRectangle.

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

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

Implements casa::DisplayShape.

Reimplemented in casa::DSRectangle, casa::DSSquare, casa::DSWorldPoly, casa::DSScreenPoly, casa::DSWorldRectangle, and casa::DSScreenRectangle.

virtual void casa::DSPoly::deletePoint ( const Vector< Float > &  removePoint) [virtual]
virtual void casa::DSPoly::deletePoint ( const Int  nPoint) [virtual]
virtual void casa::DSPoly::draw ( PixelCanvas pc) [virtual]

General DisplayShape functions.

Reimplemented from casa::DSClosed.

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

virtual Float casa::DSPoly::getArea ( ) [private, virtual]
virtual Vector<Float> casa::DSPoly::getCenter ( ) [virtual]

Returns the center of the DisplayShape (x,y).

Implements casa::DisplayShape.

virtual Record casa::DSPoly::getOptions ( ) [virtual]
virtual Matrix<Float> casa::DSPoly::getPoints ( ) [protected, virtual]
virtual Bool casa::DSPoly::inObject ( const Float xPos,
const Float yPos 
) [virtual]

Is the supplied point within the DisplayShape?

Implements casa::DisplayShape.

virtual void casa::DSPoly::move ( const Float dX,
const Float dY 
) [virtual]
virtual void casa::DSPoly::rotate ( const Float angle) [virtual]

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

Implements casa::DisplayShape.

Reimplemented in casa::DSRectangle, casa::DSWorldPoly, casa::DSScreenPoly, casa::DSWorldRectangle, and casa::DSScreenRectangle.

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

Reimplemented from casa::DSClosed.

Reimplemented in casa::DSRectangle.

virtual void casa::DSPoly::scale ( const Float scaleFactor) [virtual]

Scale the shape about its center by the scaleFactor.

Implements casa::DisplayShape.

Reimplemented in casa::DSWorldPoly, and casa::DSScreenPoly.

virtual void casa::DSPoly::setCenter ( const Float xPos,
const Float yPos 
) [virtual]
virtual void casa::DSPoly::setDefaultOptions ( ) [private, virtual]

   

Used to set up the class when default constructor called

Reimplemented from casa::DSClosed.

Reimplemented in casa::DSRectangle.

virtual Bool casa::DSPoly::setOptions ( const Record settings) [virtual]
virtual void casa::DSPoly::setPoints ( const Matrix< Float > &  newPoints) [virtual]

Reimplemented in casa::DSWorldPoly, and casa::DSScreenPoly.


Member Data Documentation

   

Points used to draw (with scaling + rotation)

Definition at line 123 of file DSPoly.h.

Definition at line 124 of file DSPoly.h.

Definition at line 126 of file DSPoly.h.

Definition at line 125 of file DSPoly.h.


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