casa
$Rev:20696$
|
00001 //# RectRegionEvent.h: class for rectangle region selection event 00002 //# Copyright (C) 1993,1994,1995,1996,1998,1999,2000,2002 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# $Id$ 00027 00028 #ifndef TRIALDISPLAY_RECTREGIONEVENT_H 00029 #define TRIALDISPLAY_RECTREGIONEVENT_H 00030 00031 #include <casa/aips.h> 00032 #include <display/DisplayEvents/WorldCanvasEvent.h> 00033 #include <casa/Arrays/Vector.h> 00034 #include <casa/BasicMath/Math.h> 00035 00036 namespace casa { //# NAMESPACE CASA - BEGIN 00037 00038 class WorldCanvas; 00039 00040 // <summary> 00041 // Contains info on the WC rectanglar area selected by MWCRTRegion mouse tool 00042 // </summary> 00043 00044 // <use visibility=export> 00045 00046 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00047 // </reviewed> 00048 00049 // <etymology> 00050 // "RectRegionEvent" holds information about a rectangular 'region' selected 00051 // by the user with the MWCRTRegion mouse tool. 00052 // NB: glish uses the term 'pseudoregion' instead to refer areas selected 00053 // by MWCRTRegion et. al. In the context of Image Analysis, 'Region' 00054 // refers to a more complex object, which may be assembled from 00055 // multiple pseudoregions. 00056 // </etymology> 00057 00058 // <synopsis> 00059 // RectRegionEvent is created by the 00060 // <linkto class="MWCRTRegion">MWCRTRegion</linkto> display library 00061 // mouse tool, when a rectangular area is selected by it on a 00062 // <linkto class="WorldCanvas">WorldCanvas</linkto> where the 00063 // tool is active. The event is passed (via WorldCanvas::sendEvent()) 00064 // to the generic <linkto class="DisplayEH">DisplayEH</linkto>s 00065 // registered with that WorldCanvas. 00066 // </synopsis> 00067 00068 // <motivation> 00069 // A mechanism was needed to notify library objects associated with a 00070 // WorldCanvas (in particular, 00071 // <linkto class="DisplayData">DisplayData</linkto>s) when a rectangular 00072 // region was selected on the WC via MWCRTRegion. Formerly, this information 00073 // was sent only to glish. This event is on a different level from the 00074 // mouse/keyboard WorldCanvasEvents and serves a different purpose, 00075 // so a new event type was created. 00076 // </motivation> 00077 00078 // <thrown> 00079 // None. 00080 // </thrown> 00081 00082 // <todo asof="1999/10/15"> 00083 // None. 00084 // </todo> 00085 00086 class RectRegionEvent : public WorldCanvasEvent { 00087 00088 public: 00089 00090 // Constructor taking a pointer to the WorldCanvas where the 00091 // event occured, and the pixel coordinates of the rectangle. 00092 RectRegionEvent(WorldCanvas *wc, 00093 const Int pixX1, const Int pixY1, 00094 const Int pixX2, const Int pixY2) : 00095 00096 WorldCanvasEvent(wc), 00097 itsPixBlc(2), itsPixTrc(2) { 00098 00099 itsPixBlc(0) = min(pixX1, pixX2); 00100 itsPixTrc(0) = max(pixX1, pixX2); // sort into top-right 00101 itsPixBlc(1) = min(pixY1, pixY2); // and and bottom-left corners. 00102 itsPixTrc(1) = max(pixY1, pixY2); } 00103 00104 // The corners of the selected rectangle, in screen pixel coordinates. 00105 // <group> 00106 virtual const Vector<Int> pixBlc() const { return itsPixBlc; } 00107 virtual const Vector<Int> pixTrc() const { return itsPixTrc; } 00108 // </group> 00109 00110 private: 00111 00112 // pixel position of the rectangle 00113 Vector<Int> itsPixBlc, itsPixTrc; 00114 00115 }; 00116 00117 00118 } //# NAMESPACE CASA - END 00119 00120 #endif 00121 00122