casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Region.qo.h
Go to the documentation of this file.
1 //# Region.qo.h: base class for statistical regions
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 
29 #ifndef REGION_REGION_H_
30 #define REGION_REGION_H_
31 
32 #include <set>
33 #include <map>
34 #include <list>
35 #include <string>
39 #include <display/Utilities/dtor.h>
41 #include <display/Utilities/VOID.h>
43 #include <stdexcept>
44 #include <QObject>
48 
49 #include <casa/Arrays/Vector.h>
50 
51 extern "C" void casa_viewer_pure_virtual( const char *file, int line, const char *func );
52 #define DISPLAY_PURE_VIRTUAL(FUNCTION,RESULT) \
53  { casa_viewer_pure_virtual( __FILE__, __LINE__, #FUNCTION ); return RESULT; }
54 
55 namespace casacore{
56 
57  template <class T> class ImageInterface;
58  class ImageRegion;
59 }
60 
61 namespace casa {
62 
63  class WorldCanvas;
64  class PrincipalAxesDD;
65 
66  class DisplayData;
67  class HistogramTab;
68 
69  class RegionTextList;
70  class AnnotationBase;
71 
72  namespace viewer {
73 
74  class ds9writer;
75  class QtRegionDock;
76 
77  // convert linear coordinates to viewer screen coordinates...
78  void linear_to_screen( WorldCanvas *wc_, double, double, int &, int & );
79  void linear_to_screen( WorldCanvas *wc_, double, double, double, double, int &, int &, int &, int & );
80  // convert linear coordinates to casa pixel coordinates...
81  void linear_to_pixel( WorldCanvas *wc_, double, double, double &, double & );
82  void linear_to_pixel( WorldCanvas *wc_, double, double, double, double, double &, double &, double &, double & );
83  // convert viewer screen coordinates to linear coordinates...
84  void screen_to_linear( WorldCanvas *wc_, int, int, double &, double & );
85  void screen_to_linear( WorldCanvas *wc_, int, int, int, int, double &, double &, double &, double & );
86  // convert linear coordinates to world coordinates...
87  void linear_to_world( WorldCanvas *wc_, double, double, double &, double & );
88  void linear_to_world( WorldCanvas *wc_, double, double, double, double, double &, double &, double &, double & );
89  // convert world coordinates to linear coordinates...
90  void world_to_linear( WorldCanvas *wc_, double, double, double &, double & );
91  void world_to_linear( WorldCanvas *wc_, double, double, double, double, double &, double &, double &, double& );
92  // convert casa pixel coordinates to world coordinates...
93  void pixel_to_world( WorldCanvas *wc_, double, double, double &, double & );
94  void pixel_to_world( WorldCanvas *wc_, double, double, double, double, double &, double &, double &, double & );
95  // convert casa pixel coordinates to linear coordinates...
96  void pixel_to_linear( WorldCanvas *wc_, double, double, double &, double & );
97  void pixel_to_linear( WorldCanvas *wc_, double, double, double, double, double &, double &, double &, double & );
98  // convert world coordantes to screen coordinates
99  void world_to_screen( WorldCanvas *wc_, double, double, int &, int & );
100  void world_to_screen( WorldCanvas *wc_, double, double, double, double, int &, int &, int &, int & );
101  // convert world to pixel coordinates
102  void world_to_pixel( WorldCanvas *wc_, double, double, int &, int & );
103  void world_to_pixel( WorldCanvas *wc_, double, double, double, double, int &, int &, int &, int & );
104 
105  // convert linear coordinates to specific coordinate systems...
106  void linear_to_j2000( WorldCanvas *wc_, double, double, double &, double & );
107  void linear_to_j2000( WorldCanvas *wc_, double, double, double, double, double &, double &, double &, double & );
108  void linear_to_b1950( WorldCanvas *wc_, double, double, double &, double & );
109  void linear_to_b1950( WorldCanvas *wc_, double, double, double, double, double &, double &, double &, double & );
110  void linear_to_galactic( WorldCanvas *wc_, double, double, double &, double & );
111  void linear_to_galactic( WorldCanvas *wc_, double, double, double, double, double &, double &, double &, double & );
112  void linear_to_ecliptic( WorldCanvas *wc_, double, double, double &, double & );
113  void linear_to_ecliptic( WorldCanvas *wc_, double, double, double, double, double &, double &, double &, double & );
114 
115  void to_linear( WorldCanvas *, casacore::MDirection::Types in_type, double, double, double &, double & );
116  void to_linear( WorldCanvas *, casacore::MDirection::Types in_type, double, double, double, double, double &, double &, double &, double & );
117  void to_linear_offset( WorldCanvas *, casacore::MDirection::Types in_type, double, double, double &, double & );
118 
119  void screen_offset_to_linear_offset( WorldCanvas *wc_, int, int, double &, double & );
120  void pixel_offset_to_linear_offset( WorldCanvas *wc_, double, double, double &, double & );
121  void linear_offset_to_pixel_offset( WorldCanvas *wc_, double, double, double &, double & );
122 
123  casacore::MDirection::Types get_coordinate_type( const DisplayCoordinateSystem &wc );
124 
126  public:
128  ImageRegion_state( casacore::ImageRegion *ir, size_t region_count ) : imageregion(ir), count_(region_count) { }
130  operator std::shared_ptr<casacore::ImageRegion>( ) {
131  return imageregion;
132  }
133  size_t regionCount( ) const {
134  return count_;
135  }
136  private:
137  void* operator new (std::size_t) throw (std::logic_error) {
138  throw std::logic_error("allocating an object not intended for dynamic allocation");
139  }
140  std::shared_ptr<casacore::ImageRegion> imageregion;
141  size_t count_;
142  };
143 
144  // All regions are specified in "linear coordinates", not "pixel coordinates". This is necessary
145  // because "linear coordinates" scale with zooming whereas "pixel coordinates" do not. Unfortunately,
146  // this means that coordinate transformation is required each time the region is drawn.
147  class Region : public QObject, public dtorNotifier {
148  Q_OBJECT
149  public:
150 
151  // functions to query results from mouse functions...
152  static bool refreshNeeded( int v ) {
153  return v & region::MouseRefresh ? true : false;
154  }
155  static bool regionSelected( int v ) {
156  return v & region::MouseSelected ? true : false;
157  }
158  static bool handleSelected( int v ) {
159  return v & region::MouseHandle ? true : false;
160  }
161 
162  // user specified name
163  const std::string name( ) const {
164  return name_;
165  }
166 
167  std::string lineColor( ) const {
168  return mystate->lineColor( );
169  }
170  std::string centerColor( ) const {
171  return mystate->centerColor( );
172  }
173  int lineWidth( ) const {
174  return mystate->lineWidth( );
175  }
177  return mystate->lineStyle( );
178  }
179 
180  std::string textColor( ) const {
181  return mystate->textColor( );
182  }
183  std::string textFont( ) const {
184  return mystate->textFont( );
185  }
186  int textFontSize( ) const {
187  return mystate->textFontSize( );
188  }
189  int textFontStyle( ) const {
190  return mystate->textFontStyle( );
191  }
192  std::string textValue( ) const {
193  return mystate->textValue( );
194  }
196  return mystate->textPosition( );
197  }
198  void textPositionDelta( int &x, int &y ) const {
199  return mystate->textPositionDelta( x, y );
200  }
201 
202  virtual void setLabel( const std::string &l );
203  virtual void setLabelPosition( region::TextPosition );
204  virtual void setLabelDelta( const std::vector<int> & );
205  virtual void setFont( const std::string &font="", int font_size=-1, int font_style=0, const std::string &font_color="" );
206  virtual void setLine( const std::string &line_color="", region::LineStyle line_style=region::SolidLine, unsigned int line_width=1 );
207  virtual void setAnnotation(bool);
208 
210  std::string &width_height_units ) const;
211  void getPositionString( std::string &x, std::string &y, std::string &angle,
212  double &bounding_width, double &bounding_height,
216  const std::string &bounding_units = "rad" ) const;
217 
218  bool translateX( const std::string &/*x*/, const std::string &/*x_units*/, const std::string &/*coordsys*/ );
219  bool translateY( const std::string &/*x*/, const std::string &/*y_units*/, const std::string &/*coordsys*/ );
220  bool resizeX( const std::string &/*x*/, const std::string &/*x_units*/, const std::string &/*coordsys*/ );
221  bool resizeY( const std::string &/*x*/, const std::string &/*y_units*/, const std::string &/*coordsys*/ );
222 
223  int numFrames( ) const;
224  void zRange( int &x, int &y ) const;
225  int zIndex( ) const;
226  bool regionVisible( ) const {
227  return visible_;
228  }
229 
230  bool worldBoundingRectangle( double &, double &, const std::string & ) const;
231 
232  virtual ~Region( );
233 
234  Region( ) : dock_(0), id_(QtId::get_id( )), wc_(0), selected_(false), visible_(true),
235  mouse_in_region(false), z_index_within_range(true) { }
236  Region( const std::string &name, WorldCanvas *wc, QtRegionDock *,
237  bool hold_signals_=false, QtRegionState *supplied_state=0,
239 
240  // is this region degenerate?
241  virtual bool degenerate( ) const;
242 
243  void setDrawingEnv( );
244  void resetDrawingEnv( );
245  void setTextEnv( );
246  void resetTextEnv( );
247  void pushDrawingEnv( region::LineStyle ls, int thickness=-1 );
248  void popDrawingEnv( );
249 
250  void setDrawCenter(bool draw_center) {
251  draw_center_=draw_center;
252  };
253  bool getDrawCenter() {
254  return draw_center_;
255  };
256 
257  // duplicate of MultiWCTool::refresh( )
258  void refresh( );
259 
260  virtual region::PointInfo checkPoint( double x, double y ) const = 0;
261 
262  // returns OR'ed set of MouseState...
263  virtual unsigned int mouseMovement( double /*x*/, double /*y*/, bool /*other_selected*/ )
264  DISPLAY_PURE_VIRTUAL(Region::mouseMovement,0);
265 
266  virtual void draw( bool other_selected );
267 
268  // indicates that the center info is no longer valid
269  void invalidateCenterInfo( );
270 
271  bool selected( ) const {
272  return selected_;
273  }
274 
275  // is this region weakly or temporarily selected?
276  virtual bool weaklySelected( ) const;
277  virtual void weaklySelect( bool scroll_dock=true );
278  // weaklyUnselectLimited( ) plus extra processing...
279  virtual void weaklyUnselect( );
280  // just unmark this region (called from RegionToolManager); do not
281  // do the rest of the reorganization that weaklyUnselect( ) does...
282  virtual void weaklyUnselectLimited( );
283 
284  // indicates that the user has selected this rectangle...
285  // ...may need to scroll region dock
286  virtual void selectedInCanvas( );
287  virtual bool clickWithin( double /*x*/, double /*y*/ ) const DISPLAY_PURE_VIRTUAL(Region::clickWithin,false);
288  virtual int clickHandle( double /*x*/, double /*y*/ ) const DISPLAY_PURE_VIRTUAL(Region::clickHandle,0);
289  // return value indicates if any data was flagged...
290  virtual bool doubleClick( double /*x*/, double /*y*/ );
291  // for rectangles, resizing can change the handle...
292  // for rectangles, moving a handle is resizing...
293  virtual int moveHandle( int handle, double /*x*/, double /*y*/ ) DISPLAY_PURE_VIRTUAL(Region::moveHandle,handle);
294  virtual void move( double /*dx*/, double /*dy*/ ) DISPLAY_PURE_VIRTUAL(Region::move,);
295  virtual void resize( double /*width_delta*/, double /*height_delta*/ ) = 0;
296  virtual bool valid_translation( double dx, double dy, double width_delta, double height_delta ) = 0;
297 
298  // functions added with the introduction of RegionToolManager and the
299  // unified selection and manipulation of the various region types...
300  virtual void mark( bool set=true );
301  virtual bool marked( ) const {
302  return mystate->marked( );
303  }
304  // returns the new state...
305  virtual bool mark_toggle( );
306  size_t selected_region_count( );
307  size_t marked_region_count( );
308 
310  mouse_in_region = false;
311  }
312 
313  // update status information...
314  virtual void status( const std::string &msg, const std::string &type="info" );
315 
316  virtual bool markCenter( ) const {
317  return mystate->markCenter( );
318  }
319 
320  virtual bool skyComponent( ) const {
321  return mystate->skyComponent();
322  //const DISPLAY_PURE_VIRTUAL(Region::skyComponent,true);
323  }
324 
325  virtual void output( ds9writer &out ) const = 0;
326 
327  // in "linear" coordinates...
328  virtual void boundingRectangle (double &/*blc_x*/, double &/*blc_y*/, double &/*trc_x*/, double &/*trc_y*/) const
329  DISPLAY_PURE_VIRTUAL(Region::boundingRectangle,);
330 
331  void emitUpdate( );
332 
333  // postpone signal processing (important for signals generated during construction)...
334  void holdSignals( ) {
335  hold_signals++;
336  }
337  virtual void releaseSignals( ) {
338  if ( --hold_signals == 0 ) process_held_signals( );
339  if ( hold_signals < 0 ) hold_signals = 0;
340  }
341 
342  virtual std::list<std::shared_ptr<RegionInfo> > *statistics( ) {
343  return generate_dds_statistics( );
344  }
345 
346  // called when creating regions to allow suppression of corner-handle drawing...
347  static std::shared_ptr<viewer::Region> creatingRegion( ) {
348  return creating_region;
349  }
350  static void creatingRegionBegin( std::shared_ptr<viewer::Region> r ) {
351  creating_region = r;
352  }
353  static void creatingRegionEnd( ) {
354  creating_region.reset( );
355  }
356 
357  //Histogram functionality
358  int getId() const {
359  return id_;
360  }
362  return get_image_region( dd );
363  }
364 
365 // --------------------==================== from old QtRegion ====================--------------------
366 
367  // query region type... to avoid dynamic cast ladder...
368  virtual region::RegionTypes type( ) const = 0;
369 
370  virtual void pixelCenter( double &/*x*/, double &/*y*/ ) const = 0;
371  // DISPLAY_PURE_VIRTUAL(Region::pixelCenter,);
372 
373  // needed for writing out a list of regions (CASA or DS9 format) because the
374  // output is based upon QtRegionState pointers (because that is what is available
375  // to the QtRegionDock... this should be rectified to use a list of QtRegion
376  // pointers for region output...
378  return mystate;
379  }
380 
381  // how much to scale the symbol used to mark point regions...
382  // assumed to go from 0 to 9...
383  int markerScale( ) const {
384  return mystate->markerScale( );
385  }
386  void setMarkerScale( int v ) {
388  }
389 
390  // indicates that region movement requires the update of state information...
391  void updateStateInfo( bool region_modified, region::RegionChanges );
392  void refresh_state_gui( );
393  // blank out the statistics for this region
394  void clearStatistics( );
397  }
398 
399  // used to synchronize the default color for all of the RegionDock's RegionState objects...
400  int &colorIndex( );
401  // used to synchronize all of the RegionDock's RegionState tab configuration...
402  std::pair<int,int> &tabState( );
403  // used to synchronize all of the RegionDock's RegionState coordinate configuration...
404  std::map<std::string,int> &coordState( );
405 
406  // forward state update information to the dock wherere a count of selected regions, information
407  // is maintained. This is used to determine the corner treatment when drawing regions...
409 
410  // used to synchronize all region directories per QtDisplayPanelGUI...
411  QString getSaveDir( );
412  void putSaveDir( QString );
413  QString getLoadDir( );
414  void putLoadDir( QString );
415 
417  return false;
418  }
419 
420  virtual AnnotationBase *annotation( ) const DISPLAY_PURE_VIRTUAL(Region::annotation,0);
421 
422  static casacore::Quantum< ::casacore::Vector<double> > convert_angle( double x, const std::string &xunits, double y, const std::string &yunits,
423  casacore::MDirection::Types original_coordsys, casacore::MDirection::Types new_coordsys, const std::string &new_units="rad" );
424 
425  signals:
426  void selectionChanged(viewer::Region*,bool);
427 
428  void regionCreated( int, const QString &shape, const QString &name, const QList<double> &world_x,
429  const QList<double> &world_y, const QList<int> &pixel_x, const QList<int> &pixel_y,
430  const QString &linecolor, const QString &text, const QString &font, int fontsize, int fontstyle );
431  void regionUpdate( int, viewer::region::RegionChanges, const QList<double> &world_x, const QList<double> &world_y,
432  const QList<int> &pixel_x, const QList<int> &pixel_y );
433  void regionChange( viewer::Region *, std::string );
434 
435  // generated by emitUpdate( )...
436  void regionUpdateResponse( int, const QString &shape, const QString &name,
437  const QList<double> &world_x, const QList<double> &world_y,
438  const QList<int> &pixel_x, const QList<int> &pixel_y,
439  const QString &linecolor, const QString &text, const QString &font, int fontsize, int fontstyle );
440  void showHistogramTool();
441 
442  protected slots:
443  void refresh_canvas_event( );
444  void refresh_statistics_event( bool );
445  void refresh_position_event( bool );
446 
447  void translate_x( const QString &/*x*/, const QString &/*x_units*/, const QString &/*coordsys*/ );
448  void translate_y( const QString &/*y*/, const QString &/*y_units*/, const QString &/*coordsys*/ );
449  void resize_x( const QString &/*x*/, const QString &/*x_units*/, const QString &/*coordsys*/ );
450  void resize_y( const QString &/*y*/, const QString &/*y_units*/, const QString &/*coordsys*/ );
451  void updateCenterInfo( );
452  void adjustCorners( double, double, double, double);
453  void refresh_zrange_event(int,int);
454 
455  // revoke...
456  void revoke_region( );
457  // revoke if our state matches parameter...
458  void revoke_region(QtRegionState*);
459 
460  void reload_statistics_event( );
461 
462  void output(std::list<QtRegionState*>,RegionTextList&);
463  void output(std::list<QtRegionState*>,ds9writer&);
464 
465  protected:
466 
467  static const int SEXAGPREC;
468 
470  QtRegionState *mystate;
472 
476 
477  int id_;
479 
481  std::map<region::RegionChanges,bool> held_signals;
482 
483  void fetch_details( region::RegionTypes &type, QList<int> &pixelx,
484  QList<int> &pixely, QList<double> &worldx, QList<double> &worldy );
485  virtual void fetch_region_details( region::RegionTypes &type,
486  std::vector<std::pair<int,int> > &pixel_pts,
487  std::vector<std::pair<double,double> > &world_pts ) const {
488  type = region::NonRegion;
489  pixel_pts.clear( );
490  world_pts.clear( );
492  }
493 
495 
496  // --------------------==================== from old QtRegion ====================--------------------
497 
498  protected:
499  void initHistogram();
500  virtual std::list<std::shared_ptr<RegionInfo> > *generate_dds_statistics( );
501 
502  // hook to allow generate_dds_statistics( ) to generate statistics
503  // for rectangular measurement set regions...
504  virtual void generate_nonimage_statistics( DisplayData*, std::list<std::shared_ptr<RegionInfo> > * ) { }
505  // newInfoObject(...) is currently only used for PVLine regions, but it should be used for
506  // other regions to allow for specialized creation of the region info objects for display
507  // in "statistics"...
509  return 0;
510  }
511 
512  virtual casacore::ImageRegion *get_image_region( DisplayData* ) const
513  DISPLAY_PURE_VIRTUAL(Region::get_image_region,0);
514 
515  virtual const std::set<Region*> &get_selected_regions( );
517 
518  virtual std::list<std::shared_ptr<RegionInfo> > *generate_dds_centers( ) = 0;
519 
520  static int getAxisIndex( casacore::ImageInterface<float> *image, std::string axtype );
521 
522  inline double linear_average( double a, double b ) const {
523  return (a + b) / 2.0;
524  }
527 
528  region::Units current_xunits( ) const;
529  region::Units current_yunits( ) const;
532 
533  virtual void drawRegion( bool /*selected*/ ) = 0; //DISPLAY_PURE_VIRTUAL(Region::drawRegion,);
534  virtual void drawText( );
535 
536  virtual void setCenter(double &, double &, double &, double &) DISPLAY_PURE_VIRTUAL(Region::setCenter,);
537 
538  virtual void drawCenter(double &x, double &y );
539  virtual void drawCenter(double &x, double &y, double &deltx, double &delty);
540 
541 
542  virtual bool within_drawing_area( );
543 
545  typedef std::pair<region::LineStyle,int> ls_ele;
546  std::list<ls_ele> ls_stack;
548 
550  bool selected_;
551 
552  bool visible_;
553 
554  // Should this region be considered complete?
555  // Set to true by derived classes...
556  bool complete;
557 
558  // Derived classes set this to true and clear it when the mouse
559  // enters and exits this regions bounding box...
561 
562  // Holds a pointer to the region currently being created...
563  static std::shared_ptr<Region> creating_region;
564 
565  private slots:
566  //Called when the histogram stack needs to be changed due
567  //to the add/removal of an image.
568  void update_histogram_event();
569 
570  private:
571  // common state-setup for constructors...
572  void init( );
573 
574  void updateHistogramRegion();
575  void clearHistograms();
576  void process_held_signals( );
577  void clear_signal_cache( );
579  void set_line_style(const ls_ele&);
581  std::string name_;
582  };
583 
584  // used to pass point specific marker information (marker type and scaling)
585  // to generic region creation routines RegionTool::create(...)
586  class PointMarkerState : public VOID {
587  public:
588  PointMarkerState( QtMouseToolNames::PointRegionSymbols t, int s ) : VOID("viewer.PointMarkerState"), type_(t), scale_(s) { }
590  return type_;
591  }
592  int scale( ) const {
593  return scale_;
594  }
595  private:
597  int scale_;
598  };
599  }
600 }
601 
602 #endif
static int getAxisIndex(casacore::ImageInterface< float > *image, std::string axtype)
std::string name_
Definition: Region.qo.h:581
static std::shared_ptr< viewer::Region > creatingRegion()
called when creating regions to allow suppression of corner-handle drawing...
Definition: Region.qo.h:347
A Measure: astronomical direction.
Definition: MDirection.h:174
Base class for annotations.
casacore::MDirection::Types get_coordinate_type(const DisplayCoordinateSystem &wc)
void getCoordinatesAndUnits(region::Coord &c, region::Units &x_units, region::Units &y_units, std::string &width_height_units) const
region::Units current_yunits() const
virtual void weaklyUnselectLimited()
just unmark this region (called from RegionToolManager); do not do the rest of the reorganization tha...
void refresh()
duplicate of MultiWCTool::refresh()
void setMarkerScale(int v)
Definition: Region.qo.h:386
std::pair< region::LineStyle, int > ls_ele
Definition: Region.qo.h:545
std::map< region::RegionChanges, bool > held_signals
Definition: Region.qo.h:481
std::vector< double > Vector
Definition: ds9context.h:24
PointMarkerState(QtMouseToolNames::PointRegionSymbols t, int s)
Definition: Region.qo.h:588
std::string centerColor() const
std::shared_ptr< casacore::ImageRegion > imageregion
Definition: Region.qo.h:140
void refresh_zrange_event(int, int)
region::Units current_xunits() const
void screen_offset_to_linear_offset(WorldCanvas *wc_, int, int, double &, double &)
region::LineStyle lineStyle() const
void resize_x(const QString &, const QString &, const QString &)
void to_linear(WorldCanvas *, casacore::MDirection::Types in_type, double, double, double &, double &)
An ordered list of annotations and comments representing an ascii region file. &lt;author&gt;Dave Mehringer...
virtual bool degenerate() const
is this region degenerate?
void selectedCountUpdateNeeded()
forward state update information to the dock wherere a count of selected regions, information is main...
void resize_y(const QString &, const QString &, const QString &)
void pixel_to_world(WorldCanvas *wc_, double, double, double &, double &)
convert casa pixel coordinates to world coordinates...
Definition: VOID.h:32
void getPositionString(std::string &x, std::string &y, std::string &angle, double &bounding_width, double &bounding_height, region::Coord coord=region::DefaultCoord, region::Units x_units=region::DefaultUnits, region::Units y_units=region::DefaultUnits, const std::string &bounding_units="rad") const
#define private
Definition: miriad.h:68
void regionCreated(int, const QString &shape, const QString &name, const QList< double > &world_x, const QList< double > &world_y, const QList< int > &pixel_x, const QList< int > &pixel_y, const QString &linecolor, const QString &text, const QString &font, int fontsize, int fontstyle)
void adjustCorners(double, double, double, double)
void linear_to_galactic(WorldCanvas *wc_, double, double, double &, double &)
void fetch_details(region::RegionTypes &type, QList< int > &pixelx, QList< int > &pixely, QList< double > &worldx, QList< double > &worldy)
void world_to_screen(WorldCanvas *wc_, double, double, int &, int &)
convert world coordantes to screen coordinates
void linear_to_screen(WorldCanvas *wc_, double, double, int &, int &)
convert linear coordinates to viewer screen coordinates...
QtMouseToolNames::PointRegionSymbols type() const
Definition: Region.qo.h:589
used to pass point specific marker information (marker type and scaling) to generic region creation r...
Definition: Region.qo.h:586
int getId() const
Histogram functionality.
Definition: Region.qo.h:358
int numFrames() const
virtual void fetch_region_details(region::RegionTypes &type, std::vector< std::pair< int, int > > &pixel_pts, std::vector< std::pair< double, double > > &world_pts) const
Definition: Region.qo.h:485
virtual void pixelCenter(double &, double &) const =0
RegionInfo::stats_t * getLayerStats(PrincipalAxesDD *padd, casacore::ImageInterface< float > *image, casacore::ImageRegion &imgReg)
static std::shared_ptr< Region > creating_region
Holds a pointer to the region currently being created...
Definition: Region.qo.h:563
bool resizeX(const std::string &, const std::string &, const std::string &)
bool mouse_in_region
Derived classes set this to true and clear it when the mouse enters and exits this regions bounding b...
Definition: Region.qo.h:560
casacore::MDirection::Types current_casa_coordsys() const
void holdSignals()
postpone signal processing (important for signals generated during construction)...
Definition: Region.qo.h:334
void updateStateInfo(bool region_modified, region::RegionChanges)
indicates that region movement requires the update of state information...
void linear_to_ecliptic(WorldCanvas *wc_, double, double, double &, double &)
void linear_to_world(WorldCanvas *wc_, double, double, double &, double &)
convert linear coordinates to world coordinates...
virtual void move(double dx, double dy, casacore::String system="")
Implements RegionShape::move.
std::string textFont() const
void set_line_style(const ls_ele &)
region::Coord current_region_coordsys() const
static void creatingRegionBegin(std::shared_ptr< viewer::Region > r)
Definition: Region.qo.h:350
void statisticsUpdateNeeded()
Definition: Region.qo.h:395
void pushDrawingEnv(region::LineStyle ls, int thickness=-1)
std::map< std::string, int > & coordState()
used to synchronize all of the RegionDock&#39;s RegionState coordinate configuration...
void regionUpdate(int, viewer::region::RegionChanges, const QList< double > &world_x, const QList< double > &world_y, const QList< int > &pixel_x, const QList< int > &pixel_y)
virtual void setFont(const std::string &font="", int font_size=-1, int font_style=0, const std::string &font_color="")
void refresh_statistics_event(bool)
virtual void status(const std::string &msg, const std::string &type="info")
update status information...
virtual void setLabelDelta(const std::vector< int > &)
casacore::ImageRegion * getImageRegion(DisplayData *dd) const
Definition: Region.qo.h:361
virtual std::list< std::shared_ptr< RegionInfo > > * statistics()
Definition: Region.qo.h:342
void init()
common state-setup for constructors...
casacore::ImageStatistics< casacore::Float >::stat_list stats_t
Definition: RegionInfo.h:49
void clearMouseInRegion()
Definition: Region.qo.h:309
ImageRegion_state(const ImageRegion_state &other)
Definition: Region.qo.h:129
void pixel_offset_to_linear_offset(WorldCanvas *wc_, double, double, double &, double &)
virtual std::list< std::shared_ptr< RegionInfo > > * generate_dds_statistics()
virtual casacore::ImageRegion *virtual get_image_region(DisplayData *) const DISPLAY_PURE_VIRTUAL(Region const std::set< Region * > get_selected_regions)()
Definition: Region.qo.h:515
std::list< ls_ele > ls_stack
Definition: Region.qo.h:546
virtual void mark(bool set=true)
functions added with the introduction of RegionToolManager and the unified selection and manipulation...
QtMouseToolNames::PointRegionSymbols type_
Definition: Region.qo.h:596
void initHistogram()
-----------------—==================== from old QtRegion ====================-----------------— ...
size_t selected_region_count()
Interface for DisplayDatas which have data arranged in axes.
void linear_to_pixel(WorldCanvas *wc_, double, double, double &, double &)
convert linear coordinates to casa pixel coordinates...
void to_linear_offset(WorldCanvas *, casacore::MDirection::Types in_type, double, double, double &, double &)
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
Definition: MDirection.h:188
void pixel_to_linear(WorldCanvas *wc_, double, double, double &, double &)
convert casa pixel coordinates to linear coordinates...
void invalidateCenterInfo()
indicates that the center info is no longer valid
virtual void drawText()
virtual bool marked() const
Definition: Region.qo.h:301
std::string textColor() const
Definition: Region.qo.h:180
void clearStatistics()
blank out the statistics for this region
std::string lineColor() const
Definition: Region.qo.h:167
bool statistics_update_needed
Definition: Region.qo.h:473
static bool regionSelected(int v)
Definition: Region.qo.h:155
std::string textColor() const
bool regionVisible() const
Definition: Region.qo.h:226
virtual void output(ds9writer &out) const =0
bool translateY(const std::string &, const std::string &, const std::string &)
All regions are specified in &quot;linear coordinates&quot;, not &quot;pixel coordinates&quot;.
Definition: Region.qo.h:147
virtual std::list< std::shared_ptr< RegionInfo > > * generate_dds_centers()=0
void setDrawCenter(bool draw_center)
Definition: Region.qo.h:250
std::string lineColor() const
virtual void setLabel(const std::string &l)
int & colorIndex()
used to synchronize the default color for all of the RegionDock&#39;s RegionState objects...
QString getSaveDir()
used to synchronize all region directories per QtDisplayPanelGUI...
virtual bool weaklySelected() const
is this region weakly or temporarily selected?
bool complete
Should this region be considered complete? Set to true by derived classes...
Definition: Region.qo.h:556
virtual void virtual setCenter(double &, double &, double &, double &) DISPLAY_PURE_VIRTUAL(Region void drawCenter(double &x, double &y)
Definition: Region.qo.h:538
int lineWidth() const
Definition: Region.qo.h:173
size_t marked_region_count()
void zRange(int &x, int &y) const
region::TextPosition textPosition() const
Definition: Region.qo.h:195
virtual bool mark_toggle()
returns the new state...
static bool handleSelected(int v)
Definition: Region.qo.h:158
QtRegionState * state()
DISPLAY_PURE_VIRTUAL(Region::pixelCenter,);.
Definition: Region.qo.h:377
std::string textValue() const
virtual region::PointInfo checkPoint(double x, double y) const =0
bool resizeY(const std::string &, const std::string &, const std::string &)
virtual bool within_drawing_area()
void putSaveDir(QString)
void regionChange(viewer::Region *, std::string)
virtual void weaklySelect(bool scroll_dock=true)
region::TextPosition textPosition() const
int zIndex() const
virtual bool markCenter() const
Definition: Region.qo.h:316
void textPositionDelta(int &x, int &y) const
virtual bool skyComponent() const
Definition: Region.qo.h:320
void putLoadDir(QString)
void linear_offset_to_pixel_offset(WorldCanvas *wc_, double, double, double &, double &)
QtRegionDock * dock_
Definition: Region.qo.h:469
QtRegionState * mystate
Definition: Region.qo.h:470
Quantities (i.e. dimensioned values)
Definition: QuantumHolder.h:44
region::LineStyle current_ls
Definition: Region.qo.h:544
int markerScale() const
how much to scale the symbol used to mark point regions...
Definition: Region.qo.h:383
TableExprNode shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape...
Definition: ExprNode.h:1944
ImageRegion_state(casacore::ImageRegion *ir, size_t region_count)
Definition: Region.qo.h:128
region::LineStyle lineStyle() const
Definition: Region.qo.h:176
void textPositionDelta(int &x, int &y) const
Definition: Region.qo.h:198
std::pair< int, int > & tabState()
used to synchronize all of the RegionDock&#39;s RegionState tab configuration...
void casa_viewer_pure_virtual(const char *file, int line, const char *func)
HistogramTab * histogram
Definition: Region.qo.h:471
Class to hold a region of interest in an image.
Definition: ImageRegion.h:86
LineStyle
LSDoubleDashed is only used to preserve state (it is a Display::LineStyle option) ...
Definition: RegionEnums.h:27
bool selected() const
Definition: Region.qo.h:271
int textFontStyle() const
Definition: Region.qo.h:189
virtual void generate_nonimage_statistics(DisplayData *, std::list< std::shared_ptr< RegionInfo > > *)
hook to allow generate_dds_statistics() to generate statistics for rectangular measurement set region...
Definition: Region.qo.h:504
void linear_to_b1950(WorldCanvas *wc_, double, double, double &, double &)
static void creatingRegionEnd()
Definition: Region.qo.h:353
virtual void boundingRectangle(double &, double &, double &, double &) const DISPLAY_PURE_VIRTUAL(Region void emitUpdate()
in &quot;linear&quot; coordinates...
Definition: Region.qo.h:331
virtual void weaklyUnselect()
weaklyUnselectLimited() plus extra processing...
void signal_region_change(region::RegionChanges)
void update_histogram_event()
Called when the histogram stack needs to be changed due to the add/removal of an image.
bool translateX(const std::string &, const std::string &, const std::string &)
int textFontSize() const
Definition: Region.qo.h:186
Implementation of drawing in world coordinates on top of a PixelCanvas.
Definition: WorldCanvas.h:204
std::string textValue() const
Definition: Region.qo.h:192
Manages a stack widget that displays histograms for a single region but multiple images.
virtual RegionInfo * newInfoObject(casacore::ImageInterface< float > *, PrincipalAxesDD *)
newInfoObject(...) is currently only used for PVLine regions, but it should be used for other regions...
Definition: Region.qo.h:508
const Double c
Fundamental physical constants (SI units):
RegionInfo::center_t * getLayerCenter(PrincipalAxesDD *padd, std::shared_ptr< casacore::ImageInterface< float > > image, casacore::ImageRegion &imgReg)
std::string textFont() const
Definition: Region.qo.h:183
void world_to_pixel(WorldCanvas *wc_, double, double, int &, int &)
convert world to pixel coordinates
static const int SEXAGPREC
Definition: Region.qo.h:467
WorldCanvas * wc_
Definition: Region.qo.h:547
virtual void setAnnotation(bool)
void linear_to_j2000(WorldCanvas *wc_, double, double, double &, double &)
convert linear coordinates to specific coordinate systems...
virtual bool valid_translation(double dx, double dy, double width_delta, double height_delta)=0
static bool refreshNeeded(int v)
functions to query results from mouse functions...
Definition: Region.qo.h:152
void world_to_linear(WorldCanvas *wc_, double, double, double &, double &)
convert world coordinates to linear coordinates...
#define DISPLAY_PURE_VIRTUAL(FUNCTION, RESULT)
Definition: Region.qo.h:52
virtual void drawRegion(bool)=0
stats_t center_t
typedef std::pair&lt;casacore::String,String&gt; center_element; typedef std::list&lt;center_element&gt; center_t...
Definition: RegionInfo.h:53
bool worldBoundingRectangle(double &, double &, const std::string &) const
void refresh_position_event(bool)
double linear_average(double a, double b) const
Definition: Region.qo.h:522
const std::string name() const
user specified name
Definition: Region.qo.h:163
virtual void releaseSignals()
Definition: Region.qo.h:337
Base class for display objects.
Definition: DisplayData.h:317
void revoke_region()
revoke...
void reload_statistics_event()
void translate_x(const QString &, const QString &, const QString &)
void translate_y(const QString &, const QString &, const QString &)
std::string centerColor() const
Definition: Region.qo.h:170
virtual region::RegionTypes type() const =0
-----------------—==================== from old QtRegion ====================-----------------— ...
virtual void selectedInCanvas()
indicates that the user has selected this rectangle...
virtual void setLabelPosition(region::TextPosition)
void selectionChanged(viewer::Region *, bool)
void screen_to_linear(WorldCanvas *wc_, int, int, double &, double &)
convert viewer screen coordinates to linear coordinates...
virtual ImageRegion_state get_image_selected_region(DisplayData *)
virtual bool setMarker(QtMouseToolNames::PointRegionSymbols)
Definition: Region.qo.h:416
Defines nreal time structures used by the VLA table filler.
Definition: nreal.h:100
void regionUpdateResponse(int, const QString &shape, const QString &name, const QList< double > &world_x, const QList< double > &world_y, const QList< int > &pixel_x, const QList< int > &pixel_y, const QString &linecolor, const QString &text, const QString &font, int fontsize, int fontstyle)
generated by emitUpdate()...
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42
virtual void setLine(const std::string &line_color="", region::LineStyle line_style=region::SolidLine, unsigned int line_width=1)