mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-22 01:30:51 +00:00
Remove strange code
This commit is contained in:
parent
24e825e98b
commit
61778d2c03
@ -86,9 +86,10 @@ public:
|
|||||||
using Segment = boost::geometry::model::segment<Point>;
|
using Segment = boost::geometry::model::segment<Point>;
|
||||||
|
|
||||||
explicit PointInPolygonWithGrid(const Polygon & polygon_, UInt16 grid_size_ = 8)
|
explicit PointInPolygonWithGrid(const Polygon & polygon_, UInt16 grid_size_ = 8)
|
||||||
: grid_size(std::max<UInt16>(1, grid_size_)), polygon(polygon_) {}
|
: grid_size(std::max<UInt16>(1, grid_size_)), polygon(polygon_)
|
||||||
|
{
|
||||||
void init();
|
buildGrid();
|
||||||
|
}
|
||||||
|
|
||||||
/// True if bound box is empty.
|
/// True if bound box is empty.
|
||||||
bool hasEmptyBound() const { return has_empty_bound; }
|
bool hasEmptyBound() const { return has_empty_bound; }
|
||||||
@ -152,7 +153,6 @@ private:
|
|||||||
CoordinateType y_scale;
|
CoordinateType y_scale;
|
||||||
|
|
||||||
bool has_empty_bound = false;
|
bool has_empty_bound = false;
|
||||||
bool was_grid_built = false;
|
|
||||||
|
|
||||||
void buildGrid();
|
void buildGrid();
|
||||||
|
|
||||||
@ -201,8 +201,6 @@ public:
|
|||||||
explicit PointInPolygonTrivial(const Polygon & polygon_)
|
explicit PointInPolygonTrivial(const Polygon & polygon_)
|
||||||
: polygon(polygon_) {}
|
: polygon(polygon_) {}
|
||||||
|
|
||||||
void init() {}
|
|
||||||
|
|
||||||
/// True if bound box is empty.
|
/// True if bound box is empty.
|
||||||
bool hasEmptyBound() const { return false; }
|
bool hasEmptyBound() const { return false; }
|
||||||
|
|
||||||
@ -233,15 +231,6 @@ UInt64 PointInPolygonWithGrid<CoordinateType>::getAllocatedBytes() const
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename CoordinateType>
|
|
||||||
void PointInPolygonWithGrid<CoordinateType>::init()
|
|
||||||
{
|
|
||||||
if (!was_grid_built)
|
|
||||||
buildGrid();
|
|
||||||
|
|
||||||
was_grid_built = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename CoordinateType>
|
template <typename CoordinateType>
|
||||||
void PointInPolygonWithGrid<CoordinateType>::calcGridAttributes(
|
void PointInPolygonWithGrid<CoordinateType>::calcGridAttributes(
|
||||||
PointInPolygonWithGrid<CoordinateType>::Box & box)
|
PointInPolygonWithGrid<CoordinateType>::Box & box)
|
||||||
@ -542,9 +531,7 @@ public:
|
|||||||
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>;
|
||||||
|
|
||||||
explicit PointInPolygon(const Polygon & polygon_) : polygon(polygon_) {}
|
explicit PointInPolygon(const Polygon & polygon_) : polygon(polygon_)
|
||||||
|
|
||||||
void init()
|
|
||||||
{
|
{
|
||||||
boost::geometry::envelope(polygon, box);
|
boost::geometry::envelope(polygon, box);
|
||||||
|
|
||||||
@ -584,12 +571,8 @@ ColumnPtr pointInPolygon(const ColumnVector<T> & x, const ColumnVector<U> & y, P
|
|||||||
{
|
{
|
||||||
auto size = x.size();
|
auto size = x.size();
|
||||||
|
|
||||||
impl.init();
|
|
||||||
|
|
||||||
if (impl.hasEmptyBound())
|
if (impl.hasEmptyBound())
|
||||||
{
|
|
||||||
return ColumnVector<UInt8>::create(size, 0);
|
return ColumnVector<UInt8>::create(size, 0);
|
||||||
}
|
|
||||||
|
|
||||||
auto result = ColumnVector<UInt8>::create(size);
|
auto result = ColumnVector<UInt8>::create(size);
|
||||||
auto & data = result->getData();
|
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();
|
const auto & y_data = y.getData();
|
||||||
|
|
||||||
for (auto i : ext::range(0, size))
|
for (auto i : ext::range(0, size))
|
||||||
{
|
|
||||||
data[i] = static_cast<UInt8>(impl.contains(x_data[i], y_data[i]));
|
data[i] = static_cast<UInt8>(impl.contains(x_data[i], y_data[i]));
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -55,9 +55,6 @@ ColumnPtr callPointInPolygonImplWithPool(const IColumn & x, const IColumn & y, P
|
|||||||
{
|
{
|
||||||
auto ptr = std::make_unique<PointInPolygonImpl>(polygon);
|
auto ptr = std::make_unique<PointInPolygonImpl>(polygon);
|
||||||
|
|
||||||
/// To allocate memory.
|
|
||||||
ptr->init();
|
|
||||||
|
|
||||||
ProfileEvents::increment(ProfileEvents::PolygonsAddedToPool);
|
ProfileEvents::increment(ProfileEvents::PolygonsAddedToPool);
|
||||||
ProfileEvents::increment(ProfileEvents::PolygonsInPoolAllocatedBytes, ptr->getAllocatedBytes());
|
ProfileEvents::increment(ProfileEvents::PolygonsInPoolAllocatedBytes, ptr->getAllocatedBytes());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user