void object::test<16>() { const std::size_t size = 5; CoordArrayPtr coords = new geos::geom::CoordinateArraySequence(size); ensure( coords != 0 ); ensure_equals( coords->getSize(), size ); LineStringPtr line = factory_.createLineString(coords); ensure( "createLineString() returned null pointer.", line != 0 ); ensure( "createLineString() returned empty point.", !line->isEmpty() ); ensure( line->isSimple() ); ensure( line->getCoordinate() != 0 ); // TODO - mloskot - is this correct? //ensure( line->isValid() ); ensure_equals( line->getGeometryTypeId(), geos::geom::GEOS_LINESTRING ); ensure_equals( line->getDimension(), geos::geom::Dimension::L ); ensure_equals( line->getBoundaryDimension(), geos::geom::Dimension::False ); ensure_equals( line->getNumPoints(), size ); ensure_equals( line->getLength(), 0.0 ); ensure_equals( line->getArea(), 0.0 ); // FREE MEMORY factory_.destroyGeometry(line); }
void object::test<30>() { using geos::geom::Coordinate; const std::size_t size = 5; const std::size_t lineSize = 2; std::vector<GeometryPtr> lines; for (std::size_t i = 0; i < size; ++i) { const std::size_t factor = i * i; CoordArrayPtr coords = new geos::geom::CoordinateArraySequence(lineSize); ensure( coords != 0 ); coords->setAt(Coordinate(0 + factor, 0 + factor), 0); coords->setAt(Coordinate(5 + factor, 5 + factor), 1); ensure_equals( coords->getSize(), lineSize ); LineStringPtr line = factory_.createLineString(coords); ensure( "createLineString() returned empty point.", !line->isEmpty() ); ensure_equals( line->getNumPoints(), lineSize ); ensure( line->isSimple() ); ensure( line->getCoordinate() != 0 ); ensure_equals( line->getGeometryTypeId(), geos::geom::GEOS_LINESTRING ); lines.push_back(line); } MultiLineStringPtr mls = factory_.createMultiLineString(lines); ensure( mls != 0 ); // TODO - mloskot - why isValid() returns false? //ensure( mls->isValid() ); ensure_equals( mls->getNumGeometries(), size ); ensure_equals( mls->getGeometryTypeId(), geos::geom::GEOS_MULTILINESTRING ); // FREE MEMORY factory_.destroyGeometry(mls); std::vector<GeometryPtr>::const_iterator it; for (it = lines.begin(); it != lines.end(); ++it) { delete (*it); } }
void object::test<17>() { const std::size_t size = 5; geos::geom::CoordinateArraySequence coords(size); ensure_equals( coords.getSize(), size ); LineStringPtr line = factory_.createLineString(coords); ensure( "createLineString() returned empty point.", !line->isEmpty() ); ensure_equals( line->getNumPoints(), size ); ensure( line->isSimple() ); ensure( line->getCoordinate() != 0 ); ensure_equals( line->getGeometryTypeId(), geos::geom::GEOS_LINESTRING ); ensure_equals( line->getDimension(), geos::geom::Dimension::L ); ensure_equals( line->getBoundaryDimension(), geos::geom::Dimension::False ); ensure_equals( line->getNumPoints(), size ); ensure_equals( line->getLength(), 0.0 ); ensure_equals( line->getArea(), 0.0 ); // FREE MEMORY factory_.destroyGeometry(line); }