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-2017 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"
47 
48 
49 // ===========================================================================
50 // class declarations
51 // ===========================================================================
52 class OptionsCont;
53 class OutputDevice;
54 class GeoConvHelper;
55 
56 
57 // ===========================================================================
58 // class definitions
59 // ===========================================================================
113  friend class GNENet; // for triggering intermediate build steps
114 
115 public:
117  NBNetBuilder();
118 
120  ~NBNetBuilder();
121 
130  void applyOptions(OptionsCont& oc);
131 
139  void compute(OptionsCont& oc, const std::set<std::string>& explicitTurnarounds = std::set<std::string>(), bool mayAddOrRemove = true);
140 
145  return myEdgeCont;
146  }
147 
150  return myNodeCont;
151  }
152 
155  return myTypeCont;
156  }
157 
160  return myTLLCont;
161  }
162 
165  return myDistrictCont;
166  }
168 
172  }
173 
176  return myNetworkHaveCrossings;
177  }
178 
187  static bool transformCoordinate(Position& from, bool includeInBoundary = true, GeoConvHelper* from_srs = 0);
188  static bool transformCoordinates(PositionVector& from, bool includeInBoundary = true, GeoConvHelper* from_srs = 0);
189 
190 
191 protected:
196  class by_id_sorter {
197  public:
199  explicit by_id_sorter() {}
200 
202  int operator()(const NBNode* n1, const NBNode* n2) const {
203  return n1->getID() < n2->getID();
204  }
205  };
206 
207 protected:
210 
213 
216 
219 
222 
225 
228 
229 private:
231  void moveToOrigin(GeoConvHelper& geoConvHelper, bool lefthand);
232 
234  void mirrorX();
235 
236 private:
238  NBNetBuilder(const NBNetBuilder& s);
239 
242 };
243 
244 
245 #endif
246 
247 /****************************************************************************/
248 
NBNetBuilder()
Constructor.
NBTypeCont myTypeCont
The used container for street types.
Definition: NBNetBuilder.h:212
NBTypeCont & getTypeCont()
Returns a reference to the type container.
Definition: NBNetBuilder.h:154
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:87
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:202
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:144
A list of positions.
NBEdgeCont myEdgeCont
The used container for edges.
Definition: NBNetBuilder.h:215
void haveLoadedNetworkWithoutInternalEdges()
notify about style of loaded network (Without internal edges
Definition: NBNetBuilder.h:170
bool myNetworkHaveCrossings
flag to indicate that network has crossings
Definition: NBNetBuilder.h:227
NBTrafficLightLogicCont myTLLCont
The used container for traffic light logics.
Definition: NBNetBuilder.h:218
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:66
Sorts nodes by their ids.
Definition: NBNetBuilder.h:196
bool haveNetworkCrossings()
notify about style of loaded network (Without Crossings)
Definition: NBNetBuilder.h:175
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:149
Instance responsible for building networks.
Definition: NBNetBuilder.h:112
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:159
Represents a single node (junction) during network building.
Definition: NBNode.h:75
NBDistrictCont myDistrictCont
The used container for districts.
Definition: NBNetBuilder.h:221
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:224
NBNodeCont myNodeCont
The used container for nodes.
Definition: NBNetBuilder.h:209
NBDistrictCont & getDistrictCont()
Returns a reference the districts container.
Definition: NBNetBuilder.h:164
A storage for available types of edges.
Definition: NBTypeCont.h:62