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


C++ GeomPtr::get方法代码示例

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


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

示例1: snapTrans

/*public*/
std::auto_ptr<geom::Geometry>
GeometrySnapper::snapToSelf(double snapTolerance, bool cleanResult)
{

	using std::auto_ptr;
	using geom::util::GeometryTransformer;
	
	// Get snap points
	auto_ptr<Coordinate::ConstVect> snapPts=extractTargetCoordinates(srcGeom);

	// Apply a SnapTransformer to source geometry
	// (we need a pointer for dynamic polymorphism)
	auto_ptr<GeometryTransformer> snapTrans(new SnapTransformer(snapTolerance, *snapPts));

	GeomPtr result = snapTrans->transform(&srcGeom);
	
	if (cleanResult && ( dynamic_cast<const Polygon*>(result.get()) ||
	                     dynamic_cast<const MultiPolygon*>(result.get()) ) )
	{
		// TODO: use better cleaning approach
		result.reset(result->buffer(0));
	}

	return result;
}
开发者ID:drownedout,项目名称:datamap,代码行数:26,代码来源:GeometrySnapper.cpp

示例2: doLineClipTest

 void doLineClipTest(const char* inputWKT, const std::string& expectedWKT, const Rectangle& rect, double tolerance=0)
 {
   GeomPtr g = readWKT(inputWKT);
   ensure(g.get());
   GeomPtr obt = RectangleIntersection::clipBoundary(*g,rect);
   ensure(obt.get());
   bool ok = isEqual(*readWKT(expectedWKT), *obt, tolerance);
   ensure(ok);
 }
开发者ID:ryandavid,项目名称:rotobox,代码行数:9,代码来源:RectangleIntersectionTest.cpp

示例3: geom

	void object::test<1>()
	{         
        GeomPtr geom ( wktreader.read("POINT(-117 33)") );
        std::string  result;

        wktwriter.setTrim(false);
        result = wktwriter.write( geom.get() );

        ensure_equals( result , "POINT (-117.000 33.000)" );

        wktwriter.setTrim(true);
        result = wktwriter.write( geom.get() );

        ensure_equals( result , "POINT (-117 33)" );
    }
开发者ID:AvlWx2014,项目名称:basemap,代码行数:15,代码来源:WKTWriterTest.cpp

示例4: doClipTest

        void doClipTest(const char* inputWKT, const std::string& expectedWKT, const Rectangle& rect, double tolerance=0)
        {
          GeomPtr g = readWKT(inputWKT);
          ensure(g.get());
          GeomPtr obt = RectangleIntersection::clip(*g,rect);
          ensure(obt.get());
          bool ok = isEqual(*readWKT(expectedWKT), *obt, tolerance);
          ensure(ok);
// Compare with GEOSIntersection output
#if 0
          GeomPtr g2 ( rect.toPolygon(*g->getFactory()) );
          obt.reset(g->intersection(g2.get()));
          ensure(obt.get());
          ok = isEqual(*readWKT(expectedWKT), *obt, tolerance);
          ensure(ok);
#endif
        }
开发者ID:ryandavid,项目名称:rotobox,代码行数:17,代码来源:RectangleIntersectionTest.cpp

示例5: runLineSequencer

    void runLineSequencer(const char * const * inputWKT,
                const std::string& expectedWKT)
    {
      readWKT(inputWKT, inpGeoms);

      LineSequencer sequencer;
      sequencer.add(inpGeoms);

      if ( ! sequencer.isSequenceable() ) {
      	ensure( expectedWKT.empty() );
      } else {  
        GeomPtr expected = readWKT(expectedWKT);
        GeomPtr result ( sequencer.getSequencedLineStrings() );
        ensure( expected->equalsExact( result.get() ) );

        bool isSequenced = LineSequencer::isSequenced(result.get());
        ensure( isSequenced );
      }
    }
开发者ID:AvlWx2014,项目名称:basemap,代码行数:19,代码来源:LineSequencerTest.cpp

示例6: fromWKT

    void object::test<1>()
    {
	GeomPtr geom = fromWKT("LINEARRING (0 0, 0 10, 10 10, 10 0, 0 0)");
	LinearRing* ring_chk = dynamic_cast<LinearRing*>(geom.get());
	ensure(nullptr != ring_chk);
	LinearRing& ring = *ring_chk;
	//cout << ring.toString() << endl;
	updateNonClosedRing(ring);
	//cout << ring.toString() << endl;
	checkIsValid(*geom, false);
    }
开发者ID:mwtoews,项目名称:libgeos,代码行数:11,代码来源:ValidClosedRingTest.cpp

示例7: rdr

int
main()
{
	PrecisionModel pm;
	GeometryFactory::Ptr gf = GeometryFactory::create(&pm);
	WKTReader rdr(gf.get());

	string inputWKT =
        "POLYGON ((110 320, 190 220, 60 200, 180 120, 120 40, 290 150, 410 40, 410 230, 500 340, 320 310, 260 370, 220 310, 110 320), (220 260, 250 180, 290 220, 360 150, 350 250, 260 280, 220 260))";

        GeomPtr base ( rdr.read(inputWKT) );
	run(base.get());
}
开发者ID:mwtoews,项目名称:libgeos,代码行数:13,代码来源:IteratedBufferStressTest.cpp

示例8: line

    void object::test<1>()
    {
	CoordinateSequence* cs = new CoordinateArraySequence();
	cs->add(Coordinate(0.0, 0.0));
	cs->add(Coordinate(1.0, DoubleNotANumber));
	GeomPtr line ( factory_.createLineString(cs) );


	IsValidOp isValidOp(line.get());
	bool valid = isValidOp.isValid();

	TopologyValidationError* err = isValidOp.getValidationError();
    ensure(0 != err);
    const Coordinate& errCoord = err->getCoordinate();

	ensure_equals( err->getErrorType(),
	               TopologyValidationError::eInvalidCoordinate );

	ensure(0 != ISNAN(errCoord.y));
	ensure_equals(valid, false);
    }
开发者ID:AvlWx2014,项目名称:basemap,代码行数:21,代码来源:IsValidTest.cpp

示例9: q

	void object::test<13>()
	{
    Coordinate p1(-123456789, -40);
    Coordinate p2(381039468754763.0, 123456789);
    Coordinate q(0, 0);

    using geos::geom::CoordinateSequence;
    using geos::geom::GeometryFactory;
    using geos::geom::LineString;

    GeometryFactory::Ptr factory = GeometryFactory::create();
    CoordinateSequence* cs = new CoordinateArraySequence();
    cs->add(p1);
    cs->add(p2);

    GeomPtr l ( factory->createLineString(cs) );
    GeomPtr p ( factory->createPoint(q) );
    ensure(!l->intersects(p.get()));

    ensure(!CGAlgorithms::isOnLine(q, cs));
    ensure_equals(CGAlgorithms::computeOrientation(p1, p2, q), -1);

	}
开发者ID:nextgis-borsch,项目名称:lib_geos,代码行数:23,代码来源:RobustLineIntersectorTest.cpp

示例10: wkt

	//
	// Test Cases
	//

	// 1 - PolygonNoReduction
	template<>
	template<>
	void object::test<1>()
	{         
		std::string wkt("POLYGON((20 220, 40 220, 60 220, 80 220, 100 220, \
					120 220, 140 220, 140 180, 100 180, 60 180, 20 180, 20 220))");

		GeomPtr g(wktreader.read(wkt));

		GeomPtr simplified = DouglasPeuckerSimplifier::simplify(
			g.get(), 10.0);

		ensure( simplified->isValid() );

		// topology is unchanged
		ensure( simplified->equals(g.get()) );
	}

	// 2 - PolygonReductionWithSplit
	template<>
	template<>
	void object::test<2>()
	{         
		std::string wkt_in("POLYGON ((40 240, 160 241, 280 240, 280 160, \
					160 240, 40 140, 40 240))");
		
开发者ID:asapnet,项目名称:geos,代码行数:30,代码来源:DouglasPeuckerSimplifierTest.cpp

示例11: wkt

	//
	// Test Cases
	//

	// PolygonNoReduction
	template<>
	template<>
	void object::test<1>()
	{         
		std::string wkt("POLYGON((20 220, 40 220, 60 220, 80 220, \
                    100 220, 120 220, 140 220, 140 180, 100 180, \
                    60 180, 20 180, 20 220))");

		GeomPtr g(wktreader.read(wkt));
		GeomPtr simplified = TopologyPreservingSimplifier::simplify(g.get(), 10.0);

		ensure( "Simplified geometry is invalid!", simplified->isValid() );
		ensure( "Simplified and original geometry inequal", simplified->equals(g.get()) );
        ensure_equals_geometry( g.get(), simplified.get() );
	}

    // PolygonNoReductionWithConflicts
	template<>
	template<>
	void object::test<2>()
	{
        std::string wkt("POLYGON ((40 240, 160 241, 280 240, 280 160, \
                        160 240, 40 140, 40 240))");
    
        GeomPtr g(wktreader.read(wkt));
开发者ID:Joe-xXx,项目名称:geos,代码行数:30,代码来源:TopologyPreservingSimplifierTest.cpp

示例12: runIsSequenced

 void runIsSequenced(const std::string& inputWKT, bool exp)
 {
   GeomPtr g = readWKT(inputWKT);
   bool isSequenced = LineSequencer::isSequenced(g.get());
   ensure_equals( isSequenced, exp );
 }
开发者ID:AvlWx2014,项目名称:basemap,代码行数:6,代码来源:LineSequencerTest.cpp

示例13: if

/*public*/
std::unique_ptr<geom::Geometry>
UnaryUnionOp::Union()
{
    using geom::Puntal;
    typedef std::unique_ptr<geom::Geometry> GeomPtr;

    GeomPtr ret;
    if(! geomFact) {
        return ret;
    }

    /**
     * For points and lines, only a single union operation is
     * required, since the OGC model allowings self-intersecting
     * MultiPoint and MultiLineStrings.
     * This is not the case for polygons, so Cascaded Union is required.
     */

    GeomPtr unionPoints;
    if(!points.empty()) {
        GeomPtr ptGeom = geomFact->buildGeometry(points.begin(),
                         points.end());
        unionPoints = unionNoOpt(*ptGeom);
    }

    GeomPtr unionLines;
    if(!lines.empty()) {
        /* JTS compatibility NOTE:
         * we use cascaded here for robustness [1]
         * but also add a final unionNoOpt step to deal with
         * self-intersecting lines [2]
         *
         * [1](http://trac.osgeo.org/geos/ticket/392
         * [2](http://trac.osgeo.org/geos/ticket/482
         *
         */
        unionLines.reset(CascadedUnion::Union(lines.begin(),
                                              lines.end()));
        if(unionLines.get()) {
            unionLines = unionNoOpt(*unionLines);
        }
    }

    GeomPtr unionPolygons;
    if(!polygons.empty()) {
        unionPolygons.reset(CascadedPolygonUnion::Union(polygons.begin(),
                            polygons.end()));
    }

    /**
     * Performing two unions is somewhat inefficient,
     * but is mitigated by unioning lines and points first
     */

    GeomPtr unionLA = unionWithNull(std::move(unionLines), std::move(unionPolygons));
    assert(!unionLines.get());
    assert(!unionPolygons.get());

    if(! unionPoints.get()) {
        ret = std::move(unionLA);
        assert(!unionLA.get());
    }
    else if(! unionLA.get()) {
        ret = std::move(unionPoints);
        assert(!unionPoints.get());
    }
    else {
        Puntal& up = dynamic_cast<Puntal&>(*unionPoints);
        ret = PointGeometryUnion::Union(up, *unionLA);
    }

    if(! ret.get()) {
        ret.reset(geomFact->createGeometryCollection());
    }

    return ret;

}
开发者ID:libgeos,项目名称:libgeos,代码行数:79,代码来源:UnaryUnionOp.cpp


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