Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/frames/GNEMatchAttribute.h
169678 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.
4
// This program and the accompanying materials are made available under the
5
// terms of the Eclipse Public License 2.0 which is available at
6
// https://www.eclipse.org/legal/epl-2.0/
7
// This Source Code may also be made available under the following Secondary
8
// Licenses when the conditions for such availability set forth in the Eclipse
9
// Public License 2.0 are satisfied: GNU General Public License, version 2
10
// or later which is available at
11
// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13
/****************************************************************************/
14
/// @file GNEMatchAttribute.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Feb 2020
17
///
18
// The Widget for modifying selections of network-elements
19
// (some elements adapted from GUIDialog_GLChosenEditor)
20
/****************************************************************************/
21
#pragma once
22
#include <config.h>
23
24
#include <utils/foxtools/MFXGroupBoxModule.h>
25
26
// ===========================================================================
27
// class declaration
28
// ===========================================================================
29
30
class GNEAttributeProperties;
31
class GNESelectorFrame;
32
class GNETagProperties;
33
class GNETagPropertiesDatabase;
34
class MFXComboBoxAttrProperty;
35
class MFXComboBoxTagProperty;
36
37
// ===========================================================================
38
// class definitions
39
// ===========================================================================
40
41
class GNEMatchAttribute : public MFXGroupBoxModule {
42
/// @brief FOX-declaration
43
FXDECLARE(GNEMatchAttribute)
44
45
public:
46
/// @brief constructor
47
GNEMatchAttribute(GNESelectorFrame* selectorFrameParent);
48
49
/// @brief destructor
50
~GNEMatchAttribute();
51
52
/// @brief enable match attributes
53
void enableMatchAttribute();
54
55
/// @brief disable match attributes
56
void disableMatchAttribute();
57
58
/// @brief show match attributes
59
void showMatchAttribute();
60
61
/// @brief hide match attributes
62
void hideMatchAttribute();
63
64
/// @brief refresh match attribute
65
void refreshMatchAttribute();
66
67
/// @name FOX-callbacks
68
/// @{
69
70
/// @brief Called when the user selects a tag in the match box
71
long onCmdTagSelected(FXObject* obj, FXSelector, void*);
72
73
/// @brief Called when the user selects an attribute in the match box
74
long onCmdAttributeSelected(FXObject*, FXSelector, void*);
75
76
/// @brief Called when the user toogle the only common checkbox
77
long onCmdToogleOnlyCommon(FXObject*, FXSelector, void*);
78
79
/// @brief Called when the user enters a new selection expression
80
long onCmdProcessString(FXObject*, FXSelector, void*);
81
82
/// @brief Called when the user clicks the help button
83
long onCmdHelp(FXObject*, FXSelector, void*);
84
85
/// @}
86
87
protected:
88
/// @brief FOX need this
89
FOX_CONSTRUCTOR(GNEMatchAttribute)
90
91
/**@brief return ACs of the given type with matching attrs
92
* @param[in] compOp One of {<,>,=} for matching against val or '@' for matching against expr
93
*/
94
std::vector<GNEAttributeCarrier*> getMatches(const char compOp, const double val, const std::string& expr);
95
96
/**@brief return GenericDatas of the given type with matching attrs
97
* @param[in] genericDatas list of filter generic datas
98
* @param[in] attr XML Attribute used to filter
99
* @param[in] compOp One of {<,>,=} for matching against val or '@' for matching against expr
100
*/
101
std::vector<GNEAttributeCarrier*> getGenericMatches(const std::vector<GNEGenericData*>& genericDatas, const std::string& attr, const char compOp, const double val, const std::string& expr);
102
103
104
private:
105
/// @brief container with current edited properties
106
class CurrentEditedProperties {
107
108
public:
109
/// @brief constructor
110
CurrentEditedProperties(const GNEMatchAttribute* matchAttributeParent);
111
112
/// @brief destructor
113
~CurrentEditedProperties();
114
115
/// @brief get special tag <all>
116
const GNETagProperties* getTagPropertiesAll() const;
117
118
/// @brief get attr properties no common
119
const GNEAttributeProperties* getAttributePropertiesNoCommon() const;
120
121
/// @brief get tag property (depending of supermode)
122
const GNETagProperties* getTagProperties() const;
123
124
/// @brief get attribute property (depending of supermode)
125
const GNEAttributeProperties* getAttributeProperties() const;
126
127
/// @brief get match value (depending of supermode)
128
const std::string& getMatchValue() const;
129
130
/// @brief set tag property (depending of supermode)
131
void setTagProperties(const GNETagProperties* tagProperty);
132
133
/// @brief set attribute property (depending of supermode)
134
void setAttributeProperties(const GNEAttributeProperties* attrProperty);
135
136
/// @brief set match value (depending of supermode)
137
void setMatchValue(const std::string value);
138
139
private:
140
/// @brief pointer to match attribute parent
141
const GNEMatchAttribute* myMatchAttributeParent;
142
143
/// @brief current network tag properties
144
std::vector<const GNETagProperties*> myNetworkTagProperties;
145
146
/// @brief current network attribute properties
147
const GNEAttributeProperties* myNetworkAttributeProperties;
148
149
/// @brief current network match value
150
std::string myNetworkMatchValue;
151
152
/// @brief current demand tag properties
153
std::vector<const GNETagProperties*> myDemandTagProperties;
154
155
/// @brief current demand attribute properties
156
const GNEAttributeProperties* myDemandAttributeProperties;
157
158
/// @brief current demand match value
159
std::string myDemandMatchValue;
160
161
/// @brief current data tag properties
162
std::vector<const GNETagProperties*> myDataTagProperties;
163
164
/// @brief current data attribute properties
165
const GNEAttributeProperties* myDataAttributeProperties;
166
167
/// @brief current data match value
168
std::string myDataMatchValue;
169
170
/// @brief tag properties <all>
171
GNETagProperties* myTagPropertiesAllAttributes = nullptr;
172
173
/// @brief attribute properties no common
174
const GNEAttributeProperties* myAttributePropertiesNoCommon = nullptr;
175
176
/// @brief default constructor
177
CurrentEditedProperties() = delete;
178
179
/// @brief Invalidated copy constructor.
180
CurrentEditedProperties(const CurrentEditedProperties&) = delete;
181
182
/// @brief Invalidated assignment operator
183
CurrentEditedProperties& operator=(const CurrentEditedProperties& src) = delete;
184
};
185
186
/// @brief pointer to selector frame parent
187
GNESelectorFrame* mySelectorFrameParent = nullptr;
188
189
/// @brief vector with tag property comboBoxes
190
std::vector <MFXComboBoxTagProperty*> myTagComboBoxVector;
191
192
/// @brief checkbox for enable/disable show only common attributes
193
FXCheckButton* myShowOnlyCommonAttributes = nullptr;
194
195
/// @brief attribute property comboBox
196
MFXComboBoxAttrProperty* myAttributeComboBox = nullptr;
197
198
/// @brief string of the match
199
FXTextField* myMatchString = nullptr;
200
201
/// @brief match string button
202
FXButton* myMatchStringButton = nullptr;
203
204
/// @brief current edited properties
205
CurrentEditedProperties* myCurrentEditedProperties;
206
207
/// @brief Invalidated copy constructor.
208
GNEMatchAttribute(const GNEMatchAttribute&) = delete;
209
210
/// @brief Invalidated assignment operator.
211
GNEMatchAttribute& operator=(const GNEMatchAttribute&) = delete;
212
};
213
214