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


C++ CoordArrayPtr::size方法代码示例

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


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

示例1: ls

    void object::test<3>()
    {
		// Single-element sequence of coordiantes
		CoordArrayPtr pseq = 0;
		try
		{
			pseq = new geos::geom::CoordinateArraySequence();
			ensure( "sequence is null pointer.", pseq != 0 );
			pseq->add(geos::geom::Coordinate(0, 0, 0));
			ensure_equals( pseq->size(), 1u );

			// Create incomplete linstring
			LineStringAutoPtr ls(factory_.createLineString(pseq));
			fail("IllegalArgumentException expected.");
		}
		catch (geos::util::IllegalArgumentException const& e)
		{
			// TODO - mloskot - is waiting for "exception-safety" and bugs resolution
			// If removed, memory 3 leaks occur
			//delete pseq;

			const char* msg = e.what(); // OK
			ensure( msg != 0 );
		}
	}
开发者ID:h4ck3rm1k3,项目名称:geos,代码行数:25,代码来源:LineStringTest.cpp

示例2: examplar

    void object::test<4>()
    {
		using geos::geom::Coordinate;

		// Non-empty sequence of coordiantes
		const size_t size = 3;

		CoordArrayPtr pseq = new geos::geom::CoordinateArraySequence();
		ensure( "sequence is null pointer.", pseq != 0 );
		
		pseq->add(Coordinate(0, 0, 0));
		pseq->add(Coordinate(5, 5, 5));
		pseq->add(Coordinate(10, 10, 10));

		ensure_equals( pseq->size(), size );

		// Create examplar of linstring instance
		LineStringAutoPtr examplar(factory_.createLineString(pseq));

		// Create copy
		LineStringAutoPtr copy(dynamic_cast<geos::geom::LineString*>(examplar->clone()));

		ensure( 0 != copy.get() );

		ensure( !copy->isEmpty() );
		ensure( copy->isSimple() );
		ensure( copy->isValid() );

		ensure( !copy->isClosed() );
		ensure( !copy->isRing() );

		GeometryPtr geo = 0;
		geo = copy->getEnvelope();
		ensure( geo != 0 );
		ensure( !geo->isEmpty() );
		factory_.destroyGeometry(geo);

		geo = copy->getBoundary();
		ensure( geo != 0 );
		ensure( !geo->isEmpty() );
		factory_.destroyGeometry(geo);

		geo = copy->convexHull();
		ensure( geo != 0 );
		ensure( !geo->isEmpty() );
		factory_.destroyGeometry(geo);

		ensure_equals( copy->getGeometryTypeId(), geos::geom::GEOS_LINESTRING );
		ensure_equals( copy->getDimension(), geos::geom::Dimension::L );
		ensure_equals( copy->getBoundaryDimension(), geos::geom::Dimension::P );
		ensure_equals( copy->getNumPoints(), size );
		ensure_equals( copy->getArea(), 0.0 );
		ensure( copy->getLength() != 0.0 );
	}
开发者ID:h4ck3rm1k3,项目名称:geos,代码行数:54,代码来源:LineStringTest.cpp

示例3: poly

    void object::test<1>()
    {
		using geos::geom::Coordinate;

		// Create non-empty Coordiantes sequence for Exterior LinearRing
		const size_t size = 7;
		CoordArrayPtr coords = new geos::geom::CoordinateArraySequence();
		ensure( "sequence is null pointer.", coords != nullptr );

		coords->add(Coordinate(0, 10));
		coords->add(Coordinate(5, 5));
		coords->add(Coordinate(10, 5));
		coords->add(Coordinate(15, 10));
		coords->add(Coordinate(10, 15));
		coords->add(Coordinate(5, 15));
		coords->add(Coordinate(0, 10));

		ensure_equals( coords->size(), size );

		try
		{
			// Create non-empty LinearRing instance
			geos::geom::LinearRing ring(coords, factory_.get());
			ensure( !ring.isEmpty() );
			ensure( ring.isClosed() );
			ensure( ring.isRing() );
			ensure( ring.isSimple() );

			// Exterior (clone is required here because Polygon takes ownership)
			GeometryPtr geo = ring.clone();
			LinearRingPtr exterior = dynamic_cast<LinearRingPtr>(geo);

			// Create non-empty Polygon
			//geos::geom::Polygon poly(exterior, 0, &factory_);
			PolygonAutoPtr poly(factory_->createPolygon(exterior, nullptr));

			ensure( !poly->isEmpty() );
			ensure( poly->isSimple() );
			ensure( poly->isValid() );

			ensure_equals( poly->getNumGeometries(), 1u );
			ensure_equals( poly->getNumInteriorRing(), 0u );
			ensure_equals( poly->getNumPoints(), size );
		}
		catch (geos::util::IllegalArgumentException const& e)
		{
			fail(e.what());
		}

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


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