All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
RoadNameClassificationPatcher.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Roads.h"
6 #include "IRoadNameClassificationPatcher.h"
7 #include "Types.h"
8 #include "VectorMath.h"
9 #include "RoadClassification.h"
10 #include "Space.h"
11 #include "Geometry.h"
12 
13 #include <vector>
14 #include <utility>
15 
16 namespace Eegeo
17 {
18  namespace Resources
19  {
20  namespace Roads
21  {
23  {
24  public:
25  RoadNameClassificationPatcher(FunctionalRoadClass::Type defaultFrc,
26  int defaultNumLanes,
27  float maxSearchRadius);
28 
29  void PatchRoadClassifications(const Space::CubeMap::CubeMapCellInfo& cellInfo,
30  const NavGraphData& navGraphDto,
32  private:
33  typedef std::pair<Geometry::Bounds2D, int> AABBToRoadIndex;
34 
35  bool FindBestFitNavGraphRoad(const IO::ChunkedFileFormat::RoadNamesChunkReader::RoadNameInstance& roadNameInstance,
36  const m44& ecefToTangent,
37  const std::vector<v2>& navGraphVertsTangent,
38  const std::vector<AABBToRoadIndex>& aabbToRoadIndices,
39  const NavGraphData& navGraphDto,
40  const NavGraphRoadData*& out_navGraphRoadData);
41 
42 
43  bool LineSegmentLiesOnNavGraphRoad(const v2& a,
44  const v2& b,
45  const std::vector<v2>& navGraphVertsTangent,
46  const NavGraphRoadData& navGraphRoadDto) const;
47 
48  void ProjectNavGraphVerts(const m44& ecefToTangent, const NavGraphData& navGraphDto, std::vector<v2>& out_navGraphVertsTangent) const;
49 
50  void BuildOrderedNavGraphAABBs(const NavGraphData& navGraphDto, const std::vector<v2>& navGraphVertsTangent, std::vector<AABBToRoadIndex>& out_aabbToRoadIndices);
51 
52  const FunctionalRoadClass::Type m_defaultFrc;
53  const int m_defaultNumLanes;
54  const float m_epsilon;
55  const float m_epsilonSq;
56 
57  std::vector<const NavGraphRoadData*> m_roadSegmentNavGraphDataScratch;
58  std::vector<RoadClassification> m_roadClassificationScratch;
59  std::vector<v2> m_navGraphVertsTangentScatch;
60  std::vector<AABBToRoadIndex> m_aabbToRoadIndicesScatch;
61  };
62  }
63  }
64 }
65 
66