Skip to content
Permalink
Browse files

catch more projection errors

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12665 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Jan 2, 2010
1 parent 18e8e57 commit 60d2eae4dae394b076fc7d09bd7cc951422dd16f
@@ -606,6 +606,11 @@ void QgsLegendLayer::saveAsShapefileGeneral( bool saveOnlySelection )
QMessageBox::warning( 0, tr( "Error" ),
tr( "Creation of an attribute failed" ) );
break;

case QgsVectorFileWriter::ErrProjection:
QMessageBox::warning( 0, tr( "Error" ),
tr( "Reprojection failed" ) );
break;
}
}

@@ -422,7 +422,22 @@ QgsVectorFileWriter::writeAsShapefile( QgsVectorLayer* layer,

if ( shallTransform )
{
fet.geometry()->transform( *ct );
try
{
fet.geometry()->transform( *ct );
}
catch ( QgsCsException &e )
{
delete ct;
delete writer;

QString msg( "Failed to transform a point while drawing a feature of type '"
+ fet.typeName() + "'. Writing stopped." );
msg += cse.what();
QgsLogger::warning( msg );

return ErrProjection;
}
}
writer->addFeature( fet );
}
@@ -49,7 +49,8 @@ class CORE_EXPORT QgsVectorFileWriter
ErrCreateDataSource,
ErrCreateLayer,
ErrAttributeTypeUnsupported,
ErrAttributeCreationFailed
ErrAttributeCreationFailed,
ErrProjection // added in 1.5
};

/** Write contents of vector layer to a shapefile */
@@ -1024,11 +1024,11 @@ bool QgsVectorLayer::draw( QgsRenderContext& rendererContext )
catch ( QgsCsException &cse )
{
QString msg( "Failed to transform a point while drawing a feature of type '"
+ fet.typeName() + "'. Ignoring this feature." );
+ fet.typeName() + "'. Rendering stopped." );
msg += cse.what();
QgsLogger::warning( msg );
return false;
}

}
else
{
@@ -1040,7 +1040,7 @@ bool QgsVectorLayer::draw( QgsRenderContext& rendererContext )
QgsDebugMsg( QString( "Cached %1 geometries." ).arg( mCachedGeometries.count() ) );
}

return TRUE; // Assume success always
return true; // Assume success always
}

void QgsVectorLayer::deleteCachedGeometries()
@@ -1942,7 +1942,7 @@ int QgsVectorLayer::addIsland( const QList<QgsPoint>& ring )
}

//look if id of selected feature belongs to an added feature
/*
#if 0
for ( QgsFeatureList::iterator addedIt = mAddedFeatures.begin(); addedIt != mAddedFeatures.end(); ++addedIt )
{
if ( addedIt->id() == selectedFeatureId )
@@ -1951,7 +1951,7 @@ int QgsVectorLayer::addIsland( const QList<QgsPoint>& ring )
mCachedGeometries[selectedFeatureId] = *addedIt->geometry();
}
}
*/
#endif

//is the feature contained in the view extent (mCachedGeometries) ?
QgsGeometryMap::iterator cachedIt = mCachedGeometries.find( selectedFeatureId );
@@ -2000,15 +2000,15 @@ int QgsVectorLayer::translateFeature( int featureId, double dx, double dy )
}

//look if id of selected feature belongs to an added feature
/*
#if 0
for ( QgsFeatureList::iterator addedIt = mAddedFeatures.begin(); addedIt != mAddedFeatures.end(); ++addedIt )
{
if ( addedIt->id() == featureId )
{
return addedIt->geometry()->translate( dx, dy );
}
}
*/
#endif

//else look in mCachedGeometries to make access faster
QgsGeometryMap::iterator cachedIt = mCachedGeometries.find( featureId );

0 comments on commit 60d2eae

Please sign in to comment.
You can’t perform that action at this time.