SUMO - Simulation of Urban MObility
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.dlr.de/
13 // Copyright (C) 2001-2015 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 
194  return myJoinedEdges;
195  }
197 
198 
202  }
203 
212  static bool transformCoordinates(Position& from, bool includeInBoundary = true, GeoConvHelper* from_srs = 0);
213  static bool transformCoordinates(PositionVector& from, bool includeInBoundary = true, GeoConvHelper* from_srs = 0);
214 
215 
216 protected:
221  class by_id_sorter {
222  public:
224  explicit by_id_sorter() { }
225 
226  int operator()(const NBNode* n1, const NBNode* n2) const {
227  return n1->getID() < n2->getID();
228  }
229 
230  };
231 
232 protected:
235 
238 
241 
244 
247 
250 
253 
254 private:
256  void moveToOrigin(GeoConvHelper& geoConvHelper, bool lefthand);
257 
259  void mirrorX();
260 
261 private:
263  NBNetBuilder(const NBNetBuilder& s);
264 
267 
268 };
269 
270 
271 #endif
272 
273 /****************************************************************************/
274 
NBNetBuilder()
Constructor.
NBTypeCont myTypeCont
The used container for street types.
Definition: NBNetBuilder.h:237
NBTypeCont & getTypeCont()
Returns the type container.
Definition: NBNetBuilder.h:170
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:249
void mirrorX()
mirror the network along the X-axis
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.
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:77
NBNetBuilder & operator=(const NBNetBuilder &s)
invalidated assignment operator
void applyOptions(OptionsCont &oc)
Initialises the storage by applying given options.
const std::string & getID() const
Returns the id.
Definition: Named.h:65
int operator()(const NBNode *n1, const NBNode *n2) const
Definition: NBNetBuilder.h:226
static methods for processing the coordinates conversion for the current net
Definition: GeoConvHelper.h:60
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:240
void haveLoadedNetworkWithoutInternalEdges()
notify about style of loaded network
Definition: NBNetBuilder.h:200
NBTrafficLightLogicCont myTLLCont
The used container for traffic light logics.
Definition: NBNetBuilder.h:243
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:193
Sorts nodes by their ids.
Definition: NBNetBuilder.h:221
void moveToOrigin(GeoConvHelper &geoConvHelper, bool lefthand)
shift network so its lower left corner is at 0,0
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:246
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:64
bool myHaveLoadedNetworkWithoutInternalEdges
whether a .net.xml without internal edges was loaded
Definition: NBNetBuilder.h:252
NBNodeCont myNodeCont
The used container for nodes.
Definition: NBNetBuilder.h:234
NBDistrictCont & getDistrictCont()
Returns the districts container.
Definition: NBNetBuilder.h:186
A storage for available types of edges.
Definition: NBTypeCont.h:62