Eclipse 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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
19 // Instance responsible for building networks
20 /****************************************************************************/
21 #ifndef NBNetBuilder_h
22 #define NBNetBuilder_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #include <config.h>
29 
30 #include <string>
31 #include <iostream>
32 #include <vector>
33 #include <set>
35 #include "NBEdgeCont.h"
36 #include "NBTypeCont.h"
37 #include "NBNodeCont.h"
38 #include "NBNode.h"
39 #include "NBParking.h"
41 #include "NBDistrictCont.h"
42 #include "NBPTStopCont.h"
43 #include "NBPTLineCont.h"
45 
46 
47 // ===========================================================================
48 // class declarations
49 // ===========================================================================
50 class OptionsCont;
51 class OutputDevice;
52 class GeoConvHelper;
53 
54 
55 // ===========================================================================
56 // class definitions
57 // ===========================================================================
111  friend class GNENet; // for triggering intermediate build steps
112 
113 public:
115  NBNetBuilder();
116 
118  ~NBNetBuilder();
119 
128  void applyOptions(OptionsCont& oc);
129 
137  void compute(OptionsCont& oc, const std::set<std::string>& explicitTurnarounds = std::set<std::string>(), bool mayAddOrRemove = true);
138 
146  //void computeSingleNode(NBNode* node, OptionsCont& oc, const std::set<std::string>& explicitTurnarounds = std::set<std::string>(), bool mayAddOrRemove = true);
147 
152  return myEdgeCont;
153  }
154 
157  return myNodeCont;
158  }
159 
162  return myTypeCont;
163  }
164 
167  return myTLLCont;
168  }
169 
172  return myDistrictCont;
173  }
174 
175 
178  return myPTStopCont;
179  }
180 
183  return myPTLineCont;
184  }
186 
188  return myParkingCont;
189  }
190 
192  return myShapeCont;
193  }
194 
197  return myNetworkHaveCrossings;
198  }
199 
201  void setHaveNetworkCrossings(bool value) {
202  myNetworkHaveCrossings = value;
203  }
204 
213  static bool transformCoordinate(Position& from, bool includeInBoundary = true, GeoConvHelper* from_srs = 0);
214  static bool transformCoordinates(PositionVector& from, bool includeInBoundary = true, GeoConvHelper* from_srs = 0);
215 
217  static bool runningNetedit();
218 
219 
220 protected:
225  class by_id_sorter {
226  public:
228  explicit by_id_sorter() {}
229 
231  int operator()(const NBNode* n1, const NBNode* n2) const {
232  return n1->getID() < n2->getID();
233  }
234  };
235 
236 protected:
239 
242 
245 
248 
251 
254 
257 
259 
262 
265 
266 private:
268  void moveToOrigin(GeoConvHelper& geoConvHelper, bool lefthand);
269 
271  void mirrorX();
272 
273 private:
275  NBNetBuilder(const NBNetBuilder& s);
276 
279 };
280 
281 
282 #endif
283 
284 /****************************************************************************/
285 
NBNetBuilder::myShapeCont
ShapeContainer myShapeCont
container for loaded polygon data
Definition: NBNetBuilder.h:261
NBPTStopCont
Definition: NBPTStopCont.h:28
NBNetBuilder::mirrorX
void mirrorX()
mirror the network along the X-axis
Definition: NBNetBuilder.cpp:648
NBNetBuilder::NBNetBuilder
NBNetBuilder()
Constructor.
Definition: NBNetBuilder.cpp:56
NBNetBuilder::myPTStopCont
NBPTStopCont myPTStopCont
The used container for pt stops.
Definition: NBNetBuilder.h:253
NBEdgeCont
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:61
NBNetBuilder
Instance responsible for building networks.
Definition: NBNetBuilder.h:110
NBTrafficLightLogicCont
A container for traffic light definitions and built programs.
Definition: NBTrafficLightLogicCont.h:58
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
NBNetBuilder::myPTLineCont
NBPTLineCont myPTLineCont
The used container for pt stops.
Definition: NBNetBuilder.h:256
GNENet
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:78
NBNetBuilder::myTypeCont
NBTypeCont myTypeCont
The used container for street types.
Definition: NBNetBuilder.h:241
NBNetBuilder::transformCoordinates
static bool transformCoordinates(PositionVector &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
Definition: NBNetBuilder.cpp:690
NBEdgeCont.h
ShapeContainer
Storage for geometrical objects.
Definition: ShapeContainer.h:50
NBNetBuilder::transformCoordinate
static bool transformCoordinate(Position &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
transforms loaded coordinates handles projections, offsets (using GeoConvHelper) and import of height...
Definition: NBNetBuilder.cpp:663
NBNetBuilder::operator=
NBNetBuilder & operator=(const NBNetBuilder &s)
invalidated assignment operator
NBParking.h
PositionVector
A list of positions.
Definition: PositionVector.h:46
NBDistrictCont
A container for districts.
Definition: NBDistrictCont.h:53
GeoConvHelper
static methods for processing the coordinates conversion for the current net
Definition: GeoConvHelper.h:56
NBNodeCont
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:60
NBNetBuilder::getEdgeCont
NBEdgeCont & getEdgeCont()
Definition: NBNetBuilder.h:151
NBNetBuilder::getPTStopCont
NBPTStopCont & getPTStopCont()
Returns a reference to the pt stop container.
Definition: NBNetBuilder.h:177
NBPTLineCont
Definition: NBPTLineCont.h:27
NBPTLineCont.h
NBNetBuilder::getPTLineCont
NBPTLineCont & getPTLineCont()
Returns a reference to the pt line container.
Definition: NBNetBuilder.h:182
NBNetBuilder::getParkingCont
NBParkingCont & getParkingCont()
Definition: NBNetBuilder.h:187
NBNetBuilder::myNetworkHaveCrossings
bool myNetworkHaveCrossings
flag to indicate that network has crossings
Definition: NBNetBuilder.h:264
NBNetBuilder::myTLLCont
NBTrafficLightLogicCont myTLLCont
The used container for traffic light logics.
Definition: NBNetBuilder.h:247
NBTypeCont.h
NBNetBuilder::applyOptions
void applyOptions(OptionsCont &oc)
Initialises the storage by applying given options.
Definition: NBNetBuilder.cpp:66
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
UtilExceptions.h
NBParkingCont
Definition: NBParking.h:63
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:90
NBNetBuilder::haveNetworkCrossings
bool haveNetworkCrossings()
notify about style of loaded network (Without Crossings)
Definition: NBNetBuilder.h:196
NBNetBuilder::moveToOrigin
void moveToOrigin(GeoConvHelper &geoConvHelper, bool lefthand)
shift network so its lower left corner is at 0,0
Definition: NBNetBuilder.cpp:621
NBNodeCont.h
NBNetBuilder::myEdgeCont
NBEdgeCont myEdgeCont
The used container for edges.
Definition: NBNetBuilder.h:244
NBNetBuilder::myDistrictCont
NBDistrictCont myDistrictCont
The used container for districts.
Definition: NBNetBuilder.h:250
NBTypeCont
A storage for available types of edges.
Definition: NBTypeCont.h:55
NBNetBuilder::getTLLogicCont
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
Definition: NBNetBuilder.h:166
NBDistrictCont.h
NBNetBuilder::getDistrictCont
NBDistrictCont & getDistrictCont()
Returns a reference the districts container.
Definition: NBNetBuilder.h:171
NBNetBuilder::compute
void compute(OptionsCont &oc, const std::set< std::string > &explicitTurnarounds=std::set< std::string >(), bool mayAddOrRemove=true)
Performs the network building steps.
Definition: NBNetBuilder.cpp:78
config.h
NBNetBuilder::runningNetedit
static bool runningNetedit()
whether netbuilding takes place in the context of NETEDIT
Definition: NBNetBuilder.cpp:726
ShapeContainer.h
NBNetBuilder::myParkingCont
NBParkingCont myParkingCont
Definition: NBNetBuilder.h:258
NBNetBuilder::setHaveNetworkCrossings
void setHaveNetworkCrossings(bool value)
enable crossing in networks
Definition: NBNetBuilder.h:201
NBNetBuilder::by_id_sorter
Sorts nodes by their ids.
Definition: NBNetBuilder.h:225
NBNode
Represents a single node (junction) during network building.
Definition: NBNode.h:68
NBNetBuilder::getShapeCont
ShapeContainer & getShapeCont()
Definition: NBNetBuilder.h:191
NBTrafficLightLogicCont.h
NBNetBuilder::getNodeCont
NBNodeCont & getNodeCont()
Returns a reference to the node container.
Definition: NBNetBuilder.h:156
NBNetBuilder::getTypeCont
NBTypeCont & getTypeCont()
Returns a reference to the type container.
Definition: NBNetBuilder.h:161
NBNode.h
Named::getID
const std::string & getID() const
Returns the id.
Definition: Named.h:77
NBNetBuilder::by_id_sorter::operator()
int operator()(const NBNode *n1, const NBNode *n2) const
selection operator
Definition: NBNetBuilder.h:231
NBNetBuilder::myNodeCont
NBNodeCont myNodeCont
The used container for nodes.
Definition: NBNetBuilder.h:238
NBNetBuilder::by_id_sorter::by_id_sorter
by_id_sorter()
constructor
Definition: NBNetBuilder.h:228
NBNetBuilder::~NBNetBuilder
~NBNetBuilder()
Destructor.
Definition: NBNetBuilder.cpp:62
NBPTStopCont.h