Skip to content

Commit

Permalink
Use lambdas in the connect for tools (and circular tools)
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti committed Oct 12, 2017
1 parent 5a9278b commit 299fff7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 133 deletions.
118 changes: 19 additions & 99 deletions src/app/qgisapp.cpp
Expand Up @@ -1787,23 +1787,23 @@ void QgisApp::createActions()
connect( mActionCopyStyle, &QAction::triggered, this, [ = ] { copyStyle(); } );
connect( mActionPasteStyle, &QAction::triggered, this, [ = ] { pasteStyle(); } );
connect( mActionAddFeature, &QAction::triggered, this, &QgisApp::addFeature );
connect( mActionCircularStringCurvePoint, &QAction::triggered, this, &QgisApp::circularStringCurvePoint );
connect( mActionCircularStringRadius, &QAction::triggered, this, &QgisApp::circularStringRadius );
connect( mActionCircle2Points, &QAction::triggered, this, &QgisApp::circle2Points );
connect( mActionCircle3Points, &QAction::triggered, this, &QgisApp::circle3Points );
connect( mActionCircle3Tangents, &QAction::triggered, this, &QgisApp::circle3Tangents );
connect( mActionCircle2TangentsPoint, &QAction::triggered, this, &QgisApp::circle2TangentsPoint );
connect( mActionCircleCenterPoint, &QAction::triggered, this, &QgisApp::circleCenterPoint );
connect( mActionEllipseCenter2Points, &QAction::triggered, this, &QgisApp::ellipseCenter2Points );
connect( mActionEllipseCenterPoint, &QAction::triggered, this, &QgisApp::ellipseCenterPoint );
connect( mActionEllipseExtent, &QAction::triggered, this, &QgisApp::ellipseExtent );
connect( mActionEllipseFoci, &QAction::triggered, this, &QgisApp::ellipseFoci );
connect( mActionRectangleCenterPoint, &QAction::triggered, this, &QgisApp::rectangleCenterPoint );
connect( mActionRectangleExtent, &QAction::triggered, this, &QgisApp::rectangleExtent );
connect( mActionRectangle3Points, &QAction::triggered, this, &QgisApp::rectangle3Points );
connect( mActionRegularPolygon2Points, &QAction::triggered, this, &QgisApp::regularPolygon2Points );
connect( mActionRegularPolygonCenterPoint, &QAction::triggered, this, &QgisApp::regularPolygonCenterPoint );
connect( mActionRegularPolygonCenterCorner, &QAction::triggered, this, &QgisApp::regularPolygonCenterCorner );
connect( mActionCircularStringCurvePoint, &QAction::triggered, this, [ = ] { setMapTool( mMapTools.mCircularStringRadius ); } );
connect( mActionCircularStringRadius, &QAction::triggered, this, [ = ] { setMapTool( mMapTools.mCircularStringRadius ); } );
connect( mActionCircle2Points, &QAction::triggered, this, [ = ] { setMapTool( mMapTools.mCircle2Points ); } );
connect( mActionCircle3Points, &QAction::triggered, this, [ = ] { setMapTool( mMapTools.mCircle3Points ); } );
connect( mActionCircle3Tangents, &QAction::triggered, this, [ = ] { setMapTool( mMapTools.mCircle3Tangents ); } );
connect( mActionCircle2TangentsPoint, &QAction::triggered, this, [ = ] { setMapTool( mMapTools.mCircle2TangentsPoint ); } );
connect( mActionCircleCenterPoint, &QAction::triggered, this, [ = ] { setMapTool( mMapTools.mCircleCenterPoint ); } );
connect( mActionEllipseCenter2Points, &QAction::triggered, this, [ = ] { setMapTool( mMapTools.mEllipseCenter2Points ); } );
connect( mActionEllipseCenterPoint, &QAction::triggered, this, [ = ] { setMapTool( mMapTools.mEllipseCenterPoint ); } );
connect( mActionEllipseExtent, &QAction::triggered, this, [ = ] { setMapTool( mMapTools.mEllipseExtent ); } );
connect( mActionEllipseFoci, &QAction::triggered, this, [ = ] { setMapTool( mMapTools.mEllipseFoci ); } );
connect( mActionRectangleCenterPoint, &QAction::triggered, this, [ = ] { setMapTool( mMapTools.mRectangleCenterPoint ); } );
connect( mActionRectangleExtent, &QAction::triggered, this, [ = ] { setMapTool( mMapTools.mRectangleExtent ); } );
connect( mActionRectangle3Points, &QAction::triggered, this, [ = ] { setMapTool( mMapTools.mRectangle3Points ); } );
connect( mActionRegularPolygon2Points, &QAction::triggered, this, [ = ] { setMapTool( mMapTools.mRegularPolygon2Points ); } );
connect( mActionRegularPolygonCenterPoint, &QAction::triggered, this, [ = ] { setMapTool( mMapTools.mRegularPolygonCenterPoint ); } );
connect( mActionRegularPolygonCenterCorner, &QAction::triggered, this, [ = ] { setMapTool( mMapTools.mRegularPolygonCenterCorner ); } );
connect( mActionMoveFeature, &QAction::triggered, this, &QgisApp::moveFeature );
connect( mActionMoveFeature, &QAction::triggered, this, &QgisApp::moveFeature );
connect( mActionMoveFeatureCopy, &QAction::triggered, this, &QgisApp::moveFeatureCopy );
Expand Down Expand Up @@ -7801,89 +7801,9 @@ void QgisApp::addFeature()
mMapCanvas->setMapTool( mMapTools.mAddFeature );
}

void QgisApp::circularStringCurvePoint()
void QgisApp::setMapTool( QgsMapTool *tool )
{
mMapCanvas->setMapTool( mMapTools.mCircularStringCurvePoint );
}

void QgisApp::circularStringRadius()
{
mMapCanvas->setMapTool( mMapTools.mCircularStringRadius );
}

void QgisApp::circle2Points()
{
mMapCanvas->setMapTool( mMapTools.mCircle2Points );
}

void QgisApp::circle3Points()
{
mMapCanvas->setMapTool( mMapTools.mCircle3Points );
}

void QgisApp::circle3Tangents()
{
mMapCanvas->setMapTool( mMapTools.mCircle3Tangents );
}

void QgisApp::circle2TangentsPoint()
{
mMapCanvas->setMapTool( mMapTools.mCircle2TangentsPoint );
}

void QgisApp::circleCenterPoint()
{
mMapCanvas->setMapTool( mMapTools.mCircleCenterPoint );
}

void QgisApp::ellipseCenter2Points()
{
mMapCanvas->setMapTool( mMapTools.mEllipseCenter2Points );
}

void QgisApp::ellipseCenterPoint()
{
mMapCanvas->setMapTool( mMapTools.mEllipseCenterPoint );
}

void QgisApp::ellipseExtent()
{
mMapCanvas->setMapTool( mMapTools.mEllipseExtent );
}

void QgisApp::ellipseFoci()
{
mMapCanvas->setMapTool( mMapTools.mEllipseFoci );
}

void QgisApp::rectangleCenterPoint()
{
mMapCanvas->setMapTool( mMapTools.mRectangleCenterPoint );
}

void QgisApp::rectangleExtent()
{
mMapCanvas->setMapTool( mMapTools.mRectangleExtent );
}

void QgisApp::rectangle3Points()
{
mMapCanvas->setMapTool( mMapTools.mRectangle3Points );
}

void QgisApp::regularPolygon2Points()
{
mMapCanvas->setMapTool( mMapTools.mRegularPolygon2Points );
}

void QgisApp::regularPolygonCenterPoint()
{
mMapCanvas->setMapTool( mMapTools.mRegularPolygonCenterPoint );
}

void QgisApp::regularPolygonCenterCorner()
{
mMapCanvas->setMapTool( mMapTools.mRegularPolygonCenterCorner );
mMapCanvas->setMapTool( tool );
}

void QgisApp::selectFeatures()
Expand Down
37 changes: 3 additions & 34 deletions src/app/qgisapp.h
Expand Up @@ -1221,40 +1221,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
void newBookmark();
//! activates the add feature tool
void addFeature();
//! activates the add circular string tool
void circularStringCurvePoint();
//! activates the circular string radius tool
void circularStringRadius();
//! activates the add circle from 2 points tool
void circle2Points();
//! activates the add circle from 3 points tool
void circle3Points();
//! activates the add circle from 3 tangents tool
void circle3Tangents();
//! activates the add circle from 2 tangents and a point tool
void circle2TangentsPoint();
//! activates the add circle from center and radius tool
void circleCenterPoint();
//! activates the add ellipse from center and 2 points tool
void ellipseCenter2Points();
//! activates the add ellipse from center point tool
void ellipseCenterPoint();
//! activates the add ellipse from extent tool
void ellipseExtent();
//! activates the add ellipse from foci tool
void ellipseFoci();
//! activates the add rectangle from center and a point tool
void rectangleCenterPoint();
//! activates the add rectangle from extent tool
void rectangleExtent();
//! activates the add rectangle from 3 points tool
void rectangle3Points();
//! activates the add regular polygon from 2 points tool
void regularPolygon2Points();
//! activates the add regular polygon from center and a point tool
void regularPolygonCenterPoint();
//! activates the add regular polygon from center and a corner tool
void regularPolygonCenterCorner();
//! activates the move feature tool
void moveFeature();
//! activates the copy and move feature tool
Expand Down Expand Up @@ -1293,6 +1259,9 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
void offsetPointSymbol();
//! shows the snapping Options
void snappingOptions();
//! activates the tool
void setMapTool( QgsMapTool *tool );


//! activates the rectangle selection tool
void selectFeatures();
Expand Down

0 comments on commit 299fff7

Please sign in to comment.