#include <display/region/QtRegionSource.qo.h>
#include <display/QtViewer/QtDisplayPanelGui.qo.h>
#include <display/region/Rectangle.h>
#include <display/region/Polygon.h>
#include <display/region/Polyline.qo.h>
#include <display/region/Ellipse.h>
#include <display/region/Point.h>
#include <display/region/PVLine.qo.h>
#include <display/ds9/ds9parser.h>
#include <display/DisplayDatas/DisplayData.h>
#include <imageanalysis/Annotations/AnnRectBox.h>
#include <imageanalysis/Annotations/AnnEllipse.h>
#include <imageanalysis/Annotations/AnnSymbol.h>
#include <imageanalysis/Annotations/AnnPolygon.h>
#include <imageanalysis/Annotations/AnnPolyline.h>
#include <measures/Measures/MCDirection.h>
using namespace casacore;
QtRegionSourceKernel::QtRegionSourceKernel( QtDisplayPanelGui *panel ) : panel_(panel) {
connect( panel_, SIGNAL(axisToolUpdate(QtDisplayData*)), this, SLOT(updateRegionState(QtDisplayData*)) );
QtRegionSourceKernel::~QtRegionSourceKernel( ) { }
void QtRegionSourceKernel::revokeRegion( Region *r ) {
std::map<Region*,RegionCreator*>::iterator it = creator_of_region.find(r);
if ( it != creator_of_region.end( ) ) {
RegionCreator *creator = it->second;
creator_of_region.erase(it);
creator->revokeRegion(r);
void QtRegionSourceKernel::dtorCalled( const dtorNotifier *r ) {
RegionSourceKernel::dtorCalled( r );
std::map<Region*,RegionCreator*>::iterator it = creator_of_region.find((Region*)r);
if ( it != creator_of_region.end( ) ) {
creator_of_region.erase(it);
std::shared_ptr<Rectangle> QtRegionSourceKernel::rectangle( RegionCreator *rc, WorldCanvas *wc, double blc_x, double blc_y, double trc_x, double trc_y ) {
Rectangle *result = new Rectangle( this, wc, blc_x, blc_y, trc_x, trc_y, true );
creator_of_region[result] = rc;
register_new_region( result );
connect( result, SIGNAL( regionCreated( int, const QString &, const QString &, const QList<double> &, const QList<double> &,
const QList<int> &, const QList<int> &, const QString &, const QString &, const QString &, int, int ) ),
this, SIGNAL( regionCreated( int, const QString &, const QString &, const QList<double> &, const QList<double> &,
const QList<int> &, const QList<int> &, const QString &, const QString &, const QString &, int, int ) ) );
connect( result, SIGNAL( regionUpdate( int, viewer::region::RegionChanges, const QList<double> &, const QList<double> &, const QList<int> &, const QList<int> & ) ),
this, SIGNAL( regionUpdate( int, viewer::region::RegionChanges, const QList<double> &, const QList<double> &, const QList<int> &, const QList<int> & ) ) );