Skip to content
Snippets Groups Projects
Commit 97c926cd authored by Emmanuel Christophe's avatar Emmanuel Christophe
Browse files

ENH: exceptions to replace printf/exit

parent e28a7712
No related branches found
No related tags found
No related merge requests found
......@@ -607,41 +607,41 @@ SHPVectorDataIO<TData>
PolygonPointerType extRing = PolygonType::New();
for (int pIndex = 0;pIndex<ogrRing->getNumPoints();++pIndex)
{
{
ogrRing->getPoint(pIndex,ogrTmpPoint);
typename PolygonType::VertexType vertex;
vertex[0] = ogrTmpPoint->getX();
vertex[1] = ogrTmpPoint->getY();
if (DataNodeType::Dimension > 2)
{
{
vertex[2]= ogrTmpPoint->getZ();
}
}
extRing->AddVertex(vertex);
}
}
PolygonListPointerType intRings = PolygonListType::New();
for (int intRingIndex = 0;intRingIndex<ogrPolygon->getNumInteriorRings();++intRingIndex)
{
{
PolygonPointerType ring = PolygonType::New();
ogrRing = ogrPolygon->getInteriorRing(intRingIndex);
for (int pIndex = 0;pIndex<ogrRing->getNumPoints();++pIndex)
{
{
ogrRing->getPoint(pIndex,ogrTmpPoint);
typename PolygonType::VertexType vertex;
vertex[0] = ogrTmpPoint->getX();
vertex[1] = ogrTmpPoint->getY();
if (DataNodeType::Dimension > 2)
{
{
vertex[2]= ogrTmpPoint->getZ();
}
ring->AddVertex(vertex);
}
intRings->PushBack(ring);
ring->AddVertex(vertex);
}
intRings->PushBack(ring);
}
delete ogrTmpPoint;
......@@ -874,8 +874,7 @@ template<class TData>
if( ogrCurrentLayer->CreateFeature( ogrFeature ) != OGRERR_NONE )
{
printf( "Failed to create feature in shapefile.\n" );
exit( 1 );
itkExceptionMacro(<<"Failed to create feature in shapefile.");
}
OGRFeature::DestroyFeature( ogrFeature );
......@@ -919,8 +918,7 @@ template<class TData>
if( ogrCurrentLayer->CreateFeature( ogrFeature ) != OGRERR_NONE )
{
printf( "Failed to create feature in shapefile.\n" );
exit( 1 );
itkExceptionMacro(<<"Failed to create feature in shapefile.");
}
OGRFeature::DestroyFeature( ogrFeature );
......@@ -993,8 +991,7 @@ template<class TData>
if( ogrCurrentLayer->CreateFeature( ogrFeature ) != OGRERR_NONE )
{
printf( "Failed to create feature in shapefile.\n" );
exit( 1 );
itkExceptionMacro(<<"Failed to create feature in shapefile.");
}
OGRFeature::DestroyFeature( ogrFeature );
......@@ -1025,8 +1022,7 @@ template<class TData>
if( ogrCurrentLayer->CreateFeature( ogrFeature ) != OGRERR_NONE )
{
printf( "Failed to create feature in shapefile.\n" );
exit( 1 );
itkExceptionMacro(<<"Failed to create feature in shapefile.");
}
ProcessNodeWrite(*it, ogrCollection, ogrCurrentLayer, oSRS);
......@@ -1049,8 +1045,7 @@ template<class TData>
if( ogrCurrentLayer->CreateFeature( ogrFeature ) != OGRERR_NONE )
{
printf( "Failed to create feature in shapefile.\n" );
exit( 1 );
itkExceptionMacro(<<"Failed to create feature in shapefile.");
}
ProcessNodeWrite(*it, ogrCollection, ogrCurrentLayer, oSRS);
......@@ -1073,8 +1068,7 @@ template<class TData>
if( ogrCurrentLayer->CreateFeature( ogrFeature ) != OGRERR_NONE )
{
printf( "Failed to create feature in shapefile.\n" );
exit( 1 );
itkExceptionMacro(<<"Failed to create feature in shapefile.");
}
ProcessNodeWrite(*it, ogrCollection, ogrCurrentLayer, oSRS);
......@@ -1097,8 +1091,7 @@ template<class TData>
if( ogrCurrentLayer->CreateFeature( ogrFeature ) != OGRERR_NONE )
{
printf( "Failed to create feature in shapefile.\n" );
exit( 1 );
itkExceptionMacro(<<"Failed to create feature in shapefile.");
}
ProcessNodeWrite(*it, ogrCollection, ogrCurrentLayer, oSRS);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment