Skip to content
Permalink
Browse files
Added unit testing for the new node tool
  • Loading branch information
wonder-sk committed Mar 29, 2017
1 parent bd5799b commit 1c202e75fe0f6bd10cd8c20ea7baf83b2b9312cc
@@ -343,16 +343,6 @@ void QgsNodeTool2::deactivate()
QgsMapToolAdvancedDigitizing::deactivate();
}

bool QgsNodeTool2::canUseCurrentLayer()
{
if ( QgsVectorLayer* layer = qobject_cast<QgsVectorLayer*>( canvas()->currentLayer() ) )
{
if ( layer->isEditable() )
return true;
}
return false;
}

void QgsNodeTool2::addDragBand( const QgsPoint &v1, const QgsPoint &v2 )
{
QgsRubberBand* dragBand = createRubberBand( QgsWkbTypes::LineGeometry, true );
@@ -372,9 +362,6 @@ void QgsNodeTool2::clearDragBands()

void QgsNodeTool2::cadCanvasPressEvent( QgsMapMouseEvent *e )
{
if ( !canUseCurrentLayer() )
return;

setHighlightedNodes( QList<Vertex>() ); // reset selection

if ( e->button() == Qt::LeftButton )
@@ -399,9 +386,6 @@ void QgsNodeTool2::cadCanvasPressEvent( QgsMapMouseEvent *e )

void QgsNodeTool2::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
{
if ( !canUseCurrentLayer() )
return;

if ( mNewVertexFromDoubleClick )
{
QgsPointLocator::Match m( *mNewVertexFromDoubleClick );
@@ -18,6 +18,7 @@

#include <memory>

#include "qgis_app.h"
#include "qgsmaptooladvanceddigitizing.h"

class QRubberBand;
@@ -63,7 +64,7 @@ struct Edge



class QgsNodeTool2 : public QgsMapToolAdvancedDigitizing
class APP_EXPORT QgsNodeTool2 : public QgsMapToolAdvancedDigitizing
{
Q_OBJECT
public:
@@ -96,8 +97,6 @@ class QgsNodeTool2 : public QgsMapToolAdvancedDigitizing

private:

bool canUseCurrentLayer();

void addDragBand( const QgsPoint& v1, const QgsPoint& v2 );

void clearDragBands();
@@ -114,4 +114,5 @@ ADD_QGIS_TEST(fieldcalculatortest testqgsfieldcalculator.cpp)
ADD_QGIS_TEST(maptoolidentifyaction testqgsmaptoolidentifyaction.cpp)
ADD_QGIS_TEST(maptoolselect testqgsmaptoolselect.cpp)
ADD_QGIS_TEST(measuretool testqgsmeasuretool.cpp)
ADD_QGIS_TEST(nodetool testqgsnodetool.cpp)
ADD_QGIS_TEST(vectorlayersaveasdialogtest testqgsvectorlayersaveasdialog.cpp)

0 comments on commit 1c202e7

Please sign in to comment.