/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file GNENetHelper.h14/// @author Pablo Alvarez Lopez15/// @date Mar 202016///17// Helper for GNENet18//19/****************************************************************************/20#pragma once21#include <config.h>2223#include <foreign/rtree/SUMORTree.h>24#include <netbuild/NBEdge.h>25#include <netbuild/NBTrafficLightLogicCont.h>26#include <netbuild/NBVehicle.h>27#include <netedit/changes/GNEChange.h>28#include <netedit/dialogs/GNEDialog.h>29#include <utils/common/IDSupplier.h>30#include <utils/common/SUMOVehicleClass.h>31#include <utils/foxtools/fxheader.h>32#include <utils/geom/Boundary.h>33#include <utils/geom/PositionVector.h>34#include <utils/geom/Triangle.h>35#include <utils/gui/globjects/GUIGlObject.h>36#include <utils/gui/globjects/GUIShapeContainer.h>37#include <utils/gui/settings/GUIVisualizationSettings.h>38#include <utils/router/SUMOAbstractRouter.h>39#include <utils/xml/SUMOXMLDefinitions.h>4041// ===========================================================================42// class declarations43// ===========================================================================4445class GNEAdditional;46class GNEApplicationWindow;47class GNEAttributeCarrier;48class GNEConnection;49class GNECrossing;50class GNEDataInterval;51class GNEDataSet;52class GNEDemandElement;53class GNEEdge;54class GNEEdgeType;55class GNEJunction;56class GNELane;57class GNELaneType;58class GNEMeanData;59class GNENet;60class GNENetworkElement;61class GNEPOI;62class GNEPoly;63class GNEUndoList;64class GNEViewNet;65class GNEWalkingArea;66class NBNetBuilder;6768// ===========================================================================69// class definitions70// ===========================================================================7172struct GNENetHelper {7374/// @brief struct used for saving all attribute carriers of net, in different formats75class AttributeCarriers {7677/// @brief declare friend class78friend class GNEAdditionalHandler;79friend class GNERouteHandler;80friend class GNEDataHandler;81friend class GNEMeanDataHandler;82friend class GNEJunction;83friend class GNEEdge;84friend class GNEDataSet;85friend class GNEDataInterval;86friend class GNEChange_Junction;87friend class GNEChange_EdgeType;88friend class GNEChange_Edge;89friend class GNEChange_TAZSourceSink;90friend class GNEChange_Additional;91friend class GNEChange_Shape;92friend class GNEChange_TAZElement;93friend class GNEChange_DemandElement;94friend class GNEChange_DataSet;95friend class GNEChange_DataInterval;96friend class GNEChange_GenericData;97friend class GNEChange_MeanData;98friend class GNETLSEditorFrame;99100public:101/// @brief constructor102AttributeCarriers(GNENet* net);103104/// @brief destructor105~AttributeCarriers();106107/// @brief remap junction and edge IDs108void remapJunctionAndEdgeIds();109110/// @brief check if shape of given AC (network element) is around the given triangle111bool isNetworkElementAroundTriangle(GNEAttributeCarrier* AC, const Triangle& triangle) const;112113/// @brief functions related with number of elements sorted by categories114/// @{115/// @brief get number of current network elements saved in AttributeCarriers116int getNumberOfNetworkElements() const;117118/// @brief get number of current demand elements saved in AttributeCarriers (default vTypes are NOT included)119int getNumberOfDemandElements() const;120121/// @brief get number of current data elements saved in AttributeCarriers122int getNumberOfDataElements() const;123124/// @}125126/// @name function for attribute carriers127/// @{128129/**@brief get a single attribute carrier based on a GLID130* @param[in] ids the GL IDs for which to retrieve the AC131* @param[in] hardFail Whether attempts to retrieve a nonexisting AttributeCarrier should result in an exception132* @throws InvalidArgument if GL ID doesn't have a associated Attribute Carrier133*/134GNEAttributeCarrier* retrieveAttributeCarrier(const GUIGlID id, bool hardFail = true) const;135136/**@brief get the attribute carriers based on Type137* @param[in] type The GUI-type of the AC. SUMO_TAG_NOTHING returns all elements (Warning: bottleneck)138* @note tag could not exist139*/140std::vector<GNEAttributeCarrier*> retrieveAttributeCarriers(SumoXMLTag tag = SUMO_TAG_NOTHING);141142/// @brief get the attribute carriers based on supermode and selected143std::vector<GNEAttributeCarrier*> retrieveAttributeCarriers(Supermode supermode, const bool onlySelected);144145/// @brief get all selected attribute carriers (or only relative to current supermode146std::vector<GNEAttributeCarrier*> getSelectedAttributeCarriers(const bool ignoreCurrentSupermode);147148/// @}149150/// @name function for junctions151/// @{152/**@brief get junction by id153* @param[in] id The id of the desired junction154* @param[in] hardFail Whether attempts to retrieve a nonexisting junction should result in an exception155* @throws UnknownElement156*/157GNEJunction* retrieveJunction(const std::string& id, bool hardFail = true) const;158159/// @brief get junctions160const std::map<std::string, GNEJunction*>& getJunctions() const;161162/// @brief return selected junctions163std::vector<GNEJunction*> getSelectedJunctions() const;164165/// @brief registers a junction in containers166GNEJunction* registerJunction(GNEJunction* junction);167168/// @brief clear junctions169void clearJunctions();170171/// @brief add prefix to all junctions172void addPrefixToJunctions(const std::string& prefix);173174/// @brief update junction ID in container175void updateJunctionID(GNEJunction* junction, const std::string& newID);176177/// @brief get number of selected junctions178int getNumberOfSelectedJunctions() const;179180/// @}181182/// @name function for crossings183/// @{184/**@brief get Crossing by AC185* @param[in] glObject The GUIGlObject associated with the element186* @param[in] hardFail Whether attempts to retrieve a nonexisting Crossing should result in an exception187* @throws UnknownElement188*/189GNECrossing* retrieveCrossing(const GUIGlObject* glObject, bool hardFail = true) const;190191/// @brief get crossings192const std::unordered_map<const GUIGlObject*, GNECrossing*>& getCrossings() const;193194/// @brief return all selected crossings195std::vector<GNECrossing*> getSelectedCrossings() const;196197/// @brief get number of selected crossings198int getNumberOfSelectedCrossings() const;199200/// @}201202/// @name function for walkingAreas203/// @{204/**@brief get WalkingArea by GlObject205* @param[in] glObject The GUIGlObject associated with the element206* @param[in] hardFail Whether attempts to retrieve a nonexisting WalkingArea should result in an exception207* @throws UnknownElement208*/209GNEWalkingArea* retrieveWalkingArea(const GUIGlObject* glObject, bool hardFail = true) const;210211/// @brief get walkingAreas212const std::unordered_map<const GUIGlObject*, GNEWalkingArea*>& getWalkingAreas() const;213214/// @brief return all selected walkingAreas215std::vector<GNEWalkingArea*> getSelectedWalkingAreas() const;216217/// @brief get number of selected walkingAreas218int getNumberOfSelectedWalkingAreas() const;219220/// @}221222/// @name function for edgeTypes223/// @{224/**@brief get edge type by id225* @param[in] id The id of the desired edge type226* @param[in] hardFail Whether attempts to retrieve a nonexisting edge type should result in an exception227* @throws UnknownElement228*/229GNEEdgeType* retrieveEdgeType(const std::string& id, bool hardFail = true) const;230231/// @brief registers a edge in containers232GNEEdgeType* registerEdgeType(GNEEdgeType* edgeType);233234/// @brief map with the ID and pointer to edgeTypes of net235const std::map<std::string, GNEEdgeType*>& getEdgeTypes() const;236237/// @brief clear edgeTypes238void clearEdgeTypes();239240/// @brief update edgeType ID in container241void updateEdgeTypeID(GNEEdgeType* edgeType, const std::string& newID);242243/// @brief generate edgeType id244std::string generateEdgeTypeID() const;245246/// @}247248/// @name function for edges249/// @{250/**@brief get edge by id251* @param[in] id The id of the desired edge252* @param[in] hardFail Whether attempts to retrieve a nonexisting edge should result in an exception253* @throws UnknownElement254*/255GNEEdge* retrieveEdge(const std::string& id, bool hardFail = true) const;256257/**@brief get all edges by from and to GNEJunction258* @param[in] id The id of the desired edge259* @param[in] hardFail Whether attempts to retrieve a nonexisting edge should result in an exception260* @throws UnknownElement261*/262std::vector<GNEEdge*> retrieveEdges(GNEJunction* from, GNEJunction* to) const;263264/// @brief map with the ID and pointer to edges of net265const std::map<std::string, GNEEdge*>& getEdges() const;266267/**@brief return all edges268* @param[in] onlySelected Whether to return only selected edges269*/270std::vector<GNEEdge*> getSelectedEdges() const;271272/// @brief registers an edge with containers273GNEEdge* registerEdge(GNEEdge* edge);274275/// @brief clear edges276void clearEdges();277278/// @brief add prefix to all edges279void addPrefixToEdges(const std::string& prefix);280281/// @brief generate edge ID282std::string generateEdgeID() const;283284/// @brief update edge ID in container285void updateEdgeID(GNEEdge* edge, const std::string& newID);286287/// @brief get number of selected edges288int getNumberOfSelectedEdges() const;289290/// @}291292/// @name function for lanes293/// @{294/**@brief get lane by id295* @param[in] id The id of the desired lane296* @param[in] hardFail Whether attempts to retrieve a nonexisting lane should result in an exception297* @param[in] checkVolatileChange Used by additionals after recomputing with volatile options.298* @throws UnknownElement299*/300GNELane* retrieveLane(const std::string& id, bool hardFail = true, bool checkVolatileChange = false) const;301302/**@brief get Lane by GlObject303* @param[in] glObject The GUIGlObject associated with the element304* @param[in] hardFail Whether attempts to retrieve a nonexisting Lane should result in an exception305* @throws UnknownElement306*/307GNELane* retrieveLane(const GUIGlObject* glObject, bool hardFail = true) const;308309/// @brief get lanes310const std::unordered_map<const GUIGlObject*, GNELane*>& getLanes() const;311312/// @brief get selected lanes313std::vector<GNELane*> getSelectedLanes() const;314315/// @brief get number of selected lanes316int getNumberOfSelectedLanes() const;317318/// @}319320/// @name function for connections321/// @{322/**@brief get Connection by id323* @param[in] id The id of the desired Connection324* @param[in] hardFail Whether attempts to retrieve a nonexisting Connection should result in an exception325* @throws UnknownElement326*/327GNEConnection* retrieveConnection(const std::string& id, bool hardFail = true) const;328329/**@brief get Connection by GUIGlObject330* @param[in] glObject The GUIGlObject associated with the element331* @param[in] hardFail Whether attempts to retrieve a nonexisting Connection should result in an exception332* @throws UnknownElement333*/334GNEConnection* retrieveConnection(const GUIGlObject* glObject, bool hardFail = true) const;335336/// @brief get connections337const std::unordered_map<const GUIGlObject*, GNEConnection*>& getConnections() const;338339/// @brief get selected connections340std::vector<GNEConnection*> getSelectedConnections() const;341342/// @brief get number of selected connections343int getNumberOfSelectedConnections() const;344345/// @}346347/// @name function for internalLanes348/// @{349350/**@brief get InternalLane by GUIGlObject351* @param[in] glObject The GUIGlObject associated with the element352* @param[in] hardFail Whether attempts to retrieve a nonexisting InternalLane should result in an exception353* @throws UnknownElement354*/355GNEInternalLane* retrieveInternalLane(const GUIGlObject* glObject, bool hardFail = true) const;356357/// @}358359/// @name function for additionals360/// @{361/**@brief Returns the named additional362* @param[in] id The attribute carrier related with the additional element363* @param[in] type tag with the type of additional364* @param[in] id The id of the additional to return.365* @param[in] hardFail Whether attempts to retrieve a nonexisting additional should result in an exception366*/367GNEAdditional* retrieveAdditional(SumoXMLTag type, const std::string& id, bool hardFail = true) const;368369/**@brief Returns the named additional370* @param[in] id The attribute carrier related with the additional element371* @param[in] types tags with the type of additional372* @param[in] id The id of the additional to return.373* @param[in] hardFail Whether attempts to retrieve a nonexisting additional should result in an exception374*/375GNEAdditional* retrieveAdditionals(const std::vector<SumoXMLTag> types, const std::string& id, bool hardFail = true) const;376377/**@brief Returns the named additional378* @param[in] glObject The GUIGlObject associated with the element379* @param[in] hardFail Whether attempts to retrieve a nonexisting additional should result in an exception380*/381GNEAdditional* retrieveAdditional(const GUIGlObject* glObject, bool hardFail = true) const;382383/**@brief Returns the rerouter interval defined by given begin and end384* @param[in] rerouter ID385* @param[in] begin SUMOTime begin386* @param[in] end SUMOTime begin387*/388GNEAdditional* retrieveRerouterInterval(const std::string& rerouterID, const SUMOTime begin, const SUMOTime end) const;389390/// @brief get additionals391const std::unordered_map<SumoXMLTag, std::unordered_map<const GUIGlObject*, GNEAdditional*>, std::hash<int> >& getAdditionals() const;392393/// @brief get selected additionals394std::vector<GNEAdditional*> getSelectedAdditionals() const;395396/// @brief get selected shapes397std::vector<GNEAdditional*> getSelectedShapes() const;398399/// @brief get number of additionals400int getNumberOfAdditionals() const;401402/// @brief clear additionals403void clearAdditionals();404405/// @brief update additional ID in container406void updateAdditionalID(GNEAdditional* additional, const std::string& newID);407408/// @brief generate additional id409std::string generateAdditionalID(SumoXMLTag type) const;410411/// @brief get number of selected additionals (Including POIs, Polygons, TAZs and Wires)412int getNumberOfSelectedAdditionals() const;413414/// @brief get number of selected pure additionals (Except POIs, Polygons, TAZs and Wires)415int getNumberOfSelectedPureAdditionals() const;416417/// @brief get number of selected polygons418int getNumberOfSelectedPolygons() const;419420/// @brief get number of selected walkable areas421int getNumberOfSelectedJpsWalkableAreas() const;422423/// @brief get number of selected obstacles424int getNumberOfSelectedJpsObstacles() const;425426/// @brief get number of selected POIs427int getNumberOfSelectedPOIs() const;428429/// @brief get number of selected TAZs430int getNumberOfSelectedTAZs() const;431432/// @brief get number of selected Wires433int getNumberOfSelectedWires() const;434435/// @}436437/// @name function for TAZ sourceSinks438/// @{439/**@brief Returns the named sourceSink440* @param[in] sourceSink The GNETAZSourceSink to retrieve441* @param[in] hardFail Whether attempts to retrieve a nonexisting sourceSink should result in an exception442*/443GNETAZSourceSink* retrieveTAZSourceSink(const GNEAttributeCarrier* sourceSink, bool hardFail = true) const;444445/// @brief get sourceSinks446const std::unordered_map<SumoXMLTag, std::unordered_map<const GNEAttributeCarrier*, GNETAZSourceSink*>, std::hash<int> >& getTAZSourceSinks() const;447448/// @brief get number of TAZSourceSinks449int getNumberOfTAZSourceSinks() const;450451/// @brief clear sourceSinks452void clearTAZSourceSinks();453454/// @}455456/// @name function for demand elements457/// @{458/**@brief Returns the named demand element459* @param[in] type tag with the type of demand element460* @param[in] id The id of the demand element to return.461* @param[in] hardFail Whether attempts to retrieve a nonexisting demand element should result in an exception462*/463GNEDemandElement* retrieveDemandElement(SumoXMLTag type, const std::string& id, bool hardFail = true) const;464465/**@brief Returns the named demand element466* @param[in] types tag with the type of demand element467* @param[in] id The id of the demand element to return.468* @param[in] hardFail Whether attempts to retrieve a nonexisting demand element should result in an exception469*/470GNEDemandElement* retrieveDemandElements(const std::vector<SumoXMLTag> types, const std::string& id, bool hardFail = true) const;471472/**@brief Returns the named demand473* @param[in] glObject The GUIGlObject associated with the element474* @param[in] hardFail Whether attempts to retrieve a nonexisting demand should result in an exception475*/476GNEDemandElement* retrieveDemandElement(const GUIGlObject* glObject, bool hardFail = true) const;477478/// @brief get selected demand elements479std::vector<GNEDemandElement*> getSelectedDemandElements() const;480481/// @brief get demand elements482const std::unordered_map<SumoXMLTag, std::unordered_map<const GUIGlObject*, GNEDemandElement*>, std::hash<int> >& getDemandElements() const;483484/// @brief generate demand element id485std::string generateDemandElementID(SumoXMLTag tag) const;486487/// @brief get default type488GNEDemandElement* getDefaultType() const;489490/// @brief clear demand elements491void clearDemandElements();492493/// @brief update demand element ID in container494void updateDemandElementID(GNEDemandElement* demandElement, const std::string& newID);495496/// @brief add default VTypes497void addDefaultVTypes();498499/// @brief get (and update) stop index500int getStopIndex();501502/// @brief get number of selected demand elements503int getNumberOfSelectedDemandElements() const;504505/// @brief get number of selected routes506int getNumberOfSelectedRoutes() const;507508/// @brief get number of selected vehicles509int getNumberOfSelectedVehicles() const;510511/// @brief get number of selected persons512int getNumberOfSelectedPersons() const;513514/// @brief get number of selected person trips515int getNumberOfSelectedPersonTrips() const;516517/// @brief get number of selected walks518int getNumberOfSelectedWalks() const;519520/// @brief get number of selected rides521int getNumberOfSelectedRides() const;522523/// @brief get number of selected containers524int getNumberOfSelectedContainers() const;525526/// @brief get number of selected transports527int getNumberOfSelectedTransport() const;528529/// @brief get number of selected tranships530int getNumberOfSelectedTranships() const;531532/// @brief get number of selected stops533int getNumberOfSelectedStops() const;534535/// @}536537/// @name function for data sets538/// @{539/**@brief Returns the named data set540* @param[in] id The id of the data set to return.541* @param[in] hardFail Whether attempts to retrieve a nonexisting data set should result in an exception542*/543GNEDataSet* retrieveDataSet(const std::string& id, bool hardFail = true) const;544545/// @brief get demand elements546const std::map<const std::string, GNEDataSet*>& getDataSets() const;547548/// @brief generate data set id549std::string generateDataSetID() const;550551/// @}552553/// @name function for data intervals554/// @{555/**@brief Returns the data interval556* @param[in] id The attribute carrier related with the dataInterval element557* @param[in] hardFail Whether attempts to retrieve a nonexisting data set should result in an exception558*/559GNEDataInterval* retrieveDataInterval(const GNEAttributeCarrier* AC, bool hardFail = true) const;560561/// @brief get all data intervals of network562const std::unordered_map<const GNEAttributeCarrier*, GNEDataInterval*>& getDataIntervals() const;563564/// @}565566/// @name function for generic datas567/// @{568/**@brief Returns the generic data569* @param[in] id The attribute carrier related with the genericData element570* @param[in] hardFail Whether attempts to retrieve a nonexisting data set should result in an exception571*/572GNEGenericData* retrieveGenericData(const GUIGlObject* glObject, bool hardFail = true) const;573574/// @brief get selected generic datas575std::vector<GNEGenericData*> getSelectedGenericDatas() const;576577/// @brief get all generic datas578const std::unordered_map<SumoXMLTag, std::unordered_map<const GUIGlObject*, GNEGenericData*>, std::hash<int> >& getGenericDatas() const;579580/// @brief retrieve generic datas within the given interval581std::vector<GNEGenericData*> retrieveGenericDatas(const SumoXMLTag genericDataTag, const double begin, const double end);582583/// @brief Return the number of generic datas584int getNumberOfGenericDatas() const;585586/// @brief get number of selected edge datas587int getNumberOfSelectedEdgeDatas() const;588589/// @brief get number of selected edge rel datas590int getNumberOfSelectedEdgeRelDatas() const;591592/// @brief get number of selected edge TAZ Rels593int getNumberOfSelectedEdgeTAZRel() const;594595/// @brief return a set of parameters for the given data Interval596std::set<std::string> retrieveGenericDataParameters(const std::string& genericDataTag, const double begin, const double end) const;597598/// @brief return a set of parameters for the given dataSet, generic data Type, begin and end599std::set<std::string> retrieveGenericDataParameters(const std::string& dataSetID, const std::string& genericDataTag,600const std::string& beginStr, const std::string& endStr) const;601602/// @}603604/// @name function for meanDatas605/// @{606/**@brief Returns the named meanData607* @param[in] id The attribute carrier related with the meanData element608* @param[in] type tag with the type of meanData609* @param[in] id The id of the meanData to return.610* @param[in] hardFail Whether attempts to retrieve a nonexisting meanData should result in an exception611*/612GNEMeanData* retrieveMeanData(SumoXMLTag type, const std::string& id, bool hardFail = true) const;613614/// @brief get meanDatas615const std::unordered_map<SumoXMLTag, std::map<const std::string, GNEMeanData*>, std::hash<int> >& getMeanDatas() const;616617/// @brief get number of meanDatas618int getNumberOfMeanDatas() const;619620/// @brief clear meanDatas621void clearMeanDatas();622623/// @brief update meanData ID in container624void updateMeanDataID(GNEMeanData* meanData, const std::string& newID);625626/// @brief generate meanData id627std::string generateMeanDataID(SumoXMLTag type) const;628629/// @}630631protected:632/// @name Junctions protected functions633/// @{634635/// @brief insert junction in container636void insertJunction(GNEJunction* junction);637638/// @brief delete junction from container639void deleteSingleJunction(GNEJunction* junction);640641/// @}642643/// @name edge types protected functions644/// @{645646/// @brief insert edge type in container647void insertEdgeType(GNEEdgeType* edgeType);648649/// @brief delete edge type from container650void deleteEdgeType(GNEEdgeType* edgeType);651652/// @}653654/// @name edges protected functions655/// @{656/// @brief insert edge in container657void insertEdge(GNEEdge* edge);658659/// @brief delete edge from container660void deleteSingleEdge(GNEEdge* edge);661662/// @}663664/// @name lane protected functions665/// @{666667/// @brief insert lane in container668void insertLane(GNELane* lane);669670/// @brief delete lane from container671void deleteLane(GNELane* lane);672673/// @}674675/// @name crossing protected functions676/// @{677678/// @brief insert crossing in container679void insertCrossing(GNECrossing* crossing);680681/// @brief delete crossing from container682void deleteCrossing(GNECrossing* crossing);683684/// @}685686/// @name walking areas protected functions687/// @{688689/// @brief insert walkingArea in container690void insertWalkingArea(GNEWalkingArea* walkingArea);691692/// @brief delete walkingArea from container693void deleteWalkingArea(GNEWalkingArea* walkingArea);694695/// @}696697/// @name connection protected functions698/// @{699700/// @brief insert connection in container701void insertConnection(GNEConnection* connection);702703/// @brief delete connection from container704void deleteConnection(GNEConnection* connection);705706/// @}707708/// @name internalLane protected functions709/// @{710711/// @brief insert internalLane in container712void insertInternalLane(GNEInternalLane* internalLane);713714/// @brief delete internalLane from container715void deleteInternalLane(GNEInternalLane* internalLane);716717/// @}718719/// @name additionals protected functions720/// @{721722/// @brief Insert a additional element in container.723void insertAdditional(GNEAdditional* additional);724725/// @brief delete additional element of container726void deleteAdditional(GNEAdditional* additional);727728/// @}729730/// @name TAZ Source Sinks protected functions731/// @{732733/// @brief Insert a sourceSink element in container.734void insertTAZSourceSink(GNETAZSourceSink* sourceSink);735736/// @brief delete sourceSink element of container737void deleteTAZSourceSink(GNETAZSourceSink* sourceSink);738739/// @}740741/// @name demand elements protected functions742/// @{743744/// @brief Insert a demand element in container.745void insertDemandElement(GNEDemandElement* demandElement);746747/// @brief delete demand element of container748void deleteDemandElement(GNEDemandElement* demandElement, const bool updateFrames);749750/// @}751752/// @name datas protected functions753/// @{754755/// @brief Insert a data set in container.756void insertDataSet(GNEDataSet* dataSet);757758/// @brief delete data set of container759void deleteDataSet(GNEDataSet* dataSet);760761/// @}762763/// @name data intervals protected functions764/// @{765766/// @brief insert data interval in container767void insertDataInterval(const GNEAttributeCarrier* AC, GNEDataInterval* dataInterval);768769/// @brief delete data interval of container770void deleteDataInterval(GNEDataInterval* dataInterval);771772/// @}773774/// @name generic datas protected functions775/// @{776777/// @brief insert generic data in container778void insertGenericData(GNEGenericData* genericData);779780/// @brief delete generic data of container781void deleteGenericData(GNEGenericData* genericData);782783/// @}784785/// @name Insertion and erasing of GNEMeanDatas items786/// @{787788/// @brief Insert a meanData element in container.789void insertMeanData(GNEMeanData* meanData);790791/// @brief delete meanData element of container792void deleteMeanData(GNEMeanData* meanData);793794/// @}795796/// @brief update demand element frames (called after insert/delete demand element)797void updateDemandElementFrames(const GNETagProperties* tagProperty);798799/// @brief retrieve attribute carriers recursively800void retrieveAttributeCarriersRecursively(const GNETagProperties* tag, std::vector<GNEAttributeCarrier*>& ACs);801802private:803/// @brief pointer to net804GNENet* myNet;805806/// @brief stop index807int myStopIndex;808809/// @brief number of network elemements inserted in AttributeCarriers810int myNumberOfNetworkElements = 0;811812/// @brief number of demand elemements inserted in AttributeCarriers (excluding default vTypes)813int myNumberOfDemandElements = 0;814815/// @brief number of data elemements inserted in AttributeCarriers816int myNumberOfDataElements = 0;817818/// @brief number of mean data elemements inserted in AttributeCarriers819int myNumberOfMeanDataElements = 0;820821/// @brief map with the ID and pointer to junctions of net822std::map<std::string, GNEJunction*> myJunctions;823824/// @brief set with crossings825std::unordered_map<const GUIGlObject*, GNECrossing*> myCrossings;826827/// @brief set with walkingAreas828std::unordered_map<const GUIGlObject*, GNEWalkingArea*> myWalkingAreas;829830/// @brief map with the ID and pointer to edgeTypes of net831std::map<std::string, GNEEdgeType*> myEdgeTypes;832833/// @brief map with the ID and pointer to edges of net834std::map<std::string, GNEEdge*> myEdges;835836/// @brief map with lanes837std::unordered_map<const GUIGlObject*, GNELane*> myLanes;838839/// @brief map with connetions840std::unordered_map<const GUIGlObject*, GNEConnection*> myConnections;841842/// @brief map with internal lanes843std::unordered_map<const GUIGlObject*, GNEInternalLane*> myInternalLanes;844845/// @brief map with the tag and pointer to additional elements of net, sorted by IDs846std::unordered_map<SumoXMLTag, std::map<const std::string, GNEAdditional*>, std::hash<int> > myAdditionalIDs;847848/// @brief map with the tag and pointer to additional elements of net849std::unordered_map<SumoXMLTag, std::unordered_map<const GUIGlObject*, GNEAdditional*>, std::hash<int> > myAdditionals;850851/// @brief map with the tag and pointer to TAZSourceSinks elements of net852std::unordered_map<SumoXMLTag, std::unordered_map<const GNEAttributeCarrier*, GNETAZSourceSink*>, std::hash<int> > myTAZSourceSinks;853854/// @brief map with the tag and pointer to demand elements of net, sorted by IDs855std::unordered_map<SumoXMLTag, std::map<const std::string, GNEDemandElement*>, std::hash<int> > myDemandElementIDs;856857/// @brief map with the tag and pointer to demand elements elements of net858std::unordered_map<SumoXMLTag, std::unordered_map<const GUIGlObject*, GNEDemandElement*>, std::hash<int> > myDemandElements;859860/// @brief map with the ID and pointer to all datasets of net861std::map<const std::string, GNEDataSet*> myDataSets;862863/// @brief map with all data intervals of network864std::unordered_map<const GNEAttributeCarrier*, GNEDataInterval*> myDataIntervals;865866/// @brief map with the tag and pointer to all generic datas867std::unordered_map<SumoXMLTag, std::unordered_map<const GUIGlObject*, GNEGenericData*>, std::hash<int> > myGenericDatas;868869/// @brief map with the tag and pointer to meanData elements of net870std::unordered_map<SumoXMLTag, std::map<const std::string, GNEMeanData*>, std::hash<int> > myMeanDatas;871872/// @brief Invalidated default constructor.873AttributeCarriers() = delete;874875/// @brief Invalidated copy constructor.876AttributeCarriers(const AttributeCarriers&) = delete;877878/// @brief Invalidated assignment operator.879AttributeCarriers& operator=(const AttributeCarriers&) = delete;880};881882/// @brief modul for AC Templates883class ACTemplate {884885public:886/// @brief constructor887ACTemplate(GNENet* net);888889/// @brief build templates890void buildTemplates();891892/// @brief destructor893~ACTemplate();894895/// @brief get all AC templates896std::map<SumoXMLTag, GNEAttributeCarrier*> getACTemplates() const;897898/// @brief get template AC by tag899GNEAttributeCarrier* getTemplateAC(const SumoXMLTag tag) const;900901/// @brief get template AC by text (using selector text902GNEAttributeCarrier* getTemplateAC(const std::string& selectorText) const;903904private:905/// @brief pointer to net906GNENet* myNet = nullptr;907908/// @brief map with templates909std::map<SumoXMLTag, GNEAttributeCarrier*> myTemplates;910911/// @brief Invalidated default constructor.912ACTemplate() = delete;913914/// @brief Invalidated copy constructor.915ACTemplate(const ACTemplate&) = delete;916917/// @brief Invalidated assignment operator918ACTemplate& operator=(const ACTemplate& src) = delete;919};920921/// @brief modul for handling saving files922class SavingFilesHandler {923924public:925/// @brief typedef used for group ACs by filename926typedef std::map<std::string, std::unordered_set<const GNEAttributeCarrier*> > ACsbyFilename;927928/// @brief constructor929SavingFilesHandler(GNENet* net);930931/// @brief update netedit config932void updateNeteditConfig();933934/// @brief additional elements935/// @{936937/// @brief add additional filename938void addAdditionalFilename(const GNEAttributeCarrier* additionalElement);939940/// @brief update additional elements with empty filenames with the given file941void updateAdditionalEmptyFilenames(const std::string& file);942943/// @brief get vector with additional elements saving files (starting with default)944const std::vector<std::string>& getAdditionalFilenames() const;945946/// @brief get additionals sorted by filenames (and also clear unused filenames)947ACsbyFilename getAdditionalsByFilename();948949/// @brief check if the given additional file was already registered950bool existAdditionalFilename(const std::string& file) const;951952/// @}953954/// @brief demand elements955/// @{956957/// @brief add demand filename958void addDemandFilename(const GNEAttributeCarrier* demandElement);959960/// @brief update demand elements with empty filenames with the given file961void updateDemandEmptyFilenames(const std::string& file);962963/// @brief get vector with demand elements saving files (starting with default)964const std::vector<std::string>& getDemandFilenames() const;965966/// @brief get demands sorted by filenames (and also clear unused filenames)967ACsbyFilename getDemandsByFilename();968969/// @brief check if the given demand file was already registered970bool existDemandFilename(const std::string& file) const;971972/// @}973974/// @brief data elements975/// @{976977/// @brief add data filename978void addDataFilename(const GNEAttributeCarrier* dataElement);979980/// @brief update data elements with empty filenames with the given file981void updateDataEmptyFilenames(const std::string& file);982983/// @brief get vector with data elements saving files (starting with default)984const std::vector<std::string>& getDataFilenames() const;985986/// @brief get datas sorted by filenames (and also clear unused filenames)987ACsbyFilename getDatasByFilename();988989/// @brief check if the given data file was already registered990bool existDataFilename(const std::string& file) const;991992/// @}993994/// @brief meanData elements995/// @{996997/// @brief add meanData filename998void addMeanDataFilename(const GNEAttributeCarrier* meanDataElement);9991000/// @brief update meanData elements with empty filenames with the given file1001void updateMeanDataEmptyFilenames(const std::string& file);10021003/// @brief get vector with meanData elements saving files (starting with default)1004const std::vector<std::string>& getMeanDataFilenames() const;10051006/// @brief get meanDatas sorted by filenames (and also clear unused filenames)1007ACsbyFilename getMeanDatasByFilename();10081009/// @brief check if the given meanData file was already registered1010bool existMeanDataFilename(const std::string& file) const;10111012/// @}10131014private:1015/// @brief pointer to net1016GNENet* myNet;10171018/// @brief vector with additional elements saving files1019std::vector<std::string> myAdditionalElementsSavingFiles;10201021/// @brief vector with demand elements saving files1022std::vector<std::string> myDemandElementsSavingFiles;10231024/// @brief vector with data elements saving files1025std::vector<std::string> myDataElementsSavingFiles;10261027/// @brief vector with mean data elements saving files1028std::vector<std::string> myMeanDataElementsSavingFiles;10291030/// @brief parsing saving files1031std::string parsingSavingFiles(const std::vector<std::string>& savingFiles) const;10321033/// @brief Invalidated default constructor.1034SavingFilesHandler() = delete;10351036/// @brief Invalidated copy constructor.1037SavingFilesHandler(const SavingFilesHandler&) = delete;10381039/// @brief Invalidated assignment operator.1040SavingFilesHandler& operator=(const SavingFilesHandler&) = delete;1041};10421043/// @brief modul for Saving status1044class SavingStatus {10451046public:1047/// @brief constructor1048SavingStatus(GNENet* net);10491050/// @name SumoConfig1051/// @{10521053/// @brief inform that SumoConfig has to be saved1054void requireSaveSumoConfig();10551056/// @brief mark SumoConfig as saved1057void SumoConfigSaved();10581059/// @brief check if SumoConfig is saved1060bool isSumoConfigSaved() const;10611062/// @}10631064/// @name NeteditConfig1065/// @{10661067/// @brief inform that netedit config has to be saved1068void requireSaveNeteditConfig();10691070/// @brief mark netedit config as saved1071void neteditConfigSaved();10721073/// @brief check if netedit config is saved1074bool isNeteditConfigSaved() const;10751076/// @}10771078/// @name network1079/// @{10801081/// @brief inform that network has to be saved1082void requireSaveNetwork();10831084/// @brief mark network as saved1085void networkSaved();10861087/// @brief check if network is saved1088bool isNetworkSaved() const;10891090/// @}10911092/// @name TLS1093/// @{10941095/// @brief inform that TLS has to be saved1096void requireSaveTLS();10971098/// @brief mark TLS as saved1099void TLSSaved();11001101/// @brief check if TLS are saved1102bool isTLSSaved() const;11031104/// @}11051106/// @name edge types1107/// @{11081109/// @brief inform that edgeType has to be saved1110void requireSaveEdgeType();11111112/// @brief mark edgeType as saved1113void edgeTypeSaved();11141115/// @brief check if edgeType are saved1116bool isEdgeTypeSaved() const;11171118/// @}11191120/// @name additionals1121/// @{11221123/// @brief inform that additionals has to be saved1124void requireSaveAdditionals();11251126/// @brief mark additionals as saved1127void additionalsSaved();11281129/// @brief check if additionals are saved1130bool isAdditionalsSaved() const;11311132/// @}11331134/// @name demand elements1135/// @{11361137/// @brief inform that demand elements has to be saved1138void requireSaveDemandElements();11391140/// @brief mark demand elements as saved1141void demandElementsSaved();11421143/// @brief check if demand elements are saved1144bool isDemandElementsSaved() const;11451146/// @}11471148/// @name data elements1149/// @{11501151/// @brief inform that data elements has to be saved1152void requireSaveDataElements();11531154/// @brief mark demand elements as saved1155void dataElementsSaved();11561157/// @brief check if data elements are saved1158bool isDataElementsSaved() const;11591160/// @}11611162/// @name mean datas1163/// @{11641165/// @brief inform that mean data elements has to be saved1166void requireSaveMeanDatas();11671168/// @brief mark mean data elements as saved1169void meanDatasSaved();11701171/// @brief check if mean data elements are saved1172bool isMeanDatasSaved() const;11731174/// @}11751176/// @name function to ask if save elements before close/quit1177/// @{11781179/// @brief warns about unsaved changes in network and gives the user the option to abort1180GNEDialog::Result askSaveNetwork(bool& abortSaving) const;11811182/// @brief warns about unsaved changes in additionals and gives the user the option to abort1183GNEDialog::Result askSaveAdditionalElements(bool& abortSaving) const;11841185/// @brief warns about unsaved changes in demand elements and gives the user the option to abort1186GNEDialog::Result askSaveDemandElements(bool& abortSaving) const;11871188/// @brief warns about unsaved changes in data elements and gives the user the option to abort1189GNEDialog::Result askSaveDataElements(bool& abortSaving) const;11901191/// @brief warns about unsaved changes in meanData elements and gives the user the option to abort1192GNEDialog::Result askSaveMeanDataElements(bool& abortSaving) const;11931194/// @}11951196private:1197/// @brief pointer to net1198GNENet* myNet;11991200/// @brief flag for SumoConfigSumoConfig saved1201bool mySumoConfigSaved = true;12021203/// @brief flag for netedit config saved1204bool myNeteditConfigSaved = true;12051206/// @brief flag for network saved1207bool myNetworkSaved = true;12081209/// @brief flag for TLS saved1210bool myTLSSaved = true;12111212/// @brief flag for edgeType saved1213bool myEdgeTypeSaved = true;12141215/// @brief flag for additional elements saved1216bool myAdditionalSaved = true;12171218/// @brief flag for demand elements saved1219bool myDemandElementSaved = true;12201221/// @brief flag for data elements saved1222bool myDataElementSaved = true;12231224/// @brief flag for meanData elements saved1225bool myMeanDataElementSaved = true;12261227/// @brief invalidate default constructor1228SavingStatus() = delete;12291230/// @brief Invalidated copy constructor.1231SavingStatus(const SavingStatus&) = delete;12321233/// @brief Invalidated assignment operator.1234SavingStatus& operator=(const SavingStatus&) = delete;1235};12361237/// @brief class for GNEChange_ReplaceEdgeInTLS1238class GNEChange_ReplaceEdgeInTLS : public GNEChange {1239FXDECLARE_ABSTRACT(GNEChange_ReplaceEdgeInTLS)12401241public:1242/// @brief constructor1243GNEChange_ReplaceEdgeInTLS(NBTrafficLightLogicCont& tllcont, NBEdge* replaced, NBEdge* by);12441245/// @brief destructor1246~GNEChange_ReplaceEdgeInTLS();12471248/// @brief undo action1249void undo();12501251/// @brief redo action1252void redo();12531254/// @brief undo name1255std::string undoName() const;12561257/// @brief get Redo name1258std::string redoName() const;12591260/// @brief wether original and new value differ1261bool trueChange();12621263private:1264/// @brief container for traffic light logic1265NBTrafficLightLogicCont& myTllcont;12661267/// @brief replaced NBEdge1268NBEdge* myReplaced;12691270/// @brief replaced by NBEdge1271NBEdge* myBy;1272};1273};127412751276