casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QtRegionSource.qo.h
Go to the documentation of this file.
1 //# qtregionsource.qo.h: qtregionsource producing persistent regions used within the casa viewer
2 //# Copyright (C) 2011
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 
29 #ifndef REGION_QTREGIONSOURCE_H_
30 #define REGION_QTREGIONSOURCE_H_
31 
32 #include <map>
33 #include <QObject>
36 
37 class QStackedWidget;
38 
39 namespace casa {
40 
41  class QtDisplayPanelGui;
42  class QtDisplayData;
43 
44  class AnnRectBox;
45  class AnnEllipse;
46  class AnnSymbol;
47  class AnnPolygon;
48  class AnnPolyline;
49 
50  namespace viewer {
51 
52  class QtRegion;
53  class QtRegionDock;
54 
55  class QtRegionSourceKernel : public QObject, public RegionSourceKernel {
56  Q_OBJECT
57  public:
59 
60  QtRegionDock *dock( );
61  int numFrames( ) const;
62 
64 
65  void revokeRegion( Region *r );
66 
67  // inherited pure-virtual from dtorNotifiee, removes deleted regions...
68  void dtorCalled( const dtorNotifier * );
69 
70  signals:
71  void regionCreated( int, const QString &shape, const QString &name,
72  const QList<double> &world_x, const QList<double> &world_y,
73  const QList<int> &pixel_x, const QList<int> &pixel_y,
74  const QString &linecolor, const QString &text, const QString &font, int fontsize, int fontstyle );
75  void regionUpdate( int, viewer::region::RegionChanges, const QList<double> &world_x, const QList<double> &world_y,
76  const QList<int> &pixel_x, const QList<int> &pixel_y );
77  void regionUpdateResponse( int, const QString &shape, const QString &name,
78  const QList<double> &world_x, const QList<double> &world_y,
79  const QList<int> &pixel_x, const QList<int> &pixel_y,
80  const QString &linecolor, const QString &text, const QString &font, int fontsize, int fontstyle );
81  void newCorners( double, double, double, double);
82  void show1DSliceTool();
83 
84  public slots:
85 //Used to change the position of the source.
86  void adjustPosition( double blcx, double blcy, double trcx, double trcy );
87 
88  protected:
89  friend class QtRegionSource;
90 
91  /* std::shared_ptr<Rectangle> rectangle( int blc_x, int blc_y, int trc_x, int trc_y ); */
92  std::shared_ptr<Rectangle> rectangle( RegionCreator *rc, WorldCanvas *wc, double blc_x, double blc_y, double trc_x, double trc_y );
93  std::shared_ptr<Polygon> polygon( RegionCreator *rc, WorldCanvas *wc, double x1, double y1 );
94  std::shared_ptr<Polygon> polygon( RegionCreator *rc, WorldCanvas *wc, const std::vector<std::pair<double,double> > &pts );
95  std::shared_ptr<Polyline> polyline( RegionCreator *rc, WorldCanvas *wc, double x1, double y1 );
96  std::shared_ptr<Polyline> polyline( RegionCreator *rc, WorldCanvas *wc, const std::vector<std::pair<double,double> > &pts );
97  std::shared_ptr<PVLine> pvline( RegionCreator *rc, WorldCanvas *wc, double blc_x, double blc_y, double trc_x, double trc_y );
98 
99 // ellipse is derived from rectangle... so while this should be "std::shared_ptr<Ellipse>" this would preclude
100 // the direct reuse of the Rectangle code (which only differs by region creation)... perhaps a case where
101 // smart pointers are not so smart (in not mirroring the inheritance hiearchy)... though perhaps it can be
102 // generalized to "std::shared_ptr<Region>"...
103  std::shared_ptr<Rectangle> ellipse( RegionCreator *rc, WorldCanvas *wc, double blc_x, double blc_y, double trc_x, double trc_y );
104  std::shared_ptr<Rectangle> point( RegionCreator *rc, WorldCanvas *wc, double x, double y, QtMouseToolNames::PointRegionSymbols sym, int size );
105 
107 
108 
109  protected slots:
110  void loadRegions( const QString &path, const QString &type );
112 
113 
114 
115  private:
116 
117  void load_crtf_regions( WorldCanvas *, const QString &path );
120  void load_crtf_point( WorldCanvas *wc, casacore::MDirection::Types cstype, const AnnSymbol *symbol );
123 
125 
126  std::map<Region*,RegionCreator*> creator_of_region;
127 
128  };
129 
130  class QtRegionSource : public RegionSource {
131  public:
133  protected:
134  friend class QtRegionSourceFactory;
136  };
137 
138  }
139 }
140 
141 #endif
This class represents an annotation of an elliptical (in position coordinates) region specified in an...
Definition: AnnEllipse.h:50
void load_crtf_regions(WorldCanvas *, const QString &path)
QtMouseToolNames::PointRegionSymbols currentPointSymbolType() const
void regionUpdateResponse(int, const QString &shape, const QString &name, const QList< double > &world_x, const QList< double > &world_y, const QList< int > &pixel_x, const QList< int > &pixel_y, const QString &linecolor, const QString &text, const QString &font, int fontsize, int fontstyle)
void dtorCalled(const dtorNotifier *)
inherited pure-virtual from dtorNotifiee, removes deleted regions...
This class represents an annotation for rectangular (in position coordinates) region specified in an ...
Definition: AnnRectBox.h:48
void regionCreated(int, const QString &shape, const QString &name, const QList< double > &world_x, const QList< double > &world_y, const QList< int > &pixel_x, const QList< int > &pixel_y, const QString &linecolor, const QString &text, const QString &font, int fontsize, int fontstyle)
virtual Type type()
Return the type enum.
QtRegionSource(RegionCreator *rc, QtDisplayPanelGui *panel)
This class represents a single polygon (in position coordinates) annotation specified in an ascii reg...
Definition: AnnPolygon.h:46
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the if a human readable name(i.e."black").In many places throughout the plotter
shared_kernel_ptr_type kernel()
Definition: RegionSource.h:131
void adjustPosition(double blcx, double blcy, double trcx, double trcy)
Used to change the position of the source.
size_t size() const
std::shared_ptr< Rectangle > point(RegionCreator *rc, WorldCanvas *wc, double x, double y, QtMouseToolNames::PointRegionSymbols sym, int size)
This class represents a single polyline (in position coordinates) annotation specified in an ascii re...
Definition: AnnPolyline.h:45
void newCorners(double, double, double, double)
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
Definition: MDirection.h:188
std::shared_ptr< Polyline > polyline(RegionCreator *rc, WorldCanvas *wc, double x1, double y1)
RegionSourceKernel::shared_kernel_ptr_type shared_kernel_ptr_type
Definition: RegionSource.h:97
Represents a symbol annotation.
Definition: AnnSymbol.h:47
All regions are specified in &quot;linear coordinates&quot;, not &quot;pixel coordinates&quot;.
Definition: Region.qo.h:147
void load_crtf_polyline(WorldCanvas *wc, casacore::MDirection::Types cstype, const AnnPolyline *polyline)
std::string path(const std::string &name)
void updateRegionState(QtDisplayData *)
The main display window for the Qt version of the viewer.
std::shared_ptr< Rectangle > ellipse(RegionCreator *rc, WorldCanvas *wc, double blc_x, double blc_y, double trc_x, double trc_y)
ellipse is derived from rectangle...
std::shared_ptr< PVLine > pvline(RegionCreator *rc, WorldCanvas *wc, double blc_x, double blc_y, double trc_x, double trc_y)
void loadRegions(const QString &path, const QString &type)
void regionUpdate(int, viewer::region::RegionChanges, const QList< double > &world_x, const QList< double > &world_y, const QList< int > &pixel_x, const QList< int > &pixel_y)
TableExprNode shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape...
Definition: ExprNode.h:1944
std::shared_ptr< Rectangle > rectangle(RegionCreator *rc, WorldCanvas *wc, double blc_x, double blc_y, double trc_x, double trc_y)
std::shared_ptr< Polygon > polygon(RegionCreator *rc, WorldCanvas *wc, double x1, double y1)
QtRegionSourceKernel(QtDisplayPanelGui *panel)
std::map< Region *, RegionCreator * > creator_of_region
Implementation of drawing in world coordinates on top of a PixelCanvas.
Definition: WorldCanvas.h:204
void load_crtf_polygon(WorldCanvas *wc, casacore::MDirection::Types cstype, const AnnPolygon *polygon)
void load_crtf_rectangle(WorldCanvas *wc, casacore::MDirection::Types cstype, const AnnRectBox *box)
void load_crtf_ellipse(WorldCanvas *wc, casacore::MDirection::Types cstype, const AnnEllipse *ellipse)
void load_crtf_point(WorldCanvas *wc, casacore::MDirection::Types cstype, const AnnSymbol *symbol)