Remove strange code

This commit is contained in:
Alexey Milovidov 2020-03-25 22:14:29 +03:00
parent 24e825e98b
commit 61778d2c03
2 changed files with 5 additions and 27 deletions

View File

@ -86,9 +86,10 @@ public:
using Segment = boost::geometry::model::segment<Point>;
explicit PointInPolygonWithGrid(const Polygon & polygon_, UInt16 grid_size_ = 8)
: grid_size(std::max<UInt16>(1, grid_size_)), polygon(polygon_) {}
void init();
: grid_size(std::max<UInt16>(1, grid_size_)), polygon(polygon_)
{
buildGrid();
}
/// True if bound box is empty.
bool hasEmptyBound() const { return has_empty_bound; }
@ -152,7 +153,6 @@ private:
CoordinateType y_scale;
bool has_empty_bound = false;
bool was_grid_built = false;
void buildGrid();
@ -201,8 +201,6 @@ public:
explicit PointInPolygonTrivial(const Polygon & polygon_)
: polygon(polygon_) {}
void init() {}
/// True if bound box is empty.
bool hasEmptyBound() const { return false; }
@ -233,15 +231,6 @@ UInt64 PointInPolygonWithGrid<CoordinateType>::getAllocatedBytes() const
return size;
}
template <typename CoordinateType>
void PointInPolygonWithGrid<CoordinateType>::init()
{
if (!was_grid_built)
buildGrid();
was_grid_built = true;
}
template <typename CoordinateType>
void PointInPolygonWithGrid<CoordinateType>::calcGridAttributes(
PointInPolygonWithGrid<CoordinateType>::Box & box)
@ -542,9 +531,7 @@ public:
using Polygon = boost::geometry::model::polygon<Point, false>;
using Box = boost::geometry::model::box<Point>;
explicit PointInPolygon(const Polygon & polygon_) : polygon(polygon_) {}
void init()
explicit PointInPolygon(const Polygon & polygon_) : polygon(polygon_)
{
boost::geometry::envelope(polygon, box);
@ -584,12 +571,8 @@ ColumnPtr pointInPolygon(const ColumnVector<T> & x, const ColumnVector<U> & y, P
{
auto size = x.size();
impl.init();
if (impl.hasEmptyBound())
{
return ColumnVector<UInt8>::create(size, 0);
}
auto result = ColumnVector<UInt8>::create(size);
auto & data = result->getData();
@ -598,9 +581,7 @@ ColumnPtr pointInPolygon(const ColumnVector<T> & x, const ColumnVector<U> & y, P
const auto & y_data = y.getData();
for (auto i : ext::range(0, size))
{
data[i] = static_cast<UInt8>(impl.contains(x_data[i], y_data[i]));
}
return result;
}

View File

@ -55,9 +55,6 @@ ColumnPtr callPointInPolygonImplWithPool(const IColumn & x, const IColumn & y, P
{
auto ptr = std::make_unique<PointInPolygonImpl>(polygon);
/// To allocate memory.
ptr->init();
ProfileEvents::increment(ProfileEvents::PolygonsAddedToPool);
ProfileEvents::increment(ProfileEvents::PolygonsInPoolAllocatedBytes, ptr->getAllocatedBytes());