casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RectRegionEvent.h
Go to the documentation of this file.
1 //# RectRegionEvent.h: class for rectangle region selection event
2 //# Copyright (C) 1993,1994,1995,1996,1998,1999,2000,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_RECTREGIONEVENT_H
29 #define TRIALDISPLAY_RECTREGIONEVENT_H
30 
31 #include <casa/aips.h>
33 #include <casa/Arrays/Vector.h>
34 #include <casa/BasicMath/Math.h>
35 
36 namespace casa { //# NAMESPACE CASA - BEGIN
37 
38  class WorldCanvas;
39 
40 // <summary>
41 // Contains info on the WC rectanglar area selected by MWCRTRegion mouse tool
42 // </summary>
43 
44 // <use visibility=export>
45 
46 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
47 // </reviewed>
48 
49 // <etymology>
50 // "RectRegionEvent" holds information about a rectangular 'region' selected
51 // by the user with the MWCRTRegion mouse tool.
52 // NB: glish uses the term 'pseudoregion' instead to refer areas selected
53 // by MWCRTRegion et. al. In the context of Image Analysis, 'Region'
54 // refers to a more complex object, which may be assembled from
55 // multiple pseudoregions.
56 // </etymology>
57 
58 // <synopsis>
59 // RectRegionEvent is created by the
60 // <linkto class="MWCRTRegion">MWCRTRegion</linkto> display library
61 // mouse tool, when a rectangular area is selected by it on a
62 // <linkto class="WorldCanvas">WorldCanvas</linkto> where the
63 // tool is active. The event is passed (via WorldCanvas::sendEvent())
64 // to the generic <linkto class="DisplayEH">DisplayEH</linkto>s
65 // registered with that WorldCanvas.
66 // </synopsis>
67 
68 // <motivation>
69 // A mechanism was needed to notify library objects associated with a
70 // WorldCanvas (in particular,
71 // <linkto class="DisplayData">DisplayData</linkto>s) when a rectangular
72 // region was selected on the WC via MWCRTRegion. Formerly, this information
73 // was sent only to glish. This event is on a different level from the
74 // mouse/keyboard WorldCanvasEvents and serves a different purpose,
75 // so a new event type was created.
76 // </motivation>
77 
78 // <thrown>
79 // None.
80 // </thrown>
81 
82 // <todo asof="1999/10/15">
83 // None.
84 // </todo>
85 
87 
88  public:
89 
90  // Constructor taking a pointer to the WorldCanvas where the
91  // event occured, and the pixel coordinates of the rectangle.
93  const casacore::Int pixX1, const casacore::Int pixY1,
94  const casacore::Int pixX2, const casacore::Int pixY2) :
95 
96  WorldCanvasEvent(wc),
97  itsPixBlc(2), itsPixTrc(2) {
98 
99  itsPixBlc(0) = std::min(pixX1, pixX2);
100  itsPixTrc(0) = std::max(pixX1, pixX2); // sort into top-right
101  itsPixBlc(1) = std::min(pixY1, pixY2); // and and bottom-left corners.
102  itsPixTrc(1) = std::max(pixY1, pixY2);
103  }
104 
105  // The corners of the selected rectangle, in screen pixel coordinates.
106  // <group>
107  virtual const casacore::Vector<casacore::Int> pixBlc() const {
108  return itsPixBlc;
109  }
110  virtual const casacore::Vector<casacore::Int> pixTrc() const {
111  return itsPixTrc;
112  }
113  // </group>
114 
115  private:
116 
117  // pixel position of the rectangle
119 
120  };
121 
122 
123 } //# NAMESPACE CASA - END
124 
125 #endif
126 
127 
int Int
Definition: aipstype.h:50
Contains info on the WC rectanglar area selected by MWCRTRegion mouse tool.
#define max(a, b)
Definition: hio.h:44
#define min(a, b)
Definition: hio.h:45
virtual const casacore::Vector< casacore::Int > pixBlc() const
The corners of the selected rectangle, in screen pixel coordinates.
Implementation of drawing in world coordinates on top of a PixelCanvas.
Definition: WorldCanvas.h:204
RectRegionEvent(WorldCanvas *wc, const casacore::Int pixX1, const casacore::Int pixY1, const casacore::Int pixX2, const casacore::Int pixY2)
Constructor taking a pointer to the WorldCanvas where the event occured, and the pixel coordinates of...
casacore::Vector< casacore::Int > itsPixTrc
casacore::Vector< casacore::Int > itsPixBlc
pixel position of the rectangle
virtual const casacore::Vector< casacore::Int > pixTrc() const
Base class describing event information for WorldCanvases.