casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
MultiEllipseTool.h
Go to the documentation of this file.
00001 //# MultiEllipseTool.h: Base class for MultiWorldCanvas event-based rectangle tools
00002 //# Copyright (C) 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_MULTIELLIPSETOOL_H
00029 #define DISPLAY_MULTIELLIPSETOOL_H
00030 
00031 #include <list>
00032 #include <casa/aips.h>
00033 #include <display/DisplayEvents/MultiRectTool.h>
00034 
00035 namespace casa { //# NAMESPACE CASA - BEGIN
00036 
00037 // <summary>
00038 // Base class for MultiWorldCanvas event-based rectangle tools
00039 // </summary>
00040 //
00041 // <use visibility=export>
00042 //
00043 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00044 // </reviewed>
00045 //
00046 // <prerequisites>
00047 //   <li> WCTool
00048 // </prerequisites>
00049 //
00050 // <etymology>
00051 // MultiEllipseTool stands for MultiWorldCanvas Rectangle Tool
00052 // </etymology>
00053 //
00054 // <synopsis>
00055 // This class adds to its base WCTool to provide a tool for drawing,
00056 // resizing and moving rectangles on a WorldCanvas.  While MultiEllipseTool
00057 // is not abstract, it performs no useful function.  The programmer
00058 // should derive from this class, and implement the functions
00059 // doubleInside and doubleOutside, which are called when the user
00060 // double-clicks the key or mouse button inside or outside an existing
00061 // rectangle respectively.  It is up to the programmer to decide what
00062 // double clicks inside and outside the rectangle correspond to,
00063 // although it is recommended that a double click inside correspond to
00064 // the main action of the tool, and a double click outside correspond
00065 // to a secondary action of the tool, if indeed a secondary action
00066 // exists.
00067 //
00068 // The rectangle is drawn by dragging the mouse from one corner to 
00069 // the diagonally opposite corner.  Once constructed, the rectangle
00070 // can be resized by dragging its corners, or relocated by dragging
00071 // inside the rectangle.  The rectangle is removed from the display 
00072 // when the Esc key is pressed.
00073 // </synopsis>
00074 //
00075 // <example>
00076 // </example>
00077 //
00078 // <motivation>
00079 // Many activities on the WorldCanvas will be based on the user drawing 
00080 // a rectangle, and then proceeding to some action with that rectangle.
00081 // A nice example is zooming.
00082 // </motivation>
00083 
00084     class MultiEllipseTool : public MultiRectTool {
00085   
00086         public:
00087   
00088             // Constructor
00089             MultiEllipseTool( viewer::RegionSourceFactory *rsf, PanelDisplay* pd,
00090                               Display::KeySym keysym = Display::K_Pointer_Button1, const Bool persistent = False ) :
00091                         MultiRectTool( rsf, pd, keysym, persistent ) { }
00092   
00093             // Destructor
00094             virtual ~MultiEllipseTool() { }
00095   
00096             // returns a set which indicates regions this creator creates...
00097             const std::set<viewer::region::RegionTypes> &regionsCreated( ) const;
00098 
00099             RegionToolTypes type( ) const { return ELLIPSETOOL; }
00100 
00101         protected:
00102 
00103                 bool checkType( viewer::region::RegionTypes t ) { return t == viewer::region::EllipseRegion; }
00104             virtual std::tr1::shared_ptr<viewer::Rectangle> allocate_region( WorldCanvas *wc, double x1, double y1, double x2, double y2, VOID *region_specific_state ) const;
00105 
00106     };
00107 
00108 } //# NAMESPACE CASA - END
00109 
00110 #endif