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// ===========================================================================
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
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:215
int operator()(const NBNode *n1, const NBNode *n2) const
selection operator
Definition: NBNetBuilder.h:221
Instance responsible for building networks.
Definition: NBNetBuilder.h:107
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.
Definition: NBNetBuilder.h:237
bool haveNetworkCrossings()
notify about style of loaded network (Without Crossings)
Definition: NBNetBuilder.h:183
NBPTLineCont & getPTLineCont()
Returns a reference to the pt line container.
Definition: NBNetBuilder.h:169
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:254
NBDistrictCont myDistrictCont
The used container for districts.
Definition: NBNetBuilder.h:240
static int addGeometrySegments(PositionVector &from, const PositionVector &cartesian, const double maxLength)
insertion geometry points to ensure maximum segment length between points
NBParkingCont & getParkingCont()
Definition: NBNetBuilder.h:173
NBPTStopCont & getPTStopCont()
Returns a reference to the pt stop container.
Definition: NBNetBuilder.h:164
NBNodeCont & getNodeCont()
Returns a reference to the node container.
Definition: NBNetBuilder.h:144
ShapeContainer & getShapeCont()
Definition: NBNetBuilder.h:177
NBPTLineCont myPTLineCont
The used container for pt stops.
Definition: NBNetBuilder.h:246
ShapeContainer myShapeCont
container for loaded polygon data
Definition: NBNetBuilder.h:251
NBEdgeCont myEdgeCont
The used container for edges.
Definition: NBNetBuilder.h:234
NBParkingCont myParkingCont
Definition: NBNetBuilder.h:248
~NBNetBuilder()
Destructor.
NBTypeCont myTypeCont
The used container for street types.
Definition: NBNetBuilder.h:231
void setHaveNetworkCrossings(bool value)
enable crossing in networks
Definition: NBNetBuilder.h:188
NBPTStopCont myPTStopCont
The used container for pt stops.
Definition: NBNetBuilder.h:243
NBEdgeCont & getEdgeCont()
Definition: NBNetBuilder.h:139
NBDistrictCont & getDistrictCont()
Returns a reference the districts container.
Definition: NBNetBuilder.h:159
NBNetBuilder & operator=(const NBNetBuilder &s)
invalidated assignment operator
NBTypeCont & getTypeCont()
Returns a reference to the type container.
Definition: NBNetBuilder.h:149
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
Definition: NBNetBuilder.h:154
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.
Definition: NBNetBuilder.h:228
static bool runningNetedit()
whether netbuilding takes place in the context of NETEDIT
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.