[gdal-dev] Patch for s57reader.cpp

mrxonx at hotmail.com mrxonx at hotmail.com
Tue Dec 13 23:00:18 EST 2011


Looks like the patch has been applied - thanks!

Test chart is found in current UKHO data set, chart GB327200 (St. Helena).
It's not a free data set, so I can't attach a copy, but UKHO should be
willing to provide one free of charge, if requested, for test purposes.

M S wrote:
>
> > Date: Fri, 4 Nov 2011 16:54:09 -0200
> > Subject: Re: [gdal-dev] Patch for s57reader.cpp
> > From: etourigny.dev at gmail.com
> > To: mrxonx at hotmail.com
> > CC: gdal-dev at lists.osgeo.org
> >
> > 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
> > >
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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