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

Method UpdateSelectionInfo

libs/map/track.cpp:122–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122void Track::UpdateSelectionInfo(m2::RectD const & touchRect, TrackSelectionInfo & info) const
123{
124 if (m_interactionData && !m_interactionData->m_limitRect.IsIntersect(touchRect))
125 return;
126
127 for (size_t lineIndex = 0; lineIndex < m_data.m_geometry.m_lines.size(); ++lineIndex)
128 {
129 auto const & line = m_data.m_geometry.m_lines[lineIndex];
130 for (size_t ptIndex = 0; ptIndex + 1 < line.size(); ++ptIndex)
131 {
132 auto pt1 = line[ptIndex].GetPoint();
133 auto pt2 = line[ptIndex + 1].GetPoint();
134 if (!m2::Intersect(touchRect, pt1, pt2))
135 continue;
136
137 m2::ParametrizedSegment<m2::PointD> seg(pt1, pt2);
138 auto const closestPoint = seg.ClosestPointTo(touchRect.Center());
139 auto const squaredDist = closestPoint.SquaredLength(touchRect.Center());
140 if (squaredDist >= info.m_squareDist)
141 continue;
142
143 info.m_squareDist = squaredDist;
144 info.m_trackId = m_data.m_id;
145 info.m_trackPoint = closestPoint;
146
147 auto const segDistInMeters = mercator::DistanceOnEarth(line[ptIndex].GetPoint(), closestPoint);
148 info.m_distFromBegM = segDistInMeters + GetLengthMetersImpl(lineIndex, ptIndex);
149 }
150 }
151}
152
153df::DepthLayer Track::GetDepthLayer() const
154{

Callers 2

FindNearestTrackMethod · 0.80
BuildPlacePageInfoMethod · 0.80

Calls 8

ClosestPointToMethod · 0.80
SquaredLengthMethod · 0.80
IntersectFunction · 0.50
DistanceOnEarthFunction · 0.50
IsIntersectMethod · 0.45
sizeMethod · 0.45
GetPointMethod · 0.45
CenterMethod · 0.45

Tested by

no test coverage detected