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


C++ OGRGeometryCollection类代码示例

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


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

示例1: Equals

OGRBoolean OGRGeometryCollection::Equals( OGRGeometry * poOther ) const

{
    if( poOther == this )
        return TRUE;

    if( poOther->getGeometryType() != getGeometryType() )
        return FALSE;

    if ( IsEmpty() && poOther->IsEmpty() )
        return TRUE;

    OGRGeometryCollection *poOGC = (OGRGeometryCollection *) poOther;
    if( getNumGeometries() != poOGC->getNumGeometries() )
        return FALSE;

    // we should eventually test the SRS.

    for( int iGeom = 0; iGeom < nGeomCount; iGeom++ )
    {
        if( !getGeometryRef(iGeom)->Equals(poOGC->getGeometryRef(iGeom)) )
            return FALSE;
    }

    return TRUE;
}
开发者ID:bbradbury,项目名称:lib_gdal,代码行数:26,代码来源:ogrgeometrycollection.cpp

示例2: wkbFlatten

OGRGeometry *OGRGeometryFactory::forceToPolygon( OGRGeometry *poGeom )

{
    if( poGeom == NULL )
        return NULL;

    if( wkbFlatten(poGeom->getGeometryType()) != wkbGeometryCollection
        || wkbFlatten(poGeom->getGeometryType()) != wkbMultiPolygon )
        return poGeom;

    // build an aggregated polygon from all the polygon rings in the container.
    OGRPolygon *poPolygon = new OGRPolygon();
    OGRGeometryCollection *poGC = (OGRGeometryCollection *) poGeom;
    int iGeom;

    for( iGeom = 0; iGeom < poGC->getNumGeometries(); iGeom++ )
    {
        if( wkbFlatten(poGC->getGeometryRef(iGeom)->getGeometryType()) 
            != wkbPolygon )
            continue;

        OGRPolygon *poOldPoly = (OGRPolygon *) poGC->getGeometryRef(iGeom);
        int   iRing;

        poPolygon->addRing( poOldPoly->getExteriorRing() );

        for( iRing = 0; iRing < poOldPoly->getNumInteriorRings(); iRing++ )
            poPolygon->addRing( poOldPoly->getInteriorRing( iRing ) );
    }
    
    delete poGC;

    return poPolygon;
}
开发者ID:maowang,项目名称:sqlite-ogc,代码行数:34,代码来源:ogrgeometryfactory.cpp

示例3: getCurveGeometry

OGRGeometry* OGRGeometryCollection::getCurveGeometry(
    const char* const* papszOptions) const
{
    OGRGeometryCollection* poGC =
        OGRGeometryFactory::createGeometry(
            OGR_GT_GetCurve(getGeometryType()))->toGeometryCollection();
    if( poGC == nullptr )
        return nullptr;
    poGC->assignSpatialReference( getSpatialReference() );
    bool bHasCurveGeometry = false;
    for( int iGeom = 0; iGeom < nGeomCount; iGeom++ )
    {
        OGRGeometry* poSubGeom =
            papoGeoms[iGeom]->getCurveGeometry(papszOptions);
        if( poSubGeom->hasCurveGeometry() )
            bHasCurveGeometry = true;
        poGC->addGeometryDirectly( poSubGeom );
    }
    if( !bHasCurveGeometry )
    {
        delete poGC;
        return clone();
    }
    return poGC;
}
开发者ID:ksshannon,项目名称:gdal,代码行数:25,代码来源:ogrgeometrycollection.cpp

示例4: make

 OGRGeometryCollection* make()
 {
     OGRGeometryCollection* poCollection = new OGRGeometryCollection();
     
     poCollection->addGeometryDirectly(make<OGRPoint>());
     poCollection->addGeometryDirectly(make<OGRLinearRing>());
     
     return poCollection;
 }
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:9,代码来源:test_ogr.cpp

示例5: getSpatialReference

OGRGeometry *OGRGeometryCollection::clone() const

{
    OGRGeometryCollection       *poNewGC;

    poNewGC = new OGRGeometryCollection;
    poNewGC->assignSpatialReference( getSpatialReference() );

    for( int i = 0; i < nGeomCount; i++ )
    {
        poNewGC->addGeometry( papoGeoms[i] );
    }

    return poNewGC;
}
开发者ID:puggan,项目名称:OpenCPN,代码行数:15,代码来源:ogrgeometrycollection.cpp

示例6: getLinearGeometry

OGRGeometry* OGRGeometryCollection::getLinearGeometry(double dfMaxAngleStepSizeDegrees,
                                                        const char* const* papszOptions) const
{
    OGRGeometryCollection* poGC = (OGRGeometryCollection*)
        OGRGeometryFactory::createGeometry(OGR_GT_GetLinear(getGeometryType()));
    if( poGC == NULL )
        return NULL;
    poGC->assignSpatialReference( getSpatialReference() );
    for( int iGeom = 0; iGeom < nGeomCount; iGeom++ )
    {
        OGRGeometry* poSubGeom = papoGeoms[iGeom]->getLinearGeometry(dfMaxAngleStepSizeDegrees,
                                                                       papszOptions);
        poGC->addGeometryDirectly( poSubGeom );
    }
    return poGC;
}
开发者ID:bbradbury,项目名称:lib_gdal,代码行数:16,代码来源:ogrgeometrycollection.cpp

示例7: CPL_length

// [[Rcpp::export]]
Rcpp::NumericVector CPL_length(Rcpp::List sfc) { 
	std::vector<OGRGeometry *> g = ogr_from_sfc(sfc, NULL);
	Rcpp::NumericVector out(sfc.length());
	for (size_t i = 0; i < g.size(); i++) {
		OGRwkbGeometryType gt = OGR_GT_Flatten(g[i]->getGeometryType());
		if (gt == wkbLineString || gt == wkbCircularString || gt == wkbCompoundCurve || gt == wkbCurve) {
			OGRCurve *a = (OGRCurve *) g[i];
			out[i] = a->get_Length();
		} else {
			OGRGeometryCollection *a = (OGRGeometryCollection *) g[i];
			out[i] = a->get_Length();
		}
		delete g[i];
	}
	return out;
}
开发者ID:rsbivand,项目名称:sfr,代码行数:17,代码来源:gdal_geom.cpp

示例8: switch

void Shape::Dispatch(OGRGeometry *geom){
  switch(geom->getGeometryType()){
    case wkbPolygon:
    {
      PlotPolygon((OGRPolygon *)geom);
      break;
    }
    case wkbMultiPolygon:
    {
      OGRGeometryCollection *coll = (OGRGeometryCollection *)geom;
      for(int i = 0; i < coll->getNumGeometries(); i++)
        Dispatch(coll->getGeometryRef(i));
      break;
    }
  }
}
开发者ID:PoNote,项目名称:stateface,代码行数:16,代码来源:shape.cpp

示例9: wkbFlatten

void wxGISSimpleMarkerSymbol::Draw(const wxGISGeometry &Geometry, int nLevel)
{
    if(!Geometry.IsOk() ||!m_pDisplay)
        return;

    OGRwkbGeometryType eGeomType = wkbFlatten(Geometry.GetType());
    if(eGeomType != wkbPoint && eGeomType != wkbMultiPoint)
        return;

    OGREnvelope Env = Geometry.GetEnvelope();
    if(!m_pDisplay->CanDraw(Env))
        return;

    OGRGeometry *pGeom = Geometry;

    if(eGeomType == wkbMultiPoint)
    {
		OGRGeometryCollection* pOGRGeometryCollection = (OGRGeometryCollection*)pGeom;
		for(int i = 0; i < pOGRGeometryCollection->getNumGeometries(); ++i)
			Draw(wxGISGeometry(pOGRGeometryCollection->getGeometryRef(i), false));
        return;
    }

    wxCriticalSectionLocker lock(m_pDisplay->GetLock());

    OGRPoint* pPoint = (OGRPoint*)pGeom;
	if(m_dfOutlineSize)
	{
		if(!m_pDisplay->DrawPointFast(pPoint->getX(), pPoint->getY()))
        {
			return;
        }
        m_pDisplay->SetColor(m_OutlineColor);
		m_pDisplay->SetLineWidth( m_dfSize + m_dfOutlineSize + m_dfOutlineSize);
        m_pDisplay->Stroke();
	}

	if(!m_pDisplay->DrawPointFast(pPoint->getX(), pPoint->getY()))
    {
		return;
    }

    m_pDisplay->SetColor(m_Color);
	m_pDisplay->SetLineWidth( m_dfSize );
    m_pDisplay->SetLineCap(CAIRO_LINE_CAP_ROUND);
    m_pDisplay->Stroke();
}
开发者ID:GimpoByte,项目名称:nextgismanager,代码行数:47,代码来源:symbol.cpp

示例10: CPL_gdal_linestring_sample

// [[Rcpp::export]]
Rcpp::List CPL_gdal_linestring_sample(Rcpp::List sfc, Rcpp::List distLst) {
	if (sfc.size() != distLst.size())
		throw std::invalid_argument("sfc and dist should have equal length");
	std::vector<OGRGeometry *> g = ogr_from_sfc(sfc, NULL);
	std::vector<OGRGeometry *> out(g.size());
	for (size_t i = 0; i < g.size(); i++) {
		OGRGeometryCollection *gc = new OGRGeometryCollection;
		Rcpp::NumericVector dists = distLst[i];
		for (size_t j = 0; j < dists.size(); j++) {
			OGRPoint *poPoint  = new OGRPoint;
			((OGRLineString *) g[i])->Value(dists[j], poPoint);
			gc->addGeometry(poPoint);
		}
		out[i] = OGRGeometryFactory::forceToMultiPoint(gc);
	}
	Rcpp::List ret = sfc_from_ogr(out, true);
	ret.attr("crs") = sfc.attr("crs");
	return ret;
}
开发者ID:rsbivand,项目名称:sfr,代码行数:20,代码来源:gdal_geom.cpp

示例11: switch

void GeomDrawBox::draw_geometry(cairo_t *cr, OGRGeometry *geom, double scale, double x, double y, double height)
{
  switch (geom->getGeometryType())
  {
    case wkbPolygon:
      draw_polygon(cr, dynamic_cast<OGRPolygon*>(geom), scale, x, y, height);
      break;
    case wkbMultiPolygon:
      {
        OGRGeometryCollection *geoCollection = dynamic_cast<OGRGeometryCollection*>(geom);
        for (int i = 0; i < geoCollection->getNumGeometries(); ++i)
          draw_geometry(cr, geoCollection->getGeometryRef(i), scale, x, y, height);
      }
      break;
    default:
      log_warning("Can't paint geometry type %s\n", geom->getGeometryName());
      break;
  }
}
开发者ID:Sonano,项目名称:mysql-workbench,代码行数:19,代码来源:geom_draw_box.cpp

示例12: toGeometryCollection

OGRGeometry *OGRGeometryCollection::clone() const

{
    OGRGeometryCollection *poNewGC =
        OGRGeometryFactory::createGeometry(getGeometryType())->
            toGeometryCollection();
    poNewGC->assignSpatialReference( getSpatialReference() );
    poNewGC->flags = flags;

    for( auto&& poSubGeom: *this )
    {
        if( poNewGC->addGeometry( poSubGeom ) != OGRERR_NONE )
        {
            delete poNewGC;
            return nullptr;
        }
    }

    return poNewGC;
}
开发者ID:ksshannon,项目名称:gdal,代码行数:20,代码来源:ogrgeometrycollection.cpp

示例13: switch

OGRConvert::Geometry* OGRConvert::geometry ( OGRGeometry* geometry, OGRCoordinateTransformation *transform, double verticalOffset )
{
  if ( 0x0 != geometry )
  {
    switch ( geometry->getGeometryType() )
    {
    case wkbPoint:
    case wkbPoint25D:
    case wkbLineString:
    case wkbLineString25D:
    case wkbLinearRing:
    case wkbPolygon:
    case wkbPolygon25D:
      return OGRConvert::_geometry ( geometry, transform, verticalOffset );
      break;
    case wkbMultiPoint:
    case wkbMultiPoint25D:
    case wkbMultiLineString:
    case wkbMultiLineString25D:
    case wkbMultiPolygon:
    case wkbMultiPolygon25D:
    case wkbGeometryCollection:
    case wkbGeometryCollection25D:
      {
        OGRGeometryCollection* collection ( static_cast<OGRGeometryCollection*> ( geometry ) );
        Minerva::Core::Data::MultiGeometry::RefPtr multiGeometry ( new Minerva::Core::Data::MultiGeometry );
        for ( int i = 0; i < collection->getNumGeometries(); ++i )
        {
          multiGeometry->addGeometry ( OGRConvert::_geometry ( collection->getGeometryRef ( i ), transform, verticalOffset ) );
        }
        return multiGeometry.release();
      }
      break;
    case wkbNone:
    case wkbUnknown:
      return 0x0;
    }
  }

  return 0x0;
}
开发者ID:gideonmay,项目名称:minervagis,代码行数:41,代码来源:OGRConvert.cpp

示例14: OGRGeometryCollection

int OGRDB2GeometryValidator::ValidateMultiLineString(
                                            OGRMultiLineString * poGeom)
{
    int i, j;
    OGRGeometry* poLineString;
    OGRGeometryCollection* poGeometries = NULL;

    for (i = 0; i < poGeom->getNumGeometries(); i++)
    {
        poLineString = poGeom->getGeometryRef(i);
        if (poLineString->getGeometryType() != wkbLineString
            && poLineString->getGeometryType() != wkbLineString25D)
        {
            // non linestring geometry
            if (!poGeometries)
            {
                poGeometries = new OGRGeometryCollection();
                for (j = 0; j < i; j++)
                    poGeometries->addGeometry(poGeom->getGeometryRef(j));
            }
            if (ValidateGeometry(poLineString))
                poGeometries->addGeometry(poLineString);
            else
                poGeometries->addGeometry(poValidGeometry);

            continue;
        }

        if (!ValidateLineString((OGRLineString*)poLineString))
        {
            // non valid linestring
            if (!poGeometries)
            {
                poGeometries = new OGRGeometryCollection();
                for (j = 0; j < i; j++)
                    poGeometries->addGeometry(poGeom->getGeometryRef(j));
            }

            poGeometries->addGeometry(poValidGeometry);
            continue;
        }

        if (poGeometries)
            poGeometries->addGeometry(poLineString);
    }

    if (poGeometries)
    {
        if (poValidGeometry)
            delete poValidGeometry;

        poValidGeometry = poGeometries;
    }

    return (poValidGeometry == NULL);
}
开发者ID:Wedjaa,项目名称:node-gdal,代码行数:56,代码来源:ogrdb2geometryvalidator.cpp

示例15: switch

void wxGISSimpleCollectionSymbol::Draw(const wxGISGeometry &Geometry, int nLevel)
{
    if(!Geometry.IsOk() ||!m_pDisplay)
        return;

    if (!Geometry.IsOk())
        return;

    switch (wkbFlatten(Geometry.GetType()))
    {
    case wkbMultiPoint:
    case wkbPoint:
        m_pMarkerSymbol->Draw(Geometry);
        break;
    case wkbMultiPolygon:
    case wkbPolygon:
        m_pFillSymbol->Draw(Geometry);
        break;
    case wkbMultiLineString:
    case wkbLineString:
        m_pLineSymbol->Draw(Geometry);
        break;
    case wkbGeometryCollection:
        {
            OGRGeometryCollection* pOGRGeometryCollection = (OGRGeometryCollection*)Geometry.operator OGRGeometry *();
            for (int i = 0; i < pOGRGeometryCollection->getNumGeometries(); ++i)
            {
                wxGISGeometry CollectionGeom(pOGRGeometryCollection->getGeometryRef(i), false);
                Draw(CollectionGeom, nLevel);
            }
        }
        break;
    case wkbLinearRing:
    case wkbUnknown:
    case wkbNone:
    default:
        break;
    }
}
开发者ID:GimpoByte,项目名称:nextgismanager,代码行数:39,代码来源:symbol.cpp


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