SUMO - Simulation of Urban MObility
NBNetBuilder.h
Go to the documentation of this file.
1 /****************************************************************************/
11 // Instance responsible for building networks
12 /****************************************************************************/
13 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
14 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
15 /****************************************************************************/
16 //
17 // This file is part of SUMO.
18 // SUMO is free software: you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation, either version 3 of the License, or
21 // (at your option) any later version.
22 //
23 /****************************************************************************/
24 #ifndef NBNetBuilder_h
25 #define NBNetBuilder_h
26 
27 
28 // ===========================================================================
29 // included modules
30 // ===========================================================================
31 #ifdef _MSC_VER
32 #include <windows_config.h>
33 #else
34 #include <config.h>
35 #endif
36 
37 #include <string>
38 #include <iostream>
39 #include <vector>
40 #include <set>
41 #include "NBEdgeCont.h"
42 #include "NBTypeCont.h"
43 #include "NBNodeCont.h"
44 #include "NBNode.h"
46 #include "NBDistrictCont.h"
47 #include "NBPTStopCont.h"
48 #include "NBPTLineCont.h"
50 
51 
52 // ===========================================================================
53 // class declarations
54 // ===========================================================================
55 class OptionsCont;
56 class OutputDevice;
57 class GeoConvHelper;
58 
59 
60 // ===========================================================================
61 // class definitions
62 // ===========================================================================
116  friend class GNENet; // for triggering intermediate build steps
117 
118 public:
120  NBNetBuilder();
121 
123  ~NBNetBuilder();
124 
133  void applyOptions(OptionsCont& oc);
134 
142  void compute(OptionsCont& oc, const std::set<std::string>& explicitTurnarounds = std::set<std::string>(), bool mayAddOrRemove = true);
143 
151  //void computeSingleNode(NBNode* node, OptionsCont& oc, const std::set<std::string>& explicitTurnarounds = std::set<std::string>(), bool mayAddOrRemove = true);
152 
157  return myEdgeCont;
158  }
159 
162  return myNodeCont;
163  }
164 
167  return myTypeCont;
168  }
169 
172  return myTLLCont;
173  }
174 
177  return myDistrictCont;
178  }
179 
180 
183  return myPTStopCont;
184  }
185 
188  return myPTLineCont;
189  }
191 
195  }
196 
199  return myNetworkHaveCrossings;
200  }
201 
203  void setHaveNetworkCrossings(bool value) {
204  myNetworkHaveCrossings = value;
205  }
206 
215  static bool transformCoordinate(Position& from, bool includeInBoundary = true, GeoConvHelper* from_srs = 0);
216  static bool transformCoordinates(PositionVector& from, bool includeInBoundary = true, GeoConvHelper* from_srs = 0);
217 
218 
219 protected:
224  class by_id_sorter {
225  public:
227  explicit by_id_sorter() {}
228 
230  int operator()(const NBNode* n1, const NBNode* n2) const {
231  return n1->getID() < n2->getID();
232  }
233  };
234 
235 protected:
238 
241 
244 
247 
250 
253 
256 
259 
262 
263 private:
265  void moveToOrigin(GeoConvHelper& geoConvHelper, bool lefthand);
266 
268  void mirrorX();
269 
270 private:
272  NBNetBuilder(const NBNetBuilder& s);
273 
276 };
277 
278 
279 #endif
280 
281 /****************************************************************************/
282 
NBNetBuilder()
Constructor.
void setHaveNetworkCrossings(bool value)
enable crossing in networks
Definition: NBNetBuilder.h:203
NBTypeCont myTypeCont
The used container for street types.
Definition: NBNetBuilder.h:240
NBPTStopCont myPTStopCont
The used container for pt stops.
Definition: NBNetBuilder.h:252
NBTypeCont & getTypeCont()
Returns a reference to the type container.
Definition: NBNetBuilder.h:166
static bool transformCoordinate(Position &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
transforms loaded coordinates handles projections, offsets (using GeoConvHelper) and import of height...
void mirrorX()
mirror the network along the X-axis
A container for traffic light definitions and built programs.
~NBNetBuilder()
Destructor.
A container for districts.
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:92
NBPTStopCont & getPTStopCont()
Returns a reference to the pt stop container.
Definition: NBNetBuilder.h:182
NBPTLineCont & getPTLineCont()
Returns a reference to the pt line container.
Definition: NBNetBuilder.h:187
static bool transformCoordinates(PositionVector &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
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:66
int operator()(const NBNode *n1, const NBNode *n2) const
selection operator
Definition: NBNetBuilder.h:230
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()
Definition: NBNetBuilder.h:156
A list of positions.
NBEdgeCont myEdgeCont
The used container for edges.
Definition: NBNetBuilder.h:243
void haveLoadedNetworkWithoutInternalEdges()
notify about style of loaded network (Without internal edges
Definition: NBNetBuilder.h:193
bool myNetworkHaveCrossings
flag to indicate that network has crossings
Definition: NBNetBuilder.h:261
NBTrafficLightLogicCont myTLLCont
The used container for traffic light logics.
Definition: NBNetBuilder.h:246
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:66
Sorts nodes by their ids.
Definition: NBNetBuilder.h:224
bool haveNetworkCrossings()
notify about style of loaded network (Without Crossings)
Definition: NBNetBuilder.h:198
void moveToOrigin(GeoConvHelper &geoConvHelper, bool lefthand)
shift network so its lower left corner is at 0,0
NBNodeCont & getNodeCont()
Returns a reference to the node container.
Definition: NBNetBuilder.h:161
Instance responsible for building networks.
Definition: NBNetBuilder.h:115
A storage for options typed value containers)
Definition: OptionsCont.h:99
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
Definition: NBNetBuilder.h:171
Represents a single node (junction) during network building.
Definition: NBNode.h:75
NBDistrictCont myDistrictCont
The used container for districts.
Definition: NBNetBuilder.h:249
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
void compute(OptionsCont &oc, const std::set< std::string > &explicitTurnarounds=std::set< std::string >(), bool mayAddOrRemove=true)
Performs the network building steps.
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:63
bool myHaveLoadedNetworkWithoutInternalEdges
whether a .net.xml without internal edges was loaded
Definition: NBNetBuilder.h:258
NBNodeCont myNodeCont
The used container for nodes.
Definition: NBNetBuilder.h:237
NBDistrictCont & getDistrictCont()
Returns a reference the districts container.
Definition: NBNetBuilder.h:176
NBPTLineCont myPTLineCont
The used container for pt stops.
Definition: NBNetBuilder.h:255
A storage for available types of edges.
Definition: NBTypeCont.h:62