[map] use feature_algo for center calculaiton

This commit is contained in:
Darafei Praliaskouski 2013-05-11 19:42:35 +03:00 committed by Alex Zolotarev
parent 370e81d73e
commit 0b1a87c04c
2 changed files with 8 additions and 7 deletions

View file

@ -4,6 +4,7 @@
#include "drawer.hpp"
#include "../indexer/feature_impl.hpp"
#include "../indexer/feature_algo.hpp"
namespace fwork
@ -98,6 +99,10 @@ namespace fwork
functor_t fun(p);
f.ForEachTriangleExRef(fun, m_zoom);
if (fi.m_styler.m_hasPointStyles)
fun.SetCenter(feature::GetCenter(f, m_zoom));
if (fun.IsExist())
{
isExist = true;

View file

@ -296,7 +296,6 @@ namespace gp
/// Adapter for points filtering, before they will go for processing
template <class TBase> class filter_screenpts_adapter : public TBase
{
size_t m_count;
m2::PointD m_prev, m_center;
static bool equal_scr_pts(m2::PointD const & p1, m2::PointD const & p2)
@ -314,7 +313,7 @@ namespace gp
typedef typename TBase::params params;
filter_screenpts_adapter(params const & p)
: TBase(p), m_count(0),
: TBase(p),
m_prev(numeric_limits<CoordT>::min(), numeric_limits<CoordT>::min()), m_center(0, 0)
{
}
@ -335,16 +334,13 @@ namespace gp
m2::RectD r;
for (int i = 0; i < 3; ++i)
{
r.Add(arr[i]);
m_center += arr[i];
}
++m_count;
if (!empty_scr_rect(r) && r.IsIntersect(this->m_rect))
TBase::operator()(arr[0], arr[1], arr[2]);
}
m2::PointD GetCenter() const { return m_center / (3*m_count); }
m2::PointD GetCenter() const { return m_center; }
void SetCenter(m2::PointD const & p) { m_center = this->g2p(p); }
};
}