All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
TiledGraphBuilder.h
1 #pragma once
2 
3 #include "Graphs.h"
4 #include "TiledGraphCell.h"
5 
6 #include <vector>
7 
8 namespace Eegeo
9 {
10  namespace Graphs
11  {
12  namespace Builder
13  {
15  {
16  int Id;
17  v3 Point;
18  int FirstHalfEdge;
19  };
20 
22  {
23  int Id;
24  int StartHalfEdge;
25  int AttributesId;
26  float Weight;
27  bool ReverseDirection;
28  };
29 
31  {
32  int Id;
33  int Node;
34  int AdjacentHalfEdge;
35  int NextHalfEdge;
36  int Edge;
37  bool IsFromNode;
38  };
39  }
40 
42  {
43  public:
44  typedef int NodeId;
45  typedef int EdgeId;
46  const static EdgeId InvalidEdgeId;
47 
49 
50  void Clear();
51 
52  void SetCellKey(const Eegeo::Streaming::MortonKey& key);
53  NodeId AddNode(const v3& point);
54  EdgeId AddEdge(NodeId nodeIdA, NodeId nodeIdB, int edgeAttributeId, float weight, bool reverseDirection);
55 
56  bool IsError() const { return m_isError; }
57  TiledGraphCell* CreateTiledGraphCellOrNull();
58  private:
59 
60  TiledGraphNodeId MakeNodeId(const Builder::TiledGraphBuilderHalfEdge& halfEdge) const;
61 
62  bool NodeExists(int nodeId) const;
63 
65  dv3 m_originEcef;
66 
67  bool m_cellIsSet;
68  bool m_isError;
69 
70  std::vector<Builder::TiledGraphBuilderNode> m_nodes;
71  std::vector<Builder::TiledGraphBuilderEdge> m_edges;
72  std::vector<Builder::TiledGraphBuilderHalfEdge> m_halfEdges;
73 
74  std::vector<TiledGraphNode> m_tiledGraphNodes;
75  std::vector<TiledGraphEdge> m_tiledGraphEdges;
76  std::vector<int> m_incidentBuilderEdgeIds;
77  std::vector<int> m_incidentEdges;
78  std::vector<int> m_edgesWithExternalNodesForward;
79  std::vector<int> m_edgesWithExternalNodesReversed;
80  };
81 
82 
83  }
84 }