DSPoly.h

Classes

DSPoly -- Implementation of a Polygon. (full description)

class DSPoly : public DSClosed

Interface

Public Members
DSPoly()
DSPoly(const DSPoly& other)
DSPoly(const Matrix<Float>& points, const Bool& handles = False, const Bool& drawHandles = False)
virtual ~DSPoly()
virtual void draw(PixelCanvas *pc)
virtual void rotate(const Float& angle)
virtual Bool inObject(const Float& xPos, const Float& yPos)
virtual void scale(const Float& scale)
virtual void move (const Float& dX, const Float& dY)
virtual void changePoint(const Vector<Float>& newLocation)
virtual void changePoint(const Vector<Float>& newLocation, const Int point)
virtual void setCenter(const Float& xPos, const Float& yPos)
virtual Vector<Float> getCenter()
virtual void rotateAbout(const Float& angle, const Float& aboutX, const Float& aboutY)
virtual void addPoint(const Vector<Float>& newPoint)
virtual void deletePoint(const Vector<Float>& removePoint)
virtual void deletePoint(const Int nPoint)
virtual void setPoints(const Matrix<Float>& newPoints)
virtual Record getOptions()
virtual Bool setOptions(const Record& settings)
Private Members
virtual void setDefaultOptions()
virtual Float getArea()
Protected Members
virtual Matrix<Float> getPoints()

Description

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


 

Member Description

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

Constructors and destructor

virtual void draw(PixelCanvas *pc)
virtual void rotate(const Float& angle)
virtual Bool inObject(const Float& xPos, const Float& yPos)
virtual void scale(const Float& scale)
virtual void move (const Float& dX, const Float& dY)
virtual void changePoint(const Vector<Float>& newLocation)
virtual void changePoint(const Vector<Float>& newLocation, const Int point)
virtual void setCenter(const Float& xPos, const Float& yPos)
virtual Vector<Float> getCenter()
virtual void rotateAbout(const Float& angle, const Float& aboutX, const Float& aboutY)

General DisplayShape functions

virtual void addPoint(const Vector<Float>& newPoint)
virtual void deletePoint(const Vector<Float>& removePoint)
virtual void deletePoint(const Int nPoint)
virtual void setPoints(const Matrix<Float>& newPoints)

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& remove) deletes the point closest to that provided.

virtual Record getOptions()
virtual Bool setOptions(const Record& settings)

Get and set options

virtual void setDefaultOptions()

virtual Float getArea()

virtual Matrix<Float> getPoints()