casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FileBox.qo.h
Go to the documentation of this file.
1 //# FileBox.qo.h: Qt implementation of viewer box maker 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 FILEBOX_H
31 #define FILEBOX_H
32 
33 #include <casa/aips.h>
34 #include <casa/Containers/Record.h>
37 
38 #include <graphics/X11/X_enter.h>
39 #include <QtCore>
40 #include <QtGui>
41 #include <QList>
42 #include <QPushButton>
43 #include <QComboBox>
44 #include <graphics/X11/X_exit.h>
45 
46 namespace casacore{
47 
48  class WCUnion;
49 }
50 
51 namespace casa {
52 
53  class RSComposite;
54 
55  class FileBox : public QWidget {
56 
57  Q_OBJECT
58 
59  public:
60 
61  FileBox(QtDisplayPanel* qdp);
62  ~FileBox() {}
63 
64  public slots:
65 
66  //handle double click that announces a box is ready
67  void drawRegion(casacore::Record mousereg, WorldCanvasHolder *wch);
68 
69  //React to new region creation in display panel.
70  void newRegion_(casacore::String imgFilename);
71 
72  //handle switch display axis
74 
75  //handle single click to select a box
77 
78  //this is not used, it emits for any wc change, too often
79  void wcChanged(const casacore::String,
81 
82  virtual void closeEvent ( QCloseEvent * event );
83 
84  signals:
85  void hideFileBox();
86 
87  protected slots:
88 
89  //load masks from a file
90  void loadRegionFromFile();
91 
92  //save masks to a file
93  void saveRegionToFile();
94 
95  //delete all masks
96  void deleteAll();
97 
98  //toggle show or hide, but does not delete any
99  void showHideAll();
100 
101  //use a different color
102  void colorAll(const QString&);
103 
104  //the work horse for all the edit commands
105  void doIt();
106 
107  //show help text
108  void showHelp();
109 
110  //create new box of this shape
111  void reShape(const QString&);
112 
113  void zPlaneChanged();
114  void pPlaneChanged();
115  protected:
116 
117  void rotateBox(int cb);
118  void addBox(RegionShape*);
119  void deleteBox(RegionShape*);
120  void reDraw();
121 
122  void addRegionsToShape(RSComposite*& theShapes,
123  const casacore::WCRegion*& wcreg);
124 
127  const casacore::WCRegion*& wcreg);
128 
129  //convert region to shape
131  QtDisplayData* qdd, const casacore::ImageRegion* wcreg);
132 
134  bool chanAllowed(const double, const double);
135  bool polAllowed(const double, const double);
136 
137  private:
138 
140 
143 
145 
146  QTimer* timer;
147  bool flash;
148 
149  int cb;
150  int zIndex;
151  int pIndex;
153 
154 
155  QGroupBox* tGroup;
156  QPushButton* load;
157  QPushButton* save;
158  QPushButton* showHide;
159  QPushButton* removeAll;
160  QComboBox* color;
161 
162  QLineEdit* chan;
163  QLineEdit* corr;
164 
165  /*
166  QGroupBox* eGroup;
167  QComboBox* shape;
168  QPushButton* remove;
169  QPushButton* rotateL;
170  QPushButton* rotateR;
171  QPushButton* left;
172  QPushButton* right;
173  QPushButton* up;
174  QPushButton* down;
175  QPushButton* wider;
176  QPushButton* narrower;
177  QPushButton* taller;
178  QPushButton* shorter;
179  */
180 
181  };
182 
183 
184 }
185 
186 #endif
void showHideAll()
toggle show or hide, but does not delete any
void deleteAll()
delete all masks
void doIt()
the work horse for all the edit commands
RegionShape * activeShape
Definition: FileBox.qo.h:144
casacore::WCUnion * unfoldCompositeRegionToSimpleUnion(const casacore::WCRegion *&wcreg)
bool planeAllowed(casacore::String, casacore::String)
QLineEdit * corr
Definition: FileBox.qo.h:163
void loadRegionFromFile()
load masks from a file
QPushButton * showHide
Definition: FileBox.qo.h:158
QComboBox * color
Definition: FileBox.qo.h:160
QtDisplayPanel * qdp_
Definition: FileBox.qo.h:139
void zPlaneChanged()
void pPlaneChanged()
QLineEdit * chan
Definition: FileBox.qo.h:162
void hideFileBox()
QPushButton * save
Definition: FileBox.qo.h:157
QGroupBox * tGroup
Definition: FileBox.qo.h:155
virtual void closeEvent(QCloseEvent *event)
QPushButton * removeAll
Definition: FileBox.qo.h:159
bool polAllowed(const double, const double)
Subclass of RegionShape used for drawing composite regions.
void changeAxis(casacore::String, casacore::String, casacore::String, std::vector< int >)
handle switch display axis
void wcChanged(const casacore::String, const casacore::Vector< double >, const casacore::Vector< double >)
this is not used, it emits for any wc change, too often
QPushButton * load
Definition: FileBox.qo.h:156
void addBox(RegionShape *)
void drawRegion(casacore::Record mousereg, WorldCanvasHolder *wch)
handle double click that announces a box is ready
void addRegionsToShape(RSComposite *&theShapes, const casacore::WCRegion *&wcreg)
void deleteBox(RegionShape *)
casacore::String zAxis
Definition: FileBox.qo.h:152
void reShape(const QString &)
create new box of this shape
void activate(casacore::Record)
handle single click to select a box
DisplayData * regData
Definition: FileBox.qo.h:142
void saveRegionToFile()
save masks to a file
casacore::PtrBlock< const casacore::ImageRegion * > unionRegions_p
Definition: FileBox.qo.h:141
A hierarchical collection of named fields of various types.
Definition: Record.h:180
Parent class for all RegionShapes.
Definition: RegionShape.h:223
void showHelp()
show help text
void unfoldIntoSimpleRegionPtrs(casacore::PtrBlock< const casacore::WCRegion * > &outRegPtrs, const casacore::WCRegion *&wcreg)
Class to hold a region of interest in an image.
Definition: ImageRegion.h:86
A holder to interface between DisplayDatas and a WorldCanvas.
void rotateBox(int cb)
Base class to define world coordinate regions of interest in an image.
Definition: WCRegion.h:95
String: the storage and methods of handling collections of characters.
Definition: String.h:223
RSComposite * regionToShape(QtDisplayData *qdd, const casacore::ImageRegion *wcreg)
convert region to shape
void colorAll(const QString &)
use a different color
Base class for display objects.
Definition: DisplayData.h:317
void newRegion_(casacore::String imgFilename)
React to new region creation in display panel.
FileBox(QtDisplayPanel *qdp)
Make the union of 2 or more image regions.
Definition: WCUnion.h:85
bool chanAllowed(const double, const double)
QTimer * timer
Definition: FileBox.qo.h:146
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42