SUMO - Simulation of Urban MObility
NBNetBuilder.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
21 // Instance responsible for building networks
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"
44 #include "NBParking.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 
193  return myParkingCont;
194  }
195 
199  }
200 
203  return myNetworkHaveCrossings;
204  }
205 
207  void setHaveNetworkCrossings(bool value) {
208  myNetworkHaveCrossings = value;
209  }
210 
219  static bool transformCoordinate(Position& from, bool includeInBoundary = true, GeoConvHelper* from_srs = 0);
220  static bool transformCoordinates(PositionVector& from, bool includeInBoundary = true, GeoConvHelper* from_srs = 0);
221 
222 
223 protected:
228  class by_id_sorter {
229  public:
231  explicit by_id_sorter() {}
232 
234  int operator()(const NBNode* n1, const NBNode* n2) const {
235  return n1->getID() < n2->getID();
236  }
237  };
238 
239 protected:
242 
245 
248 
251 
254 
257 
260 
262 
265 
268 
269 private:
271  void moveToOrigin(GeoConvHelper& geoConvHelper, bool lefthand);
272 
274  void mirrorX();
275 
276 private:
278  NBNetBuilder(const NBNetBuilder& s);
279 
282 };
283 
284 
285 #endif
286 
287 /****************************************************************************/
288 
NBNetBuilder()
Constructor.
void setHaveNetworkCrossings(bool value)
enable crossing in networks
Definition: NBNetBuilder.h:207
NBTypeCont myTypeCont
The used container for street types.
Definition: NBNetBuilder.h:244
NBPTStopCont myPTStopCont
The used container for pt stops.
Definition: NBNetBuilder.h:256
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:91
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)
const std::string & getID() const
Returns the id.
Definition: Named.h:65
NBParkingCont & getParkingCont()
Definition: NBNetBuilder.h:192
NBNetBuilder & operator=(const NBNetBuilder &s)
invalidated assignment operator
void applyOptions(OptionsCont &oc)
Initialises the storage by applying given options.
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:45
NBEdgeCont & getEdgeCont()
Definition: NBNetBuilder.h:156
A list of positions.
NBEdgeCont myEdgeCont
The used container for edges.
Definition: NBNetBuilder.h:247
void haveLoadedNetworkWithoutInternalEdges()
notify about style of loaded network (Without internal edges
Definition: NBNetBuilder.h:197
int operator()(const NBNode *n1, const NBNode *n2) const
selection operator
Definition: NBNetBuilder.h:234
bool myNetworkHaveCrossings
flag to indicate that network has crossings
Definition: NBNetBuilder.h:267
NBTrafficLightLogicCont myTLLCont
The used container for traffic light logics.
Definition: NBNetBuilder.h:250
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:66
Sorts nodes by their ids.
Definition: NBNetBuilder.h:228
bool haveNetworkCrossings()
notify about style of loaded network (Without Crossings)
Definition: NBNetBuilder.h:202
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:98
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:74
NBDistrictCont myDistrictCont
The used container for districts.
Definition: NBNetBuilder.h:253
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
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:66
bool myHaveLoadedNetworkWithoutInternalEdges
whether a .net.xml without internal edges was loaded
Definition: NBNetBuilder.h:264
NBParkingCont myParkingCont
Definition: NBNetBuilder.h:261
NBNodeCont myNodeCont
The used container for nodes.
Definition: NBNetBuilder.h:241
NBDistrictCont & getDistrictCont()
Returns a reference the districts container.
Definition: NBNetBuilder.h:176
NBPTLineCont myPTLineCont
The used container for pt stops.
Definition: NBNetBuilder.h:259
A storage for available types of edges.
Definition: NBTypeCont.h:61