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:
authorvng <viktor.govako@gmail.com>2011-11-17 06:28:40 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:28:14 +0300
commit8d9b597bcda2fb3dadefc295d7f600c74114b778 (patch)
tree983b8d8d9109e2d1466b16fd1fe6faf0d21eb276 /indexer/drawing_rules.cpp
parente8975ebcbf8e34d1bd71cce114bd035a7d51d183 (diff)
Add stroke_color to PathTextRuleProto.
Correct generation of alpha and stroke color for caption rules. New proto drawing styles with stroke_color.
Diffstat (limited to 'indexer/drawing_rules.cpp')
-rw-r--r--indexer/drawing_rules.cpp49
1 files changed, 20 insertions, 29 deletions
diff --git a/indexer/drawing_rules.cpp b/indexer/drawing_rules.cpp
index e1b15b2160..8b6bcfcbe4 100644
--- a/indexer/drawing_rules.cpp
+++ b/indexer/drawing_rules.cpp
@@ -575,7 +575,8 @@ namespace drule {
virtual double GetTextHeight() const { return m_params.get<5>().m_v; }
virtual int GetFillColor() const { return m_params.get<6>().m_v; }
- virtual int GetColor() const {return m_params.get<8>().m_v; }
+ virtual unsigned char GetAlpha() const { return alpha_opacity(m_params.get<7>()); }
+ virtual int GetColor() const { return m_params.get<8>().m_v; }
static string arrKeys[9];
};
@@ -648,7 +649,9 @@ namespace drule {
virtual void Write(FileWriterStream & ar) const { write_rules(ar, this); }
virtual double GetTextHeight() const { return m_params.get<6>().m_v; }
- virtual int GetFillColor() const {return m_params.get<7>().m_v;}
+ virtual int GetFillColor() const { return m_params.get<7>().m_v; }
+ virtual unsigned char GetAlpha() const { return alpha_opacity(m_params.get<8>()); }
+ virtual int GetColor() const { return m_params.get<9>().m_v; }
static string arrKeys[10];
};
@@ -1146,19 +1149,24 @@ namespace
pDest->set_name(s);
}
- void ConvertImpl(BaseRule const * pSrc, CaptionRuleProto * pDest) const
+ template <class T>
+ void ConvertCaptionT(BaseRule const * pSrc, T * pDest) const
{
pDest->set_height(ToPixels(pSrc->GetTextHeight()));
- pDest->set_color(GetFillColor(pSrc));
+ pDest->set_color((pSrc->GetFillColor() != -1) ? GetFillColor(pSrc) : 0);
if (pSrc->GetColor() != -1)
pDest->set_stroke_color(GetColor(pSrc));
}
+ void ConvertImpl(BaseRule const * pSrc, CaptionRuleProto * pDest) const
+ {
+ ConvertCaptionT(pSrc, pDest);
+ }
+
void ConvertImpl(BaseRule const * pSrc, PathTextRuleProto * pDest) const
{
- pDest->set_height(ToPixels(pSrc->GetTextHeight()));
- pDest->set_color(GetFillColor(pSrc));
+ ConvertCaptionT(pSrc, pDest);
}
void ConvertImpl(BaseRule const * pSrc, CircleRuleProto * pDest) const
@@ -1368,11 +1376,11 @@ namespace
}
};
- class Caption : public MyBase
+ template <class T> class CaptionT : public MyBase
{
- CaptionRuleProto m_caption;
+ T m_caption;
public:
- Caption(CaptionRuleProto const & r) : m_caption(r) {}
+ CaptionT(T const & r) : m_caption(r) {}
virtual int GetColor() const
{
@@ -1394,6 +1402,9 @@ namespace
}
};
+ typedef CaptionT<CaptionRuleProto> Caption;
+ typedef CaptionT<PathTextRuleProto> PathText;
+
class Circle : public MyBase
{
CircleRuleProto m_circle;
@@ -1409,26 +1420,6 @@ namespace
return m_circle.radius();
}
};
-
- class PathText : public MyBase
- {
- PathTextRuleProto m_text;
- public:
- PathText(PathTextRuleProto const & r) : m_text(r) {}
-
- virtual int GetFillColor() const
- {
- return m_text.color();
- }
- virtual double GetTextHeight() const
- {
- return m_text.height();
- }
- virtual unsigned char GetAlpha() const
- {
- return AlphaFromColor(GetFillColor());
- }
- };
}
class DoSetIndex