Exemplo n.º 1
0
QgsDistanceArea::QgsDistanceArea()
{
  // init with default settings
  mEllipsoidalMode = false;
  setSourceCrs( GEOCRS_ID ); // WGS 84
  setEllipsoid( GEO_NONE );
}
Exemplo n.º 2
0
QgsDistanceArea::QgsDistanceArea()
{
  // init with default settings
  mEllipsoidalMode = false;
  mCoordTransform = new QgsCoordinateTransform;
  setSourceCrs( GEOCRS_ID ); // WGS 84
  setEllipsoid( GEO_NONE );
}
void Mesh::setSourceCrsFromWKT(const QString& wkt)
{
    QString proj4 = _setSourceCrsFromWKT(wkt);
    if (proj4.isEmpty()) {
        proj4 = _setSourceCrsFromESRI(wkt);
    }
    setSourceCrs(proj4);
}
Exemplo n.º 4
0
QgsDistanceArea::QgsDistanceArea()
{
  // init with default settings
  mProjectionsEnabled = false;
  mCoordTransform = new QgsCoordinateTransform;
  setSourceCrs( GEOCRS_ID ); // WGS 84
  setEllipsoid( "WGS84" );
}
/*
 * Initialize the GUI interface for the plugin - this is only called once when the plugin is
 * added to the plugin registry in the QGIS application.
 */
void CoordinateCapture::initGui()
{
    mCrs.createFromSrsId( GEOCRS_ID );	// initialize the CRS object

    connect( mQGisIface->mapCanvas()->mapRenderer(), SIGNAL( destinationSrsChanged() ), this, SLOT( setSourceCrs() ) );

    setSourceCrs();	//set up the source CRS
    mTransform.setDestCRS( mCrs );	// set the CRS in the transform
    mUserCrsDisplayPrecision = ( mCrs.mapUnits() == QGis::Degrees ) ? 8 : 3;	// precision depends on CRS units

    // Create the action for tool
    mQActionPointer = new QAction( QIcon( ":/coordinatecapture/coordinate_capture.png" ), tr( "Coordinate Capture" ), this );
    // Set the what's this text
    mQActionPointer->setWhatsThis( tr( "Click on the map to view coordinates and capture to clipboard." ) );
    // Connect the action to the run
    connect( mQActionPointer, SIGNAL( triggered() ), this, SLOT( run() ) );
    // Add the icon to the toolbar
    mQGisIface->addToolBarIcon( mQActionPointer );
    mQGisIface->addPluginToMenu( tr( "&Coordinate Capture" ), mQActionPointer );

    // create our map tool
    mpMapTool = new CoordinateCaptureMapTool( mQGisIface->mapCanvas() );
    connect( mpMapTool, SIGNAL( mouseMoved( QgsPoint ) ), this, SLOT( mouseMoved( QgsPoint ) ) );
    connect( mpMapTool, SIGNAL( mouseClicked( QgsPoint ) ), this, SLOT( mouseClicked( QgsPoint ) ) );


    // create a little widget with x and y display to put into our dock widget
    QWidget * mypWidget = new QWidget();
    QGridLayout *mypLayout = new QGridLayout( mypWidget );
    mypLayout->setColumnMinimumWidth( 0, 36 );
    mypWidget->setLayout( mypLayout );

    QToolButton * mypUserCrsToolButton = new QToolButton( mypWidget );
    mypUserCrsToolButton->setIcon( QIcon( ":/coordinatecapture/geographic.png" ) );
    mypUserCrsToolButton->setToolTip( tr( "Click to select the CRS to use for coordinate display" ) );
    connect( mypUserCrsToolButton, SIGNAL( clicked() ), this, SLOT( setCRS() ) );

    QLabel * mypCRSLabel = new QLabel( mypWidget );
    mypCRSLabel->setPixmap( QPixmap( ":/coordinatecapture/transformed.png" ) );
    mypCRSLabel->setGeometry( mypUserCrsToolButton->geometry() );

    mpUserCrsEdit = new QLineEdit( mypWidget );
    mpUserCrsEdit->setReadOnly( true );
    mpUserCrsEdit->setToolTip( tr( "Coordinate in your selected CRS" ) );

    mpCanvasEdit = new QLineEdit( mypWidget );
    mpCanvasEdit->setReadOnly( true );
    mpCanvasEdit->setToolTip( tr( "Coordinate in map canvas coordinate reference system" ) );

    QPushButton * mypCopyButton = new QPushButton( mypWidget );
    mypCopyButton->setText( tr( "Copy to clipboard" ) );
    connect( mypCopyButton, SIGNAL( clicked() ), this, SLOT( copy() ) );

    mpTrackMouseButton = new QToolButton( mypWidget );
    mpTrackMouseButton->setCheckable( true );
    mpTrackMouseButton->setToolTip( tr( "Click to enable mouse tracking. Click the canvas to stop" ) );
    mpTrackMouseButton->setChecked( false );
    mpTrackMouseButton->setIcon( QIcon( ":/coordinatecapture/tracking.png" ) );

    mypLayout->addWidget( mypUserCrsToolButton, 0, 0 );
    mypLayout->addWidget( mpUserCrsEdit, 0, 1 );
    mypLayout->addWidget( mypCRSLabel, 1, 0 );
    mypLayout->addWidget( mpCanvasEdit, 1, 1 );
    mypLayout->addWidget( mpTrackMouseButton, 2, 0 );
    mypLayout->addWidget( mypCopyButton, 2, 1 );


    //create the dock widget
    mpDockWidget = new QDockWidget( tr( "Coordinate Capture" ), mQGisIface->mainWindow() );
    mpDockWidget->setObjectName( "CoordinateCapture" );
    mpDockWidget->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
    mQGisIface->addDockWidget( Qt::LeftDockWidgetArea, mpDockWidget );

    // now add our custom widget to the dock - ownership of the widget is passed to the dock
    mpDockWidget->setWidget( mypWidget );

}
Exemplo n.º 6
0
/*
 * Initialize the GUI interface for the plugin - this is only called once when the plugin is
 * added to the plugin registry in the QGIS application.
 */
void CoordinateCapture::initGui()
{
  mCrs.createFromSrsId( GEOCRS_ID ); // initialize the CRS object

  connect( mQGisIface->mapCanvas(), &QgsMapCanvas::destinationCrsChanged, this, &CoordinateCapture::setSourceCrs );
  connect( mQGisIface, &QgisInterface::currentThemeChanged, this, &CoordinateCapture::setCurrentTheme );

  setSourceCrs(); //set up the source CRS
  mTransform.setDestinationCrs( mCrs ); // set the CRS in the transform
  mUserCrsDisplayPrecision = ( mCrs.mapUnits() == QgsUnitTypes::DistanceDegrees ) ? 5 : 3; // precision depends on CRS units

  //create the dock widget
  mpDockWidget = new QgsDockWidget( tr( "Coordinate Capture" ), mQGisIface->mainWindow() );
  mpDockWidget->setObjectName( QStringLiteral( "CoordinateCapture" ) );
  mpDockWidget->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
  mQGisIface->addDockWidget( Qt::LeftDockWidgetArea, mpDockWidget );

  // Create the action for tool
  mQActionPointer = new QAction( QIcon(), tr( "Coordinate Capture" ), this );
  mQActionPointer->setObjectName( QStringLiteral( "mQActionPointer" ) );
  mQActionPointer->setCheckable( true );
  mQActionPointer->setChecked( mpDockWidget->isVisible() );
  // Set the what's this text
  mQActionPointer->setWhatsThis( tr( "Click on the map to view coordinates and capture to clipboard." ) );
  // Connect the action to the run
  connect( mQActionPointer, &QAction::triggered, this, &CoordinateCapture::showOrHide );
  mQGisIface->addPluginToVectorMenu( tr( "&Coordinate Capture" ), mQActionPointer );
  mQGisIface->addVectorToolBarIcon( mQActionPointer );

  // create our map tool
  mpMapTool = new CoordinateCaptureMapTool( mQGisIface->mapCanvas() );
  connect( mpMapTool, &CoordinateCaptureMapTool::mouseMoved, this, &CoordinateCapture::mouseMoved );
  connect( mpMapTool, &CoordinateCaptureMapTool::mouseClicked, this, &CoordinateCapture::mouseClicked );

  // create a little widget with x and y display to put into our dock widget
  QWidget *mypWidget = new QWidget();
  QGridLayout *mypLayout = new QGridLayout( mypWidget );
  mypLayout->setColumnMinimumWidth( 0, 36 );
  mypWidget->setLayout( mypLayout );

  mypUserCrsToolButton = new QToolButton( mypWidget );
  mypUserCrsToolButton->setToolTip( tr( "Click to select the CRS to use for coordinate display" ) );
  connect( mypUserCrsToolButton, &QAbstractButton::clicked, this, &CoordinateCapture::setCRS );

  mypCRSLabel = new QLabel( mypWidget );
  mypCRSLabel->setGeometry( mypUserCrsToolButton->geometry() );

  mpUserCrsEdit = new QLineEdit( mypWidget );
  mpUserCrsEdit->setReadOnly( true );
  mpUserCrsEdit->setToolTip( tr( "Coordinate in your selected CRS (lat,lon or east,north)" ) );

  mpCanvasEdit = new QLineEdit( mypWidget );
  mpCanvasEdit->setReadOnly( true );
  mpCanvasEdit->setToolTip( tr( "Coordinate in map canvas coordinate reference system (lat,lon or east,north)" ) );

  QPushButton *mypCopyButton = new QPushButton( mypWidget );
  mypCopyButton->setText( tr( "Copy to clipboard" ) );
  connect( mypCopyButton, &QAbstractButton::clicked, this, &CoordinateCapture::copy );

  mpTrackMouseButton = new QToolButton( mypWidget );
  mpTrackMouseButton->setCheckable( true );
  mpTrackMouseButton->setToolTip( tr( "Click to enable mouse tracking. Click the canvas to stop" ) );
  mpTrackMouseButton->setChecked( false );

  // Create the action for tool
  mpCaptureButton = new QPushButton( mypWidget );
  mpCaptureButton->setText( tr( "Start capture" ) );
  mpCaptureButton->setToolTip( tr( "Click to enable coordinate capture" ) );
  mpCaptureButton->setIcon( QIcon( ":/coordinate_capture/coordinate_capture.png" ) );
  mpCaptureButton->setWhatsThis( tr( "Click on the map to view coordinates and capture to clipboard." ) );
  connect( mpCaptureButton, &QAbstractButton::clicked, this, &CoordinateCapture::run );

  // Set the icons
  setCurrentTheme( QLatin1String( "" ) );

  mypLayout->addWidget( mypUserCrsToolButton, 0, 0 );
  mypLayout->addWidget( mpUserCrsEdit, 0, 1 );
  mypLayout->addWidget( mypCRSLabel, 1, 0 );
  mypLayout->addWidget( mpCanvasEdit, 1, 1 );
  mypLayout->addWidget( mpTrackMouseButton, 2, 0 );
  mypLayout->addWidget( mypCopyButton, 2, 1 );
  mypLayout->addWidget( mpCaptureButton, 3, 1 );

  // now add our custom widget to the dock - ownership of the widget is passed to the dock
  mpDockWidget->setWidget( mypWidget );
  connect( mpDockWidget.data(), &QDockWidget::visibilityChanged, mQActionPointer, &QAction::setChecked );
}
Exemplo n.º 7
0
void MDAL::Mesh::setSourceCrsFromEPSG( int code )
{
  setSourceCrs( std::string( "EPSG:" ) + std::to_string( code ) );
}
Exemplo n.º 8
0
void MDAL::Mesh::setSourceCrsFromWKT( const std::string &wkt )
{
  setSourceCrs( wkt );
}