00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef REGION_QTREGIONSOURCE_H_
00030 #define REGION_QTREGIONSOURCE_H_
00031
00032 #include <map>
00033 #include <QObject>
00034 #include <display/region/RegionSource.h>
00035 #include <display/region/Region.qo.h>
00036
00037 class QStackedWidget;
00038
00039 namespace casa {
00040
00041 class QtDisplayPanelGui;
00042 class QtDisplayData;
00043
00044 class AnnRectBox;
00045 class AnnEllipse;
00046 class AnnSymbol;
00047 class AnnPolygon;
00048 class AnnPolyline;
00049
00050 namespace viewer {
00051
00052 class QtRegion;
00053 class QtRegionDock;
00054
00055 class QtRegionSourceKernel : public QObject, public RegionSourceKernel {
00056 Q_OBJECT
00057 public:
00058 QtRegionSourceKernel( QtDisplayPanelGui *panel );
00059
00060 QtRegionDock *dock( );
00061 int numFrames( ) const;
00062
00063 ~QtRegionSourceKernel( );
00064
00065 void revokeRegion( Region *r );
00066
00067
00068 void dtorCalled( const dtorNotifier * );
00069
00070 signals:
00071 void regionCreated( int, const QString &shape, const QString &name,
00072 const QList<double> &world_x, const QList<double> &world_y,
00073 const QList<int> &pixel_x, const QList<int> &pixel_y,
00074 const QString &linecolor, const QString &text, const QString &font, int fontsize, int fontstyle );
00075 void regionUpdate( int, viewer::region::RegionChanges, const QList<double> &world_x, const QList<double> &world_y,
00076 const QList<int> &pixel_x, const QList<int> &pixel_y );
00077 void regionUpdateResponse( int, const QString &shape, const QString &name,
00078 const QList<double> &world_x, const QList<double> &world_y,
00079 const QList<int> &pixel_x, const QList<int> &pixel_y,
00080 const QString &linecolor, const QString &text, const QString &font, int fontsize, int fontstyle );
00081 void newCorners( double, double, double, double);
00082 void show1DSliceTool();
00083
00084 public slots:
00085
00086 void adjustPosition( double blcx, double blcy, double trcx, double trcy );
00087
00088 protected:
00089 friend class QtRegionSource;
00090
00091
00092 SHARED_PTR<Rectangle> rectangle( RegionCreator *rc, WorldCanvas *wc, double blc_x, double blc_y, double trc_x, double trc_y );
00093 SHARED_PTR<Polygon> polygon( RegionCreator *rc, WorldCanvas *wc, double x1, double y1 );
00094 SHARED_PTR<Polygon> polygon( RegionCreator *rc, WorldCanvas *wc, const std::vector<std::pair<double,double> > &pts );
00095 SHARED_PTR<Polyline> polyline( RegionCreator *rc, WorldCanvas *wc, double x1, double y1 );
00096 SHARED_PTR<Polyline> polyline( RegionCreator *rc, WorldCanvas *wc, const std::vector<std::pair<double,double> > &pts );
00097 SHARED_PTR<PVLine> pvline( RegionCreator *rc, WorldCanvas *wc, double blc_x, double blc_y, double trc_x, double trc_y );
00098
00099
00100
00101
00102
00103 SHARED_PTR<Rectangle> ellipse( RegionCreator *rc, WorldCanvas *wc, double blc_x, double blc_y, double trc_x, double trc_y );
00104 SHARED_PTR<Rectangle> point( RegionCreator *rc, WorldCanvas *wc, double x, double y, QtMouseToolNames::PointRegionSymbols sym, int size );
00105
00106 QtMouseToolNames::PointRegionSymbols currentPointSymbolType( ) const;
00107
00108
00109 protected slots:
00110 void loadRegions( const QString &path, const QString &type );
00111 void updateRegionState(QtDisplayData*);
00112
00113
00114
00115 private:
00116
00117 void load_crtf_regions( WorldCanvas *, const QString &path );
00118 void load_crtf_rectangle( WorldCanvas *wc, MDirection::Types cstype, const AnnRectBox *box );
00119 void load_crtf_ellipse( WorldCanvas *wc, MDirection::Types cstype, const AnnEllipse *ellipse );
00120 void load_crtf_point( WorldCanvas *wc, MDirection::Types cstype, const AnnSymbol *symbol );
00121 void load_crtf_polygon( WorldCanvas *wc, MDirection::Types cstype, const AnnPolygon *polygon );
00122 void load_crtf_polyline( WorldCanvas *wc, MDirection::Types cstype, const AnnPolyline *polyline );
00123
00124 QtDisplayPanelGui *panel_;
00125
00126 std::map<Region*,RegionCreator*> creator_of_region;
00127
00128 };
00129
00130 class QtRegionSource : public RegionSource {
00131 public:
00132 QtRegionSource( RegionCreator *rc, QtDisplayPanelGui *panel );
00133 protected:
00134 friend class QtRegionSourceFactory;
00135 QtRegionSource( RegionCreator *rc, QtDisplayPanelGui *panel, const shared_kernel_ptr_type &kernel );
00136 };
00137
00138 }
00139 }
00140
00141 #endif