casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QtRegionState.qo.h
Go to the documentation of this file.
1 //# QtRegionState.h: region properties, populates region dock
2 //# Copyright (C) 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 
29 #ifndef REGION_QTREGIONSTATE_H_
30 #define REGION_QTREGIONSTATE_H_
31 
32 #include <casa/BasicSL/String.h>
34 #include <display/region/QtRegionState.ui.h>
37 
38 namespace casa {
39 
40  class HistogramTab;
41  namespace viewer {
42 
43  class Region;
44 
45 
46  class QtRegionState : public QFrame, protected Ui::QtRegionState {
47  Q_OBJECT
48  public:
49  // initializing the display depends upon having signals & slots connected
50  // which cannot happen until after the ctor of QtRegionState...
51  void init( );
52 
53 
54  QtRegionState( const QString &name,
56  Region *region=0, QWidget *parent=0 );
57  ~QtRegionState( );
58 
60  return categories->tabText(categories->currentIndex( )) == "stats";
61  }
62 
63  Region *region( ) {
64  return region_;
65  }
66  void setRegion( Region *r );
67 
68  void updateCoord( );
69  void updateStatistics( );
70  void updateStatistics( std::list<std::shared_ptr<RegionInfo> > *stats );
71  void updateFrameInformation( int count );
72  void reloadStatistics( );
73  void updateCenters( std::list<std::shared_ptr<RegionInfo> > *centers );
74  void setCenterBackground(QString background);
75  void clearStatistics( );
76  void addHistogram(QWidget* histogram);
77  void updateStackOrder( int firstImage );
78  int getStackIndex() const;
79 
80  std::string lineColor( ) const;
81  std::string centerColor( ) const;
82  int lineWidth( ) const {
83  return line_width->value( );
84  }
86 
87  int markerScale( ) const {
88  return marker_scale->value( );
89  }
90  void setMarkerScale( int v );
91 
92  std::string textColor( ) const;
93  std::string textFont( ) const;
94  int textFontSize( ) const {
95  return font_size->value( );
96  }
97  int textFontStyle( ) const;
98  std::string textValue( ) const;
100  void textPositionDelta( int &x, int &y ) const;
101 
102  void setTextValue( const std::string &l );
104  void setTextDelta( const std::vector<int> & );
105  void setTextFont( const std::string &f );
106  void setTextFontSize( int s );
107  void setTextFontStyle( int s );
108  void setTextColor( const std::string & );
109  void setLineColor( const std::string & );
111  void setLineWidth( unsigned int );
112  void setAnnotation( bool );
113  void disableAnnotation( bool );
114 
115  int zMin( ) const;
116  int zMax( ) const;
117  int numFrames( ) const;
118 
119  bool isAnnotation( ) const;
120 
121  // reset the widget to its original state...
122  void reset( const QString &name, Region *r );
123 
124  /* QString getRegionCategory( ) const { return categories->tabText(categories->currentIndex( )); } */
125  /* void justExposed( ); */
126 
127  void getCoordinatesAndUnits( region::Coord &c, region::Units &xu, region::Units &yu, std::string &bounding_units ) const;
128  void setCoordinatesAndUnits( region::Coord c, region::Units x_units, region::Units y_units, const std::string &bounding_units );
129  void updatePosition( const QString &x, const QString &y, const QString &angle,
130  const QString &bounding_width, const QString &bounding_height );
131 
132  // may be called after "outputRegions" signal to notify the
133  // user that no regions were selected for output...
134  void noOutputNotify( );
135 
136  // functions added with the introduction of RegionToolManager and the
137  // unified selection and manipulation of the various region types...
138  /* void mark( bool set=true ) { region_mark->setCheckState( set ? Qt::Checked : Qt::Unchecked ); } */
139  /* bool marked( ) const { return region_mark->checkState( ) == Qt::Checked ? true : false; } */
140  void mark( bool set=true );
141  bool marked( ) const {
142  return region_mark->isChecked( );
143  }
144  bool markCenter( ) const {
145  return (markcenter_chk->checkState()==Qt::Checked);
146  }
147  bool skyComponent() const {
148  return (skycomp_chk->checkState()==Qt::Checked);
149  };
150  bool mark_toggle( );
151 
152  void nowVisible( );
153  QPushButton *getFitButton() {
154  return imfit_fit;
155  };
156 
157  void emitRefresh( ) {
158  emit refreshCanvas( );
159  }
160 
161  // return the current information mode of the region state, e.g. position, statistics, etc.
162  std::string mode( ) const;
163  const std::string LINE_COLOR_CHANGE;
164 
165  virtual QString HISTOGRAM_MODE( ) const {
166  return "Histogram";
167  }
168  virtual QString STATISTICS_MODE( ) const {
169  return "Statistics";
170  }
171  virtual QString FILE_MODE( ) const {
172  return "File";
173  }
174  virtual QString FIT_MODE( ) const {
175  return "Fit";
176  }
177  virtual QString PROPERTIES_MODE( ) const {
178  return "Properties";
179  }
180 
181  signals:
182  void regionChange( viewer::Region *, std::string );
183  void refreshCanvas( );
184  void statisticsVisible( bool );
185  void collectStatistics( );
186  void updateHistogram();
187  void positionVisible( bool );
188  void translateX( const QString &/*x*/, const QString &/*x_units*/, const QString &/*coordsys*/ );
189  void translateY( const QString &/*y*/, const QString &/*y_units*/, const QString &/*coordsys*/ );
190  void resizeX( const QString &/*x*/, const QString &/*x_units*/, const QString &/*coordsys*/ );
191  void resizeY( const QString &/*y*/, const QString &/*y_units*/, const QString &/*coordsys*/ );
192 
193  void zRange( int z_min, int z_max );
194  /* void regionCategoryChange( QString ); */
195  void outputRegions( const QString &what, const QString &name, const QString &type, const QString &csys );
196  void loadRegions( const QString &path, const QString &type );
197 
198  public slots:
199  void stackChange(QWidget*);
200 
201  protected slots:
202  // updates canvas with any line changes
203  void state_change( int );
204  void state_change_region_mark( int );
205  void color_state_change( int );
206  void state_change( bool );
207  void state_change( const QString & );
208  void states_change( int );
209  void states_val_change( int );
210  void coordsys_change( const QString &text );
211  void translate_x( );
212  void translate_y( );
213  void resize_x( );
214  void resize_y( );
215  void category_change( int );
216  void filetab_change( int );
217  // keeps text color in sync with line color (if they were the same before)
218  void line_color_change(const QString & );
219  QString default_extension( const QString & );
220 
221  void update_default_file_extension(const QString&);
222  void update_save_type(const QString &);
223  void save_region(bool);
224 
225  void update_load_type(const QString &);
226  void load_regions( bool );
227 
228  void frame_min_change(int);
229  void frame_max_change(int);
230 
231  void save_browser(bool);
232  void load_browser(bool);
233 
234  void set_point_region_marker( int );
235 
236  protected:
237  // keep track of which set of statistics
238  // where selected when refreshing all...
240  typedef std::list<QtRegionStats*> freestat_list;
245 
246  std::string bounding_index_to_string( int index ) const;
247 
248  friend class Region;
249  void clearRegion( ) {
250  region_ = 0;
251  }
252 
253  private:
254  void initRegionState( );
255  void statisticsUpdate( QtRegionStats *regionStats, std::shared_ptr<casa::viewer::RegionInfo> regionInfo );
256  unsigned int setting_combo_box;
259 
260  };
261 
262  class QtPVLineState : public QtRegionState {
263  Q_OBJECT
264  public:
265  QtPVLineState( const QString &name,
267  Region *region=0, QWidget *parent=0 );
268  QString STATISTICS_MODE( ) const {
269  return "pV";
270  }
271 
272  };
273 
275  Q_OBJECT
276  public:
277  QtSliceCutState( const QString &name,
279  Region *region=0, QWidget *parent=0 );
280  QString STATISTICS_MODE( ) const {
281  return "Spatial Profile";
282  }
283 
284  };
285 
286  class QtPointState : public QtRegionState {
287  Q_OBJECT
288  public:
289  QtPointState( const QString &name,
291  Region *region=0, QWidget *parent=0 );
292  };
293 
294  }
295 }
296 
297 #endif
void updateStackOrder(int firstImage)
void noOutputNotify()
may be called after &quot;outputRegions&quot; signal to notify the user that no regions were selected for outpu...
virtual QString STATISTICS_MODE() const
virtual QString FIT_MODE() const
void addHistogram(QWidget *histogram)
std::string centerColor() const
region::LineStyle lineStyle() const
int selected_statistics
keep track of which set of statistics where selected when refreshing all...
void translateX(const QString &, const QString &, const QString &)
void stackChange(QWidget *)
virtual Type type()
Return the type enum.
void setTextFont(const std::string &f)
std::string textFont() const
void update_default_file_extension(const QString &)
void setLineStyle(region::LineStyle)
const std::string LINE_COLOR_CHANGE
void setTextColor(const std::string &)
void loadRegions(const QString &path, const QString &type)
QtPVLineState(const QString &name, QtMouseToolNames::PointRegionSymbols sym=QtMouseToolNames::SYM_UNKNOWN, Region *region=0, QWidget *parent=0)
void regionChange(viewer::Region *, std::string)
void setCoordinatesAndUnits(region::Coord c, region::Units x_units, region::Units y_units, const std::string &bounding_units)
void statisticsUpdate(QtRegionStats *regionStats, std::shared_ptr< casa::viewer::RegionInfo > regionInfo)
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the if a human readable name(i.e."black").In many places throughout the plotter
QtRegionState(const QString &name, QtMouseToolNames::PointRegionSymbols sym=QtMouseToolNames::SYM_UNKNOWN, Region *region=0, QWidget *parent=0)
void init()
initializing the display depends upon having signals &amp; slots connected which cannot happen until afte...
virtual QString FILE_MODE() const
void setLineColor(const std::string &)
void outputRegions(const QString &what, const QString &name, const QString &type, const QString &csys)
void state_change(int)
updates canvas with any line changes
void mark(bool set=true)
functions added with the introduction of RegionToolManager and the unified selection and manipulation...
void getCoordinatesAndUnits(region::Coord &c, region::Units &xu, region::Units &yu, std::string &bounding_units) const
void updateCenters(std::list< std::shared_ptr< RegionInfo > > *centers)
QString STATISTICS_MODE() const
static freestat_list * freestats
std::string textColor() const
void translateY(const QString &, const QString &, const QString &)
void setTextDelta(const std::vector< int > &)
void updatePosition(const QString &x, const QString &y, const QString &angle, const QString &bounding_width, const QString &bounding_height)
All regions are specified in &quot;linear coordinates&quot;, not &quot;pixel coordinates&quot;.
Definition: Region.qo.h:147
std::string lineColor() const
virtual QString HISTOGRAM_MODE() const
void resizeY(const QString &, const QString &, const QString &)
void setCenterBackground(QString background)
std::list< QtRegionStats * > freestat_list
std::string path(const std::string &name)
std::string textValue() const
void coordsys_change(const QString &text)
region::TextPosition textPosition() const
void textPositionDelta(int &x, int &y) const
void reset(const QString &name, Region *r)
reset the widget to its original state...
std::string bounding_index_to_string(int index) const
void resizeX(const QString &, const QString &, const QString &)
QtPointState(const QString &name, QtMouseToolNames::PointRegionSymbols sym=QtMouseToolNames::SYM_UNKNOWN, Region *region=0, QWidget *parent=0)
virtual QString PROPERTIES_MODE() const
static freestat_list * freecenters
LineStyle
LSDoubleDashed is only used to preserve state (it is a Display::LineStyle option) ...
Definition: RegionEnums.h:27
std::string mode() const
return the current information mode of the region state, e.g.
Manages a stack widget that displays histograms for a single region but multiple images.
QString default_extension(const QString &)
const Double c
Fundamental physical constants (SI units):
void setTextPosition(region::TextPosition)
void line_color_change(const QString &)
keeps text color in sync with line color (if they were the same before)
void zRange(int z_min, int z_max)
void updateFrameInformation(int count)
QtSliceCutState(const QString &name, QtMouseToolNames::PointRegionSymbols sym=QtMouseToolNames::SYM_UNKNOWN, Region *region=0, QWidget *parent=0)
void setLineWidth(unsigned int)
void setTextValue(const std::string &l)
void update_load_type(const QString &)
void update_save_type(const QString &)