casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Ellipse.h
Go to the documentation of this file.
1 //# ellipse.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_ELLIPSE_H_
30 #define REGION_ELLIPSE_H_
31 
33 #include <casa/BasicSL/String.h>
34 #include <list>
35 
36 namespace casa {
37 
38  class PanelDisplay;
39  class AnnRegion;
40 
41  namespace viewer {
42 
43  // carry over from QtRegion... hopefully, removed soon...
44  class QtRegionSourceKernel;
45 
46  // All regions are specified in "linear coordinates", not "pixel coordinates". This is necessary
47  // because "linear coordinates" scale with zooming whereas "pixel coordinates" do not. Unfortunately,
48  // this means that coordinate transformation is required each time the region is drawn.
49  class Ellipse : public Rectangle {
50  public:
51  ~Ellipse( );
52  Ellipse( WorldCanvas *wc, QtRegionDock *d, double x1, double y1, double x2, double y2);
53 
54  // carry over from QtRegion... hopefully, removed soon...
55  Ellipse( QtRegionSourceKernel *factory, WorldCanvas *wc, double x1, double y1, double x2, double y2, bool hold_signals=false );
56 
57  // returns mouse movement state
58  unsigned int mouseMovement( double x, double y, bool other_selected );
59 
60  AnnotationBase *annotation( ) const;
61 
62  bool flag( MSAsRaster * ) {
63  return false;
64  }
65 
66  // fetch region type...
68  return region::EllipseRegion;
69  }
70 
71  protected:
72  std::list<std::shared_ptr<RegionInfo> > *generate_dds_centers( );
74  // Ellipse is derived from Rectangle, but we have no way to generate ellipse
75  // statistics for a measurement set (our only non-image display data)... so
76  // we have to define this to prevent casacore::MS info being reported for the bounding
77  // rectangle of an Ellipse...
78  void generate_nonimage_statistics( DisplayData*, std::list<RegionInfo> * ) { }
79 
80  virtual void fetch_region_details( region::RegionTypes &type, std::vector<std::pair<int,int> > &pixel_pts,
81  std::vector<std::pair<double,double> > &world_pts ) const;
82 
83  void drawRegion( bool );
84  /* void drawHandles( ); */
85 
86  private:
87  std::pair<casacore::Vector<casacore::Quantity>,casacore::Vector<casacore::Quantity> > posAndRadii( ) const;
88  bool output_region( ds9writer &out, WorldCanvas *wc, const std::vector<std::pair<double,double> > &pts ) const;
89 
90  };
91  }
92 }
93 
94 #endif
A 1-D Specialization of the Array class.
Base class for annotations.
Class for displaying data within an casacore::MS as a raster (gridded) image.
Definition: MSAsRaster.h:128
AnnotationBase * annotation() const
void generate_nonimage_statistics(DisplayData *, std::list< RegionInfo > *)
Ellipse is derived from Rectangle, but we have no way to generate ellipse statistics for a measuremen...
Definition: Ellipse.h:78
bool flag(MSAsRaster *)
Definition: Ellipse.h:62
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
region::RegionTypes type() const
fetch region type...
Definition: Ellipse.h:67
std::pair< casacore::Vector< casacore::Quantity >, casacore::Vector< casacore::Quantity > > posAndRadii() const
std::list< std::shared_ptr< RegionInfo > > * generate_dds_centers()
unsigned int mouseMovement(double x, double y, bool other_selected)
returns mouse movement state
Ellipse(WorldCanvas *wc, QtRegionDock *d, double x1, double y1, double x2, double y2)
Class to hold a region of interest in an image.
Definition: ImageRegion.h:86
All regions are specified in &quot;linear coordinates&quot;, not &quot;pixel coordinates&quot;.
Definition: Ellipse.h:49
Implementation of drawing in world coordinates on top of a PixelCanvas.
Definition: WorldCanvas.h:204
All regions are specified in &quot;linear coordinates&quot;, not &quot;pixel coordinates&quot;.
Definition: Rectangle.h:52
casacore::ImageRegion * get_image_region(DisplayData *) const
Base class for display objects.
Definition: DisplayData.h:317
bool output_region(ds9writer &out, WorldCanvas *wc, const std::vector< std::pair< double, double > > &pts) const