casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DSEllipse.h
Go to the documentation of this file.
1 //# DSEllipse.h: Ellipse 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_DSELLIPSE_H
29 #define TRIALDISPLAY_DSELLIPSE_H
30 
31 #include <casa/aips.h>
32 
34 #include <casa/Arrays/Matrix.h>
35 #include <casa/Arrays/Vector.h>
36 namespace casa { //# NAMESPACE CASA - BEGIN
37 
38 // <summary>
39 // Implementation of a ellipse.
40 // </summary>
41 //
42 // <prerequisite>
43 // <li> <linkto class="DisplayShape">DisplayShape</linkto>
44 // </prerequisite>
45 //
46 // <etymology>
47 // DSEllipse is a method of managing the drawing of a ellipse onto a
48 // PixelCanvas.
49 // </etymology>
50 //
51 // <synopsis>
52 // DSEllipse is the DisplayShape implementation of the primitive ellipse.
53 //
54 // There are generally two ways to make DisplayShape(s); To create them in
55 // "one hit" by providing arguments to the constructor, or by using the
56 // default constructor and then the "setOptions" method. A simple interface
57 // for all classes inheriting from the
58 // <linkto class="DisplayShape">DisplayShape</linkto> class is provided by
59 // <linkto class="DisplayShapeInterface">DisplayShapeInterface</linkto>.
60 // </synopsis>
61 //
62 // <motivation>
63 // To allow the management of ellipses being draw to a pixel canvas.
64 // </motivation>
65 //
66 // <example>
67 // </example>
68 
69 
70 
71  class DSEllipse : public DSClosed {
72 
73  public:
74  // Constructors and destructors. the 'onlyShowOneHandle' flag is primarily
75  // for use if the ellipse is intended to remain symmetrical i.e. a circle.
76  // <group>
77  DSEllipse(const casacore::Bool& onlyShowOneHandle = false);
78  DSEllipse(const DSEllipse& other);
79  DSEllipse(const casacore::Float& xPos, const casacore::Float& yPos, const casacore::Float& major,
80  const casacore::Float& minor,
81  const casacore::Bool& hasHandles = false, const casacore::Bool& drawHandles = false,
82  const casacore::Bool& onlyShowOneHandle = false);
83  virtual ~DSEllipse();
84  // </group>
85 
86  // General DisplayShape functions.
87  // <group>
88  virtual void draw(PixelCanvas *pix);
89  virtual void move(const casacore::Float& dX, const casacore::Float& dY);
90  virtual casacore::Bool inObject(const casacore::Float& xPos, const casacore::Float& yPos);
91  virtual void rotate(const casacore::Float& angle);
92  virtual void rotateAbout(const casacore::Float& angle, const casacore::Float& aboutX,
93  const casacore::Float& aboutY);
94  virtual void setCenter(const casacore::Float& xPos, const casacore::Float& yPos);
96  virtual void changePoint(const casacore::Vector<casacore::Float>& newPoint);
97  virtual void changePoint(const casacore::Vector<casacore::Float>& newPoint, const casacore::Int nPoint);
98  virtual void scale(const casacore::Float& scaleFactor);
99  // </group>
100 
101  // Functions to set / get the minor and major axis of the ellipse
102  // (in pixels).
103  // <group>
104  virtual casacore::Float getMinorAxis();
105  virtual casacore::Float getMajorAxis();
106  virtual void setMajorAxis(const casacore::Float& newMajor);
107  virtual void setMinorAxis(const casacore::Float& newMinor);
108  // </group>
109 
110  // Get and set options
111  // <group>
112  virtual casacore::Record getOptions();
113  virtual casacore::Bool setOptions(const casacore::Record& settings);
114  // </group>
115 
116  protected:
117  // Required on update
118  virtual void calculateHandlePositions();
119  private:
120 
125 
127 
128  // Called when def. constructor used
129  virtual void setDefaultOptions();
130 
131 
132  };
133 
134 
135 } //# NAMESPACE CASA - END
136 
137 #endif
138 
139 
virtual casacore::Bool setOptions(const casacore::Record &settings)
casacore::Bool itsValid
Definition: DSEllipse.h:124
virtual void draw(PixelCanvas *pix)
General DisplayShape functions.
int Int
Definition: aipstype.h:50
virtual void setDefaultOptions()
Called when def.
virtual casacore::Bool inObject(const casacore::Float &xPos, const casacore::Float &yPos)
Is the supplied point within the DisplayShape?
virtual void setMajorAxis(const casacore::Float &newMajor)
virtual casacore::Vector< casacore::Float > getCenter()
Returns the center of the DisplayShape (x,y).
casacore::Vector< casacore::Float > itsCenter
Definition: DSEllipse.h:121
virtual casacore::Float getMinorAxis()
Functions to set / get the minor and major axis of the ellipse (in pixels).
virtual ~DSEllipse()
virtual void changePoint(const casacore::Vector< casacore::Float > &newPoint)
Changes the closest point to the supplied location to that location.
virtual casacore::Record getOptions()
Get and set options.
casacore::Float itsAngle
Definition: DSEllipse.h:122
Base class defining interface to pixel-based output devices.
Definition: PixelCanvas.h:161
Implementation of a ellipse.
Definition: DSEllipse.h:71
virtual void scale(const casacore::Float &scaleFactor)
Scale the shape about its center by the scaleFactor.
virtual void move(const casacore::Float &dX, const casacore::Float &dY)
virtual void setMinorAxis(const casacore::Float &newMinor)
casacore::Float itsMinorAxis
Definition: DSEllipse.h:123
casacore::Bool itsOneHandle
Definition: DSEllipse.h:124
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
DSClosed provides common functionality for all &quot;closed&quot; shapes.
Definition: DSClosed.h:64
virtual void rotateAbout(const casacore::Float &angle, const casacore::Float &aboutX, const casacore::Float &aboutY)
virtual casacore::Float getMajorAxis()
virtual void calculateHandlePositions()
Required on update.
virtual void rotate(const casacore::Float &angle)
Rotate the shape about its center by a set angle (angle in degrees).
casacore::Matrix< casacore::Float > itsHandleLocation
Definition: DSEllipse.h:126
DSEllipse(const casacore::Bool &onlyShowOneHandle=false)
Constructors and destructors.
casacore::Float itsMajorAxis
Definition: DSEllipse.h:123
virtual void setCenter(const casacore::Float &xPos, const casacore::Float &yPos)
Sets the center of the DisplayShape.