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-2022 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
22 // Instance responsible for building networks
23 /****************************************************************************/
24 #pragma once
25 #include <config.h>
26 
27 #include <string>
28 #include <iostream>
29 #include <vector>
30 #include <set>
32 #include "NBEdgeCont.h"
33 #include "NBTypeCont.h"
34 #include "NBNodeCont.h"
35 #include "NBNode.h"
36 #include "NBParking.h"
38 #include "NBDistrictCont.h"
39 #include "NBPTStopCont.h"
40 #include "NBPTLineCont.h"
42 
43 
44 // ===========================================================================
45 // class declarations
46 // ===========================================================================
47 class OptionsCont;
48 class OutputDevice;
49 class GeoConvHelper;
50 
51 
52 // ===========================================================================
53 // class definitions
54 // ===========================================================================
108  friend class GNENet; // for triggering intermediate build steps
109 
110 public:
112  NBNetBuilder();
113 
115  ~NBNetBuilder();
116 
125  void applyOptions(OptionsCont& oc);
126 
134  void compute(OptionsCont& oc, const std::set<std::string>& explicitTurnarounds = std::set<std::string>(), bool mayAddOrRemove = true);
135 
143  //void computeSingleNode(NBNode* node, OptionsCont& oc, const std::set<std::string>& explicitTurnarounds = std::set<std::string>(), bool mayAddOrRemove = true);
144 
149  return myEdgeCont;
150  }
151 
154  return myNodeCont;
155  }
156 
159  return myTypeCont;
160  }
161 
164  return myTLLCont;
165  }
166 
169  return myDistrictCont;
170  }
171 
172 
175  return myPTStopCont;
176  }
177 
180  return myPTLineCont;
181  }
183 
185  return myParkingCont;
186  }
187 
189  return myShapeCont;
190  }
191 
194  return myNetworkHaveCrossings;
195  }
196 
198  void setHaveNetworkCrossings(bool value) {
199  myNetworkHaveCrossings = value;
200  }
201 
210  static bool transformCoordinate(Position& from, bool includeInBoundary = true, GeoConvHelper* from_srs = 0);
211  static bool transformCoordinates(PositionVector& from, bool includeInBoundary = true, GeoConvHelper* from_srs = 0);
212 
214  static int addGeometrySegments(PositionVector& from, const PositionVector& cartesian, const double maxLength);
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:
276 
279 };
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
static methods for processing the coordinates conversion for the current net
Definition: GeoConvHelper.h:53
A container for districts.
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:59
Sorts nodes by their ids.
Definition: NBNetBuilder.h:225
int operator()(const NBNode *n1, const NBNode *n2) const
selection operator
Definition: NBNetBuilder.h:231
Instance responsible for building networks.
Definition: NBNetBuilder.h:107
NBNetBuilder(const NBNetBuilder &s)
invalidated copy constructor
ShapeContainer & getShapeCont()
Definition: NBNetBuilder.h:188
void mirrorX()
mirror the network along the X-axis
NBNetBuilder()
Constructor.
NBTrafficLightLogicCont myTLLCont
The used container for traffic light logics.
Definition: NBNetBuilder.h:247
static bool transformCoordinates(PositionVector &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
bool haveNetworkCrossings()
notify about style of loaded network (Without Crossings)
Definition: NBNetBuilder.h:193
NBDistrictCont & getDistrictCont()
Returns a reference the districts container.
Definition: NBNetBuilder.h:168
void moveToOrigin(GeoConvHelper &geoConvHelper, bool lefthand)
shift network so its lower left corner is at 0,0
bool myNetworkHaveCrossings
flag to indicate that network has crossings
Definition: NBNetBuilder.h:264
NBDistrictCont myDistrictCont
The used container for districts.
Definition: NBNetBuilder.h:250
static int addGeometrySegments(PositionVector &from, const PositionVector &cartesian, const double maxLength)
insertion geometry points to ensure maximum segment length between points
NBNetBuilder & operator=(const NBNetBuilder &s)
invalidated assignment operator
NBPTLineCont myPTLineCont
The used container for pt stops.
Definition: NBNetBuilder.h:256
ShapeContainer myShapeCont
container for loaded polygon data
Definition: NBNetBuilder.h:261
NBEdgeCont myEdgeCont
The used container for edges.
Definition: NBNetBuilder.h:244
NBParkingCont myParkingCont
Definition: NBNetBuilder.h:258
NBTypeCont & getTypeCont()
Returns a reference to the type container.
Definition: NBNetBuilder.h:158
~NBNetBuilder()
Destructor.
NBTypeCont myTypeCont
The used container for street types.
Definition: NBNetBuilder.h:241
void setHaveNetworkCrossings(bool value)
enable crossing in networks
Definition: NBNetBuilder.h:198
NBPTStopCont myPTStopCont
The used container for pt stops.
Definition: NBNetBuilder.h:253
NBParkingCont & getParkingCont()
Definition: NBNetBuilder.h:184
NBPTLineCont & getPTLineCont()
Returns a reference to the pt line container.
Definition: NBNetBuilder.h:179
static bool transformCoordinate(Position &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
transforms loaded coordinates handles projections, offsets (using GeoConvHelper) and import of height...
NBEdgeCont & getEdgeCont()
Definition: NBNetBuilder.h:148
void applyOptions(OptionsCont &oc)
Initialises the storage by applying given options.
NBPTStopCont & getPTStopCont()
Returns a reference to the pt stop container.
Definition: NBNetBuilder.h:174
void compute(OptionsCont &oc, const std::set< std::string > &explicitTurnarounds=std::set< std::string >(), bool mayAddOrRemove=true)
Performs the network building steps.
NBNodeCont & getNodeCont()
Returns a reference to the node container.
Definition: NBNetBuilder.h:153
NBNodeCont myNodeCont
The used container for nodes.
Definition: NBNetBuilder.h:238
static bool runningNetedit()
whether netbuilding takes place in the context of NETEDIT
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
Definition: NBNetBuilder.h:163
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:58
Represents a single node (junction) during network building.
Definition: NBNode.h:66
A container for traffic light definitions and built programs.
A storage for available edgeTypes of edges.
Definition: NBTypeCont.h:52
const std::string & getID() const
Returns the id.
Definition: Named.h:74
A storage for options typed value containers)
Definition: OptionsCont.h:89
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
A list of positions.
Storage for geometrical objects.