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