MCPcopy Create free account
hub / github.com/comaps/comaps / BuildLines

Method BuildLines

libs/drape_frontend/drape_api_builder.cpp:47–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45namespace df
46{
47void DrapeApiBuilder::BuildLines(ref_ptr<dp::GraphicsContext> context, DrapeApi::TLines & lines,
48 ref_ptr<dp::TextureManager> textures,
49 std::vector<drape_ptr<DrapeApiRenderProperty>> & properties)
50{
51 properties.reserve(lines.size());
52
53 uint32_t constexpr kMaxSize = 5000;
54 uint32_t constexpr kFontSize = 14;
55 FeatureID fakeFeature;
56
57 for (auto & line : lines)
58 {
59 std::string const & id = line.first;
60
61 DrapeApiLineData & data = line.second;
62 base::Unique(data.m_points,
63 [](m2::PointD const & p1, m2::PointD const & p2) { return p1.EqualDxDy(p2, kMwmPointAccuracy); });
64
65 m2::RectD rect;
66 for (auto const & p : data.m_points)
67 rect.Add(p);
68
69 dp::Batcher batcher(kMaxSize, kMaxSize);
70 batcher.SetBatcherHash(static_cast<uint64_t>(BatcherBucket::Default));
71 auto property = make_unique_dp<DrapeApiRenderProperty>();
72 property->m_center = rect.Center();
73 {
74 dp::SessionGuard guard(context, batcher,
75 [&property, &id](dp::RenderState const & state, drape_ptr<dp::RenderBucket> && b)
76 {
77 property->m_id = id;
78 property->m_buckets.emplace_back(state, std::move(b));
79 });
80
81 if (data.m_points.size() > 1)
82 {
83 m2::SharedSpline spline(data.m_points);
84 LineViewParams lvp;
85 lvp.m_tileCenter = property->m_center;
86 lvp.m_depthTestEnabled = false;
87 lvp.m_minVisibleScale = 1;
88 lvp.m_cap = dp::RoundCap;
89 lvp.m_color = data.m_color;
90 lvp.m_width = data.m_width;
91 lvp.m_join = dp::RoundJoin;
92 LineShape(spline, lvp).Draw(context, make_ref(&batcher), textures);
93 }
94
95 if (data.m_showPoints)
96 {
97 ColoredSymbolViewParams cvp;
98 cvp.m_tileCenter = property->m_center;
99 cvp.m_depthTestEnabled = false;
100 cvp.m_minVisibleScale = 1;
101 cvp.m_shape = ColoredSymbolViewParams::Shape::Circle;
102 cvp.m_color = data.m_color;
103 cvp.m_radiusInPixels = data.m_width * 2.0f;
104 for (m2::PointD const & pt : data.m_points)

Callers 1

AcceptMessageMethod · 0.80

Calls 15

UniqueFunction · 0.85
LineShapeClass · 0.85
make_refFunction · 0.85
ColoredSymbolShapeClass · 0.85
to_stringFunction · 0.85
BuildTextFunction · 0.85
SetBatcherHashMethod · 0.80
TileKeyClass · 0.70
reserveMethod · 0.45
sizeMethod · 0.45
EqualDxDyMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected