Eclipse SUMO - Simulation of Urban MObility
GNENetHelper.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-2020 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 /****************************************************************************/
18 // Helper for GNENet
19 //
20 /****************************************************************************/
21 #pragma once
22 #include <config.h>
23 
24 #include <fx.h>
26 #include <netbuild/NBEdge.h>
28 #include <netbuild/NBVehicle.h>
32 #include <utils/geom/Boundary.h>
40 
41 
42 // ===========================================================================
43 // class declarations
44 // ===========================================================================
45 
46 class NBNetBuilder;
47 class GNEAdditional;
48 class GNEDataSet;
49 class GNEDemandElement;
52 class GNEConnection;
53 class GNECrossing;
54 class GNEJunction;
55 class GNEEdgeType;
56 class GNELaneType;
57 class GNEEdge;
58 class GNELane;
59 class GNENetworkElement;
60 class GNEPOI;
61 class GNEPoly;
62 class GNEShape;
63 class GNETAZElement;
64 class GNEUndoList;
65 class GNEViewNet;
66 
67 // ===========================================================================
68 // class definitions
69 // ===========================================================================
70 
71 struct GNENetHelper {
72 
75 
77  friend class GNEAdditionalHandler;
78  friend class GNERouteHandler;
79  friend class GNEChange_Junction;
80  friend class GNEChange_EdgeType;
81  friend class GNEChange_LaneType;
82  friend class GNEChange_Edge;
83  friend class GNEChange_Additional;
84  friend class GNEChange_Shape;
85  friend class GNEChange_TAZElement;
87  friend class GNEChange_DataSet;
88  friend class GNEChange_DataInterval;
89  friend class GNEChange_GenericData;
90 
91  public:
94 
97 
99  void updateID(GNEAttributeCarrier* AC, const std::string newID);
100 
103 
108 
110  const std::map<std::string, GNEJunction*>& getJunctions() const;
111 
113  void clearJunctions();
114 
116 
121 
123  const std::map<std::string, GNEEdgeType*>& getEdgeTypes() const;
124 
126  void clearEdgeTypes();
127 
129 
133  GNEEdge* registerEdge(GNEEdge* edge);
134 
136  const std::map<std::string, GNEEdge*>& getEdges() const;
137 
139  void clearEdges();
140 
142 
145 
159  bool addPolygon(const std::string& id, const std::string& type, const RGBColor& color, double layer,
160  double angle, const std::string& imgFile, bool relativePath, const PositionVector& shape,
161  bool geo, bool fill, double lineWidth, bool ignorePruning = false);
162 
180  bool addPOI(const std::string& id, const std::string& type, const RGBColor& color, const Position& pos, bool geo,
181  const std::string& lane, double posOverLane, double posLat, double layer, double angle,
182  const std::string& imgFile, bool relativePath, double width, double height, bool ignorePruning = false);
183 
185 
189  const std::map<SumoXMLTag, std::map<std::string, GNEAdditional*> >& getAdditionals() const;
190 
192  void clearAdditionals();
193 
195 
199  const std::map<SumoXMLTag, std::map<std::string, GNEShape*> >& getShapes() const;
200 
202  void clearShapes();
203 
205 
209  const std::map<SumoXMLTag, std::map<std::string, GNETAZElement*> >& getTAZElements() const;
210 
212  void clearTAZElements();
213 
215 
219  const std::map<SumoXMLTag, std::map<std::string, GNEDemandElement*> >& getDemandElements() const;
220 
222  void clearDemandElements();
223 
225  void addDefaultVTypes();
226 
228 
232  const std::map<std::string, GNEDataSet*>& getDataSets() const;
233 
235  void clearDataSets();
236 
238 
242  std::vector<GNEGenericData*> retrieveGenericDatas(const SumoXMLTag genericDataTag, const double begin, const double end);
243 
245 
246  protected:
250  void insertJunction(GNEJunction* junction);
251 
253  void deleteSingleJunction(GNEJunction* junction);
254 
256  void updateJunctionID(GNEAttributeCarrier* AC, const std::string& newID);
257 
259 
263  bool edgeTypeExist(const GNEEdgeType* edgeType) const;
264 
266  void insertEdgeType(GNEEdgeType* edgeType);
267 
269  void deleteEdgeType(GNEEdgeType* edgeType);
270 
272  void updateEdgeTypeID(GNEAttributeCarrier* AC, const std::string& newID);
273 
275 
279  void insertEdge(GNEEdge* edge);
280 
282  void deleteSingleEdge(GNEEdge* edge);
283 
285  void updateEdgeID(GNEAttributeCarrier* AC, const std::string& newID);
286 
288 
291 
293  bool additionalExist(const GNEAdditional* additional) const;
294 
298  void insertAdditional(GNEAdditional* additional);
299 
303  void deleteAdditional(GNEAdditional* additional);
304 
306  void updateAdditionalID(GNEAttributeCarrier* AC, const std::string& newID);
307 
309 
312 
314  bool shapeExist(const GNEShape* shape) const;
315 
319  void insertShape(GNEShape* shape);
320 
324  void deleteShape(GNEShape* shape);
325 
327  void updateShapeID(GNEAttributeCarrier* AC, const std::string& newID);
328 
331 
333  bool TAZElementExist(const GNETAZElement* TAZElement) const;
334 
338  void insertTAZElement(GNETAZElement* TAZElement);
339 
343  void deleteTAZElement(GNETAZElement* TAZElement);
344 
346  void updateTAZElementID(GNEAttributeCarrier* AC, const std::string& newID);
347 
349 
352 
354  bool demandElementExist(const GNEDemandElement* demandElement) const;
355 
359  void insertDemandElement(GNEDemandElement* demandElement);
360 
364  void deleteDemandElement(GNEDemandElement* demandElement);
365 
367  void updateDemandElementID(GNEAttributeCarrier* AC, const std::string& newID);
368 
370 
373 
375  bool dataSetExist(const GNEDataSet* dataSet) const;
376 
380  void insertDataSet(GNEDataSet* dataSet);
381 
385  void deleteDataSet(GNEDataSet* dataSet);
386 
388  void updateDataSetID(GNEAttributeCarrier* AC, const std::string& newID);
389 
391 
392  private:
394  std::map<std::string, GNEJunction*> myJunctions;
395 
397  std::map<std::string, GNEEdgeType*> myEdgeTypes;
398 
400  std::map<std::string, GNEEdge*> myEdges;
401 
403  std::map<SumoXMLTag, std::map<std::string, GNEAdditional*> > myAdditionals;
404 
406  std::map<SumoXMLTag, std::map<std::string, GNEShape*> > myShapes;
407 
409  std::map<SumoXMLTag, std::map<std::string, GNETAZElement*> > myTAZElements;
410 
412  std::map<SumoXMLTag, std::map<std::string, GNEDemandElement*> > myDemandElements;
413 
415  std::map<std::string, GNEDataSet*> myDataSets;
416 
419 
422 
425 
428  };
429 
432 
433  public:
435  PathCalculator(const GNENet* net);
436 
438  ~PathCalculator();
439 
441  void updatePathCalculator();
442 
444  std::vector<GNEEdge*> calculatePath(const SUMOVehicleClass vClass, const std::vector<GNEEdge*>& partialEdges) const;
445 
447  void calculateReachability(const SUMOVehicleClass vClass, GNEEdge* originEdge);
448 
450  bool consecutiveEdgesConnected(const SUMOVehicleClass vClass, const GNEEdge* from, const GNEEdge* to) const;
451 
453  bool busStopConnected(const GNEAdditional* busStop, const GNEEdge* edge) const;
454 
455  private:
457  const GNENet* myNet;
458 
461  };
462 
465  FXDECLARE_ABSTRACT(GNEChange_ReplaceEdgeInTLS)
466 
467  public:
470 
473 
475  FXString undoName() const;
476 
478  FXString redoName() const;
479 
481  void undo();
482 
484  void redo();
485 
487  bool trueChange();
488 
489  private:
492 
495 
498  };
499 };
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
SumoXMLTag
Numbers representing SUMO-XML - element names.
Builds additional objects for GNENet (busStops, chargingStations, detectors, etc.....
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
The main window of the Netedit.
the function-object for an editing operation (abstract base)
Definition: GNEChange.h:65
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
Definition: GNECrossing.h:41
An Element which don't belongs to GNENet but has influency in the simulation.
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:49
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
struct used for saving all attribute carriers of net, in different formats
Definition: GNENetHelper.h:74
AttributeCarriers & operator=(const AttributeCarriers &)=delete
Invalidated assignment operator.
const std::map< std::string, GNEDataSet * > & getDataSets() const
void deleteDataSet(GNEDataSet *dataSet)
delete demand element element of GNENet container
bool addPOI(const std::string &id, const std::string &type, const RGBColor &color, const Position &pos, bool geo, const std::string &lane, double posOverLane, double posLat, double layer, double angle, const std::string &imgFile, bool relativePath, double width, double height, bool ignorePruning=false)
Builds a POI using the given values and adds it to the container.
GNEEdgeType * registerEdgeType(GNEEdgeType *edgeType)
void insertDataSet(GNEDataSet *dataSet)
Insert a demand element element int GNENet container.
void clearDemandElements()
clear demand elements
std::map< std::string, GNEDataSet * > myDataSets
map with the ID and pointer to data sets of net
Definition: GNENetHelper.h:415
GNEEdge * registerEdge(GNEEdge *edge)
void updateEdgeTypeID(GNEAttributeCarrier *AC, const std::string &newID)
update edgeType ID in container
void updateDataSetID(GNEAttributeCarrier *AC, const std::string &newID)
update data element ID in container
void deleteShape(GNEShape *shape)
delete shape element of GNENet container
void remapJunctionAndEdgeIds()
remap junction and edge IDs
void clearEdgeTypes()
clear edgeTypes
std::map< SumoXMLTag, std::map< std::string, GNEAdditional * > > myAdditionals
map with the ID and pointer to additional elements of net
Definition: GNENetHelper.h:403
std::map< std::string, GNEJunction * > myJunctions
map with the ID and pointer to junctions of net
Definition: GNENetHelper.h:394
void deleteDemandElement(GNEDemandElement *demandElement)
delete demand element element of GNENet container
void deleteEdgeType(GNEEdgeType *edgeType)
deletes edgeType
void clearAdditionals()
clear additionals
std::vector< GNEGenericData * > retrieveGenericDatas(const SumoXMLTag genericDataTag, const double begin, const double end)
bool demandElementExist(const GNEDemandElement *demandElement) const
return true if given demand element exist
GNENet * myNet
pointer to net
Definition: GNENetHelper.h:418
void updateEdgeID(GNEAttributeCarrier *AC, const std::string &newID)
update edge ID in container
void deleteSingleJunction(GNEJunction *junction)
deletes a single junction
void insertShape(GNEShape *shape)
Insert a shape element int GNENet container.
GNEJunction * registerJunction(GNEJunction *junction)
bool dataSetExist(const GNEDataSet *dataSet) const
return true if given demand element exist
void updateDemandElementID(GNEAttributeCarrier *AC, const std::string &newID)
update demand element ID in container
const std::map< std::string, GNEEdge * > & getEdges() const
map with the ID and pointer to edges of net
void deleteTAZElement(GNETAZElement *TAZElement)
delete TAZElement element of GNENet container
const std::map< SumoXMLTag, std::map< std::string, GNETAZElement * > > & getTAZElements() const
AttributeCarriers(const AttributeCarriers &)=delete
Invalidated copy constructor.
void addDefaultVTypes()
add default VTypes
void deleteSingleEdge(GNEEdge *edge)
deletes a single edge
void deleteAdditional(GNEAdditional *additional)
delete additional element of GNENet container
std::map< SumoXMLTag, std::map< std::string, GNEShape * > > myShapes
map with the ID and pointer to shape elements of net
Definition: GNENetHelper.h:406
void updateID(GNEAttributeCarrier *AC, const std::string newID)
update ID
void insertEdge(GNEEdge *edge)
void insertDemandElement(GNEDemandElement *demandElement)
Insert a demand element element int GNENet container.
void clearTAZElements()
clear TAZElements
bool addPolygon(const std::string &id, const std::string &type, const RGBColor &color, double layer, double angle, const std::string &imgFile, bool relativePath, const PositionVector &shape, bool geo, bool fill, double lineWidth, bool ignorePruning=false)
Builds a polygon using the given values and adds it to the container.
std::map< std::string, GNEEdgeType * > myEdgeTypes
map with the ID and pointer to edgeTypes of net
Definition: GNENetHelper.h:397
std::map< SumoXMLTag, std::map< std::string, GNETAZElement * > > myTAZElements
map with the ID and pointer to TAZElement elements of net
Definition: GNENetHelper.h:409
const std::map< SumoXMLTag, std::map< std::string, GNEAdditional * > > & getAdditionals() const
bool additionalExist(const GNEAdditional *additional) const
return true if given additional exist
bool shapeExist(const GNEShape *shape) const
return true if given shape exist
void insertTAZElement(GNETAZElement *TAZElement)
Insert a TAZElement element int GNENet container.
void insertAdditional(GNEAdditional *additional)
Insert a additional element int GNENet container.
void updateAdditionalID(GNEAttributeCarrier *AC, const std::string &newID)
update additional ID in container
void insertEdgeType(GNEEdgeType *edgeType)
inserts a single edgeType into the net and into the underlying netbuild-container
void clearDataSets()
clear demand elements
void insertJunction(GNEJunction *junction)
std::map< SumoXMLTag, std::map< std::string, GNEDemandElement * > > myDemandElements
map with the ID and pointer to demand elements of net
Definition: GNENetHelper.h:412
const std::map< SumoXMLTag, std::map< std::string, GNEDemandElement * > > & getDemandElements() const
bool myAllowUndoShapes
flag used to indicate if created shape can be undo
Definition: GNENetHelper.h:421
const std::map< std::string, GNEJunction * > & getJunctions() const
map with the ID and pointer to junctions of net
const std::map< std::string, GNEEdgeType * > & getEdgeTypes() const
map with the ID and pointer to edgeTypes of net
bool TAZElementExist(const GNETAZElement *TAZElement) const
return true if given TAZElement exist
void clearJunctions()
clear junctions
void updateJunctionID(GNEAttributeCarrier *AC, const std::string &newID)
update junction ID in container
bool edgeTypeExist(const GNEEdgeType *edgeType) const
std::map< std::string, GNEEdge * > myEdges
map with the ID and pointer to edges of net
Definition: GNENetHelper.h:400
AttributeCarriers(GNENet *net)
constructor
const std::map< SumoXMLTag, std::map< std::string, GNEShape * > > & getShapes() const
void updateShapeID(GNEAttributeCarrier *AC, const std::string &newID)
update shape ID in container
void updateTAZElementID(GNEAttributeCarrier *AC, const std::string &newID)
update TAZElement ID in container
class for GNEChange_ReplaceEdgeInTLS
Definition: GNENetHelper.h:464
NBEdge * myBy
replaced by NBEdge
Definition: GNENetHelper.h:497
NBTrafficLightLogicCont & myTllcont
container for traffic light logic
Definition: GNENetHelper.h:491
FXString redoName() const
get Redo name
GNEChange_ReplaceEdgeInTLS(NBTrafficLightLogicCont &tllcont, NBEdge *replaced, NBEdge *by)
constructor
bool trueChange()
wether original and new value differ
class used to calculate paths in nets
Definition: GNENetHelper.h:431
bool busStopConnected(const GNEAdditional *busStop, const GNEEdge *edge) const
check if exist a path between the given busStop and edge (Either a valid lane or an acces) for pedest...
void updatePathCalculator()
update path calculator (called when SuperModes Demand or Data is selected)
void calculateReachability(const SUMOVehicleClass vClass, GNEEdge *originEdge)
calculate reachability for given edge
PathCalculator(const GNENet *net)
constructor
SUMOAbstractRouter< NBRouterEdge, NBVehicle > * myDijkstraRouter
SUMO Abstract myDijkstraRouter.
Definition: GNENetHelper.h:460
std::vector< GNEEdge * > calculatePath(const SUMOVehicleClass vClass, const std::vector< GNEEdge * > &partialEdges) const
calculate Dijkstra path between a list of partial edges
const GNENet * myNet
pointer to net
Definition: GNENetHelper.h:457
bool consecutiveEdgesConnected(const SUMOVehicleClass vClass, const GNEEdge *from, const GNEEdge *to) const
check if exist a path between the two given consecutives edges for the given VClass
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:40
Definition: GNEPOI.h:41
Builds trigger objects for GNENet (busStops, chargingStations, detectors, etc..)
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNETAZElement.h:45
The representation of a single edge during network building.
Definition: NBEdge.h:91
Instance responsible for building networks.
Definition: NBNetBuilder.h:107
A container for traffic light definitions and built programs.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
A list of positions.
Storage for geometrical objects.