casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DDDPolygon.h
Go to the documentation of this file.
1 //# DDDPolygon.h: declaration of DDDPolygon
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_DDDPOLYGON_H
30 #define TRIALDISPLAY_DDDPOLYGON_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 
52 // <summary>
53 // Implementation of aan ellipse object for DrawingDisplayData class.
54 // </summary>
55 
56 // <synopsis>
57 // This class implements the interface defined by DDDObject, to provide
58 // a polygon object for registration with DrawingDisplayData objects.
59 // </synopsis>
60 //
61 // <todo>
62 // Allow vertices to be edited.
63 // </todo>
64 //
65 
66  class DDDPolygon : public DDDObject {
67 
68  public:
69 
70  // Constructor taking a casacore::Record description. Fields in the record,
71  // on top of what is consumed by the DDDObject constructor, are:
72  // Required : <src>x</src> (quantum of vector double) and
73  // <src>y</src> (quantum of vector double).
74  // Other, not required fields are <src>outline & editable</src>
75  // which default to <src>true</src>. When <src>editable=false</src>
76  // the object can be moved but not reshaped, when <src>true</src>
77  // it can be moved and reshaped. When <src>outline=false</src>
78  // the ellipse is filled.
80 
81  // Destructor.
82  virtual ~DDDPolygon();
83 
84  // Draw this rectangle object for the given reason on the provided
85  // WorldCanvas.
86  virtual void draw(const Display::RefreshReason &reason,
87  WorldCanvas *worldcanvas);
88 
89  // Return a record describing this object. Presently returns
90  // only construction description.
91  virtual casacore::Record description();
92 
93  // Update this object based on the information in the provided
94  // Record.
95  virtual void setDescription(const casacore::Record &rec);
96 
97  // Event handlers. The parent DrawingDisplayData will distribute
98  // events as necessary to the various DDDObjects which comprise it.
99  // <group>
100  virtual void operator()(const WCRefreshEvent &/*ev*/) {
101  ;
102  };
103  virtual void operator()(const WCPositionEvent &ev);
104  virtual void operator()(const WCMotionEvent &ev);
105  // </group>
106 
107 
108 
109 
110  protected:
111 
112  // (Required) default constructor.
113  DDDPolygon();
114 
115  // (Required) copy constructor.
116  DDDPolygon(const DDDPolygon &other);
117 
118  // (Required) copy assignment.
119  void operator=(const DDDPolygon &other);
120 
121  private:
122 
123 // Fill style
125 
126 // Define x and y
130 
131 // Rotated Rectangle Corners to draw in screen pixel
133 
134 // casacore::List of handles
135 
137 
138 // Mode.
139 
141 
142 // Store for movement bases.
143 
145 
146 // In function draw(), recompute all pixel coordinates when true
147 // else use what is currently set
148 
150 
151 // LOgger
152 
154 
155 // DisplayCoordinateSystem in screen pixel coordinates
157 
158 // pointer to world canvas (shallow copy)
160 
161 // Fractional indicators
163 
164 // COnvert parameters from world to pixel
165  void convertToPixel ();
166 
167 // Update private world parameters from current pixel values
168  void updateWorldValues ();
169 
170 // Decode record into private data
171  void decode(const casacore::RecordInterface& description, casacore::Bool required);
172 
173 // Encode private data into record
174  void encode(casacore::RecordInterface& description) const;
175 
176 // compute corners of rectangle of bounding box of polygon
177  void createCorners();
178 
179 // create handles, one per vertex
180  void createHandles();
181 
182 
183 // Debugging routines
184 
185  void listWorld();
186  void listPixel();
187 
188  };
189 
190 
191 } //# NAMESPACE CASA - END
192 
193 #endif
194 
virtual casacore::Record description()
Return a record describing this object.
casacore::Vector< casacore::Double > itsPixelX
Definition: DDDPolygon.h:128
DrawingDisplayData * owner()
Return the owner of this object.
Definition: DDDObject.h:131
casacore::Double itsBaseMoveY
Definition: DDDPolygon.h:144
void updateWorldValues()
Update private world parameters from current pixel values.
Class which stores WorldCanvas refresh event information.
void listWorld()
Debugging routines.
DisplayData which provides interactive drawing capabilities.
casacore::Quantum< casacore::Vector< casacore::Double > > itsWorldX
Define x and y.
Definition: DDDPolygon.h:127
WorldCanvas * itsWorldCanvasPtr
pointer to world canvas (shallow copy)
Definition: DDDPolygon.h:159
casacore::Double itsBaseMoveX
Store for movement bases.
Definition: DDDPolygon.h:144
virtual ~DDDPolygon()
Destructor.
virtual void operator()(const WCRefreshEvent &)
Event handlers.
Definition: DDDPolygon.h:100
casacore::Matrix< casacore::Double > itsCorners
Rotated Rectangle Corners to draw in screen pixel.
Definition: DDDPolygon.h:132
ostream-like interface to creating log messages.
Definition: LogIO.h:167
void convertToPixel()
COnvert parameters from world to pixel.
void decode(const casacore::RecordInterface &description, casacore::Bool required)
Decode record into private data.
virtual void setDescription(const casacore::Record &rec)
Update this object based on the information in the provided Record.
casacore::Block< DDDHandle > itsHandles
casacore::List of handles
Definition: DDDPolygon.h:136
DisplayCoordinateSystem itsCoordinateSystem
DisplayCoordinateSystem in screen pixel coordinates.
Definition: DDDPolygon.h:156
casacore::Bool itsRecompute
In function draw(), recompute all pixel coordinates when true else use what is currently set...
Definition: DDDPolygon.h:149
virtual void draw(const Display::RefreshReason &reason, WorldCanvas *worldcanvas)
Draw this rectangle object for the given reason on the provided WorldCanvas.
Class which stores WorldCanvas motion event information.
Definition: WCMotionEvent.h:79
Implementation of aan ellipse object for DrawingDisplayData class.
Definition: DDDPolygon.h:66
double Double
Definition: aipstype.h:55
void createCorners()
compute corners of rectangle of bounding box of polygon
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
casacore::Quantum< casacore::Vector< casacore::Double > > itsWorldY
Definition: DDDPolygon.h:127
DDDPolygon()
(Required) default constructor.
casacore::LogIO itsLogger
LOgger.
Definition: DDDPolygon.h:153
casacore::uInt itsNPoints
Definition: DDDPolygon.h:129
casacore::Vector< casacore::Double > itsPixelY
Definition: DDDPolygon.h:128
void createHandles()
create handles, one per vertex
DDDObject::Mode itsMode
Mode.
Definition: DDDPolygon.h:140
Quantities (i.e. dimensioned values)
Definition: QuantumHolder.h:44
void operator=(const DDDPolygon &other)
(Required) copy assignment.
casacore::Bool itsFracY
Definition: DDDPolygon.h:162
simple 1-D array
RefreshReason
Callback reasons for PCRefreshEvent and WCRefreshEvent.
Definition: DisplayEnums.h:267
Class which stores WorldCanvas position event information.
Implementation of drawing in world coordinates on top of a PixelCanvas.
Definition: WorldCanvas.h:204
casacore::Bool itsOutline
Fill style.
Definition: DDDPolygon.h:124
Abstract base class for Record classes.
void encode(casacore::RecordInterface &description) const
Encode private data into record.
casacore::Bool itsFracX
Fractional indicators.
Definition: DDDPolygon.h:162
unsigned int uInt
Definition: aipstype.h:51
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42