本文整理汇总了C++中CPLGetExtension函数的典型用法代码示例。如果您正苦于以下问题:C++ CPLGetExtension函数的具体用法?C++ CPLGetExtension怎么用?C++ CPLGetExtension使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CPLGetExtension函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CPLError
OGRDataSource *OGRWalkDriver::Open( const char * pszFilename, int bUpdate )
{
if( EQUALN(pszFilename, "PGEO:", strlen("PGEO:")) )
return NULL;
if( EQUALN(pszFilename, "GEOMEDIA:", strlen("GEOMEDIA:")) )
return NULL;
if( !EQUALN(pszFilename,"WALK:", strlen("WALK:"))
&& !EQUAL(CPLGetExtension(pszFilename), "MDB") )
return NULL;
#ifndef WIN32
// Try to register MDB Tools driver
//
// ODBCINST.INI NOTE:
// This operation requires write access to odbcinst.ini file
// located in directory pointed by ODBCINISYS variable.
// Usually, it points to /etc, so non-root users can overwrite this
// setting ODBCINISYS with location they have write access to, e.g.:
// $ export ODBCINISYS=$HOME/etc
// $ touch $ODBCINISYS/odbcinst.ini
//
// See: http://www.unixodbc.org/internals.html
//
if ( !InstallMdbDriver() )
{
CPLError( CE_Warning, CPLE_AppDefined,
"Unable to install MDB driver for ODBC, MDB access may not supported.\n" );
}
else
CPLDebug( "Walk", "MDB Tools driver installed successfully!");
#endif /* ndef WIN32 */
OGRWalkDataSource *poDS = new OGRWalkDataSource();
if( !poDS->Open( pszFilename, bUpdate ) )
{
delete poDS;
return NULL;
}
else
return poDS;
}
开发者ID:drownedout,项目名称:datamap,代码行数:46,代码来源:ogrwalkdriver.cpp
示例2: Identify
int ARGDataset::Identify( GDALOpenInfo *poOpenInfo )
{
json_object * pJSONObject;
if (!EQUAL(CPLGetExtension(poOpenInfo->pszFilename), "arg")) {
return FALSE;
}
pJSONObject = GetJsonObject(poOpenInfo->pszFilename);
if (pJSONObject == NULL) {
return FALSE;
}
json_object_put(pJSONObject);
pJSONObject = NULL;
return TRUE;
}
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:17,代码来源:argdataset.cpp
示例3: GetOutputDriversFor
std::vector<CPLString> GetOutputDriversFor(const char* pszDestFilename,
int nFlagRasterVector)
{
std::vector<CPLString> aoDriverList;
CPLString osExt = CPLGetExtension(pszDestFilename);
const int nDriverCount = GDALGetDriverCount();
for( int i = 0; i < nDriverCount; i++ )
{
GDALDriverH hDriver = GDALGetDriver(i);
if( (GDALGetMetadataItem( hDriver, GDAL_DCAP_CREATE, nullptr ) != nullptr ||
GDALGetMetadataItem( hDriver, GDAL_DCAP_CREATECOPY, nullptr ) != nullptr ) &&
(((nFlagRasterVector & GDAL_OF_RASTER) &&
GDALGetMetadataItem( hDriver, GDAL_DCAP_RASTER, nullptr ) != nullptr) ||
((nFlagRasterVector & GDAL_OF_VECTOR) &&
GDALGetMetadataItem( hDriver, GDAL_DCAP_VECTOR, nullptr ) != nullptr)) )
{
if( !osExt.empty() && DoesDriverHandleExtension(hDriver, osExt) )
{
aoDriverList.push_back( GDALGetDriverShortName(hDriver) );
}
else
{
const char* pszPrefix = GDALGetMetadataItem(hDriver,
GDAL_DMD_CONNECTION_PREFIX, nullptr);
if( pszPrefix && STARTS_WITH_CI(pszDestFilename, pszPrefix) )
{
aoDriverList.push_back( GDALGetDriverShortName(hDriver) );
}
}
}
}
// GMT is registered before netCDF for opening reasons, but we want
// netCDF to be used by default for output.
if( EQUAL(osExt, "nc") && aoDriverList.size() == 2 &&
EQUAL(aoDriverList[0], "GMT") && EQUAL(aoDriverList[1], "NETCDF") )
{
aoDriverList.clear();
aoDriverList.push_back("NETCDF");
aoDriverList.push_back("GMT");
}
return aoDriverList;
}
开发者ID:jef-n,项目名称:gdal,代码行数:45,代码来源:commonutils.cpp
示例4: CheckExtensionConsistency
void CheckExtensionConsistency(const char* pszDestFilename,
const char* pszDriverName)
{
char* pszDestExtension = CPLStrdup(CPLGetExtension(pszDestFilename));
if (pszDestExtension[0] != '\0')
{
int nDriverCount = GDALGetDriverCount();
CPLString osConflictingDriverList;
for(int i=0;i<nDriverCount;i++)
{
GDALDriverH hDriver = GDALGetDriver(i);
const char* pszDriverExtension =
GDALGetMetadataItem( hDriver, GDAL_DMD_EXTENSION, NULL );
if (pszDriverExtension && EQUAL(pszDestExtension, pszDriverExtension))
{
if (GDALGetDriverByName(pszDriverName) != hDriver)
{
if (osConflictingDriverList.size())
osConflictingDriverList += ", ";
osConflictingDriverList += GDALGetDriverShortName(hDriver);
}
else
{
/* If the request driver allows the used extension, then */
/* just stop iterating now */
osConflictingDriverList = "";
break;
}
}
}
if (osConflictingDriverList.size())
{
fprintf(stderr,
"Warning: The target file has a '%s' extension, which is normally used by the %s driver%s,\n"
"but the requested output driver is %s. Is it really what you want ?\n",
pszDestExtension,
osConflictingDriverList.c_str(),
strchr(osConflictingDriverList.c_str(), ',') ? "s" : "",
pszDriverName);
}
}
CPLFree(pszDestExtension);
}
开发者ID:TUW-GEO,项目名称:OGRSpatialRef3D,代码行数:45,代码来源:commonutils.cpp
示例5: EQUAL
int RDataset::Identify( GDALOpenInfo *poOpenInfo )
{
if( poOpenInfo->nHeaderBytes < 50 )
return FALSE;
// If the extension is .rda and the file type is gzip
// compressed we assume it is a gzipped R binary file.
if( memcmp(poOpenInfo->pabyHeader, "\037\213\b", 3) == 0 &&
EQUAL(CPLGetExtension(poOpenInfo->pszFilename), "rda") )
return TRUE;
// Is this an ASCII or XDR binary R file?
if( !STARTS_WITH_CI((const char *)poOpenInfo->pabyHeader, "RDA2\nA\n") &&
!STARTS_WITH_CI((const char *)poOpenInfo->pabyHeader, "RDX2\nX\n") )
return FALSE;
return TRUE;
}
开发者ID:ksshannon,项目名称:gdal,代码行数:18,代码来源:rdataset.cpp
示例6: Identify
int ARGDataset::Identify( GDALOpenInfo *poOpenInfo )
{
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
if (!EQUAL(CPLGetExtension(poOpenInfo->pszFilename), "arg")) {
return FALSE;
}
#endif
json_object *pJSONObject = GetJsonObject(poOpenInfo->pszFilename);
if (pJSONObject == nullptr) {
return FALSE;
}
json_object_put(pJSONObject);
pJSONObject = nullptr;
return TRUE;
}
开发者ID:AsgerPetersen,项目名称:gdal,代码行数:18,代码来源:argdataset.cpp
示例7: locker
bool wxGISDataset::Rename(const wxString &sNewName, ITrackCancel* const pTrackCancel)
{
wxCriticalSectionLocker locker(m_CritSect);
Close();
CPLString szDirPath = CPLGetPath(m_sPath);
CPLString szName = CPLGetBasename(m_sPath);
CPLString szNewName(ClearExt(sNewName).mb_str(wxConvUTF8));
char** papszFileList = GetFileList();
papszFileList = CSLAddString( papszFileList, m_sPath );
if(!papszFileList)
{
if(pTrackCancel)
pTrackCancel->PutMessage(_("No files to rename"), wxNOT_FOUND, enumGISMessageErr);
return false;
}
char **papszNewFileList = NULL;
for(int i = 0; papszFileList[i] != NULL; ++i )
{
CPLString szNewPath(CPLFormFilename(szDirPath, szNewName, GetExtension(papszFileList[i], szName)));
papszNewFileList = CSLAddString(papszNewFileList, szNewPath);
if(!RenameFile(papszFileList[i], papszNewFileList[i], pTrackCancel))
{
// Try to put the ones we moved back.
for( --i; i >= 0; i-- )
RenameFile( papszNewFileList[i], papszFileList[i]);
CSLDestroy( papszFileList );
CSLDestroy( papszNewFileList );
return false;
}
}
m_sPath = CPLString(CPLFormFilename(szDirPath, szNewName, CPLGetExtension(m_sPath)));
CSLDestroy( papszFileList );
CSLDestroy( papszNewFileList );
return true;
}
开发者ID:Mileslee,项目名称:wxgis,代码行数:43,代码来源:dataset.cpp
示例8: OGRDWGDataSource
OGRDataSource *OGRDWGDriver::Open( const char * pszFilename, int /*bUpdate*/ )
{
if( !EQUAL(CPLGetExtension(pszFilename),"dwg") )
return NULL;
if( !OGRTEIGHAInitialize() )
return NULL;
OGRDWGDataSource *poDS = new OGRDWGDataSource();
if( !poDS->Open( OGRDWGGetServices(), pszFilename ) )
{
delete poDS;
poDS = NULL;
}
return poDS;
}
开发者ID:Mavrx-inc,项目名称:gdal,代码行数:19,代码来源:ogrdwgdriver.cpp
示例9: GetGxCatalog
bool wxGxWebConnectionFactory::GetChildren(wxGxObject* pParent, char** &pFileNames, wxArrayLong & pChildrenIds)
{
wxGxCatalogBase* pCatalog = GetGxCatalog();
for(int i = CSLCount(pFileNames) - 1; i >= 0; i-- )
{
CPLString szExt = CPLGetExtension(pFileNames[i]);
if(wxGISEQUAL(szExt, "wconn"))
{
if( m_bHasDriver )
{
wxGxObject* pObj = GetGxObject(pParent, GetConvName(pFileNames[i]), pFileNames[i]);
if(pObj)
pChildrenIds.Add(pObj->GetId());
}
pFileNames = CSLRemoveStrings( pFileNames, i, 1, NULL );
}
}
return true;
}
开发者ID:Mileslee,项目名称:wxgis,代码行数:19,代码来源:gxwebconnfactory.cpp
示例10: memcmp
int BAGDataset::Identify( GDALOpenInfo * poOpenInfo )
{
/* -------------------------------------------------------------------- */
/* Is it an HDF5 file? */
/* -------------------------------------------------------------------- */
static const char achSignature[] = "\211HDF\r\n\032\n";
if( poOpenInfo->pabyHeader == NULL
|| memcmp(poOpenInfo->pabyHeader,achSignature,8) != 0 )
return FALSE;
/* -------------------------------------------------------------------- */
/* Does it have the extension .bag? */
/* -------------------------------------------------------------------- */
if( !EQUAL(CPLGetExtension(poOpenInfo->pszFilename),"bag") )
return FALSE;
return TRUE;
}
开发者ID:actian-geospatial,项目名称:ogr-ingres,代码行数:20,代码来源:bagdataset.cpp
示例11: OGRAeronavFAADataSource
static GDALDataset *OGRAeronavFAADriverOpen( GDALOpenInfo* poOpenInfo )
{
if (poOpenInfo->eAccess == GA_Update ||
poOpenInfo->fpL == NULL ||
!EQUAL(CPLGetExtension(poOpenInfo->pszFilename), "dat") )
{
return NULL;
}
OGRAeronavFAADataSource *poDS = new OGRAeronavFAADataSource();
if( !poDS->Open( poOpenInfo->pszFilename ) )
{
delete poDS;
poDS = NULL;
}
return poDS;
}
开发者ID:bbradbury,项目名称:lib_gdal,代码行数:20,代码来源:ograeronavfaadriver.cpp
示例12: OGRPDFDataSource
OGRDataSource *OGRPDFDriver::Open( const char * pszFilename, int bUpdate )
{
if( !EQUAL(CPLGetExtension(pszFilename), "pdf") || bUpdate )
return NULL;
/* -------------------------------------------------------------------- */
/* Try to create datasource. */
/* -------------------------------------------------------------------- */
OGRPDFDataSource *poDS;
poDS = new OGRPDFDataSource();
if( !poDS->Open( pszFilename ) )
{
delete poDS;
return NULL;
}
else
return poDS;
}
开发者ID:sylvainallard,项目名称:gdal,代码行数:21,代码来源:ogrpdfdriver.cpp
示例13: OGRGMLDriverIdentify
static int OGRGMLDriverIdentify( GDALOpenInfo* poOpenInfo )
{
if( poOpenInfo->fpL == NULL )
{
if( strstr(poOpenInfo->pszFilename, "xsd=") != NULL )
return -1; /* must be later checked */
return FALSE;
}
/* Might be a OS-Mastermap gzipped GML, so let be nice and try to open */
/* it transparently with /vsigzip/ */
else
if ( poOpenInfo->pabyHeader[0] == 0x1f && poOpenInfo->pabyHeader[1] == 0x8b &&
EQUAL(CPLGetExtension(poOpenInfo->pszFilename), "gz") &&
strncmp(poOpenInfo->pszFilename, "/vsigzip/", strlen("/vsigzip/")) != 0 )
{
return -1; /* must be later checked */
}
else
{
const char* szPtr = (const char*)poOpenInfo->pabyHeader;
if( ( (unsigned char)szPtr[0] == 0xEF )
&& ( (unsigned char)szPtr[1] == 0xBB )
&& ( (unsigned char)szPtr[2] == 0xBF) )
{
szPtr += 3;
}
/* -------------------------------------------------------------------- */
/* Here, we expect the opening chevrons of GML tree root element */
/* -------------------------------------------------------------------- */
if( szPtr[0] != '<' )
return FALSE;
if( !poOpenInfo->TryToIngest(4096) )
return FALSE;
return OGRGMLDataSource::CheckHeader((const char*)poOpenInfo->pabyHeader);
}
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:40,代码来源:ogrgmldriver.cpp
示例14: GetGxCatalog
bool wxGxLocalDBFactory::GetChildren(wxGxObject* pParent, char** &pFileNames, wxArrayLong & pChildrenIds)
{
wxGxCatalogBase* pCatalog = GetGxCatalog();
bool bCheckNames = CSLCount(pFileNames) < CHECK_DUBLES_MAX_COUNT;
for(int i = CSLCount(pFileNames) - 1; i >= 0; i-- )
{
VSIStatBufL BufL;
int ret = VSIStatL(pFileNames[i], &BufL);
if(ret == 0)
{
if (VSI_ISDIR(BufL.st_mode) && wxGISEQUAL(CPLGetExtension(pFileNames[i]), "gdb"))
{
wxGxObject* pObj = GetGxObject(pParent, wxString(CPLGetFilename(pFileNames[i]), wxConvUTF8), pFileNames[i], enumContGDBFolder, bCheckNames);
if(pObj)
pChildrenIds.Add(pObj->GetId());
pFileNames = CSLRemoveStrings( pFileNames, i, 1, NULL );
}
//TODO: mdb, sqlite, db extensions
}
}
return true;
}
开发者ID:GimpoByte,项目名称:nextgismanager,代码行数:22,代码来源:gxlocaldbfactory.cpp
示例15: CheckExtensionConsistency
void CheckExtensionConsistency(const char* pszDestFilename,
const char* pszDriverName)
{
CPLString osExt = CPLGetExtension(pszDestFilename);
if( !osExt.empty() )
{
GDALDriverH hThisDrv = GDALGetDriverByName(pszDriverName);
if( hThisDrv != NULL && DoesDriverHandleExtension(hThisDrv, osExt) )
return;
const int nDriverCount = GDALGetDriverCount();
CPLString osConflictingDriverList;
for( int i = 0; i < nDriverCount; i++ )
{
GDALDriverH hDriver = GDALGetDriver(i);
if( hDriver != hThisDrv &&
DoesDriverHandleExtension(hDriver, osExt) )
{
if (osConflictingDriverList.size())
osConflictingDriverList += ", ";
osConflictingDriverList += GDALGetDriverShortName(hDriver);
}
}
if (osConflictingDriverList.size())
{
fprintf(
stderr,
"Warning: The target file has a '%s' extension, "
"which is normally used by the %s driver%s, "
"but the requested output driver is %s. "
"Is it really what you want?\n",
osExt.c_str(),
osConflictingDriverList.c_str(),
strchr(osConflictingDriverList.c_str(), ',') ? "s" : "",
pszDriverName);
}
}
}
开发者ID:ryandavid,项目名称:rotobox,代码行数:39,代码来源:commonutils.cpp
示例16: CheckDestDataSourceNameConsistency
static
void CheckDestDataSourceNameConsistency(const char* pszDestFilename,
const char* pszDriverName)
{
int i;
char* pszDestExtension = CPLStrdup(CPLGetExtension(pszDestFilename));
if( EQUAL(pszDriverName, "GMT") )
pszDriverName = "OGR_GMT";
CheckExtensionConsistency(pszDestFilename, pszDriverName);
static const char* apszBeginName[][2] = { { "PG:" , "PostgreSQL" },
{ "MySQL:" , "MySQL" },
{ "CouchDB:" , "CouchDB" },
{ "GFT:" , "GFT" },
{ "MSSQL:" , "MSSQLSpatial" },
{ "ODBC:" , "ODBC" },
{ "OCI:" , "OCI" },
{ "SDE:" , "SDE" },
{ "WFS:" , "WFS" },
{ NULL, NULL }
};
for(i=0; apszBeginName[i][0] != NULL; i++)
{
if (EQUALN(pszDestFilename, apszBeginName[i][0], strlen(apszBeginName[i][0])) &&
!EQUAL(pszDriverName, apszBeginName[i][1]))
{
CPLError(CE_Warning, CPLE_AppDefined,
"The target file has a name which is normally recognized by the %s driver,\n"
"but the requested output driver is %s. Is it really what you want ?\n",
apszBeginName[i][1],
pszDriverName);
break;
}
}
CPLFree(pszDestExtension);
}
开发者ID:ryandavid,项目名称:rotobox,代码行数:39,代码来源:ogr2ogr_bin.cpp
示例17: CPLGetExtension
int ROIPACDataset::Identify( GDALOpenInfo *poOpenInfo )
{
/* -------------------------------------------------------------------- */
/* Check if: */
/* * 1. The data file extension is known */
/* -------------------------------------------------------------------- */
const char *pszExtension = CPLGetExtension(poOpenInfo->pszFilename);
if ( strcmp( pszExtension, "raw" ) == 0 )
{
/* Since gdal do not read natively CInt8, more work is needed
* to read raw files */
return false;
}
bool bExtensionIsValid = strcmp( pszExtension, "int" ) == 0
|| strcmp( pszExtension, "slc" ) == 0
|| strcmp( pszExtension, "amp" ) == 0
|| strcmp( pszExtension, "cor" ) == 0
|| strcmp( pszExtension, "hgt" ) == 0
|| strcmp( pszExtension, "unw" ) == 0
|| strcmp( pszExtension, "msk" ) == 0
|| strcmp( pszExtension, "trans" ) == 0
|| strcmp( pszExtension, "dem" ) == 0
|| strcmp( pszExtension, "flg" ) == 0;
if ( !bExtensionIsValid )
{
return false;
}
/* -------------------------------------------------------------------- */
/* * 2. there is a .rsc file */
/* -------------------------------------------------------------------- */
CPLString osRscFilename = getRscFilename( poOpenInfo );
if ( osRscFilename.empty() )
{
return false;
}
return true;
}
开发者ID:nextgis-borsch,项目名称:lib_gdal,代码行数:39,代码来源:roipacdataset.cpp
示例18: OGRXLSDataSource
OGRDataSource *OGRXLSDriver::Open( const char * pszFilename, int bUpdate )
{
if (bUpdate)
{
return NULL;
}
if (!EQUAL(CPLGetExtension(pszFilename), "XLS"))
{
return NULL;
}
OGRXLSDataSource *poDS = new OGRXLSDataSource();
if( !poDS->Open( pszFilename, bUpdate ) )
{
delete poDS;
poDS = NULL;
}
return poDS;
}
开发者ID:samalone,项目名称:gdal-ios,代码行数:23,代码来源:ogrxlsdriver.cpp
示例19: OGRXPlaneDataSource
OGRDataSource *OGRXPlaneDriver::Open( const char * pszFilename, int bUpdate )
{
if ( bUpdate )
{
return NULL;
}
if( !EQUAL(CPLGetExtension(pszFilename), "dat") )
return NULL;
OGRXPlaneDataSource *poDS = new OGRXPlaneDataSource();
int bReadWholeFile = CSLTestBoolean(CPLGetConfigOption("OGR_XPLANE_READ_WHOLE_FILE", "TRUE"));
if( !poDS->Open( pszFilename, bReadWholeFile ) )
{
delete poDS;
poDS = NULL;
}
return poDS;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:23,代码来源:ogrxplanedriver.cpp
示例20: OGRODBCDataSource
OGRDataSource *OGRODBCDriver::Open( const char * pszFilename,
int bUpdate )
{
OGRODBCDataSource *poDS;
if( !EQUALN(pszFilename,"ODBC:",5)
#ifdef WIN32
&& !EQUAL(CPLGetExtension(pszFilename), "MDB")
#endif
)
return NULL;
poDS = new OGRODBCDataSource();
if( !poDS->Open( pszFilename, bUpdate, TRUE ) )
{
delete poDS;
return NULL;
}
else
return poDS;
}
开发者ID:0004c,项目名称:node-gdal,代码行数:23,代码来源:ogrodbcdriver.cpp
注:本文中的CPLGetExtension函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论