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 /****************************************************************************/
18 // Instance responsible for building networks
19 /****************************************************************************/
20 #ifndef NBNetBuilder_h
21 #define NBNetBuilder_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #include <config.h>
28 
29 #include <string>
30 #include <iostream>
31 #include <vector>
32 #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 
191  return myShapeCont;
192  }
193 
196  return myNetworkHaveCrossings;
197  }
198 
200  void setHaveNetworkCrossings(bool value) {
201  myNetworkHaveCrossings = value;
202  }
203 
212  static bool transformCoordinate(Position& from, bool includeInBoundary = true, GeoConvHelper* from_srs = 0);
213  static bool transformCoordinates(PositionVector& from, bool includeInBoundary = true, GeoConvHelper* from_srs = 0);
214 
216  static int addGeometrySegments(PositionVector& from, const PositionVector& cartesian, const double maxLength);
217 
219  static bool runningNetedit();
220 
221 
222 protected:
227  class by_id_sorter {
228  public:
230  explicit by_id_sorter() {}
231 
233  int operator()(const NBNode* n1, const NBNode* n2) const {
234  return n1->getID() < n2->getID();
235  }
236  };
237 
238 protected:
241 
244 
247 
250 
253 
256 
259 
261 
264 
267 
268 private:
270  void moveToOrigin(GeoConvHelper& geoConvHelper, bool lefthand);
271 
273  void mirrorX();
274 
275 private:
277  NBNetBuilder(const NBNetBuilder& s);
278 
281 };
282 
283 
284 #endif
285 
286 /****************************************************************************/
287 
NBNetBuilder::myShapeCont
ShapeContainer myShapeCont
container for loaded polygon data
Definition: NBNetBuilder.h:263
NBPTStopCont
Definition: NBPTStopCont.h:27
NBNetBuilder::mirrorX
void mirrorX()
mirror the network along the X-axis
Definition: NBNetBuilder.cpp:618
NBNetBuilder::NBNetBuilder
NBNetBuilder()
Constructor.
Definition: NBNetBuilder.cpp:55
NBNetBuilder::myPTStopCont
NBPTStopCont myPTStopCont
The used container for pt stops.
Definition: NBNetBuilder.h:255
NBEdgeCont
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:60
NBNetBuilder
Instance responsible for building networks.
Definition: NBNetBuilder.h:109
NBTrafficLightLogicCont
A container for traffic light definitions and built programs.
Definition: NBTrafficLightLogicCont.h:57
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
NBNetBuilder::myPTLineCont
NBPTLineCont myPTLineCont
The used container for pt stops.
Definition: NBNetBuilder.h:258
GNENet
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:77
NBNetBuilder::myTypeCont
NBTypeCont myTypeCont
The used container for street types.
Definition: NBNetBuilder.h:243
NBNetBuilder::transformCoordinates
static bool transformCoordinates(PositionVector &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
Definition: NBNetBuilder.cpp:660
NBEdgeCont.h
ShapeContainer
Storage for geometrical objects.
Definition: ShapeContainer.h:49
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:633
NBNetBuilder::operator=
NBNetBuilder & operator=(const NBNetBuilder &s)
invalidated assignment operator
NBParking.h
PositionVector
A list of positions.
Definition: PositionVector.h:45
NBDistrictCont
A container for districts.
Definition: NBDistrictCont.h:52
GeoConvHelper
static methods for processing the coordinates conversion for the current net
Definition: GeoConvHelper.h:55
NBNodeCont
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:59
NBNetBuilder::getEdgeCont
NBEdgeCont & getEdgeCont()
Definition: NBNetBuilder.h:150
NBNetBuilder::getPTStopCont
NBPTStopCont & getPTStopCont()
Returns a reference to the pt stop container.
Definition: NBNetBuilder.h:176
NBPTLineCont
Definition: NBPTLineCont.h:26
NBPTLineCont.h
NBNetBuilder::getPTLineCont
NBPTLineCont & getPTLineCont()
Returns a reference to the pt line container.
Definition: NBNetBuilder.h:181
NBNetBuilder::getParkingCont
NBParkingCont & getParkingCont()
Definition: NBNetBuilder.h:186
NBNetBuilder::myNetworkHaveCrossings
bool myNetworkHaveCrossings
flag to indicate that network has crossings
Definition: NBNetBuilder.h:266
NBNetBuilder::myTLLCont
NBTrafficLightLogicCont myTLLCont
The used container for traffic light logics.
Definition: NBNetBuilder.h:249
NBTypeCont.h
NBNetBuilder::applyOptions
void applyOptions(OptionsCont &oc)
Initialises the storage by applying given options.
Definition: NBNetBuilder.cpp:65
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
UtilExceptions.h
NBParkingCont
Definition: NBParking.h:66
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:89
NBNetBuilder::haveNetworkCrossings
bool haveNetworkCrossings()
notify about style of loaded network (Without Crossings)
Definition: NBNetBuilder.h:195
NBNetBuilder::moveToOrigin
void moveToOrigin(GeoConvHelper &geoConvHelper, bool lefthand)
shift network so its lower left corner is at 0,0
Definition: NBNetBuilder.cpp:592
NBNodeCont.h
NBNetBuilder::myEdgeCont
NBEdgeCont myEdgeCont
The used container for edges.
Definition: NBNetBuilder.h:246
NBNetBuilder::myDistrictCont
NBDistrictCont myDistrictCont
The used container for districts.
Definition: NBNetBuilder.h:252
NBTypeCont
A storage for available types of edges.
Definition: NBTypeCont.h:54
NBNetBuilder::getTLLogicCont
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
Definition: NBNetBuilder.h:165
NBDistrictCont.h
NBNetBuilder::getDistrictCont
NBDistrictCont & getDistrictCont()
Returns a reference the districts container.
Definition: NBNetBuilder.h:170
NBNetBuilder::addGeometrySegments
static int addGeometrySegments(PositionVector &from, const PositionVector &cartesian, const double maxLength)
insertion geometry points to ensure maximum segment length between points
Definition: NBNetBuilder.cpp:678
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:77
config.h
NBNetBuilder::runningNetedit
static bool runningNetedit()
whether netbuilding takes place in the context of NETEDIT
Definition: NBNetBuilder.cpp:700
ShapeContainer.h
NBNetBuilder::myParkingCont
NBParkingCont myParkingCont
Definition: NBNetBuilder.h:260
NBNetBuilder::setHaveNetworkCrossings
void setHaveNetworkCrossings(bool value)
enable crossing in networks
Definition: NBNetBuilder.h:200
NBNetBuilder::by_id_sorter
Sorts nodes by their ids.
Definition: NBNetBuilder.h:227
NBNode
Represents a single node (junction) during network building.
Definition: NBNode.h:67
NBNetBuilder::getShapeCont
ShapeContainer & getShapeCont()
Definition: NBNetBuilder.h:190
NBTrafficLightLogicCont.h
NBNetBuilder::getNodeCont
NBNodeCont & getNodeCont()
Returns a reference to the node container.
Definition: NBNetBuilder.h:155
NBNetBuilder::getTypeCont
NBTypeCont & getTypeCont()
Returns a reference to the type container.
Definition: NBNetBuilder.h:160
NBNode.h
Named::getID
const std::string & getID() const
Returns the id.
Definition: Named.h:76
NBNetBuilder::by_id_sorter::operator()
int operator()(const NBNode *n1, const NBNode *n2) const
selection operator
Definition: NBNetBuilder.h:233
NBNetBuilder::myNodeCont
NBNodeCont myNodeCont
The used container for nodes.
Definition: NBNetBuilder.h:240
NBNetBuilder::by_id_sorter::by_id_sorter
by_id_sorter()
constructor
Definition: NBNetBuilder.h:230
NBNetBuilder::~NBNetBuilder
~NBNetBuilder()
Destructor.
Definition: NBNetBuilder.cpp:61
NBPTStopCont.h