您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CSLDuplicate函数代码示例

51自学网 2021-06-01 20:06:13
  C++
这篇教程C++ CSLDuplicate函数代码示例写得很实用,希望能帮到您。

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

在下文中一共展示了CSLDuplicate函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: CSLDuplicate

HDF5ImageRasterBand::HDF5ImageRasterBand( HDF5ImageDataset *poDS, int nBand,                                          GDALDataType eType ){    char          **papszMetaGlobal;    this->poDS    = poDS;    this->nBand   = nBand;    eDataType     = eType;    bNoDataSet    = FALSE;    dfNoDataValue = -9999;    nBlockXSize   = poDS->GetRasterXSize( );    nBlockYSize   = 1;/* -------------------------------------------------------------------- *//*      Take a copy of Global Metadata since  I can't pass Raster       *//*      variable to Iterate function.                                   *//* -------------------------------------------------------------------- */    papszMetaGlobal = CSLDuplicate( poDS->papszMetadata );    CSLDestroy( poDS->papszMetadata );    poDS->papszMetadata = NULL;    if( poDS->poH5Objects->nType == H5G_DATASET ) {        poDS->CreateMetadata( poDS->poH5Objects, H5G_DATASET );    }/* -------------------------------------------------------------------- *//*      Recover Global Metadat and set Band Metadata                    *//* -------------------------------------------------------------------- */    SetMetadata( poDS->papszMetadata );    CSLDestroy( poDS->papszMetadata );    poDS->papszMetadata = CSLDuplicate( papszMetaGlobal );    CSLDestroy( papszMetaGlobal );    /* check for chunksize and set it as the blocksize (optimizes read) */    hid_t listid = H5Dget_create_plist(((HDF5ImageDataset * )poDS)->dataset_id);    if (listid>0)    {        if(H5Pget_layout(listid) == H5D_CHUNKED)        {            hsize_t panChunkDims[3];            int nDimSize = H5Pget_chunk(listid, 3, panChunkDims);            nBlockXSize   = (int) panChunkDims[nDimSize-1];            nBlockYSize   = (int) panChunkDims[nDimSize-2];        }        H5Pclose(listid);    }}
开发者ID:afarnham,项目名称:gdal,代码行数:50,


示例2: bNoDataSet

HDF5ImageRasterBand::HDF5ImageRasterBand( HDF5ImageDataset *poDSIn, int nBandIn,                                          GDALDataType eType ) :    bNoDataSet(false),    dfNoDataValue(-9999.0){    poDS = poDSIn;    nBand = nBandIn;    eDataType     = eType;    nBlockXSize   = poDS->GetRasterXSize( );    nBlockYSize   = 1;/* -------------------------------------------------------------------- *//*      Take a copy of Global Metadata since  I can't pass Raster       *//*      variable to Iterate function.                                   *//* -------------------------------------------------------------------- */    char **papszMetaGlobal = CSLDuplicate( poDSIn->papszMetadata );    CSLDestroy( poDSIn->papszMetadata );    poDSIn->papszMetadata = NULL;    if( poDSIn->poH5Objects->nType == H5G_DATASET ) {        poDSIn->CreateMetadata( poDSIn->poH5Objects, H5G_DATASET );    }/* -------------------------------------------------------------------- *//*      Recover Global Metadata and set Band Metadata                   *//* -------------------------------------------------------------------- */    SetMetadata( poDSIn->papszMetadata );    CSLDestroy( poDSIn->papszMetadata );    poDSIn->papszMetadata = CSLDuplicate( papszMetaGlobal );    CSLDestroy( papszMetaGlobal );    /* check for chunksize and set it as the blocksize (optimizes read) */    const hid_t listid = H5Dget_create_plist(poDSIn->dataset_id);    if (listid>0)    {        if(H5Pget_layout(listid) == H5D_CHUNKED)        {            hsize_t panChunkDims[3] = {0, 0, 0};            const int nDimSize = H5Pget_chunk(listid, 3, panChunkDims);            CPL_IGNORE_RET_VAL(nDimSize);            CPLAssert(nDimSize == poDSIn->ndims);            nBlockXSize   = (int) panChunkDims[poDSIn->GetXIndex()];            nBlockYSize   = (int) panChunkDims[poDSIn->GetYIndex()];        }        H5Pclose(listid);    }}
开发者ID:nextgis-borsch,项目名称:lib_gdal,代码行数:50,


示例3: RGDAL_GetCategoryNames

SEXPRGDAL_GetCategoryNames(SEXP sxpRasterBand) {  GDALRasterBand *pRasterBand = getGDALRasterPtr(sxpRasterBand);  char **pcCNames = pRasterBand->GetCategoryNames();  if (pcCNames == NULL) return(R_NilValue);  pcCNames = CSLDuplicate(pcCNames);  SEXP sxpCNames;  PROTECT(sxpCNames = allocVector(STRSXP, CSLCount(pcCNames)));  int i;  for (i = 0; i < CSLCount(pcCNames); ++i) {    const char *field = CSLGetField(pcCNames, i);    SET_VECTOR_ELT(sxpCNames, i, mkChar(field));  }  UNPROTECT(1);    return(sxpCNames);}
开发者ID:jeroenooms,项目名称:rgdal,代码行数:29,


示例4: CSLFindString

CPLErr GDALMultiDomainMetadata::SetMetadata( char **papszMetadata,                                              const char *pszDomain ){    if( pszDomain == NULL )        pszDomain = "";    int iDomain = CSLFindString( papszDomainList, pszDomain );    if( iDomain == -1 )    {        int nDomainCount;        papszDomainList = CSLAddString( papszDomainList, pszDomain );        nDomainCount = CSLCount( papszDomainList );        papoMetadataLists = (CPLStringList **)             CPLRealloc( papoMetadataLists, sizeof(void*)*(nDomainCount+1) );        papoMetadataLists[nDomainCount] = NULL;        papoMetadataLists[nDomainCount-1] = new CPLStringList();        iDomain = nDomainCount-1;    }    papoMetadataLists[iDomain]->Assign( CSLDuplicate( papszMetadata ) );    // we want to mark name/value pair domains as being sorted for fast    // access.    if( !EQUALN(pszDomain,"xml:",4) && !EQUAL(pszDomain, "SUBDATASETS") )        papoMetadataLists[iDomain]->Sort();    return CE_None;}
开发者ID:drownedout,项目名称:datamap,代码行数:32,


示例5: CPLHTTPInitializeRequest

void CPLHTTPInitializeRequest(CPLHTTPRequest *psRequest, const char *pszURL, const char *const *papszOptions) {    psRequest->pszURL = CPLStrdup(pszURL);    psRequest->papszOptions = CSLDuplicate(const_cast<char **>(papszOptions));    psRequest->nStatus = 0;    psRequest->pszContentType = 0;    psRequest->pszError = 0;    psRequest->pabyData = 0;    psRequest->nDataLen = 0;    psRequest->nDataAlloc = 0;    psRequest->m_curl_handle = 0;    psRequest->m_headers = 0;    psRequest->m_curl_error = 0;    psRequest->m_curl_handle = curl_easy_init();    if (psRequest->m_curl_handle == NULL) {        CPLError(CE_Fatal, CPLE_AppDefined, "CPLHTTPInitializeRequest(): Unable to create CURL handle.");    }    char** papszOptionsDup = CSLDuplicate(const_cast<char **>(psRequest->papszOptions));    /* Set User-Agent */    const char *pszUserAgent = CSLFetchNameValue(papszOptionsDup, "USERAGENT");    if (pszUserAgent == NULL)        papszOptionsDup = CSLAddNameValue(papszOptionsDup, "USERAGENT",                                          "GDAL WMS driver (http://www.gdal.org/frmt_wms.html)");    /* Set URL */    curl_easy_setopt(psRequest->m_curl_handle, CURLOPT_URL, psRequest->pszURL);    /* Set Headers (copied&pasted from cpl_http.cpp, but unused by callers of CPLHTTPInitializeRequest) .*/    const char *headers = CSLFetchNameValue(const_cast<char **>(psRequest->papszOptions), "HEADERS");    if (headers != NULL) {        psRequest->m_headers = curl_slist_append(psRequest->m_headers, headers);        curl_easy_setopt(psRequest->m_curl_handle, CURLOPT_HTTPHEADER, psRequest->m_headers);    }    curl_easy_setopt(psRequest->m_curl_handle, CURLOPT_WRITEDATA, psRequest);    curl_easy_setopt(psRequest->m_curl_handle, CURLOPT_WRITEFUNCTION, CPLHTTPWriteFunc);    psRequest->m_curl_error = reinterpret_cast<char *>(CPLMalloc(CURL_ERROR_SIZE + 1));    psRequest->m_curl_error[0] = '/0';    curl_easy_setopt(psRequest->m_curl_handle, CURLOPT_ERRORBUFFER, psRequest->m_curl_error);        CPLHTTPSetOptions(psRequest->m_curl_handle, papszOptionsDup);    CSLDestroy(papszOptionsDup);}
开发者ID:0004c,项目名称:node-gdal,代码行数:47,


示例6: CSLDestroy

CPLErr RawRasterBand::SetCategoryNames( char ** papszNewNames ){    CSLDestroy( papszCategoryNames );    papszCategoryNames = CSLDuplicate( papszNewNames );    return CE_None;}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:8,


示例7: CSLDuplicate

OGRWritableDWGLayer::OGRWritableDWGLayer( const char *pszLayerName,                                          char **papszOptionsIn,                                           OGRWritableDWGDataSource *poDSIn ){    poDS = poDSIn;    papszOptions = CSLDuplicate( papszOptionsIn );    pDb = poDS->pDb;/* -------------------------------------------------------------------- *//*      Create the DWGdirect layer object.                              *//* -------------------------------------------------------------------- */    // Add a new layer to the drawing    OdDbLayerTablePtr pLayers;    OdDbLayerTableRecordPtr pLayer;    pLayers = pDb->getLayerTableId().safeOpenObject(OdDb::kForWrite);    pLayer = OdDbLayerTableRecord::createObject();        // Name must be set before a table object is added to a table.    pLayer->setName( pszLayerName );        // Add the object to the table.    hLayerId = pLayers->add(pLayer);/* -------------------------------------------------------------------- *//*      Check for a layer color.                                        *//* -------------------------------------------------------------------- */    const char *pszColor = CSLFetchNameValue(papszOptionsIn,"COLOR");    if( pszColor != NULL )    {        char **papszTokens =             CSLTokenizeStringComplex( pszColor, ",", FALSE, FALSE );                if( CSLCount( papszTokens ) != 3 )        {            CPLError( CE_Warning, CPLE_AppDefined,                       "COLOR=%s setting not parsable.  Should be 'red,green,blue'.",                       pszColor );        }        else        {            OdCmColor oColor;            oColor.setRGB( atoi(papszTokens[0]),                            atoi(papszTokens[1]),                            atoi(papszTokens[2]) );            pLayer->setColor( oColor );        }    }/* -------------------------------------------------------------------- *//*      Create the starting OGRFeatureDefn.                             *//* -------------------------------------------------------------------- */    poFeatureDefn = new OGRFeatureDefn( pszLayerName );    poFeatureDefn->Reference();}
开发者ID:h4ck3rm1k3,项目名称:gdal_dxfdwg_no_oda,代码行数:58,


示例8: CSLDuplicate

int OGRDGNDataSource::PreCreate( const char *pszFilename,                                  char **papszOptions ){    this->papszOptions = CSLDuplicate( papszOptions );    pszName = CPLStrdup( pszFilename );    return TRUE;}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:9,


示例9: CSLDestroy

CPLErr VRTRasterBand::SetCategoryNames( char ** papszNewNames ){    reinterpret_cast<VRTDataset *>( poDS )->SetNeedsFlush();    CSLDestroy( m_papszCategoryNames );    m_papszCategoryNames = CSLDuplicate( papszNewNames );    return CE_None;}
开发者ID:Mavrx-inc,项目名称:gdal,代码行数:10,


示例10: CSLDestroy

CPLErr GDALGeorefPamDataset::SetMetadata( char ** papszMetadata,                                           const char * pszDomain ){    if( m_bPAMLoaded && (pszDomain == NULL || EQUAL(pszDomain, "")) )    {        CSLDestroy(m_papszMainMD);        m_papszMainMD = CSLDuplicate(papszMetadata);    }    return GDALPamDataset::SetMetadata(papszMetadata, pszDomain);}
开发者ID:ryandavid,项目名称:rotobox,代码行数:10,


示例11: CSLDestroy

CPLErr VRTRasterBand::SetCategoryNames( char ** papszNewNames ){    ((VRTDataset *) poDS)->SetNeedsFlush();    CSLDestroy( papszCategoryNames );    papszCategoryNames = CSLDuplicate( papszNewNames );    return CE_None;}
开发者ID:Joe-xXx,项目名称:gdal,代码行数:10,


示例12: CSLDestroy

OGRErr OGRUnionLayer::SetIgnoredFields( const char **papszFields ){    OGRErr eErr = OGRLayer::SetIgnoredFields(papszFields);    if( eErr != OGRERR_NONE )        return eErr;    CSLDestroy(papszIgnoredFields);    papszIgnoredFields = papszFields ? CSLDuplicate((char**)papszFields) : NULL;    return eErr;}
开发者ID:bbradbury,项目名称:lib_gdal,代码行数:11,


示例13: CSLDestroy

CPLErr VRTDriver::SetMetadata( char **papszMetadata, const char *pszDomain ){    if( pszDomain && EQUAL(pszDomain,"SourceParsers") )    {        CSLDestroy( papszSourceParsers );        papszSourceParsers = CSLDuplicate( papszMetadata );        return CE_None;    }    return GDALDriver::SetMetadata( papszMetadata, pszDomain );}
开发者ID:bbradbury,项目名称:lib_gdal,代码行数:12,


示例14: msContourLayerWhichShapes

int msContourLayerWhichShapes(layerObj *layer, rectObj rect, int isQuery){  rectObj newRect;  contourLayerInfo *clinfo = (contourLayerInfo *) layer->layerinfo;  if (layer->debug)    msDebug("Entering msContourLayerWhichShapes()./n");  if (clinfo == NULL) {    msSetError(MS_MISCERR, "Assertion failed: Contour layer not opened!!!",               "msContourLayerWhichShapes()");    return MS_FAILURE;  }  newRect = rect;  #ifdef USE_PROJ    /* if necessary, project the searchrect to source coords */    if (msProjectionsDiffer( &(layer->map->projection), &(layer->projection)))  {      if (msProjectRect(&layer->projection, &layer->map->projection, &newRect)          != MS_SUCCESS ) {        msDebug("msContourLayerWhichShapes(%s): unable to reproject map request rectangle into layer projection, canceling./n", layer->name);        return MS_FAILURE;      }    }#endif  /* regenerate the raster io */  msConnPoolRelease(&clinfo->ogrLayer, clinfo->hOGRDS);  msLayerClose(&clinfo->ogrLayer);    /* Open the raster source */  if (msContourLayerReadRaster(layer, newRect) != MS_SUCCESS)    return MS_FAILURE;  /* Generate Contour Dataset */  if (msContourLayerGenerateContour(layer) != MS_SUCCESS)    return MS_FAILURE;  GDALClose(clinfo->hDS);  clinfo->hDS = NULL;  free(clinfo->buffer);      /* Open our virtual ogr layer */  if (msLayerOpen(&clinfo->ogrLayer) != MS_SUCCESS)    return MS_FAILURE;  clinfo->ogrLayer.numitems = layer->numitems;  clinfo->ogrLayer.items = CSLDuplicate(layer->items);   return msLayerWhichShapes(&clinfo->ogrLayer, rect, isQuery);}
开发者ID:abolfazl-esmaeeli,项目名称:mapserver,代码行数:52,


示例15: PamInitialize

CPLErr GDALPamRasterBand::SetCategoryNames( char ** papszNewNames ){    PamInitialize();    if( !psPam )        return GDALRasterBand::SetCategoryNames( papszNewNames );    CSLDestroy( psPam->papszCategoryNames );    psPam->papszCategoryNames = CSLDuplicate( papszNewNames );    psPam->poParentDS->MarkPamDirty();    return CE_None;}
开发者ID:ksshannon,项目名称:gdal,代码行数:13,


示例16: while

// set the metdata as a CSLStringListCPLErr KEARasterBand::SetMetadata(char **papszMetadata, const char *pszDomain){    // only deal with 'default' domain - no geolocation etc    if( ( pszDomain != NULL ) && ( *pszDomain != '/0' ) )        return CE_Failure;    int nIndex = 0;    char *pszName;    const char *pszValue;    try    {        // iterate through each one        while( papszMetadata[nIndex] != NULL )        {            pszName = NULL;            pszValue = CPLParseNameValue( papszMetadata[nIndex], &pszName );            if( pszValue == NULL )                pszValue = "";            if( pszName != NULL )            {                // it is LAYER_TYPE? if so handle seperately                if( EQUAL( pszName, "LAYER_TYPE" ) )                {                    if( EQUAL( pszValue, "athematic" ) )                    {                        this->m_pImageIO->setImageBandLayerType(this->nBand, kealib::kea_continuous );                    }                    else                    {                        this->m_pImageIO->setImageBandLayerType(this->nBand, kealib::kea_thematic );                    }                }                else                {                    // write it into the image                    this->m_pImageIO->setImageBandMetaData(this->nBand, pszName, pszValue );                }                CPLFree(pszName);            }            nIndex++;        }    }    catch (kealib::KEAIOException &e)    {        return CE_Failure;    }    // destroy our list and duplicate the one passed in    // and use that as our list from now on    CSLDestroy(m_papszMetadataList);    m_papszMetadataList = CSLDuplicate(papszMetadata);    return CE_None;}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:52,


示例17: CPLDebug

GDALOverviewDataset::GDALOverviewDataset(GDALDataset* poMainDS,        int nOvrLevel,        int bThisLevelOnly,        int bOwnDS){    this->poMainDS = poMainDS;    this->nOvrLevel = nOvrLevel;    this->bOwnDS = bOwnDS;    this->bThisLevelOnly = bThisLevelOnly;    eAccess = poMainDS->GetAccess();    nRasterXSize = poMainDS->GetRasterBand(1)->GetOverview(nOvrLevel)->GetXSize();    nRasterYSize = poMainDS->GetRasterBand(1)->GetOverview(nOvrLevel)->GetYSize();    poOvrDS = poMainDS->GetRasterBand(1)->GetOverview(nOvrLevel)->GetDataset();    if( poOvrDS != NULL && poOvrDS == poMainDS )    {        CPLDebug("GDAL", "Dataset of overview is the same as the main band. This is not expected");        poOvrDS = NULL;    }    nBands = poMainDS->GetRasterCount();    for(int i=0; i<nBands; i++)    {        SetBand(i+1, new GDALOverviewBand(this, i+1));    }    nGCPCount = 0;    pasGCPList = NULL;    papszMD_RPC = NULL;    papszMD_GEOLOCATION = NULL;    /* We create a fake driver that has the same name as the original */    /* one, but we cannot use the real driver object, so that code */    /* doesn't try to cast the GDALOverviewDataset* as a native dataset */    /* object */    if( poMainDS->GetDriver() != NULL )    {        poDriver = new GDALDriver();        poDriver->SetDescription(poMainDS->GetDriver()->GetDescription());        poDriver->SetMetadata(poMainDS->GetDriver()->GetMetadata());    }    SetDescription( poMainDS->GetDescription() );    CPLDebug( "GDAL", "GDALOverviewDataset(%s, this=%p) creation.",              poMainDS->GetDescription(), this );    papszOpenOptions = CSLDuplicate(poMainDS->GetOpenOptions());    /* Add OVERVIEW_LEVEL if not called from GDALOpenEx() but directly */    papszOpenOptions = CSLSetNameValue(papszOpenOptions, "OVERVIEW_LEVEL",                                       CPLSPrintf("%d", nOvrLevel));}
开发者ID:garnertb,项目名称:gdal,代码行数:49,


示例18: OGRSpatialReference

OGRS57DataSource::OGRS57DataSource(char** papszOpenOptions){    nLayers = 0;    papoLayers = NULL;    nModules = 0;    papoModules = NULL;    poClassContentExplorer = NULL;    poWriter = NULL;    pszName = NULL;    poSpatialRef = new OGRSpatialReference();    poSpatialRef->SetWellKnownGeogCS( "WGS84" );        bExtentsSet = FALSE;/* -------------------------------------------------------------------- *//*      Allow initialization of options from the environment.           *//* -------------------------------------------------------------------- */    if( papszOpenOptions != NULL )    {        papszOptions = CSLDuplicate(papszOpenOptions);    }    else    {        const char *pszOptString = CPLGetConfigOption( "OGR_S57_OPTIONS", NULL );        papszOptions = NULL;        if ( pszOptString )        {            char    **papszCurOption;            papszOptions =                 CSLTokenizeStringComplex( pszOptString, ",", FALSE, FALSE );            if ( papszOptions && *papszOptions )            {                CPLDebug( "S57", "The following S57 options are being set:" );                papszCurOption = papszOptions;                while( *papszCurOption )                    CPLDebug( "S57", "    %s", *papszCurOption++ );            }        }    }}
开发者ID:drownedout,项目名称:datamap,代码行数:48,


示例19: RGDAL_GetMetadata

SEXPRGDAL_GetMetadata(SEXP sxpObj, SEXP sxpDomain) {  void *pGDALObj = getGDALObjPtr(sxpObj);  const char *domain = asString(sxpDomain);  char **metadata = ((GDALMajorObject *)pGDALObj)->GetMetadata(domain);  if (metadata == NULL) return(R_NilValue);  metadata = CSLDuplicate(metadata);  SEXP sxpMetadata, sxpNames;  PROTECT(sxpMetadata = allocVector(VECSXP, CSLCount(metadata)));  PROTECT(sxpNames = allocVector(STRSXP, CSLCount(metadata)));    int i;  for (i = 0; i < CSLCount(metadata); ++i) {    const char *field = CSLGetField(metadata, i);    char *tag = NULL;    const char *value = CPLParseNameValue(field, &tag);    SET_VECTOR_ELT(sxpMetadata, i, value ? mkChar(value) : mkChar(""));    SET_STRING_ELT(sxpNames, i, tag ? mkChar(tag) : mkChar(""));  }  setAttrib(sxpMetadata, R_NamesSymbol, sxpNames);  UNPROTECT(2);  return(sxpMetadata);}
开发者ID:jeroenooms,项目名称:rgdal,代码行数:41,


示例20: CPLError

GDALDataset* PDFWritableVectorDataset::Create( const char * pszName,                                               CPL_UNUSED int nXSize,                                               CPL_UNUSED int nYSize,                                               int nBands,                                               CPL_UNUSED GDALDataType eType,                                               char ** papszOptions ){    if( nBands != 0 )    {        CPLError(CE_Failure, CPLE_AppDefined,                 "PDFWritableVectorDataset::Create() can only be called with "                 "nBands = 0 to create a vector-only PDF");        return NULL;    }    PDFWritableVectorDataset* poDataset = new PDFWritableVectorDataset();    poDataset->SetDescription(pszName);    poDataset->papszOptions = CSLDuplicate(papszOptions);    return poDataset;}
开发者ID:drownedout,项目名称:datamap,代码行数:21,


示例21: while

// set the whole metadata as a CSLStringListCPLErr KEADataset::SetMetadata(char **papszMetadata, const char *pszDomain){    // only deal with 'default' domain - no geolocation etc    if( ( pszDomain != NULL ) && ( *pszDomain != '/0' ) )        return CE_Failure;    int nIndex = 0;    char *pszName;    const char *pszValue;    try    {        // go through each item        while( papszMetadata[nIndex] != NULL )        {            // get the value/name            pszName = NULL;            pszValue = CPLParseNameValue( papszMetadata[nIndex], &pszName );            if( pszValue == NULL )                pszValue = "";            if( pszName != NULL )            {                // set it with imageio                this->m_pImageIO->setImageMetaData(pszName, pszValue );                CPLFree(pszName);            }            nIndex++;        }    }    catch (kealib::KEAIOException &e)    {        CPLError( CE_Failure, CPLE_AppDefined,                "Unable to write metadata: %s", e.what() );        return CE_Failure;    }    // destroy our one and replace it    CSLDestroy(m_papszMetadataList);    m_papszMetadataList = CSLDuplicate(papszMetadata);    return CE_None;}
开发者ID:drownedout,项目名称:datamap,代码行数:41,


示例22: GDALClose

void GDALDefaultOverviews::Initialize( GDALDataset *poDSIn,                                       const char * pszBasename,                                       char **papszSiblingFiles,                                       int bNameIsOVR ){    poDS = poDSIn;/* -------------------------------------------------------------------- *//*      If we were already initialized, destroy the old overview        *//*      file handle.                                                    *//* -------------------------------------------------------------------- */    if( poODS != NULL )    {        GDALClose( poODS );        poODS = NULL;        CPLDebug(            "GDAL",            "GDALDefaultOverviews::Initialize() called twice - "            "this is odd and perhaps dangerous!" );    }/* -------------------------------------------------------------------- *//*      Store the initialization information for later use in           *//*      OverviewScan()                                                  *//* -------------------------------------------------------------------- */    bCheckedForOverviews = FALSE;    CPLFree( pszInitName );    pszInitName = NULL;    if( pszBasename != NULL )        pszInitName = CPLStrdup(pszBasename);    bInitNameIsOVR = CPL_TO_BOOL(bNameIsOVR);    CSLDestroy( papszInitSiblingFiles );    papszInitSiblingFiles = NULL;    if( papszSiblingFiles != NULL )        papszInitSiblingFiles = CSLDuplicate(papszSiblingFiles);}
开发者ID:ryandavid,项目名称:rotobox,代码行数:40,


示例23: pszName

OGRS57DataSource::OGRS57DataSource(char** papszOpenOptionsIn) :    pszName(NULL),    nLayers(0),    papoLayers(NULL),    poSpatialRef(new OGRSpatialReference()),    papszOptions(NULL),    nModules(0),    papoModules(NULL),    poWriter(NULL),    poClassContentExplorer(NULL),    bExtentsSet(false){    poSpatialRef->SetWellKnownGeogCS( "WGS84" );/* -------------------------------------------------------------------- *//*      Allow initialization of options from the environment.           *//* -------------------------------------------------------------------- */    if( papszOpenOptionsIn != NULL )    {        papszOptions = CSLDuplicate(papszOpenOptionsIn);        return;    }    const char *pszOptString = CPLGetConfigOption( "OGR_S57_OPTIONS", NULL );    if ( pszOptString == NULL )        return;    papszOptions =        CSLTokenizeStringComplex( pszOptString, ",", FALSE, FALSE );    if ( papszOptions && *papszOptions )    {        CPLDebug( "S57", "The following S57 options are being set:" );        char **papszCurOption = papszOptions;        while( *papszCurOption )            CPLDebug( "S57", "    %s", *papszCurOption++ );    }}
开发者ID:bbradbury,项目名称:lib_gdal,代码行数:39,


示例24: GDALCreateSimilarGeoLocTransformer

staticvoid* GDALCreateSimilarGeoLocTransformer( void *hTransformArg, double dfRatioX, double dfRatioY ){    VALIDATE_POINTER1( hTransformArg, "GDALCreateSimilarGeoLocTransformer", NULL );    GDALGeoLocTransformInfo *psInfo = (GDALGeoLocTransformInfo *) hTransformArg;        char** papszGeolocationInfo = CSLDuplicate(psInfo->papszGeolocationInfo);    if( dfRatioX != 1.0 || dfRatioY != 1.0 )    {        GDALGeoLocRescale(papszGeolocationInfo, "PIXEL_OFFSET", dfRatioX, 0.0);        GDALGeoLocRescale(papszGeolocationInfo, "LINE_OFFSET", dfRatioY, 0.0);        GDALGeoLocRescale(papszGeolocationInfo, "PIXEL_STEP", 1.0 / dfRatioX, 1.0);        GDALGeoLocRescale(papszGeolocationInfo, "LINE_STEP", 1.0 / dfRatioY, 1.0);    }    psInfo = (GDALGeoLocTransformInfo*) GDALCreateGeoLocTransformer(        NULL, papszGeolocationInfo, psInfo->bReversed );        CSLDestroy(papszGeolocationInfo);    return psInfo;}
开发者ID:drownedout,项目名称:datamap,代码行数:24,


示例25: CPLAssert

int OGRTABDataSource::Create( const char * pszName, char **papszOptions ){    CPLAssert(m_pszName == nullptr);    m_pszName = CPLStrdup(pszName);    m_papszOptions = CSLDuplicate(papszOptions);    m_bUpdate = TRUE;    const char *pszOpt = CSLFetchNameValue(papszOptions, "FORMAT");    if( pszOpt != nullptr && EQUAL(pszOpt, "MIF") )        m_bCreateMIF = TRUE;    else if( EQUAL(CPLGetExtension(pszName),"mif") ||             EQUAL(CPLGetExtension(pszName),"mid") )        m_bCreateMIF = TRUE;    if( (pszOpt = CSLFetchNameValue(papszOptions,"SPATIAL_INDEX_MODE")) != nullptr )    {        if( EQUAL(pszOpt, "QUICK") )            m_bQuickSpatialIndexMode = TRUE;        else if( EQUAL(pszOpt, "OPTIMIZED") )            m_bQuickSpatialIndexMode = FALSE;    }    m_nBlockSize = atoi(CSLFetchNameValueDef(papszOptions, "BLOCKSIZE", "512"));    // Create a new empty directory.    VSIStatBufL sStat;    if( strlen(CPLGetExtension(pszName)) == 0 )    {        if( VSIStatL( pszName, &sStat ) == 0 )        {            if( !VSI_ISDIR(sStat.st_mode) )            {                CPLError(CE_Failure, CPLE_OpenFailed,                         "Attempt to create dataset named %s,/n"                         "but that is an existing file.",                         pszName);                return FALSE;            }        }        else        {            if( VSIMkdir(pszName, 0755) != 0 )            {                CPLError(CE_Failure, CPLE_AppDefined,                         "Unable to create directory %s.",                         pszName);                return FALSE;            }        }        m_pszDirectory = CPLStrdup(pszName);    }    // Create a new single file.    else    {        IMapInfoFile *poFile = nullptr;        const char *pszEncoding( CSLFetchNameValue( papszOptions, "ENCODING" ) );        const char *pszCharset( IMapInfoFile::EncodingToCharset( pszEncoding ) );        if( m_bCreateMIF )        {            poFile = new MIFFile;            if( poFile->Open(m_pszName, TABWrite, FALSE, pszCharset) != 0 )            {                delete poFile;                return FALSE;            }        }        else        {            TABFile *poTabFile = new TABFile;            if( poTabFile->Open(m_pszName, TABWrite, FALSE,                                m_nBlockSize, pszCharset) != 0 )            {                delete poTabFile;                return FALSE;            }            poFile = poTabFile;        }        m_nLayerCount = 1;        m_papoLayers = static_cast<IMapInfoFile **>(CPLMalloc(sizeof(void *)));        m_papoLayers[0] = poFile;        m_pszDirectory = CPLStrdup(CPLGetPath(pszName));        m_bSingleFile = TRUE;    }    return TRUE;}
开发者ID:ksshannon,项目名称:gdal,代码行数:96,


示例26: CSLDestroy

void OGRS57DataSource::SetOptionList( char ** papszNewOptions ){    CSLDestroy( papszOptions );    papszOptions = CSLDuplicate( papszNewOptions );}
开发者ID:469447793,项目名称:World-Wind-Java,代码行数:6,


示例27: msUVRASTERLayerWhichShapes

//.........这里部分代码省略.........  map_tmp->mappath = msStrdup(layer->map->mappath);  map_tmp->shapepath = msStrdup(layer->map->shapepath);  map_tmp->extent.minx = rect.minx-(0.5*map_cellsize)+(0.5*map_tmp->cellsize);  map_tmp->extent.miny = rect.miny-(0.5*map_cellsize)+(0.5*map_tmp->cellsize);  map_tmp->extent.maxx = map_tmp->extent.minx+((width-1)*map_tmp->cellsize);  map_tmp->extent.maxy = map_tmp->extent.miny+((height-1)*map_tmp->cellsize);  map_tmp->gt.rotation_angle = 0.0;   msCopyProjection(&map_tmp->projection, &layer->projection);  if (layer->debug == 5)    msDebug("msUVRASTERLayerWhichShapes(): extent: %g %g %g %g/n",            map_tmp->extent.minx, map_tmp->extent.miny,            map_tmp->extent.maxx, map_tmp->extent.maxy);  /* important to use that function, to compute map     geotransform, used by the resampling*/   msMapSetSize(map_tmp, width, height);  if (layer->debug == 5)    msDebug("msUVRASTERLayerWhichShapes(): geotransform: %g %g %g %g %g %g/n",            map_tmp->gt.geotransform[0], map_tmp->gt.geotransform[1],            map_tmp->gt.geotransform[2], map_tmp->gt.geotransform[3],            map_tmp->gt.geotransform[4], map_tmp->gt.geotransform[5]);  uvlinfo->extent = map_tmp->extent;  image_tmp = msImageCreate(width, height, map_tmp->outputformatlist[0],                            NULL, NULL, map_tmp->resolution, map_tmp->defresolution,                            &(map_tmp->imagecolor));  /* Default set to AVERAGE resampling */  if( CSLFetchNameValue( layer->processing, "RESAMPLE" ) == NULL ) {    alteredProcessing = CSLDuplicate( layer->processing );    alteredProcessing =      CSLSetNameValue( alteredProcessing, "RESAMPLE",                       "AVERAGE");    savedProcessing = layer->processing;    layer->processing = alteredProcessing;  }  /* disable masking at this level: we don't want to apply the mask at the raster level,   * it will be applied with the correct cellsize and image size in the vector rendering   * phase.   */  saved_layer_mask = layer->mask;  layer->mask = NULL;  if (msDrawRasterLayerLow(map_tmp, layer, image_tmp, NULL ) == MS_FAILURE) {    msSetError(MS_MISCERR, "Unable to draw raster data.", "msUVRASTERLayerWhichShapes()");    layer->mask = saved_layer_mask;    return MS_FAILURE;  }  /* restore layer mask */  layer->mask = saved_layer_mask;  /* restore the saved processing */  if (alteredProcessing != NULL) {    layer->processing = savedProcessing;    CSLDestroy(alteredProcessing);  }  /* free old query arrays */  if (uvlinfo->u) {    for (i=0; i<uvlinfo->width; ++i) {      free(uvlinfo->u[i]);
开发者ID:EOX-A,项目名称:mapserver,代码行数:67,


示例28: CPLAssert

int OGRShapeDataSource::Open( GDALOpenInfo* poOpenInfo,                              int bTestOpen, int bForceSingleFileDataSource ){    CPLAssert( nLayers == 0 );        const char * pszNewName = poOpenInfo->pszFilename;    int bUpdate = poOpenInfo->eAccess == GA_Update;    papszOpenOptions = CSLDuplicate( poOpenInfo->papszOpenOptions );        pszName = CPLStrdup( pszNewName );    bDSUpdate = bUpdate;    bSingleFileDataSource = bForceSingleFileDataSource;/* -------------------------------------------------------------------- *//*      If  bSingleFileDataSource is TRUE we don't try to do anything else.     *//*      This is only utilized when the OGRShapeDriver::Create()         *//*      method wants to create a stub OGRShapeDataSource for a          *//*      single shapefile.  The driver will take care of creating the    *//*      file by callingICreateLayer().                                  *//* -------------------------------------------------------------------- */    if( bSingleFileDataSource )        return TRUE;    /* -------------------------------------------------------------------- *//*      Is the given path a directory or a regular file?                *//* -------------------------------------------------------------------- */    if( !poOpenInfo->bStatOK )    {        if( !bTestOpen )            CPLError( CE_Failure, CPLE_AppDefined,                   "%s is neither a file or directory, Shape access failed./n",                      pszNewName );        return FALSE;    }    /* -------------------------------------------------------------------- *//*      Build a list of filenames we figure are Shape files.            *//* -------------------------------------------------------------------- */    if( !poOpenInfo->bIsDirectory )    {        if( !OpenFile( pszNewName, bUpdate, bTestOpen ) )        {            if( !bTestOpen )                CPLError( CE_Failure, CPLE_OpenFailed,                          "Failed to open shapefile %s./n"                          "It may be corrupt or read-only file accessed in update mode./n",                          pszNewName );            return FALSE;        }        bSingleFileDataSource = TRUE;        return TRUE;    }    else    {        char      **papszCandidates = CPLReadDir( pszNewName );        int       iCan, nCandidateCount = CSLCount( papszCandidates );        int       bMightBeOldCoverage = FALSE;        std::set<CPLString> osLayerNameSet;        for( iCan = 0; iCan < nCandidateCount; iCan++ )        {            char        *pszFilename;            const char  *pszCandidate = papszCandidates[iCan];            const char  *pszLayerName = CPLGetBasename(pszCandidate);            CPLString osLayerName(pszLayerName);#ifdef WIN32            /* On Windows, as filenames are case insensitive, a shapefile layer can be made of */            /* foo.shp and FOO.DBF, so to detect unique layer names, put them */            /* upper case in the unique set used for detection */            osLayerName.toupper();#endif            if( EQUAL(pszCandidate,"ARC") )                bMightBeOldCoverage = TRUE;            if( strlen(pszCandidate) < 4                || !EQUAL(pszCandidate+strlen(pszCandidate)-4,".shp") )                continue;            pszFilename =                CPLStrdup(CPLFormFilename(pszNewName, pszCandidate, NULL));            osLayerNameSet.insert(osLayerName);#ifdef IMMEDIATE_OPENING            if( !OpenFile( pszFilename, bUpdate, bTestOpen )                && !bTestOpen )            {                CPLError( CE_Failure, CPLE_OpenFailed,                          "Failed to open shapefile %s./n"                          "It may be corrupt or read-only file accessed in update mode./n",                          pszFilename );                CPLFree( pszFilename );                CSLDestroy( papszCandidates );//.........这里部分代码省略.........
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:101,


示例29: CSLDuplicate

int OGRGeoconceptDataSource::Create( const char *pszName, char** papszOptions ){    const char *pszConf;    const char *pszExtension;    if( _pszName ) CPLFree(_pszName);    _papszOptions = CSLDuplicate( papszOptions );    pszConf= CSLFetchNameValue(papszOptions,"CONFIG");    if( pszConf != NULL )    {      _pszGCT = CPLStrdup(pszConf);    }    _pszExt = (char *)CSLFetchNameValue(papszOptions,"EXTENSION");    pszExtension = CSLFetchNameValue(papszOptions,"EXTENSION");    if( pszExtension == NULL )    {        _pszExt = CPLStrdup(CPLGetExtension(pszName));    }    else    {        _pszExt = CPLStrdup(pszExtension);    }    if( strlen(_pszExt) == 0 )    {        if( VSIMkdir( pszName, 0755 ) != 0 )        {            CPLError( CE_Failure, CPLE_AppDefined,                      "Directory %s already exists"                      " as geoconcept datastore or"                      " is made up of a non existing list of directories.",                      pszName );            return FALSE;        }        _pszDirectory = CPLStrdup( pszName );        CPLFree(_pszExt);        _pszExt = CPLStrdup("gxt");        char *pszbName = CPLStrdup(CPLGetBasename( pszName ));        if (strlen(pszbName)==0) {/* pszName ends with '/' */            CPLFree(pszbName);            char *pszNameDup= CPLStrdup(pszName);            pszNameDup[strlen(pszName)-2] = '/0';            pszbName = CPLStrdup(CPLGetBasename( pszNameDup ));            CPLFree(pszNameDup);        }        _pszName = CPLStrdup((char *)CPLFormFilename( _pszDirectory, pszbName, NULL ));        CPLFree(pszbName);    }    else    {        _pszDirectory = CPLStrdup( CPLGetPath(pszName) );        _pszName = CPLStrdup( pszName );    }/* -------------------------------------------------------------------- *//*      Create a new single file.                                       *//*      OGRGeoconceptDriver::CreateLayer() will do the job.             *//* -------------------------------------------------------------------- */    _bSingleNewFile = TRUE;    if( !LoadFile( "wt" ) )    {        CPLDebug( "GEOCONCEPT",                  "Failed to create Geoconcept %s.",                  pszName );        return FALSE;    }    return TRUE;}
开发者ID:brunosimoes,项目名称:WorldWind,代码行数:75,



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


C++ CSLFetchBoolean函数代码示例
C++ CSLDestroy函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。