casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
casa::DSArrow Class Reference

Arrow implementation;adds a polygon to a DSLine to represent the arrow head. More...

#include <DSArrow.h>

Inheritance diagram for casa::DSArrow:
casa::DSLine casa::DSPolyLine casa::DSBasic casa::DisplayShape casa::DSPixelArrow casa::DSScreenArrow casa::DSWorldArrow

Public Types

enum  ArrowHead {
  Open_Triangle,
  Filled_Triangle,
  Cool_Triangle
}
 Supported arrow head types. More...
 
- Public Types inherited from casa::DisplayShape
enum  HandleShape {
  Filled_Square,
  Open_Square,
  Filled_Circle,
  Open_Circle,
  Filled_Triangle,
  Open_Triangle
}
 Handle style. More...
 

Public Member Functions

 DSArrow ()
 Default constructor. More...
 
 DSArrow (const casacore::Vector< casacore::Float > &startPoint, const casacore::Vector< casacore::Float > &endPoint, DSArrow::ArrowHead style=DSArrow::Cool_Triangle, const casacore::Int arrowHeadSize=8)
 The start and end point are in pixel co-ordinates. More...
 
 DSArrow (const DSArrow &other)
 Copy constructor. More...
 
virtual ~DSArrow ()
 Destructor. More...
 
virtual void draw (PixelCanvas *pc)
 Standard Display Shape functions. More...
 
virtual void move (const casacore::Float &dX, const casacore::Float &dY)
 
virtual void rotate (const casacore::Float &angle)
 Rotate the shape about its center by a set angle (angle in degrees). More...
 
virtual void scale (const casacore::Float &scaleFactor)
 Scale the shape about its center by the scaleFactor. More...
 
virtual void setCenter (const casacore::Float &xPos, const casacore::Float &yPos)
 This does nothing, it's so arrow and other inheriting classes can take note of new centers. More...
 
virtual void rotateAbout (const casacore::Float &angle, const casacore::Float &aboutX, const casacore::Float &aboutY)
 Does nothing currently. More...
 
virtual void setStartPoint (const casacore::Vector< casacore::Float > &startPoint)
 Standard (changePoint) and specific funtions for altering the arrow. More...
 
virtual void setEndPoint (const casacore::Vector< casacore::Float > &endPoint)
 
virtual void changePoint (const casacore::Vector< casacore::Float > &pos, const casacore::Int n)
 Changes the nth point making up the DisplayShape ot the specified location. More...
 
virtual void changePoint (const casacore::Vector< casacore::Float > &pos)
 Point manipulation functions. More...
 
virtual void setLength (const casacore::Float &pixelLength)
 These are to enable the use of arrows more easily in vector plots. More...
 
virtual void setAngle (const casacore::Float &angle)
 
virtual casacore::Record getOptions ()
 Return an option record describing the shape. More...
 
virtual casacore::Bool setOptions (const casacore::Record &newSettings)
 Set options. More...
 
- Public Member Functions inherited from casa::DSLine
 DSLine ()
 Constructors and Destructors. More...
 
 DSLine (const DSLine &other)
 
 DSLine (const casacore::Vector< casacore::Float > &startPos, const casacore::Vector< casacore::Float > &endPos, const casacore::Bool &handles=true, const casacore::Bool &drawHandles=true)
 
virtual ~DSLine ()
 
virtual casacore::Bool isValid ()
 Does this line have a valid start and a valid end? More...
 
- Public Member Functions inherited from casa::DSPolyLine
 DSPolyLine ()
 Constructors and Destructors. More...
 
 DSPolyLine (const DSPolyLine &other)
 
 DSPolyLine (const casacore::Matrix< casacore::Float > &points, const casacore::Bool &handles, const casacore::Bool &drawHandles)
 
virtual ~DSPolyLine ()
 
virtual casacore::Bool inObject (const casacore::Float &xPos, const casacore::Float &yPos)
 Is the supplied point within the DisplayShape? More...
 
virtual casacore::Vector
< casacore::Float
getCenter ()
 Returns the center of the DisplayShape (x,y). More...
 
virtual void addPoint (const casacore::Vector< casacore::Float > &newPos)
 If applicable, this function will add a point to the shape in the most meaningful location. More...
 
virtual void setPoints (const casacore::Matrix< casacore::Float > &points)
 
virtual casacore::uInt nPoints ()
 Return the number of points. More...
 
- 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 ()
 

Static Public Attributes

static const int numArrowHeads
 For checking setoptions(arrowheadstyle = ?) More...
 

Private Member Functions

virtual void buildArrowHead ()
 Make a new arrow head (which is simply a DSPoly) More...
 
virtual void updateArrowHead ()
 Caluclate angle etc. More...
 
virtual void setDefaultOptions ()
 Set default options. More...
 
virtual void make ()
 Construct the line segment of the arrow when we have valid start / end points. More...
 

Private Attributes

casacore::Float itsLength
 If someone calls "setLength" before "setCenter", we can store our length until they DO call setLength;. More...
 
DParameterRange< casacore::Int > * itsHeadSize
 
DSPolyitsArrowHead
 
casacore::Vector< casacore::FloatitsStartPoint
 Temp storage while I am being set up. More...
 
casacore::Vector< casacore::FloatitsEndPoint
 
casacore::Matrix< casacore::FloatitsUnrotatedHead
 A casacore::Matrix of the unRotated arrow head. More...
 
casacore::Float itsOffset
 Offset needed to make sure the tip of the arrow is at the end of the line. More...
 
DSArrow::ArrowHead itsArrowHeadStyle
 Style of arrow head. More...
 
casacore::Bool itsValidStart
 Have I been supplied with valid points yet. More...
 
casacore::Bool itsValidEnd
 

Additional Inherited Members

- Protected Member Functions inherited from casa::DSLine
virtual casacore::Bool validStart ()
 
virtual casacore::Bool validEnd ()
 
virtual casacore::Matrix
< casacore::Float
getEnds ()
 General utility functions. More...
 
virtual casacore::Matrix
< casacore::Float
asPolyLine (const casacore::Vector< casacore::Float > &startPos, const casacore::Vector< casacore::Float > &endPos)
 
- Protected Member Functions inherited from casa::DSPolyLine
virtual casacore::Matrix
< casacore::Float
getPoints ()
 Return all my points. More...
 

Detailed Description

Arrow implementation;adds a polygon to a DSLine to represent the arrow head.

Prerequisite

Etymology

DSArrow is a method of managing the drawing of a line and polygon onto a PixelCanvas.

Synopsis

DSArrow simply extends from DSLine, and adds the management of a polygon to it. The polygon is used to represent the arrow head, and various options regarding its apppearance can be changed.

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

It was thought, especially in an annotations context, that an Arrow would be a usefull drawing tool.

Example

casacore::Vector<casacore::Float> startPoint(2); startPoint[0] = 100; startPoint[1] = 100;
casacore::Vector<casacore::Float> endPoint(2); endPoint[0] = 200; endPoint[1] = 200;
DSArrow* myArrow =
new DSArrow(startPoint, endPoint, DSArrow::Filled_Triangle, 10);
myArrow->move(10,10);
casacore::Vector<casacore::Float> newStart(2); newStart[0] = 50; newStart[1] = 50;
myArrow->setStartPoint(newStart);
newArrow.define("arrowheadsize", 6);
myArrow->setOptions(newArrow);
myArrow->draw(myPixelCanvas);
etc.\.

Definition at line 99 of file DSArrow.h.

Member Enumeration Documentation

Supported arrow head types.

Enumerator
Open_Triangle 
Filled_Triangle 
Cool_Triangle 

Definition at line 104 of file DSArrow.h.

Constructor & Destructor Documentation

casa::DSArrow::DSArrow ( )

Default constructor.

In order to make the arrow "valid", it must be supplied with a valid start and end point.

casa::DSArrow::DSArrow ( const casacore::Vector< casacore::Float > &  startPoint,
const casacore::Vector< casacore::Float > &  endPoint,
DSArrow::ArrowHead  style = DSArrow::Cool_Triangle,
const casacore::Int  arrowHeadSize = 8 
)

The start and end point are in pixel co-ordinates.

casa::DSArrow::DSArrow ( const DSArrow other)

Copy constructor.

virtual casa::DSArrow::~DSArrow ( )
virtual

Destructor.

Member Function Documentation

virtual void casa::DSArrow::buildArrowHead ( )
privatevirtual

Make a new arrow head (which is simply a DSPoly)

virtual void casa::DSArrow::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::DSPolyLine.

Reimplemented in casa::DSScreenArrow, and casa::DSWorldArrow.

virtual void casa::DSArrow::changePoint ( const casacore::Vector< casacore::Float > &  pos)
virtual

Point manipulation functions.

The changePoint with only one argument moves the closest point to the location specified.

Reimplemented from casa::DSPolyLine.

Reimplemented in casa::DSScreenArrow, and casa::DSWorldArrow.

virtual void casa::DSArrow::draw ( PixelCanvas pc)
virtual

Standard Display Shape functions.

Reimplemented from casa::DSPolyLine.

Reimplemented in casa::DSWorldArrow.

virtual casacore::Record casa::DSArrow::getOptions ( )
virtual

Return an option record describing the shape.

Reimplemented from casa::DSLine.

Reimplemented in casa::DSScreenArrow, casa::DSWorldArrow, and casa::DSPixelArrow.

Referenced by casa::DSPixelArrow::getRawOptions(), casa::DSScreenArrow::getRawOptions(), and casa::DSWorldArrow::getRawOptions().

virtual void casa::DSArrow::make ( )
privatevirtual

Construct the line segment of the arrow when we have valid start / end points.

Reimplemented from casa::DSLine.

virtual void casa::DSArrow::move ( const casacore::Float dX,
const casacore::Float dY 
)
virtual

Reimplemented from casa::DSPolyLine.

Reimplemented in casa::DSScreenArrow, and casa::DSWorldArrow.

virtual void casa::DSArrow::rotate ( const casacore::Float angle)
virtual

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

Reimplemented from casa::DSPolyLine.

Reimplemented in casa::DSScreenArrow, and casa::DSWorldArrow.

virtual void casa::DSArrow::rotateAbout ( const casacore::Float angle,
const casacore::Float aboutX,
const casacore::Float aboutY 
)
virtual

Does nothing currently.

Reimplemented from casa::DSPolyLine.

virtual void casa::DSArrow::scale ( const casacore::Float scaleFactor)
virtual

Scale the shape about its center by the scaleFactor.

Reimplemented from casa::DSPolyLine.

Reimplemented in casa::DSScreenArrow, and casa::DSWorldArrow.

virtual void casa::DSArrow::setAngle ( const casacore::Float angle)
virtual
virtual void casa::DSArrow::setCenter ( const casacore::Float xPos,
const casacore::Float yPos 
)
virtual

This does nothing, it's so arrow and other inheriting classes can take note of new centers.

Reimplemented from casa::DSLine.

Reimplemented in casa::DSScreenArrow, and casa::DSWorldArrow.

virtual void casa::DSArrow::setDefaultOptions ( )
privatevirtual

Set default options.

Reimplemented from casa::DSPolyLine.

virtual void casa::DSArrow::setEndPoint ( const casacore::Vector< casacore::Float > &  endPoint)
virtual

Reimplemented from casa::DSLine.

Reimplemented in casa::DSScreenArrow, and casa::DSWorldArrow.

virtual void casa::DSArrow::setLength ( const casacore::Float pixelLength)
virtual

These are to enable the use of arrows more easily in vector plots.

virtual casacore::Bool casa::DSArrow::setOptions ( const casacore::Record newSettings)
virtual

Set options.

Reimplemented from casa::DSLine.

Reimplemented in casa::DSScreenArrow, casa::DSWorldArrow, and casa::DSPixelArrow.

virtual void casa::DSArrow::setStartPoint ( const casacore::Vector< casacore::Float > &  startPoint)
virtual

Standard (changePoint) and specific funtions for altering the arrow.

the changePoint method with only one argument will move the closest point to the specified new point. When speciffyin 'n', in this case only 0 or 1 are valid. The 'startpoint' is the one with the arrow head on it.

Reimplemented from casa::DSLine.

Reimplemented in casa::DSScreenArrow, and casa::DSWorldArrow.

virtual void casa::DSArrow::updateArrowHead ( )
privatevirtual

Caluclate angle etc.

Member Data Documentation

DSPoly* casa::DSArrow::itsArrowHead
private

Definition at line 183 of file DSArrow.h.

DSArrow::ArrowHead casa::DSArrow::itsArrowHeadStyle
private

Style of arrow head.

Definition at line 199 of file DSArrow.h.

casacore::Vector<casacore::Float> casa::DSArrow::itsEndPoint
private

Definition at line 188 of file DSArrow.h.

DParameterRange<casacore::Int>* casa::DSArrow::itsHeadSize
private

Definition at line 181 of file DSArrow.h.

casacore::Float casa::DSArrow::itsLength
private

If someone calls "setLength" before "setCenter", we can store our length until they DO call setLength;.

Definition at line 166 of file DSArrow.h.

casacore::Float casa::DSArrow::itsOffset
private

Offset needed to make sure the tip of the arrow is at the end of the line.

Definition at line 196 of file DSArrow.h.

casacore::Vector<casacore::Float> casa::DSArrow::itsStartPoint
private

Temp storage while I am being set up.

Definition at line 187 of file DSArrow.h.

casacore::Matrix<casacore::Float> casa::DSArrow::itsUnrotatedHead
private

A casacore::Matrix of the unRotated arrow head.

Definition at line 192 of file DSArrow.h.

casacore::Bool casa::DSArrow::itsValidEnd
private

Definition at line 202 of file DSArrow.h.

casacore::Bool casa::DSArrow::itsValidStart
private

Have I been supplied with valid points yet.

Definition at line 202 of file DSArrow.h.

const int casa::DSArrow::numArrowHeads
static

For checking setoptions(arrowheadstyle = ?)

Definition at line 107 of file DSArrow.h.


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