Implemented a new map cursor type : Capture Point (little pencil icon on your toolbar). At the moment clicking on the map in capture point mode will cause QgsMapCanvas to emit an xyClickCoordinate(QgsPoint) signal which is picked up by qgisapp and the coordinates are placed into the system clipboard.

In release 0.5 this will be extended to provide simple point vector file data capture / digitising facility. This will be implemented by means of a plugin which will utilise the aforementioned xyClickCoordinate(QgsPoint) signal.


git-svn-id: http://svn.osgeo.org/qgis/trunk@1569 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
timlinux 2004-06-13 14:59:21 +00:00
parent dcc8d58298
commit 07dd6b6ee6
5 changed files with 115 additions and 31 deletions

View File

@ -34,7 +34,8 @@ namespace QGis
Distance,
Identify,
Table,
Select
Select,
CapturePoint
};
//! Used for symbology operations
// Featuure types

View File

@ -64,6 +64,8 @@
#include <qimage.h>
#include <qprinter.h>
#include <qpaintdevicemetrics.h>
#include <qclipboard.h>
#include <qapplication.h>
#include <iostream>
#include <iomanip>
@ -186,6 +188,27 @@ static unsigned char pan_mask_bits[] = {
};
static char *capture_point_cursor[] = {
"16 16 3 1",
" » c None",
".» c #000000",
"+» c #FFFFFF",
" ",
" +.+ ",
" ++.++ ",
" +.....+ ",
" +. .+ ",
" +. . .+ ",
" +. . .+ ",
" ++. . .++",
" ... ...+... ...",
" ++. . .++",
" +. . .+ ",
" +. . .+ ",
" ++. .+ ",
" ++.....+ ",
" ++.++ ",
" +.+ "};
static char *select_cursor[] = {
"16 16 3 1",
@ -295,7 +318,10 @@ QgisApp::QgisApp(QWidget * parent, const char *name, WFlags fl):QgisAppBase(pare
setCaption(caption);
//signal when mouse moved over window (coords display in status bar)
connect(mMapCanvas, SIGNAL(xyCoordinates(QgsPoint &)), this, SLOT(showMouseCoordinate(QgsPoint &)));
//signal when mouse in capturePoint mode and mouse clicked on canvas
connect(mMapCanvas, SIGNAL(xyClickCoordinates(QgsPoint &)), this, SLOT(showCapturePointCoordinate(QgsPoint &)));
connect(mMapCanvas, SIGNAL(extentsChanged(QgsRect )),this,SLOT(showExtents(QgsRect )));
connect(mMapCanvas, SIGNAL(scaleChanged(QString)), this, SLOT(showScale(QString)));
connect(mMapCanvas, SIGNAL(addedLayer(QgsMapLayer *)), mMapLegend, SLOT(addLayer(QgsMapLayer *)));
@ -1954,6 +1980,18 @@ void QgisApp::attributeTable()
}
}
}
void QgisApp::capturePoint()
{
// set current map tool to select
mMapCanvas->setMapTool(QGis::CapturePoint);
QPixmap mySelectQPixmap = QPixmap((const char **) capture_point_cursor);
delete mMapCursor;
mMapCursor = new QCursor(mySelectQPixmap, 8, 8);
mMapCanvas->setCursor(*mMapCursor);
}
void QgisApp::select()
{
@ -3101,6 +3139,7 @@ void QgisApp::setTheme(QString themeName)
actionQgisSourceForgePage->setIconSet(QIconSet(QPixmap(iconPath + "/sourceforge_page.png")));
actionHelpAbout->setIconSet(QIconSet(QPixmap(iconPath + "/help_about.png")));
drawAction->setIconSet(QIconSet(QPixmap(iconPath + "/reload.png")));
actionCapturePoint->setIconSet(QIconSet(QPixmap(iconPath + "/digitising_point.png")));
actionZoomIn->setIconSet(QIconSet(QPixmap(iconPath + "/zoom_in.png")));
actionZoomOut->setIconSet(QIconSet(QPixmap(iconPath + "/zoom_out.png")));
actionZoomFullExtent->setIconSet(QIconSet(QPixmap(iconPath + "/zoom_full.png")));
@ -3175,3 +3214,14 @@ void QgisApp::setOverviewZOrder(QgsLegend * lv)
mOverviewCanvas->refresh();
}
//copy the click coord to clipboard and let the user know its there
void QgisApp::showCapturePointCoordinate(QgsPoint & theQgsPoint)
{
#ifdef QGISDEBUG
std::cout << "Capture point (clicked on map) at position " << theQgsPoint.stringRep(2) << std::endl;
#endif
QClipboard *myClipboard = QApplication::clipboard();
myClipboard->setText(theQgsPoint.stringRep(2));
QString myMessage = "Clipboard contents set to: ";
statusBar()->message(myMessage + myClipboard->text());
}

View File

@ -185,6 +185,8 @@ private:
void testButton();
//! About QGis
void about();
//! activates the capture point tool
void capturePoint();
//! activates the selection tool
void select();
//! check to see if file is dirty and if so, prompt the user th save it
@ -192,6 +194,8 @@ private:
private slots:
//! Slot to show the map coordinate position of the mouse cursor
void showMouseCoordinate(QgsPoint &);
//copy the click coord to clipboard and let the user know its there
void showCapturePointCoordinate(QgsPoint &);
//! Slot to show current map scale;
void showScale(QString theScale);
//! Show layer properties for the selected layer

File diff suppressed because one or more lines are too long

View File

@ -211,3 +211,9 @@ void QgisAppBase::filePrint()
{
}
void QgisAppBase::capturePoint()
{
}