Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
NBNetBuilder.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 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// ===========================================================================
47class OptionsCont;
48class OutputDevice;
49class GeoConvHelper;
50
51
52// ===========================================================================
53// class definitions
54// ===========================================================================
108 friend class GNENet; // for triggering intermediate build steps
109
110public:
112 NBNetBuilder();
113
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
140 return myEdgeCont;
141 }
142
145 return myNodeCont;
146 }
147
150 return myTypeCont;
151 }
152
155 return myTLLCont;
156 }
157
160 return myDistrictCont;
161 }
162
165 return myPTStopCont;
166 }
167
170 return myPTLineCont;
171 }
172
174 return myParkingCont;
175 }
176
178 return myShapeCont;
179 }
181
183 inline bool haveNetworkCrossings() {
185 }
186
188 inline void setHaveNetworkCrossings(bool value) {
190 }
191
200 static bool transformCoordinate(Position& from, bool includeInBoundary = true, GeoConvHelper* from_srs = nullptr);
201 static bool transformCoordinates(PositionVector& from, bool includeInBoundary = true, GeoConvHelper* from_srs = nullptr);
202
204 static int addGeometrySegments(PositionVector& from, const PositionVector& cartesian, const double maxLength);
205
207 static bool runningNetedit();
208
209
210protected:
216 public:
218 explicit by_id_sorter() {}
219
221 int operator()(const NBNode* n1, const NBNode* n2) const {
222 return n1->getID() < n2->getID();
223 }
224 };
225
226protected:
229
232
235
238
241
244
247
249
252
255
256private:
258 void moveToOrigin(GeoConvHelper& geoConvHelper, bool lefthand);
259
261 void mirrorX();
262
263private:
266
269};
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
static methods for processing the coordinates conversion for the current net
A container for districts.
Storage for edges, including some functionality operating on multiple edges.
Definition NBEdgeCont.h:59
Sorts nodes by their ids.
int operator()(const NBNode *n1, const NBNode *n2) const
selection operator
Instance responsible for building networks.
static bool transformCoordinates(PositionVector &from, bool includeInBoundary=true, GeoConvHelper *from_srs=nullptr)
NBNetBuilder(const NBNetBuilder &s)
invalidated copy constructor
void mirrorX()
mirror the network along the X-axis
NBNetBuilder()
Constructor.
NBTrafficLightLogicCont myTLLCont
The used container for traffic light logics.
bool haveNetworkCrossings()
notify about style of loaded network (Without Crossings)
NBPTLineCont & getPTLineCont()
Returns a reference to the pt line container.
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
NBDistrictCont myDistrictCont
The used container for districts.
static int addGeometrySegments(PositionVector &from, const PositionVector &cartesian, const double maxLength)
insertion geometry points to ensure maximum segment length between points
NBParkingCont & getParkingCont()
NBPTStopCont & getPTStopCont()
Returns a reference to the pt stop container.
NBNodeCont & getNodeCont()
Returns a reference to the node container.
ShapeContainer & getShapeCont()
NBPTLineCont myPTLineCont
The used container for pt stops.
ShapeContainer myShapeCont
container for loaded polygon data
NBEdgeCont myEdgeCont
The used container for edges.
NBParkingCont myParkingCont
~NBNetBuilder()
Destructor.
NBTypeCont myTypeCont
The used container for street types.
void setHaveNetworkCrossings(bool value)
enable crossing in networks
NBPTStopCont myPTStopCont
The used container for pt stops.
NBEdgeCont & getEdgeCont()
NBDistrictCont & getDistrictCont()
Returns a reference the districts container.
NBNetBuilder & operator=(const NBNetBuilder &s)
invalidated assignment operator
NBTypeCont & getTypeCont()
Returns a reference to the type container.
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
void applyOptions(OptionsCont &oc)
Initialises the storage by applying given options.
static bool transformCoordinate(Position &from, bool includeInBoundary=true, GeoConvHelper *from_srs=nullptr)
transforms loaded coordinates handles projections, offsets (using GeoConvHelper) and import of height...
void compute(OptionsCont &oc, const std::set< std::string > &explicitTurnarounds=std::set< std::string >(), bool mayAddOrRemove=true)
Performs the network building steps.
NBNodeCont myNodeCont
The used container for nodes.
static bool runningNetedit()
whether netbuilding takes place in the context of netedit
Container for nodes during the netbuilding process.
Definition NBNodeCont.h:57
Represents a single node (junction) during network building.
Definition NBNode.h:66
Container for public transport stops during the net building process.
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.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
A list of positions.
Storage for geometrical objects.