Skip to content

Commit

Permalink
[transit] Changed default feature id for edgeData.
Browse files Browse the repository at this point in the history
  • Loading branch information
mesozoic-drones authored and maksimandrianov committed Oct 29, 2020
1 parent 5f8fd1f commit 127b880
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion transit/experimental/transit_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ void Read(base::Json const & obj, std::vector<Edge> & edges, EdgeIdToFeatureId &
FromJSONObjectOptionalField(obj.get(), "line_id", lineId);

TransitId featureId = kInvalidFeatureId;
FromJSONObjectOptionalField(obj.get(), "feature_id", featureId);
FromJSONObject(obj.get(), "feature_id", featureId);

if (lineId == 0)
{
Expand Down
2 changes: 1 addition & 1 deletion transit/transit_entities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ struct EdgeData

// Feature id for cross-mwm transit section. It is used in Segment class as a feature id for
// transit routing case.
uint32_t m_featureId = 0;
uint32_t m_featureId = std::numeric_limits<uint32_t>::max();
};

struct LineSegment
Expand Down
10 changes: 6 additions & 4 deletions transit/world_feed/world_feed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1569,8 +1569,9 @@ void Edges::Write(IdEdgeSet const & ids, std::ofstream & stream) const
ToJSONObject(*node, "stop_id_from", edgeId.m_fromStopId);
ToJSONObject(*node, "stop_id_to", edgeId.m_toStopId);

if (edge.m_featureId != 0)
ToJSONObject(*node, "feature_id", edge.m_featureId);
CHECK_NOT_EQUAL(edge.m_featureId, std::numeric_limits<uint32_t>::max(),
(edgeId.m_lineId, edgeId.m_fromStopId, edgeId.m_toStopId));
ToJSONObject(*node, "feature_id", edge.m_featureId);

CHECK_GREATER(edge.m_weight, 0, (edgeId.m_fromStopId, edgeId.m_toStopId, edgeId.m_lineId));
ToJSONObject(*node, "weight", edge.m_weight);
Expand All @@ -1592,8 +1593,9 @@ void EdgesTransfer::Write(IdEdgeTransferSet const & ids, std::ofstream & stream)
ToJSONObject(*node, "stop_id_to", edgeTransferId.m_toStopId);
ToJSONObject(*node, "weight", edgeData.m_weight);

if (edgeData.m_featureId != 0)
ToJSONObject(*node, "feature_id", edgeData.m_featureId);
CHECK_NOT_EQUAL(edgeData.m_featureId, std::numeric_limits<uint32_t>::max(),
(edgeTransferId.m_fromStopId, edgeTransferId.m_toStopId));
ToJSONObject(*node, "feature_id", edgeData.m_featureId);

WriteJson(node.get(), stream);
}
Expand Down

0 comments on commit 127b880

Please sign in to comment.