/****************************************************************************/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 GNEMatchAttribute.h14/// @author Pablo Alvarez Lopez15/// @date Feb 202016///17// The Widget for modifying selections of network-elements18// (some elements adapted from GUIDialog_GLChosenEditor)19/****************************************************************************/20#pragma once21#include <config.h>2223#include <utils/foxtools/MFXGroupBoxModule.h>2425// ===========================================================================26// class declaration27// ===========================================================================2829class GNEAttributeProperties;30class GNESelectorFrame;31class GNETagProperties;32class GNETagPropertiesDatabase;33class MFXComboBoxAttrProperty;34class MFXComboBoxTagProperty;3536// ===========================================================================37// class definitions38// ===========================================================================3940class GNEMatchAttribute : public MFXGroupBoxModule {41/// @brief FOX-declaration42FXDECLARE(GNEMatchAttribute)4344public:45/// @brief constructor46GNEMatchAttribute(GNESelectorFrame* selectorFrameParent);4748/// @brief destructor49~GNEMatchAttribute();5051/// @brief enable match attributes52void enableMatchAttribute();5354/// @brief disable match attributes55void disableMatchAttribute();5657/// @brief show match attributes58void showMatchAttribute();5960/// @brief hide match attributes61void hideMatchAttribute();6263/// @brief refresh match attribute64void refreshMatchAttribute();6566/// @name FOX-callbacks67/// @{6869/// @brief Called when the user selects a tag in the match box70long onCmdTagSelected(FXObject* obj, FXSelector, void*);7172/// @brief Called when the user selects an attribute in the match box73long onCmdAttributeSelected(FXObject*, FXSelector, void*);7475/// @brief Called when the user toogle the only common checkbox76long onCmdToogleOnlyCommon(FXObject*, FXSelector, void*);7778/// @brief Called when the user enters a new selection expression79long onCmdProcessString(FXObject*, FXSelector, void*);8081/// @brief Called when the user clicks the help button82long onCmdHelp(FXObject*, FXSelector, void*);8384/// @}8586protected:87/// @brief FOX need this88FOX_CONSTRUCTOR(GNEMatchAttribute)8990/**@brief return ACs of the given type with matching attrs91* @param[in] compOp One of {<,>,=} for matching against val or '@' for matching against expr92*/93std::vector<GNEAttributeCarrier*> getMatches(const char compOp, const double val, const std::string& expr);9495/**@brief return GenericDatas of the given type with matching attrs96* @param[in] genericDatas list of filter generic datas97* @param[in] attr XML Attribute used to filter98* @param[in] compOp One of {<,>,=} for matching against val or '@' for matching against expr99*/100std::vector<GNEAttributeCarrier*> getGenericMatches(const std::vector<GNEGenericData*>& genericDatas, const std::string& attr, const char compOp, const double val, const std::string& expr);101102103private:104/// @brief container with current edited properties105class CurrentEditedProperties {106107public:108/// @brief constructor109CurrentEditedProperties(const GNEMatchAttribute* matchAttributeParent);110111/// @brief destructor112~CurrentEditedProperties();113114/// @brief get special tag <all>115const GNETagProperties* getTagPropertiesAll() const;116117/// @brief get attr properties no common118const GNEAttributeProperties* getAttributePropertiesNoCommon() const;119120/// @brief get tag property (depending of supermode)121const GNETagProperties* getTagProperties() const;122123/// @brief get attribute property (depending of supermode)124const GNEAttributeProperties* getAttributeProperties() const;125126/// @brief get match value (depending of supermode)127const std::string& getMatchValue() const;128129/// @brief set tag property (depending of supermode)130void setTagProperties(const GNETagProperties* tagProperty);131132/// @brief set attribute property (depending of supermode)133void setAttributeProperties(const GNEAttributeProperties* attrProperty);134135/// @brief set match value (depending of supermode)136void setMatchValue(const std::string value);137138private:139/// @brief pointer to match attribute parent140const GNEMatchAttribute* myMatchAttributeParent;141142/// @brief current network tag properties143std::vector<const GNETagProperties*> myNetworkTagProperties;144145/// @brief current network attribute properties146const GNEAttributeProperties* myNetworkAttributeProperties;147148/// @brief current network match value149std::string myNetworkMatchValue;150151/// @brief current demand tag properties152std::vector<const GNETagProperties*> myDemandTagProperties;153154/// @brief current demand attribute properties155const GNEAttributeProperties* myDemandAttributeProperties;156157/// @brief current demand match value158std::string myDemandMatchValue;159160/// @brief current data tag properties161std::vector<const GNETagProperties*> myDataTagProperties;162163/// @brief current data attribute properties164const GNEAttributeProperties* myDataAttributeProperties;165166/// @brief current data match value167std::string myDataMatchValue;168169/// @brief tag properties <all>170GNETagProperties* myTagPropertiesAllAttributes = nullptr;171172/// @brief attribute properties no common173const GNEAttributeProperties* myAttributePropertiesNoCommon = nullptr;174175/// @brief default constructor176CurrentEditedProperties() = delete;177178/// @brief Invalidated copy constructor.179CurrentEditedProperties(const CurrentEditedProperties&) = delete;180181/// @brief Invalidated assignment operator182CurrentEditedProperties& operator=(const CurrentEditedProperties& src) = delete;183};184185/// @brief pointer to selector frame parent186GNESelectorFrame* mySelectorFrameParent = nullptr;187188/// @brief vector with tag property comboBoxes189std::vector <MFXComboBoxTagProperty*> myTagComboBoxVector;190191/// @brief checkbox for enable/disable show only common attributes192FXCheckButton* myShowOnlyCommonAttributes = nullptr;193194/// @brief attribute property comboBox195MFXComboBoxAttrProperty* myAttributeComboBox = nullptr;196197/// @brief string of the match198FXTextField* myMatchString = nullptr;199200/// @brief match string button201FXButton* myMatchStringButton = nullptr;202203/// @brief current edited properties204CurrentEditedProperties* myCurrentEditedProperties;205206/// @brief Invalidated copy constructor.207GNEMatchAttribute(const GNEMatchAttribute&) = delete;208209/// @brief Invalidated assignment operator.210GNEMatchAttribute& operator=(const GNEMatchAttribute&) = delete;211};212213214