diff --git a/src/plugins/coordinate_capture/coordinatecapture.png b/src/plugins/coordinate_capture/coordinate_capture.png similarity index 100% rename from src/plugins/coordinate_capture/coordinatecapture.png rename to src/plugins/coordinate_capture/coordinate_capture.png diff --git a/src/plugins/coordinate_capture/coordinatecapture.cpp b/src/plugins/coordinate_capture/coordinatecapture.cpp index d4f6801dc2f..806a21334f3 100644 --- a/src/plugins/coordinate_capture/coordinatecapture.cpp +++ b/src/plugins/coordinate_capture/coordinatecapture.cpp @@ -76,7 +76,7 @@ void CoordinateCapture::initGui() { // Create the action for tool - mQActionPointer = new QAction(QIcon(":/coordinatecapture/coordinatecapture.png"),tr("Coordinate Capture"), this); + 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 @@ -92,18 +92,25 @@ void CoordinateCapture::initGui() // create a little widget with x and y display to put into our dock widget QWidget * mypWidget = new QWidget(); - QLayout * mypLayout = new QVBoxLayout(); + QGridLayout *mypLayout = new QGridLayout ( mypWidget ); + mypLayout->setColumnMinimumWidth( 0, 36 ); mypWidget->setLayout(mypLayout); + QLabel * mypGeoLabel = new QLabel(mypWidget); + mypGeoLabel->setPixmap(QPixmap(":/coordinatecapture/geographic.png")); + QLabel * mypCRSLabel = new QLabel(mypWidget); + mypCRSLabel->setPixmap(QPixmap(":/coordinatecapture/transformed.png")); mpXEdit = new QLineEdit(mypWidget); mpYEdit = new QLineEdit(mypWidget); QPushButton * mypCopyButton = new QPushButton(mypWidget); mypCopyButton->setText(tr("Copy to clipboard")); connect(mypCopyButton, SIGNAL(clicked()), this, SLOT(copy())); - mypLayout->addWidget(mpXEdit); - mypLayout->addWidget(mpYEdit); - mypLayout->addWidget(mypCopyButton); + mypLayout->addWidget(mypGeoLabel, 0,0); + mypLayout->addWidget(mpXEdit, 0,1); + mypLayout->addWidget(mypCRSLabel, 1,0); + mypLayout->addWidget(mpYEdit, 1,1); + mypLayout->addWidget(mypCopyButton, 2,1); //create the dock widget diff --git a/src/plugins/coordinate_capture/coordinatecapture.qrc b/src/plugins/coordinate_capture/coordinatecapture.qrc index c45ab11a641..89e03a8a997 100644 --- a/src/plugins/coordinate_capture/coordinatecapture.qrc +++ b/src/plugins/coordinate_capture/coordinatecapture.qrc @@ -1,5 +1,7 @@ - coordinatecapture.png + coordinate_capture.png + geographic.png + transformed.png diff --git a/src/plugins/coordinate_capture/coordinatecapturemaptool.cpp b/src/plugins/coordinate_capture/coordinatecapturemaptool.cpp index 67397e48aea..9e43697add7 100644 --- a/src/plugins/coordinate_capture/coordinatecapturemaptool.cpp +++ b/src/plugins/coordinate_capture/coordinatecapturemaptool.cpp @@ -31,12 +31,12 @@ CoordinateCaptureMapTool::CoordinateCaptureMapTool(QgsMapCanvas* thepCanvas) : QgsMapTool(thepCanvas) { // set cursor - QPixmap myIdentifyCursor = QPixmap((const char **) capture_point_cursor); - mCursor = QCursor(myIdentifyCursor, 1, 1); + QPixmap myCursor = QPixmap((const char **) capture_point_cursor); + mCursor = QCursor(myCursor, 8, 8); //8,8 is the point in the cursor where clicks register mpMapCanvas = thepCanvas; - mpRubberBand = new QgsRubberBand(mpMapCanvas,false); //false - not a polygon + mpRubberBand = new QgsRubberBand(mpMapCanvas,true); //true - its a polygon mpRubberBand->setColor(Qt::red); - mpRubberBand->setWidth(3); + mpRubberBand->setWidth(1); } CoordinateCaptureMapTool::~CoordinateCaptureMapTool() @@ -60,14 +60,27 @@ void CoordinateCaptureMapTool::canvasReleaseEvent(QMouseEvent * thepEvent) return; } - QgsPoint myPoint = + QgsPoint myOriginalPoint = mCanvas->getCoordinateTransform()->toMapCoordinates(thepEvent->x(), thepEvent->y()); - emit pointCaptured(myPoint); - mpRubberBand->reset(false); + emit pointCaptured(myOriginalPoint); + + //make a little box for display + + QgsPoint myPoint1 = + mCanvas->getCoordinateTransform()->toMapCoordinates(thepEvent->x() - 1, thepEvent->y()-1); + QgsPoint myPoint2 = + mCanvas->getCoordinateTransform()->toMapCoordinates(thepEvent->x() + 1, thepEvent->y()-1); + QgsPoint myPoint3 = + mCanvas->getCoordinateTransform()->toMapCoordinates(thepEvent->x() + 1, thepEvent->y() + 1); + QgsPoint myPoint4 = + mCanvas->getCoordinateTransform()->toMapCoordinates(thepEvent->x() - 1, thepEvent->y() + 1); + + mpRubberBand->reset(true); // convert screen coordinates to map coordinates - mpRubberBand->addPoint(myPoint,false); //true - update canvas - mpRubberBand->addPoint(myPoint,false); //true - update canvas - mpRubberBand->addPoint(myPoint,false); //true - update canvas + mpRubberBand->addPoint(myPoint1,false); //true - update canvas + mpRubberBand->addPoint(myPoint2,false); //true - update canvas + mpRubberBand->addPoint(myPoint3,false); //true - update canvas + mpRubberBand->addPoint(myPoint4,true); //true - update canvas mpRubberBand->show(); } diff --git a/src/plugins/coordinate_capture/geographic.png b/src/plugins/coordinate_capture/geographic.png new file mode 100644 index 00000000000..c7ac771c4f0 Binary files /dev/null and b/src/plugins/coordinate_capture/geographic.png differ diff --git a/src/plugins/coordinate_capture/geographic.svg b/src/plugins/coordinate_capture/geographic.svg new file mode 100644 index 00000000000..b4439d9b68c --- /dev/null +++ b/src/plugins/coordinate_capture/geographic.svg @@ -0,0 +1,207 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/plugins/coordinate_capture/transformed.png b/src/plugins/coordinate_capture/transformed.png new file mode 100644 index 00000000000..2e9c1a740c1 Binary files /dev/null and b/src/plugins/coordinate_capture/transformed.png differ diff --git a/src/plugins/coordinate_capture/transformed.svg b/src/plugins/coordinate_capture/transformed.svg new file mode 100644 index 00000000000..c2caabc963e --- /dev/null +++ b/src/plugins/coordinate_capture/transformed.svg @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + +