[gdal-dev] Patch for s57reader.cpp
Etienne Tourigny
etourigny.dev at gmail.com
Fri Nov 4 14:54:09 EDT 2011
Dear Mike,
Please add this to a relevant ticket, or create one and add it there.
http://trac.osgeo.org/gdal/report
thanks, Etienne
On Fri, Nov 4, 2011 at 4:27 PM, <mrxonx at hotmail.com> wrote:
> Dear all,
>
> Included is a patch for s57reader.cpp that properly applies updates for
> certain types of charts.
>
> The essence of this patch is that SG2D field may not be present in
> original record, and must be added if update is trying to insert SG2D
> fields.
>
> The patch was made against our modified version of OGR, so line numbers
> likely do not match and certain function signatures may need to be
> updated. If you'd like to apply it - make sure it goes in the
> S57Reader::ApplyRecordUpdate.
>
> Best,
> --
> Mike
>
>
>
> Index: s57reader.cpp
> ===================================================================
> --- s57reader.cpp (revision 0000)
> +++ s57reader.cpp (working copy)
> @@ -2635,16 +2635,30 @@
> /* If we don't have SG2D, check for SG3D */
> if( poDstSG2D == NULL )
> {
> - poSrcSG2D = poUpdate->FindField("SG3D");
> poDstSG2D = poTarget->FindField("SG3D");
> + if (poDstSG2D != NULL) {
> + poSrcSG2D = poUpdate->FindField("SG3D");
> + }
> }
>
> - if( (poSrcSG2D == NULL && nCCUI != 2) || poDstSG2D == NULL )
> + if( (poSrcSG2D == NULL && nCCUI != 2) || (poDstSG2D == NULL && nCCUI != 1) )
> {
> CPLAssert( FALSE );
> return FALSE;
> }
>
> + if (poDstSG2D == NULL) {
> + poTarget->AddField(poTarget->GetModule()->FindFieldDefn("SG2D"));
> + poDstSG2D = poTarget->FindField("SG2D");
> + if (poDstSG2D == NULL) {
> + CPLAssert( FALSE );
> + return FALSE;
> + }
> +
> + // Delete null default data that was created
> + poTarget->SetFieldRaw( poDstSG2D, 0, NULL, 0 );
> + }
> +
> nCoordSize = poDstSG2D->GetFieldDefn()->GetFixedWidth();
>
> if( nCCUI == 1 ) /* INSERT */
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
More information about the gdal-dev
mailing list