SUMO - Simulation of Urban MObility
TraCIServerAPI_Lane.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // APIs for getting/setting lane values via TraCI
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef TraCIServerAPI_Lane_h
23 #define TraCIServerAPI_Lane_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #ifndef NO_TRACI
36 
37 #include <foreign/tcpip/storage.h>
38 
39 
40 // ===========================================================================
41 // class declarations
42 // ===========================================================================
43 class TraCIServer;
44 
45 
46 // ===========================================================================
47 // class definitions
48 // ===========================================================================
54 public:
61  static bool processGet(TraCIServer& server, tcpip::Storage& inputStorage,
62  tcpip::Storage& outputStorage);
63 
64 
71  static bool processSet(TraCIServer& server, tcpip::Storage& inputStorage,
72  tcpip::Storage& outputStorage);
73 
74 
81  static bool getShape(const std::string& id, PositionVector& shape);
82 
83 
88  public:
90  StoringVisitor(std::set<std::string>& ids, const PositionVector& shape,
91  const double range, const int domain)
92  : myIDs(ids), myShape(shape), myRange(range), myDomain(domain) {}
93 
96 
98  void add(const MSLane* const l) const;
99 
101  std::set<std::string>& myIDs;
103  const double myRange;
104  const int myDomain;
105 
106  private:
108  StoringVisitor(const StoringVisitor& src);
109 
112  };
113 
114 
115 private:
118 
121 
122 
123 };
124 
125 
126 #define LANE_RTREE_QUAL RTree<MSLane*, MSLane, float, 2, TraCIServerAPI_Lane::StoringVisitor>
127 
128 template<>
129 inline float LANE_RTREE_QUAL::RectSphericalVolume(Rect* a_rect) {
130  ASSERT(a_rect);
131  const float extent0 = a_rect->m_max[0] - a_rect->m_min[0];
132  const float extent1 = a_rect->m_max[1] - a_rect->m_min[1];
133  return .78539816f * (extent0 * extent0 + extent1 * extent1);
134 }
135 
136 template<>
137 inline LANE_RTREE_QUAL::Rect LANE_RTREE_QUAL::CombineRect(Rect* a_rectA, Rect* a_rectB) {
138  ASSERT(a_rectA && a_rectB);
139  Rect newRect;
140  newRect.m_min[0] = rtree_min(a_rectA->m_min[0], a_rectB->m_min[0]);
141  newRect.m_max[0] = rtree_max(a_rectA->m_max[0], a_rectB->m_max[0]);
142  newRect.m_min[1] = rtree_min(a_rectA->m_min[1], a_rectB->m_min[1]);
143  newRect.m_max[1] = rtree_max(a_rectA->m_max[1], a_rectB->m_max[1]);
144  return newRect;
145 }
146 
147 #endif
148 
149 #endif
150 
151 /****************************************************************************/
static bool processGet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xa3: Get Lane Variable)
static bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xc3: Change Lane State)
StoringVisitor(std::set< std::string > &ids, const PositionVector &shape, const double range, const int domain)
Constructor.
StoringVisitor & operator=(const StoringVisitor &src)
invalidated assignment operator
std::set< std::string > & myIDs
The container.
Allows to store the object; used as context while traveling the rtree in TraCI.
#define ASSERT
Definition: RTree.h:12
#define rtree_min(a, b)
Definition: RTree.h:20
A list of positions.
TraCI server used to control sumo by a remote TraCI client.
Definition: TraCIServer.h:74
#define rtree_max(a, b)
Definition: RTree.h:21
TraCIServerAPI_Lane(const TraCIServerAPI_Lane &s)
invalidated copy constructor
void add(const MSLane *const l) const
Adds the given object to the container.
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
APIs for getting/setting lane values via TraCI.
static bool getShape(const std::string &id, PositionVector &shape)
Returns the named lane&#39;s shape.