Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorExMix <rahuba.youri@gmail.com>2013-04-23 16:58:13 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:53:33 +0300
commitc69c3788e02670c8cf52fa4ac16525f9f3d83124 (patch)
tree0099a4437a1ef042f4b9804e3897bbf6563e3ff6 /graphics
parente56e3602855061d5d9384ea45ad7a3f29d172100 (diff)
From this moment we will set and reset state for overlay element instead of cloning element with new transformation
Diffstat (limited to 'graphics')
-rw-r--r--graphics/circle_element.cpp12
-rw-r--r--graphics/circle_element.hpp3
-rw-r--r--graphics/overlay_element.cpp17
-rw-r--r--graphics/overlay_element.hpp14
-rw-r--r--graphics/path_text_element.cpp15
-rw-r--r--graphics/path_text_element.hpp4
-rw-r--r--graphics/straight_text_element.cpp28
-rw-r--r--graphics/straight_text_element.hpp3
-rw-r--r--graphics/symbol_element.cpp13
-rw-r--r--graphics/symbol_element.hpp5
10 files changed, 54 insertions, 60 deletions
diff --git a/graphics/circle_element.cpp b/graphics/circle_element.cpp
index 8fbf9ac3d0..c7421bb356 100644
--- a/graphics/circle_element.cpp
+++ b/graphics/circle_element.cpp
@@ -13,13 +13,6 @@ namespace graphics
m_ci(p.m_ci)
{}
- CircleElement::CircleElement(CircleElement const & ce, math::Matrix<double, 3, 3> const & m)
- : base_t(ce),
- m_ci(ce.m_ci)
- {
- setPivot(ce.pivot() * m);
- }
-
vector<m2::AnyRectD> const & CircleElement::boundRects() const
{
if (isDirtyRect())
@@ -72,8 +65,9 @@ namespace graphics
res->m_pipelineID);
}
- OverlayElement * CircleElement::clone(math::Matrix<double, 3, 3> const & m) const
+ void CircleElement::setTransformation(const math::Matrix<double, 3, 3> & m)
{
- return new CircleElement(*this, m);
+ setPivot(pivot() * getResetMatrix() * m);
+ base_t::setTransformation(m);
}
}
diff --git a/graphics/circle_element.hpp b/graphics/circle_element.hpp
index aa32a24d02..289214a88b 100644
--- a/graphics/circle_element.hpp
+++ b/graphics/circle_element.hpp
@@ -26,12 +26,11 @@ namespace graphics
};
CircleElement(Params const & p);
- CircleElement(CircleElement const & ce, math::Matrix<double, 3, 3> const & m);
vector<m2::AnyRectD> const & boundRects() const;
void draw(OverlayRenderer * s, math::Matrix<double, 3, 3> const & m) const;
- OverlayElement * clone(math::Matrix<double, 3, 3> const & m) const;
+ void setTransformation(const math::Matrix<double, 3, 3> & m);
};
}
diff --git a/graphics/overlay_element.cpp b/graphics/overlay_element.cpp
index ec6d5e5937..2594f2d62c 100644
--- a/graphics/overlay_element.cpp
+++ b/graphics/overlay_element.cpp
@@ -24,7 +24,8 @@ namespace graphics
m_isDirtyRect(true),
m_isDirtyLayout(true),
m_isDirtyRoughRect(true),
- m_userInfo(p.m_userInfo)
+ m_userInfo(p.m_userInfo),
+ m_inverseMatrix(math::Identity<double, 3>())
{}
m2::PointD const OverlayElement::computeTopLeft(m2::PointD const & sz,
@@ -229,4 +230,18 @@ namespace graphics
return m_depth;
}
+ math::Matrix<double, 3, 3> const & OverlayElement::getResetMatrix() const
+ {
+ return m_inverseMatrix;
+ }
+
+ void OverlayElement::setTransformation(const math::Matrix<double, 3, 3> & m)
+ {
+ m_inverseMatrix = math::Inverse(m);
+ }
+
+ void OverlayElement::resetTransformation()
+ {
+ setTransformation(math::Identity<double, 3>());
+ }
}
diff --git a/graphics/overlay_element.hpp b/graphics/overlay_element.hpp
index 6b0c695e35..e8471a2627 100644
--- a/graphics/overlay_element.hpp
+++ b/graphics/overlay_element.hpp
@@ -43,6 +43,11 @@ namespace graphics
mutable bool m_isDirtyRoughRect;
mutable m2::RectD m_roughBoundRect;
+ math::Matrix<double, 3, 3> m_inverseMatrix;
+
+ protected:
+ math::Matrix<double, 3, 3> const & getResetMatrix() const;
+
public:
UserInfo m_userInfo;
@@ -62,11 +67,16 @@ namespace graphics
OverlayElement(Params const & p);
virtual ~OverlayElement();
- virtual OverlayElement * clone(math::Matrix<double, 3, 3> const & m) const = 0;
-
/// 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;
+ /// Set new transformation ! RELATIVE TO INIT STATE ! for drawing and safe information for reseting
+ /// Need to call base class method
+ virtual void setTransformation(math::Matrix<double, 3, 3> const & m) = 0;
+ /// This method reset transformation to initial state.
+ /// Geometry stored in coordinates relative to the tile.
+ /// Need to call base class method
+ virtual void resetTransformation();
virtual double priority() const;
diff --git a/graphics/path_text_element.cpp b/graphics/path_text_element.cpp
index a2ccb1c571..a2b20d912c 100644
--- a/graphics/path_text_element.cpp
+++ b/graphics/path_text_element.cpp
@@ -27,14 +27,6 @@ namespace graphics
setIsValid((m_glyphLayout.firstVisible() == 0) && (m_glyphLayout.lastVisible() == visText().size()));
}
- PathTextElement::PathTextElement(PathTextElement const & src, math::Matrix<double, 3, 3> const & m)
- : TextElement(src),
- m_glyphLayout(src.m_glyphLayout, m)
- {
- setPivot(m_glyphLayout.pivot());
- setIsValid((m_glyphLayout.firstVisible() == 0) && (m_glyphLayout.lastVisible() == visText().size()));
- }
-
vector<m2::AnyRectD> const & PathTextElement::boundRects() const
{
if (isDirtyRect())
@@ -92,8 +84,11 @@ namespace graphics
m_glyphLayout.setPivot(pivot);
}
- OverlayElement * PathTextElement::clone(math::Matrix<double, 3, 3> const & m) const
+ void PathTextElement::setTransformation(const math::Matrix<double, 3, 3> & m)
{
- return new PathTextElement(*this, m);
+ m_glyphLayout = GlyphLayout(m_glyphLayout, getResetMatrix() * m);
+ TextElement::setPivot(m_glyphLayout.pivot());
+ setIsValid((m_glyphLayout.firstVisible() == 0) && (m_glyphLayout.lastVisible() == visText().size()));
+ TextElement::setTransformation(m);
}
}
diff --git a/graphics/path_text_element.hpp b/graphics/path_text_element.hpp
index c165dbe55a..ab14d8d66c 100644
--- a/graphics/path_text_element.hpp
+++ b/graphics/path_text_element.hpp
@@ -23,14 +23,12 @@ namespace graphics
};
PathTextElement(Params const & p);
- PathTextElement(PathTextElement const & src, math::Matrix<double, 3, 3> const & m);
vector<m2::AnyRectD> const & boundRects() const;
void draw(OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
void setPivot(m2::PointD const & pivot);
-
- OverlayElement * clone(math::Matrix<double, 3, 3> const & m) const;
+ void setTransformation(const math::Matrix<double, 3, 3> & m);
};
}
diff --git a/graphics/straight_text_element.cpp b/graphics/straight_text_element.cpp
index 83717130dc..ae4913a4b5 100644
--- a/graphics/straight_text_element.cpp
+++ b/graphics/straight_text_element.cpp
@@ -178,22 +178,6 @@ namespace graphics
m_offset(0, 0)
{}
- StraightTextElement::StraightTextElement(StraightTextElement const & src,
- math::Matrix<double, 3, 3> const & m)
- : TextElement(src),
- m_glyphLayouts(src.m_glyphLayouts)
- {
- m_offsets = src.m_offsets;
-
- setPivot(pivot() * m);
-
- for (unsigned i = 0; i < m_glyphLayouts.size(); ++i)
- {
- m_glyphLayouts[i].setPivot(pivot());
- m_glyphLayouts[i].setOffset(m_offsets[i]);
- }
- }
-
vector<m2::AnyRectD> const & StraightTextElement::boundRects() const
{
if (isDirtyRect())
@@ -262,9 +246,17 @@ namespace graphics
m_glyphLayouts[i].setPivot(m_glyphLayouts[i].pivot() + offs);
}
- OverlayElement * StraightTextElement::clone(math::Matrix<double, 3, 3> const & m) const
+ void StraightTextElement::setTransformation(const math::Matrix<double, 3, 3> & m)
{
- return new StraightTextElement(*this, m);
+ setPivot(pivot() * getResetMatrix() * m);
+
+ for (unsigned i = 0; i < m_glyphLayouts.size(); ++i)
+ {
+ m_glyphLayouts[i].setPivot(pivot());
+ m_glyphLayouts[i].setOffset(m_offsets[i]);
+ }
+
+ TextElement::setTransformation(m);
}
bool StraightTextElement::hasSharpGeometry() const
diff --git a/graphics/straight_text_element.hpp b/graphics/straight_text_element.hpp
index d33f18e3d9..9d42c095fa 100644
--- a/graphics/straight_text_element.hpp
+++ b/graphics/straight_text_element.hpp
@@ -28,7 +28,6 @@ namespace graphics
};
StraightTextElement(Params const & p);
- StraightTextElement(StraightTextElement const & src, math::Matrix<double, 3, 3> const & m);
vector<m2::AnyRectD> const & boundRects() const;
@@ -36,7 +35,7 @@ namespace graphics
void setPivot(m2::PointD const & pv);
- OverlayElement * clone(math::Matrix<double, 3, 3> const & m) const;
+ void setTransformation(const math::Matrix<double, 3, 3> & m);
bool hasSharpGeometry() const;
};
diff --git a/graphics/symbol_element.cpp b/graphics/symbol_element.cpp
index 1eb21e353c..2fefa5ca84 100644
--- a/graphics/symbol_element.cpp
+++ b/graphics/symbol_element.cpp
@@ -30,14 +30,6 @@ namespace graphics
m_symbolRect = res->m_texRect;
}
- SymbolElement::SymbolElement(SymbolElement const & se, math::Matrix<double, 3, 3> const & m)
- : base_t(se),
- m_info(se.m_info),
- m_symbolRect(se.m_symbolRect)
- {
- setPivot(se.pivot() * m);
- }
-
vector<m2::AnyRectD> const & SymbolElement::boundRects() const
{
if (isDirtyRect())
@@ -101,9 +93,10 @@ namespace graphics
res->m_pipelineID);
}
- OverlayElement * SymbolElement::clone(math::Matrix<double, 3, 3> const & m) const
+ void SymbolElement::setTransformation(const math::Matrix<double, 3, 3> & m)
{
- return new SymbolElement(*this, m);
+ setPivot(pivot() * getResetMatrix() * m);
+ base_t::setTransformation(m);
}
bool SymbolElement::hasSharpGeometry() const
diff --git a/graphics/symbol_element.hpp b/graphics/symbol_element.hpp
index 4960c06148..49f58b517a 100644
--- a/graphics/symbol_element.hpp
+++ b/graphics/symbol_element.hpp
@@ -31,15 +31,14 @@ namespace graphics
};
SymbolElement(Params const & p);
- SymbolElement(SymbolElement const & se, math::Matrix<double, 3, 3> const & m);
vector<m2::AnyRectD> const & boundRects() const;
void draw(OverlayRenderer * s, math::Matrix<double, 3, 3> const & m) const;
uint32_t resID() const;
- OverlayElement * clone(math::Matrix<double, 3, 3> const & m) const;
-
bool hasSharpGeometry() const;
+
+ void setTransformation(const math::Matrix<double, 3, 3> & m);
};
}