casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RegionToolManager.qo.h
Go to the documentation of this file.
1 //# RegionToolManager.qo.h: class designed to unify the behavior of all of the mouse tools
2 //# Copyright (C) 2011
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_TOOLMANAGER_H__
29 #define DISPLAY_TOOLMANAGER_H__
30 
31 #include <QObject>
34 
40 
41 namespace casa {
42 
43  /* class QtMWCTool; */
44  class QtMouseTool;
45  class QtRectTool;
46 
47  namespace viewer {
48 
49  // the RegionCreator class now has static members which allow for the
50  // retrieval of lists of RegionCreator objects for creating each type
51  // of region (currently rectangle, polygon, ellipse, and point).
52  class RegionToolManager : public QObject, public WCPositionEH, public WCMotionEH, public WCRefreshEH {
53  Q_OBJECT
54  public:
55 
57 
58 
61 
62  // Required operators for event handling - these are called when
63  // events occur, and distribute the events to the "user-level"
64  // methods
65  // <group>
66  void operator()(const WCPositionEvent& ev);
67  void operator()(const WCMotionEvent& ev);
68  void operator()(const WCRefreshEvent& ev);
69  // </group>
70 
71  void loadRegions( const std::string &path, const std::string &type );
72 
73  // fetch tool for a particular region type...
74  std::shared_ptr<RegionTool> tool( region::RegionTypes );
75 
76  private:
77 
79  return type == RegionTool::POLYTOOL ? region::SelectPoly :
84  }
85 
86  typedef std::pair<double,double> linear_point_type;
88  typedef std::map<ToolTypes,std::shared_ptr<RegionTool> > tool_map;
90 
91  // members for keeping track of marked (sticky-selected) regions...
92  /* region_list_type marked_regions; */
93 
94  // members for state when moving selected region...
95  bool inDrawArea( WorldCanvas *wc, const linear_point_type &new_blc, const linear_point_type &new_trc ) const;
100 
101  // members for state when moving a region handle...
105 
106  // returns new region marked state...
110  void setup_moving_regions_state( double linx, double liny, const region::region_list_type & );
111  void translate_moving_regions( WorldCanvas *wc, double dx, double dy );
113 
114  // region source factory is needed to retrieve the region dock
115  // which can provide a list of selected regions...
118 
119  };
120  }
121 }
122 
123 
124 #endif
std::map< ToolTypes, std::shared_ptr< RegionTool > > tool_map
Class which stores WorldCanvas refresh event information.
void translate_moving_regions(WorldCanvas *wc, double dx, double dy)
region::RegionSelect tool_to_select(RegionTool::RegionToolTypes type) const
bool process_double_click(RegionTool::State &state, region::RegionSelect)
Base class for handling WorldCanvas motion events.
Definition: WCMotionEH.h:70
virtual Type type()
Return the type enum.
void setup_moving_regions_state(double linx, double liny, const region::region_list_type &)
viewer::region::PointInfo moving_handle_info
void clear_mark_select(RegionTool::State &state, region::RegionSelect)
bool add_mark_select(RegionTool::State &state, region::RegionSelect)
returns new region marked state...
Base class for handling WorldCanvas refresh events.
Definition: WCRefreshEH.h:95
All regions are specified in &quot;linear coordinates&quot;, not &quot;pixel coordinates&quot;.
Definition: Region.qo.h:147
Class which stores WorldCanvas motion event information.
Definition: WCMotionEvent.h:79
region::region_list_type moving_regions
std::string path(const std::string &name)
The main display window for the Qt version of the viewer.
std::shared_ptr< RegionTool > tool(region::RegionTypes)
fetch tool for a particular region type...
bool moving_handle
members for state when moving a region handle...
QtRegionSourceFactory * factory
region source factory is needed to retrieve the region dock which can provide a list of selected regi...
Class which stores WorldCanvas position event information.
bool inDrawArea(WorldCanvas *wc, const linear_point_type &new_blc, const linear_point_type &new_trc) const
members for keeping track of marked (sticky-selected) regions...
Implementation of drawing in world coordinates on top of a PixelCanvas.
Definition: WorldCanvas.h:204
RegionToolManager(QtRegionSourceFactory *rsf, QtDisplayPanelGui *dpg, PanelDisplay *pd)
std::pair< double, double > linear_point_type
A class which creates and manages &quot;panelled&quot; displays.
Definition: PanelDisplay.h:79
void loadRegions(const std::string &path, const std::string &type)
Base class for handling WorldCanvas position events.
Definition: WCPositionEH.h:75
std::set< Region * > region_list_type
Definition: RegionEnums.h:14
void operator()(const WCPositionEvent &ev)
Required operators for event handling - these are called when events occur, and distribute the events...
bool setup_moving_regions(RegionTool::State &state, region::RegionSelect)
the RegionCreator class now has static members which allow for the retrieval of lists of RegionCreato...