Skip to content
Permalink
Browse files

Gui cleanups for coordinate capture - dont use a toolbar icon, rather…

… use a button in the dock.

Also use less precision for dd maps.


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10395 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux
timlinux committed Mar 21, 2009
1 parent b3c54da commit 7c372799e1efcdde181ae9f2a08ea22d96350586
@@ -87,16 +87,14 @@ void CoordinateCapture::initGui()

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
mUserCrsDisplayPrecision = ( mCrs.mapUnits() == QGis::Degrees ) ? 3 : 5; // 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
@@ -138,12 +136,21 @@ void CoordinateCapture::initGui()
mpTrackMouseButton->setChecked( false );
mpTrackMouseButton->setIcon( QIcon( ":/coordinatecapture/tracking.png" ) );

// 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( ":/coordinatecapture/coordinatecapture/coordinate_capture.png" ));
mpCaptureButton->setWhatsThis( tr( "Click on the map to view coordinates and capture to clipboard." ) );
connect( mpCaptureButton, SIGNAL( clicked() ), this, SLOT( run() ) );

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 );


//create the dock widget
@@ -171,14 +178,14 @@ void CoordinateCapture::setCRS()
{
mCrs.createFromSrsId( mySelector.selectedCrsId() );
mTransform.setDestCRS( mCrs );
mUserCrsDisplayPrecision = ( mCrs.mapUnits() == QGis::Degrees ) ? 8 : 3; //precision depends on CRS units
mUserCrsDisplayPrecision = ( mCrs.mapUnits() == QGis::Degrees ) ? 3 : 5; //precision depends on CRS units
}
}

void CoordinateCapture::setSourceCrs()
{
mTransform.setSourceCrs( mQGisIface->mapCanvas()->mapRenderer()->destinationSrs() );
mCanvasDisplayPrecision = ( mQGisIface->mapCanvas()->mapRenderer()->destinationSrs().mapUnits() == QGis::Degrees ) ? 8 : 3; // for the map canvas coordinate display
mCanvasDisplayPrecision = ( mQGisIface->mapCanvas()->mapRenderer()->destinationSrs().mapUnits() == QGis::Degrees ) ? 3 : 5; // for the map canvas coordinate display
}

void CoordinateCapture::mouseClicked( QgsPoint thePoint )
@@ -245,7 +252,7 @@ void CoordinateCapture::unload()
{
// remove the GUI
mQGisIface->removePluginMenu( "&Coordinate Capture", mQActionPointer );
mQGisIface->removeToolBarIcon( mQActionPointer );
//mQGisIface->removeToolBarIcon( mQActionPointer );
mpMapTool->deactivate();
delete mpMapTool;
delete mpDockWidget;
@@ -50,6 +50,7 @@
class QAction;
class QToolBar;
class QToolButton;
class QPushButton;
class QDockWidget;
class QLineEdit;

@@ -121,6 +122,7 @@ class CoordinateCapture: public QObject, public QgisPlugin

//!A toolbutton to keep track whether mouse tracking is enabled
QToolButton * mpTrackMouseButton;
QPushButton * mpCaptureButton;

//! transform object
QgsCoordinateTransform mTransform;

0 comments on commit 7c37279

Please sign in to comment.
You can’t perform that action at this time.