本文整理汇总了C++中CSLFetchNameValueDef函数的典型用法代码示例。如果您正苦于以下问题:C++ CSLFetchNameValueDef函数的具体用法?C++ CSLFetchNameValueDef怎么用?C++ CSLFetchNameValueDef使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CSLFetchNameValueDef函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: m_poDS
OGRGeoJSONSeqWriteLayer::OGRGeoJSONSeqWriteLayer(
OGRGeoJSONSeqDataSource* poDS,
const char* pszName,
CSLConstList papszOptions,
OGRCoordinateTransformation* poCT):
m_poDS(poDS)
{
SetDescription(pszName);
m_poFeatureDefn = new OGRFeatureDefn(pszName);
m_poFeatureDefn->Reference();
m_poFeatureDefn->GetGeomFieldDefn(0)->SetSpatialRef(
OGRSpatialReference::GetWGS84SRS());
m_poCT = poCT;
m_oWriteOptions.SetRFC7946Settings();
m_oWriteOptions.SetIDOptions(papszOptions);
m_oWriteOptions.nCoordPrecision = atoi(
CSLFetchNameValueDef(papszOptions, "COORDINATE_PRECISION", "7"));
m_oWriteOptions.nSignificantFigures = atoi(
CSLFetchNameValueDef(papszOptions, "SIGNIFICANT_FIGURES", "-1"));
m_bRS = EQUAL(CPLGetExtension(poDS->GetDescription()), "GEOJSONS");
const char* pszRS = CSLFetchNameValue(papszOptions, "RS");
if( pszRS )
{
m_bRS = CPLTestBool(pszRS);
}
}
开发者ID:koordinates,项目名称:gdal,代码行数:28,代码来源:ogrgeojsonseqdriver.cpp
示例2: CSLFetchNameValueDef
bool VSIOSSHandleHelper::GetConfiguration(CSLConstList papszOptions,
CPLString& osSecretAccessKey,
CPLString& osAccessKeyId)
{
osSecretAccessKey = CSLFetchNameValueDef(papszOptions,
"OSS_SECRET_ACCESS_KEY",
CPLGetConfigOption("OSS_SECRET_ACCESS_KEY", ""));
if( !osSecretAccessKey.empty() )
{
osAccessKeyId = CSLFetchNameValueDef(papszOptions,
"OSS_ACCESS_KEY_ID",
CPLGetConfigOption("OSS_ACCESS_KEY_ID", ""));
if( osAccessKeyId.empty() )
{
VSIError(VSIE_AWSInvalidCredentials,
"OSS_ACCESS_KEY_ID configuration option not defined");
return false;
}
return true;
}
VSIError(VSIE_AWSInvalidCredentials,
"OSS_SECRET_ACCESS_KEY configuration option not defined");
return false;
}
开发者ID:OSGeo,项目名称:gdal,代码行数:27,代码来源:cpl_alibaba_oss.cpp
示例3: CPLStrdup
char *OGR_G_ExportToGMLEx( OGRGeometryH hGeometry, char** papszOptions )
{
char *pszText;
int nLength = 0, nMaxLength = 1;
if( hGeometry == NULL )
return CPLStrdup( "" );
pszText = (char *) CPLMalloc(nMaxLength);
pszText[0] = '\0';
const char* pszFormat = CSLFetchNameValue(papszOptions, "FORMAT");
if (pszFormat && EQUAL(pszFormat, "GML3"))
{
const char* pszLineStringElement = CSLFetchNameValue(papszOptions, "GML3_LINESTRING_ELEMENT");
int bLineStringAsCurve = (pszLineStringElement && EQUAL(pszLineStringElement, "curve"));
int bLongSRS = CSLTestBoolean(CSLFetchNameValueDef(papszOptions, "GML3_LONGSRS", "YES"));
const char* pszGMLId = CSLFetchNameValue(papszOptions, "GMLID");
const char* pszSRSDimensionLoc = CSLFetchNameValueDef(papszOptions,"SRSDIMENSION_LOC","POSLIST");
char** papszSRSDimensionLoc = CSLTokenizeString2(pszSRSDimensionLoc, ",", 0);
int nSRSDimensionLocFlags = 0;
for(int i=0; papszSRSDimensionLoc[i] != NULL; i++)
{
if( EQUAL(papszSRSDimensionLoc[i], "POSLIST") )
nSRSDimensionLocFlags |= SRSDIM_LOC_POSLIST;
else if( EQUAL(papszSRSDimensionLoc[i], "GEOMETRY") )
nSRSDimensionLocFlags |= SRSDIM_LOC_GEOMETRY;
else
CPLDebug("OGR", "Unrecognized location for srsDimension : %s",
papszSRSDimensionLoc[i]);
}
CSLDestroy(papszSRSDimensionLoc);
if( !OGR2GML3GeometryAppend( (OGRGeometry *) hGeometry, NULL, &pszText,
&nLength, &nMaxLength, FALSE, bLongSRS,
bLineStringAsCurve, pszGMLId, nSRSDimensionLocFlags, FALSE ))
{
CPLFree( pszText );
return NULL;
}
else
return pszText;
}
if( !OGR2GMLGeometryAppend( (OGRGeometry *) hGeometry, &pszText,
&nLength, &nMaxLength, FALSE ))
{
CPLFree( pszText );
return NULL;
}
else
return pszText;
}
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:53,代码来源:ogr2gmlgeometry.cpp
示例4: CSLFetchNameValue
CPLString VSIOSSHandleHelper::GetSignedURL(CSLConstList papszOptions)
{
GIntBig nStartDate = static_cast<GIntBig>(time(nullptr));
const char* pszStartDate = CSLFetchNameValue(papszOptions, "START_DATE");
if( pszStartDate )
{
int nYear, nMonth, nDay, nHour, nMin, nSec;
if( sscanf(pszStartDate, "%04d%02d%02dT%02d%02d%02dZ",
&nYear, &nMonth, &nDay, &nHour, &nMin, &nSec) == 6 )
{
struct tm brokendowntime;
brokendowntime.tm_year = nYear - 1900;
brokendowntime.tm_mon = nMonth - 1;
brokendowntime.tm_mday = nDay;
brokendowntime.tm_hour = nHour;
brokendowntime.tm_min = nMin;
brokendowntime.tm_sec = nSec;
nStartDate = CPLYMDHMSToUnixTime(&brokendowntime);
}
}
GIntBig nExpiresIn = nStartDate + atoi(
CSLFetchNameValueDef(papszOptions, "EXPIRATION_DELAY", "3600"));
CPLString osExpires(CSLFetchNameValueDef(papszOptions, "EXPIRES",
CPLSPrintf(CPL_FRMT_GIB, nExpiresIn)));
CPLString osVerb(CSLFetchNameValueDef(papszOptions, "VERB", "GET"));
CPLString osCanonicalizedResource( m_osBucket.empty() ? CPLString("/") :
"/" + m_osBucket + "/" + m_osObjectKey );
CPLString osStringToSign;
osStringToSign += osVerb + "\n";
osStringToSign += "\n";
osStringToSign += "\n";
osStringToSign += osExpires + "\n";
// osStringToSign += ; // osCanonicalizedHeaders;
osStringToSign += osCanonicalizedResource;
#ifdef DEBUG_VERBOSE
CPLDebug("OSS", "osStringToSign = %s", osStringToSign.c_str());
#endif
CPLString osSignature(GetSignature(osStringToSign, m_osSecretAccessKey));
ResetQueryParameters();
// Note: https://www.alibabacloud.com/help/doc-detail/31952.htm?spm=a3c0i.o32002en.b99.294.6d70a0fc7cRJfJ is wrong on the name of the OSSAccessKeyId parameter !
AddQueryParameter("OSSAccessKeyId", m_osAccessKeyId);
AddQueryParameter("Expires", osExpires);
AddQueryParameter("Signature", osSignature);
return m_osURL;
}
开发者ID:OSGeo,项目名称:gdal,代码行数:50,代码来源:cpl_alibaba_oss.cpp
示例5: poDS_
OGRGeoJSONWriteLayer::OGRGeoJSONWriteLayer( const char* pszName,
OGRwkbGeometryType eGType,
char** papszOptions,
OGRGeoJSONDataSource* poDS )
: poDS_( poDS ), poFeatureDefn_(new OGRFeatureDefn( pszName ) ), nOutCounter_( 0 )
{
bWriteBBOX = CSLTestBoolean(CSLFetchNameValueDef(papszOptions, "WRITE_BBOX", "FALSE"));
bBBOX3D = FALSE;
poFeatureDefn_->Reference();
poFeatureDefn_->SetGeomType( eGType );
SetDescription( poFeatureDefn_->GetName() );
nCoordPrecision = atoi(CSLFetchNameValueDef(papszOptions, "COORDINATE_PRECISION", "-1"));
}
开发者ID:MattLatt,项目名称:GDAL_2.0.x_VC,代码行数:15,代码来源:ogrgeojsonwritelayer.cpp
示例6: CSLFetchNameValueDef
CPLErr GNMGenericNetwork::CheckLayerDriver(const char* pszDefaultDriverName,
char **papszOptions)
{
if(NULL == m_poLayerDriver)
{
const char* pszDriverName = CSLFetchNameValueDef(papszOptions,
GNM_MD_FORMAT,
pszDefaultDriverName);
if(!CheckStorageDriverSupport(pszDriverName))
{
CPLError( CE_Failure, CPLE_IllegalArg, "%s driver not supported as network storage",
pszDriverName );
return CE_Failure;
}
m_poLayerDriver = GetGDALDriverManager()->GetDriverByName(pszDriverName );
if(NULL == m_poLayerDriver)
{
CPLError( CE_Failure, CPLE_IllegalArg, "%s driver not available",
pszDriverName );
return CE_Failure;
}
}
return CE_None;
}
开发者ID:Mavrx-inc,项目名称:gdal,代码行数:26,代码来源:gnmgenericnetwork.cpp
示例7: GDALGeoLocRescale
static void GDALGeoLocRescale(char**& papszMD, const char* pszItem,
double dfRatio, double dfDefaultVal)
{
double dfVal = CPLAtofM(CSLFetchNameValueDef(papszMD, pszItem,
CPLSPrintf("%.18g", dfDefaultVal)));
dfVal *= dfRatio;
papszMD = CSLSetNameValue(papszMD, pszItem, CPLSPrintf("%.18g", dfVal));
}
开发者ID:drownedout,项目名称:datamap,代码行数:8,代码来源:gdalgeoloc.cpp
示例8: CSLTestBoolean
void *CPLCreateZip( const char *pszZipFilename, char **papszOptions )
{
(void) papszOptions;
int bAppend = CSLTestBoolean(CSLFetchNameValueDef(papszOptions, "APPEND", "FALSE"));
return cpl_zipOpen( pszZipFilename, bAppend ? APPEND_STATUS_ADDINZIP : APPEND_STATUS_CREATE);
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:9,代码来源:cpl_minizip_zip.cpp
示例9: CPLDebug
OGRGMELayer::OGRGMELayer(OGRGMEDataSource* poDS,
const char* pszTableName,
char ** papszOptions)
{
CPLDebug("GME", "Creating new layer %s", pszTableName);
this->poDS = poDS;
poSRS = new OGRSpatialReference(SRS_WKT_WGS84);
poFeatureDefn = NULL;
current_feature_page = NULL;
bDirty = false;
iBatchPatchSize = 50;
bCreateTablePending = true;
osTableName = pszTableName;
osProjectId = CSLFetchNameValue( papszOptions, "projectId" );
osDraftACL = CSLFetchNameValueDef( papszOptions, "draftAccessList", "Map Editors" );
osPublishedACL = CSLFetchNameValueDef( papszOptions, "publishedAccessList", "Map Viewers" );
// TODO: support tags and description
}
开发者ID:Mofangbao,项目名称:node-gdal,代码行数:19,代码来源:ogrgmelayer.cpp
示例10: CSLTestBoolean
OGRLayer * OGRJMLDataset::ICreateLayer( const char * pszLayerName,
CPL_UNUSED OGRSpatialReference *poSRS,
CPL_UNUSED OGRwkbGeometryType eType,
char ** papszOptions )
{
if (!bWriteMode || poLayer != NULL)
return NULL;
int bAddRGBField = CSLTestBoolean(
CSLFetchNameValueDef(papszOptions, "CREATE_R_G_B_FIELD", "YES"));
int bAddOGRStyleField = CSLTestBoolean(
CSLFetchNameValueDef(papszOptions, "CREATE_OGR_STYLE_FIELD", "NO"));
int bClassicGML = CSLTestBoolean(
CSLFetchNameValueDef(papszOptions, "CLASSIC_GML", "NO"));
poLayer = new OGRJMLWriterLayer( pszLayerName, this, fp,
bAddRGBField, bAddOGRStyleField,
bClassicGML);
return poLayer;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:20,代码来源:ogrjmldataset.cpp
示例11: CSLFetchNameValueDef
int GDALGeorefPamDataset::GetPAMGeorefSrcIndex()
{
if( !m_bGotPAMGeorefSrcIndex )
{
m_bGotPAMGeorefSrcIndex = true;
const char* pszGeorefSources = CSLFetchNameValueDef( papszOpenOptions,
"GEOREF_SOURCES",
CPLGetConfigOption("GDAL_GEOREF_SOURCES", "PAM,OTHER") );
char** papszTokens = CSLTokenizeString2(pszGeorefSources, ",", 0);
m_nPAMGeorefSrcIndex = CSLFindString(papszTokens, "PAM");
CSLDestroy(papszTokens);
}
return m_nPAMGeorefSrcIndex;
}
开发者ID:ryandavid,项目名称:rotobox,代码行数:14,代码来源:gdalgeorefpamdataset.cpp
示例12: poDS_
OGRGeoJSONWriteLayer::OGRGeoJSONWriteLayer( const char* pszName,
OGRwkbGeometryType eGType,
char** papszOptions,
bool bWriteFC_BBOXIn,
OGRCoordinateTransformation* poCT,
OGRGeoJSONDataSource* poDS ) :
poDS_(poDS),
poFeatureDefn_(new OGRFeatureDefn( pszName )),
nOutCounter_(0),
bWriteBBOX(CPLTestBool(
CSLFetchNameValueDef(papszOptions, "WRITE_BBOX", "FALSE"))),
bBBOX3D(false),
bWriteFC_BBOX(bWriteFC_BBOXIn),
nCoordPrecision_(atoi(
CSLFetchNameValueDef(papszOptions, "COORDINATE_PRECISION", "-1"))),
nSignificantFigures_(atoi(
CSLFetchNameValueDef(papszOptions, "SIGNIFICANT_FIGURES", "-1"))),
bRFC7946_(CPLTestBool(
CSLFetchNameValueDef(papszOptions, "RFC7946", "FALSE"))),
poCT_(poCT)
{
poFeatureDefn_->Reference();
poFeatureDefn_->SetGeomType( eGType );
SetDescription( poFeatureDefn_->GetName() );
if( bRFC7946_ && nCoordPrecision_ < 0 )
nCoordPrecision_ = 7;
oWriteOptions_.bWriteBBOX = bWriteBBOX;
oWriteOptions_.nCoordPrecision = nCoordPrecision_;
oWriteOptions_.nSignificantFigures = nSignificantFigures_;
if( bRFC7946_ )
{
oWriteOptions_.SetRFC7946Settings();
}
oWriteOptions_.SetIDOptions(papszOptions);
oWriteOptions_.bAllowNonFiniteValues = CPLTestBool(
CSLFetchNameValueDef(papszOptions, "WRITE_NON_FINITE_VALUES", "FALSE"));
}
开发者ID:OSGeo,项目名称:gdal,代码行数:37,代码来源:ogrgeojsonwritelayer.cpp
示例13: atoi
bool CPLJSONDocument::LoadUrl(const std::string & /*osUrl*/, char ** /*papszOptions*/,
GDALProgressFunc /*pfnProgress*/,
void * /*pProgressArg*/)
#endif // HAVE_CURL
{
#ifdef HAVE_CURL
int nDepth = atoi( CSLFetchNameValueDef( papszOptions, "JSON_DEPTH", "10") );
JsonContext ctx = { nullptr, json_tokener_new_ex(nDepth), 0 };
CPLHTTPFetchWriteFunc pWriteFunc = CPLJSONWriteFunction;
CPLHTTPResult *psResult = CPLHTTPFetchEx( osUrl.c_str(), papszOptions,
pfnProgress, pProgressArg,
pWriteFunc, &ctx );
bool bResult = true;
if( psResult->nStatus != 0 /*CURLE_OK*/ )
{
bResult = false;
}
CPLHTTPDestroyResult( psResult );
enum json_tokener_error jerr;
if ((jerr = json_tokener_get_error(ctx.pTokener)) != json_tokener_success) {
CPLError(CE_Failure, CPLE_AppDefined, "JSON error: %s\n",
json_tokener_error_desc(jerr));
bResult = false;
}
else {
if( m_poRootJsonObject )
json_object_put( TO_JSONOBJ(m_poRootJsonObject) );
m_poRootJsonObject = ctx.pObject;
}
json_tokener_free(ctx.pTokener);
return bResult;
#else
return false;
#endif
}
开发者ID:ksshannon,项目名称:gdal,代码行数:41,代码来源:cpl_json.cpp
示例14: CreateLL
// static function- pointer set in driver
GDALDataset *KEADataset::Create( const char * pszFilename,
int nXSize, int nYSize, int nBands,
GDALDataType eType,
char ** papszParmList )
{
H5::H5File *keaImgH5File = CreateLL( pszFilename, nXSize, nYSize, nBands,
eType, papszParmList );
if( keaImgH5File == NULL )
return NULL;
bool bThematic =
CPLTestBool(CSLFetchNameValueDef( papszParmList, "THEMATIC", "FALSE" ));
try
{
// create our dataset object
KEADataset *pDataset = new KEADataset( keaImgH5File, GA_Update );
pDataset->SetDescription( pszFilename );
// set all to thematic if asked
if( bThematic )
{
for( int nCount = 0; nCount < nBands; nCount++ )
{
GDALRasterBand *pBand = pDataset->GetRasterBand(nCount+1);
pBand->SetMetadataItem("LAYER_TYPE", "thematic");
}
}
return pDataset;
}
catch (kealib::KEAIOException &e)
{
CPLError( CE_Failure, CPLE_OpenFailed,
"Attempt to create file `%s' failed. Error: %s\n",
pszFilename, e.what() );
return NULL;
}
}
开发者ID:bbradbury,项目名称:lib_gdal,代码行数:41,代码来源:keadataset.cpp
示例15: CPLAssert
CPLVirtualMem *RawRasterBand::GetVirtualMemAuto( GDALRWFlag eRWFlag,
int *pnPixelSpace,
GIntBig *pnLineSpace,
char **papszOptions )
{
CPLAssert(pnPixelSpace);
CPLAssert(pnLineSpace);
vsi_l_offset nSize = (vsi_l_offset)(nRasterYSize - 1) * nLineOffset +
(nRasterXSize - 1) * nPixelOffset + GDALGetDataTypeSize(eDataType) / 8;
if( !bIsVSIL || VSIFGetNativeFileDescriptorL(fpRawL) == NULL ||
!CPLIsVirtualMemFileMapAvailable() || (eDataType != GDT_Byte && !bNativeOrder) ||
(size_t)nSize != nSize || nPixelOffset < 0 || nLineOffset < 0 ||
CSLTestBoolean(CSLFetchNameValueDef(papszOptions, "USE_DEFAULT_IMPLEMENTATION", "NO")) )
{
return GDALRasterBand::GetVirtualMemAuto(eRWFlag, pnPixelSpace,
pnLineSpace, papszOptions);
}
FlushCache();
CPLVirtualMem* pVMem = CPLVirtualMemFileMapNew(
fpRawL, nImgOffset, nSize,
(eRWFlag == GF_Write) ? VIRTUALMEM_READWRITE : VIRTUALMEM_READONLY,
NULL, NULL);
if( pVMem == NULL )
{
return GDALRasterBand::GetVirtualMemAuto(eRWFlag, pnPixelSpace,
pnLineSpace, papszOptions);
}
else
{
*pnPixelSpace = nPixelOffset;
*pnLineSpace = nLineOffset;
return pVMem;
}
}
开发者ID:0004c,项目名称:node-gdal,代码行数:38,代码来源:rawdataset.cpp
示例16: CPLStrdup
char *OGR_G_ExportToGMLEx( OGRGeometryH hGeometry, char** papszOptions )
{
char *pszText;
int nLength = 0, nMaxLength = 1;
if( hGeometry == NULL )
return CPLStrdup( "" );
pszText = (char *) CPLMalloc(nMaxLength);
pszText[0] = '\0';
const char* pszFormat = CSLFetchNameValue(papszOptions, "FORMAT");
if (pszFormat && EQUAL(pszFormat, "GML3"))
{
const char* pszLineStringElement = CSLFetchNameValue(papszOptions, "GML3_LINESTRING_ELEMENT");
int bLineStringAsCurve = (pszLineStringElement && EQUAL(pszLineStringElement, "curve"));
int bLongSRS = CSLTestBoolean(CSLFetchNameValueDef(papszOptions, "GML3_LONGSRS", "YES"));
const char* pszGMLId = CSLFetchNameValue(papszOptions, "GMLID");
if( !OGR2GML3GeometryAppend( (OGRGeometry *) hGeometry, NULL, &pszText,
&nLength, &nMaxLength, FALSE, bLongSRS, bLineStringAsCurve, pszGMLId ))
{
CPLFree( pszText );
return NULL;
}
else
return pszText;
}
if( !OGR2GMLGeometryAppend( (OGRGeometry *) hGeometry, &pszText,
&nLength, &nMaxLength, FALSE ))
{
CPLFree( pszText );
return NULL;
}
else
return pszText;
}
开发者ID:Joe-xXx,项目名称:gdal,代码行数:38,代码来源:ogr2gmlgeometry.cpp
示例17: OGR_G_ExportToJsonEx
char* OGR_G_ExportToJsonEx( OGRGeometryH hGeometry, char** papszOptions )
{
VALIDATE_POINTER1( hGeometry, "OGR_G_ExportToJson", NULL );
OGRGeometry* poGeometry = (OGRGeometry*) (hGeometry);
int nCoordPrecision = atoi(CSLFetchNameValueDef(papszOptions, "COORDINATE_PRECISION", "-1"));
json_object* poObj = NULL;
poObj = OGRGeoJSONWriteGeometry( poGeometry, nCoordPrecision );
if( NULL != poObj )
{
char* pszJson = CPLStrdup( json_object_to_json_string( poObj ) );
/* Release JSON tree. */
json_object_put( poObj );
return pszJson;
}
/* Translation failed */
return NULL;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:24,代码来源:ogrgeojsonwriter.cpp
示例18: CPL_TO_BOOL
int OGRAmigoCloudDataSource::Open( const char * pszFilename,
char** papszOpenOptionsIn,
int bUpdateIn )
{
bReadWrite = CPL_TO_BOOL(bUpdateIn);
pszName = CPLStrdup( pszFilename );
if( CSLFetchNameValue(papszOpenOptionsIn, "PROJECTID") )
pszProjetctId = CPLStrdup(CSLFetchNameValue(papszOpenOptionsIn, "PROJECTID"));
else
{
pszProjetctId = CPLStrdup(pszFilename + strlen("AMIGOCLOUD:"));
char* pchSpace = strchr(pszProjetctId, ' ');
if( pchSpace )
*pchSpace = '\0';
if( pszProjetctId[0] == 0 )
{
CPLError(CE_Failure, CPLE_AppDefined, "Missing projetc id");
return FALSE;
}
}
osAPIKey = CSLFetchNameValueDef(papszOpenOptionsIn, "API_KEY",
CPLGetConfigOption("AMIGOCLOUD_API_KEY", ""));
CPLString osDatasets = OGRAMIGOCLOUDGetOptionValue(pszFilename, "datasets");
bUseHTTPS = CPLTestBool(CPLGetConfigOption("AMIGOCLOUD_HTTPS", "YES"));
OGRLayer* poSchemaLayer = ExecuteSQLInternal("SELECT current_schema()");
if( poSchemaLayer )
{
OGRFeature* poFeat = poSchemaLayer->GetNextFeature();
if( poFeat )
{
if( poFeat->GetFieldCount() == 1 )
{
osCurrentSchema = poFeat->GetFieldAsString(0);
}
delete poFeat;
}
ReleaseResultSet(poSchemaLayer);
}
if( osCurrentSchema.size() == 0 )
return FALSE;
if (osDatasets.size() != 0)
{
char** papszTables = CSLTokenizeString2(osDatasets, ",", 0);
for(int i=0;papszTables && papszTables[i];i++)
{
papoLayers = (OGRAmigoCloudTableLayer**) CPLRealloc(
papoLayers, (nLayers + 1) * sizeof(OGRAmigoCloudTableLayer*));
papoLayers[nLayers ++] = new OGRAmigoCloudTableLayer(this, papszTables[i]);
}
CSLDestroy(papszTables);
return TRUE;
}
return TRUE;
}
开发者ID:ryandavid,项目名称:rotobox,代码行数:63,代码来源:ogramigoclouddatasource.cpp
示例19: CPLError
GDALDataset *
WEBPDataset::CreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
int bStrict, char ** papszOptions,
GDALProgressFunc pfnProgress, void * pProgressData )
{
int nBands = poSrcDS->GetRasterCount();
int nXSize = poSrcDS->GetRasterXSize();
int nYSize = poSrcDS->GetRasterYSize();
/* -------------------------------------------------------------------- */
/* WEBP library initialization */
/* -------------------------------------------------------------------- */
WebPPicture sPicture;
if (!WebPPictureInit(&sPicture))
{
CPLError(CE_Failure, CPLE_AppDefined, "WebPPictureInit() failed");
return NULL;
}
/* -------------------------------------------------------------------- */
/* Some some rudimentary checks */
/* -------------------------------------------------------------------- */
if( nXSize > 16383 || nYSize > 16383 )
{
CPLError( CE_Failure, CPLE_NotSupported,
"WEBP maximum image dimensions are 16383 x 16383.");
return NULL;
}
if( nBands != 3
#if WEBP_ENCODER_ABI_VERSION >= 0x0100
&& nBands != 4
#endif
)
{
CPLError( CE_Failure, CPLE_NotSupported,
"WEBP driver doesn't support %d bands. Must be 3 (RGB) "
#if WEBP_ENCODER_ABI_VERSION >= 0x0100
"or 4 (RGBA) "
#endif
"bands.",
nBands );
return NULL;
}
GDALDataType eDT = poSrcDS->GetRasterBand(1)->GetRasterDataType();
if( eDT != GDT_Byte )
{
CPLError( (bStrict) ? CE_Failure : CE_Warning, CPLE_NotSupported,
"WEBP driver doesn't support data type %s. "
"Only eight bit byte bands supported.",
GDALGetDataTypeName(
poSrcDS->GetRasterBand(1)->GetRasterDataType()) );
if (bStrict)
return NULL;
}
/* -------------------------------------------------------------------- */
/* What options has the user selected? */
/* -------------------------------------------------------------------- */
float fQuality = 75.0f;
const char* pszQUALITY = CSLFetchNameValue(papszOptions, "QUALITY");
if( pszQUALITY != NULL )
{
fQuality = (float) CPLAtof(pszQUALITY);
if( fQuality < 0.0f || fQuality > 100.0f )
{
CPLError( CE_Failure, CPLE_IllegalArg,
"%s=%s is not a legal value.", "QUALITY", pszQUALITY);
return NULL;
}
}
WebPPreset nPreset = WEBP_PRESET_DEFAULT;
const char* pszPRESET = CSLFetchNameValueDef(papszOptions, "PRESET", "DEFAULT");
if (EQUAL(pszPRESET, "DEFAULT"))
nPreset = WEBP_PRESET_DEFAULT;
else if (EQUAL(pszPRESET, "PICTURE"))
nPreset = WEBP_PRESET_PICTURE;
else if (EQUAL(pszPRESET, "PHOTO"))
nPreset = WEBP_PRESET_PHOTO;
else if (EQUAL(pszPRESET, "PICTURE"))
nPreset = WEBP_PRESET_PICTURE;
else if (EQUAL(pszPRESET, "DRAWING"))
nPreset = WEBP_PRESET_DRAWING;
else if (EQUAL(pszPRESET, "ICON"))
nPreset = WEBP_PRESET_ICON;
else if (EQUAL(pszPRESET, "TEXT"))
nPreset = WEBP_PRESET_TEXT;
else
{
CPLError( CE_Failure, CPLE_IllegalArg,
"%s=%s is not a legal value.", "PRESET", pszPRESET );
//.........这里部分代码省略.........
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:101,代码来源:webpdataset.cpp
示例20: VSIFOpenL
int OGRCSVDataSource::OpenTable( const char * pszFilename,
char** papszOpenOptions,
const char* pszNfdcRunwaysGeomField,
const char* pszGeonamesGeomFieldPrefix)
{
/* -------------------------------------------------------------------- */
/* Open the file. */
/* -------------------------------------------------------------------- */
VSILFILE * fp;
if( bUpdate )
fp = VSIFOpenL( pszFilename, "rb+" );
else
fp = VSIFOpenL( pszFilename, "rb" );
if( fp == NULL )
{
CPLError( CE_Warning, CPLE_OpenFailed,
"Failed to open %s, %s.",
pszFilename, VSIStrerror( errno ) );
return FALSE;
}
if( !bUpdate && strstr(pszFilename, "/vsigzip/") == NULL &&
strstr(pszFilename, "/vsizip/") == NULL )
fp = (VSILFILE*) VSICreateBufferedReaderHandle((VSIVirtualHandle*)fp);
CPLString osLayerName = CPLGetBasename(pszFilename);
CPLString osExt = CPLGetExtension(pszFilename);
if( strncmp(pszFilename, "/vsigzip/", 9) == 0 && EQUAL(osExt, "gz") )
{
if( strlen(pszFilename) > 7 && EQUAL(pszFilename + strlen(pszFilename) - 7, ".csv.gz") )
{
osLayerName = osLayerName.substr(0, osLayerName.size() - 4);
osExt = "csv";
}
else if( strlen(pszFilename) > 7 && EQUAL(pszFilename + strlen(pszFilename) - 7, ".tsv.gz") )
{
osLayerName = osLayerName.substr(0, osLayerName.size() - 4);
osExt = "tsv";
}
}
/* -------------------------------------------------------------------- */
/* Read and parse a line. Did we get multiple fields? */
/* -------------------------------------------------------------------- */
const char* pszLine = CPLReadLineL( fp );
if (pszLine == NULL)
{
VSIFCloseL( fp );
return FALSE;
}
char chDelimiter = CSVDetectSeperator(pszLine);
if( chDelimiter != '\t' && strchr(pszLine, '\t') != NULL )
{
/* Force the delimiter to be TAB for a .tsv file that has a tabulation */
/* in its first line */
if( EQUAL(osExt, "tsv") )
{
chDelimiter = '\t';
}
else
{
for(int bDontHonourStrings=0; bDontHonourStrings<=1; bDontHonourStrings++)
{
// Read the first 2 lines to see if they have the same number of fields, if using tabulation
VSIRewindL( fp );
char** papszTokens = OGRCSVReadParseLineL( fp, '\t', bDontHonourStrings );
int nTokens1 = CSLCount(papszTokens);
CSLDestroy(papszTokens);
papszTokens = OGRCSVReadParseLineL( fp, '\t', bDontHonourStrings );
int nTokens2 = CSLCount(papszTokens);
CSLDestroy(papszTokens);
if( nTokens1 >= 2 && nTokens1 == nTokens2 )
{
chDelimiter = '\t';
break;
}
}
}
}
VSIRewindL( fp );
#if 0
const char *pszDelimiter = CSLFetchNameValueDef( papszOpenOptions, "SEPARATOR", "AUTO");
if( !EQUAL(pszDelimiter, "AUTO") )
{
if (EQUAL(pszDelimiter, "COMMA"))
chDelimiter = ',';
else if (EQUAL(pszDelimiter, "SEMICOLON"))
chDelimiter = ';';
else if (EQUAL(pszDelimiter, "TAB"))
chDelimiter = '\t';
else if (EQUAL(pszDelimiter, "SPACE"))
chDelimiter = ' ';
else
{
CPLError( CE_Warning, CPLE_AppDefined,
//.........这里部分代码省略.........
开发者ID:MattLatt,项目名称:GDAL_2.0.x_VC,代码行数:101,代码来源:ogrcsvdatasource.cpp
注:本文中的CSLFetchNameValueDef函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论