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

resource_style.cpp « yg - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7b3ab352974014bf03ff29251f0bb642d7efb79c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include "resource_style.hpp"

#include "../base/start_mem_debug.hpp"

namespace yg
{
  ResourceStyle::ResourceStyle()
  {}

  ResourceStyle::ResourceStyle(
      m2::RectU const & texRect,
      int pageID
      ) : m_cat(EGenericStyle),
      m_texRect(texRect),
      m_pageID(pageID)
  {}

  ResourceStyle::ResourceStyle(
      Category cat,
      m2::RectU const & texRect,
      int pageID)
    : m_cat(cat),
    m_texRect(texRect),
    m_pageID(pageID)
  {}

  LineStyle::LineStyle(bool isWrapped, m2::RectU const & texRect, int pageID, yg::PenInfo const & penInfo) :
    ResourceStyle(ELineStyle, texRect, pageID),
    m_isWrapped(isWrapped),
    m_isSolid(penInfo.m_isSolid),
    m_penInfo(penInfo)
  {
    if (m_isSolid)
    {
      m_borderColorPixel = m_centerColorPixel = m2::PointU(texRect.minX() + 1, texRect.minY() + 1);
    }
    else
    {
      double firstDashOffset = penInfo.firstDashOffset();
      m_centerColorPixel = m2::PointU(firstDashOffset + texRect.minX() + 3, texRect.minY() + texRect.SizeY() / 2.0);
      m_borderColorPixel = m2::PointU(firstDashOffset + texRect.minX() + 3, texRect.minY() + 1);
    }
  }

  double LineStyle::geometryTileLen() const
  {
    return m_texRect.SizeX() - 2;
  }

  double LineStyle::geometryTileWidth() const
  {
    return m_texRect.SizeY() - 2;
  }

  double LineStyle::rawTileLen() const
  {
    return m_texRect.SizeX() - 4;
  }

  double LineStyle::rawTileWidth() const
  {
    return m_texRect.SizeY() - 4;
  }

  CharStyle::CharStyle(m2::RectU const & texRect, int pageID, int8_t xOffset, int8_t yOffset, int8_t xAdvance)
    : ResourceStyle(ECharStyle, texRect, pageID), m_xOffset(xOffset), m_yOffset(yOffset), m_xAdvance(xAdvance)
  {}

  PointStyle::PointStyle(m2::RectU const & texRect, int pageID, string const & styleName)
    : ResourceStyle(EPointStyle, texRect, pageID), m_styleName(styleName)
  {}

  GenericStyle::GenericStyle(m2::RectU const & texRect, int pageID)
    : ResourceStyle(EGenericStyle, texRect, pageID)
  {}
}