本文整理汇总了C++中CoordArrayPtr::add方法的典型用法代码示例。如果您正苦于以下问题:C++ CoordArrayPtr::add方法的具体用法?C++ CoordArrayPtr::add怎么用?C++ CoordArrayPtr::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CoordArrayPtr
的用法示例。
在下文中一共展示了CoordArrayPtr::add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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 );
}
示例2: 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());
}
}
示例3: ls
void object::test<2>()
{
using geos::geom::Coordinate;
// Non-empty sequence of coordiantes
const size_t size3 = 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(), size3 );
// Create non-empty linstring instance
LineStringAutoPtr ls(factory_.createLineString(pseq));
ensure( !ls->isEmpty() );
ensure( ls->isSimple() );
ensure( ls->isValid() );
ensure( !ls->isClosed() );
ensure( !ls->isRing() );
GeometryPtr geo = 0;
geo = ls->getEnvelope();
ensure( geo != 0 );
ensure( !geo->isEmpty() );
factory_.destroyGeometry(geo);
geo = ls->getBoundary();
ensure( geo != 0 );
ensure( !geo->isEmpty() );
factory_.destroyGeometry(geo);
geo = ls->convexHull();
ensure( geo != 0 );
ensure( !geo->isEmpty() );
factory_.destroyGeometry(geo);
ensure_equals( ls->getGeometryTypeId(), geos::geom::GEOS_LINESTRING );
ensure_equals( ls->getDimension(), geos::geom::Dimension::L );
ensure_equals( ls->getBoundaryDimension(), geos::geom::Dimension::P );
ensure_equals( ls->getCoordinateDimension(), 3 );
ensure_equals( ls->getNumPoints(), size3 );
ensure_equals( ls->getArea(), 0.0 );
ensure( ls->getLength() != 0.0 );
}
示例4: coord
void object::test<10>()
{
geos::geom::Coordinate coord(x_, y_, z_);
CoordArrayPtr sequence = new geos::geom::CoordinateArraySequence();
ensure( "sequence is null pointer.", sequence != 0 );
sequence->add(coord);
PointPtr pt = factory_.createPoint(sequence);
ensure( "createPoint() returned null pointer.", pt != 0 );
ensure( "createPoint() returned empty point.", !pt->isEmpty() );
ensure( pt->isSimple() );
ensure( pt->isValid() );
ensure( pt->getCoordinate() != 0 );
CoordinateCPtr pcoord = pt->getCoordinate();
ensure( pcoord != 0 );
ensure_equals( pcoord->x, x_ );
ensure_equals( pcoord->y, y_ );
ensure_equals( pcoord->z, z_ );
GeometryPtr geo = 0;
geo = pt->getEnvelope();
ensure( geo != 0 );
ensure( !geo->isEmpty() );
factory_.destroyGeometry(geo);
geo = pt->getCentroid();
ensure( geo != 0 );
ensure( !geo->isEmpty() );
factory_.destroyGeometry(geo);
geo = pt->getBoundary();
ensure( geo != 0 );
ensure( geo->isEmpty() );
factory_.destroyGeometry(geo);
geo = pt->convexHull();
ensure( geo != 0 );
ensure( !geo->isEmpty() );
factory_.destroyGeometry(geo);
ensure_equals( pt->getGeometryTypeId(), geos::geom::GEOS_POINT );
ensure_equals( pt->getDimension(), geos::geom::Dimension::P );
ensure_equals( pt->getBoundaryDimension(), geos::geom::Dimension::False );
ensure_equals( pt->getNumPoints(), 1u );
ensure_equals( pt->getLength(), 0.0 );
ensure_equals( pt->getArea(), 0.0 );
// FREE MEMORY
factory_.destroyGeometry(pt);
}