~ubuntu-branches/debian/sid/gdal/sid

« back to all changes in this revision

Viewing changes to frmts/raw/gscdataset.cpp

  • Committer: Package Import Robot
  • Author(s): Francesco Paolo Lovergine
  • Date: 2012-05-07 15:04:42 UTC
  • mfrom: (5.5.16 experimental)
  • Revision ID: package-import@ubuntu.com-20120507150442-2eks97loeh6rq005
Tags: 1.9.0-1
* Ready for sid, starting transition.
* All symfiles updated to latest builds.
* Added dh_numpy call in debian/rules to depend on numpy ABI.
* Policy bumped to 3.9.3, no changes required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/******************************************************************************
2
 
 * $Id: gscdataset.cpp 17664 2009-09-21 21:16:45Z rouault $
 
2
 * $Id: gscdataset.cpp 21715 2011-02-13 19:18:59Z rouault $
3
3
 *
4
4
 * Project:  GSC Geogrid format driver.
5
5
 * Purpose:  Implements support for reading and writing GSC Geogrid format.
30
30
#include "rawdataset.h"
31
31
#include "cpl_string.h"
32
32
 
33
 
CPL_CVSID("$Id: gscdataset.cpp 17664 2009-09-21 21:16:45Z rouault $");
 
33
CPL_CVSID("$Id: gscdataset.cpp 21715 2011-02-13 19:18:59Z rouault $");
34
34
 
35
35
/************************************************************************/
36
36
/* ==================================================================== */
40
40
 
41
41
class GSCDataset : public RawDataset
42
42
{
43
 
    FILE        *fpImage;       // image data file.
 
43
    VSILFILE    *fpImage;       // image data file.
44
44
    
45
45
    double      adfGeoTransform[6];
46
46
 
77
77
{
78
78
    FlushCache();
79
79
    if( fpImage != NULL )
80
 
        VSIFClose( fpImage );
 
80
        VSIFCloseL( fpImage );
81
81
}
82
82
 
83
83
/************************************************************************/
104
104
/* -------------------------------------------------------------------- */
105
105
/*      Does this plausible look like a GSC Geogrid file?               */
106
106
/* -------------------------------------------------------------------- */
107
 
    if( poOpenInfo->nHeaderBytes < 20 || poOpenInfo->fp == NULL )
 
107
    if( poOpenInfo->nHeaderBytes < 20 )
108
108
        return NULL;
109
109
 
110
110
    if( poOpenInfo->pabyHeader[12] != 0x02
149
149
/* -------------------------------------------------------------------- */
150
150
/*      Assume ownership of the file handled from the GDALOpenInfo.     */
151
151
/* -------------------------------------------------------------------- */
152
 
    poDS->fpImage = poOpenInfo->fp;
153
 
    poOpenInfo->fp = NULL;
 
152
    poDS->fpImage = VSIFOpenL(poOpenInfo->pszFilename, "rb");
 
153
    if (poDS->fpImage == NULL)
 
154
    {
 
155
        delete poDS;
 
156
        return NULL;
 
157
    }
154
158
 
155
159
/* -------------------------------------------------------------------- */
156
160
/*      Read the header information in the second record.               */
157
161
/* -------------------------------------------------------------------- */
158
162
    float       afHeaderInfo[8];
159
163
 
160
 
    if( VSIFSeek( poDS->fpImage, nRecordLen + 12, SEEK_SET ) != 0
161
 
        || VSIFRead( afHeaderInfo, sizeof(float), 8, poDS->fpImage ) != 8 )
 
164
    if( VSIFSeekL( poDS->fpImage, nRecordLen + 12, SEEK_SET ) != 0
 
165
        || VSIFReadL( afHeaderInfo, sizeof(float), 8, poDS->fpImage ) != 8 )
162
166
    {
163
167
        CPLError( CE_Failure, CPLE_FileIO, 
164
168
                  "Failure reading second record of GSC file with %d record length.",
192
196
    poBand = new RawRasterBand( poDS, 1, poDS->fpImage,
193
197
                                nRecordLen * 2 + 4,
194
198
                                sizeof(float), nRecordLen,
195
 
                                GDT_Float32, bNative, FALSE );
 
199
                                GDT_Float32, bNative, TRUE );
196
200
    poDS->SetBand( 1, poBand );
197
201
 
198
202
    poBand->SetNoDataValue( -1.0000000150474662199e+30 );
229
233
                                   "GSC Geogrid" );
230
234
//        poDriver->SetMetadataItem( GDAL_DMD_HELPTOPIC, 
231
235
//                                   "frmt_various.html#GSC" );
 
236
        poDriver->SetMetadataItem( GDAL_DCAP_VIRTUALIO, "YES" );
232
237
 
233
238
        poDriver->pfnOpen = GSCDataset::Open;
234
239