예제 #1
0
파일: wkt.cpp 프로젝트: amutu/SFCGAL
std::auto_ptr< Geometry > readWkt( const char* str, size_t len )
{
	CharArrayBuffer buf( str, str + len );
	std::istream istr( &buf );
	WktReader wktReader( istr );
	return std::auto_ptr< Geometry >( wktReader.readGeometry() );
}
예제 #2
0
    void object::test<7>()
    {         
        GeomPtr geom;

        try
        {
            // use FLOATING model
            namespace ggm = geos::geom;
            namespace gio = geos::io;
            ggm::PrecisionModel pm(ggm::PrecisionModel::FLOATING);
            ggm::GeometryFactory gf(&pm);
            gio::WKTReader wktReader(&gf);
            const std::string str = " POINT (0 0) ";
            geom.reset(wktReader.read(str)); //HERE IT FAILS

            geos::geom::CoordinateSequence *coords = geom->getCoordinates();
            ensure_equals(coords->getDimension(), 2U);
            ensure_distance(coords->getX(0), 0.0, 1e-12);
            ensure_distance( coords->getY(0), 0.0, 1e-12);
            delete coords;
        }
        catch (const geos::util::IllegalArgumentException& ex)
        {
            ensure( "Did get expected exception" );
            ex.what();
        }
        catch (...)
        {
            ensure( !"Got unexpected exception" );
        }
    }
예제 #3
0
파일: wkt.cpp 프로젝트: amutu/SFCGAL
std::auto_ptr< Geometry > readWkt( const std::string & s )
{
	std::istringstream iss(s);
	WktReader wktReader(iss);
	return std::auto_ptr< Geometry >( wktReader.readGeometry() );
}
예제 #4
0
파일: wkt.cpp 프로젝트: amutu/SFCGAL
std::auto_ptr< Geometry > readWkt( std::istream & s )
{
	WktReader wktReader(s);
	return std::auto_ptr< Geometry >( wktReader.readGeometry() );
}