Skip to content

Commit

Permalink
Review fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
bykoianko authored and vmihaylenko committed May 21, 2019
1 parent 4f4e5fb commit 450e12a
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions openlr/openlr_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,12 +401,12 @@ class SegmentsDecoderV3
m_dataSource, m_graph);
ScoreCandidatePathsGetter pathsGetter(pointsGetter, m_graph, m_infoGetter, stat);

if (!pathsGetter.GetLineCandidatesForPoints(points, segment.m_status, lineCandidates))
if (!pathsGetter.GetLineCandidatesForPoints(points, segment.m_source, lineCandidates))
return false;

vector<Graph::EdgeVector> resultPath;
ScorePathsConnector connector(m_graph, m_infoGetter, stat);
if (!connector.FindBestPath(points, lineCandidates, segment.m_status, resultPath))
if (!connector.FindBestPath(points, lineCandidates, segment.m_source, resultPath))
{
LOG(LINFO, ("Connections not found:", segment.m_segmentId));
auto const mercatorPoints = segment.GetMercatorPoints();
Expand Down
2 changes: 1 addition & 1 deletion openlr/openlr_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ string DebugPrint(LinearSegmentSource source)
{
case LinearSegmentSource::NotValid: return "NotValid";
case LinearSegmentSource::FromLocationReferenceTag: return "FromLocationReferenceTag";
case LinearSegmentSource::FormCoordinatesTag: return "FormCoordinatesTag";
case LinearSegmentSource::FromCoordinatesTag: return "FromCoordinatesTag";
}
UNREACHABLE();
}
Expand Down
4 changes: 2 additions & 2 deletions openlr/openlr_model.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ enum class LinearSegmentSource
{
NotValid,
FromLocationReferenceTag,
FormCoordinatesTag,
FromCoordinatesTag,
};

struct LocationReferencePoint
Expand Down Expand Up @@ -110,7 +110,7 @@ struct LinearSegment
std::vector<LocationReferencePoint> const & GetLRPs() const;
std::vector<LocationReferencePoint> & GetLRPs();

LinearSegmentSource m_status = LinearSegmentSource::NotValid;
LinearSegmentSource m_source = LinearSegmentSource::NotValid;
// TODO(mgsergio): Think of using openlr::PartnerSegmentId
uint32_t m_segmentId = kInvalidSegmentId;
// TODO(mgsergio): Make sure that one segment cannot contain
Expand Down
4 changes: 2 additions & 2 deletions openlr/openlr_model_xml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ bool SegmentFromXML(pugi::xml_node const & segmentNode, LinearSegment & segment)
auto const locRefNode = GetLinearLocationReference(segmentNode);
auto const result = LinearLocationReferenceFromXML(locRefNode, segment.m_locationReference);
if (result)
segment.m_status = LinearSegmentSource::FromLocationReferenceTag;
segment.m_source = LinearSegmentSource::FromLocationReferenceTag;

return result;
}
Expand All @@ -363,7 +363,7 @@ bool SegmentFromXML(pugi::xml_node const & segmentNode, LinearSegment & segment)

CHECK_EQUAL(segment.m_locationReference.m_points.size(), 2, ());
segment.m_locationReference.m_points[0].m_distanceToNextPoint = segment.m_segmentLengthMeters;
segment.m_status = LinearSegmentSource::FormCoordinatesTag;
segment.m_source = LinearSegmentSource::FromCoordinatesTag;
return true;
}
} // namespace openlr
6 changes: 3 additions & 3 deletions openlr/score_candidate_paths_getter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ bool GetBearingScore(BearingPointsSelector const & pointsSelector,
return false;

double constexpr kMaxScoreForBearing = 60.0;
double constexpr kAngleDeviationFactor = 4.3;
double constexpr kAngleDeviationFactor = 1.0 / 4.3;
score =
static_cast<Score>(kMaxScoreForBearing / (1.0 + angleDeviationDeg / kAngleDeviationFactor));
static_cast<Score>(kMaxScoreForBearing / (1.0 + angleDeviationDeg * kAngleDeviationFactor));

return true;
}
Expand Down Expand Up @@ -257,7 +257,7 @@ void ScoreCandidatePathsGetter::GetBestCandidatePaths(vector<shared_ptr<Link>> c

--traceBackIterationsLeft;

// Note. No information about bearing if source == LinearSegmentSource::FormCoordinatesTag.
// Note. No information about bearing if source == LinearSegmentSource::FromCoordinatesTag.
Score bearingScore = 0;
if (source == LinearSegmentSource::FromLocationReferenceTag)
{
Expand Down
6 changes: 3 additions & 3 deletions openlr/score_paths_connector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,12 @@ bool ScorePathsConnector::FindBestPath(vector<LocationReferencePoint> const & po
result.cbegin(), result.cend(),
[](ScorePath const & o1, ScorePath const & o2) { return o1.m_score < o2.m_score; });

// Note. In case of source == LinearSegmentSource::FormCoordinatesTag there is less
// information about a open lr segment so less score is collected.
// Note. In case of source == LinearSegmentSource::FromCoordinatesTag there is less
// information about a openlr segment so less score is collected.
Score const kMinValidScore = source == LinearSegmentSource::FromLocationReferenceTag ? 240 : 165;
if (it->m_score < kMinValidScore)
{
LOG(LINFO, ("The shortest path found but it is no good. The best score:", it->m_score));
LOG(LINFO, ("The shortest path found but it is not good. The best score:", it->m_score));
++m_stat.m_notEnoughScore;
return false;
}
Expand Down

0 comments on commit 450e12a

Please sign in to comment.