casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QtRegionDock.qo.h
Go to the documentation of this file.
1 //# QtRegionDock.qo.h: dockable Qt implementation of viewer region management
2 //# Copyright (C) 2011, 2012
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 REGION_QTREGIONDOCK_H_
29 #define REGION_QTREGIONDOCK_H_
30 #include <map>
31 #include <list>
32 #include <iostream>
33 #include <display/region/QtRegionDock.ui.h>
38 
39 namespace casa {
40 
41  class QtDisplayData;
42  class QtDisplayPanelGui;
43 
44  namespace viewer {
45 
46  class Region;
47  class QtRegionState;
48  class ds9writer;
49  class Region;
50 
51  class QtRegionDock : public InActiveDock, protected Ui::QtRegionDock {
52  Q_OBJECT
53  public:
54 
55  QtRegionDock( QtDisplayPanelGui *, QWidget* parent=0 );
56  ~QtRegionDock();
57 
58  void addRegion(Region *,QtRegionState*,int index = -1);
59  int indexOf(QtRegionState*) const;
61  void selectRegion(QtRegionState*,bool scroll=true);
62  void updateFrameCount( int count );
63  void status( const std::string &msg, const std::string &type="info" );
64 
66  return dpg;
67  }
68 
69  /* QStackedWidget *regionStack( ) { return regions; } */
70 
71  /* void showStats( const QString &stats ); */
72 
73  std::pair<int,int> &tabState( ) {
74  return current_tab_state;
75  }
76  std::map<std::string,int> &coordState( ) {
77  return current_coord_state;
78  }
79  QString &saveDir( ) {
80  return current_save_dir;
81  }
82  QString &loadDir( ) {
83  return current_load_dir;
84  }
85  int &colorIndex( ) {
86  return current_color_index;
87  }
88 
89  // called to signal that selected region state needs to be updated...
91  // retrieve the selected region state...
92  size_t selectedRegionCount( ) {
93  return selected_region_set_.size( );
94  }
96  return selected_region_set_;
97  }
98  size_t markedRegionCount( ) {
99  return marked_region_set_.size( );
100  }
102  return marked_region_set_;
103  }
106  }
108  bool isWeaklySelectedRegion( const Region * ) const;
111 
112  void dismiss( );
113 
114  std::list<Region*> regions( ) const {
115  return region_list;
116  }
117  // zero length string indicates OK!
118  std::string outputRegions( std::list<viewer::QtRegionState*> regions, std::string file,
119  std::string format, std::string ds9_csys="pixel" );
120 
121  void updateRegionStats( );
126  void updateStackOrder( int topIndex );
127  void emitCreate( Region * );
128 
129  int numFrames( ) const;
130  void deleteRegions( const region::region_list_type & );
131  void revokeRegion( Region *r );
132 
133  signals:
134  // triggers deletion elsewhere of Region containing this QtRegionState
135  // which then causes the removal of this QtRegionState...
137  // notice sent after QtRegionState is removed from QStackWidget,
138  // *and* after Region has already been deleted...
139  // also sent when a region is created (see std::string arg)...
140  void regionChange( viewer::Region *, std::string );
141  void deleteAllRegions();
142  void regionSelected( int id );
143  void saveRegions( std::list<QtRegionState*>, RegionTextList & );
144  void saveRegions( std::list<QtRegionState*>, ds9writer & );
145  void loadRegions( const QString &path, const QString &type );
146 
147  void region_stack_change(QWidget*);
148  void showHistogramTool();
149 
150  public slots:
152  void delete_all_regions( bool );
153  private slots:
154  void stack_changed(int);
155  void change_stack(int);
156  void delete_current_region(bool);
157 
158  void output_region_event(const QString &what, const QString &where, const QString &type, const QString &csys );
159  void handle_visibility(bool);
160  void emit_region_stack_change( int );
161 
162  protected:
163  void enterEvent( QEvent* );
164  void leaveEvent( QEvent* );
165  void closeEvent ( QCloseEvent * event );
166 
167  private:
170  std::pair<int,int> current_tab_state;
171  std::map<std::string,int> current_coord_state;
175  bool dismissed;
177 
178  typedef std::list<Region*> region_list_t;
180  typedef std::map<QtRegionState*,Region*> region_map_t;
182 
183  // maintain a count of selected regions, information which is used
184  // to determine the corner treatment when drawing regions...
188  void update_region_statistics( );
189 
190  };
191  }
192 }
193 
194 #endif
QtDisplayPanelGui * panel()
region::region_list_type selected_region_set_
maintain a count of selected regions, information which is used to determine the corner treatment whe...
std::map< std::string, int > & coordState()
size_t selectedRegionCount()
retrieve the selected region state...
std::map< std::string, int > current_coord_state
An ordered list of annotations and comments representing an ascii region file. &lt;author&gt;Dave Mehringer...
region::region_list_type weakly_selected_region_set_
void revokeRegion(Region *r)
void selectedCountUpdateNeeded()
called to signal that selected region state needs to be updated...
void loadRegions(const QString &path, const QString &type)
virtual Type type()
Return the type enum.
void deleteRegions(const region::region_list_type &)
void addRegion(Region *, QtRegionState *, int index=-1)
QtDisplayPanelGui * dpg
void closeEvent(QCloseEvent *event)
void removeWeaklySelectedRegion(Region *)
QtRegionDock(QtDisplayPanelGui *, QWidget *parent=0)
bool isWeaklySelectedRegion(const Region *) const
const region::region_list_type & selectedRegionSet()
void region_stack_change(QWidget *)
void status(const std::string &msg, const std::string &type="info")
std::string outputRegions(std::list< viewer::QtRegionState * > regions, std::string file, std::string format, std::string ds9_csys="pixel")
zero length string indicates OK!
void deleteRegion(QtRegionState *)
triggers deletion elsewhere of Region containing this QtRegionState which then causes the removal of ...
std::list< Region * > region_list_t
All regions are specified in &quot;linear coordinates&quot;, not &quot;pixel coordinates&quot;.
Definition: Region.qo.h:147
void selectRegion(QtRegionState *, bool scroll=true)
std::map< QtRegionState *, Region * > region_map_t
void regionChange(viewer::Region *, std::string)
notice sent after QtRegionState is removed from QStackWidget, and* after Region has already been dele...
std::string path(const std::string &name)
region::region_list_type marked_region_set_
The main display window for the Qt version of the viewer.
std::list< Region * > regions() const
void saveRegions(std::list< QtRegionState * >, RegionTextList &)
const region::region_list_type & markedRegionSet()
std::pair< int, int > current_tab_state
void output_region_event(const QString &what, const QString &where, const QString &type, const QString &csys)
int indexOf(QtRegionState *) const
void removeRegion(QtRegionState *)
const region::region_list_type & weaklySelectedRegionSet()
void addWeaklySelectedRegion(Region *)
void updateStackOrder(int topIndex)
Allows the images displayed in the region dock to remain in sync with the images selected in the anim...
std::set< Region * > region_list_type
Definition: RegionEnums.h:14
Allows the dock widget z-position to be behind the main window instead of the default behavior of alw...
void updateFrameCount(int count)
std::pair< int, int > & tabState()
void updateRegionState(QtDisplayData *)
Defines nreal time structures used by the VLA table filler.
Definition: nreal.h:100