Beispiel #1
0
	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);
	}
Beispiel #2
0
    void object::test<38>()
	{
		// First centroid
		PointPtr point = poly_->getCentroid();
		ensure( point != nullptr );
		ensure( !point->isEmpty() );
		ensure_equals( point->getGeometryTypeId(), geos::geom::GEOS_POINT );

		CoordinateCPtr pointCoord = point->getCoordinate();
		ensure( pointCoord != nullptr );
		geos::geom::Coordinate pointCentr(*pointCoord);
		// FREE MEMORY
		factory_->destroyGeometry(point);

		// Second centroid
		geos::geom::Coordinate coordCentr;
		bool isCentroid = poly_->getCentroid(coordCentr);
		ensure( isCentroid );

		// Comparison of two centroids
		ensure_equals( "Check Polygon::getCentroid() functions.", coordCentr, pointCentr );
	}
Beispiel #3
0
	void object::test<8>()
	{
		PointPtr pt = factory_.createPoint();

		ensure( "createPoint() returned null pointer.", pt != 0 );
		ensure( "createPoint() returned non-empty point.", pt->isEmpty() );
		ensure( pt->isSimple() );
		ensure( pt->isValid() );
		ensure( pt->getCentroid() == 0 );
		ensure( pt->getCoordinate() == 0 );

		GeometryPtr geo = 0;
		geo = pt->getEnvelope();
		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(), 0u );	
		ensure_equals( pt->getLength(), 0.0 );
		ensure_equals( pt->getArea(), 0.0 );

		// FREE MEMORY
		factory_.destroyGeometry(pt);
	}