RegionEnums.h

Go to the documentation of this file.
00001 #ifndef REGION_REGIONENUM_H_
00002 #define REGION_REGIONENUM_H_
00003 
00004 #include <string>
00005 #include <set>
00006 #include <stdio.h>
00007 
00008 namespace casa {
00009         namespace viewer {
00010 
00011                 class Region;
00012 
00013                 namespace region {
00014                         typedef std::set<Region*> region_list_type;
00015 
00016                         template<class T> void dump( const std::string &prefix, const std::set<T*> &s ) {
00017                                 fprintf( stderr, "%s ", prefix.c_str( ) );
00018                                 for ( typename std::set<T*>::const_iterator i=s.begin( ); i != s.end( ); ++i ) {
00019                                         fprintf( stderr, "0x%x ", *i );
00020                                 }
00021                                 fprintf( stderr, "\n" );
00022                         }
00023 
00024 
00025                         /* enum states { undisplayed, inactive, highlighted, selected }; */
00026                         // LSDoubleDashed is only used to preserve state (it is a Display::LineStyle option)
00027                         enum LineStyle { SolidLine, DashLine, DotLine, LSDoubleDashed };
00028                         enum TextPosition { TopText, RightText, BottomText, LeftText };
00029                         enum TextFontStyle { ItalicText = 1 << 0, BoldText = 1 << 1 };
00030                         enum Coord { J2000, B1950, Galactic, SuperGalactic, Ecliptic, DefaultCoord };
00031                         enum Units { Degrees, Radians, Sexagesimal, Pixel, DefaultUnits };
00032 
00033                         // state returned from mouse functions for regions...
00034                         enum MouseState { MouseRefresh = 1 << 0, MouseSelected = 1 << 1, MouseHandle = 1 << 2 };
00035 
00036                         enum RegionTypes { RectRegion, PointRegion, EllipseRegion, PolyRegion, PolylineRegion, PVLineRegion, NonRegion };
00037                         enum RegionSelect { SelectAny, SelectRect, SelectPoint, SelectEllipse, SelectPoly, SelectPolyline, SelectPVLine };
00038                         inline RegionTypes select_to_region( RegionSelect select ) {
00039                                 return select == SelectRect ? RectRegion :
00040                                        select == SelectPoint ? PointRegion :
00041                                        select == SelectEllipse ? EllipseRegion :
00042                                        select == SelectPoly ? PolyRegion :
00043                                        select == SelectPolyline ? PolylineRegion :
00044                                        select == SelectPVLine ? PVLineRegion : NonRegion;
00045                         }
00046 
00047 
00048                         enum PointLocation { PointInside = 1 << 0, PointHandle = 1 << 1, PointOutside = 1 << 2 };
00049 
00050                         enum RegionChanges { RegionChangeCreate, RegionChangeUpdate, RegionChangeReset,
00051                                              RegionChangeFocus, RegionChangeModified, RegionChangeLabel, RegionChangeDelete,
00052                                              RegionChangeStatsUpdate, RegionChangeNewChannel, RegionChangeSelected
00053                                            };
00054 
00055                         class PointInfo {
00056                         public:
00057                                 PointInfo( double x, double y, unsigned int location, unsigned int handle=0 ) :
00058                                         x_(x), y_(y), location_(location), handle_(handle) { }
00059                                 PointInfo( const PointInfo &other) : x_(other.x_), y_(other.y_), location_(other.location_), handle_(other.handle_) { }
00060                                 unsigned int handle( ) const {
00061                                         return handle_;
00062                                 }
00063                                 unsigned int &handle( ) {
00064                                         return handle_;
00065                                 }
00066                                 unsigned int location( ) const {
00067                                         return location_;
00068                                 }
00069                                 unsigned int operator&( region::PointLocation mask ) const {
00070                                         return location_ & mask;
00071                                 }
00072                                 const PointInfo &operator=( const PointInfo &other ) {
00073                                         x_ = other.x_;
00074                                         y_ = other.y_;
00075                                         location_ = other.location_;
00076                                         handle_ = other.handle_;
00077                                         return *this;
00078                                 }
00079                                 double x( ) const {
00080                                         return x_;
00081                                 }
00082                                 double y( ) const {
00083                                         return y_;
00084                                 }
00085                                 double &x( ) {
00086                                         return x_;
00087                                 }
00088                                 double &y( ) {
00089                                         return y_;
00090                                 }
00091                         private:
00092                                 double x_, y_;
00093                                 unsigned int location_;
00094                                 unsigned int handle_;
00095                         };
00096 
00097                 }
00098         }
00099 }
00100 
00101 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1