casa
$Rev:20696$
|
00001 //# MultiRectToolImpl.h: WorldCanvas event-based rectangle region drawer 00002 //# Copyright (C) 1999,2000,2001,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_MULTIRECTTOOLIMPL_H 00029 #define TRIALDISPLAY_MULTIRECTTOOLIMPL_H 00030 00031 //# aips includes 00032 #include <casa/aips.h> 00033 #include <casa/Arrays/Vector.h> 00034 00035 //# trial includes 00036 00037 //# display library includes 00038 #include <display/DisplayEvents/MultiRectTool.h> 00039 #include <display/region/RegionSourceFactory.h> 00040 00041 namespace casa { //# NAMESPACE CASA - BEGIN 00042 00043 // <summary> 00044 // WorldCanvas event-based rectangle region drawer 00045 // </summary> 00046 00047 // <use visibility=export> 00048 00049 // <reviewed reviewer="" data="yyyy/mm/dd" tests="" demos=""> 00050 // </reviewed> 00051 00052 // <prerequisites> 00053 // <li> MWCRectTool 00054 // </prerequisites> 00055 00056 // <etymology> 00057 // MultiRectToolImpl stands for MultiWorldCanvas Rectangle Tool Region 00058 // </etymology> 00059 00060 // <synopsis> 00061 // Why this "finalization" is required is beyond me... i.e. why not 00062 // roll this functionality into the parent class?? 00063 // <drs> Thu Aug 18 20:13:53 UTC 2011 00064 // ------------------------------------------------------------------------ 00065 // This class finalises the functionality in MWCRectTool to 00066 // implement event-based drawing of rectangular regions on a 00067 // WorldCanvas. Double clicking inside the constructed rectangle 00068 // emits the region, whilst pressing Escape cancels the region. 00069 // </synopsis> 00070 00071 // <example> 00072 // </example> 00073 00074 // <motivation> 00075 // Rectangular regions are the most common regions, and constructing 00076 // them visually can be very efficient. 00077 // </motivation> 00078 00079 // <todo asof="1999/02/10"> 00080 // <li> Nothing known 00081 // </todo> 00082 00083 class MultiRectToolImpl : public MultiRectTool { 00084 00085 public: 00086 00087 // Constructor 00088 MultiRectToolImpl(viewer::RegionSourceFactory *rf, PanelDisplay* pd, Display::KeySym keysym = Display::K_Pointer_Button2); 00089 00090 // Destructor 00091 virtual ~MultiRectToolImpl(); 00092 00093 // handle events, via new-style interface. Currently just for reset event. 00094 virtual void handleEvent(DisplayEvent& ev); 00095 00096 protected: 00097 00098 // Handle double-click inside the rectangle. Invokes regionReady(). 00099 virtual void doubleInside(); 00100 00101 // This function is called when a region is deliberately "finished" 00102 // by the user. It can be implemented to do further actions, such 00103 // as report the region to the application 00104 virtual void regionReady() { }; 00105 00106 // get the world coords of the current rectangular region 00107 void getWorldCoords(Vector<Double> &blc, Vector<Double> &trc); 00108 00109 // get the linear coords of the current rectangular region 00110 void getLinearCoords(Vector<Double> &blc, Vector<Double> &trc); 00111 00112 }; 00113 00114 00115 } //# NAMESPACE CASA - END 00116 00117 #endif