forked from organicmaps/organicmaps
Save empty paths to openlr_stat assessment output.
This commit is contained in:
parent
b3ab518fd7
commit
5aee1eec68
3 changed files with 10 additions and 28 deletions
|
@ -84,7 +84,6 @@ public:
|
|||
m_drapeApi.Clear();
|
||||
}
|
||||
|
||||
|
||||
void VisualizePoints(std::vector<m2::PointD> const & points) override
|
||||
{
|
||||
UserMarkNotificationGuard g(m_bm, UserMarkType::DEBUG_MARK);
|
||||
|
|
|
@ -16,14 +16,6 @@
|
|||
|
||||
namespace
|
||||
{
|
||||
std::vector<m2::PointD> GetPoints(openlr::LinearSegment const & segment)
|
||||
{
|
||||
std::vector<m2::PointD> result;
|
||||
for (auto const & lrp : segment.m_locationReference.m_points)
|
||||
result.push_back(MercatorBounds::FromLatLon(lrp.m_latLon));
|
||||
return result;
|
||||
}
|
||||
|
||||
void RemovePointFromPull(m2::PointD const & toBeRemoved, std::vector<m2::PointD> & pool)
|
||||
{
|
||||
pool.erase(
|
||||
|
@ -234,22 +226,18 @@ void TrafficMode::OnItemSelected(QItemSelection const & selected, QItemSelection
|
|||
|
||||
auto const row = selected.front().top();
|
||||
|
||||
// TODO(mgsergio): Use algo for center calculation.
|
||||
// Now viewport is set to the first point of the first segment.
|
||||
CHECK_LESS(row, m_segments.size(), ());
|
||||
m_currentSegment = &m_segments[row];
|
||||
auto const partnerSegmentId = m_currentSegment->GetPartnerSegmentId();
|
||||
|
||||
// TODO(mgsergio): Maybe we shold show empty paths.
|
||||
CHECK(m_currentSegment->GetMatchedPath(), ("Empty mwm segments for partner id", partnerSegmentId));
|
||||
|
||||
auto const & path = *m_currentSegment->GetMatchedPath();
|
||||
auto const & firstEdge = path.front();
|
||||
auto const & partnerSegment = m_currentSegment->GetPartnerSegment().GetMercatorPoints();
|
||||
auto const & viewportCenter = partnerSegment.front();
|
||||
|
||||
m_drawerDelegate->ClearAllPaths();
|
||||
m_drawerDelegate->SetViewportCenter(GetStart(firstEdge));
|
||||
m_drawerDelegate->DrawEncodedSegment(GetPoints(m_currentSegment->GetPartnerSegment()));
|
||||
m_drawerDelegate->DrawDecodedSegments(GetPoints(path));
|
||||
// TODO(mgsergio): Use a better way to set viewport and scale.
|
||||
m_drawerDelegate->SetViewportCenter(viewportCenter);
|
||||
m_drawerDelegate->DrawEncodedSegment(partnerSegment);
|
||||
if (auto const & path = m_currentSegment->GetMatchedPath())
|
||||
m_drawerDelegate->DrawDecodedSegments(GetPoints(*path));
|
||||
if (auto const & path = m_currentSegment->GetGoldenPath())
|
||||
m_drawerDelegate->DrawGoldenPath(GetPoints(*path));
|
||||
}
|
||||
|
@ -303,8 +291,6 @@ void TrafficMode::PopPoint()
|
|||
|
||||
void TrafficMode::CommitPath()
|
||||
{
|
||||
// TODO(mgsergio): Make this situation impossible. Make the first segment selected by default
|
||||
// for example.
|
||||
CHECK(m_currentSegment, ("No segments selected"));
|
||||
|
||||
if (!m_buildingPath)
|
||||
|
|
|
@ -186,15 +186,12 @@ void WriteAssessmentFile(std::string const fileName, pugi::xml_document const &
|
|||
pugi::xml_document result;
|
||||
for (auto const p : paths)
|
||||
{
|
||||
// TODO(mgsergio): Should we keep empty paths to assess them as well?
|
||||
if (p.m_path.empty())
|
||||
continue;
|
||||
|
||||
auto segment = result.append_child("Segment");
|
||||
{
|
||||
auto const xmlSegment = xmlSegments[p.m_segmentId.Get()];
|
||||
segment.append_copy(xmlSegment);
|
||||
}
|
||||
if (!p.m_path.empty())
|
||||
{
|
||||
auto node = segment.append_child("Route");
|
||||
openlr::PathToXML(p.m_path, node);
|
||||
|
@ -234,9 +231,9 @@ int main(int argc, char * argv[])
|
|||
|
||||
SaveNonMatchedIds(FLAGS_non_matched_ids, paths);
|
||||
if (!FLAGS_assessment_output.empty())
|
||||
WriteAssessmentFile(FLAGS_spark_output, document, paths);
|
||||
WriteAssessmentFile(FLAGS_assessment_output, document, paths);
|
||||
if (!FLAGS_spark_output.empty())
|
||||
WriteAsMappingForSpark(FLAGS_assessment_output, paths);
|
||||
WriteAsMappingForSpark(FLAGS_spark_output, paths);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue