示例#1
0
 point_type make_point(const osmium::geom::Coordinates& xy) const {
     try {
         return point_type{m_geos_factory->createPoint(geos::geom::Coordinate{xy.x, xy.y})};
     } catch (const geos::util::GEOSException& e) {
         THROW(osmium::geos_geometry_error(e.what()));
     }
 }
示例#2
0
 point_type make_point(const osmium::geom::Coordinates& xy) const {
     try {
         return point_type(m_geos_factory.createPoint(geos::geom::Coordinate(xy.x, xy.y)));
     } catch (geos::util::GEOSException&) {
         THROW(osmium::geos_geometry_error());
     }
 }
 void create_discs(geos::geom::GeometryFactory& gf, int num, double radius, 
     std::vector<geos::geom::Polygon*>* g)
 {
     for (int i = 0; i < num; ++i) {
         for (int j = 0; j < num; ++j) {
             std::auto_ptr<geos::geom::Point> pt(
                 gf.createPoint(geos::geom::Coordinate(i, j)));
             g->push_back(dynamic_cast<geos::geom::Polygon*>(pt->buffer(radius)));
         }
     }
 }
		bool
		pointsWithinDistance(vector<Coordinate>& coords, double dist)
		{
			// we expect some numerical instability here
			// OffsetPointGenerator could produce points
			// at *slightly* farther locations then
			// requested
			//
			dist *= 1.0000001;

			for (size_t i=0, n=coords.size(); i<n; ++i)
			{
				const Coordinate& c = coords[i];
				auto_ptr<Geometry> pg(gf.createPoint(c));
				double rdist =  g->distance(pg.get());
				if ( rdist > dist )
				{
					return false;
				}
			}
			return true;
		}