All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
CandidateSetGenerator.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Routes.h"
6 #include "Space.h"
7 #include "Geometry.h"
8 #include "VectorMathDecl.h"
9 #include "VectorMath.h"
10 #include "Bounds.h"
11 #include <vector>
12 
13 namespace Eegeo
14 {
15  namespace Routes
16  {
17  namespace Fitting
18  {
19  namespace NavGraphConforming
20  {
22  {
23  public:
24  CandidateSetGenerator(const std::vector<LocalRouteVertex>& inputLocalRouteVertices,
25  const std::vector<int>& clipVertexIndices,
26  const Space::CubeMap::CubeMapCellInfo& cellInfo,
27  const std::vector<const NavGraphFittingInfoForKey*>& roadFittingInfos,
28  const std::vector<const NavGraphFittingInfoForKey*>& railFittingInfos,
29  const Geometry::Point3Spline& routeSectionSpline,
30  const float maxRadius,
31  bool debugLog);
32 
33  void CreateCandidateSets(std::vector<const CandidateSet*>& out_candidateSets, bool& out_anyCandidatesFound);
34 
35  private:
36  CandidateSet* CreateCandidateSet(int srcVertexIndex);
37 
38  void CreateCandidatesForVertex(
39  const v3& lineSegmentStart,
40  const v3& lineSegmentEnd,
41  const std::vector<const NavGraphRoadFittingInfo*>& fittingInfos,
42  std::vector<Candidate*>& out_candidates,
43  int& out_uniqueRoadCount
44  );
45 
46  void CreateCandidatesForRoad(const v3& lineSegmentStartInFittingInfo,
47  const v3& lineSegmentEndInFittingInfo,
48  const NavGraphRoadFittingInfo& roadInfo,
49  const v3& translationToFittingInfoCell,
50  std::vector<Candidate*>& out_candidates);
51 
52  bool IsRoadPotentiallyClipped(const NavGraphRoadFittingInfo& roadInfo) const;
53 
54  bool IsRoadEncapsulatedByInflatedRoute(
55  const Geometry::Point3Spline& roadSpline,
56  const v3& translationToCentralCell) const;
57 
58  bool IsRoadPotentiallyIntersectingRoute(const Geometry::Point3Spline& roadSpline,
59  const v3& translationToFittingInfoCell,
60  std::vector<v3>::const_iterator routePointsStart,
61  std::vector<v3>::const_iterator routePointsEnd) const;
62 
63  void FindRoadsPotentiallyIntersectingRoute(const std::vector<const NavGraphFittingInfoForKey*>& fittingInfos,
64  std::vector<const NavGraphRoadFittingInfo*>& out_roadFittingInfos) const;
65 
66  void FindRoadsEncapsulatedByInflatedRoute(const std::vector<const NavGraphRoadFittingInfo*>& roadsPotentiallyIntersectingRoute,
67  std::vector<const NavGraphRoadFittingInfo*>& out_roadsEncapsulatedByInflatedRoute,
68  std::vector<const NavGraphRoadFittingInfo*>& out_remainder) const;
69 
70  void FindRoadsPotentiallyClipped(const std::vector<const NavGraphRoadFittingInfo*>& roads,
71  std::vector<const NavGraphRoadFittingInfo*>& out_roadsPotentiallyClipped) const;
72 
73  void FindCandidateRoads(const std::vector<const NavGraphFittingInfoForKey*>& fittingInfos,
74  std::vector<const NavGraphRoadFittingInfo*>& out_roadFittingInfos) const;
75 
76 
77  const std::vector<LocalRouteVertex>& m_inputLocalRouteVertices;
78  const std::vector<int>& m_clipVertexIndices;
79  const Space::CubeMap::CubeMapCellInfo& m_cellInfo;
80 
81  std::vector<const NavGraphRoadFittingInfo*> m_roadCandidateFittingInfos;
82  std::vector<const NavGraphRoadFittingInfo*> m_railCandidateFittingInfos;
83 
84  const Geometry::Point3Spline& m_routeSectionSpline;
85  const float m_maxRadius;
86  Eegeo::Geometry::Bounds3D m_inflatedRouteSectionBounds;
87  bool m_debugLog;
88  };
89  }
90  }
91  }
92 }