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


C++ OGRFeatureDefn::GetName方法代码示例

本文整理汇总了C++中OGRFeatureDefn::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ OGRFeatureDefn::GetName方法的具体用法?C++ OGRFeatureDefn::GetName怎么用?C++ OGRFeatureDefn::GetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OGRFeatureDefn的用法示例。


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

示例1: if

void OGRILI1Layer::JoinGeomLayers()
{
    bGeomsJoined = TRUE;
    int bResetConfigOption = FALSE;
    if (EQUAL(CPLGetConfigOption("OGR_ARC_STEPSIZE", ""), ""))
    {
        bResetConfigOption = TRUE;
        CPLSetThreadLocalConfigOption("OGR_ARC_STEPSIZE", "0.96");
    }

    for (GeomFieldInfos::const_iterator it = oGeomFieldInfos.begin(); it != oGeomFieldInfos.end(); ++it)
    {
        OGRFeatureDefn* geomFeatureDefn = it->second.geomTable;
        if (geomFeatureDefn)
        {
            CPLDebug( "OGR_ILI", "Join geometry table %s of field '%s'", geomFeatureDefn->GetName(), it->first.c_str() );
            OGRILI1Layer* poGeomLayer = poDS->GetLayerByName(geomFeatureDefn->GetName());
            int nGeomFieldIndex = GetLayerDefn()->GetGeomFieldIndex(it->first.c_str());
            if (it->second.iliGeomType == "Surface")
            {
                JoinSurfaceLayer(poGeomLayer, nGeomFieldIndex);
            }
            else if (it->second.iliGeomType == "Area")
            {
                CPLString pointField = it->first + "__Point";
                int nPointFieldIndex = GetLayerDefn()->GetGeomFieldIndex(pointField.c_str());
                PolygonizeAreaLayer(poGeomLayer, nGeomFieldIndex, nPointFieldIndex);
            }
        }
    }

    if( bResetConfigOption )
        CPLSetThreadLocalConfigOption("OGR_ARC_STEPSIZE", NULL);
}
开发者ID:garnertb,项目名称:gdal,代码行数:34,代码来源:ogrili1layer.cpp

示例2: layer_by_index

    void layer_by_index(gdal_dataset_type const datasource,
                        int layer_index)
    {
        free_layer();

        datasource_ = datasource;

        OGRLayer* ogr_layer = datasource_->GetLayer(layer_index);
        if (ogr_layer)
        {
            OGRFeatureDefn* def = ogr_layer->GetLayerDefn();
            if (def != 0)
            {
                layer_ = ogr_layer;
                layer_name_ = def->GetName();
                is_valid_ = true;

                MAPNIK_LOG_DEBUG(ogr) << "ogr_layer_ptr: layer_from_index layer=" << layer_name_;
            }
        }

#ifdef MAPNIK_LOG
        debug_print_last_error();
#endif
    }
开发者ID:cquest,项目名称:mapnik,代码行数:25,代码来源:ogr_layer_ptr.hpp

示例3: layer_by_sql

    void layer_by_sql(gdal_dataset_type const datasource,
                      std::string const& layer_sql)
    {
        free_layer();

        datasource_ = datasource;
        owns_layer_ = true;

        // TODO - actually filter fields!
        // http://trac.osgeo.org/gdal/wiki/rfc29_desired_fields
        // http://trac.osgeo.org/gdal/wiki/rfc28_sqlfunc

        OGRGeometry* spatial_filter = nullptr;
        const char* sql_dialect = nullptr;
        OGRLayer* ogr_layer = datasource_->ExecuteSQL(layer_sql.c_str(), spatial_filter, sql_dialect);

        if (ogr_layer)
        {
            OGRFeatureDefn* def = ogr_layer->GetLayerDefn();
            if (def != 0)
            {
                layer_ = ogr_layer;
                layer_name_ = def->GetName();
                is_valid_ = true;

                MAPNIK_LOG_DEBUG(ogr) << "ogr_layer_ptr: layer_from_sql layer=" << layer_name_;
            }
        }

#ifdef MAPNIK_LOG
        debug_print_last_error();
#endif
    }
开发者ID:cquest,项目名称:mapnik,代码行数:33,代码来源:ogr_layer_ptr.hpp

示例4:

//---------------------------------------------------------
CSG_Shapes * COGR_DataSource::Read_Shapes(int iLayer)
{
	OGRLayer	*pLayer	= Get_Layer(iLayer);

	//-----------------------------------------------------
	if( pLayer && Get_Type(iLayer) != SHAPE_TYPE_Undefined )
	{
		int				iField;
		OGRFeature		*pFeature;
		OGRFeatureDefn	*pDef		= pLayer->GetLayerDefn();
		CSG_Shapes		*pShapes	= SG_Create_Shapes(Get_Type(iLayer), CSG_String(pDef->GetName()));

		for(iField=0; iField<pDef->GetFieldCount(); iField++)
		{
			OGRFieldDefn	*pDefField	= pDef->GetFieldDefn(iField);

			pShapes->Add_Field(pDefField->GetNameRef(), COGR_Driver::Get_Type(pDefField->GetType()));
		}

		pLayer->ResetReading();

		//-------------------------------------------------
		while( (pFeature = pLayer->GetNextFeature()) != NULL && SG_UI_Process_Get_Okay(false) )
		{
			OGRGeometry	*pGeometry	= pFeature->GetGeometryRef();

			if( pGeometry != NULL )
			{
				CSG_Shape	*pShape	= pShapes->Add_Shape();

				for(iField=0; iField<pDef->GetFieldCount(); iField++)
				{
					OGRFieldDefn	*pDefField	= pDef->GetFieldDefn(iField);

					switch( pDefField->GetType() )
					{
					default:			pShape->Set_Value(iField, SG_STR_MBTOSG(pFeature->GetFieldAsString (iField)));	break;
					case OFTString:		pShape->Set_Value(iField, SG_STR_MBTOSG(pFeature->GetFieldAsString (iField)));	break;
					case OFTInteger:	pShape->Set_Value(iField, pFeature->GetFieldAsInteger(iField));	break;
					case OFTReal:		pShape->Set_Value(iField, pFeature->GetFieldAsDouble (iField));	break;
					}
				}

				//-----------------------------------------
				if( _Read_Geometry(pShape, pGeometry) == false )
				{
					pShapes->Del_Shape(pShape);
				}
			}

			OGRFeature::DestroyFeature(pFeature);
		}

		return( pShapes );
	}

	//-----------------------------------------------------
	return( NULL );
}
开发者ID:am2222,项目名称:SAGA-GIS,代码行数:60,代码来源:ogr_driver.cpp

示例5: GetFeatureDefnInfo

FeatureDefnInfo ImdReader::GetFeatureDefnInfo(const char *pszLayerName) {
    FeatureDefnInfo featureDefnInfo;
    for (FeatureDefnInfos::const_iterator it = featureDefnInfos.begin(); it != featureDefnInfos.end(); ++it)
    {
        OGRFeatureDefn* fdefn = it->poTableDefn;
        if (EQUAL(fdefn->GetName(), pszLayerName)) featureDefnInfo = *it;
    }
    return featureDefnInfo;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:9,代码来源:imdreader.cpp

示例6:

OGRLayer* ILI2Reader::GetLayer(const char* pszName) {
  for (list<OGRLayer *>::reverse_iterator layerIt = m_listLayer.rbegin();
       layerIt != m_listLayer.rend();
       ++layerIt) {
    OGRFeatureDefn *fDef = (*layerIt)->GetLayerDefn();
    if (cmpStr(fDef->GetName(), pszName) == 0) {
      return *layerIt;
    }
  }
  return NULL;
}
开发者ID:Wedjaa,项目名称:node-gdal,代码行数:11,代码来源:ili2reader.cpp

示例7: CPLDebug

int ILI1Reader::ReadModel( ImdReader *poImdReader,
                           const char *pszModelFilename,
                           OGRILI1DataSource *poDS)
{

  poImdReader->ReadModel(pszModelFilename);
  for (FeatureDefnInfos::const_iterator it = poImdReader->featureDefnInfos.begin(); it != poImdReader->featureDefnInfos.end(); ++it)
  {
#if DEBUG_VERBOSE
    CPLDebug( "OGR_ILI", "Adding OGRILI1Layer with table '%s'",
              it->GetTableDefnRef()->GetName() );
#endif
    OGRILI1Layer* layer = new OGRILI1Layer( it->GetTableDefnRef(),
                                            it->poGeomFieldInfos, poDS);
    AddLayer(layer);
    // Create additional layers for surface and area geometries.
    for (GeomFieldInfos::const_iterator it2 = it->poGeomFieldInfos.begin();
         it2 != it->poGeomFieldInfos.end();
         ++it2)
    {
      if (it2->second.GetGeomTableDefnRef())
      {
        OGRFeatureDefn* poGeomTableDefn = it2->second.GetGeomTableDefnRef();
        OGRGeomFieldDefn* poOGRGeomFieldDefn
            = poGeomTableDefn->GetGeomFieldDefn(0);
        GeomFieldInfos oGeomFieldInfos;
        // We add iliGeomType to recognize Ili1 geom tables
        oGeomFieldInfos[poOGRGeomFieldDefn->GetNameRef()].iliGeomType
            = it2->second.iliGeomType;
#if DEBUG_VERBOSE
        CPLDebug( "OGR_ILI", "Adding OGRILI1Layer with geometry table '%s'",
                  poGeomTableDefn->GetName() );
#endif
        OGRILI1Layer* geomlayer
            = new OGRILI1Layer(poGeomTableDefn, oGeomFieldInfos, poDS);
        AddLayer(geomlayer);
      }
    }
  }

  codeBlank = poImdReader->codeBlank;
  CPLDebug( "OGR_ILI", "Ili1Format blankCode '%c'", poImdReader->codeBlank );
  codeUndefined = poImdReader->codeUndefined;
  CPLDebug( "OGR_ILI", "Ili1Format undefinedCode '%c'",
            poImdReader->codeUndefined );
  codeContinue = poImdReader->codeContinue;
  CPLDebug( "OGR_ILI", "Ili1Format continueCode '%c'",
            poImdReader->codeContinue );
  return 0;
}
开发者ID:OSGeo,项目名称:gdal,代码行数:50,代码来源:ili1reader.cpp

示例8: if

void OGRILI1Layer::JoinGeomLayers()
{
    for (GeomFieldInfos::const_iterator it = oGeomFieldInfos.begin(); it != oGeomFieldInfos.end(); ++it)
    {
        OGRFeatureDefn* geomFeatureDefn = it->second.geomTable;
        if (geomFeatureDefn)
        {
            CPLDebug( "OGR_ILI", "Join geometry table %s of field '%s'", geomFeatureDefn->GetName(), it->first.c_str() );
            OGRILI1Layer* poGeomLayer = poDS->GetLayerByName(geomFeatureDefn->GetName());
            int nGeomFieldIndex = GetLayerDefn()->GetGeomFieldIndex(it->first.c_str());
            if (it->second.iliGeomType == "Surface")
            {
                JoinSurfaceLayer(poGeomLayer, nGeomFieldIndex);
            }
            else if (it->second.iliGeomType == "Area")
            {
                CPLString pointField = it->first + "__Point";
                int nPointFieldIndex = GetLayerDefn()->GetGeomFieldIndex(pointField.c_str());
                PolygonizeAreaLayer(poGeomLayer, nGeomFieldIndex, nPointFieldIndex);
            }
        }
    }
    bGeomsJoined = TRUE;
}
开发者ID:0004c,项目名称:node-gdal,代码行数:24,代码来源:ogrili1layer.cpp

示例9: AddGeomTable

 // Add additional Geometry table for Interlis 1
 void AddGeomTable(CPLString layerName, const char* psFieldName, OGRwkbGeometryType eType, bool bRefTIDField = false)
 {
     OGRFeatureDefn* poGeomTableDefn = new OGRFeatureDefn(layerName);
     OGRFieldDefn fieldDef("_TID", OFTString);
     poGeomTableDefn->AddFieldDefn(&fieldDef);
     if (bRefTIDField)
     {
         OGRFieldDefn fieldDefRef("_RefTID", OFTString);
         poGeomTableDefn->AddFieldDefn(&fieldDefRef);
     }
     poGeomTableDefn->DeleteGeomFieldDefn(0);
     OGRGeomFieldDefn fieldDefGeom(psFieldName, eType);
     poGeomTableDefn->AddGeomFieldDefn(&fieldDefGeom);
     CPLDebug( "OGR_ILI", "Adding geometry table %s for field %s", poGeomTableDefn->GetName(), psFieldName);
     poGeomFieldInfos[psFieldName].geomTable = poGeomTableDefn;
 }
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:17,代码来源:imdreader.cpp

示例10:

JNIEXPORT jstring JNICALL Java_es_gva_cit_jogr_OGRFeatureDefn_getNameNat
  (JNIEnv *env, jobject obj, jlong cPtr){
  	
  	OGRFeatureDefn 			*fd = (OGRFeatureDefn *) 0 ;
  	jstring					nom_fd;
  	
  	fd = *(OGRFeatureDefn **)&cPtr;
  	const char *name = fd->GetName();
  	
  	if(name!=NULL)
	  	nom_fd = env->NewStringUTF(name);
  	else return NULL;
  	
  	return nom_fd;
  	
  }
开发者ID:,项目名称:,代码行数:16,代码来源:

示例11: OGRFeatureDefn

OGRESRIFeatureServiceLayer::OGRESRIFeatureServiceLayer(OGRESRIFeatureServiceDataset* poDS)
{
    this->poDS = poDS;
    OGRFeatureDefn* poSrcFeatDefn = poDS->GetUnderlyingLayer()->GetLayerDefn();
    poFeatureDefn = new OGRFeatureDefn(poSrcFeatDefn->GetName());
    SetDescription(poFeatureDefn->GetName());
    poFeatureDefn->Reference();
    poFeatureDefn->SetGeomType(wkbNone);
    for(int i=0;i<poSrcFeatDefn->GetFieldCount();i++)
        poFeatureDefn->AddFieldDefn(poSrcFeatDefn->GetFieldDefn(i));
    for(int i=0;i<poSrcFeatDefn->GetGeomFieldCount();i++)
        poFeatureDefn->AddGeomFieldDefn(poSrcFeatDefn->GetGeomFieldDefn(i));
    nFeaturesRead = 0;
    nLastFID = 0;
    bOtherPage = FALSE;
    bUseSequentialFID = FALSE;
}
开发者ID:drownedout,项目名称:datamap,代码行数:17,代码来源:ogrgeojsondriver.cpp

示例12: ReportOnLayer

static void ReportOnLayer( OGRLayer * poLayer )

{
    OGRFeatureDefn      *poDefn = poLayer->GetLayerDefn();

    printf( "\n" );
    
    printf( "Layer name: %s\n", poDefn->GetName() );

    printf( "Feature Count: %d\n", poLayer->GetFeatureCount() );

    if( bVerbose )
    {
        char    *pszWKT;
        
        if( poLayer->GetSpatialRef() == NULL )
            pszWKT = CPLStrdup( "(NULL)" );
        else
            poLayer->GetSpatialRef()->exportToWkt( &pszWKT );

        printf( "Layer SRS WKT: %s\n", pszWKT );
        CPLFree( pszWKT );
    }
    
    for( int iAttr = 0; iAttr < poDefn->GetFieldCount(); iAttr++ )
    {
        OGRFieldDefn    *poField = poDefn->GetFieldDefn( iAttr );

        printf( "%s: %s (%d.%d)\n",
                poField->GetNameRef(),
                poField->GetFieldTypeName( poField->GetType() ),
                poField->GetWidth(),
                poField->GetPrecision() );
    }

/* -------------------------------------------------------------------- */
/*      Read, and dump features.                                        */
/* -------------------------------------------------------------------- */
    OGRFeature  *poFeature;
    while( (poFeature = poLayer->GetNextFeature()) != NULL )
    {
        poFeature->DumpReadable( stdout );
        delete poFeature;
    }
}
开发者ID:,项目名称:,代码行数:45,代码来源:

示例13: poDS

OGRESRIFeatureServiceLayer::OGRESRIFeatureServiceLayer(
    OGRESRIFeatureServiceDataset* poDSIn) :
    poDS(poDSIn),
    nFeaturesRead(0),
    nLastFID(0),
    bOtherPage(false),
    bUseSequentialFID(false)
{
    OGRFeatureDefn* poSrcFeatDefn = poDS->GetUnderlyingLayer()->GetLayerDefn();
    poFeatureDefn = new OGRFeatureDefn(poSrcFeatDefn->GetName());
    SetDescription(poFeatureDefn->GetName());
    poFeatureDefn->Reference();
    poFeatureDefn->SetGeomType(wkbNone);
    for(int i=0;i<poSrcFeatDefn->GetFieldCount();i++)
        poFeatureDefn->AddFieldDefn(poSrcFeatDefn->GetFieldDefn(i));
    for(int i=0;i<poSrcFeatDefn->GetGeomFieldCount();i++)
        poFeatureDefn->AddGeomFieldDefn(poSrcFeatDefn->GetGeomFieldDefn(i));
}
开发者ID:bbradbury,项目名称:lib_gdal,代码行数:18,代码来源:ogrgeojsondriver.cpp

示例14: ofieldDefn

int ILI2Reader::AddFeature(DOMElement *elem) {
  bool newLayer = true;
  OGRLayer *curLayer = 0;
  char *pszName = XMLString::transcode(elem->getTagName());

  // test if this layer exist
  for (list<OGRLayer *>::reverse_iterator layerIt = m_listLayer.rbegin();
       layerIt != m_listLayer.rend();
       ++layerIt) {
    OGRFeatureDefn *fDef = (*layerIt)->GetLayerDefn();
    if (cmpStr(fDef->GetName(), pszName) == 0) {
      newLayer = false;
      curLayer = *layerIt;
      break;
    }
  }

  // add a layer
  if (newLayer) { // FIXME in Layer: SRS Writer Type datasource
    CPLDebug( "OGR_ILI", "Adding layer: %s", pszName );
    // new layer data
    OGRSpatialReference *poSRSIn = NULL; // FIXME fix values for initial layer
    int bWriterIn = 0;
    OGRwkbGeometryType eReqType = wkbUnknown;
    OGRILI2DataSource *poDSIn = NULL;
    curLayer = new OGRILI2Layer(pszName, poSRSIn, bWriterIn, eReqType, poDSIn);
    m_listLayer.push_back(curLayer);
  }

  // the feature and field definition
  OGRFeatureDefn *featureDef = curLayer->GetLayerDefn();
  if (newLayer) {
    // add TID field
    OGRFieldDefn ofieldDefn (ILI2_TID, OFTString);
    featureDef->AddFieldDefn(&ofieldDefn);

    setFieldDefn(featureDef, elem);
  }

  // add the features
  OGRFeature *feature = new OGRFeature(featureDef);

  // assign TID
  int fIndex = feature->GetFieldIndex(ILI2_TID);
  if (fIndex != -1) {
      XMLCh *pszIli2_tid = XMLString::transcode(ILI2_TID);
      char *fChVal = XMLString::transcode(elem->getAttribute(pszIli2_tid));
      feature->SetField(fIndex, fChVal);
      XMLString::release (&pszIli2_tid);
      XMLString::release (&fChVal);
  } else {
      CPLDebug( "OGR_ILI","'%s' not found", ILI2_TID);
  }

  SetFieldValues(feature, elem);
  curLayer->SetFeature(feature);
  
  XMLString::release (&pszName);

  return 0;
}
开发者ID:imincik,项目名称:pkg-gdal,代码行数:61,代码来源:ili2reader.cpp

示例15: if

int ILI1Reader::ReadTable(const char *layername) {
    char **tokens = NULL;
    const char *firsttok = NULL;
    int ret = TRUE;
    int warned = FALSE;
    int fIndex;
    int geomIdx;

    // curLayer is NULL if we have more than one
    // point geometry column
    if(curLayer == NULL) {
      OGRFeature *metaFeature = NULL;
      metaLayer->ResetReading();
      while((metaFeature = metaLayer->GetNextFeature()) != NULL ) {
        if(EQUAL(layername, metaFeature->GetFieldAsString(0))) {
          const char *geomlayername = metaFeature->GetFieldAsString(2);
          curLayer = GetLayerByName(geomlayername);
          break;
        }
      }
    }

    OGRFeatureDefn *featureDef = curLayer->GetLayerDefn();
    OGRFeature *feature = NULL;

    // get the geometry index of the current layer
    // only if the model is read
    if(featureDef->GetFieldCount() != 0) {
      OGRFeature *metaFeature = NULL;
      metaLayer->ResetReading();
      while((metaFeature = metaLayer->GetNextFeature()) != NULL ) {
        if(EQUAL(curLayer->GetLayerDefn()->GetName(), metaFeature->GetFieldAsString(2))) {
          geomIdx = metaFeature->GetFieldAsInteger(1);
        }
      }
    }

    long fpos = VSIFTell(fpItf);
    while (ret && (tokens = ReadParseLine()))
    {
      firsttok = CSLGetField(tokens, 0);
      if (EQUAL(firsttok, "OBJE"))
      {
        //Check for features spread over multiple objects
        if (featureDef->GetGeomType() == wkbPolygon)
        {
          //Multiple polygon rings
          feature = curLayer->GetFeatureRef(atol(CSLGetField(tokens, 2)));
        }
        else if (featureDef->GetGeomType() == wkbGeometryCollection)
        {
          //AREA lines spread over mutltiple objects
        }
        else
        {
          feature = NULL;
        }

        if (feature == NULL)
        {
          if (featureDef->GetFieldCount() == 0)
          {
            CPLDebug( "OGR_ILI", "No field definition found for table: %s", featureDef->GetName() );
            //Model not read - use heuristics
            for (fIndex=1; fIndex<CSLCount(tokens); fIndex++)
            {
              char szFieldName[32];
              sprintf(szFieldName, "Field%02d", fIndex);
              OGRFieldDefn oFieldDefn(szFieldName, OFTString);
              featureDef->AddFieldDefn(&oFieldDefn);
            }
          }
          //start new feature
          feature = new OGRFeature(featureDef);

          int fieldno = 0;
          for (fIndex=1; fIndex<CSLCount(tokens) && fieldno < featureDef->GetFieldCount(); fIndex++, fieldno++)
          {
            if (!EQUAL(tokens[fIndex], "@")) {
              //CPLDebug( "READ TABLE OGR_ILI", "Adding Field %d: %s", fieldno, tokens[fIndex]);
              feature->SetField(fieldno, tokens[fIndex]);
              if (featureDef->GetFieldDefn(fieldno)->GetType() == OFTReal
                  && fieldno > 0
                  && featureDef->GetFieldDefn(fieldno-1)->GetType() == OFTReal
                  && featureDef->GetGeomType() == wkbPoint

                  /*
                  // if there is no ili model read,
                  // we have no chance to detect the
                  // geometry column!!
                  */

                  && (fieldno-2) == geomIdx) {
                //add Point geometry
                OGRPoint *ogrPoint = new OGRPoint(atof(tokens[fIndex-1]), atof(tokens[fIndex]));
                feature->SetGeometryDirectly(ogrPoint);
              }
            }
          }
          if (!warned && featureDef->GetFieldCount() != CSLCount(tokens)-1 && !(featureDef->GetFieldCount() == CSLCount(tokens) && EQUAL(featureDef->GetFieldDefn(featureDef->GetFieldCount()-1)->GetNameRef(), "ILI_Geometry"))) {
//.........这里部分代码省略.........
开发者ID:Chaduke,项目名称:bah.mod,代码行数:101,代码来源:ili1reader.cpp


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