static GDALDataset *OGRGTMDriverOpen( GDALOpenInfo* poOpenInfo ) { if( poOpenInfo->eAccess == GA_Update || poOpenInfo->fpL == NULL || poOpenInfo->nHeaderBytes < 13) return NULL; /* -------------------------------------------------------------------- */ /* If it looks like a GZip header, this may be a .gtz file, so */ /* try opening with the /vsigzip/ prefix */ /* -------------------------------------------------------------------- */ if (poOpenInfo->pabyHeader[0] == 0x1f && ((unsigned char*)poOpenInfo->pabyHeader)[1] == 0x8b && strncmp(poOpenInfo->pszFilename, "/vsigzip/", strlen("/vsigzip/")) != 0) { /* ok */ } else { short version = CPL_LSBINT16PTR(poOpenInfo->pabyHeader); if (version != 211 || strncmp((const char*)poOpenInfo->pabyHeader + 2, "TrackMaker", strlen("TrackMaker")) != 0 ) { return NULL; } } OGRGTMDataSource *poDS = new OGRGTMDataSource(); if( !poDS->Open( poOpenInfo->pszFilename, FALSE ) ) { delete poDS; poDS = NULL; } return poDS; }
OGRDataSource *OGRGTMDriver::CreateDataSource( const char* pszName, char** papszOptions ) { CPLAssert( NULL != pszName ); CPLDebug( "GTM", "Attempt to create: %s", pszName ); OGRGTMDataSource *poDS = new OGRGTMDataSource(); if( !poDS->Create( pszName, papszOptions ) ) { delete poDS; poDS = NULL; } return poDS; }
OGRDataSource *OGRGTMDriver::Open( const char * pszName, int bUpdate ) { if (bUpdate) { return NULL; } OGRGTMDataSource *poDS = new OGRGTMDataSource(); if( !poDS->Open( pszName, bUpdate ) ) { delete poDS; poDS = NULL; } return poDS; }
static GDALDataset *OGRGTMDriverCreate( const char * pszName, CPL_UNUSED int nBands, CPL_UNUSED int nXSize, CPL_UNUSED int nYSize, CPL_UNUSED GDALDataType eDT, char **papszOptions ) { CPLAssert( NULL != pszName ); CPLDebug( "GTM", "Attempt to create: %s", pszName ); OGRGTMDataSource *poDS = new OGRGTMDataSource(); if( !poDS->Create( pszName, papszOptions ) ) { delete poDS; poDS = NULL; } return poDS; }