casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Point.h
Go to the documentation of this file.
1 //# point.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_POINT_H_
30 #define REGION_POINT_H_
31 
34 #include <casa/BasicSL/String.h>
35 #include <list>
36 
37 namespace casa {
38 
39  class PanelDisplay;
40  class AnnRegion;
41  class PixelCanvas;
42 
43  namespace viewer {
44 
45  // carry over from QtRegion... hopefully, removed soon...
46  class QtRegionSourceKernel;
47 
48  // All regions are specified in "linear coordinates", not "pixel coordinates". This is necessary
49  // because "linear coordinates" scale with zooming whereas "pixel coordinates" do not. Unfortunately,
50  // this means that coordinate transformation is required each time the region is drawn.
51  class Point : public Rectangle {
52  public:
53  ~Point( );
55  Rectangle( wc, d, x, y, x, y ), marker_(sym) {
56  /***updateStatistics***/
57  }
58 
59  // carry over from QtRegion... hopefully, removed soon...
61  Rectangle( "point", wc, factory->dock( ), x, y, x, y,
62  hold_signals, new QtPointState( QString("point"), sym ), sym ), marker_(sym) {
63  mystate->setRegion(this);
64  /***updateStatistics***/
65  }
66 
68 
69  int clickHandle( double /*x*/, double /*y*/ ) const {
70  return 0;
71  }
72 
73  bool clickWithin( double x, double y ) const;
74 
75  // returns point state (Region::PointLocation)
76  region::PointInfo checkPoint( double x, double y ) const;
77 
78  // returns mouse movement state
79  unsigned int mouseMovement( double x, double y, bool other_selected );
80  void resize( double, double ) { }
81 
82  AnnotationBase *annotation( ) const;
83 
84  // points cannot be degenerate...
85  bool degenerate( ) const {
86  return false;
87  }
88 
89  // fetch region type...
91  return region::PointRegion;
92  }
93 
94  void releaseSignals( );
95 
96  protected:
97 
98  static const int radius;
99 
100  virtual void fetch_region_details( region::RegionTypes &type, std::vector<std::pair<int,int> > &pixel_pts,
101  std::vector<std::pair<double,double> > &world_pts ) const;
102 
103  void drawRegion( bool );
104 
105  std::list<std::shared_ptr<RegionInfo> > *generate_dds_centers( );
106 
108 
109  private:
110  virtual bool output_region( ds9writer &out, WorldCanvas *wc, const std::vector<std::pair<double,double> > &pts ) const;
111  void draw_arrow( PixelCanvas *, int /*x*/, int /*y*/, int /*xsign*/, int /*ysign*/,
112  int /*scale_unit*/, int /*scale*/ );
113 
114  };
115  }
116 }
117 
118 #endif
unsigned int mouseMovement(double x, double y, bool other_selected)
returns mouse movement state
Base class for annotations.
static const int radius
Definition: Point.h:98
AnnotationBase * annotation() const
std::list< std::shared_ptr< RegionInfo > > * generate_dds_centers()
void resize(double, double)
Definition: Point.h:80
region::PointInfo checkPoint(double x, double y) const
returns point state (Region::PointLocation)
int clickHandle(double, double) const
Definition: Point.h:69
bool degenerate() const
points cannot be degenerate...
Definition: Point.h:85
void draw_arrow(PixelCanvas *, int, int, int, int, int, int)
Base class defining interface to pixel-based output devices.
Definition: PixelCanvas.h:161
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
void drawRegion(bool)
All regions are specified in &quot;linear coordinates&quot;, not &quot;pixel coordinates&quot;.
Definition: Point.h:51
bool clickWithin(double x, double y) const
Point(WorldCanvas *wc, QtRegionDock *d, double x, double y, QtMouseToolNames::PointRegionSymbols sym)
Definition: Point.h:54
QtRegionState * mystate
Definition: Region.qo.h:470
QtMouseToolNames::PointRegionSymbols marker_
Definition: Point.h:107
Implementation of drawing in world coordinates on top of a PixelCanvas.
Definition: WorldCanvas.h:204
region::RegionTypes type() const
fetch region type...
Definition: Point.h:90
bool setMarker(QtMouseToolNames::PointRegionSymbols sym)
All regions are specified in &quot;linear coordinates&quot;, not &quot;pixel coordinates&quot;.
Definition: Rectangle.h:52
Point(QtRegionSourceKernel *factory, WorldCanvas *wc, double x, double y, bool hold_signals=false, QtMouseToolNames::PointRegionSymbols sym=QtMouseToolNames::SYM_DOT)
carry over from QtRegion...
Definition: Point.h:60
virtual bool output_region(ds9writer &out, WorldCanvas *wc, const std::vector< std::pair< double, double > > &pts) const