From 67058e7c3cb71449077a117c1bbceeb2d446bf65 Mon Sep 17 00:00:00 2001 From: Pablo Alvarez Lopez Date: Wed, 5 Feb 2025 13:52:08 +0100 Subject: [PATCH] make some pointer constants. Refs #15834 --- src/netedit/GNEApplicationWindow.cpp | 4 +-- src/netedit/GNEApplicationWindow.h | 6 ++-- src/netedit/GNENet.cpp | 31 ++++++++++++------- src/netedit/GNENet.h | 8 ++++- src/netedit/GNENetHelper.cpp | 24 +++++++------- src/netedit/GNENetHelper.h | 3 +- src/netedit/GNETagPropertiesDatabase.cpp | 8 ++--- src/netedit/GNETagPropertiesDatabase.h | 8 ++--- src/netedit/GNEViewNet.cpp | 6 ---- src/netedit/GNEViewNet.h | 3 -- src/netedit/GNEViewParent.cpp | 2 +- src/netedit/elements/GNEAttributeCarrier.cpp | 2 +- .../elements/demand/GNERouteHandler.cpp | 4 +-- src/netedit/elements/network/GNEEdge.cpp | 2 +- src/netedit/frames/GNEAttributesEditor.cpp | 8 ++--- src/netedit/frames/GNEDemandSelector.cpp | 2 +- src/netedit/frames/GNESelectorParent.cpp | 2 +- src/netedit/frames/GNETagSelector.cpp | 2 +- .../frames/common/GNEMatchAttribute.cpp | 8 ++--- .../common/GNEMatchGenericDataAttribute.cpp | 4 +-- .../frames/common/GNESelectorFrame.cpp | 2 +- .../frames/data/GNEGenericDataFrame.cpp | 4 +-- src/netedit/frames/data/GNEMeanDataFrame.cpp | 6 ++-- src/netedit/frames/demand/GNETypeFrame.cpp | 2 +- .../frames/network/GNECrossingFrame.cpp | 2 +- src/netedit/netedit_main.cpp | 2 +- 26 files changed, 79 insertions(+), 76 deletions(-) diff --git a/src/netedit/GNEApplicationWindow.cpp b/src/netedit/GNEApplicationWindow.cpp index 5440c5063dc..f384f2ecbcb 100644 --- a/src/netedit/GNEApplicationWindow.cpp +++ b/src/netedit/GNEApplicationWindow.cpp @@ -453,7 +453,7 @@ FXIMPLEMENT(GNEApplicationWindow, FXMainWindow, GNEApplicationWindowMap, ARRAYNU // GNEApplicationWindow method definitions // =========================================================================== -GNEApplicationWindow::GNEApplicationWindow(FXApp* app, GNETagPropertiesDatabase* tagPropertiesDatabase, const std::string& configPattern) : +GNEApplicationWindow::GNEApplicationWindow(FXApp* app, const GNETagPropertiesDatabase* tagPropertiesDatabase, const std::string& configPattern) : GUIMainWindow(app), myTagPropertiesDatabase(tagPropertiesDatabase), myUndoList(new GNEUndoList(this)), @@ -1505,7 +1505,7 @@ GNEApplicationWindow::getTrackerInterval() const { } -GNETagPropertiesDatabase* +const GNETagPropertiesDatabase* GNEApplicationWindow::getTagPropertiesDatabase() const { return myTagPropertiesDatabase; } diff --git a/src/netedit/GNEApplicationWindow.h b/src/netedit/GNEApplicationWindow.h index 5ad3dc1cfe6..d8ede4e70c4 100644 --- a/src/netedit/GNEApplicationWindow.h +++ b/src/netedit/GNEApplicationWindow.h @@ -47,7 +47,7 @@ class GNEApplicationWindow : public GUIMainWindow, public MFXInterThreadEventCli * @param[in] tagPropertiesDatabase pointer to tag properties database * @param[in] configPattern The pattern used for loading configurations */ - GNEApplicationWindow(FXApp* app, GNETagPropertiesDatabase* tagPropertiesDatabase, const std::string& configPattern); + GNEApplicationWindow(FXApp* app, const GNETagPropertiesDatabase* tagPropertiesDatabase, const std::string& configPattern); /// @brief Destructor ~GNEApplicationWindow(); @@ -549,7 +549,7 @@ class GNEApplicationWindow : public GUIMainWindow, public MFXInterThreadEventCli FXCursor* getDefaultCursor(); /// @brief get tag properties database - GNETagPropertiesDatabase* getTagPropertiesDatabase() const; + const GNETagPropertiesDatabase* getTagPropertiesDatabase() const; /// @brief get pointer to undoList GNEUndoList* getUndoList(); @@ -702,7 +702,7 @@ class GNEApplicationWindow : public GUIMainWindow, public MFXInterThreadEventCli bool myHadDependentBuild = false; /// @brief tagProperties database - GNETagPropertiesDatabase* myTagPropertiesDatabase = nullptr; + const GNETagPropertiesDatabase* myTagPropertiesDatabase = nullptr; /// @brief we are responsible for the net GNENet* myNet = nullptr; diff --git a/src/netedit/GNENet.cpp b/src/netedit/GNENet.cpp index 471887e8b12..e89a701a5e1 100644 --- a/src/netedit/GNENet.cpp +++ b/src/netedit/GNENet.cpp @@ -88,10 +88,11 @@ const std::map GNENet::EMPTY_HEADER; // member method definitions // =========================================================================== -GNENet::GNENet(NBNetBuilder* netBuilder, GNETagPropertiesDatabase* tagPropertiesDatabase) : +GNENet::GNENet(NBNetBuilder* netBuilder, const GNETagPropertiesDatabase* tagPropertiesDatabase) : GUIGlObject(GLO_NETWORK, "", nullptr), myNetBuilder(netBuilder), - myAttributeCarriers(new GNENetHelper::AttributeCarriers(this, tagPropertiesDatabase)), + myTagPropertiesDatabase(tagPropertiesDatabase), + myAttributeCarriers(new GNENetHelper::AttributeCarriers(this)), mySavingStatus(new GNENetHelper::SavingStatus(this)), myNetworkPathManager(new GNEPathManager(this)), myDemandPathManager(new GNEPathManager(this)), @@ -121,6 +122,12 @@ GNENet::~GNENet() { } +const GNETagPropertiesDatabase* +GNENet::getTagPropertiesDatabase() const { + return myTagPropertiesDatabase; +} + + GNENetHelper::AttributeCarriers* GNENet::getAttributeCarriers() const { return myAttributeCarriers; @@ -2633,7 +2640,7 @@ GNENet::writeRouteProbeComment(OutputDevice& device) const { bool GNENet::writeCalibratorComment(OutputDevice& device) const { for (const auto& additionals : myAttributeCarriers->getAdditionals()) { - if (myViewNet->getTagPropertiesDatabase()->getTagProperty(additionals.first)->isCalibrator() && (additionals.second.size() > 0)) { + if (myViewNet->getNet()->getTagPropertiesDatabase()->getTagProperty(additionals.first)->isCalibrator() && (additionals.second.size() > 0)) { device << (" \n"); return true; } @@ -2645,7 +2652,7 @@ GNENet::writeCalibratorComment(OutputDevice& device) const { bool GNENet::writeStoppingPlaceComment(OutputDevice& device) const { for (const auto& additionals : myAttributeCarriers->getAdditionals()) { - if (myViewNet->getTagPropertiesDatabase()->getTagProperty(additionals.first)->isStoppingPlace() && (additionals.second.size() > 0)) { + if (myViewNet->getNet()->getTagPropertiesDatabase()->getTagProperty(additionals.first)->isStoppingPlace() && (additionals.second.size() > 0)) { device << (" \n"); return true; } @@ -2657,7 +2664,7 @@ GNENet::writeStoppingPlaceComment(OutputDevice& device) const { bool GNENet::writeDetectorComment(OutputDevice& device) const { for (const auto& additionals : myAttributeCarriers->getAdditionals()) { - if (myViewNet->getTagPropertiesDatabase()->getTagProperty(additionals.first)->isDetector() && (additionals.second.size() > 0)) { + if (myViewNet->getNet()->getTagPropertiesDatabase()->getTagProperty(additionals.first)->isDetector() && (additionals.second.size() > 0)) { device << (" \n"); return true; } @@ -2669,10 +2676,10 @@ GNENet::writeDetectorComment(OutputDevice& device) const { bool GNENet::writeOtherAdditionalsComment(OutputDevice& device) const { for (const auto& additionals : myAttributeCarriers->getAdditionals()) { - if (myViewNet->getTagPropertiesDatabase()->getTagProperty(additionals.first)->isAdditionalPureElement() && - !myViewNet->getTagPropertiesDatabase()->getTagProperty(additionals.first)->isStoppingPlace() && - !myViewNet->getTagPropertiesDatabase()->getTagProperty(additionals.first)->isDetector() && - !myViewNet->getTagPropertiesDatabase()->getTagProperty(additionals.first)->isCalibrator() && + if (myViewNet->getNet()->getTagPropertiesDatabase()->getTagProperty(additionals.first)->isAdditionalPureElement() && + !myViewNet->getNet()->getTagPropertiesDatabase()->getTagProperty(additionals.first)->isStoppingPlace() && + !myViewNet->getNet()->getTagPropertiesDatabase()->getTagProperty(additionals.first)->isDetector() && + !myViewNet->getNet()->getTagPropertiesDatabase()->getTagProperty(additionals.first)->isCalibrator() && (additionals.first != SUMO_TAG_ROUTEPROBE) && (additionals.first != SUMO_TAG_ACCESS) && (additionals.first != SUMO_TAG_PARKING_SPACE) && (additionals.second.size() > 0)) { device << (" \n"); @@ -2686,8 +2693,8 @@ GNENet::writeOtherAdditionalsComment(OutputDevice& device) const { bool GNENet::writeShapesComment(OutputDevice& device) const { for (const auto& additionals : myAttributeCarriers->getAdditionals()) { - if (myViewNet->getTagPropertiesDatabase()->getTagProperty(additionals.first)->isShapeElement() && - !myViewNet->getTagPropertiesDatabase()->getTagProperty(additionals.first)->isJuPedSimElement() && + if (myViewNet->getNet()->getTagPropertiesDatabase()->getTagProperty(additionals.first)->isShapeElement() && + !myViewNet->getNet()->getTagPropertiesDatabase()->getTagProperty(additionals.first)->isJuPedSimElement() && (additionals.second.size() > 0)) { device << (" \n"); return true; @@ -2700,7 +2707,7 @@ GNENet::writeShapesComment(OutputDevice& device) const { bool GNENet::writeJuPedSimComment(OutputDevice& device) const { for (const auto& additionals : myAttributeCarriers->getAdditionals()) { - if (myViewNet->getTagPropertiesDatabase()->getTagProperty(additionals.first)->isJuPedSimElement() && (additionals.second.size() > 0)) { + if (myViewNet->getNet()->getTagPropertiesDatabase()->getTagProperty(additionals.first)->isJuPedSimElement() && (additionals.second.size() > 0)) { device << (" \n"); return true; } diff --git a/src/netedit/GNENet.h b/src/netedit/GNENet.h index b0fc173e439..a840dde95fa 100644 --- a/src/netedit/GNENet.h +++ b/src/netedit/GNENet.h @@ -43,11 +43,14 @@ class GNENet : public GUIGlObject { public: /// @brief constructor - GNENet(NBNetBuilder* netBuilder, GNETagPropertiesDatabase* tagPropertiesDatabase); + GNENet(NBNetBuilder* netBuilder, const GNETagPropertiesDatabase* tagPropertiesDatabase); /// @brief Destructor ~GNENet(); + /// @brief get tag properties database + const GNETagPropertiesDatabase* getTagPropertiesDatabase() const; + /// @brief get all attribute carriers used in this net GNENetHelper::AttributeCarriers* getAttributeCarriers() const; @@ -501,6 +504,9 @@ class GNENet : public GUIGlObject { /// @brief The net to be notified of about changes GNEViewNet* myViewNet = nullptr; + /// @brief pointer to tagProperties database + const GNETagPropertiesDatabase* myTagPropertiesDatabase = nullptr; + /// @brief AttributeCarriers of net GNENetHelper::AttributeCarriers* myAttributeCarriers = nullptr; diff --git a/src/netedit/GNENetHelper.cpp b/src/netedit/GNENetHelper.cpp index e6a317ec136..b3a14967d57 100644 --- a/src/netedit/GNENetHelper.cpp +++ b/src/netedit/GNENetHelper.cpp @@ -55,11 +55,11 @@ // GNENetHelper::AttributeCarriers - methods // --------------------------------------------------------------------------- -GNENetHelper::AttributeCarriers::AttributeCarriers(GNENet* net, GNETagPropertiesDatabase* tagPropertiesDatabase) : +GNENetHelper::AttributeCarriers::AttributeCarriers(GNENet* net) : myNet(net), myStopIndex(0) { // fill additionals with tags - auto additionalTagProperties = tagPropertiesDatabase->getTagPropertiesByType(GNETagProperties::TagType::ADDITIONALELEMENT | + auto additionalTagProperties = myNet->getTagPropertiesDatabase()->getTagPropertiesByType(GNETagProperties::TagType::ADDITIONALELEMENT | GNETagProperties::TagType::SHAPE | GNETagProperties::TagType::TAZELEMENT | GNETagProperties::TagType::WIRE, false); for (const auto& additionalTagProperty : additionalTagProperties) { myAdditionals.insert(std::make_pair(additionalTagProperty->getTag(), std::unordered_map())); @@ -68,24 +68,24 @@ GNENetHelper::AttributeCarriers::AttributeCarriers(GNENet* net, GNETagProperties } } // fill demand elements with tags - auto demandElementTagProperties = tagPropertiesDatabase->getTagPropertiesByType(GNETagProperties::TagType::DEMANDELEMENT, false); + auto demandElementTagProperties = myNet->getTagPropertiesDatabase()->getTagPropertiesByType(GNETagProperties::TagType::DEMANDELEMENT, false); for (const auto& demandElementTagProperty : demandElementTagProperties) { myDemandElements.insert(std::make_pair(demandElementTagProperty->getTag(), std::unordered_map())); if (demandElementTagProperty->hasAttribute(SUMO_ATTR_ID)) { myDemandElementIDs.insert(std::make_pair(demandElementTagProperty->getTag(), std::map())); } } - auto stopTagProperties = tagPropertiesDatabase->getTagPropertiesByType(GNETagProperties::TagType::VEHICLESTOP, false); + auto stopTagProperties = myNet->getTagPropertiesDatabase()->getTagPropertiesByType(GNETagProperties::TagType::VEHICLESTOP, false); for (const auto& stopTagProperty : stopTagProperties) { myDemandElements.insert(std::make_pair(stopTagProperty->getTag(), std::unordered_map())); } // fill data elements with tags - auto genericDataElementTagProperties = tagPropertiesDatabase->getTagPropertiesByType(GNETagProperties::TagType::GENERICDATA, false); + auto genericDataElementTagProperties = myNet->getTagPropertiesDatabase()->getTagPropertiesByType(GNETagProperties::TagType::GENERICDATA, false); for (const auto& genericDataElementTagProperty : genericDataElementTagProperties) { myGenericDatas.insert(std::make_pair(genericDataElementTagProperty->getTag(), std::unordered_map())); } // fill meanDatas with tags - auto meanDataTagProperties = tagPropertiesDatabase->getTagPropertiesByType(GNETagProperties::TagType::MEANDATA, false); + auto meanDataTagProperties = myNet->getTagPropertiesDatabase()->getTagPropertiesByType(GNETagProperties::TagType::MEANDATA, false); for (const auto& meanDataTagProperty : meanDataTagProperties) { myMeanDatas.insert(std::make_pair(meanDataTagProperty->getTag(), std::map())); } @@ -269,12 +269,12 @@ GNENetHelper::AttributeCarriers::retrieveAttributeCarriers(SumoXMLTag tag) { for (const auto& walkingArea : myWalkingAreas) { result.push_back(walkingArea.second); } - } else if ((tag == SUMO_TAG_NOTHING) || (myNet->getViewNet()->getTagPropertiesDatabase()->getTagProperty(tag)->isAdditionalElement())) { + } else if ((tag == SUMO_TAG_NOTHING) || (myNet->getTagPropertiesDatabase()->getTagProperty(tag)->isAdditionalElement())) { for (const auto& additional : myAdditionals.at(tag)) { result.push_back(additional.second); } - } else if ((tag == SUMO_TAG_NOTHING) || (myNet->getViewNet()->getTagPropertiesDatabase()->getTagProperty(tag)->isDemandElement())) { - auto mergingPlans = myNet->getViewNet()->getTagPropertiesDatabase()->getTagPropertiesByMergingTag(tag); + } else if ((tag == SUMO_TAG_NOTHING) || (myNet->getTagPropertiesDatabase()->getTagProperty(tag)->isDemandElement())) { + auto mergingPlans = myNet->getTagPropertiesDatabase()->getTagPropertiesByMergingTag(tag); if (mergingPlans.size() > 0) { for (const auto& mergingPlan : mergingPlans) { for (const auto& demandElemet : myDemandElements.at(mergingPlan->getTag())) { @@ -294,11 +294,11 @@ GNENetHelper::AttributeCarriers::retrieveAttributeCarriers(SumoXMLTag tag) { for (const auto& dataInterval : myDataIntervals) { result.push_back(dataInterval.second); } - } else if ((tag == SUMO_TAG_NOTHING) || (myNet->getViewNet()->getTagPropertiesDatabase()->getTagProperty(tag)->isGenericData())) { + } else if ((tag == SUMO_TAG_NOTHING) || (myNet->getTagPropertiesDatabase()->getTagProperty(tag)->isGenericData())) { for (const auto& genericData : myGenericDatas.at(tag)) { result.push_back(genericData.second); } - } else if ((tag == SUMO_TAG_NOTHING) || (myNet->getViewNet()->getTagPropertiesDatabase()->getTagProperty(tag)->isMeanData())) { + } else if ((tag == SUMO_TAG_NOTHING) || (myNet->getTagPropertiesDatabase()->getTagProperty(tag)->isMeanData())) { for (const auto& meanData : myMeanDatas.at(tag)) { result.push_back(meanData.second); } @@ -1411,7 +1411,7 @@ GNENetHelper::AttributeCarriers::generateDemandElementID(SumoXMLTag tag) const { // obtain option container const auto& neteditOptions = OptionsCont::getOptions(); // get tag property - const auto tagProperty = myNet->getViewNet()->getTagPropertiesDatabase()->getTagProperty(tag); + const auto tagProperty = myNet->getTagPropertiesDatabase()->getTagProperty(tag); // get prefix std::string prefix; if (tag == SUMO_TAG_ROUTE) { diff --git a/src/netedit/GNENetHelper.h b/src/netedit/GNENetHelper.h index 9ff130e8097..c54f97f93d1 100644 --- a/src/netedit/GNENetHelper.h +++ b/src/netedit/GNENetHelper.h @@ -62,7 +62,6 @@ class GNENet; class GNENetworkElement; class GNEPOI; class GNEPoly; -class GNETagPropertiesDatabase; class GNEUndoList; class GNEViewNet; class GNEWalkingArea; @@ -102,7 +101,7 @@ struct GNENetHelper { public: /// @brief constructor - AttributeCarriers(GNENet* net, GNETagPropertiesDatabase* tagPropertiesDatabase); + AttributeCarriers(GNENet* net); /// @brief destructor ~AttributeCarriers(); diff --git a/src/netedit/GNETagPropertiesDatabase.cpp b/src/netedit/GNETagPropertiesDatabase.cpp index 897e510badc..e58ef11a1cc 100644 --- a/src/netedit/GNETagPropertiesDatabase.cpp +++ b/src/netedit/GNETagPropertiesDatabase.cpp @@ -77,7 +77,7 @@ GNETagPropertiesDatabase::~GNETagPropertiesDatabase() { GNETagProperties* -GNETagPropertiesDatabase::getTagProperty(SumoXMLTag tag) { +GNETagPropertiesDatabase::getTagProperty(SumoXMLTag tag) const { // check that tag is defined if (myTagProperties.count(tag) == 0) { if (myMergedPlanTagProperties.count(tag) == 0) { @@ -92,7 +92,7 @@ GNETagPropertiesDatabase::getTagProperty(SumoXMLTag tag) { const std::vector -GNETagPropertiesDatabase::getTagPropertiesByType(const int tagPropertyCategory, const bool mergeCommonPlans) { +GNETagPropertiesDatabase::getTagPropertiesByType(const int tagPropertyCategory, const bool mergeCommonPlans) const { std::vector allowedTags; if (tagPropertyCategory & GNETagProperties::TagType::NETWORKELEMENT) { // fill networkElements tags @@ -310,7 +310,7 @@ GNETagPropertiesDatabase::getTagPropertiesByType(const int tagPropertyCategory, const std::vector -GNETagPropertiesDatabase::getTagPropertiesByMergingTag(SumoXMLTag mergingTag) { +GNETagPropertiesDatabase::getTagPropertiesByMergingTag(SumoXMLTag mergingTag) const { std::vector result; // fill tags for (const auto& tagProperty : myTagProperties) { @@ -359,7 +359,7 @@ GNETagPropertiesDatabase::getMaxNumberOfNeteditAttributes() const { void -GNETagPropertiesDatabase::writeAttributeHelp() { +GNETagPropertiesDatabase::writeAttributeHelp() const { // merge "virtual" netedit tags like 'edge' static std::map mergedAttributeProperties; for (const auto& tagPropertyItem : myTagProperties) { diff --git a/src/netedit/GNETagPropertiesDatabase.h b/src/netedit/GNETagPropertiesDatabase.h index de355bab3f0..83e7d041a71 100644 --- a/src/netedit/GNETagPropertiesDatabase.h +++ b/src/netedit/GNETagPropertiesDatabase.h @@ -45,13 +45,13 @@ class GNETagPropertiesDatabase { ~GNETagPropertiesDatabase(); /// @brief get tagProperty associated to the given tag - GNETagProperties* getTagProperty(SumoXMLTag tag); + GNETagProperties* getTagProperty(SumoXMLTag tag) const; /// @brief get tagProperties associated to the given GNETagProperties::TagType (NETWORKELEMENT, ADDITIONALELEMENT, VEHICLE, etc.) - const std::vector getTagPropertiesByType(const int tagPropertyCategory, const bool mergeCommonPlans); + const std::vector getTagPropertiesByType(const int tagPropertyCategory, const bool mergeCommonPlans) const; /// @brief get tagProperties associated to the given merging tag - const std::vector getTagPropertiesByMergingTag(SumoXMLTag mergingTag); + const std::vector getTagPropertiesByMergingTag(SumoXMLTag mergingTag) const; /// @brief max number of editable (non extended) attributes int getMaxNumberOfEditableAttributes() const; @@ -66,7 +66,7 @@ class GNETagPropertiesDatabase { int getMaxNumberOfNeteditAttributes() const; /// @brief write machine readable attribute help to file - void writeAttributeHelp(); + void writeAttributeHelp() const; protected: /// @brief fill network elements diff --git a/src/netedit/GNEViewNet.cpp b/src/netedit/GNEViewNet.cpp index 59ad249cf62..42054028f2a 100644 --- a/src/netedit/GNEViewNet.cpp +++ b/src/netedit/GNEViewNet.cpp @@ -1849,12 +1849,6 @@ GNEViewNet::getNet() const { } -GNETagPropertiesDatabase* -GNEViewNet::getTagPropertiesDatabase() const { - return myViewParent->getGNEAppWindows()->getTagPropertiesDatabase(); -} - - GNEUndoList* GNEViewNet::getUndoList() const { return myUndoList; diff --git a/src/netedit/GNEViewNet.h b/src/netedit/GNEViewNet.h index 7f02a817a75..ee6f729817a 100644 --- a/src/netedit/GNEViewNet.h +++ b/src/netedit/GNEViewNet.h @@ -533,9 +533,6 @@ class GNEViewNet : public GUISUMOAbstractView { /// @brief get the net object GNENet* getNet() const; - /// @brief get tag properties database (Shortcut) - GNETagPropertiesDatabase* getTagPropertiesDatabase() const; - /// @brief get the undoList object GNEUndoList* getUndoList() const; diff --git a/src/netedit/GNEViewParent.cpp b/src/netedit/GNEViewParent.cpp index 0823439b6dc..c40a3cff692 100644 --- a/src/netedit/GNEViewParent.cpp +++ b/src/netedit/GNEViewParent.cpp @@ -605,7 +605,7 @@ GNEViewParent::onCmdLocate(FXObject*, FXSelector sel, void*) { chooserLoc = &myACChoosers.ACChooserAdditional; locateTitle = TL("Additional Chooser"); for (const auto& additionalTag : viewNet->getNet()->getAttributeCarriers()->getAdditionals()) { - const auto tagProperty = viewNet->getTagPropertiesDatabase()->getTagProperty(additionalTag.first); + const auto tagProperty = viewNet->getNet()->getTagPropertiesDatabase()->getTagProperty(additionalTag.first); // avoid shapes and TAZs if (!tagProperty->isShapeElement() && !tagProperty->isTAZElement()) { for (const auto& additional : additionalTag.second) { diff --git a/src/netedit/elements/GNEAttributeCarrier.cpp b/src/netedit/elements/GNEAttributeCarrier.cpp index b0c808b1fb1..cac356b4b3c 100644 --- a/src/netedit/elements/GNEAttributeCarrier.cpp +++ b/src/netedit/elements/GNEAttributeCarrier.cpp @@ -52,7 +52,7 @@ const std::string GNEAttributeCarrier::False = toString(false); // =========================================================================== GNEAttributeCarrier::GNEAttributeCarrier(const SumoXMLTag tag, GNENet* net) : - myTagProperty(net->getViewNet()->getTagPropertiesDatabase()->getTagProperty(tag)), + myTagProperty(net->getTagPropertiesDatabase()->getTagProperty(tag)), myNet(net) { } diff --git a/src/netedit/elements/demand/GNERouteHandler.cpp b/src/netedit/elements/demand/GNERouteHandler.cpp index faf011ee555..f3caccaeca3 100644 --- a/src/netedit/elements/demand/GNERouteHandler.cpp +++ b/src/netedit/elements/demand/GNERouteHandler.cpp @@ -1739,7 +1739,7 @@ GNERouteHandler::transformToRouteFlow(GNEVehicle* originalVehicle, bool createEm // first delete vehicle net->deleteDemandElement(originalVehicle, net->getViewNet()->getUndoList()); // change depart - if (!originalVehicle->getNet()->getViewNet()->getTagPropertiesDatabase()->getTagProperty(vehicleParameters.tag)->isFlow()) { + if (!originalVehicle->getNet()->getViewNet()->getNet()->getTagPropertiesDatabase()->getTagProperty(vehicleParameters.tag)->isFlow()) { // get template flow const auto templateFlow = net->getViewNet()->getViewParent()->getVehicleFrame()->getVehicleTagSelector()->getTemplateAC(GNE_TAG_FLOW_ROUTE); // set flow parameters @@ -1887,7 +1887,7 @@ GNERouteHandler::transformToFlow(GNEVehicle* originalVehicle) { net->deleteDemandElement(route, net->getViewNet()->getUndoList()); } // change depart - if (!originalVehicle->getNet()->getViewNet()->getTagPropertiesDatabase()->getTagProperty(vehicleParameters.tag)->isFlow()) { + if (!originalVehicle->getNet()->getViewNet()->getNet()->getTagPropertiesDatabase()->getTagProperty(vehicleParameters.tag)->isFlow()) { // get template flow const auto templateFlow = net->getViewNet()->getViewParent()->getVehicleFrame()->getVehicleTagSelector()->getTemplateAC(GNE_TAG_FLOW_ROUTE); // set flow parameters diff --git a/src/netedit/elements/network/GNEEdge.cpp b/src/netedit/elements/network/GNEEdge.cpp index cc088990344..6f8c714b32f 100644 --- a/src/netedit/elements/network/GNEEdge.cpp +++ b/src/netedit/elements/network/GNEEdge.cpp @@ -1071,7 +1071,7 @@ GNEEdge::copyTemplate(const GNEEdgeTemplate* edgeTemplate, GNEUndoList* undoList void GNEEdge::copyEdgeType(const GNEEdgeType* edgeType, GNEUndoList* undoList) { - const auto tagPropertiesDatabase = myNet->getViewNet()->getTagPropertiesDatabase(); + const auto tagPropertiesDatabase = myNet->getTagPropertiesDatabase(); // get tag properties const auto edgeProperties = tagPropertiesDatabase->getTagProperty(SUMO_TAG_EDGE); const auto laneProperties = tagPropertiesDatabase->getTagProperty(SUMO_TAG_LANE); diff --git a/src/netedit/frames/GNEAttributesEditor.cpp b/src/netedit/frames/GNEAttributesEditor.cpp index 04f2ec6c1ae..2a3bebfec4d 100644 --- a/src/netedit/frames/GNEAttributesEditor.cpp +++ b/src/netedit/frames/GNEAttributesEditor.cpp @@ -62,13 +62,13 @@ GNEAttributesEditor::GNEAttributesEditor(GNEFrame* frameParent, const std::strin myEditorOptions(editorOptions) { // adjust max number of rows if ((myEditorOptions & EditorOptions::BASIC_ATTRIBUTES) != 0) { - myMaxNumberOfRows = frameParent->getViewNet()->getTagPropertiesDatabase()->getMaxNumberOfEditableAttributes(); + myMaxNumberOfRows = frameParent->getViewNet()->getNet()->getTagPropertiesDatabase()->getMaxNumberOfEditableAttributes(); } else if ((myEditorOptions & EditorOptions::FLOW_ATTRIBUTES) != 0) { - myMaxNumberOfRows = frameParent->getViewNet()->getTagPropertiesDatabase()->getMaxNumberOfFlowAttributes(); + myMaxNumberOfRows = frameParent->getViewNet()->getNet()->getTagPropertiesDatabase()->getMaxNumberOfFlowAttributes(); } else if ((myEditorOptions & EditorOptions::GEO_ATTRIBUTES) != 0) { - myMaxNumberOfRows = frameParent->getViewNet()->getTagPropertiesDatabase()->getMaxNumberOfGeoAttributes(); + myMaxNumberOfRows = frameParent->getViewNet()->getNet()->getTagPropertiesDatabase()->getMaxNumberOfGeoAttributes(); } else if ((myEditorOptions & EditorOptions::NETEDIT_ATTRIBUTES) != 0) { - myMaxNumberOfRows = frameParent->getViewNet()->getTagPropertiesDatabase()->getMaxNumberOfNeteditAttributes(); + myMaxNumberOfRows = frameParent->getViewNet()->getNet()->getTagPropertiesDatabase()->getMaxNumberOfNeteditAttributes(); // create netedit editor buttons myFrontButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Front element"), "", "", GUIIconSubSys::getIcon(GUIIcon::FRONTELEMENT), this, MID_GNE_ATTRIBUTESEDITOR_FRONT, GUIDesignButton); myFrontButton->hide(); diff --git a/src/netedit/frames/GNEDemandSelector.cpp b/src/netedit/frames/GNEDemandSelector.cpp index 1b667aefc5c..09b907486e3 100644 --- a/src/netedit/frames/GNEDemandSelector.cpp +++ b/src/netedit/frames/GNEDemandSelector.cpp @@ -68,7 +68,7 @@ GNEDemandElementSelector::GNEDemandElementSelector(GNEFrame* frameParent, const mySelectingMultipleElements(false) { // fill myDemandElementTags for (const auto& tagType : tagTypes) { - const auto tagPropertiesByType = frameParent->getViewNet()->getTagPropertiesDatabase()->getTagPropertiesByType(tagType, false); + const auto tagPropertiesByType = frameParent->getViewNet()->getNet()->getTagPropertiesDatabase()->getTagPropertiesByType(tagType, false); for (const auto tagProperty : tagPropertiesByType) { myDemandElementTags.push_back(tagProperty->getTag()); } diff --git a/src/netedit/frames/GNESelectorParent.cpp b/src/netedit/frames/GNESelectorParent.cpp index dbd45eee162..1df58ed04a4 100644 --- a/src/netedit/frames/GNESelectorParent.cpp +++ b/src/netedit/frames/GNESelectorParent.cpp @@ -112,7 +112,7 @@ GNESelectorParent::refreshSelectorParentModule() { // fill list with IDs for (const auto& parentTag : myParentTags) { // check type - const auto tagProperty = myFrameParent->getViewNet()->getTagPropertiesDatabase()->getTagProperty(parentTag); + const auto tagProperty = myFrameParent->getViewNet()->getNet()->getTagPropertiesDatabase()->getTagProperty(parentTag); // additionals if (tagProperty->isAdditionalElement()) { for (const auto& additional : myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getAdditionals().at(parentTag)) { diff --git a/src/netedit/frames/GNETagSelector.cpp b/src/netedit/frames/GNETagSelector.cpp index d4ae21fe256..f895b9428c5 100644 --- a/src/netedit/frames/GNETagSelector.cpp +++ b/src/netedit/frames/GNETagSelector.cpp @@ -206,7 +206,7 @@ GNETagSelector::setCurrentTagType(GNETagProperties::TagType tagType, const bool myACTemplates.clear(); myTagsMatchBox->clearItems(); // get tag properties - const auto tagPropertiesByType = myFrameParent->getViewNet()->getTagPropertiesDatabase()->getTagPropertiesByType(myTagType, true); + const auto tagPropertiesByType = myFrameParent->getViewNet()->getNet()->getTagPropertiesDatabase()->getTagPropertiesByType(myTagType, true); // fill myACTemplates and myTagsMatchBox for (const auto tagProperty : tagPropertiesByType) { if ((!onlyDrawables || tagProperty->isDrawable()) && (!tagProperty->requireProj() || proj)) { diff --git a/src/netedit/frames/common/GNEMatchAttribute.cpp b/src/netedit/frames/common/GNEMatchAttribute.cpp index 78b75ecb85b..fc3578f5c60 100644 --- a/src/netedit/frames/common/GNEMatchAttribute.cpp +++ b/src/netedit/frames/common/GNEMatchAttribute.cpp @@ -97,7 +97,7 @@ GNEMatchAttribute::disableMatchAttribute() { void GNEMatchAttribute::showMatchAttribute(const GNEElementSet::Type type) { - const auto tagPropertiesDatabase = myElementSet->getSelectorFrameParent()->getViewNet()->getTagPropertiesDatabase(); + const auto tagPropertiesDatabase = myElementSet->getSelectorFrameParent()->getViewNet()->getNet()->getTagPropertiesDatabase(); // declare flag for proj const bool proj = (GeoConvHelper::getFinal().getProjString() != "!"); // get tags for the given element set @@ -165,7 +165,7 @@ long GNEMatchAttribute::onCmdSelMBAttribute(FXObject*, FXSelector, void*) { // set current selected attributeProperty myCurrentAttribute = SUMO_ATTR_NOTHING; - for (const auto attributeProperty : myElementSet->getSelectorFrameParent()->getViewNet()->getTagPropertiesDatabase()->getTagProperty(myCurrentTag)->getAttributeProperties()) { + for (const auto attributeProperty : myElementSet->getSelectorFrameParent()->getViewNet()->getNet()->getTagPropertiesDatabase()->getTagProperty(myCurrentTag)->getAttributeProperties()) { if (attributeProperty->getAttrStr() == myMatchAttrComboBox->getText().text()) { myCurrentAttribute = attributeProperty->getAttr(); } @@ -188,7 +188,7 @@ long GNEMatchAttribute::onCmdSelMBString(FXObject*, FXSelector, void*) { // obtain expresion std::string expr(myMatchString->getText().text()); - const auto tagProperty = myElementSet->getSelectorFrameParent()->getViewNet()->getTagPropertiesDatabase()->getTagProperty(myCurrentTag); + const auto tagProperty = myElementSet->getSelectorFrameParent()->getViewNet()->getNet()->getTagPropertiesDatabase()->getTagProperty(myCurrentTag); bool valid = true; if (expr == "") { // the empty expression matches all objects @@ -319,7 +319,7 @@ GNEMatchAttribute::updateAttribute() { // first check if tag is valid if (myCurrentTag != SUMO_TAG_NOTHING) { // now continue with attributes - const auto tagProperty = myElementSet->getSelectorFrameParent()->getViewNet()->getTagPropertiesDatabase()->getTagProperty(myCurrentTag); + const auto tagProperty = myElementSet->getSelectorFrameParent()->getViewNet()->getNet()->getTagPropertiesDatabase()->getTagProperty(myCurrentTag); // set color and enable items myMatchAttrComboBox->enable(); myMatchAttrComboBox->setTextColor(FXRGB(0, 0, 0)); diff --git a/src/netedit/frames/common/GNEMatchGenericDataAttribute.cpp b/src/netedit/frames/common/GNEMatchGenericDataAttribute.cpp index c123d6bad30..0508a56ee36 100644 --- a/src/netedit/frames/common/GNEMatchGenericDataAttribute.cpp +++ b/src/netedit/frames/common/GNEMatchGenericDataAttribute.cpp @@ -133,7 +133,7 @@ GNEMatchGenericDataAttribute::enableMatchGenericDataAttribute() { myEnd->setText(toString(myIntervals.begin()->first.second).c_str()); myEnd->setTextColor(FXRGB(0, 0, 0)); // get generic datas - const auto tagPropertiesGenericDatas = myElementSet->getSelectorFrameParent()->getViewNet()->getTagPropertiesDatabase()->getTagPropertiesByType(GNETagProperties::TagType::GENERICDATA, true); + const auto tagPropertiesGenericDatas = myElementSet->getSelectorFrameParent()->getViewNet()->getNet()->getTagPropertiesDatabase()->getTagPropertiesByType(GNETagProperties::TagType::GENERICDATA, true); // fill combo box (only with drawable elements) for (const auto& genericDataTag : tagPropertiesGenericDatas) { if (genericDataTag->isDrawable()) { @@ -294,7 +294,7 @@ GNEMatchGenericDataAttribute::onCmdSelectTag(FXObject*, FXSelector, void*) { // First check what type of elementes is being selected myCurrentTag = SUMO_TAG_NOTHING; // get generic data tags - const auto tagPropertiesGenericDatas = myElementSet->getSelectorFrameParent()->getViewNet()->getTagPropertiesDatabase()->getTagPropertiesByType(GNETagProperties::TagType::GENERICDATA, true); + const auto tagPropertiesGenericDatas = myElementSet->getSelectorFrameParent()->getViewNet()->getNet()->getTagPropertiesDatabase()->getTagPropertiesByType(GNETagProperties::TagType::GENERICDATA, true); // fill myMatchGenericDataTagComboBox for (const auto& genericDataTag : tagPropertiesGenericDatas) { if (genericDataTag->isDrawable() && (genericDataTag->getFieldString() == myMatchGenericDataTagComboBox->getText().text())) { diff --git a/src/netedit/frames/common/GNESelectorFrame.cpp b/src/netedit/frames/common/GNESelectorFrame.cpp index 33fa379f85b..18cde778422 100644 --- a/src/netedit/frames/common/GNESelectorFrame.cpp +++ b/src/netedit/frames/common/GNESelectorFrame.cpp @@ -1143,7 +1143,7 @@ GNESelectorFrame::getMatches(const SumoXMLTag ACTag, const SumoXMLAttr ACAttr, c // first retrieve all ACs using ACTag const auto allACbyTag = myViewNet->getNet()->getAttributeCarriers()->retrieveAttributeCarriers(ACTag); // get Tag value - const auto tagProperties = myViewNet->getTagPropertiesDatabase()->getTagProperty(ACTag); + const auto tagProperties = myViewNet->getNet()->getTagPropertiesDatabase()->getTagProperty(ACTag); // iterate over all ACs for (const auto& AC : allACbyTag) { if (expr == "" && compOp == '@') { diff --git a/src/netedit/frames/data/GNEGenericDataFrame.cpp b/src/netedit/frames/data/GNEGenericDataFrame.cpp index 8c529858c8d..66260524c8c 100644 --- a/src/netedit/frames/data/GNEGenericDataFrame.cpp +++ b/src/netedit/frames/data/GNEGenericDataFrame.cpp @@ -570,7 +570,7 @@ GNEGenericDataFrame::show() { myDataSetSelector->refreshDataSetSelector(nullptr); // check if there is an edge path creator if (myPathCreator) { - myPathCreator->showPathCreatorModule(myViewNet->getTagPropertiesDatabase()->getTagProperty(myGenericDataTag), false); + myPathCreator->showPathCreatorModule(myViewNet->getNet()->getTagPropertiesDatabase()->getTagProperty(myGenericDataTag), false); } // show frame GNEFrame::show(); @@ -596,7 +596,7 @@ GNEGenericDataFrame::updateFrameAfterUndoRedo() { myDataSetSelector->refreshDataSetSelector(nullptr); // check if there is an edge path creator if (myPathCreator) { - myPathCreator->showPathCreatorModule(myViewNet->getTagPropertiesDatabase()->getTagProperty(myGenericDataTag), false); + myPathCreator->showPathCreatorModule(myViewNet->getNet()->getTagPropertiesDatabase()->getTagProperty(myGenericDataTag), false); } } diff --git a/src/netedit/frames/data/GNEMeanDataFrame.cpp b/src/netedit/frames/data/GNEMeanDataFrame.cpp index 6c4c62925d6..45a52b89b02 100644 --- a/src/netedit/frames/data/GNEMeanDataFrame.cpp +++ b/src/netedit/frames/data/GNEMeanDataFrame.cpp @@ -71,7 +71,7 @@ GNEMeanDataFrame::MeanDataTypeSelector::MeanDataTypeSelector(GNEMeanDataFrame* m myTypeComboBox = new MFXComboBoxIcon(getCollapsableFrame(), GUIDesignComboBoxNCol, false, GUIDesignComboBoxVisibleItems, this, MID_GNE_SET_TYPE, GUIDesignComboBox); // add mean data types - const auto tagPropertiesMeanDatas = myMeanDataFrameParent->getViewNet()->getTagPropertiesDatabase()->getTagPropertiesByType(GNETagProperties::MEANDATA, false); + const auto tagPropertiesMeanDatas = myMeanDataFrameParent->getViewNet()->getNet()->getTagPropertiesDatabase()->getTagPropertiesByType(GNETagProperties::MEANDATA, false); for (const auto& meanDataType : tagPropertiesMeanDatas) { myTypeComboBox->appendIconItem(meanDataType->getTagStr().c_str(), GUIIconSubSys::getIcon(meanDataType->getGUIIcon())); } @@ -96,7 +96,7 @@ GNEMeanDataFrame::MeanDataTypeSelector::refreshMeanDataTypeSelector() { // clear items myTypeComboBox->clearItems(); // add mean data types - const auto tagPropertiesMeanDatas = myMeanDataFrameParent->getViewNet()->getTagPropertiesDatabase()->getTagPropertiesByType(GNETagProperties::MEANDATA, false); + const auto tagPropertiesMeanDatas = myMeanDataFrameParent->getViewNet()->getNet()->getTagPropertiesDatabase()->getTagPropertiesByType(GNETagProperties::MEANDATA, false); for (const auto& meanDataType : tagPropertiesMeanDatas) { myTypeComboBox->appendIconItem(meanDataType->getTagStr().c_str(), GUIIconSubSys::getIcon(meanDataType->getGUIIcon())); } @@ -121,7 +121,7 @@ GNEMeanDataFrame::MeanDataTypeSelector::refreshMeanDataTypeSelector() { long GNEMeanDataFrame::MeanDataTypeSelector::onCmdSelectItem(FXObject*, FXSelector, void*) { // add mean data types - const auto tagPropertiesMeanDatas = myMeanDataFrameParent->getViewNet()->getTagPropertiesDatabase()->getTagPropertiesByType(GNETagProperties::MEANDATA, false); + const auto tagPropertiesMeanDatas = myMeanDataFrameParent->getViewNet()->getNet()->getTagPropertiesDatabase()->getTagPropertiesByType(GNETagProperties::MEANDATA, false); // Check if value of myTypeMatchBox correspond of an allowed additional tags for (const auto& meanDataType : tagPropertiesMeanDatas) { if (meanDataType->getTagStr() == myTypeComboBox->getText().text()) { diff --git a/src/netedit/frames/demand/GNETypeFrame.cpp b/src/netedit/frames/demand/GNETypeFrame.cpp index df809bd6b60..0be16ee75d1 100644 --- a/src/netedit/frames/demand/GNETypeFrame.cpp +++ b/src/netedit/frames/demand/GNETypeFrame.cpp @@ -307,7 +307,7 @@ GNETypeFrame::TypeEditor::resetType() { // begin reset default vehicle type values myTypeFrameParent->getViewNet()->getUndoList()->begin(GUIIcon::VTYPE, TL("reset default vehicle type values")); // reset all values of default vehicle type - for (const auto& attrProperty : myTypeFrameParent->getViewNet()->getTagPropertiesDatabase()->getTagProperty(SUMO_TAG_VTYPE)->getAttributeProperties()) { + for (const auto& attrProperty : myTypeFrameParent->getViewNet()->getNet()->getTagPropertiesDatabase()->getTagProperty(SUMO_TAG_VTYPE)->getAttributeProperties()) { // change all attributes with "" to reset it (except ID and vClass) if ((attrProperty->getAttr() != SUMO_ATTR_ID) && (attrProperty->getAttr() != SUMO_ATTR_VCLASS)) { myTypeFrameParent->myTypeSelector->getCurrentType()->setAttribute(attrProperty->getAttr(), "", myTypeFrameParent->myViewNet->getUndoList()); diff --git a/src/netedit/frames/network/GNECrossingFrame.cpp b/src/netedit/frames/network/GNECrossingFrame.cpp index b465bb81420..4a4ca28c920 100644 --- a/src/netedit/frames/network/GNECrossingFrame.cpp +++ b/src/netedit/frames/network/GNECrossingFrame.cpp @@ -220,7 +220,7 @@ GNECrossingFrame::CrossingParameters::~CrossingParameters() { void GNECrossingFrame::CrossingParameters::enableCrossingParameters(bool hasTLS) { // obtain Tag Values - const auto crossingTagProperties = myCrossingFrameParent->getViewNet()->getTagPropertiesDatabase()->getTagProperty(SUMO_TAG_CROSSING); + const auto crossingTagProperties = myCrossingFrameParent->getViewNet()->getNet()->getTagPropertiesDatabase()->getTagProperty(SUMO_TAG_CROSSING); // Enable all elements of the crossing frames myCrossingEdgesLabel->enable(); myCrossingEdges->enable(); diff --git a/src/netedit/netedit_main.cpp b/src/netedit/netedit_main.cpp index 62df34c0635..367d229930c 100644 --- a/src/netedit/netedit_main.cpp +++ b/src/netedit/netedit_main.cpp @@ -61,7 +61,7 @@ main(int argc, char** argv) { // set default options GNELoadThread::setDefaultOptions(neteditOptions); // create tagPropertiesdatabase - GNETagPropertiesDatabase* tagPropertiesDatabase = new GNETagPropertiesDatabase(); + const GNETagPropertiesDatabase* tagPropertiesDatabase = new GNETagPropertiesDatabase(); // set arguments called through console OptionsIO::setArgs(argc, argv); OptionsIO::getOptions(true);