casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QtRegionManager.qo.h
Go to the documentation of this file.
1 //# QtRegionManager.qo.h: Qt implementation of viewer region manager window.
2 //# (This is the gui part only; it connects to region functions within
3 //# QtDisplayPanel).
4 //# Copyright (C) 2005
5 //# Associated Universities, Inc. Washington DC, USA.
6 //#
7 //# This library is free software; you can redistribute it and/or modify it
8 //# under the terms of the GNU Library General Public License as published by
9 //# the Free Software Foundation; either version 2 of the License, or (at your
10 //# option) any later version.
11 //#
12 //# This library is distributed in the hope that it will be useful, but WITHOUT
13 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
15 //# License for more details.
16 //#
17 //# You should have received a copy of the GNU Library General Public License
18 //# along with this library; if not, write to the Free Software Foundation,
19 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
20 //#
21 //# Correspondence concerning AIPS++ should be addressed as follows:
22 //# Internet email: aips2-request@nrao.edu.
23 //# Postal address: AIPS++ Project Office
24 //# National Radio Astronomy Observatory
25 //# 520 Edgemont Road
26 //# Charlottesville, VA 22903-2475 USA
27 //#
28 //# $Id$
29 
30 #ifndef QTREGIONMANAGER_H
31 #define QTREGIONMANAGER_H
32 
33 #include <casa/aips.h>
34 #include <list>
37 
38 #include <graphics/X11/X_enter.h>
39 #include <QtCore>
40 #include <QtGui>
41 #include <QHash>
42 //#dk Be careful to put *.ui.h within X_enter/exit bracket too,
43 //# because they'll have Qt includes.
44 //# E.g. <QApplication> needs the X11 definition of 'Display'
45 #include <display/QtViewer/QtRegionMgr.ui.h>
46 #include <graphics/X11/X_exit.h>
47 
48 
49 namespace casacore{
50 
51  class ImageRegion;
52  class Record;
53  class WCUnion;
54  template <class T> class PtrBlock;
55 }
56 
57 namespace casa { //# NAMESPACE CASA - BEGIN
58 
59  class QtViewer;
60  class RSComposite;
61 
62 
63  class QtRegionManager : public QWidget, protected Ui::QtRegionMgr {
64 
65  Q_OBJECT
66 
67 
68  public:
69 
70  QtRegionManager(QtDisplayPanel* qdp, QWidget* parent=0);
71 
73 
74  public slots:
77 
78  protected slots:
79  //draw region on viewer
80  void drawRegion(casacore::Record mousereg, WorldCanvasHolder *wch);
81  // React to new region creation in display panel.
82  void newRegion_(casacore::String imgFilename);
83 
84  // Load region from current displayed image
85  void loadRegionFromImage();
86  // Load region from ds9 or aipsbox or rgn file
87  void loadRegionFromFile();
88 
89  //save region into image
90  void saveRegionInImage();
91  // react to SaveRgnn, save region to file
92  void saveRegionInFile();
93  //remove region from image
94  void removeRegion();
95 
96  void toggleImageRegion();
97  void zPlaneChanged();
98  void currentRegionChanged(const QString &);
99  void showHelp();
100  void showHelpActive();
101 
102  //convert region to shape
104  QtDisplayData* qdd, const casacore::ImageRegion* wcreg);
105 
106  // Cleanup on destruction
107  void cleanup();
108 
109  void deleteActiveBox();
110  void insertActiveBox();
111 
112  // set up plane only or extending by channel and pol
113  void singlePlane();
114  void extendChan();
115  void extendPol();
116 
117  void resetRegionExtension();
118 
120  DisplayData* getImageData(QString);
122 
123  //delete region from image
124  void deleteRegion();
125  //show/hide region
126  void showHideRegion();
127 
128  void flashActive();
129  void exportRegions();
130 
131  public:
133 
134  protected:
135  void addRegionsToShape(RSComposite*& theShapes,
136  const casacore::WCRegion*& wcreg);
138  void displaySelectedRegion();
139  void showRegion(const casacore::String& regName);
140 
141  bool deleteBox(QString&, int);
142  bool insertBox(QString&);
143  void rotateBox(int);
144 
145  void addRegionToMenu(const QString&, const QString&);
146 
148  QWidget* parent_;
149 
150  private:
152  std::list<RegionShape*> regShapes_p;
154  QHash<QString, DisplayData*> regData;
155  QHash<QString, bool> regState;
156  QMenu *showHideMenu;
157  QMenu *deleteMenu;
158 
159  QString activeGroup;
162  QTimer* timer;
163  bool flash;
164 
165  int cb;
166 
167  signals:
169 
170  };
171 
172 
173 } //# NAMESPACE CASA - END
174 
175 #endif
void deleteRegion()
delete region from image
QHash< QString, bool > regState
bool insertBox(QString &)
void addRegionsToShape(RSComposite *&theShapes, const casacore::WCRegion *&wcreg)
void saveRegionInImage()
save region into image
Subclass of RegionShape used for drawing composite regions.
void singlePlane()
set up plane only or extending by channel and pol
QHash< QString, DisplayData * > regData
DisplayData * getImageData(QString)
void extendRegion(casacore::String, casacore::String)
void loadRegionFromImage()
Load region from current displayed image.
void addRegionToMenu(const QString &, const QString &)
casacore::WCUnion * unfoldCompositeRegionToSimpleUnion(const casacore::WCRegion *&wcreg)
QtRegionManager(QtDisplayPanel *qdp, QWidget *parent=0)
void changeAxis(casacore::String, casacore::String, casacore::String)
void showHideRegion()
show/hide region
DisplayData * getBoundingBoxData(QString)
A hierarchical collection of named fields of various types.
Definition: Record.h:180
void cleanup()
Cleanup on destruction.
Parent class for all RegionShapes.
Definition: RegionShape.h:223
RSComposite * regionToShape(QtDisplayData *qdd, const casacore::ImageRegion *wcreg)
convert region to shape
casacore::PtrBlock< const casacore::ImageRegion * > unionRegions_p
A drop-in replacement for Block&lt;T*&gt;.
Definition: WProjectFT.h:54
void activate(casacore::Record)
Class to hold a region of interest in an image.
Definition: ImageRegion.h:86
void newRegion_(casacore::String imgFilename)
React to new region creation in display panel.
bool planeAllowed(int, casacore::String &, casacore::String &)
A holder to interface between DisplayDatas and a WorldCanvas.
void loadRegionFromFile()
Load region from ds9 or aipsbox or rgn file.
void unfoldIntoSimpleRegionPtrs(casacore::PtrBlock< const casacore::WCRegion * > &outRegPtrs, const casacore::WCRegion *&wcreg)
Base class to define world coordinate regions of interest in an image.
Definition: WCRegion.h:95
std::list< RegionShape * > regShapes_p
bool deleteBox(QString &, int)
String: the storage and methods of handling collections of characters.
Definition: String.h:223
Base class for display objects.
Definition: DisplayData.h:317
void currentRegionChanged(const QString &)
Make the union of 2 or more image regions.
Definition: WCUnion.h:85
void showRegion(const casacore::String &regName)
void removeRegion()
remove region from image
void drawRegion(casacore::Record mousereg, WorldCanvasHolder *wch)
draw region on viewer
void saveRegionInFile()
react to SaveRgnn, save region to file
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42