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 Attributes | List of all members
casa::DSLine Class Reference

Implementation of a line. More...

#include <DSLine.h>

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

Public Member Functions

 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 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 casacore::Bool isValid ()
 Does this line have a valid start and a valid end? More...
 
virtual void setStartPoint (const casacore::Vector< casacore::Float > &start)
 Line specific functions for ease of use. More...
 
virtual void setEndPoint (const casacore::Vector< casacore::Float > &end)
 
virtual casacore::Record getOptions ()
 Set and get options. More...
 
virtual casacore::Bool setOptions (const casacore::Record &newSettings)
 Get and set this shapes options. 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 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 move (const casacore::Float &dX, const casacore::Float &dY)
 
virtual casacore::Vector
< casacore::Float
getCenter ()
 Returns the center of the DisplayShape (x,y). More...
 
virtual void scale (const casacore::Float &scaleFactor)
 Scale the shape about its center by the scaleFactor. 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 changePoint (const casacore::Vector< casacore::Float > &pos)
 Point manipulation functions. More...
 
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 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 ()
 

Protected Member Functions

virtual casacore::Bool validStart ()
 
virtual casacore::Bool validEnd ()
 
virtual void make ()
 
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...
 

Private Attributes

casacore::Bool itsValidStart
 
casacore::Bool itsValidEnd
 
casacore::Vector< casacore::FloatitsStart
 These are to hold the points while line is being made (line is invalid). More...
 
casacore::Vector< casacore::FloatitsEnd
 

Additional Inherited Members

- 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 line.

Prerequisite

Etymology

DSLine is a method of managing the drawing of a line onto a PixelCanvas.

Synopsis

DSLine simply extends from DSPolyLine, and adds specific functions to a line with only two points (e.g. setStartPoint)

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 for a basic line 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;
DSLine* myLine = new DSLine(startPoint, endPoint, true, true);
myLine->move(10,10);
casacore::Vector<casacore::Float> newStart(2); newStart[0] = 50; newStart[1] = 50;
myLine->setStartPoint(newStart);
casacore::Record newLineOpt;
newLineOpt.define("linewidth", 3);
myLine->setOptions(newLineOpt);
myLine->draw(myPixelCanvas);
etc.\.

Definition at line 94 of file DSLine.h.

Constructor & Destructor Documentation

casa::DSLine::DSLine ( )

Constructors and Destructors.

casa::DSLine::DSLine ( const DSLine other)
casa::DSLine::DSLine ( const casacore::Vector< casacore::Float > &  startPos,
const casacore::Vector< casacore::Float > &  endPos,
const casacore::Bool handles = true,
const casacore::Bool drawHandles = true 
)
virtual casa::DSLine::~DSLine ( )
virtual

Member Function Documentation

virtual casacore::Matrix<casacore::Float> casa::DSLine::asPolyLine ( const casacore::Vector< casacore::Float > &  startPos,
const casacore::Vector< casacore::Float > &  endPos 
)
protectedvirtual
virtual casacore::Matrix<casacore::Float> casa::DSLine::getEnds ( )
protectedvirtual

General utility functions.

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

Set and get options.

Reimplemented from casa::DSPolyLine.

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

virtual casacore::Bool casa::DSLine::isValid ( )
virtual

Does this line have a valid start and a valid end?

virtual void casa::DSLine::make ( )
protectedvirtual

Reimplemented in casa::DSArrow.

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

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

virtual void casa::DSLine::setEndPoint ( const casacore::Vector< casacore::Float > &  end)
virtual
virtual casacore::Bool casa::DSLine::setOptions ( const casacore::Record newSettings)
virtual

Get and set this shapes options.

Reimplemented from casa::DSPolyLine.

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

virtual void casa::DSLine::setStartPoint ( const casacore::Vector< casacore::Float > &  start)
virtual

Line specific functions for ease of use.

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

virtual casacore::Bool casa::DSLine::validEnd ( )
inlineprotectedvirtual

Definition at line 141 of file DSLine.h.

References itsValidEnd.

virtual casacore::Bool casa::DSLine::validStart ( )
inlineprotectedvirtual

Definition at line 137 of file DSLine.h.

References itsValidStart.

Member Data Documentation

casacore::Vector<casacore::Float> casa::DSLine::itsEnd
private

Definition at line 133 of file DSLine.h.

casacore::Vector<casacore::Float> casa::DSLine::itsStart
private

These are to hold the points while line is being made (line is invalid).

Definition at line 132 of file DSLine.h.

casacore::Bool casa::DSLine::itsValidEnd
private

Definition at line 129 of file DSLine.h.

Referenced by validEnd().

casacore::Bool casa::DSLine::itsValidStart
private

Definition at line 129 of file DSLine.h.

Referenced by validStart().


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