casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MultiEllipseTool.h
Go to the documentation of this file.
1 //# MultiEllipseTool.h: Base class for MultiWorldCanvas event-based rectangle tools
2 //# Copyright (C) 2000,2001,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 DISPLAY_MULTIELLIPSETOOL_H
29 #define DISPLAY_MULTIELLIPSETOOL_H
30 
31 #include <list>
32 #include <casa/aips.h>
34 
35 namespace casa { //# NAMESPACE CASA - BEGIN
36 
37 // <summary>
38 // Base class for MultiWorldCanvas event-based rectangle tools
39 // </summary>
40 //
41 // <use visibility=export>
42 //
43 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
44 // </reviewed>
45 //
46 // <prerequisites>
47 // <li> WCTool
48 // </prerequisites>
49 //
50 // <etymology>
51 // MultiEllipseTool stands for MultiWorldCanvas Rectangle Tool
52 // </etymology>
53 //
54 // <synopsis>
55 // This class adds to its base WCTool to provide a tool for drawing,
56 // resizing and moving rectangles on a WorldCanvas. While MultiEllipseTool
57 // is not abstract, it performs no useful function. The programmer
58 // should derive from this class, and implement the functions
59 // doubleInside and doubleOutside, which are called when the user
60 // double-clicks the key or mouse button inside or outside an existing
61 // rectangle respectively. It is up to the programmer to decide what
62 // double clicks inside and outside the rectangle correspond to,
63 // although it is recommended that a double click inside correspond to
64 // the main action of the tool, and a double click outside correspond
65 // to a secondary action of the tool, if indeed a secondary action
66 // exists.
67 //
68 // The rectangle is drawn by dragging the mouse from one corner to
69 // the diagonally opposite corner. Once constructed, the rectangle
70 // can be resized by dragging its corners, or relocated by dragging
71 // inside the rectangle. The rectangle is removed from the display
72 // when the Esc key is pressed.
73 // </synopsis>
74 //
75 // <example>
76 // </example>
77 //
78 // <motivation>
79 // Many activities on the WorldCanvas will be based on the user drawing
80 // a rectangle, and then proceeding to some action with that rectangle.
81 // A nice example is zooming.
82 // </motivation>
83 
85 
86  public:
87 
88  // Constructor
90  Display::KeySym keysym = Display::K_Pointer_Button1, const casacore::Bool persistent = false ) :
91  MultiRectTool( rsf, pd, keysym, persistent ) { }
92 
93  // Destructor
94  virtual ~MultiEllipseTool() { }
95 
96  // returns a set which indicates regions this creator creates...
97  const std::set<viewer::region::RegionTypes> &regionsCreated( ) const;
98 
99  RegionToolTypes type( ) const {
100  return ELLIPSETOOL;
101  }
102 
103  protected:
104 
106  return t == viewer::region::EllipseRegion;
107  }
108  virtual std::shared_ptr<viewer::Rectangle> allocate_region( WorldCanvas *wc, double x1, double y1, double x2, double y2, VOID *region_specific_state ) const;
109 
110  };
111 
112 } //# NAMESPACE CASA - END
113 
114 #endif
RegionToolTypes type() const
MultiEllipseTool(viewer::RegionSourceFactory *rsf, PanelDisplay *pd, Display::KeySym keysym=Display::K_Pointer_Button1, const casacore::Bool persistent=false)
Constructor.
virtual std::shared_ptr< viewer::Rectangle > allocate_region(WorldCanvas *wc, double x1, double y1, double x2, double y2, VOID *region_specific_state) const
bool checkType(viewer::region::RegionTypes t)
Definition: VOID.h:32
virtual ~MultiEllipseTool()
Destructor.
const std::set< viewer::region::RegionTypes > & regionsCreated() const
returns a set which indicates regions this creator creates...
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
Base class for MultiWorldCanvas event-based rectangle tools.
Base class for MultiWorldCanvas event-based rectangle tools.
Definition: MultiRectTool.h:92
Implementation of drawing in world coordinates on top of a PixelCanvas.
Definition: WorldCanvas.h:204
A class which creates and manages &quot;panelled&quot; displays.
Definition: PanelDisplay.h:79
KeySym
Keysyms for PixelCanvas keyboard events.
Definition: DisplayEnums.h:412