SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NBNetBuilder.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // Instance responsible for building networks
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
13 // Copyright (C) 2001-2014 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 #ifndef NBNetBuilder_h
24 #define NBNetBuilder_h
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
36 #include <string>
37 #include <iostream>
38 #include <vector>
39 #include <set>
40 #include "NBEdgeCont.h"
41 #include "NBTypeCont.h"
42 #include "NBNodeCont.h"
43 #include "NBNode.h"
45 #include "NBDistrictCont.h"
46 #include "NBJoinedEdgesMap.h"
48 
49 
50 // ===========================================================================
51 // class declarations
52 // ===========================================================================
53 class OptionsCont;
54 class OutputDevice;
55 class GeoConvHelper;
56 
57 
58 // ===========================================================================
59 // class definitions
60 // ===========================================================================
114  friend class GNENet; // for triggering intermediate build steps
115 
116 public:
118  NBNetBuilder();
119 
121  ~NBNetBuilder();
122 
123 
132  void applyOptions(OptionsCont& oc);
133 
134 
142  void compute(OptionsCont& oc,
143  const std::set<std::string>& explicitTurnarounds = std::set<std::string>(),
144  bool removeElements = true);
145 
146 
147 
150 
155  return myEdgeCont;
156  }
157 
158 
163  return myNodeCont;
164  }
165 
166 
171  return myTypeCont;
172  }
173 
174 
179  return myTLLCont;
180  }
181 
182 
187  return myDistrictCont;
188  }
189 
190 
194  const std::vector<EdgeVector>& getRoundabouts() const {
195  return myRoundabouts;
196  }
197 
198 
203  return myJoinedEdges;
204  }
206 
207 
210  myHaveSeenRoundabouts = true;
211  }
212 
221  static bool transformCoordinates(Position& from, bool includeInBoundary = true, GeoConvHelper* from_srs = 0);
222  static bool transformCoordinates(PositionVector& from, bool includeInBoundary = true, GeoConvHelper* from_srs = 0);
223 
224 
225 protected:
230  class by_id_sorter {
231  public:
233  explicit by_id_sorter() { }
234 
235  int operator()(const NBNode* n1, const NBNode* n2) const {
236  return n1->getID() < n2->getID();
237  }
238 
239  };
240 
241 protected:
244 
247 
250 
253 
256 
259 
261  std::vector<EdgeVector> myRoundabouts;
262 
265 
266 private:
268  void moveToOrigin(GeoConvHelper& geoConvHelper);
269 
270 private:
272  NBNetBuilder(const NBNetBuilder& s);
273 
276 
277 };
278 
279 
280 #endif
281 
282 /****************************************************************************/
283 
void moveToOrigin(GeoConvHelper &geoConvHelper)
shift network so its lower left corner is at 0,0
NBNetBuilder()
Constructor.
NBTypeCont myTypeCont
The used container for street types.
Definition: NBNetBuilder.h:246
NBTypeCont & getTypeCont()
Returns the type container.
Definition: NBNetBuilder.h:170
void haveSeenRoundabouts()
declare that roundabouts have been seen during loading
Definition: NBNetBuilder.h:209
static bool transformCoordinates(Position &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
transforms loaded coordinates handles projections, offsets (using GeoConvHelper) and import of height...
NBJoinedEdgesMap myJoinedEdges
Map of joined edges.
Definition: NBNetBuilder.h:264
A container for traffic light definitions and built programs.
void compute(OptionsCont &oc, const std::set< std::string > &explicitTurnarounds=std::set< std::string >(), bool removeElements=true)
Performs the network building steps.
~NBNetBuilder()
Destructor.
A container for districts.
bool myHaveSeenRoundabouts
whether a sumo network with roundabout information was loaded
Definition: NBNetBuilder.h:258
NBNetBuilder & operator=(const NBNetBuilder &s)
invalidated assignment operator
void applyOptions(OptionsCont &oc)
Initialises the storage by applying given options.
const std::vector< EdgeVector > & getRoundabouts() const
Returns the determined roundabouts.
Definition: NBNetBuilder.h:194
const std::string & getID() const
Returns the id.
Definition: Named.h:60
int operator()(const NBNode *n1, const NBNode *n2) const
Definition: NBNetBuilder.h:235
static methods for processing the coordinates conversion for the current net
Definition: GeoConvHelper.h:59
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
NBEdgeCont & getEdgeCont()
Returns the edge container.
Definition: NBNetBuilder.h:154
A list of positions.
NBEdgeCont myEdgeCont
The used container for edges.
Definition: NBNetBuilder.h:249
NBTrafficLightLogicCont myTLLCont
The used container for traffic light logics.
Definition: NBNetBuilder.h:252
std::vector< EdgeVector > myRoundabouts
Edges marked as belonging to a roundabout (each EdgeVector is a roundabout)
Definition: NBNetBuilder.h:261
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:66
const NBJoinedEdgesMap & getJoinedEdgesMap() const
Returns the joined edges map.
Definition: NBNetBuilder.h:202
Sorts nodes by their ids.
Definition: NBNetBuilder.h:230
NBNodeCont & getNodeCont()
Returns the node container.
Definition: NBNetBuilder.h:162
A structure storing information about which edges were joined.
Instance responsible for building networks.
Definition: NBNetBuilder.h:113
A storage for options typed value containers)
Definition: OptionsCont.h:108
NBTrafficLightLogicCont & getTLLogicCont()
Returns the traffic light logics container.
Definition: NBNetBuilder.h:178
Represents a single node (junction) during network building.
Definition: NBNode.h:74
NBDistrictCont myDistrictCont
The used container for districts.
Definition: NBNetBuilder.h:255
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:64
friend class GNENet
Definition: NBNetBuilder.h:114
NBNodeCont myNodeCont
The used container for nodes.
Definition: NBNetBuilder.h:243
NBDistrictCont & getDistrictCont()
Returns the districts container.
Definition: NBNetBuilder.h:186
A storage for available types of edges.
Definition: NBTypeCont.h:56