-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNodeInterface.h
55 lines (46 loc) · 1.28 KB
/
NodeInterface.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef NODEINTERFACE_H
#define NODEINTERFACE_H
#include "stdafx.h"
#include "RoadGraph.h"
#include <OgreVector2.h>
#include <OgreVector3.h>
class NodeInterface
{
protected:
RoadGraph& _roadGraph;
public:
NodeId _nodeId;
Ogre::Real _r,_s;
NodeInterface(RoadGraph& g) : _roadGraph(g)
{
}
virtual ~NodeInterface() {}
virtual Ogre::Vector2 getPosition2D() const = 0;
virtual Ogre::Vector3 getPosition3D() const = 0;
virtual bool setPosition2D(Ogre::Real x, Ogre::Real z) = 0;
virtual bool setPosition2D(const Ogre::Vector2& pos) = 0;
virtual void setPosition3D(Ogre::Real x, Ogre::Real y, Ogre::Real z) = 0;
virtual void onAddRoad() {}
virtual void onRemoveRoad() {}
virtual std::pair<Ogre::Vector3, Ogre::Vector3> getRoadJunction(RoadId rd) = 0;
virtual size_t getDegree()
{
return _roadGraph.getDegree(_nodeId);
}
friend RoadInterface* getRoad(NodeInterface* n1, NodeInterface* n2)
{
RoadGraph& g(n1->_roadGraph);
return g.getRoad(g.getRoadId(n1->_nodeId, n2->_nodeId));
}
friend std::ostream& operator<<(std::ostream& os, const NodeInterface& n)
{
os << n.getPosition2D();
return os;
}
};
//std::ostream& operator<<(std::ostream& os, const NodeInterface& n)
//{
// os << n.getPosition2D();
// return os;
//}
#endif