Changed strategy to "Franklin"

This commit is contained in:
Alexey Milovidov 2020-05-23 00:47:31 +03:00
parent 5e21a06559
commit d2cd941f47
2 changed files with 12 additions and 9 deletions

View File

@ -107,7 +107,7 @@ private:
/// Simple algorithm with bounding box. /// Simple algorithm with bounding box.
template <typename CoordinateType> template <typename Strategy, typename CoordinateType>
class PointInPolygon class PointInPolygon
{ {
public: public:
@ -136,7 +136,7 @@ public:
if (!boost::geometry::within(point, box)) if (!boost::geometry::within(point, box))
return false; return false;
return boost::geometry::covered_by(point, polygon); return boost::geometry::covered_by(point, polygon, strategy);
} }
UInt64 getAllocatedBytes() const { return sizeof(*this); } UInt64 getAllocatedBytes() const { return sizeof(*this); }
@ -145,6 +145,7 @@ private:
const Polygon & polygon; const Polygon & polygon;
Box box; Box box;
bool has_empty_bound = false; bool has_empty_bound = false;
Strategy strategy;
}; };

View File

@ -42,16 +42,16 @@ namespace ErrorCodes
} }
template <typename PointInConstPolygonImpl, typename PointInNonConstPolygonImpl>
class FunctionPointInPolygon : public IFunction
{
public:
using CoordinateType = Float64; using CoordinateType = Float64;
using Point = boost::geometry::model::d2::point_xy<CoordinateType>; using Point = boost::geometry::model::d2::point_xy<CoordinateType>;
using Polygon = boost::geometry::model::polygon<Point, false>; using Polygon = boost::geometry::model::polygon<Point, false>;
using Box = boost::geometry::model::box<Point>; using Box = boost::geometry::model::box<Point>;
template <typename PointInConstPolygonImpl, typename PointInNonConstPolygonImpl>
class FunctionPointInPolygon : public IFunction
{
public:
static inline const char * name = "pointInPolygon"; static inline const char * name = "pointInPolygon";
explicit FunctionPointInPolygon(bool validate_) : validate(validate_) {} explicit FunctionPointInPolygon(bool validate_) : validate(validate_) {}
@ -381,7 +381,9 @@ private:
void registerFunctionPointInPolygon(FunctionFactory & factory) void registerFunctionPointInPolygon(FunctionFactory & factory)
{ {
factory.registerFunction<FunctionPointInPolygon<PointInPolygonWithGrid<Float64>, PointInPolygon<Float64>>>(); factory.registerFunction<FunctionPointInPolygon<
PointInPolygonWithGrid<Float64>,
PointInPolygon<boost::geometry::strategy::within::franklin<Point>, Float64>>>();
} }
} }