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


C++ CSLDuplicate函数代码示例

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


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

示例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,代码来源:hdf5imagedataset.cpp

示例3: RGDAL_GetCategoryNames

SEXP
RGDAL_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,代码来源:gdal-bindings.cpp

示例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,代码来源:gdalmultidomainmetadata.cpp

示例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,代码来源:gdalhttp.cpp

示例6: CSLDestroy

CPLErr RawRasterBand::SetCategoryNames( char ** papszNewNames )

{
    CSLDestroy( papszCategoryNames );
    papszCategoryNames = CSLDuplicate( papszNewNames );

    return CE_None;
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:8,代码来源:rawdataset.cpp

示例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,代码来源:ogrwritabledwglayer.cpp

示例8: CSLDuplicate

int OGRDGNDataSource::PreCreate( const char *pszFilename, 
                                 char **papszOptions )

{
    this->papszOptions = CSLDuplicate( papszOptions );
    pszName = CPLStrdup( pszFilename );

    return TRUE;
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:9,代码来源:ogrdgndatasource.cpp

示例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,代码来源:vrtrasterband.cpp

示例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,代码来源:gdalgeorefpamdataset.cpp

示例11: CSLDestroy

CPLErr VRTRasterBand::SetCategoryNames( char ** papszNewNames )

{
    ((VRTDataset *) poDS)->SetNeedsFlush();

    CSLDestroy( papszCategoryNames );
    papszCategoryNames = CSLDuplicate( papszNewNames );

    return CE_None;
}
开发者ID:Joe-xXx,项目名称:gdal,代码行数:10,代码来源:vrtrasterband.cpp

示例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,代码来源:ogrunionlayer.cpp

示例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,代码来源:vrtdriver.cpp

示例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,代码来源:mapcontour.c

示例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,代码来源:gdalpamrasterband.cpp


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