• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ geom::GeometryFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: create_relation

    /***
     * Union linestrings to multilinestring and insert them into table
     * relations.
     */
    void create_relation(const osmium::Relation &relation,
                         const osmium::object_id_type relation_id,
                         bool &contains_nowaterway_ways,
                         vector<geos::geom::Geometry *> *linestrings) {

        if (!(linestrings->size())) {
            return;
        }
        const geos::geom::GeometryFactory geom_factory =
                geos::geom::GeometryFactory();
        geos::geom::GeometryCollection *geom_collection = nullptr;
        try {
            geom_collection = geom_factory.createGeometryCollection(
                              linestrings);
        } catch (...) {
            cerr << "Failed to create geometry collection at relation: "
                 << relation_id << endl;
            delete linestrings;
            return;
        }
        geos::geom::Geometry *geos_geom = nullptr;
        try {
            geos_geom = geom_collection->Union().release();
        } catch (...) {
            cerr << "Failed to union linestrings at relation: "
                 << relation_id << endl;
            delete geom_collection;
            return;
        }
        OGRGeometry *ogr_multilinestring = nullptr;
        ogr_multilinestring = geos2ogr(geos_geom);
        if (!strcmp(ogr_multilinestring->getGeometryName(),"LINESTRING")) {
            try {
                ogr_multilinestring =
                        OGRGeometryFactory::forceToMultiLineString(
                        ogr_multilinestring);
            } catch (...) {
                delete geom_collection;
                delete geos_geom;
                return;
            }
        }
        try {
            ds.insert_relation_feature(ogr_multilinestring, relation,
                                       contains_nowaterway_ways);
        } catch (osmium::geometry_error&) {
            OGRGeometryFactory::destroyGeometry(ogr_multilinestring);
            cerr << "Inserting to table failed for relation: "
                 << relation_id << endl;
        } catch (...) {
            OGRGeometryFactory::destroyGeometry(ogr_multilinestring);
            cerr << "Inserting to table failed for relation: "
                 << relation_id << endl;
            cerr << "  Unexpected error" << endl;
        }
        delete geom_collection;
        delete geos_geom;
        OGRGeometryFactory::destroyGeometry(ogr_multilinestring);
    }
开发者ID:Nathanael-L,项目名称:osmi-water,代码行数:63,代码来源:waterway.hpp


示例2:

 ~test_preparedgeometryfactory_data()
 {
     // FREE MEMORY per test case
     prep::PreparedGeometryFactory::destroy(pg_);
     factory_.destroyGeometry(g_);
     pg_ = 0;
     g_ = 0;
 }
开发者ID:AvlWx2014,项目名称:basemap,代码行数:8,代码来源:PreparedGeometryFactoryTest.cpp


示例3: create_discs

 void create_discs(geos::geom::GeometryFactory& gf, int num, double radius, 
     std::vector<geos::geom::Polygon*>* g)
 {
     for (int i = 0; i < num; ++i) {
         for (int j = 0; j < num; ++j) {
             std::auto_ptr<geos::geom::Point> pt(
                 gf.createPoint(geos::geom::Coordinate(i, j)));
             g->push_back(dynamic_cast<geos::geom::Polygon*>(pt->buffer(radius)));
         }
     }
 }
开发者ID:ryandavid,项目名称:rotobox,代码行数:11,代码来源:CascadedPolygonUnionTest.cpp


示例4: setSampleOffset

namespace Isis {


static  geos::geom::GeometryFactory geosFactory;
bool HiJitCube::naifLoaded = false;
int npSamp0[] = {0,1971,3964,5963,7970,7971,7971,9975,9976,9976,11981,13986,15984,17982};
int npSamps[] = {2021,2043,2048,2052,2055,2053,2053,2053,2054,2055,2051,2049,2043,2018};
bool sampinit=false;
bool originst;

/**
 *  @brief Default constructor with no cube
 */
HiJitCube::HiJitCube() {
  initLocal();
}

/**
 *  @brief Constructor with file to open
 */
HiJitCube::HiJitCube(const std::string &filename) {
  initLocal();
  OpenCube(filename);
}

/**
 *  @brief Constructor with file to open and potential shift applied
 */
HiJitCube::HiJitCube(const std::string &filename, PvlObject &shift) {
  initLocal();
  OpenCube(filename, shift);
}


/**
 *  @brief Destructor
 */
HiJitCube::~HiJitCube() {
  delete fpGeom;
  Close();
}

void HiJitCube::setSampleOffset(int soff) {
  jdata.sampOffset = soff;
  if (IsOpen()) computePoly();
  return;
}

void HiJitCube::setLineOffset(int loff) {
  jdata.lineOffset = loff;
  if (IsOpen()) computePoly();
  return;
}


void HiJitCube::OpenCube(const std::string &filename) {
  Open(filename);
  Init();
  return;
}

void HiJitCube::OpenCube(const std::string &filename, PvlObject &shift) {
  OpenCube(filename);

//  Determine if a shift of the CCD exists in the definitions file
  if (shift.HasGroup(jdata.ccdName)) {
    PvlGroup &ccddef = shift.FindGroup(jdata.ccdName, Pvl::Traverse);
    if (ccddef.HasKeyword("SampleOffset")) {
      jdata.sampOffset = (int) ccddef["SampleOffset"];
    }
    if (ccddef.HasKeyword("LineOffset")) {
      jdata.lineOffset = (int) ccddef["LineOffset"];
    }
    computePoly();
  }

  return;
}

double HiJitCube::getLineTime(double line) const {
  return (((line-1.0) * jdata.linerate) + jdata.obsStartTime);
}

void HiJitCube::Compatable(HiJitCube &cube) throw (iException &) {
  JitInfo other = cube.GetInfo();
  
  if (jdata.summing != other.summing) {
    ostringstream msg;
    msg << "Summing mode (" << jdata.summing 
        << ") in file " << Filename() << " is not equal to summing mode (" 
        << other.summing << ") in file " << cube.Filename() << endl;
    throw iException::Message(iException::User,msg.str(),_FILEINFO_);
  }
  return;
}
       

bool HiJitCube::intersects(const HiJitCube &cube) const {
  return (fpGeom->intersects(cube.Poly()));
}
//.........这里部分代码省略.........
开发者ID:assutech,项目名称:isis3,代码行数:101,代码来源:HiJitCube.cpp


示例5: computePoly

void HiJitCube::computePoly() {

//  Compute sample and line coordinates in the focal plane
  int samp0,sampN;
  if (originst) {
    samp0=jdata.fpSamp0 + jdata.sampOffset;
    sampN=samp0 + npSamps[jdata.cpmmNumber] - 1;
  } else {
    samp0=jdata.fpSamp0 + jdata.sampOffset;
    sampN=samp0 + Samples() - 1;
  }
  int line0(jdata.fpLine0 + jdata.lineOffset), lineN(line0 + Lines() - 1);

//  Allocate a new coordinate sequence and define it
  geos::geom::CoordinateSequence *pts = new geos::geom::CoordinateArraySequence();
  pts->add(geos::geom::Coordinate(samp0, lineN));
  pts->add(geos::geom::Coordinate(sampN, lineN));
  pts->add(geos::geom::Coordinate(sampN, line0));
  pts->add(geos::geom::Coordinate(samp0, line0));
  pts->add(geos::geom::Coordinate(samp0, lineN));

  
//  Make this reentrant and delete previous one if it exists and get the
//  new one
  delete fpGeom;
  fpGeom = geosFactory.createPolygon(geosFactory.createLinearRing(pts), 0);
  return;
}
开发者ID:assutech,项目名称:isis3,代码行数:28,代码来源:HiJitCube.cpp


示例6: GeomPtr

 GeomPtr
 getGeometry(SegStrVct& vct)
 {
     GeomVct* lines = new GeomVct;
     for(SegStrVct::size_type i = 0, n = vct.size(); i < n; ++i) {
         SegmentString* ss = vct[i];
         lines->push_back(gf_->createLineString(*(ss->getCoordinates())));
     }
     return GeomPtr(gf_->createMultiLineString(lines));
 }
开发者ID:libgeos,项目名称:libgeos,代码行数:10,代码来源:MCIndexSnapRounderTest.cpp


示例7: make_point

 point_type make_point(const osmium::geom::Coordinates& xy) const {
     try {
         return point_type(m_geos_factory.createPoint(geos::geom::Coordinate(xy.x, xy.y)));
     } catch (geos::util::GEOSException&) {
         THROW(osmium::geos_geometry_error());
     }
 }
开发者ID:Gozhack,项目名称:osrm-backend,代码行数:7,代码来源:geos.hpp


示例8: multipolygon_inner_ring_start

 void multipolygon_inner_ring_start() {
     try {
         m_coordinate_sequence.reset(m_geos_factory->getCoordinateSequenceFactory()->create(static_cast<std::size_t>(0), 2));
     } catch (const geos::util::GEOSException& e) {
         THROW(osmium::geos_geometry_error(e.what()));
     }
 }
开发者ID:KnockSoftware,项目名称:osrm-backend,代码行数:7,代码来源:geos.hpp


示例9: linestring_start

 void linestring_start() {
     try {
         m_coordinate_sequence.reset(m_geos_factory->getCoordinateSequenceFactory()->create(static_cast<size_t>(0), 2));
     } catch (geos::util::GEOSException& e) {
         THROW(osmium::geos_geometry_error(e.what()));
     }
 }
开发者ID:7ute,项目名称:osrm-backend,代码行数:7,代码来源:geos.hpp


示例10: multipolygon_inner_ring_finish

 void multipolygon_inner_ring_finish() {
     try {
         m_rings.emplace_back(m_geos_factory->createLinearRing(m_coordinate_sequence.release()));
     } catch (const geos::util::GEOSException& e) {
         THROW(osmium::geos_geometry_error(e.what()));
     }
 }
开发者ID:KnockSoftware,项目名称:osrm-backend,代码行数:7,代码来源:geos.hpp


示例11: linestring_finish

 linestring_type linestring_finish(std::size_t /* num_points */) {
     try {
         return linestring_type{m_geos_factory->createLineString(m_coordinate_sequence.release())};
     } catch (const geos::util::GEOSException& e) {
         THROW(osmium::geos_geometry_error(e.what()));
     }
 }
开发者ID:KnockSoftware,项目名称:osrm-backend,代码行数:7,代码来源:geos.hpp


示例12: multipolygon_outer_ring_start

 void multipolygon_outer_ring_start() {
     try {
         m_coordinate_sequence.reset(m_geos_factory.getCoordinateSequenceFactory()->create(static_cast<size_t>(0), 2));
     } catch (geos::util::GEOSException&) {
         THROW(osmium::geos_geometry_error());
     }
 }
开发者ID:Gozhack,项目名称:osrm-backend,代码行数:7,代码来源:geos.hpp


示例13: make_point

 point_type make_point(const osmium::geom::Coordinates& xy) const {
     try {
         return point_type{m_geos_factory->createPoint(geos::geom::Coordinate{xy.x, xy.y})};
     } catch (const geos::util::GEOSException& e) {
         THROW(osmium::geos_geometry_error(e.what()));
     }
 }
开发者ID:KnockSoftware,项目名称:osrm-backend,代码行数:7,代码来源:geos.hpp


示例14: linestring_finish

 linestring_type linestring_finish(size_t /* num_points */) {
     try {
         return linestring_type(m_geos_factory.createLineString(m_coordinate_sequence.release()));
     } catch (geos::util::GEOSException&) {
         THROW(osmium::geos_geometry_error());
     }
 }
开发者ID:Gozhack,项目名称:osrm-backend,代码行数:7,代码来源:geos.hpp


示例15:

		test_polygon_data() 
			: pm_(1), factory_(&pm_, 0), reader_(&factory_),
			empty_poly_(factory_.createPolygon()), poly_size_(7)
		{
			// Create non-empty LinearRing
			GeometryPtr geo = 0;
			geo = reader_.read("POLYGON((0 10, 5 5, 10 5, 15 10, 10 15, 5 15, 0 10))");
			poly_ = static_cast<PolygonPtr>(geo);
		}
开发者ID:asapnet,项目名称:geos,代码行数:9,代码来源:PolygonTest.cpp


示例16: multipolygon_finish

 multipolygon_type multipolygon_finish() {
     try {
         auto polygons = new std::vector<geos::geom::Geometry*>;
         std::transform(m_polygons.begin(), m_polygons.end(), std::back_inserter(*polygons), [](std::unique_ptr<geos::geom::Polygon>& p) {
             return p.release();
         });
         m_polygons.clear();
         return multipolygon_type{m_geos_factory->createMultiPolygon(polygons)};
     } catch (const geos::util::GEOSException& e) {
         THROW(osmium::geos_geometry_error(e.what()));
     }
 }
开发者ID:KnockSoftware,项目名称:osrm-backend,代码行数:12,代码来源:geos.hpp


示例17: multipolygon_polygon_finish

 void multipolygon_polygon_finish() {
     try {
         assert(!m_rings.empty());
         auto inner_rings = new std::vector<geos::geom::Geometry*>;
         std::transform(std::next(m_rings.begin(), 1), m_rings.end(), std::back_inserter(*inner_rings), [](std::unique_ptr<geos::geom::LinearRing>& r) {
             return r.release();
         });
         m_polygons.emplace_back(m_geos_factory->createPolygon(m_rings[0].release(), inner_rings));
         m_rings.clear();
     } catch (const geos::util::GEOSException& e) {
         THROW(osmium::geos_geometry_error(e.what()));
     }
 }
开发者ID:KnockSoftware,项目名称:osrm-backend,代码行数:13,代码来源:geos.hpp


示例18: pg

		bool
		pointsWithinDistance(vector<Coordinate>& coords, double dist)
		{
			// we expect some numerical instability here
			// OffsetPointGenerator could produce points
			// at *slightly* farther locations then
			// requested
			//
			dist *= 1.0000001;

			for (size_t i=0, n=coords.size(); i<n; ++i)
			{
				const Coordinate& c = coords[i];
				auto_ptr<Geometry> pg(gf.createPoint(c));
				double rdist =  g->distance(pg.get());
				if ( rdist > dist )
				{
					return false;
				}
			}
			return true;
		}
开发者ID:h4ck3rm1k3,项目名称:geos,代码行数:22,代码来源:OffsetPointGeneratorTest.cpp


示例19:

 ~test_linestring_data()
 {
     factory_.destroyGeometry(empty_line_);
     empty_line_ = 0;
 }
开发者ID:h4ck3rm1k3,项目名称:geos,代码行数:5,代码来源:LineStringTest.cpp


示例20: assert

		test_linestring_data()
			: pm_(1000), factory_(&pm_, 0), reader_(&factory_),
			empty_line_(factory_.createLineString(new geos::geom::CoordinateArraySequence()))
		{
            assert(0 != empty_line_);
        }
开发者ID:h4ck3rm1k3,项目名称:geos,代码行数:6,代码来源:LineStringTest.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ io::WKTReader类代码示例发布时间:2022-05-31
下一篇:
C++ geometrycollection::const_iterator类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap