casa
$Rev:20696$
|
00001 //# MultiPolyToolImpl.h: MultiWorldCanvas event-based polygon 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 DISPLAY_MULTIPOLYTOOLIMPL_H 00029 #define DISPLAY_MULTIPOLYTOOLIMPL_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/Display/WorldCanvas.h> 00039 #include <display/DisplayEvents/MultiPolyTool.h> 00040 #include <display/region/RegionSourceFactory.h> 00041 00042 namespace casa { //# NAMESPACE CASA - BEGIN 00043 00044 // <summary> 00045 // WorldCanvas event-based polygon region drawer 00046 // </summary> 00047 00048 // <use visibility=export> 00049 00050 // <reviewed reviewer="" data="yyyy/mm/dd" tests="" demos=""> 00051 // </reviewed> 00052 00053 // <prerequisites> 00054 // <li> WCRectTool 00055 // </prerequisites> 00056 00057 // <etymology> 00058 // WCPTRegion stands for WorldCanvas Polygon Tool Region 00059 // </etymology> 00060 00061 // <synopsis> 00062 // This class finalises the functionality in WCRectTool to 00063 // implement event-based drawing of polygonal regions on a 00064 // WorldCanvas. Double clicking inside the constructed polygon 00065 // emits the region, whilst pressing Escape cancels the region. 00066 // </synopsis> 00067 00068 // <example> 00069 // </example> 00070 00071 // <motivation> 00072 // Polygonal regions are the most common regions, and constructing 00073 // them visually can be very efficient. 00074 // </motivation> 00075 00076 // <todo asof="1999/02/10"> 00077 // <li> Nothing known 00078 // </todo> 00079 00080 class MultiPolyToolImpl : public MultiPolyTool { 00081 00082 public: 00083 00084 // Constructor 00085 MultiPolyToolImpl(viewer::RegionSourceFactory *rf, PanelDisplay* pd, Display::KeySym keysym = Display::K_Pointer_Button3); 00086 00087 // Destructor 00088 virtual ~MultiPolyToolImpl(); 00089 00090 protected: 00091 00092 // Handle double-click inside the polygon. Invokes regionReady(). 00093 virtual void doubleInside(); 00094 00095 // This function is called when a region is deliberately "finished" 00096 // by the user. It can be implemented to do further actions, such 00097 // as report the region to the application. 00098 virtual void regionReady() { }; 00099 00100 // get the world coords of the current polygon region 00101 void getWorldCoords(Vector<Double> &x, Vector<Double> &y); 00102 00103 // get the linear coords of the current ploygon region 00104 void getLinearCoords(Vector<Double> &x, Vector<Double> &y); 00105 00106 }; 00107 00108 00109 } //# NAMESPACE CASA - END 00110 00111 #endif