casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
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

Public Member Functions

 DSRectangle ()
 Constructors and Destructors. More...
 
 DSRectangle (const casacore::Float &xPos, const casacore::Float &yPos, const casacore::Float &width, const casacore::Float &height, const casacore::Bool &handles=false, const casacore::Bool &drawHandles=false)
 
 DSRectangle (const DSRectangle &other)
 
virtual ~DSRectangle ()
 
virtual void move (const casacore::Float &dX, const casacore::Float &dY)
 Standard DisplayShape functions. More...
 
virtual void rotate (const casacore::Float &angle)
 Rotate the shape about its center by a set angle (angle in degrees). More...
 
virtual void rotateAbout (const casacore::Float &angle, const casacore::Float &aboutX, const casacore::Float &aboutY)
 
virtual void setCenter (const casacore::Float &xPos, const casacore::Float &yPos)
 Sets the center of the DisplayShape. More...
 
virtual void changePoint (const casacore::Vector< casacore::Float > &pos)
 Changes the closest point to the supplied location to that location. More...
 
virtual void changePoint (const casacore::Vector< casacore::Float > &newPoints, const casacore::Int whichOne)
 Changes the nth point making up the DisplayShape ot the specified location. More...
 
virtual void addPoint (const casacore::Vector< casacore::Float > &toAdd)
 Polygon specific functions, add, delete and set points, all in pixels. More...
 
virtual void setHeight (const casacore::Float &height)
 Rectangle specific. More...
 
virtual void setWidth (const casacore::Float &width)
 
virtual casacore::Float getHeight ()
 
virtual casacore::Float getWidth ()
 
virtual casacore::Bool setOptions (const casacore::Record &settings)
 Get and set options. More...
 
virtual casacore::Record getOptions ()
 Get and set options. More...
 
virtual casacore::Matrix
< casacore::Float
makeAsPoly (const casacore::Float &xPos, const casacore::Float &yPos, const casacore::Float &width, const casacore::Float &height)
 Using supplied parameters, make a polygon of four points representing the rectangle. More...
 
- Public Member Functions inherited from casa::DSPoly
 DSPoly ()
 Constructors and destructor. More...
 
 DSPoly (const DSPoly &other)
 
 DSPoly (const casacore::Matrix< casacore::Float > &points, const casacore::Bool &handles=false, const casacore::Bool &drawHandles=false)
 
virtual ~DSPoly ()
 
virtual void draw (PixelCanvas *pc)
 General DisplayShape functions. More...
 
virtual casacore::Bool inObject (const casacore::Float &xPos, const casacore::Float &yPos)
 Is the supplied point within the DisplayShape? More...
 
virtual void scale (const casacore::Float &scale)
 Scale the shape about its center by the scaleFactor. More...
 
virtual casacore::Vector
< casacore::Float
getCenter ()
 Returns the center of the DisplayShape (x,y). More...
 
virtual void deletePoint (const casacore::Vector< casacore::Float > &removePoint)
 
virtual void deletePoint (const casacore::Int nPoint)
 
virtual void setPoints (const casacore::Matrix< casacore::Float > &newPoints)
 
- Public Member Functions inherited from casa::DSClosed
 DSClosed ()
 Constructors and destructors. More...
 
 DSClosed (const DSClosed &other)
 
virtual ~DSClosed ()
 
virtual void setFillStyle (DSClosed::FillStyle fill)
 Get / Set fill options. More...
 
virtual DSClosed::FillStyle getFillStyle ()
 
virtual void setFillColor (casacore::String color)
 
virtual casacore::String getFillColor ()
 
- Public Member Functions inherited from casa::DSBasic
 DSBasic ()
 Default constructor. More...
 
 DSBasic (const DSBasic &other)
 Copy constructor. More...
 
virtual ~DSBasic ()
 Destructor. More...
 
virtual void setLineWidth (const casacore::Int pixels)
 Manage line width. More...
 
virtual casacore::Int getLineWidth ()
 
- Public Member Functions inherited from casa::DisplayShape
 DisplayShape ()
 Default constructor. More...
 
 DisplayShape (const DisplayShape &other)
 Copy constructor. More...
 
virtual ~DisplayShape ()
 Destructor. More...
 
virtual casacore::Matrix
< casacore::Float
rotatePolygon (const casacore::Matrix< casacore::Float > &toRotate, const casacore::Float &angle, const casacore::Float &aboutX, const casacore::Float &aboutY)
 Rotate the supplied polygon (column 1 - x values, column 2 - y values) about the supplied point by the supplied angle. More...
 
virtual casacore::Vector
< casacore::Float
rotatePoint (const casacore::Vector< casacore::Float > &toRotate, const casacore::Float &angle, const casacore::Float &aboutX, const casacore::Float &aboutY)
 Rotates a point around the point specified. More...
 
virtual casacore::Matrix
< casacore::Float
translateMatrix (const casacore::Matrix< casacore::Float > &points, const casacore::Float &dx, const casacore::Float &dy)
 Translate an entire matrix by the specified dx / dy amounts. More...
 
virtual casacore::Bool inPolygon (const casacore::Matrix< casacore::Float > &points, const casacore::Float &xPos, const casacore::Float &yPos)
 Is xPos, YPos inside the supplied points (column 1 - x values, clolumn 2 - y values) More...
 
virtual casacore::Bool closestLine (const casacore::Matrix< casacore::Float > &points, const casacore::Float &xPos, const casacore::Float &yPos, casacore::Int &firstVert, casacore::Int &secondVert, const casacore::Bool &closedPoly=true)
 Determine the two vertices (firstVert, secondVert) which join the line closest to the xPos, yPos point supplied. More...
 
virtual casacore::Bool closestPoint (const casacore::Matrix< casacore::Float > &points, const casacore::Float &xPos, const casacore::Float &yPos, casacore::Int &out)
 For a specified set of points, find the closest to xPos,YPos. More...
 
virtual casacore::Bool closestPoints (const casacore::Matrix< casacore::Float > &points, const casacore::Float &xPos, const casacore::Float &yPos, casacore::Int &outClosest, casacore::Int &outSecond)
 Find the closest two Points from a casacore::Matrix to the specified point. More...
 
virtual casacore::Float toRadians (const casacore::Float &degrees)
 Convert degrees to radians. More...
 
virtual casacore::Float toDegrees (const casacore::Float &radians)
 Conver radians to degree. More...
 
virtual void addLocked (DisplayShape *toLock)
 Allow locking of other shapes onto this one. More...
 
virtual void removeLocked (DisplayShape *removeLock)
 Removes a lock from the specified shape. More...
 
virtual void buildHandles (const casacore::Matrix< casacore::Float > &startPoints)
 Handle management. More...
 
virtual casacore::Matrix
< casacore::Float
getHandleLocations ()
 
virtual void setHandlePositions (const casacore::Matrix< casacore::Float > &newPoints)
 
virtual DSClosedmakeHandle (const casacore::Vector< casacore::Float > &newHandlePos)
 
virtual void addHandle (const casacore::Vector< casacore::Float > &newHandlePos, const casacore::Bool &atEnd=true, const casacore::Int position=0)
 
virtual casacore::Bool removeHandle (const casacore::Vector< casacore::Float > &getRidOf)
 
virtual casacore::Bool removeHandle (const casacore::Int nHandle)
 
virtual casacore::Bool onHandles (const casacore::Float &xPos, const casacore::Float &yPos)
 
virtual casacore::Bool whichHandle (const casacore::Float &xPos, const casacore::Float &yPos, casacore::Int &out)
 
virtual void setDrawHandles (const casacore::Bool &shouldIDraw)
 
virtual casacore::Bool drawingHandles ()
 
virtual void setHasHandles (const casacore::Bool &hasHandles)
 
virtual void setHandleShape (const DisplayShape::HandleShape &shape)
 
virtual void setHandleSize (const casacore::Int pixelSize)
 
virtual void setHandleColor (const casacore::String &handleColor)
 
virtual casacore::uInt nHandles ()
 
virtual void setColor (const casacore::String &newColor)
 Manage the color of object. More...
 
virtual casacore::String getColor ()
 
virtual void recalculateScreenPosition ()
 

Protected Member Functions

virtual casacore::Float getAngle ()
 
- Protected Member Functions inherited from casa::DSPoly
virtual casacore::Matrix
< casacore::Float
getPoints ()
 

Private Member Functions

virtual void setDefaultOptions ()
 Used to set up the class when default constructor called. More...
 
virtual void setAngle (const casacore::Float &newAngle)
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from casa::DSClosed
enum  FillStyle {
  No_Fill,
  Full_Fill
}
 Type of fill to use. More...
 
- Public Types inherited from casa::DisplayShape
enum  HandleShape {
  Filled_Square,
  Open_Square,
  Filled_Circle,
  Open_Circle,
  Filled_Triangle,
  Open_Triangle
}
 Handle style. More...
 

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

casa::DSRectangle::DSRectangle ( )

Constructors and Destructors.

casa::DSRectangle::DSRectangle ( const casacore::Float xPos,
const casacore::Float yPos,
const casacore::Float width,
const casacore::Float height,
const casacore::Bool handles = false,
const casacore::Bool drawHandles = false 
)
casa::DSRectangle::DSRectangle ( const DSRectangle other)
virtual casa::DSRectangle::~DSRectangle ( )
virtual

Member Function Documentation

virtual void casa::DSRectangle::addPoint ( const casacore::Vector< casacore::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 casacore::Vector<casacore::Float>& remove) deletes the point closest to that provided.

Reimplemented from casa::DSPoly.

virtual void casa::DSRectangle::changePoint ( const casacore::Vector< casacore::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 casacore::Vector< casacore::Float > &  newPoint,
const casacore::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 casacore::Float casa::DSRectangle::getAngle ( )
protectedvirtual
virtual casacore::Float casa::DSRectangle::getHeight ( )
virtual
virtual casacore::Record casa::DSRectangle::getOptions ( )
virtual
virtual casacore::Float casa::DSRectangle::getWidth ( )
virtual
virtual casacore::Matrix<casacore::Float> casa::DSRectangle::makeAsPoly ( const casacore::Float xPos,
const casacore::Float yPos,
const casacore::Float width,
const casacore::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 casacore::Float dX,
const casacore::Float dY 
)
virtual

Standard DisplayShape functions.

Reimplemented from casa::DSPoly.

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

virtual void casa::DSRectangle::rotate ( const casacore::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 casacore::Float angle,
const casacore::Float aboutX,
const casacore::Float aboutY 
)
virtual

Reimplemented from casa::DSPoly.

virtual void casa::DSRectangle::setAngle ( const casacore::Float newAngle)
privatevirtual
virtual void casa::DSRectangle::setCenter ( const casacore::Float xPos,
const casacore::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 ( )
privatevirtual

Used to set up the class when default constructor called.

Reimplemented from casa::DSPoly.

virtual void casa::DSRectangle::setHeight ( const casacore::Float height)
virtual

Rectangle specific.

Get / set width and height in pixels.

virtual casacore::Bool casa::DSRectangle::setOptions ( const casacore::Record settings)
virtual

Get and set options.

Reimplemented from casa::DSPoly.

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

virtual void casa::DSRectangle::setWidth ( const casacore::Float width)
virtual

Member Data Documentation

casacore::Float casa::DSRectangle::itsAngle
private

Always valid.

Definition at line 129 of file DSRectangle.h.

casacore::Float casa::DSRectangle::itsCenter
private

Ony used during the set-up period.

Definition at line 133 of file DSRectangle.h.

casacore::Float casa::DSRectangle::itsHeight
private

Definition at line 133 of file DSRectangle.h.

casacore::Bool casa::DSRectangle::itsValid
private

Definition at line 130 of file DSRectangle.h.

casacore::Float casa::DSRectangle::itsWidth
private

Definition at line 133 of file DSRectangle.h.


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