当前位置: 首页>>代码示例>>C++>>正文


C++ CSLFetchNameValueDef函数代码示例

本文整理汇总了C++中CSLFetchNameValueDef函数的典型用法代码示例。如果您正苦于以下问题:C++ CSLFetchNameValueDef函数的具体用法?C++ CSLFetchNameValueDef怎么用?C++ CSLFetchNameValueDef使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CSLFetchNameValueDef函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的CSLFetchNameValueDef函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。