Point.h

Go to the documentation of this file.
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,
00062                                            hold_signals, new QtPointState( QString("point"), sym ), sym ), marker_(sym) {
00063                                 mystate->setRegion(this);
00064                                 /***updateStatistics***/
00065                         }
00066 
00067                         bool setMarker( QtMouseToolNames::PointRegionSymbols sym );
00068 
00069                         int clickHandle( double /*x*/, double /*y*/ ) const {
00070                                 return 0;
00071                         }
00072 
00073                         bool clickWithin( double x, double y ) const;
00074 
00075                         // returns point state (Region::PointLocation)
00076                         region::PointInfo checkPoint( double x, double y ) const;
00077 
00078                         // returns mouse movement state
00079                         unsigned int mouseMovement( double x, double y, bool other_selected );
00080                         void resize( double, double ) { }
00081 
00082                         AnnotationBase *annotation( ) const;
00083 
00084                         // points cannot be degenerate...
00085                         bool degenerate( ) const {
00086                                 return false;
00087                         }
00088 
00089                         // fetch region type...
00090                         region::RegionTypes type( ) const {
00091                                 return region::PointRegion;
00092                         }
00093 
00094                         void releaseSignals( );
00095 
00096                 protected:
00097 
00098                         static const int radius;
00099 
00100                         virtual void fetch_region_details( region::RegionTypes &type, std::vector<std::pair<int,int> > &pixel_pts,
00101                                                            std::vector<std::pair<double,double> > &world_pts ) const;
00102 
00103                         void drawRegion( bool );
00104 
00105                         std::list<SHARED_PTR<RegionInfo> > *generate_dds_centers( );
00106 
00107                         QtMouseToolNames::PointRegionSymbols marker_;
00108 
00109                 private:
00110                         virtual bool output_region( ds9writer &out, WorldCanvas *wc, const std::vector<std::pair<double,double> > &pts ) const;
00111                         void draw_arrow( PixelCanvas *, int /*x*/, int /*y*/, int /*xsign*/, int /*ysign*/,
00112                                          int /*scale_unit*/, int /*scale*/ );
00113 
00114                 };
00115         }
00116 }
00117 
00118 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1