/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2026 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 FileBucket;56class GNEJunction;57class GNELane;58class GNELaneType;59class GNEMeanData;60class GNENet;61class GNENetworkElement;62class GNEPOI;63class GNEPoly;64class GNEUndoList;65class GNEViewNet;66class GNEWalkingArea;67class NBNetBuilder;6869// ===========================================================================70// class definitions71// ===========================================================================7273struct GNENetHelper {7475/// @brief struct used for saving all attribute carriers of net, in different formats76class AttributeCarriers {7778/// @brief declare friend class79friend class GNEAdditionalHandler;80friend class GNEChange_Additional;81friend class GNEChange_DataInterval;82friend class GNEChange_DataSet;83friend class GNEChange_DemandElement;84friend class GNEChange_Edge;85friend class GNEChange_EdgeType;86friend class GNEChange_GenericData;87friend class GNEChange_Junction;88friend class GNEChange_MeanData;89friend class GNEChange_Shape;90friend class GNEChange_TAZElement;91friend class GNEChange_TAZSourceSink;92friend class GNEDataHandler;93friend class GNEDataInterval;94friend class GNEDataSet;95friend class GNEDistributionRefDialog;96friend class GNEEdge;97friend class GNEJunction;98friend class GNEMeanDataHandler;99friend class GNERouteHandler;100friend class GNETLSEditorFrame;101102public:103/// @brief constructor104AttributeCarriers(GNENet* net);105106/// @brief destructor107~AttributeCarriers();108109/// @brief remap junction and edge IDs110void remapJunctionAndEdgeIds();111112/// @brief check if shape of given AC (network element) is around the given triangle113bool isNetworkElementAroundTriangle(GNEAttributeCarrier* AC, const Triangle& triangle) const;114115/// @brief functions related with number of elements sorted by categories116/// @{117/// @brief get number of current network elements saved in AttributeCarriers118int getNumberOfNetworkElements() const;119120/// @brief get number of current demand elements saved in AttributeCarriers (default vTypes are NOT included)121int getNumberOfDemandElements() const;122123/// @brief get number of current data elements saved in AttributeCarriers124int getNumberOfDataElements() const;125126/// @}127128/// @name function for attribute carriers129/// @{130131/**@brief get a single attribute carrier based on a GLID132* @param[in] ids the GL IDs for which to retrieve the AC133* @param[in] hardFail Whether attempts to retrieve a nonexisting AttributeCarrier should result in an exception134* @throws InvalidArgument if GL ID doesn't have a associated Attribute Carrier135*/136GNEAttributeCarrier* retrieveAttributeCarrier(const GUIGlID id, bool hardFail = true) const;137138/**@brief get the attribute carriers based on Type139* @param[in] type The GUI-type of the AC. SUMO_TAG_NOTHING returns all elements (Warning: bottleneck)140* @note tag could not exist141*/142std::vector<GNEAttributeCarrier*> retrieveAttributeCarriers(SumoXMLTag tag = SUMO_TAG_NOTHING);143144/// @brief get the attribute carriers based on supermode and selected145std::vector<GNEAttributeCarrier*> retrieveAttributeCarriers(Supermode supermode, const bool onlySelected);146147/// @brief get all selected attribute carriers (or only relative to current supermode148std::vector<GNEAttributeCarrier*> getSelectedAttributeCarriers(const bool ignoreCurrentSupermode);149150/// @}151152/// @name function for junctions153/// @{154/**@brief get junction by id155* @param[in] id The id of the desired junction156* @param[in] hardFail Whether attempts to retrieve a nonexisting junction should result in an exception157* @throws UnknownElement158*/159GNEJunction* retrieveJunction(const std::string& id, bool hardFail = true) const;160161/// @brief get junctions162const std::map<std::string, GNEJunction*>& getJunctions() const;163164/// @brief return selected junctions165std::vector<GNEJunction*> getSelectedJunctions() const;166167/// @brief registers a junction in containers168GNEJunction* registerJunction(GNEJunction* junction);169170/// @brief clear junctions171void clearJunctions();172173/// @brief add prefix to all junctions174void addPrefixToJunctions(const std::string& prefix);175176/// @brief update junction ID in container177void updateJunctionID(GNEJunction* junction, const std::string& newID);178179/// @brief get number of selected junctions180int getNumberOfSelectedJunctions() const;181182/// @}183184/// @name function for crossings185/// @{186/**@brief get Crossing by AC187* @param[in] glObject The GUIGlObject associated with the element188* @param[in] hardFail Whether attempts to retrieve a nonexisting Crossing should result in an exception189* @throws UnknownElement190*/191GNECrossing* retrieveCrossing(const GUIGlObject* glObject, bool hardFail = true) const;192193/// @brief get crossings194const std::unordered_map<const GUIGlObject*, GNECrossing*>& getCrossings() const;195196/// @brief return all selected crossings197std::vector<GNECrossing*> getSelectedCrossings() const;198199/// @brief get number of selected crossings200int getNumberOfSelectedCrossings() const;201202/// @}203204/// @name function for walkingAreas205/// @{206/**@brief get WalkingArea by GlObject207* @param[in] glObject The GUIGlObject associated with the element208* @param[in] hardFail Whether attempts to retrieve a nonexisting WalkingArea should result in an exception209* @throws UnknownElement210*/211GNEWalkingArea* retrieveWalkingArea(const GUIGlObject* glObject, bool hardFail = true) const;212213/// @brief get walkingAreas214const std::unordered_map<const GUIGlObject*, GNEWalkingArea*>& getWalkingAreas() const;215216/// @brief return all selected walkingAreas217std::vector<GNEWalkingArea*> getSelectedWalkingAreas() const;218219/// @brief get number of selected walkingAreas220int getNumberOfSelectedWalkingAreas() const;221222/// @}223224/// @name function for edgeTypes225/// @{226/**@brief get edge type by id227* @param[in] id The id of the desired edge type228* @param[in] hardFail Whether attempts to retrieve a nonexisting edge type should result in an exception229* @throws UnknownElement230*/231GNEEdgeType* retrieveEdgeType(const std::string& id, bool hardFail = true) const;232233/// @brief registers a edge in containers234GNEEdgeType* registerEdgeType(GNEEdgeType* edgeType);235236/// @brief map with the ID and pointer to edgeTypes of net237const std::map<std::string, GNEEdgeType*>& getEdgeTypes() const;238239/// @brief clear edgeTypes240void clearEdgeTypes();241242/// @brief update edgeType ID in container243void updateEdgeTypeID(GNEEdgeType* edgeType, const std::string& newID);244245/// @brief generate edgeType id246std::string generateEdgeTypeID() const;247248/// @}249250/// @name function for edges251/// @{252/**@brief get edge by id253* @param[in] id The id of the desired edge254* @param[in] hardFail Whether attempts to retrieve a nonexisting edge should result in an exception255* @throws UnknownElement256*/257GNEEdge* retrieveEdge(const std::string& id, bool hardFail = true) const;258259/**@brief get all edges by from and to GNEJunction260* @param[in] id The id of the desired edge261* @param[in] hardFail Whether attempts to retrieve a nonexisting edge should result in an exception262* @throws UnknownElement263*/264std::vector<GNEEdge*> retrieveEdges(GNEJunction* from, GNEJunction* to) const;265266/// @brief map with the ID and pointer to edges of net267const std::map<std::string, GNEEdge*>& getEdges() const;268269/**@brief return all edges270* @param[in] onlySelected Whether to return only selected edges271*/272std::vector<GNEEdge*> getSelectedEdges() const;273274/// @brief registers an edge with containers275GNEEdge* registerEdge(GNEEdge* edge);276277/// @brief clear edges278void clearEdges();279280/// @brief add prefix to all edges281void addPrefixToEdges(const std::string& prefix);282283/// @brief generate edge ID284std::string generateEdgeID() const;285286/// @brief update edge ID in container287void updateEdgeID(GNEEdge* edge, const std::string& newID);288289/// @brief get number of selected edges290int getNumberOfSelectedEdges() const;291292/// @}293294/// @name function for lanes295/// @{296/**@brief get lane by id297* @param[in] id The id of the desired lane298* @param[in] hardFail Whether attempts to retrieve a nonexisting lane should result in an exception299* @param[in] checkVolatileChange Used by additionals after recomputing with volatile options.300* @throws UnknownElement301*/302GNELane* retrieveLane(const std::string& id, bool hardFail = true, bool checkVolatileChange = false) const;303304/**@brief get Lane by GlObject305* @param[in] glObject The GUIGlObject associated with the element306* @param[in] hardFail Whether attempts to retrieve a nonexisting Lane should result in an exception307* @throws UnknownElement308*/309GNELane* retrieveLane(const GUIGlObject* glObject, bool hardFail = true) const;310311/// @brief get lanes312const std::unordered_map<const GUIGlObject*, GNELane*>& getLanes() const;313314/// @brief get selected lanes315std::vector<GNELane*> getSelectedLanes() const;316317/// @brief get number of selected lanes318int getNumberOfSelectedLanes() const;319320/// @}321322/// @name function for connections323/// @{324/**@brief get Connection by id325* @param[in] id The id of the desired Connection326* @param[in] hardFail Whether attempts to retrieve a nonexisting Connection should result in an exception327* @throws UnknownElement328*/329GNEConnection* retrieveConnection(const std::string& id, bool hardFail = true) const;330331/**@brief get Connection by GUIGlObject332* @param[in] glObject The GUIGlObject associated with the element333* @param[in] hardFail Whether attempts to retrieve a nonexisting Connection should result in an exception334* @throws UnknownElement335*/336GNEConnection* retrieveConnection(const GUIGlObject* glObject, bool hardFail = true) const;337338/// @brief get connections339const std::unordered_map<const GUIGlObject*, GNEConnection*>& getConnections() const;340341/// @brief get selected connections342std::vector<GNEConnection*> getSelectedConnections() const;343344/// @brief get number of selected connections345int getNumberOfSelectedConnections() const;346347/// @}348349/// @name function for internalLanes350/// @{351352/**@brief get InternalLane by GUIGlObject353* @param[in] glObject The GUIGlObject associated with the element354* @param[in] hardFail Whether attempts to retrieve a nonexisting InternalLane should result in an exception355* @throws UnknownElement356*/357GNEInternalLane* retrieveInternalLane(const GUIGlObject* glObject, bool hardFail = true) const;358359/// @}360361/// @name function for additionals362/// @{363/**@brief Returns the named additional364* @param[in] id The attribute carrier related with the additional element365* @param[in] type tag with the type of additional366* @param[in] id The id of the additional to return.367* @param[in] hardFail Whether attempts to retrieve a nonexisting additional should result in an exception368*/369GNEAdditional* retrieveAdditional(SumoXMLTag type, const std::string& id, bool hardFail = true) const;370371/**@brief Returns the named additional372* @param[in] id The attribute carrier related with the additional element373* @param[in] types tags with the type of additional374* @param[in] id The id of the additional to return.375* @param[in] hardFail Whether attempts to retrieve a nonexisting additional should result in an exception376*/377GNEAdditional* retrieveAdditionals(const std::vector<SumoXMLTag> types, const std::string& id, bool hardFail = true) const;378379/**@brief Returns the named additional380* @param[in] glObject The GUIGlObject associated with the element381* @param[in] hardFail Whether attempts to retrieve a nonexisting additional should result in an exception382*/383GNEAdditional* retrieveAdditional(const GUIGlObject* glObject, bool hardFail = true) const;384385/**@brief Returns the rerouter interval defined by given begin and end386* @param[in] rerouter ID387* @param[in] begin SUMOTime begin388* @param[in] end SUMOTime begin389*/390GNEAdditional* retrieveRerouterInterval(const std::string& rerouterID, const SUMOTime begin, const SUMOTime end) const;391392/// @brief get additionals393const std::unordered_map<SumoXMLTag, std::unordered_map<const GUIGlObject*, GNEAdditional*>, std::hash<int> >& getAdditionals() const;394395/// @brief get selected additionals396std::vector<GNEAdditional*> getSelectedAdditionals() const;397398/// @brief get selected shapes399std::vector<GNEAdditional*> getSelectedShapes() const;400401/// @brief get number of additionals402int getNumberOfAdditionals() const;403404/// @brief clear additionals405void clearAdditionals();406407/// @brief update additional ID in container408void updateAdditionalID(GNEAdditional* additional, const std::string& newID);409410/// @brief generate additional id411std::string generateAdditionalID(SumoXMLTag type) const;412413/// @brief get number of selected additionals (Including POIs, Polygons, TAZs and Wires)414int getNumberOfSelectedAdditionals() const;415416/// @brief get number of selected pure additionals (Except POIs, Polygons, TAZs and Wires)417int getNumberOfSelectedPureAdditionals() const;418419/// @brief get number of selected polygons420int getNumberOfSelectedPolygons() const;421422/// @brief get number of selected walkable areas423int getNumberOfSelectedJpsWalkableAreas() const;424425/// @brief get number of selected obstacles426int getNumberOfSelectedJpsObstacles() const;427428/// @brief get number of selected POIs429int getNumberOfSelectedPOIs() const;430431/// @brief get number of selected TAZs432int getNumberOfSelectedTAZs() const;433434/// @brief get number of selected Wires435int getNumberOfSelectedWires() const;436437/// @brief return list of available POI parameters438std::vector<std::string> getPOIParamKeys() const;439/// @}440441/// @name function for TAZ sourceSinks442/// @{443/**@brief Returns the named sourceSink444* @param[in] sourceSink The GNETAZSourceSink to retrieve445* @param[in] hardFail Whether attempts to retrieve a nonexisting sourceSink should result in an exception446*/447GNETAZSourceSink* retrieveTAZSourceSink(const GNEAttributeCarrier* sourceSink, bool hardFail = true) const;448449/// @brief get sourceSinks450const std::unordered_map<SumoXMLTag, std::unordered_map<const GNEAttributeCarrier*, GNETAZSourceSink*>, std::hash<int> >& getTAZSourceSinks() const;451452/// @brief get number of TAZSourceSinks453int getNumberOfTAZSourceSinks() const;454455/// @brief clear sourceSinks456void clearTAZSourceSinks();457458/// @}459460/// @name function for demand elements461/// @{462/**@brief Returns the named demand element463* @param[in] type tag with the type of demand element464* @param[in] id The id of the demand element to return.465* @param[in] hardFail Whether attempts to retrieve a nonexisting demand element should result in an exception466*/467GNEDemandElement* retrieveDemandElement(SumoXMLTag type, const std::string& id, bool hardFail = true) const;468469/**@brief Returns the named demand element470* @param[in] types tag with the type of demand element471* @param[in] id The id of the demand element to return.472* @param[in] hardFail Whether attempts to retrieve a nonexisting demand element should result in an exception473*/474GNEDemandElement* retrieveDemandElements(const std::vector<SumoXMLTag> types, const std::string& id, bool hardFail = true) const;475476/**@brief Returns the named demand477* @param[in] glObject The GUIGlObject associated with the element478* @param[in] hardFail Whether attempts to retrieve a nonexisting demand should result in an exception479*/480GNEDemandElement* retrieveDemandElement(const GUIGlObject* glObject, bool hardFail = true) const;481482/// @brief get selected demand elements483std::vector<GNEDemandElement*> getSelectedDemandElements() const;484485/// @brief get demand elements486const std::unordered_map<SumoXMLTag, std::unordered_map<const GUIGlObject*, GNEDemandElement*>, std::hash<int> >& getDemandElements() const;487488/// @brief generate demand element id489std::string generateDemandElementID(SumoXMLTag tag) const;490491/// @brief get default type492GNEDemandElement* getDefaultType() const;493494/// @brief clear demand elements495void clearDemandElements();496497/// @brief update demand element ID in container498void updateDemandElementID(GNEDemandElement* demandElement, const std::string& newID);499500/// @brief add default VTypes501void addDefaultVTypes();502503/// @brief check if we have elements that requires the option junction-taz504bool requireJunctionTazOption() const;505506/// @brief get (and update) stop index507int getStopIndex();508509/// @brief get number of selected demand elements510int getNumberOfSelectedDemandElements() const;511512/// @brief get number of selected routes513int getNumberOfSelectedRoutes() const;514515/// @brief get number of selected vehicles516int getNumberOfSelectedVehicles() const;517518/// @brief get number of selected persons519int getNumberOfSelectedPersons() const;520521/// @brief get number of selected person trips522int getNumberOfSelectedPersonTrips() const;523524/// @brief get number of selected walks525int getNumberOfSelectedWalks() const;526527/// @brief get number of selected rides528int getNumberOfSelectedRides() const;529530/// @brief get number of selected containers531int getNumberOfSelectedContainers() const;532533/// @brief get number of selected transports534int getNumberOfSelectedTransport() const;535536/// @brief get number of selected tranships537int getNumberOfSelectedTranships() const;538539/// @brief get number of selected stops540int getNumberOfSelectedStops() const;541542/// @}543544/// @name function for data sets545/// @{546/**@brief Returns the named data set547* @param[in] id The id of the data set to return.548* @param[in] hardFail Whether attempts to retrieve a nonexisting data set should result in an exception549*/550GNEDataSet* retrieveDataSet(const std::string& id, bool hardFail = true) const;551552/// @brief get demand elements553const std::map<const std::string, GNEDataSet*>& getDataSets() const;554555/// @brief generate data set id556std::string generateDataSetID() const;557558/// @}559560/// @name function for data intervals561/// @{562/**@brief Returns the data interval563* @param[in] id The attribute carrier related with the dataInterval element564* @param[in] hardFail Whether attempts to retrieve a nonexisting data set should result in an exception565*/566GNEDataInterval* retrieveDataInterval(const GNEAttributeCarrier* AC, bool hardFail = true) const;567568/// @brief get all data intervals of network569const std::unordered_map<const GNEAttributeCarrier*, GNEDataInterval*>& getDataIntervals() const;570571/// @}572573/// @name function for generic datas574/// @{575/**@brief Returns the generic data576* @param[in] id The attribute carrier related with the genericData element577* @param[in] hardFail Whether attempts to retrieve a nonexisting data set should result in an exception578*/579GNEGenericData* retrieveGenericData(const GUIGlObject* glObject, bool hardFail = true) const;580581/// @brief get selected generic datas582std::vector<GNEGenericData*> getSelectedGenericDatas() const;583584/// @brief get all generic datas585const std::unordered_map<SumoXMLTag, std::unordered_map<const GUIGlObject*, GNEGenericData*>, std::hash<int> >& getGenericDatas() const;586587/// @brief retrieve generic datas within the given interval588std::vector<GNEGenericData*> retrieveGenericDatas(const SumoXMLTag genericDataTag, const double begin, const double end);589590/// @brief Return the number of generic datas591int getNumberOfGenericDatas() const;592593/// @brief get number of selected edge datas594int getNumberOfSelectedEdgeDatas() const;595596/// @brief get number of selected edge rel datas597int getNumberOfSelectedEdgeRelDatas() const;598599/// @brief get number of selected edge TAZ Rels600int getNumberOfSelectedEdgeTAZRel() const;601602/// @brief return a set of parameters for the given data Interval603std::set<std::string> retrieveGenericDataParameters(const std::string& genericDataTag, const double begin, const double end) const;604605/// @brief return a set of parameters for the given dataSet, generic data Type, begin and end606std::set<std::string> retrieveGenericDataParameters(const std::string& dataSetID, const std::string& genericDataTag,607const std::string& beginStr, const std::string& endStr) const;608609/// @}610611/// @name function for meanDatas612/// @{613/**@brief Returns the named meanData614* @param[in] id The attribute carrier related with the meanData element615* @param[in] type tag with the type of meanData616* @param[in] id The id of the meanData to return.617* @param[in] hardFail Whether attempts to retrieve a nonexisting meanData should result in an exception618*/619GNEMeanData* retrieveMeanData(SumoXMLTag type, const std::string& id, bool hardFail = true) const;620621/// @brief get meanDatas622const std::unordered_map<SumoXMLTag, std::map<const std::string, GNEMeanData*>, std::hash<int> >& getMeanDatas() const;623624/// @brief get number of meanDatas625int getNumberOfMeanDatas() const;626627/// @brief clear meanDatas628void clearMeanDatas();629630/// @brief update meanData ID in container631void updateMeanDataID(GNEMeanData* meanData, const std::string& newID);632633/// @brief generate meanData id634std::string generateMeanDataID(SumoXMLTag type) const;635636/// @}637638protected:639/// @name Junctions protected functions640/// @{641642/// @brief insert junction in container643void insertJunction(GNEJunction* junction);644645/// @brief delete junction from container646void deleteSingleJunction(GNEJunction* junction);647648/// @}649650/// @name edge types protected functions651/// @{652653/// @brief insert edge type in container654void insertEdgeType(GNEEdgeType* edgeType);655656/// @brief delete edge type from container657void deleteEdgeType(GNEEdgeType* edgeType);658659/// @}660661/// @name edges protected functions662/// @{663/// @brief insert edge in container664void insertEdge(GNEEdge* edge);665666/// @brief delete edge from container667void deleteSingleEdge(GNEEdge* edge);668669/// @}670671/// @name lane protected functions672/// @{673674/// @brief insert lane in container675void insertLane(GNELane* lane);676677/// @brief delete lane from container678void deleteLane(GNELane* lane);679680/// @}681682/// @name crossing protected functions683/// @{684685/// @brief insert crossing in container686void insertCrossing(GNECrossing* crossing);687688/// @brief delete crossing from container689void deleteCrossing(GNECrossing* crossing);690691/// @}692693/// @name walking areas protected functions694/// @{695696/// @brief insert walkingArea in container697void insertWalkingArea(GNEWalkingArea* walkingArea);698699/// @brief delete walkingArea from container700void deleteWalkingArea(GNEWalkingArea* walkingArea);701702/// @}703704/// @name connection protected functions705/// @{706707/// @brief insert connection in container708void insertConnection(GNEConnection* connection);709710/// @brief delete connection from container711void deleteConnection(GNEConnection* connection);712713/// @}714715/// @name internalLane protected functions716/// @{717718/// @brief insert internalLane in container719void insertInternalLane(GNEInternalLane* internalLane);720721/// @brief delete internalLane from container722void deleteInternalLane(GNEInternalLane* internalLane);723724/// @}725726/// @name additionals protected functions727/// @{728729/// @brief Insert a additional element in container.730void insertAdditional(GNEAdditional* additional);731732/// @brief delete additional element of container733void deleteAdditional(GNEAdditional* additional);734735/// @}736737/// @name TAZ Source Sinks protected functions738/// @{739740/// @brief Insert a sourceSink element in container.741void insertTAZSourceSink(GNETAZSourceSink* sourceSink);742743/// @brief delete sourceSink element of container744void deleteTAZSourceSink(GNETAZSourceSink* sourceSink);745746/// @}747748/// @name demand elements protected functions749/// @{750751/// @brief Insert a demand element in container.752void insertDemandElement(GNEDemandElement* demandElement);753754/// @brief delete demand element of container755void deleteDemandElement(GNEDemandElement* demandElement, const bool updateFrames);756757/// @}758759/// @name datas protected functions760/// @{761762/// @brief Insert a data set in container.763void insertDataSet(GNEDataSet* dataSet);764765/// @brief delete data set of container766void deleteDataSet(GNEDataSet* dataSet);767768/// @}769770/// @name data intervals protected functions771/// @{772773/// @brief insert data interval in container774void insertDataInterval(const GNEAttributeCarrier* AC, GNEDataInterval* dataInterval);775776/// @brief delete data interval of container777void deleteDataInterval(GNEDataInterval* dataInterval);778779/// @}780781/// @name generic datas protected functions782/// @{783784/// @brief insert generic data in container785void insertGenericData(GNEGenericData* genericData);786787/// @brief delete generic data of container788void deleteGenericData(GNEGenericData* genericData);789790/// @}791792/// @name Insertion and erasing of GNEMeanDatas items793/// @{794795/// @brief Insert a meanData element in container.796void insertMeanData(GNEMeanData* meanData);797798/// @brief delete meanData element of container799void deleteMeanData(GNEMeanData* meanData);800801/// @}802803/// @brief update demand element frames (called after insert/delete demand element)804void updateDemandElementFrames(const GNETagProperties* tagProperty);805806/// @brief retrieve attribute carriers recursively807void retrieveAttributeCarriersRecursively(const GNETagProperties* tag, std::vector<GNEAttributeCarrier*>& ACs);808809private:810/// @brief pointer to net811GNENet* myNet;812813/// @brief stop index814int myStopIndex;815816/// @brief number of network elemements inserted in AttributeCarriers817int myNumberOfNetworkElements = 0;818819/// @brief number of demand elemements inserted in AttributeCarriers (excluding default vTypes)820int myNumberOfDemandElements = 0;821822/// @brief number of data elemements inserted in AttributeCarriers823int myNumberOfDataElements = 0;824825/// @brief number of mean data elemements inserted in AttributeCarriers826int myNumberOfMeanDataElements = 0;827828/// @brief map with the ID and pointer to junctions of net829std::map<std::string, GNEJunction*> myJunctions;830831/// @brief set with crossings832std::unordered_map<const GUIGlObject*, GNECrossing*> myCrossings;833834/// @brief set with walkingAreas835std::unordered_map<const GUIGlObject*, GNEWalkingArea*> myWalkingAreas;836837/// @brief map with the ID and pointer to edgeTypes of net838std::map<std::string, GNEEdgeType*> myEdgeTypes;839840/// @brief map with the ID and pointer to edges of net841std::map<std::string, GNEEdge*> myEdges;842843/// @brief map with lanes844std::unordered_map<const GUIGlObject*, GNELane*> myLanes;845846/// @brief map with connetions847std::unordered_map<const GUIGlObject*, GNEConnection*> myConnections;848849/// @brief map with internal lanes850std::unordered_map<const GUIGlObject*, GNEInternalLane*> myInternalLanes;851852/// @brief map with the tag and pointer to additional elements of net, sorted by IDs853std::unordered_map<SumoXMLTag, std::map<const std::string, GNEAdditional*>, std::hash<int> > myAdditionalIDs;854855/// @brief map with the tag and pointer to additional elements of net856std::unordered_map<SumoXMLTag, std::unordered_map<const GUIGlObject*, GNEAdditional*>, std::hash<int> > myAdditionals;857858/// @brief map with the tag and pointer to TAZSourceSinks elements of net859std::unordered_map<SumoXMLTag, std::unordered_map<const GNEAttributeCarrier*, GNETAZSourceSink*>, std::hash<int> > myTAZSourceSinks;860861/// @brief map with the tag and pointer to demand elements of net, sorted by IDs862std::unordered_map<SumoXMLTag, std::map<const std::string, GNEDemandElement*>, std::hash<int> > myDemandElementIDs;863864/// @brief map with the tag and pointer to demand elements elements of net865std::unordered_map<SumoXMLTag, std::unordered_map<const GUIGlObject*, GNEDemandElement*>, std::hash<int> > myDemandElements;866867/// @brief map with the ID and pointer to all datasets of net868std::map<const std::string, GNEDataSet*> myDataSets;869870/// @brief map with all data intervals of network871std::unordered_map<const GNEAttributeCarrier*, GNEDataInterval*> myDataIntervals;872873/// @brief map with the tag and pointer to all generic datas874std::unordered_map<SumoXMLTag, std::unordered_map<const GUIGlObject*, GNEGenericData*>, std::hash<int> > myGenericDatas;875876/// @brief map with the tag and pointer to meanData elements of net877std::unordered_map<SumoXMLTag, std::map<const std::string, GNEMeanData*>, std::hash<int> > myMeanDatas;878879/// @brief Invalidated default constructor.880AttributeCarriers() = delete;881882/// @brief Invalidated copy constructor.883AttributeCarriers(const AttributeCarriers&) = delete;884885/// @brief Invalidated assignment operator.886AttributeCarriers& operator=(const AttributeCarriers&) = delete;887};888889/// @brief modul for AC Templates890class ACTemplate {891892public:893/// @brief constructor894ACTemplate(GNENet* net);895896/// @brief build templates897void buildTemplates();898899/// @brief destructor900~ACTemplate();901902/// @brief get all AC templates903std::map<SumoXMLTag, GNEAttributeCarrier*> getACTemplates() const;904905/// @brief get template AC by tag906GNEAttributeCarrier* getTemplateAC(const SumoXMLTag tag) const;907908/// @brief get template AC by text (using selector text909GNEAttributeCarrier* getTemplateAC(const std::string& selectorText) const;910911/// @brief get default edge type912GNEEdgeType* getDefaultEdgeType() const;913914/// @brief get plan templates915const std::vector<std::pair<GNETagProperties*, GNEDemandElement*> >& getPlanTemplates(SumoXMLTag tag) const;916917protected:918/// @brief fill plan templates919void fillPlanTemplates();920921private:922/// @brief pointer to net923GNENet* myNet = nullptr;924925/// @brief map with templates926std::map<SumoXMLTag, GNEAttributeCarrier*> myTemplates;927928/// @brief list with demand templates929std::map<SumoXMLTag, std::vector<std::pair<GNETagProperties*, GNEDemandElement*> > > myPlanTemplates;930931/// @brief edge type932GNEEdgeType* myEdgeType = nullptr;933934/// @brief Invalidated default constructor.935ACTemplate() = delete;936937/// @brief Invalidated copy constructor.938ACTemplate(const ACTemplate&) = delete;939940/// @brief Invalidated assignment operator941ACTemplate& operator=(const ACTemplate& src) = delete;942};943944/// @brief modul for Saving status945class SavingStatus {946947public:948/// @brief constructor949SavingStatus(GNENet* net);950951/// @name SumoConfig952/// @{953954/// @brief inform that SumoConfig has to be saved955void requireSaveSumoConfig();956957/// @brief mark SumoConfig as saved958void SumoConfigSaved();959960/// @brief check if SumoConfig is saved961bool isSumoConfigSaved() const;962963/// @}964965/// @name NeteditConfig966/// @{967968/// @brief inform that netedit config has to be saved969void requireSaveNeteditConfig();970971/// @brief mark netedit config as saved972void neteditConfigSaved();973974/// @brief check if netedit config is saved975bool isNeteditConfigSaved() const;976977/// @}978979/// @name network980/// @{981982/// @brief inform that network has to be saved983void requireSaveNetwork();984985/// @brief mark network as saved986void networkSaved();987988/// @brief check if network is saved989bool isNetworkSaved() const;990991/// @}992993/// @name TLS994/// @{995996/// @brief inform that TLS has to be saved997void requireSaveTLS();998999/// @brief mark TLS as saved1000void TLSSaved();10011002/// @brief check if TLS are saved1003bool isTLSSaved() const;10041005/// @}10061007/// @name edge types1008/// @{10091010/// @brief inform that edgeType has to be saved1011void requireSaveEdgeType();10121013/// @brief mark edgeType as saved1014void edgeTypeSaved();10151016/// @brief check if edgeType are saved1017bool isEdgeTypeSaved() const;10181019/// @}10201021/// @name additionals1022/// @{10231024/// @brief inform that additionals has to be saved1025void requireSaveAdditionals();10261027/// @brief mark additionals as saved1028void additionalsSaved();10291030/// @brief check if additionals are saved1031bool isAdditionalsSaved() const;10321033/// @}10341035/// @name demand elements1036/// @{10371038/// @brief inform that demand elements has to be saved1039void requireSaveDemandElements();10401041/// @brief mark demand elements as saved1042void demandElementsSaved();10431044/// @brief check if demand elements are saved1045bool isDemandElementsSaved() const;10461047/// @}10481049/// @name data elements1050/// @{10511052/// @brief inform that data elements has to be saved1053void requireSaveDataElements();10541055/// @brief mark demand elements as saved1056void dataElementsSaved();10571058/// @brief check if data elements are saved1059bool isDataElementsSaved() const;10601061/// @}10621063/// @name mean datas1064/// @{10651066/// @brief inform that mean data elements has to be saved1067void requireSaveMeanDatas();10681069/// @brief mark mean data elements as saved1070void meanDatasSaved();10711072/// @brief check if mean data elements are saved1073bool isMeanDatasSaved() const;10741075/// @}10761077/// @name function to ask if save elements before close/quit1078/// @{10791080/// @brief warns about unsaved changes in network and gives the user the option to abort1081GNEDialog::Result askSaveNetwork(GNEDialog::Result& commonResult) const;10821083/// @brief warns about unsaved changes in additionals and gives the user the option to abort1084GNEDialog::Result askSaveAdditionalElements(GNEDialog::Result& commonResult) const;10851086/// @brief warns about unsaved changes in demand elements and gives the user the option to abort1087GNEDialog::Result askSaveDemandElements(GNEDialog::Result& commonResult) const;10881089/// @brief warns about unsaved changes in data elements and gives the user the option to abort1090GNEDialog::Result askSaveDataElements(GNEDialog::Result& commonResult) const;10911092/// @brief warns about unsaved changes in meanData elements and gives the user the option to abort1093GNEDialog::Result askSaveMeanDataElements(GNEDialog::Result& commonResult) const;10941095/// @}10961097private:1098/// @brief pointer to net1099GNENet* myNet;11001101/// @brief flag for SumoConfigSumoConfig saved1102bool mySumoConfigSaved = true;11031104/// @brief flag for netedit config saved1105bool myNeteditConfigSaved = true;11061107/// @brief flag for network saved1108bool myNetworkSaved = true;11091110/// @brief flag for TLS saved1111bool myTLSSaved = true;11121113/// @brief flag for edgeType saved1114bool myEdgeTypeSaved = true;11151116/// @brief flag for additional elements saved1117bool myAdditionalSaved = true;11181119/// @brief flag for demand elements saved1120bool myDemandElementSaved = true;11211122/// @brief flag for data elements saved1123bool myDataElementSaved = true;11241125/// @brief flag for meanData elements saved1126bool myMeanDataElementSaved = true;11271128/// @brief invalidate default constructor1129SavingStatus() = delete;11301131/// @brief Invalidated copy constructor.1132SavingStatus(const SavingStatus&) = delete;11331134/// @brief Invalidated assignment operator.1135SavingStatus& operator=(const SavingStatus&) = delete;1136};11371138/// @brief class for GNEChange_ReplaceEdgeInTLS1139class GNEChange_ReplaceEdgeInTLS : public GNEChange {1140FXDECLARE_ABSTRACT(GNEChange_ReplaceEdgeInTLS)11411142public:1143/// @brief constructor1144GNEChange_ReplaceEdgeInTLS(NBTrafficLightLogicCont& tllcont, NBEdge* replaced, NBEdge* by);11451146/// @brief destructor1147~GNEChange_ReplaceEdgeInTLS();11481149/// @brief undo action1150void undo();11511152/// @brief redo action1153void redo();11541155/// @brief undo name1156std::string undoName() const;11571158/// @brief get Redo name1159std::string redoName() const;11601161/// @brief wether original and new value differ1162bool trueChange();11631164private:1165/// @brief container for traffic light logic1166NBTrafficLightLogicCont& myTllcont;11671168/// @brief replaced NBEdge1169NBEdge* myReplaced;11701171/// @brief replaced by NBEdge1172NBEdge* myBy;1173};1174};117511761177