Skip to content
Permalink
Browse files
Little bit of renaming of variables to camelCase
  • Loading branch information
wonder-sk committed Mar 30, 2017
1 parent 0472a29 commit 95eada577777f8f4e09c15f61a78b6916b82c378
Showing with 33 additions and 34 deletions.
  1. +14 −14 src/app/nodetool/qgsnodetool2.cpp
  2. +19 −20 src/app/nodetool/qgsnodetool2.h
@@ -226,13 +226,13 @@ void QgsNodeTool2::addDragBand( const QgsPoint &v1, const QgsPoint &v2 )
QgsRubberBand *dragBand = createRubberBand( QgsWkbTypes::LineGeometry, true );
dragBand->addPoint( v1 );
dragBand->addPoint( v2 );
drag_bands << dragBand;
mDragBands << dragBand;
}

void QgsNodeTool2::clearDragBands()
{
qDeleteAll( drag_bands );
drag_bands.clear();
qDeleteAll( mDragBands );
mDragBands.clear();

// for the case when standalone point geometry is being dragged
mDragPointMarker->setVisible( false );
@@ -396,7 +396,7 @@ void QgsNodeTool2::mouseMoveDraggingVertex( QgsMapMouseEvent *e )

mEdgeCenterMarker->setVisible( false );

Q_FOREACH ( QgsRubberBand *band, drag_bands )
Q_FOREACH ( QgsRubberBand *band, mDragBands )
band->movePoint( 1, e->mapPoint() );

// in case of moving of standalone point geometry
@@ -864,7 +864,7 @@ void QgsNodeTool2::startDraggingAddVertex( const QgsPointLocator::Match &m )
mOverrideCadPoints << m.point() << m.point();
}

void QgsNodeTool2::startDraggingAddVertexAtEndpoint( const QgsPoint &map_point )
void QgsNodeTool2::startDraggingAddVertexAtEndpoint( const QgsPoint &mapPoint )
{
Q_ASSERT( mMouseAtEndpoint );

@@ -879,7 +879,7 @@ void QgsNodeTool2::startDraggingAddVertexAtEndpoint( const QgsPoint &map_point )
QgsPoint v0 = geom.vertexAt( mMouseAtEndpoint->vertexId );
QgsPoint map_v0 = toMapCoordinates( mMouseAtEndpoint->layer, v0 );

addDragBand( map_v0, map_point );
addDragBand( map_v0, mapPoint );

// setup CAD dock previous points to endpoint and the previous point
QgsPoint pt0 = geom.vertexAt( adjacentVertexIndexToEndpoint( geom, mMouseAtEndpoint->vertexId ) );
@@ -888,14 +888,14 @@ void QgsNodeTool2::startDraggingAddVertexAtEndpoint( const QgsPoint &map_point )
mOverrideCadPoints << pt0 << pt1;
}

void QgsNodeTool2::startDraggingEdge( const QgsPointLocator::Match &m, const QgsPoint &map_point )
void QgsNodeTool2::startDraggingEdge( const QgsPointLocator::Match &m, const QgsPoint &mapPoint )
{
Q_ASSERT( m.hasEdge() );

// activate advanced digitizing
setMode( CaptureLine );

mDraggingEdge.reset( new Edge( m.layer(), m.featureId(), m.vertexIndex(), map_point ) );
mDraggingEdge.reset( new Edge( m.layer(), m.featureId(), m.vertexIndex(), mapPoint ) );
mDraggingTopo.clear();

QgsPoint edge_p0, edge_p1;
@@ -912,17 +912,17 @@ void QgsNodeTool2::startDraggingEdge( const QgsPointLocator::Match &m, const Qgs
QgsPoint layerPoint0 = geom.vertexAt( v0idx );
QgsPoint mapPoint0 = toMapCoordinates( m.layer(), layerPoint0 );
addDragBand( mapPoint0, edge_p0 );
mDraggingEdge->bandsTo0 << drag_bands.last();
mDraggingEdge->bandsTo0 << mDragBands.last();
}
if ( v1idx != -1 )
{
QgsPoint layerPoint1 = geom.vertexAt( v1idx );
QgsPoint mapPoint1 = toMapCoordinates( m.layer(), layerPoint1 );
addDragBand( mapPoint1, edge_p1 );
mDraggingEdge->bandsTo1 << drag_bands.last();
mDraggingEdge->bandsTo1 << mDragBands.last();
}

mDraggingEdge->band0to1 = drag_bands.first();
mDraggingEdge->band0to1 = mDragBands.first();

mOverrideCadPoints.clear();
mOverrideCadPoints << m.point() << m.point();
@@ -1181,12 +1181,12 @@ void QgsNodeTool2::deleteVertex()

}

void QgsNodeTool2::setHighlightedNodes( const QList<Vertex> &list_nodes )
void QgsNodeTool2::setHighlightedNodes( const QList<Vertex> &listNodes )
{
qDeleteAll( mSelectedNodesMarkers );
mSelectedNodesMarkers.clear();

Q_FOREACH ( const Vertex &node, list_nodes )
Q_FOREACH ( const Vertex &node, listNodes )
{
QgsGeometry geom = cachedGeometryForVertex( node );
QgsVertexMarker *marker = new QgsVertexMarker( canvas() );
@@ -1196,7 +1196,7 @@ void QgsNodeTool2::setHighlightedNodes( const QList<Vertex> &list_nodes )
marker->setCenter( geom.vertexAt( node.vertexId ) );
mSelectedNodesMarkers.append( marker );
}
mSelectedNodes = list_nodes;
mSelectedNodes = listNodes;
}

void QgsNodeTool2::highlightAdjacentVertex( double offset )
@@ -54,11 +54,11 @@ struct Edge
int edgeVertex0; //!< First vertex (with lower index)
QgsPoint startMapPoint; //!< Map point where edge drag started

//! rubber band between the edge's endpoints (owned by drag_bands, not this instance)
//! rubber band between the edge's endpoints (owned by mDragBands, not this instance)
QgsRubberBand *band0to1 = nullptr;
//! rubber bands from other edges to our edge's first endpoint (owned by drag_bands, not this instance)
//! rubber bands from other edges to our edge's first endpoint (owned by mDragBands, not this instance)
QList<QgsRubberBand *> bandsTo0;
//! rubber bands from other edges to our edge's second endpoint (owned by drag_bands, not this instance)
//! rubber bands from other edges to our edge's second endpoint (owned by mDragBands, not this instance)
QList<QgsRubberBand *> bandsTo1;
};

@@ -113,8 +113,8 @@ class APP_EXPORT QgsNodeTool2 : public QgsMapToolAdvancedDigitizing
*/
QgsPointLocator::Match snapToEditableLayer( QgsMapMouseEvent *e );

//! check whether we are still close to the endpoint_marker
bool isNearEndpointMarker( const QgsPoint &map_point );
//! check whether we are still close to the mEndpointMarker
bool isNearEndpointMarker( const QgsPoint &mapPoint );

bool isMatchAtEndpoint( const QgsPointLocator::Match &match );

@@ -126,29 +126,29 @@ class APP_EXPORT QgsNodeTool2 : public QgsMapToolAdvancedDigitizing

void startDragging( QgsMapMouseEvent *e );

void startDraggingMoveVertex( const QgsPoint &map_point, const QgsPointLocator::Match &m );
void startDraggingMoveVertex( const QgsPoint &mapPoint, const QgsPointLocator::Match &m );

//! Get list of matches of all vertices of a layer exactly snapped to a map point
QList<QgsPointLocator::Match> layerVerticesSnappedToPoint( QgsVectorLayer *layer, const QgsPoint &map_point );
QList<QgsPointLocator::Match> layerVerticesSnappedToPoint( QgsVectorLayer *layer, const QgsPoint &mapPoint );

void startDraggingAddVertex( const QgsPointLocator::Match &m );

void startDraggingAddVertexAtEndpoint( const QgsPoint &map_point );
void startDraggingAddVertexAtEndpoint( const QgsPoint &mapPoint );

void startDraggingEdge( const QgsPointLocator::Match &m, const QgsPoint &map_point );
void startDraggingEdge( const QgsPointLocator::Match &m, const QgsPoint &mapPoint );

void stopDragging();

QgsPoint matchToLayerPoint( const QgsVectorLayer *dest_layer, const QgsPoint &map_point, const QgsPointLocator::Match *match );
QgsPoint matchToLayerPoint( const QgsVectorLayer *destLayer, const QgsPoint &mapPoint, const QgsPointLocator::Match *match );

//! Finish moving of an edge
void moveEdge( const QgsPoint &map_point );
void moveEdge( const QgsPoint &mapPoint );

void moveVertex( const QgsPoint &map_point, const QgsPointLocator::Match *map_point_match );
void moveVertex( const QgsPoint &mapPoint, const QgsPointLocator::Match *mapPointMatch );

void deleteVertex();

void setHighlightedNodes( const QList<Vertex> &list_nodes );
void setHighlightedNodes( const QList<Vertex> &listNodes );

//! Allow moving back and forth selected vertex within a feature
void highlightAdjacentVertex( double offset );
@@ -165,7 +165,7 @@ class APP_EXPORT QgsNodeTool2 : public QgsMapToolAdvancedDigitizing

//! Using a given edge match and original map point, find out
//! center of the edge and whether we are close enough to the center
bool matchEdgeCenterTest( const QgsPointLocator::Match &m, const QgsPoint &map_point, QgsPoint *edge_center_ptr = nullptr );
bool matchEdgeCenterTest( const QgsPointLocator::Match &m, const QgsPoint &mapPoint, QgsPoint *edgeCenterPtr = nullptr );


private:
@@ -179,9 +179,9 @@ class APP_EXPORT QgsNodeTool2 : public QgsMapToolAdvancedDigitizing
QgsVertexMarker *mEdgeCenterMarker = nullptr;
//! rubber band for highlight of a whole feature on mouse over and not dragging anything
QgsRubberBand *mFeatureBand = nullptr;
//! source layer for feature_band (null if feature_band is null)
//! source layer for mFeatureBand (null if mFeatureBand is null)
const QgsVectorLayer *mFeatureBandLayer = nullptr;
//! source feature id for feature_band (zero if feature_band is null)
//! source feature id for mFeatureBand (zero if mFeatureBand is null)
QgsFeatureId mFeatureBandFid;
//! highlight of a vertex while mouse pointer is close to a vertex and not dragging anything
QgsRubberBand *mVertexBand = nullptr;
@@ -199,12 +199,11 @@ class APP_EXPORT QgsNodeTool2 : public QgsMapToolAdvancedDigitizing
};

//! marker for a point used only for moving standalone point geoetry
//! (there are no adjacent vertices so drag_bands is empty in that case)
//! (there are no adjacent vertices so mDragBands is empty in that case)
QgsVertexMarker *mDragPointMarker = nullptr;
//! list of QgsRubberBand instances used when dragging
QList<QgsRubberBand *> drag_bands;
QList<QgsRubberBand *> mDragBands;
//! instance of Vertex that is being currently moved or nothing
//! (vertex_id when adding is a tuple (vid, adding_at_endpoint))
std::unique_ptr<Vertex> mDraggingVertex;
//! whether moving a vertex or adding one
DraggingVertexType mDraggingVertexType = NotDragging;
@@ -227,7 +226,7 @@ class APP_EXPORT QgsNodeTool2 : public QgsMapToolAdvancedDigitizing
std::unique_ptr<QPoint> mSelectionRectStartPos;
//! QRect in screen coordinates or null
std::unique_ptr<QRect> mSelectionRect;
//! QRubberBand to show selection_rect
//! QRubberBand to show mSelectionRect
QRubberBand *mSelectionRectItem = nullptr;

// members for addition of vertices at the end of a curve

0 comments on commit 95eada5

Please sign in to comment.