casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DDDEllipse.h
Go to the documentation of this file.
1 //# DDDEllipse.h: declaration of ellipse DDDObject
2 //# Copyright (C) 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 
29 #ifndef TRIALDISPLAY_DDDELLIPSE_H
30 #define TRIALDISPLAY_DDDELLIPSE_H
31 
32 #include <casa/aips.h>
33 #include <casa/Arrays/Vector.h>
34 #include <casa/Arrays/Matrix.h>
35 #include <casa/Containers/Record.h>
36 #include <casa/Containers/Block.h>
37 #include <casa/Logging/LogIO.h>
38 #include <casa/Quanta/Quantum.h>
39 #include <casa/Quanta/Unit.h>
43 
44 namespace casacore{
45 
46  class LogIO;
47 }
48 
49 namespace casa { //# NAMESPACE CASA - BEGIN
50 
51  class DisplayEvent;
52 
53 // <summary>
54 // Implementation of an ellipse/rectangle object for DrawingDisplayData class.
55 // </summary>
56 
57 // <synopsis>
58 // This class implements the interface defined by DDDObject, to provide
59 // an ellipse or rectangle object for registration with DrawingDisplayData objects.
60 // The widths are all full widths.
61 // </synopsis>
62 //
63 // <todo>
64 // Create a drawEllipse function on the world canvas and move
65 // intelligence from here to there.
66 // </todo>
67 //
68 
69  class DDDEllipse : public DDDObject {
70 
71  public:
72 
73  // Constructor taking a casacore::Record description. Fields in the record,
74  // on top of what is consumed by the DDDObject constructor, are:
75  // Required : <src>center</src> (vector of quanta length 2),
76  // <src>major, minor, positionangle</src> (all quanta).
77  //
78  // Units 'frac' ([0->1]) are available for the center only.
79  // Units 'pix' (absolute 0-rel image pixels) are available for the
80  // major and minor only.
81  //
82  // Other, not required fields are <src>outline & editable</src>
83  // which default to <src>true</src>. When <src>editable=false</src>
84  // the object can be moved but not reshaped, when <src>true</src>
85  // it can be moved and reshaped. When <src>outline=false</src>
86  // the ellipse is filled. If the field <src>rectangle=true</src>
87  // a rectangle is drawn. If it does not exist or is false, an ellipse
88  // is drawn.
89  //
90  // Finally, field <src>doreference</src> which defaults to <src>false</src>
91  // is used to control the location at which conversions to and from
92  // pixel coordinates are done. If <src>true</src> then all conversions
93  // are done at the reference value. Otherwise, the conversions are
94  // done at the actual location of the shape. For example, with
95  // a casacore::DirectionCoordinate plane, setting <src>doreference=true</src>
96  // will cause the shape to rotate as you move it about the display
97  // as the position angle tracks the local North.
99 
100  // Destructor.
101  virtual ~DDDEllipse();
102 
103  // Draw this object for the given reason on the provided
104  // WorldCanvas.
105  virtual void draw(const Display::RefreshReason &reason,
106  WorldCanvas *worldcanvas);
107 
108  // Return a record describing this object. Presently returns
109  // only construction description.
110  virtual casacore::Record description();
111 
112  // Update this object based on the information in the provided
113  // Record.
114  virtual void setDescription(const casacore::Record &rec);
115 
116  // Event handlers. The parent DrawingDisplayData will distribute
117  // events as necessary to the various DDDObjects which comprise it.
118  // <group>
119  virtual void operator()(const WCRefreshEvent &ev);
120  virtual void operator()(const WCPositionEvent &ev);
121  virtual void operator()(const WCMotionEvent &ev);
122  // </group>
123 
124  protected:
125 
126  // (Required) default constructor.
127  DDDEllipse();
128 
129  // (Required) copy constructor.
130  DDDEllipse(const DDDEllipse &other);
131 
132  // (Required) copy assignment.
133  void operator=(const DDDEllipse &other);
134 
135  private:
136 
137 // Fill style
139 
140 // Define center x, center y, major, minor, pa in world
142 
143 // Define center x, center y, major, minor, pa (radians) in screen pixel
145 
146 // Rotated Rectangle Corners to draw in screen pixel
149 
150 // casacore::List of handles
151 
153 
154 // Mode.
155 
157 
158 // Store for movement bases.
159 
161 
162 // Logger
163 
165 
166 // DisplayCoordinateSystem in screen pixel coordinates
168 
169 // pointer to world canvas (shallow copy)
171 
172 // are we drawing a rectangle or an ellipse ?
174 
175 // Fractional indicators
177 
178 // Do world/pixel conversions at reference location ?
180 
181 // COnvert parameters from world to pixel
182  void convertToPixel ();
183 
184 // Update private world parameters from current pixel values
185  void updateWorldValues ();
186 
187 // Decode record into private data
188 
189  void decode(const casacore::RecordInterface& description, casacore::Bool required);
190 
191 // Encode private data into record
192  void encode(casacore::RecordInterface& description) const;
193 
194 // compute corners of rectangle
195  void createCorners();
196 
198 
199 // Debugging routines
200 
201  void listWorld();
202  void listPixel();
203 
204  };
205 
206 
207 } //# NAMESPACE CASA - END
208 
209 #endif
casacore::Block< DDDHandle > itsHandles
casacore::List of handles
Definition: DDDEllipse.h:152
A 1-D Specialization of the Array class.
DrawingDisplayData * owner()
Return the owner of this object.
Definition: DDDObject.h:131
casacore::LogIO itsLogger
Logger.
Definition: DDDEllipse.h:164
casacore::Bool itsDoRef
Do world/pixel conversions at reference location ?
Definition: DDDEllipse.h:179
Class which stores WorldCanvas refresh event information.
void operator=(const DDDEllipse &other)
(Required) copy assignment.
void decode(const casacore::RecordInterface &description, casacore::Bool required)
Decode record into private data.
void convertToPixel()
COnvert parameters from world to pixel.
casacore::Vector< casacore::Double > itsPixelShape
Definition: DDDEllipse.h:144
DisplayData which provides interactive drawing capabilities.
casacore::Bool itsRectangle
are we drawing a rectangle or an ellipse ?
Definition: DDDEllipse.h:173
WorldCanvas * itsWorldCanvasPtr
pointer to world canvas (shallow copy)
Definition: DDDEllipse.h:170
ostream-like interface to creating log messages.
Definition: LogIO.h:167
casacore::Vector< casacore::Double > itsPixelCenter
Define center x, center y, major, minor, pa (radians) in screen pixel.
Definition: DDDEllipse.h:144
Implementation of an ellipse/rectangle object for DrawingDisplayData class.
Definition: DDDEllipse.h:69
casacore::Matrix< casacore::Double > itsCorners
Rotated Rectangle Corners to draw in screen pixel.
Definition: DDDEllipse.h:147
void encode(casacore::RecordInterface &description) const
Encode private data into record.
virtual void draw(const Display::RefreshReason &reason, WorldCanvas *worldcanvas)
Draw this object for the given reason on the provided WorldCanvas.
virtual ~DDDEllipse()
Destructor.
casacore::Bool itsFracX
Fractional indicators.
Definition: DDDEllipse.h:176
casacore::Double itsBaseMoveX
Store for movement bases.
Definition: DDDEllipse.h:160
Class which stores WorldCanvas motion event information.
Definition: WCMotionEvent.h:79
double Double
Definition: aipstype.h:55
casacore::Double itsBaseMoveY
Definition: DDDEllipse.h:160
virtual void operator()(const WCRefreshEvent &ev)
Event handlers.
casacore::Bool itsFracY
Definition: DDDEllipse.h:176
Base class describing interface for objects supported by DrawingDisplayData.
Definition: DDDObject.h:62
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
DisplayCoordinateSystem itsCoordinateSystem
DisplayCoordinateSystem in screen pixel coordinates.
Definition: DDDEllipse.h:167
void listWorld()
Debugging routines.
simple 1-D array
virtual void setDescription(const casacore::Record &rec)
Update this object based on the information in the provided Record.
RefreshReason
Callback reasons for PCRefreshEvent and WCRefreshEvent.
Definition: DisplayEnums.h:267
Class which stores WorldCanvas position event information.
DDDObject::Mode itsMode
Mode.
Definition: DDDEllipse.h:156
virtual casacore::Record description()
Return a record describing this object.
Implementation of drawing in world coordinates on top of a PixelCanvas.
Definition: WorldCanvas.h:204
DDDEllipse()
(Required) default constructor.
void createCorners()
compute corners of rectangle
casacore::Bool itsOutline
Fill style.
Definition: DDDEllipse.h:138
casacore::Matrix< casacore::Double > itsPixelOffsets
Definition: DDDEllipse.h:148
casacore::Vector< casacore::Quantum< casacore::Double > > itsWorldParameters
Define center x, center y, major, minor, pa in world.
Definition: DDDEllipse.h:141
Abstract base class for Record classes.
casacore::Matrix< casacore::Int > toIntPixel(const casacore::Matrix< casacore::Double > &points)
void updateWorldValues()
Update private world parameters from current pixel values.
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42