SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TraCIServerAPI_Lane.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // APIs for getting/setting lane values via TraCI
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
11 // Copyright (C) 2001-2014 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 #ifndef TraCIServerAPI_Lane_h
22 #define TraCIServerAPI_Lane_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #ifndef NO_TRACI
35 
36 #include <foreign/tcpip/storage.h>
37 
38 
39 // ===========================================================================
40 // class declarations
41 // ===========================================================================
42 class TraCIServer;
43 
44 
45 // ===========================================================================
46 // class definitions
47 // ===========================================================================
53 public:
60  static bool processGet(TraCIServer& server, tcpip::Storage& inputStorage,
61  tcpip::Storage& outputStorage);
62 
63 
70  static bool processSet(TraCIServer& server, tcpip::Storage& inputStorage,
71  tcpip::Storage& outputStorage);
72 
73 
80  static bool getShape(const std::string& id, PositionVector& shape);
81 
82 
87  public:
89  StoringVisitor(std::set<std::string>& ids, const PositionVector& shape,
90  const SUMOReal range, const int domain)
91  : myIDs(ids), myShape(shape), myRange(range), myDomain(domain) {}
92 
95 
97  void add(const MSLane* const l) const;
98 
100  std::set<std::string>& myIDs;
103  const int myDomain;
104 
105  private:
107  StoringVisitor(const StoringVisitor& src);
108 
111  };
112 
113 
114 private:
117 
120 
121 
122 };
123 
124 
125 #define LANE_RTREE_QUAL RTree<MSLane*, MSLane, float, 2, TraCIServerAPI_Lane::StoringVisitor>
126 
127 template<>
128 inline float LANE_RTREE_QUAL::RectSphericalVolume(Rect* a_rect) {
129  ASSERT(a_rect);
130  const float extent0 = a_rect->m_max[0] - a_rect->m_min[0];
131  const float extent1 = a_rect->m_max[1] - a_rect->m_min[1];
132  return .78539816f * (extent0 * extent0 + extent1 * extent1);
133 }
134 
135 template<>
136 inline LANE_RTREE_QUAL::Rect LANE_RTREE_QUAL::CombineRect(Rect* a_rectA, Rect* a_rectB) {
137  ASSERT(a_rectA && a_rectB);
138  Rect newRect;
139  newRect.m_min[0] = rtree_min(a_rectA->m_min[0], a_rectB->m_min[0]);
140  newRect.m_max[0] = rtree_max(a_rectA->m_max[0], a_rectB->m_max[0]);
141  newRect.m_min[1] = rtree_min(a_rectA->m_min[1], a_rectB->m_min[1]);
142  newRect.m_max[1] = rtree_max(a_rectA->m_max[1], a_rectB->m_max[1]);
143  return newRect;
144 }
145 
146 #endif
147 
148 #endif
149 
150 /****************************************************************************/
static bool processGet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xa3: Get Lane Variable)
StoringVisitor(std::set< std::string > &ids, const PositionVector &shape, const SUMOReal range, const int domain)
Constructor.
static bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xc3: Change Lane State)
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.
void add(const MSLane *const l) const
Adds the given object to the container.
#define ASSERT
Definition: RTree.h:12
#define rtree_min(a, b)
Definition: RTree.h:20
A list of positions.
TraCIServerAPI_Lane & operator=(const TraCIServerAPI_Lane &s)
invalidated assignment operator
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
#define SUMOReal
Definition: config.h:215
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
APIs for getting/setting lane values via TraCI.
static bool getShape(const std::string &id, PositionVector &shape)
Returns the named lane's shape.