mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
catch more projection errors
git-svn-id: http://svn.osgeo.org/qgis/trunk@12665 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
54e68185e8
commit
ed4e5e4c32
@ -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,7 +2000,7 @@ 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 )
|
||||
@ -2008,7 +2008,7 @@ int QgsVectorLayer::translateFeature( int featureId, double dx, double dy )
|
||||
return addedIt->geometry()->translate( dx, dy );
|
||||
}
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
//else look in mCachedGeometries to make access faster
|
||||
QgsGeometryMap::iterator cachedIt = mCachedGeometries.find( featureId );
|
||||
|
Loading…
x
Reference in New Issue
Block a user