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-2018 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>
34 #include "NBEdgeCont.h"
35 #include "NBTypeCont.h"
36 #include "NBNodeCont.h"
37 #include "NBNode.h"
38 #include "NBParking.h"
40 #include "NBDistrictCont.h"
41 #include "NBPTStopCont.h"
42 #include "NBPTLineCont.h"
44 
45 
46 // ===========================================================================
47 // class declarations
48 // ===========================================================================
49 class OptionsCont;
50 class OutputDevice;
51 class GeoConvHelper;
52 
53 
54 // ===========================================================================
55 // class definitions
56 // ===========================================================================
110  friend class GNENet; // for triggering intermediate build steps
111 
112 public:
114  NBNetBuilder();
115 
117  ~NBNetBuilder();
118 
127  void applyOptions(OptionsCont& oc);
128 
136  void compute(OptionsCont& oc, const std::set<std::string>& explicitTurnarounds = std::set<std::string>(), bool mayAddOrRemove = true);
137 
145  //void computeSingleNode(NBNode* node, OptionsCont& oc, const std::set<std::string>& explicitTurnarounds = std::set<std::string>(), bool mayAddOrRemove = true);
146 
151  return myEdgeCont;
152  }
153 
156  return myNodeCont;
157  }
158 
161  return myTypeCont;
162  }
163 
166  return myTLLCont;
167  }
168 
171  return myDistrictCont;
172  }
173 
174 
177  return myPTStopCont;
178  }
179 
182  return myPTLineCont;
183  }
185 
187  return myParkingCont;
188  }
189 
192  return myNetworkHaveCrossings;
193  }
194 
196  void setHaveNetworkCrossings(bool value) {
197  myNetworkHaveCrossings = value;
198  }
199 
208  static bool transformCoordinate(Position& from, bool includeInBoundary = true, GeoConvHelper* from_srs = 0);
209  static bool transformCoordinates(PositionVector& from, bool includeInBoundary = true, GeoConvHelper* from_srs = 0);
210 
212  static bool runningNetedit();
213 
214 
215 protected:
220  class by_id_sorter {
221  public:
223  explicit by_id_sorter() {}
224 
226  int operator()(const NBNode* n1, const NBNode* n2) const {
227  return n1->getID() < n2->getID();
228  }
229  };
230 
231 protected:
234 
237 
240 
243 
246 
249 
252 
254 
257 
258 private:
260  void moveToOrigin(GeoConvHelper& geoConvHelper, bool lefthand);
261 
263  void mirrorX();
264 
265 private:
267  NBNetBuilder(const NBNetBuilder& s);
268 
271 };
272 
273 
274 #endif
275 
276 /****************************************************************************/
277 
NBNetBuilder()
Constructor.
void setHaveNetworkCrossings(bool value)
enable crossing in networks
Definition: NBNetBuilder.h:196
NBTypeCont myTypeCont
The used container for street types.
Definition: NBNetBuilder.h:236
NBPTStopCont myPTStopCont
The used container for pt stops.
Definition: NBNetBuilder.h:248
NBTypeCont & getTypeCont()
Returns a reference to the type container.
Definition: NBNetBuilder.h:160
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:77
NBPTStopCont & getPTStopCont()
Returns a reference to the pt stop container.
Definition: NBNetBuilder.h:176
NBPTLineCont & getPTLineCont()
Returns a reference to the pt line 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:78
NBParkingCont & getParkingCont()
Definition: NBNetBuilder.h:186
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:53
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
NBEdgeCont & getEdgeCont()
Definition: NBNetBuilder.h:150
A list of positions.
NBEdgeCont myEdgeCont
The used container for edges.
Definition: NBNetBuilder.h:239
int operator()(const NBNode *n1, const NBNode *n2) const
selection operator
Definition: NBNetBuilder.h:226
bool myNetworkHaveCrossings
flag to indicate that network has crossings
Definition: NBNetBuilder.h:256
NBTrafficLightLogicCont myTLLCont
The used container for traffic light logics.
Definition: NBNetBuilder.h:242
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:61
Sorts nodes by their ids.
Definition: NBNetBuilder.h:220
bool haveNetworkCrossings()
notify about style of loaded network (Without Crossings)
Definition: NBNetBuilder.h:191
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:155
Instance responsible for building networks.
Definition: NBNetBuilder.h:109
static bool runningNetedit()
whether netbuilding takes place in the context of NETEDIT
A storage for options typed value containers)
Definition: OptionsCont.h:92
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
Definition: NBNetBuilder.h:165
Represents a single node (junction) during network building.
Definition: NBNode.h:68
NBDistrictCont myDistrictCont
The used container for districts.
Definition: NBNetBuilder.h:245
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
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:60
NBParkingCont myParkingCont
Definition: NBNetBuilder.h:253
NBNodeCont myNodeCont
The used container for nodes.
Definition: NBNetBuilder.h:233
NBDistrictCont & getDistrictCont()
Returns a reference the districts container.
Definition: NBNetBuilder.h:170
NBPTLineCont myPTLineCont
The used container for pt stops.
Definition: NBNetBuilder.h:251
A storage for available types of edges.
Definition: NBTypeCont.h:55