Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added buttons and icons for add/delete/move Vertex and set mouseTrack…
…ing true in QgsRubberBand

git-svn-id: http://svn.osgeo.org/qgis/trunk@4717 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jan 22, 2006
1 parent 9e50a75 commit e990dec
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 8 deletions.
Binary file added images/themes/default/mActionAddVertex.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/themes/default/mActionDeleteVertex.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/themes/default/mActionMoveVertex.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions src/gui/qgisapp.cpp
Expand Up @@ -612,6 +612,22 @@ void QgisApp::createActions()
mActionCapturePolygon->setShortcut(tr("Ctrl+/"));
mActionCapturePolygon->setStatusTip(tr("Capture Polygons"));
connect(mActionCapturePolygon, SIGNAL(triggered()), this, SLOT(capturePolygon()));
//
mActionDeleteSelected = new QAction(QIcon(myIconPath+"/mActionDeleteSelected.png"), tr("Delete Seleced"), this);
mActionDeleteSelected->setStatusTip(tr("Delete Selected"));
connect(mActionDeleteSelected, SIGNAL(triggered()), this, SLOT(deleteSelected()));
//
mActionAddVertex = new QAction(QIcon(myIconPath+"/mActionAddVertex.png"), tr("Add Vertex"), this);
mActionAddVertex->setStatusTip(tr("Add Vertex"));
connect(mActionAddVertex, SIGNAL(triggered()), this, SLOT(addVertex()));
//
mActionDeleteVertex = new QAction(QIcon(myIconPath+"/mActionDeleteVertex.png"), tr("Delete Vertex"), this);
mActionDeleteVertex->setStatusTip(tr("Delete Vertex"));
connect(mActionDeleteVertex, SIGNAL(triggered()), this, SLOT(deleteVertex()));
//
mActionMoveVertex = new QAction(QIcon(myIconPath+"/mActionMoveVertex.png"), tr("Move Vertex"), this);
mActionMoveVertex->setStatusTip(tr("Move Vertex"));
connect(mActionMoveVertex, SIGNAL(triggered()), this, SLOT(moveVertex()));
}

void QgisApp::createActionGroups()
Expand Down Expand Up @@ -639,6 +655,13 @@ void QgisApp::createActionGroups()
mMapToolGroup->addAction(mActionCapturePoint);
mActionCapturePolygon->setCheckable(true);
mMapToolGroup->addAction(mActionCapturePolygon);
mMapToolGroup->addAction(mActionDeleteSelected);
mActionAddVertex->setCheckable(true);
mMapToolGroup->addAction(mActionAddVertex);
mActionDeleteVertex->setCheckable(true);
mMapToolGroup->addAction(mActionDeleteVertex);
mActionMoveVertex->setCheckable(true);
mMapToolGroup->addAction(mActionMoveVertex);
}

void QgisApp::createMenus()
Expand Down Expand Up @@ -764,6 +787,10 @@ void QgisApp::createToolBars()
mDigitizeToolBar->addAction(mActionCapturePoint);
mDigitizeToolBar->addAction(mActionCaptureLine);
mDigitizeToolBar->addAction(mActionCapturePolygon);
mDigitizeToolBar->addAction(mActionDeleteSelected);
mDigitizeToolBar->addAction(mActionAddVertex);
mDigitizeToolBar->addAction(mActionDeleteVertex);
mDigitizeToolBar->addAction(mActionMoveVertex);
//
// Map Navigation Toolbar
mMapNavToolBar = addToolBar(tr("Map Navigation"));
Expand Down Expand Up @@ -3670,6 +3697,7 @@ void QgisApp::addVertex()
delete mMapCursor;
mMapCursor = new QCursor(mySelectQPixmap, 8, 8);
mMapCanvas->setCursor(*mMapCursor);
mActionAddVertex->setOn(true);
}
}

Expand All @@ -3688,6 +3716,7 @@ void QgisApp::moveVertex()
delete mMapCursor;
mMapCursor = new QCursor(mySelectQPixmap, 8, 8);
mMapCanvas->setCursor(*mMapCursor);
mActionMoveVertex->setOn(true);
}
}

Expand All @@ -3707,6 +3736,7 @@ void QgisApp::deleteVertex()
delete mMapCursor;
mMapCursor = new QCursor(mySelectQPixmap, 8, 8);
mMapCanvas->setCursor(*mMapCursor);
mActionDeleteVertex->setOn(true);
}
}

Expand Down
20 changes: 12 additions & 8 deletions src/gui/qgisapp.h
Expand Up @@ -298,6 +298,14 @@ public slots:
void captureLine();
//! activates the capture polygon tool
void capturePolygon();
/**Deletes the selected attributes for the currently selected vector layer*/
void deleteSelected();
//! activates the add vertex tool
void addVertex();
//! activates the move vertex tool
void moveVertex();
//! activates the delete vertex tool
void deleteVertex();
//! activates the selection tool
void select();

Expand Down Expand Up @@ -383,8 +391,6 @@ public slots:
void saveRecentProjectPath(QString projectPath, QSettings & settings);
//! Update file menu with the current list of recently accessed projects
void updateRecentProjectPaths();
/**Deletes the selected attributes for the currently selected vector layer*/
void deleteSelected();
//! Read Well Known Binary stream from PostGIS
//void readWKB(const char *, QStringList tables);
//! Draw a point on the map canvas
Expand All @@ -393,12 +399,6 @@ public slots:
void drawLayers();
//! test function
void testButton();
//! activates the add vertex tool
void addVertex();
//! activates the move vertex tool
void moveVertex();
//! activates the delete vertex tool
void deleteVertex();
//! cuts selected features on the active layer to the clipboard
void editCut();
//! copies selected features on the active layer to the clipboard
Expand Down Expand Up @@ -469,6 +469,10 @@ public slots:
QAction *mActionCapturePoint;
QAction *mActionCaptureLine;
QAction *mActionCapturePolygon;
QAction *mActionDeleteSelected;
QAction *mActionAddVertex;
QAction *mActionDeleteVertex;
QAction *mActionMoveVertex;
QAction *mActionZoomIn;
QAction *mActionZoomOut;
QAction *mActionZoomFullExtent;
Expand Down
2 changes: 2 additions & 0 deletions src/gui/qgsmapcanvas.cpp
Expand Up @@ -138,6 +138,8 @@ QgsMapCanvas::QgsMapCanvas()
mCanvasProperties->initMetrics(pdm);
delete pdm;

mRubberBand = 0;
mRubberBand2 = 0;
mMeasure = 0;
} // QgsMapCanvas ctor

Expand Down
1 change: 1 addition & 0 deletions src/gui/qgsrubberband.cpp
Expand Up @@ -28,6 +28,7 @@ QgsRubberBand::QgsRubberBand(QWidget * parent, bool isPolygon)
setGeometry(parent->rect()); // this widget is same size as parent
mPoints.append(QPoint()); // addPoint assumes an initial allocated point
setColor(QColor(Qt::lightGray));
setMouseTracking(true);
}

QgsRubberBand::~QgsRubberBand()
Expand Down

0 comments on commit e990dec

Please sign in to comment.