casa
$Rev:20696$
|
00001 //# point.h: base class for statistical regions 00002 //# Copyright (C) 2011 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# $Id$ 00027 00028 00029 #ifndef REGION_POINT_H_ 00030 #define REGION_POINT_H_ 00031 00032 #include <display/Display/MouseToolState.h> 00033 #include <display/region/Rectangle.h> 00034 #include <casa/BasicSL/String.h> 00035 #include <list> 00036 00037 namespace casa { 00038 00039 class PanelDisplay; 00040 class AnnRegion; 00041 class PixelCanvas; 00042 00043 namespace viewer { 00044 00045 // carry over from QtRegion... hopefully, removed soon... 00046 class QtRegionSourceKernel; 00047 00048 // All regions are specified in "linear coordinates", not "pixel coordinates". This is necessary 00049 // because "linear coordinates" scale with zooming whereas "pixel coordinates" do not. Unfortunately, 00050 // this means that coordinate transformation is required each time the region is drawn. 00051 class Point : public Rectangle { 00052 public: 00053 ~Point( ); 00054 Point( WorldCanvas *wc, QtRegionDock *d, double x, double y, QtMouseToolNames::PointRegionSymbols sym ) : 00055 Rectangle( wc, d, x, y, x, y ), marker_(sym) { 00056 /***updateStatistics***/ 00057 } 00058 00059 // carry over from QtRegion... hopefully, removed soon... 00060 Point( QtRegionSourceKernel *factory, WorldCanvas *wc, double x, double y, bool hold_signals=false, QtMouseToolNames::PointRegionSymbols sym=QtMouseToolNames::SYM_DOT ) : 00061 Rectangle( "point", wc, factory->dock( ), x, y, x, y, hold_signals, sym ), marker_(sym) { 00062 /***updateStatistics***/ 00063 } 00064 00065 bool setMarker( QtMouseToolNames::PointRegionSymbols sym ); 00066 00067 int clickHandle( double /*x*/, double /*y*/ ) const { 00068 return 0; 00069 } 00070 00071 bool clickWithin( double x, double y ) const; 00072 00073 // returns point state (Region::PointLocation) 00074 region::PointInfo checkPoint( double x, double y ) const; 00075 00076 // returns mouse movement state 00077 unsigned int mouseMovement( double x, double y, bool other_selected ); 00078 void resize( double, double ) { } 00079 00080 AnnotationBase *annotation( ) const; 00081 00082 // points cannot be degenerate... 00083 bool degenerate( ) const { 00084 return false; 00085 } 00086 00087 // fetch region type... 00088 region::RegionTypes type( ) const { 00089 return region::PointRegion; 00090 } 00091 00092 void releaseSignals( ); 00093 00094 protected: 00095 00096 static const int radius; 00097 00098 virtual void fetch_region_details( region::RegionTypes &type, std::vector<std::pair<int,int> > &pixel_pts, 00099 std::vector<std::pair<double,double> > &world_pts ) const; 00100 00101 void drawRegion( bool ); 00102 00103 std::list<std::tr1::shared_ptr<RegionInfo> > *generate_dds_centers( ); 00104 00105 QtMouseToolNames::PointRegionSymbols marker_; 00106 00107 private: 00108 void draw_arrow( PixelCanvas *, int /*x*/, int /*y*/, int /*xsign*/, int /*ysign*/, 00109 int /*scale_unit*/, int /*scale*/ ); 00110 00111 }; 00112 } 00113 } 00114 00115 #endif