forked from organicmaps/organicmaps
changed OverlayElement::visualRank into OverlayElement::priority and turned on sorting by OverlayElement::depth(which is essentially a priority in drules_proto.txt).
This commit is contained in:
parent
0d3366464e
commit
83e03625f5
17 changed files with 22 additions and 31 deletions
|
@ -62,11 +62,6 @@ namespace graphics
|
|||
res->m_pipelineID);
|
||||
}
|
||||
|
||||
int CircleElement::visualRank() const
|
||||
{
|
||||
return 500;
|
||||
}
|
||||
|
||||
OverlayElement * CircleElement::clone(math::Matrix<double, 3, 3> const & m) const
|
||||
{
|
||||
return new CircleElement(*this, m);
|
||||
|
|
|
@ -31,8 +31,6 @@ namespace graphics
|
|||
|
||||
void draw(OverlayRenderer * s, math::Matrix<double, 3, 3> const & m) const;
|
||||
|
||||
int visualRank() const;
|
||||
|
||||
OverlayElement * clone(math::Matrix<double, 3, 3> const & m) const;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -48,12 +48,12 @@ namespace graphics
|
|||
m_elements[i]->draw(r, m);
|
||||
}
|
||||
|
||||
int CompositeOverlayElement::visualRank() const
|
||||
int CompositeOverlayElement::priority() const
|
||||
{
|
||||
int res = numeric_limits<int>::min();
|
||||
|
||||
for (unsigned i = 0; i < m_elements.size(); ++i)
|
||||
res = max(res, m_elements[i]->visualRank());
|
||||
res = max(res, m_elements[i]->priority());
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace graphics
|
|||
|
||||
void draw(OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
|
||||
|
||||
int visualRank() const;
|
||||
int priority() const;
|
||||
|
||||
void offset(m2::PointD const & offs);
|
||||
};
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace graphics
|
|||
return false;
|
||||
|
||||
/// for the composite elements, collected in OverlayRenderer to replace the part elements
|
||||
return l->visualRank() >= r->visualRank();
|
||||
return l->priority() >= r->priority();
|
||||
}
|
||||
|
||||
m2::RectD const OverlayElementTraits::LimitRect(shared_ptr<OverlayElement> const & elem)
|
||||
|
@ -288,7 +288,7 @@ namespace graphics
|
|||
bool greater_priority(shared_ptr<OverlayElement> const & l,
|
||||
shared_ptr<OverlayElement> const & r)
|
||||
{
|
||||
return l->visualRank() > r->visualRank();
|
||||
return l->priority() > r->priority();
|
||||
}
|
||||
|
||||
void Overlay::merge(Overlay const & layer, math::Matrix<double, 3, 3> const & m)
|
||||
|
|
|
@ -209,4 +209,9 @@ namespace graphics
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int OverlayElement::priority() const
|
||||
{
|
||||
return m_depth * 1000;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace graphics
|
|||
/// PLEASE, REMEMBER THE REFERENCE!!!
|
||||
virtual vector<m2::AnyRectD> const & boundRects() const = 0;
|
||||
virtual void draw(OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const = 0;
|
||||
virtual int visualRank() const = 0;
|
||||
virtual int priority() const;
|
||||
|
||||
m2::PointD const & pivot() const;
|
||||
virtual void setPivot(m2::PointD const & pv);
|
||||
|
|
|
@ -83,9 +83,9 @@ namespace graphics
|
|||
m_glyphLayout.setPivot(pivot);
|
||||
}
|
||||
|
||||
int PathTextElement::visualRank() const
|
||||
int PathTextElement::priority() const
|
||||
{
|
||||
return 2000 + m_fontDesc.m_size;
|
||||
return OverlayElement::priority() + m_fontDesc.m_size;
|
||||
}
|
||||
|
||||
OverlayElement * PathTextElement::clone(math::Matrix<double, 3, 3> const & m) const
|
||||
|
|
|
@ -27,10 +27,10 @@ namespace graphics
|
|||
|
||||
void draw(OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
|
||||
|
||||
int visualRank() const;
|
||||
|
||||
void setPivot(m2::PointD const & pivot);
|
||||
|
||||
OverlayElement * clone(math::Matrix<double, 3, 3> const & m) const;
|
||||
|
||||
int priority() const;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -293,9 +293,9 @@ namespace graphics
|
|||
m_glyphLayouts[i].setPivot(m_glyphLayouts[i].pivot() + offs);
|
||||
}
|
||||
|
||||
int StraightTextElement::visualRank() const
|
||||
int StraightTextElement::priority() const
|
||||
{
|
||||
return 1000 + m_fontDesc.m_size;
|
||||
return OverlayElement::priority() + m_fontDesc.m_size;
|
||||
}
|
||||
|
||||
OverlayElement * StraightTextElement::clone(math::Matrix<double, 3, 3> const & m) const
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace graphics
|
|||
|
||||
void draw(OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
|
||||
|
||||
int visualRank() const;
|
||||
int priority() const;
|
||||
|
||||
void setPivot(m2::PointD const & pv);
|
||||
|
||||
|
|
|
@ -87,11 +87,6 @@ namespace graphics
|
|||
res->m_pipelineID);
|
||||
}
|
||||
|
||||
int SymbolElement::visualRank() const
|
||||
{
|
||||
return 0000;
|
||||
}
|
||||
|
||||
OverlayElement * SymbolElement::clone(math::Matrix<double, 3, 3> const & m) const
|
||||
{
|
||||
return new SymbolElement(*this, m);
|
||||
|
|
|
@ -37,8 +37,6 @@ namespace graphics
|
|||
|
||||
uint32_t resID() const;
|
||||
|
||||
int visualRank() const;
|
||||
|
||||
OverlayElement * clone(math::Matrix<double, 3, 3> const & m) const;
|
||||
|
||||
bool hasSharpGeometry() const;
|
||||
|
|
|
@ -92,7 +92,7 @@ namespace gui
|
|||
r->drawRectangle(boundRects()[i], color(state()), depth());
|
||||
}
|
||||
|
||||
int Element::visualRank() const
|
||||
int Element::priority() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace gui
|
|||
|
||||
graphics::OverlayElement * clone(math::Matrix<double, 3, 3> const & m) const;
|
||||
void draw(graphics::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
|
||||
int visualRank() const;
|
||||
int priority() const;
|
||||
|
||||
virtual void cache();
|
||||
/// this method is called upon renderPolicy destruction and should clean
|
||||
|
|
|
@ -303,7 +303,7 @@ void Ruler::draw(graphics::OverlayRenderer * s, math::Matrix<double, 3, 3> const
|
|||
}
|
||||
}
|
||||
|
||||
int Ruler::visualRank() const
|
||||
int Ruler::priority() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -80,6 +80,6 @@ public:
|
|||
|
||||
void draw(graphics::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
|
||||
|
||||
int visualRank() const;
|
||||
int priority() const;
|
||||
graphics::OverlayElement * clone(math::Matrix<double, 3, 3> const & m) const;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue