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"
49 
50 
51 // ===========================================================================
52 // class declarations
53 // ===========================================================================
54 class OptionsCont;
55 class OutputDevice;
56 class GeoConvHelper;
57 
58 
59 // ===========================================================================
60 // class definitions
61 // ===========================================================================
115  friend class GNENet; // for triggering intermediate build steps
116 
117 public:
119  NBNetBuilder();
120 
122  ~NBNetBuilder();
123 
132  void applyOptions(OptionsCont& oc);
133 
141  void compute(OptionsCont& oc, const std::set<std::string>& explicitTurnarounds = std::set<std::string>(), bool mayAddOrRemove = true);
142 
150  void computeSingleNode(NBNode* node, OptionsCont& oc, const std::set<std::string>& explicitTurnarounds = std::set<std::string>(), bool mayAddOrRemove = true);
151 
156  return myEdgeCont;
157  }
158 
161  return myNodeCont;
162  }
163 
166  return myTypeCont;
167  }
168 
171  return myTLLCont;
172  }
173 
176  return myDistrictCont;
177  }
178 
179 
182  return myPTStopCont;
183  }
185 
189  }
190 
193  return myNetworkHaveCrossings;
194  }
195 
204  static bool transformCoordinate(Position& from, bool includeInBoundary = true, GeoConvHelper* from_srs = 0);
205  static bool transformCoordinates(PositionVector& from, bool includeInBoundary = true, GeoConvHelper* from_srs = 0);
206 
207 
208 protected:
213  class by_id_sorter {
214  public:
216  explicit by_id_sorter() {}
217 
219  int operator()(const NBNode* n1, const NBNode* n2) const {
220  return n1->getID() < n2->getID();
221  }
222  };
223 
224 protected:
227 
230 
233 
236 
239 
242 
245 
248 
249 private:
251  void moveToOrigin(GeoConvHelper& geoConvHelper, bool lefthand);
252 
254  void mirrorX();
255 
256 private:
258  NBNetBuilder(const NBNetBuilder& s);
259 
262 };
263 
264 
265 #endif
266 
267 /****************************************************************************/
268 
NBNetBuilder()
Constructor.
NBTypeCont myTypeCont
The used container for street types.
Definition: NBNetBuilder.h:229
NBPTStopCont myPTStopCont
The used container for pt stops.
Definition: NBNetBuilder.h:241
NBTypeCont & getTypeCont()
Returns a reference to the type container.
Definition: NBNetBuilder.h:165
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:88
NBPTStopCont & getPTStopCont()
Returns a reference to the pt stop container.
Definition: NBNetBuilder.h:181
static bool transformCoordinates(PositionVector &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
const std::string & getID() const
Returns the id.
Definition: Named.h:66
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:60
void computeSingleNode(NBNode *node, OptionsCont &oc, const std::set< std::string > &explicitTurnarounds=std::set< std::string >(), bool mayAddOrRemove=true)
Performs the network building steps only for a single Node.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
NBEdgeCont & getEdgeCont()
Definition: NBNetBuilder.h:155
A list of positions.
NBEdgeCont myEdgeCont
The used container for edges.
Definition: NBNetBuilder.h:232
void haveLoadedNetworkWithoutInternalEdges()
notify about style of loaded network (Without internal edges
Definition: NBNetBuilder.h:187
int operator()(const NBNode *n1, const NBNode *n2) const
selection operator
Definition: NBNetBuilder.h:219
bool myNetworkHaveCrossings
flag to indicate that network has crossings
Definition: NBNetBuilder.h:247
NBTrafficLightLogicCont myTLLCont
The used container for traffic light logics.
Definition: NBNetBuilder.h:235
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:66
Sorts nodes by their ids.
Definition: NBNetBuilder.h:213
bool haveNetworkCrossings()
notify about style of loaded network (Without Crossings)
Definition: NBNetBuilder.h:192
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:160
Instance responsible for building networks.
Definition: NBNetBuilder.h:114
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:170
Represents a single node (junction) during network building.
Definition: NBNode.h:75
NBDistrictCont myDistrictCont
The used container for districts.
Definition: NBNetBuilder.h:238
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:244
NBNodeCont myNodeCont
The used container for nodes.
Definition: NBNetBuilder.h:226
NBDistrictCont & getDistrictCont()
Returns a reference the districts container.
Definition: NBNetBuilder.h:175
A storage for available types of edges.
Definition: NBTypeCont.h:62