DSRectangle.h

Classes

DSRectangle -- Implementation of a rectangle. (full description)

class DSRectangle : public DSPoly

Interface

Public Members
DSRectangle()
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)
virtual void rotate(const Float& angle)
virtual void rotateAbout(const Float& angle, const Float& aboutX, const Float& aboutY)
virtual void setCenter(const Float& xPos, const Float& yPos)
virtual void changePoint(const Vector<Float>& pos)
virtual void changePoint(const Vector<Float>& newPoints, const Int whichOne)
virtual void addPoint(const Vector<Float>& toAdd)
virtual void setHeight(const Float& height)
virtual void setWidth(const Float& width)
virtual Float getHeight()
virtual Float getWidth()
virtual Bool setOptions(const Record& settings)
virtual Record getOptions()
virtual Matrix<Float> makeAsPoly(const Float& xPos, const Float& yPos, const Float& width, const Float& height)
Private Members
virtual void setDefaultOptions()
virtual void setAngle(const Float& newAngle)
Protected Members
virtual Float getAngle()

Description

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

Member Description

DSRectangle()
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()

Constructors and Destructors

virtual void move(const Float& dX, const Float& dY)
virtual void rotate(const Float& angle)
virtual void rotateAbout(const Float& angle, const Float& aboutX, const Float& aboutY)
virtual void setCenter(const Float& xPos, const Float& yPos)
virtual void changePoint(const Vector<Float>& pos)
virtual void changePoint(const Vector<Float>& newPoints, const Int whichOne)
virtual void addPoint(const Vector<Float>& toAdd)

Standard DisplayShape functions

virtual void setHeight(const Float& height)
virtual void setWidth(const Float& width)
virtual Float getHeight()
virtual Float getWidth()

Rectangle specific. Get / set width and height in pixels.

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

Get and set options

virtual Matrix<Float> makeAsPoly(const Float& xPos, const Float& yPos, const Float& width, const Float& height)

Using supplied parameters, make a polygon of four points representing the rectangle. This can then be used to create / alter a DSPoly.

virtual void setDefaultOptions()

virtual void setAngle(const Float& newAngle)

virtual Float getAngle()