casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DSPolyLine.h
Go to the documentation of this file.
1 //# DSPolyLine.h: PolyLine implementation for "DisplayShapes"
2 //# Copyright (C) 1998,1999,2000,2001,2002
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id:
27 
28 #ifndef TRIALDISPLAY_DSPOLYLINE_H
29 #define TRIALDISPLAY_DSPOLYLINE_H
30 
31 #include <casa/aips.h>
32 #include <casa/Arrays/Matrix.h>
33 #include <casa/Arrays/Vector.h>
35 
36 
37 namespace casa { //# NAMESPACE CASA - BEGIN
38 
39 // <summary>
40 // Implementation of a polyline.
41 // </summary>
42 //
43 // <prerequisite>
44 // <li> <linkto class="DisplayShape">DisplayShape</linkto>
45 // </prerequisite>
46 //
47 // <etymology>
48 // DSPolyLine is a method of managing the drawing of a polyline onto
49 // a PixelCanvas.
50 // </etymology>
51 //
52 // <synopsis>
53 // DSPolyLine manages a collection of points, which when called it draws.
54 // It also manages actions like the addition and removal of points from/to
55 // the line.
56 //
57 // There are generally two ways to make DisplayShape(s); To create them in
58 // "one hit" by providing arguments to the constructor, or by using the
59 // default constructor and then the "setOptions" method. A simple interface
60 // for all classes inheriting from the
61 // <linkto class="DisplayShape">DisplayShape</linkto> class is provided by
62 // <linkto class="DisplayShapeInterface">DisplayShapeInterface</linkto>.
63 // </synopsis>
64 //
65 // <motivation>
66 // The need to draw, move and manipulate a polyline.
67 // </motivation>
68 //
69 // <example>
70 // <srcblock>
71 //
72 // </srcblock>
73 // </example>
74 
75 
76  class DSPolyLine : public DSBasic {
77 
78  public:
79 
80  // Constructors and Destructors
81  // <group>
82  DSPolyLine();
83  DSPolyLine(const DSPolyLine& other);
84  DSPolyLine(const casacore::Matrix<casacore::Float>& points, const casacore::Bool& handles,
85  const casacore::Bool& drawHandles);
86  virtual ~DSPolyLine();
87  // </group>
88 
89  // General DisplayShape functions
90  // <group>
91  virtual void draw(PixelCanvas* pc);
92  virtual casacore::Bool inObject(const casacore::Float& xPos, const casacore::Float& yPos);
93  virtual void move(const casacore::Float& dX, const casacore::Float& dY);
95  virtual void setCenter(const casacore::Float& xPos, const casacore::Float& yPos);
96  virtual void scale(const casacore::Float& scaleFactor);
97  virtual void rotate(const casacore::Float& angle);
98  virtual void rotateAbout(const casacore::Float& angle, const casacore::Float& aboutX,
99  const casacore::Float& aboutY);
100  // </group>
101 
102  // Point manipulation functions. The changePoint with only one argument
103  // moves the closest point to the location specified.
104  // <group>
105  virtual void changePoint(const casacore::Vector<casacore::Float>& pos);
106  virtual void changePoint(const casacore::Vector<casacore::Float>& pos, const casacore::Int n);
107  virtual void addPoint(const casacore::Vector<casacore::Float>& newPos);
108  virtual void setPoints(const casacore::Matrix<casacore::Float>& points);
109  // </group>
110 
111  // Return the number of points.
112  virtual casacore::uInt nPoints();
113 
114  // Get and set this shapes options.
115  // <group>
116  virtual casacore::Bool setOptions(const casacore::Record& newSettings);
117  virtual casacore::Record getOptions();
118  // </group>
119 
120  protected:
121  // Return all my points.
123 
124  private:
128  // Used when default constructor called.
129  virtual void setDefaultOptions();
130  };
131 
132 } //# NAMESPACE CASA - END
133 
134 #endif
135 
136 
137 
138 
int Int
Definition: aipstype.h:50
virtual void changePoint(const casacore::Vector< casacore::Float > &pos)
Point manipulation functions.
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).
DSPolyLine()
Constructors and Destructors.
virtual casacore::uInt nPoints()
Return the number of points.
casacore::Bool itsValidCenter
Definition: DSPolyLine.h:127
virtual void rotate(const casacore::Float &angle)
Rotate the shape about its center by a set angle (angle in degrees).
virtual void setPoints(const casacore::Matrix< casacore::Float > &points)
Implementation of a polyline.
Definition: DSPolyLine.h:76
virtual void scale(const casacore::Float &scaleFactor)
Scale the shape about its center by the scaleFactor.
Base class defining interface to pixel-based output devices.
Definition: PixelCanvas.h:161
virtual void setCenter(const casacore::Float &xPos, const casacore::Float &yPos)
Sets the center of the DisplayShape.
virtual ~DSPolyLine()
virtual casacore::Matrix< casacore::Float > getPoints()
Return all my points.
virtual casacore::Record getOptions()
Settings.
virtual casacore::Bool inObject(const casacore::Float &xPos, const casacore::Float &yPos)
Is the supplied point within the DisplayShape?
A hierarchical collection of named fields of various types.
Definition: Record.h:180
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
float Float
Definition: aipstype.h:54
virtual void draw(PixelCanvas *pc)
General DisplayShape functions.
casacore::Matrix< casacore::Float > itsPoints
Definition: DSPolyLine.h:125
casacore::Vector< casacore::Float > itsCenter
Definition: DSPolyLine.h:126
virtual void rotateAbout(const casacore::Float &angle, const casacore::Float &aboutX, const casacore::Float &aboutY)
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...
virtual void setDefaultOptions()
Used when default constructor called.
virtual casacore::Bool setOptions(const casacore::Record &newSettings)
Get and set this shapes options.
Base class for all &quot;basic&quot; shapes.
Definition: DSBasic.h:68
unsigned int uInt
Definition: aipstype.h:51