@@ -87,16 +87,14 @@ void CoordinateCapture::initGui()
8787
8888 setSourceCrs (); // set up the source CRS
8989 mTransform .setDestCRS ( mCrs ); // set the CRS in the transform
90- mUserCrsDisplayPrecision = ( mCrs .mapUnits () == QGis::Degrees ) ? 8 : 3 ; // precision depends on CRS units
90+ mUserCrsDisplayPrecision = ( mCrs .mapUnits () == QGis::Degrees ) ? 3 : 5 ; // precision depends on CRS units
9191
9292 // Create the action for tool
9393 mQActionPointer = new QAction ( QIcon ( " :/coordinatecapture/coordinate_capture.png" ), tr ( " Coordinate Capture" ), this );
9494 // Set the what's this text
9595 mQActionPointer ->setWhatsThis ( tr ( " Click on the map to view coordinates and capture to clipboard." ) );
9696 // Connect the action to the run
9797 connect ( mQActionPointer , SIGNAL ( triggered () ), this , SLOT ( run () ) );
98- // Add the icon to the toolbar
99- mQGisIface ->addToolBarIcon ( mQActionPointer );
10098 mQGisIface ->addPluginToMenu ( tr ( " &Coordinate Capture" ), mQActionPointer );
10199
102100 // create our map tool
@@ -138,12 +136,21 @@ void CoordinateCapture::initGui()
138136 mpTrackMouseButton->setChecked ( false );
139137 mpTrackMouseButton->setIcon ( QIcon ( " :/coordinatecapture/tracking.png" ) );
140138
139+ // Create the action for tool
140+ mpCaptureButton = new QPushButton ( mypWidget );
141+ mpCaptureButton->setText ( tr ( " Start capture" ) );
142+ mpCaptureButton->setToolTip ( tr ( " Click to enable coordinate capture" ) );
143+ mpCaptureButton->setIcon ( QIcon ( " :/coordinatecapture/coordinatecapture/coordinate_capture.png" ));
144+ mpCaptureButton->setWhatsThis ( tr ( " Click on the map to view coordinates and capture to clipboard." ) );
145+ connect ( mpCaptureButton, SIGNAL ( clicked () ), this , SLOT ( run () ) );
146+
141147 mypLayout->addWidget ( mypUserCrsToolButton, 0 , 0 );
142148 mypLayout->addWidget ( mpUserCrsEdit, 0 , 1 );
143149 mypLayout->addWidget ( mypCRSLabel, 1 , 0 );
144150 mypLayout->addWidget ( mpCanvasEdit, 1 , 1 );
145151 mypLayout->addWidget ( mpTrackMouseButton, 2 , 0 );
146152 mypLayout->addWidget ( mypCopyButton, 2 , 1 );
153+ mypLayout->addWidget ( mpCaptureButton, 3 , 1 );
147154
148155
149156 // create the dock widget
@@ -171,14 +178,14 @@ void CoordinateCapture::setCRS()
171178 {
172179 mCrs .createFromSrsId ( mySelector.selectedCrsId () );
173180 mTransform .setDestCRS ( mCrs );
174- mUserCrsDisplayPrecision = ( mCrs .mapUnits () == QGis::Degrees ) ? 8 : 3 ; // precision depends on CRS units
181+ mUserCrsDisplayPrecision = ( mCrs .mapUnits () == QGis::Degrees ) ? 3 : 5 ; // precision depends on CRS units
175182 }
176183}
177184
178185void CoordinateCapture::setSourceCrs ()
179186{
180187 mTransform .setSourceCrs ( mQGisIface ->mapCanvas ()->mapRenderer ()->destinationSrs () );
181- mCanvasDisplayPrecision = ( mQGisIface ->mapCanvas ()->mapRenderer ()->destinationSrs ().mapUnits () == QGis::Degrees ) ? 8 : 3 ; // for the map canvas coordinate display
188+ mCanvasDisplayPrecision = ( mQGisIface ->mapCanvas ()->mapRenderer ()->destinationSrs ().mapUnits () == QGis::Degrees ) ? 3 : 5 ; // for the map canvas coordinate display
182189}
183190
184191void CoordinateCapture::mouseClicked ( QgsPoint thePoint )
@@ -245,7 +252,7 @@ void CoordinateCapture::unload()
245252{
246253 // remove the GUI
247254 mQGisIface ->removePluginMenu ( " &Coordinate Capture" , mQActionPointer );
248- mQGisIface ->removeToolBarIcon ( mQActionPointer );
255+ // mQGisIface->removeToolBarIcon( mQActionPointer );
249256 mpMapTool->deactivate ();
250257 delete mpMapTool;
251258 delete mpDockWidget;
0 commit comments