Skip to content
Permalink
Browse files
Formatting changes only
git-svn-id: http://svn.osgeo.org/qgis/trunk@8752 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Jul 11, 2008
1 parent ea06083 commit 159a004e88e378192bfe7cd3cb4a8e2a4ca27faf
Showing with 31 additions and 31 deletions.
  1. +31 −31 src/app/qgsmaptooledit.cpp
@@ -39,41 +39,41 @@ int QgsMapToolEdit::insertSegmentVerticesForSnap(const QList<QgsSnappingResult>&
QgsPoint layerPoint;

if(!editedLayer || !editedLayer->isEditable())
{
return 1;
}
{
return 1;
}

//transform snaping coordinates to layer crs first
QList<QgsSnappingResult> transformedSnapResults = snapResults;
QList<QgsSnappingResult>::iterator it = transformedSnapResults.begin();
for(; it != transformedSnapResults.constEnd(); ++it)
{
QgsPoint layerPoint = toLayerCoords(editedLayer, it->snappedVertex);
it->snappedVertex = layerPoint;
}
{
QgsPoint layerPoint = toLayerCoords(editedLayer, it->snappedVertex);
it->snappedVertex = layerPoint;
}

return editedLayer->insertSegmentVerticesForSnap(transformedSnapResults);
}

QgsPoint QgsMapToolEdit::snapPointFromResults(const QList<QgsSnappingResult>& snapResults, const QPoint& screenCoords)
{
if(snapResults.size() < 1)
{
return toMapCoords(screenCoords);
}
{
return toMapCoords(screenCoords);
}
else
{
return snapResults.constBegin()->snappedVertex;
}
{
return snapResults.constBegin()->snappedVertex;
}
}

QgsRubberBand* QgsMapToolEdit::createRubberBand(bool isPolygon)
{
QSettings settings;
QgsRubberBand* rb = new QgsRubberBand(mCanvas, isPolygon);
QColor color( settings.value("/qgis/digitizing/line_color_red", 255).toInt(),
settings.value("/qgis/digitizing/line_color_green", 0).toInt(),
settings.value("/qgis/digitizing/line_color_blue", 0).toInt());
settings.value("/qgis/digitizing/line_color_green", 0).toInt(),
settings.value("/qgis/digitizing/line_color_blue", 0).toInt());
rb->setColor(color);
rb->setWidth(settings.value("/qgis/digitizing/line_width", 1).toInt());
rb->show();
@@ -84,39 +84,39 @@ QgsVectorLayer* QgsMapToolEdit::currentVectorLayer()
{
QgsMapLayer* currentLayer = mCanvas->currentLayer();
if(!currentLayer)
{
return 0;
}
{
return 0;
}

QgsVectorLayer* vlayer = dynamic_cast<QgsVectorLayer*>(currentLayer);
if(!vlayer)
{
return 0;
}
{
return 0;
}
return vlayer;
}


int QgsMapToolEdit::addTopologicalPoints(const QList<QgsPoint>& geom)
{
if(!mCanvas)
{
return 1;
}
{
return 1;
}

//find out current vector layer
QgsVectorLayer *vlayer = currentVectorLayer();

if (!vlayer)
{
return 2;
}
{
return 2;
}

QList<QgsPoint>::const_iterator list_it = geom.constBegin();
for(; list_it != geom.constEnd(); ++list_it)
{
vlayer->addTopologicalPoints(*list_it);
}
{
vlayer->addTopologicalPoints(*list_it);
}
return 0;
}

0 comments on commit 159a004

Please sign in to comment.