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

Method PrepareSchemeSubway

libs/drape_frontend/transit_scheme_builder.cpp:797–830  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

795}
796
797void TransitSchemeBuilder::PrepareSchemeSubway(MwmSchemeData & scheme)
798{
799 m2::RectD boundingRect;
800
801 for (auto const & shape : scheme.m_shapesSubway)
802 {
803 auto const stop1 = shape.first.GetStop1Id();
804 auto const stop2 = shape.first.GetStop2Id();
805 StopNodeParamsSubway & params1 = (scheme.m_stopsSubway.find(stop1) == scheme.m_stopsSubway.end())
806 ? scheme.m_transfersSubway[stop1]
807 : scheme.m_stopsSubway[stop1];
808 StopNodeParamsSubway & params2 = (scheme.m_stopsSubway.find(stop2) == scheme.m_stopsSubway.end())
809 ? scheme.m_transfersSubway[stop2]
810 : scheme.m_stopsSubway[stop2];
811
812 auto const linesCount = shape.second.m_forwardLines.size() + shape.second.m_backwardLines.size();
813
814 auto const sz = shape.second.m_polyline.size();
815
816 auto const dir1 = (shape.second.m_polyline[1] - shape.second.m_polyline[0]).Normalize();
817 auto const dir2 = (shape.second.m_polyline[sz - 2] - shape.second.m_polyline[sz - 1]).Normalize();
818
819 params1.m_shapesInfo[shape.first].m_linesCount = linesCount;
820 params1.m_shapesInfo[shape.first].m_direction = dir1;
821
822 params2.m_shapesInfo[shape.first].m_linesCount = linesCount;
823 params2.m_shapesInfo[shape.first].m_direction = dir2;
824
825 for (auto const & pt : shape.second.m_polyline)
826 boundingRect.Add(pt);
827 }
828
829 scheme.m_pivot = boundingRect.Center();
830}
831
832void UpdateShapeInfos(std::vector<ShapeInfoPT> & shapeInfos, m2::PointD const & newDir,
833 std::set<std::string> const & colors)

Callers

nothing calls this directly

Calls 8

GetStop1IdMethod · 0.80
GetStop2IdMethod · 0.80
findMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
NormalizeMethod · 0.45
AddMethod · 0.45
CenterMethod · 0.45

Tested by

no test coverage detected