forked from organicmaps/organicmaps
Merge pull request #2 from gardster/fixes
Xcode warnings fixes in routing.
This commit is contained in:
commit
3e50401401
9 changed files with 35 additions and 34 deletions
|
@ -84,11 +84,11 @@ inline bool SaveNodeDataToFile(std::string const & filename, NodeDataVectorT con
|
|||
if (!stream.is_open())
|
||||
return false;
|
||||
|
||||
uint32_t count = data.size();
|
||||
uint32_t count = static_cast<uint32_t>(data.size());
|
||||
stream.write((char*)&count, sizeof(count));
|
||||
for (auto d : data)
|
||||
{
|
||||
uint32_t pc = d.m_segments.size();
|
||||
uint32_t pc = static_cast<uint32_t>(d.m_segments.size());
|
||||
stream.write((char*)&pc, sizeof(pc));
|
||||
stream.write((char*)d.m_segments.data(), sizeof(NodeData::SegmentInfo) * pc);
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ void FindCrossNodes(osrm::NodeDataVectorT const & nodeData, gen::OsmID2FeatureID
|
|||
});
|
||||
});
|
||||
|
||||
for (size_t nodeId = 0; nodeId < nodeData.size(); ++nodeId)
|
||||
for (WritedNodeID nodeId = 0; nodeId < nodeData.size(); ++nodeId)
|
||||
{
|
||||
auto const & data = nodeData[nodeId];
|
||||
|
||||
|
@ -250,7 +250,7 @@ void BuildRoutingIndex(string const & baseDir, string const & countryName, strin
|
|||
|
||||
uint32_t found = 0, all = 0, multiple = 0, equal = 0, moreThan1Seg = 0, stored = 0;
|
||||
|
||||
for (size_t nodeId = 0; nodeId < nodeData.size(); ++nodeId)
|
||||
for (WritedNodeID nodeId = 0; nodeId < nodeData.size(); ++nodeId)
|
||||
{
|
||||
auto const & data = nodeData[nodeId];
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ size_t CrossRoutingContextReader::GetIndexInAdjMatrix(IngoingEdgeIteratorT ingoi
|
|||
|
||||
void CrossRoutingContextReader::Load(Reader const & r)
|
||||
{
|
||||
uint32_t size, pos = 0;
|
||||
size_t size, pos = 0;
|
||||
r.Read(pos, &size, sizeof(size));
|
||||
pos += sizeof(size);
|
||||
m_ingoingNodes.resize(size);
|
||||
|
@ -155,12 +155,12 @@ void CrossRoutingContextWriter::Save(Writer & w) const
|
|||
}
|
||||
}
|
||||
|
||||
void CrossRoutingContextWriter::AddIngoingNode(size_t const nodeId, m2::PointD const & point)
|
||||
void CrossRoutingContextWriter::AddIngoingNode(WritedNodeID const nodeId, m2::PointD const & point)
|
||||
{
|
||||
m_ingoingNodes.push_back(IngoingCrossNode(nodeId, point));
|
||||
}
|
||||
|
||||
void CrossRoutingContextWriter::AddOutgoingNode(size_t const nodeId, string const & targetMwm,
|
||||
void CrossRoutingContextWriter::AddOutgoingNode(WritedNodeID const nodeId, string const & targetMwm,
|
||||
m2::PointD const & point)
|
||||
{
|
||||
auto it = find(m_neighborMwmList.begin(), m_neighborMwmList.end(), targetMwm);
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
namespace routing
|
||||
{
|
||||
using WritedNodeID = uint32_t;
|
||||
using WritedEdgeWeightT = uint32_t;
|
||||
static WritedEdgeWeightT const INVALID_CONTEXT_EDGE_WEIGHT = std::numeric_limits<WritedEdgeWeightT>::max();
|
||||
static WritedEdgeWeightT const INVALID_CONTEXT_EDGE_NODE_ID = std::numeric_limits<uint32_t>::max();
|
||||
|
@ -16,10 +17,10 @@ static WritedEdgeWeightT const INVALID_CONTEXT_EDGE_NODE_ID = std::numeric_limit
|
|||
struct IngoingCrossNode
|
||||
{
|
||||
m2::PointD m_point;
|
||||
uint32_t m_nodeId;
|
||||
WritedNodeID m_nodeId;
|
||||
|
||||
IngoingCrossNode() : m_point(m2::PointD::Zero()), m_nodeId(INVALID_CONTEXT_EDGE_NODE_ID) {}
|
||||
IngoingCrossNode(uint32_t nodeId, m2::PointD const & point) :m_point(point), m_nodeId(nodeId) {}
|
||||
IngoingCrossNode(WritedNodeID nodeId, m2::PointD const & point) :m_point(point), m_nodeId(nodeId) {}
|
||||
|
||||
void Save(Writer & w) const;
|
||||
|
||||
|
@ -29,13 +30,13 @@ struct IngoingCrossNode
|
|||
struct OutgoingCrossNode
|
||||
{
|
||||
m2::PointD m_point;
|
||||
uint32_t m_nodeId;
|
||||
WritedNodeID m_nodeId;
|
||||
unsigned char m_outgoingIndex;
|
||||
|
||||
OutgoingCrossNode() : m_point(m2::PointD::Zero()), m_nodeId(INVALID_CONTEXT_EDGE_NODE_ID), m_outgoingIndex(0) {}
|
||||
OutgoingCrossNode(uint32_t nodeId, size_t const index, m2::PointD const & point) : m_point(point),
|
||||
m_nodeId(nodeId),
|
||||
m_outgoingIndex(static_cast<unsigned char>(index)){}
|
||||
OutgoingCrossNode(WritedNodeID nodeId, size_t const index, m2::PointD const & point) : m_point(point),
|
||||
m_nodeId(nodeId),
|
||||
m_outgoingIndex(static_cast<unsigned char>(index)){}
|
||||
|
||||
void Save(Writer & w) const;
|
||||
|
||||
|
@ -81,9 +82,9 @@ class CrossRoutingContextWriter
|
|||
public:
|
||||
void Save(Writer & w) const;
|
||||
|
||||
void AddIngoingNode(size_t const nodeId, m2::PointD const & point);
|
||||
void AddIngoingNode(WritedNodeID const nodeId, m2::PointD const & point);
|
||||
|
||||
void AddOutgoingNode(size_t const nodeId, string const & targetMwm, m2::PointD const & point);
|
||||
void AddOutgoingNode(WritedNodeID const nodeId, string const & targetMwm, m2::PointD const & point);
|
||||
|
||||
void ReserveAdjacencyMatrix();
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ void NearestEdgeFinder::AddInformationSource(FeatureID const & featureId, IRoadG
|
|||
{
|
||||
res.m_dist = d;
|
||||
res.m_fid = featureId;
|
||||
res.m_segId = i - 1;
|
||||
res.m_segId = static_cast<uint32_t>(i - 1);
|
||||
res.m_segStart = roadInfo.m_points[i - 1];
|
||||
res.m_segEnd = roadInfo.m_points[i];
|
||||
res.m_point = pt;
|
||||
|
|
|
@ -205,7 +205,7 @@ void OsrmFtSegMapping::GetOsrmNodes(FtSegSetT & segments, OsrmNodesT & res) cons
|
|||
for (uint32_t nodeId : nodeIds)
|
||||
{
|
||||
auto const & range = GetSegmentsRange(nodeId);
|
||||
for (int i = range.first; i != range.second; ++i)
|
||||
for (size_t i = range.first; i != range.second; ++i)
|
||||
{
|
||||
OsrmMappingTypes::FtSeg const s(m_segments[i]);
|
||||
if (s.m_fid != seg.m_fid)
|
||||
|
@ -259,7 +259,7 @@ pair<size_t, size_t> OsrmFtSegMapping::GetSegmentsRange(TOsrmNodeId nodeId) cons
|
|||
return make_pair(start, start + 1);
|
||||
}
|
||||
|
||||
TOsrmNodeId OsrmFtSegMapping::GetNodeId(size_t segInd) const
|
||||
TOsrmNodeId OsrmFtSegMapping::GetNodeId(uint32_t segInd) const
|
||||
{
|
||||
SegOffsetsT::const_iterator it = lower_bound(m_offsets.begin(), m_offsets.end(), OsrmMappingTypes::SegOffset(segInd, 0),
|
||||
[] (OsrmMappingTypes::SegOffset const & o, OsrmMappingTypes::SegOffset const & val)
|
||||
|
@ -422,7 +422,7 @@ void OsrmFtSegBackwardIndex::Construct(OsrmFtSegMapping & mapping, uint32_t maxN
|
|||
size_t removedNodes = 0;
|
||||
for (size_t i = 0; i < m_table->size(); ++i)
|
||||
{
|
||||
uint32_t const fid = m_oldFormat ? m_table->GetFeatureOffset(i) : i;
|
||||
uint32_t const fid = m_oldFormat ? m_table->GetFeatureOffset(i) : static_cast<uint32_t>(i);
|
||||
auto it = temporaryBackwardIndex.find(fid);
|
||||
if (it != temporaryBackwardIndex.end())
|
||||
{
|
||||
|
|
|
@ -164,9 +164,9 @@ public:
|
|||
/// @name For unit test purpose only.
|
||||
//@{
|
||||
/// @return STL-like range [s, e) of segments indexies for passed node.
|
||||
pair<size_t, size_t> GetSegmentsRange(uint32_t nodeId) const;
|
||||
pair<size_t, size_t> GetSegmentsRange(TOsrmNodeId nodeId) const;
|
||||
/// @return Node id for segment's index.
|
||||
TOsrmNodeId GetNodeId(size_t segInd) const;
|
||||
TOsrmNodeId GetNodeId(uint32_t segInd) const;
|
||||
|
||||
size_t GetSegmentsCount() const { return static_cast<size_t>(m_segments.size()); }
|
||||
//@}
|
||||
|
|
|
@ -93,10 +93,10 @@ public:
|
|||
EdgeDataT res;
|
||||
|
||||
res.shortcut = m_shortcuts[e];
|
||||
res.id = res.shortcut ? (node - bits::ZigZagDecode(m_edgeId[m_shortcuts.rank(e)])) : 0;
|
||||
res.id = res.shortcut ? (node - static_cast<NodeID>(bits::ZigZagDecode(m_edgeId[m_shortcuts.rank(e)]))) : 0;
|
||||
res.backward = (m_matrix.select(e) % 2 == 1);
|
||||
res.forward = !res.backward;
|
||||
res.distance = m_edgeData[e];
|
||||
res.distance = static_cast<int>(m_edgeData[e]);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -117,13 +117,13 @@ public:
|
|||
EdgeID BeginEdges(const NodeID n) const override
|
||||
{
|
||||
uint64_t idx = 2 * n * (uint64_t)GetNumberOfNodes();
|
||||
return n == 0 ? 0 : m_matrix.rank(min(idx, m_matrix.size()));
|
||||
return n == 0 ? 0 : static_cast<EdgeID>(m_matrix.rank(min(idx, m_matrix.size())));
|
||||
}
|
||||
|
||||
EdgeID EndEdges(const NodeID n) const override
|
||||
{
|
||||
uint64_t const idx = 2 * (n + 1) * (uint64_t)GetNumberOfNodes();
|
||||
return m_matrix.rank(min(idx, m_matrix.size()));
|
||||
return static_cast<EdgeID>(m_matrix.rank(min(idx, m_matrix.size())));
|
||||
}
|
||||
|
||||
EdgeRange GetAdjacentEdgeRange(const NodeID node) const override
|
||||
|
|
|
@ -95,7 +95,7 @@ public:
|
|||
{
|
||||
res.m_dist = d;
|
||||
res.m_fid = featureId;
|
||||
res.m_segIdx = i - 1;
|
||||
res.m_segIdx = static_cast<uint32_t>(i - 1);
|
||||
res.m_point = pt;
|
||||
}
|
||||
}
|
||||
|
@ -159,11 +159,11 @@ public:
|
|||
auto const range = m_mapping.GetSegmentsRange(nodeId);
|
||||
OsrmMappingTypes::FtSeg s, cSeg;
|
||||
|
||||
int si = forward ? range.second - 1 : range.first;
|
||||
int ei = forward ? range.first - 1 : range.second;
|
||||
size_t si = forward ? range.second - 1 : range.first;
|
||||
size_t ei = forward ? range.first - 1 : range.second;
|
||||
int di = forward ? -1 : 1;
|
||||
|
||||
for (int i = si; i != ei; i += di)
|
||||
for (size_t i = si; i != ei; i += di)
|
||||
{
|
||||
m_mapping.GetSegmentByIndex(i, s);
|
||||
if (!s.IsValid())
|
||||
|
@ -372,7 +372,7 @@ bool OsrmRouter::FindRouteFromCases(TFeatureGraphNodeVec const & source,
|
|||
return false;
|
||||
}
|
||||
|
||||
void FindGraphNodeOffsets(size_t const nodeId, m2::PointD const & point,
|
||||
void FindGraphNodeOffsets(uint32_t const nodeId, m2::PointD const & point,
|
||||
Index const * pIndex, TRoutingMappingPtr & mapping,
|
||||
FeatureGraphNode & graphNode)
|
||||
{
|
||||
|
@ -419,7 +419,7 @@ void CalculatePhantomNodeForCross(TRoutingMappingPtr & mapping, FeatureGraphNode
|
|||
if (graphNode.segment.IsValid())
|
||||
return;
|
||||
|
||||
size_t nodeId;
|
||||
uint32_t nodeId;
|
||||
if (forward)
|
||||
nodeId = graphNode.node.forward_node_id;
|
||||
else
|
||||
|
@ -497,7 +497,7 @@ OsrmRouter::ResultCode OsrmRouter::MakeRouteFromCrossesPath(TCheckedPath const &
|
|||
vector<m2::PointD> mwmPoints;
|
||||
MakeTurnAnnotation(routingResult, mwmMapping, delegate, mwmPoints, mwmTurnsDir, mwmTimes);
|
||||
// Connect annotated route.
|
||||
const uint32_t pSize = Points.size();
|
||||
const uint32_t pSize = static_cast<uint32_t>(Points.size());
|
||||
for (auto turn : mwmTurnsDir)
|
||||
{
|
||||
if (turn.m_index == 0)
|
||||
|
@ -712,7 +712,7 @@ OsrmRouter::ResultCode OsrmRouter::MakeTurnAnnotation(
|
|||
if (j > 0 && !points.empty())
|
||||
{
|
||||
turns::TurnItem t;
|
||||
t.m_index = points.size() - 1;
|
||||
t.m_index = static_cast<uint32_t>(points.size() - 1);
|
||||
|
||||
turns::TurnInfo turnInfo(*mapping, segment[j - 1].node, segment[j].node);
|
||||
turns::GetTurnDirection(*m_pIndex, turnInfo, t);
|
||||
|
@ -827,7 +827,7 @@ OsrmRouter::ResultCode OsrmRouter::MakeTurnAnnotation(
|
|||
if (routingResult.targetEdge.segment.IsValid())
|
||||
{
|
||||
turnsDir.push_back(
|
||||
turns::TurnItem(points.size() - 1, turns::TurnDirection::ReachedYourDestination));
|
||||
turns::TurnItem(static_cast<uint32_t>(points.size() - 1), turns::TurnDirection::ReachedYourDestination));
|
||||
}
|
||||
turns::FixupTurns(points, turnsDir);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue