Skip to content

Commit 477c662

Browse files
author
jef
committed
apply #2692. Thanks again Jeremy.
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13471 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent d8adf0b commit 477c662

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

src/app/qgsmaptoolidentify.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ bool QgsMapToolIdentify::identifyVectorLayer( QgsVectorLayer *layer, int x, int
295295
convertMeasurement( calc, dist, myDisplayUnits, false );
296296
QString str = calc.textUnit( dist, 3, myDisplayUnits, false ); // dist and myDisplayUnits are out params
297297
derivedAttributes.insert( tr( "Length" ), str );
298-
if ( f_it->geometry()->wkbType() == QGis::WKBLineString )
298+
if ( f_it->geometry()->wkbType() == QGis::WKBLineString ||
299+
f_it->geometry()->wkbType() == QGis::WKBLineString25D )
299300
{
300301
// Add the start and end points in as derived attributes
301302
str = QLocale::system().toString( f_it->geometry()->asPolyline().first().x(), 'g', 10 );
@@ -316,7 +317,9 @@ bool QgsMapToolIdentify::identifyVectorLayer( QgsVectorLayer *layer, int x, int
316317
QString str = calc.textUnit( area, 3, myDisplayUnits, true );
317318
derivedAttributes.insert( tr( "Area" ), str );
318319
}
319-
else if ( layer->geometryType() == QGis::Point )
320+
else if ( layer->geometryType() == QGis::Point &&
321+
( f_it->geometry()->wkbType() == QGis::WKBPoint ||
322+
f_it->geometry()->wkbType() == QGis::WKBPoint25D ) )
320323
{
321324
// Include the x and y coordinates of the point as a derived attribute
322325
QString str;

src/gui/qgsrubberband.cpp

+11-12
Original file line numberDiff line numberDiff line change
@@ -202,19 +202,20 @@ void QgsRubberBand::setToGeometry( QgsGeometry* geom, QgsVectorLayer* layer )
202202
for ( int i = 0; i < mpt.size(); ++i )
203203
{
204204
QgsPoint pt = mpt[i];
205+
mPoints.push_back( QList<QgsPoint>() );
205206
if ( layer )
206207
{
207-
addPoint( mr->layerToMapCoordinates( layer, QgsPoint( pt.x() - d, pt.y() - d ) ), false );
208-
addPoint( mr->layerToMapCoordinates( layer, QgsPoint( pt.x() + d, pt.y() - d ) ), false );
209-
addPoint( mr->layerToMapCoordinates( layer, QgsPoint( pt.x() + d, pt.y() + d ) ), false );
210-
addPoint( mr->layerToMapCoordinates( layer, QgsPoint( pt.x() - d, pt.y() + d ) ), false );
208+
addPoint( mr->layerToMapCoordinates( layer, QgsPoint( pt.x() - d, pt.y() - d ) ), false, i );
209+
addPoint( mr->layerToMapCoordinates( layer, QgsPoint( pt.x() + d, pt.y() - d ) ), false, i );
210+
addPoint( mr->layerToMapCoordinates( layer, QgsPoint( pt.x() + d, pt.y() + d ) ), false, i );
211+
addPoint( mr->layerToMapCoordinates( layer, QgsPoint( pt.x() - d, pt.y() + d ) ), false, i );
211212
}
212213
else
213214
{
214-
addPoint( QgsPoint( pt.x() - d, pt.y() - d ), false );
215-
addPoint( QgsPoint( pt.x() + d, pt.y() - d ), false );
216-
addPoint( QgsPoint( pt.x() + d, pt.y() + d ), false );
217-
addPoint( QgsPoint( pt.x() - d, pt.y() + d ), false );
215+
addPoint( QgsPoint( pt.x() - d, pt.y() - d ), false, i );
216+
addPoint( QgsPoint( pt.x() + d, pt.y() - d ), false, i );
217+
addPoint( QgsPoint( pt.x() + d, pt.y() + d ), false, i );
218+
addPoint( QgsPoint( pt.x() - d, pt.y() + d ), false, i );
218219
}
219220
}
220221
}
@@ -248,8 +249,7 @@ void QgsRubberBand::setToGeometry( QgsGeometry* geom, QgsVectorLayer* layer )
248249
QgsMultiPolyline mline = geom->asMultiPolyline();
249250
for ( int i = 0; i < mline.size(); ++i )
250251
{
251-
QList<QgsPoint> newList;
252-
mPoints.push_back( newList );
252+
mPoints.push_back( QList<QgsPoint>() );
253253
QgsPolyline line = mline[i];
254254
for ( int j = 0; j < line.size(); ++j )
255255
{
@@ -295,8 +295,7 @@ void QgsRubberBand::setToGeometry( QgsGeometry* geom, QgsVectorLayer* layer )
295295
QgsMultiPolygon multipoly = geom->asMultiPolygon();
296296
for ( int i = 0; i < multipoly.size(); ++i )
297297
{
298-
QList<QgsPoint> newList;
299-
mPoints.push_back( newList );
298+
mPoints.push_back( QList<QgsPoint>() );
300299
QgsPolygon poly = multipoly[i];
301300
QgsPolyline line = poly[0];
302301
for ( int j = 0; j < line.count(); ++j )

0 commit comments

Comments
 (0)