21 #ifndef OPHIDIAN_SRC_GEOMETRY_H
22 #define OPHIDIAN_SRC_GEOMETRY_H
24 #include <boost/geometry/geometries/point_xy.hpp>
25 #include <boost/geometry/geometries/polygon.hpp>
26 #include <boost/geometry/geometries/multi_polygon.hpp>
28 #include <boost/geometry/strategies/transform/matrix_transformers.hpp>
29 #include <boost/geometry/algorithms/correct.hpp>
30 #include <boost/geometry/algorithms/transform.hpp>
31 #include <boost/geometry/algorithms/equals.hpp>
33 #include <boost/geometry/io/wkt/wkt.hpp>
40 template<
class Coordinate_Type>
41 using point =
typename boost::geometry::model::d2::point_xy<Coordinate_Type>;
42 template<
class Po
int_Type>
43 using polygon =
typename boost::geometry::model::polygon<Point_Type>;
44 template<
class Polygon_Type>
45 using multi_polygon =
typename boost::geometry::model::multi_polygon<Polygon_Type>;
46 template<
class Po
int_Type>
47 using box =
typename boost::geometry::model::box<Point_Type>;
49 template<
class Geometry,
class CoordinateType>
50 void translate(Geometry geometry, point<CoordinateType> point,
52 boost::geometry::strategy::transform::translate_transformer<CoordinateType,
53 2, 2> translate(point.x(), point.y());
54 boost::geometry::transform(geometry, result, translate);
58 template<
class Geometry,
class CoordinateType>
59 void scale(Geometry geometry, point<CoordinateType> point,
61 boost::geometry::strategy::transform::scale_transformer<CoordinateType,
62 2, 2> translate(point.x(), point.y());
63 boost::geometry::transform(geometry, result, translate);
67 template<
class CoordinateType>
68 CoordinateType manhattan_distance(
const point<CoordinateType> & p1,
const point<CoordinateType> & p2)
70 return std::abs(p2.y()-p1.y())+std::abs(p2.x()-p1.x());
74 using boost::geometry::equals;
75 using boost::geometry::wkt;
77 using boost::geometry::correct;
78 using boost::geometry::append;
79 using boost::geometry::envelope;
80 using boost::geometry::add_point;
86 #endif //OPHIDIAN_SRC_GEOMETRY_H