Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEMatchAttribute.cpp
Go to the documentation of this file.
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/****************************************************************************/
18// The Widget for modifying selections of network-elements
19/****************************************************************************/
20
22#include <netedit/GNENet.h>
31
32#include "GNEMatchAttribute.h"
33
34// ===========================================================================
35// FOX callback mapping
36// ===========================================================================
37
45
46// Object implementation
47FXIMPLEMENT(GNEMatchAttribute, MFXGroupBoxModule, GNEMatchAttributeMap, ARRAYNUMBER(GNEMatchAttributeMap))
48
49// ===========================================================================
50// method definitions
51// ===========================================================================
52
53// ---------------------------------------------------------------------------
54// GNEMatchAttribute - methods
55// ---------------------------------------------------------------------------
56#ifdef _MSC_VER
57#pragma warning(push)
58#pragma warning(disable: 4355) // mask warning about "this" in initializers
59#endif
61 MFXGroupBoxModule(selectorFrameParent, TL("Match Attribute")),
62 mySelectorFrameParent(selectorFrameParent),
63 myCurrentEditedProperties(new CurrentEditedProperties(this)) {
64 // Create MFXComboBoxIcons (sum 1 due children)
65 for (int i = 0; i < selectorFrameParent->getViewNet()->getNet()->getTagPropertiesDatabase()->getHierarchyDepth() + 1; i++) {
68 myTagComboBoxVector.push_back(comboBoxIcon);
69 }
71 myShowOnlyCommonAttributes->setCheck(FALSE);
72 // Create MFXComboBoxIcon for Attributes
75 // Create TextField for Match string
77 // create button
79 // Create help button
81 // refresh with the current tag and attr
83}
84#ifdef _MSC_VER
85#pragma warning(pop)
86#endif
87
91
92
93void
95 for (const auto& tagComboBox : myTagComboBoxVector) {
96 tagComboBox->enable();
97 }
99 myMatchString->enable();
100 myMatchStringButton->enable();
101}
102
103
104void
106 for (const auto& tagComboBox : myTagComboBoxVector) {
107 tagComboBox->disable();
108 tagComboBox->setTextColor(FXRGB(0, 0, 0));
109 }
111 myMatchString->disable();
112 myMatchStringButton->disable();
113 // change colors to black (even if there are invalid values)
114 myAttributeComboBox->setTextColor(FXRGB(0, 0, 0));
115 myMatchString->setTextColor(FXRGB(0, 0, 0));
116}
117
118
119void
121 // refresh before show
123 // show groupbox
124 show();
125}
126
127
128void
130 // hide groupbox
131 hide();
132}
133
134
135void
137 // continue depending of current
139 // fill hierarchy
140 for (size_t i = 0; i < parentHierarchy.size(); i++) {
141 auto comboBox = myTagComboBoxVector.at(i);
142 // clear previous elements
143 comboBox->clearItems();
144 // add <all> always as first element
146 // add siblings (except for root)
147 if (parentHierarchy.at(i)->getHierarchicalParent()) {
148 for (const auto tagSibling : parentHierarchy.at(i)->getHierarchicalParent()->getHierarchicalChildren()) {
149 if (tagSibling->isDrawable()) {
150 myTagComboBoxVector.at(i)->appendTagItem(tagSibling);
151 }
152 }
153 // update tag
154 if (myTagComboBoxVector.at(i)->hasTagProperty(parentHierarchy.at(i))) {
155 myTagComboBoxVector.at(i)->setCurrentItem(parentHierarchy.at(i), FALSE);
156 myTagComboBoxVector.at(i)->show();
157 } else {
158 myTagComboBoxVector.at(i)->hide();
159 }
160 }
161 }
162 // hide the two first combo boxes(root and supermode)
163 myTagComboBoxVector.at(0)->hide();
164 myTagComboBoxVector.at(1)->hide();
165 // hide comboBox with only one element (+ <all>)
166 if (myTagComboBoxVector.at(parentHierarchy.size() - 1)->getNumItems() == 2) {
167 myTagComboBoxVector.at(parentHierarchy.size() - 1)->hide();
168 }
169 // check if show children
170 auto comboBoxChildren = myTagComboBoxVector.at(parentHierarchy.size());
171 if (parentHierarchy.back()->getHierarchicalChildren().size() > 0) {
172 // clear previous elements
173 comboBoxChildren->clearItems();
174 // add <all> always as first element
175 comboBoxChildren->appendTagItem(myCurrentEditedProperties->getTagPropertiesAll());
176 for (const auto childTagProperty : parentHierarchy.back()->getHierarchicalChildren()) {
177 comboBoxChildren->appendTagItem(childTagProperty);
178 }
179 comboBoxChildren->show();
180 } else {
181 comboBoxChildren->hide();
182 }
183 // hide rest of combo boxes
184 for (size_t i = (parentHierarchy.size() + 1); i < myTagComboBoxVector.size(); i++) {
185 myTagComboBoxVector.at(i)->hide();
186 }
187 // now fill attributes
189 // get all children recursivelly
191 for (const auto& attribute : attributes) {
192 myAttributeComboBox->appendAttrItem(attribute.second);
193 }
194 // update tag
195 if (myAttributeComboBox->getNumItems() == 0) {
198 // set match string
199 myMatchString->setText("", FALSE);
200 myMatchString->disable();
201 } else {
205 } else {
206 myAttributeComboBox->setCurrentItem(attributes.begin()->second, FALSE);
208 }
209 // set match string
210 myMatchString->setText(myCurrentEditedProperties->getMatchValue().c_str(), FALSE);
211 myMatchString->enable();
212 }
213}
214
215
216long
217GNEMatchAttribute::onCmdTagSelected(FXObject* obj, FXSelector, void*) {
218 // iterate over all comboBoxes
219 int tagComboBoxIndex = 0;
220 for (int i = 0; i < (int)myTagComboBoxVector.size(); i++) {
221 if (myTagComboBoxVector.at(i) == obj) {
222 tagComboBoxIndex = i;
223 }
224 }
225 // check if tag property exist
226 if (myTagComboBoxVector.at(tagComboBoxIndex)->getCurrentTagProperty()) {
227 const auto selectedTag = myTagComboBoxVector.at(tagComboBoxIndex)->getCurrentTagProperty();
228 // if we select <all>, use parent tag
229 if (selectedTag == myCurrentEditedProperties->getTagPropertiesAll()) {
230 myCurrentEditedProperties->setTagProperties(myTagComboBoxVector.at(tagComboBoxIndex - 1)->getCurrentTagProperty());
231 } else {
233 }
235 }
236 return 0;
237}
238
239
240long
246
247
248long
249GNEMatchAttribute::onCmdToogleOnlyCommon(FXObject*, FXSelector, void*) {
250 // simply refresh attribute
252 return 1;
253}
254
255
256long
257GNEMatchAttribute::onCmdProcessString(FXObject*, FXSelector, void*) {
258 std::vector<GNEAttributeCarrier*> matches;
259 // obtain expresion
260 std::string expr = myMatchString->getText().text();
261 bool valid = true;
262 if (expr == "") {
263 // the empty expression matches all objects
264 matches = getMatches('@', 0, expr);
266 // The expression must have the form
267 // <val matches if attr < val
268 // >val matches if attr > val
269 // =val matches if attr = val
270 // val matches if attr = val
271 char compOp = expr[0];
272 if (compOp == '<' || compOp == '>' || compOp == '=') {
273 expr = expr.substr(1);
274 } else {
275 compOp = '=';
276 }
277 // check if value can be parsed to double
278 if (GNEAttributeCarrier::canParse<double>(expr.c_str())) {
279 matches = getMatches(compOp, GNEAttributeCarrier::parse<double>(expr.c_str()), expr);
280 } else {
281 valid = false;
282 }
283 } else {
284 // The expression must have the form
285 // =str: matches if <str> is an exact match
286 // !str: matches if <str> is not a substring
287 // ^str: matches if <str> is not an exact match
288 // str: matches if <str> is a substring (sends compOp '@')
289 // Alternatively, if the expression is empty it matches all objects
290 char compOp = expr[0];
291 if (compOp == '=' || compOp == '!' || compOp == '^') {
292 expr = expr.substr(1);
293 } else {
294 compOp = '@';
295 }
296 matches = getMatches(compOp, 0, expr);
297 }
298 if (valid) {
300 myMatchString->setTextColor(FXRGB(0, 0, 0));
301 myMatchString->killFocus();
302 } else {
303 myMatchString->setTextColor(FXRGB(255, 0, 0));
304 }
305 return 1;
306
307}
308
309
310long
311GNEMatchAttribute::onCmdHelp(FXObject*, FXSelector, void*) {
312 // Create dialog box
313 MFXDialogBox* additionalNeteditAttributesHelpDialog = new MFXDialogBox(getCollapsableFrame(), TL("Netedit Parameters Help"), GUIDesignDialogBox);
314 additionalNeteditAttributesHelpDialog->setIcon(GUIIconSubSys::getIcon(GUIIcon::MODEADDITIONAL));
315 // set help text
316 std::ostringstream help;
317 help
318 << TL("- The 'Match Attribute' controls allow to specify a set of objects which are then applied to the current selection\n")
319 << TL(" according to the current 'Modification Mode'.\n")
320 << TL(" 1. Select an object type from the first input box\n")
321 << TL(" 2. Select an attribute from the second input box\n")
322 << TL(" 3. Enter a 'match expression' in the third input box and press <return>\n")
323 << "\n"
324 << TL("- The empty expression matches all objects\n")
325 << TL("- For numerical attributes the match expression must consist of a comparison operator ('<', '>', '=') and a number.\n")
326 << TL("- An object matches if the comparison between its attribute and the given number by the given operator evaluates to 'true'\n")
327 << "\n"
328 << TL("- For string attributes the match expression must consist of a comparison operator ('', '=', '!', '^') and a string.\n")
329 << TL(" '' (no operator) matches if string is a substring of that object's attribute.\n")
330 << TL(" '=' matches if string is an exact match.\n")
331 << TL(" '!' matches if string is not a substring.\n")
332 << TL(" '^' matches if string is not an exact match.\n")
333 << "\n"
334 << TL("- Examples:\n")
335 << TL(" junction; id; 'foo' -> match all junctions that have 'foo' in their id\n")
336 << TL(" junction; type; '=priority' -> match all junctions of type 'priority', but not of type 'priority_stop'\n")
337 << TL(" edge; speed; '>10' -> match all edges with a speed above 10\n");
338 // Create label with the help text
339 new FXLabel(additionalNeteditAttributesHelpDialog, help.str().c_str(), nullptr, GUIDesignLabelFrameInformation);
340 // Create horizontal separator
341 new FXHorizontalSeparator(additionalNeteditAttributesHelpDialog, GUIDesignHorizontalSeparator);
342 // Create frame for OK Button
343 FXHorizontalFrame* myHorizontalFrameOKButton = new FXHorizontalFrame(additionalNeteditAttributesHelpDialog, GUIDesignAuxiliarHorizontalFrame);
344 // Create Button Close (And two more horizontal frames to center it)
345 new FXHorizontalFrame(myHorizontalFrameOKButton, GUIDesignAuxiliarHorizontalFrame);
346 GUIDesigns::buildFXButton(myHorizontalFrameOKButton, TL("OK"), "", TL("close"), GUIIconSubSys::getIcon(GUIIcon::ACCEPT), additionalNeteditAttributesHelpDialog, FXDialogBox::ID_ACCEPT, GUIDesignButtonOK);
347 new FXHorizontalFrame(myHorizontalFrameOKButton, GUIDesignAuxiliarHorizontalFrame);
348 // create Dialog
349 additionalNeteditAttributesHelpDialog->create();
350 // show in the given position
351 additionalNeteditAttributesHelpDialog->show(PLACEMENT_CURSOR);
352 // refresh APP
353 getApp()->refresh();
354 // open as modal dialog (will block all windows until stop() or stopModal() is called)
355 getApp()->runModalFor(additionalNeteditAttributesHelpDialog);
356 return 1;
357}
358
359
360std::vector<GNEAttributeCarrier*>
361GNEMatchAttribute::getMatches(const char compOp, const double val, const std::string& expr) {
362 std::vector<GNEAttributeCarrier*> result;
363 // first retrieve all ACs using ACTag
365 // iterate over all ACs
366 for (const auto& AC : allACbyTag) {
367 // first check if the attribute exist in the given tag
368 if (AC->getTagProperty()->hasAttribute(myCurrentEditedProperties->getAttributeProperties()->getAttr())) {
369 if (expr == "" && compOp == '@') {
370 result.push_back(AC);
372 double acVal;
373 std::istringstream buf(AC->getAttribute(myCurrentEditedProperties->getAttributeProperties()->getAttr()));
374 buf >> acVal;
375 switch (compOp) {
376 case '<':
377 if (acVal < val) {
378 result.push_back(AC);
379 }
380 break;
381 case '>':
382 if (acVal > val) {
383 result.push_back(AC);
384 }
385 break;
386 case '=':
387 if (acVal == val) {
388 result.push_back(AC);
389 }
390 break;
391 }
392 } else {
393 // string match
394 std::string acVal = AC->getAttributeForSelection(myCurrentEditedProperties->getAttributeProperties()->getAttr());
395 switch (compOp) {
396 case '@':
397 if (acVal.find(expr) != std::string::npos) {
398 result.push_back(AC);
399 }
400 break;
401 case '!':
402 if (acVal.find(expr) == std::string::npos) {
403 result.push_back(AC);
404 }
405 break;
406 case '=':
407 if (acVal == expr) {
408 result.push_back(AC);
409 }
410 break;
411 case '^':
412 if (acVal != expr) {
413 result.push_back(AC);
414 }
415 break;
416 }
417 }
418 }
419 }
420 return result;
421}
422
423
424std::vector<GNEAttributeCarrier*>
425GNEMatchAttribute::getGenericMatches(const std::vector<GNEGenericData*>& genericDatas, const std::string& attr, const char compOp, const double val, const std::string& expr) {
426 std::vector<GNEAttributeCarrier*> result;
427 // iterate over generic datas
428 for (const auto& genericData : genericDatas) {
429 if (expr == "" && compOp == '@') {
430 result.push_back(genericData);
431 } else if (attr != toString(GNE_ATTR_PARENT)) {
432 double acVal;
433 std::istringstream buf(genericData->getParameter(attr, "0"));
434 buf >> acVal;
435 switch (compOp) {
436 case '<':
437 if (acVal < val) {
438 result.push_back(genericData);
439 }
440 break;
441 case '>':
442 if (acVal > val) {
443 result.push_back(genericData);
444 }
445 break;
446 case '=':
447 if (acVal == val) {
448 result.push_back(genericData);
449 }
450 break;
451 }
452 } else {
453 // string match
454 std::string acVal = genericData->getAttributeForSelection(GNE_ATTR_PARENT);
455 switch (compOp) {
456 case '@':
457 if (acVal.find(expr) != std::string::npos) {
458 result.push_back(genericData);
459 }
460 break;
461 case '!':
462 if (acVal.find(expr) == std::string::npos) {
463 result.push_back(genericData);
464 }
465 break;
466 case '=':
467 if (acVal == expr) {
468 result.push_back(genericData);
469 }
470 break;
471 case '^':
472 if (acVal != expr) {
473 result.push_back(genericData);
474 }
475 break;
476 }
477 }
478 }
479 return result;
480}
481
482// ---------------------------------------------------------------------1------
483// GNEMatchAttribute::CurrentEditedProperties - methods
484// ---------------------------------------------------------------------------
485
487 myMatchAttributeParent(matchAttributeParent) {
488 // build special attributes
490 nullptr,
492 TL("Show all attributes"),
493 FXRGBA(255, 255, 255, 255),
494 TL("<all>"));
497 TL("No common attributes defined"));
498 // set default tag and attribute for every property
500 setTagProperties(database->getTagProperty(SUMO_TAG_EDGE, true));
501 setAttributeProperties(myNetworkTagProperties.back()->getAttributeProperties(SUMO_ATTR_SPEED));
502 myNetworkMatchValue = ">10";
503 setTagProperties(database->getTagProperty(SUMO_TAG_VEHICLE, true));
504 setAttributeProperties(myDemandTagProperties.back()->getAttributeProperties(SUMO_ATTR_ID));
505 setTagProperties(database->getTagProperty(GNE_TAG_DATAS, true));
506}
507
508
510 delete myTagPropertiesAllAttributes;
511}
512
513
514const GNETagProperties*
516 return myTagPropertiesAllAttributes;
517}
518
519
522 return myAttributePropertiesNoCommon;
523}
524
525
526const GNETagProperties*
528 if (myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeNetwork()) {
529 return myNetworkTagProperties.back();
530 } else if (myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
531 return myDemandTagProperties.back();
532 } else if (myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeData()) {
533 return myDataTagProperties.back();
534 } else {
535 throw ProcessError("Invalid supermode");
536 }
537}
538
539
542 if (myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeNetwork()) {
543 return myNetworkAttributeProperties;
544 } else if (myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
545 return myDemandAttributeProperties;
546 } else if (myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeData()) {
547 return myDataAttributeProperties;
548 } else {
549 throw ProcessError("Invalid supermode");
550 }
551}
552
553
554const std::string&
556 if (myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeNetwork()) {
557 return myNetworkMatchValue;
558 } else if (myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
559 return myDemandMatchValue;
560 } else if (myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeData()) {
561 return myDataMatchValue;
562 } else {
563 throw ProcessError("Invalid supermode");
564 }
565}
566
567
568void
570 if (tagProperty->getSupermode() == Supermode::NETWORK) {
571 myNetworkTagProperties = tagProperty->getHierarchicalParentsRecuersively();
572 } else if (tagProperty->getSupermode() == Supermode::DEMAND) {
573 myDemandTagProperties = tagProperty->getHierarchicalParentsRecuersively();
574 } else if (tagProperty->getSupermode() == Supermode::DATA) {
575 myDataTagProperties = tagProperty->getHierarchicalParentsRecuersively();
576 }
577}
578
579
580void
582 if (attrProperty->getTagPropertyParent()->getSupermode() == Supermode::NETWORK) {
583 myNetworkAttributeProperties = attrProperty;
584 } else if (attrProperty->getTagPropertyParent()->getSupermode() == Supermode::DEMAND) {
585 myDemandAttributeProperties = attrProperty;
586 } else if (attrProperty->getTagPropertyParent()->getSupermode() == Supermode::DATA) {
587 myDataAttributeProperties = attrProperty;
588 }
589}
590
591
592void
594 if (myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeNetwork()) {
595 myNetworkMatchValue = value;
596 } else if (myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
597 myDemandMatchValue = value;
598 } else if (myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeData()) {
599 myDataMatchValue = value;
600 }
601}
602
603/****************************************************************************/
FXDEFMAP(GNEMatchAttribute) GNEMatchAttributeMap[]
@ NETWORK
Network mode (Edges, junctions, etc..)
@ DATA
Data mode (edgeData, LaneData etc..)
@ DEMAND
Demand mode (Routes, Vehicles etc..)
@ MID_GNE_SELECTORFRAME_SELECTATTRIBUTE
select attribute in selector frame
@ MID_GNE_SELECTORFRAME_SELECTTAG
select tag in selector frame
@ MID_HELP
help button
Definition GUIAppEnum.h:653
@ MID_GNE_SELECTORFRAME_PROCESSSTRING
process string
@ MID_GNE_SELECTORFRAME_TOGGLECOMMON
toogle only show common
#define GUIDesignButton
Definition GUIDesigns.h:82
#define GUIDesignComboBox
Definition GUIDesigns.h:293
#define GUIDesignComboBoxNCol
number of column of every combo box
Definition GUIDesigns.h:311
#define GUIDesignTextField
Definition GUIDesigns.h:59
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition GUIDesigns.h:399
#define GUIDesignDialogBox
Definition GUIDesigns.h:599
#define GUIDesignButtonRectangular
little rectangular button used in frames (For example, in "help" buttons)
Definition GUIDesigns.h:94
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition GUIDesigns.h:74
#define GUIDesignButtonOK
Definition GUIDesigns.h:153
#define GUIDesignComboBoxVisibleItems
Definition GUIDesigns.h:49
#define GUIDesignCheckButton
checkButton placed in left position
Definition GUIDesigns.h:192
#define GUIDesignHorizontalSeparator
Definition GUIDesigns.h:463
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition GUIDesigns.h:279
@ MODEADDITIONAL
#define TL(string)
Definition MsgHandler.h:305
@ SUMO_TAG_VEHICLE
description of a vehicle
@ GNE_TAG_ATTRIBUTES_ALL
@ GNE_TAG_DATAS
@ SUMO_TAG_EDGE
begin/end of the description of an edge
@ GNE_ATTR_NOCOMMON
no common attributes
@ SUMO_ATTR_SPEED
@ GNE_ATTR_PARENT
parent of an additional element
@ SUMO_ATTR_ID
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
bool isNumerical() const
return true if attribute is numerical (int or float)
const GNETagProperties * getTagPropertyParent() const
get reference to tagProperty parent
SumoXMLAttr getAttr() const
get XML Attribute
GNEViewNet * getViewNet() const
get view net
Definition GNEFrame.cpp:155
container with current edited properties
CurrentEditedProperties()=delete
default constructor
std::vector< const GNETagProperties * > myDemandTagProperties
current demand tag properties
const GNEAttributeProperties * getAttributePropertiesNoCommon() const
get attr properties no common
std::vector< const GNETagProperties * > myNetworkTagProperties
current network tag properties
std::string myNetworkMatchValue
current network match value
GNETagProperties * myTagPropertiesAllAttributes
tag properties <all>
void setTagProperties(const GNETagProperties *tagProperty)
set tag property (depending of supermode)
const std::string & getMatchValue() const
get match value (depending of supermode)
const GNETagProperties * getTagPropertiesAll() const
get special tag <all>
void setAttributeProperties(const GNEAttributeProperties *attrProperty)
set attribute property (depending of supermode)
const GNEMatchAttribute * myMatchAttributeParent
pointer to match attribute parent
const GNEAttributeProperties * myAttributePropertiesNoCommon
attribute properties no common
const GNETagProperties * getTagProperties() const
get tag property (depending of supermode)
void setMatchValue(const std::string value)
set match value (depending of supermode)
const GNEAttributeProperties * getAttributeProperties() const
get attribute property (depending of supermode)
CurrentEditedProperties * myCurrentEditedProperties
current edited properties
~GNEMatchAttribute()
destructor
FXButton * myMatchStringButton
match string button
long onCmdAttributeSelected(FXObject *, FXSelector, void *)
Called when the user selects an attribute in the match box.
void showMatchAttribute()
show match attributes
std::vector< MFXComboBoxTagProperty * > myTagComboBoxVector
vector with tag property comboBoxes
std::vector< GNEAttributeCarrier * > getGenericMatches(const std::vector< GNEGenericData * > &genericDatas, const std::string &attr, const char compOp, const double val, const std::string &expr)
return GenericDatas of the given type with matching attrs
long onCmdProcessString(FXObject *, FXSelector, void *)
Called when the user enters a new selection expression.
GNESelectorFrame * mySelectorFrameParent
pointer to selector frame parent
long onCmdToogleOnlyCommon(FXObject *, FXSelector, void *)
Called when the user toogle the only common checkbox.
long onCmdTagSelected(FXObject *obj, FXSelector, void *)
Called when the user selects a tag in the match box.
FXTextField * myMatchString
string of the match
void hideMatchAttribute()
hide match attributes
FXCheckButton * myShowOnlyCommonAttributes
checkbox for enable/disable show only common attributes
long onCmdHelp(FXObject *, FXSelector, void *)
Called when the user clicks the help button.
void refreshMatchAttribute()
refresh match attribute
std::vector< GNEAttributeCarrier * > getMatches(const char compOp, const double val, const std::string &expr)
FOX need this.
void enableMatchAttribute()
enable match attributes
void disableMatchAttribute()
disable match attributes
MFXComboBoxAttrProperty * myAttributeComboBox
attribute property comboBox
GNEMatchAttribute(GNESelectorFrame *selectorFrameParent)
FOX-declaration.
std::vector< GNEAttributeCarrier * > retrieveAttributeCarriers(SumoXMLTag tag=SUMO_TAG_NOTHING)
get the attribute carriers based on Type
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:147
const GNETagPropertiesDatabase * getTagPropertiesDatabase() const
get tag properties database
Definition GNENet.cpp:141
void handleIDs(const std::vector< GNEAttributeCarrier * > &ACs, const ModificationMode::Operation setop=ModificationMode::Operation::DEFAULT)
apply list of ids to the current selection according to Operation,
std::map< std::string, const GNEAttributeProperties * > getHierarchicalChildrenAttributesRecursively(const bool onlyCommon, const bool onlyDrawables) const
get all children attributes sorted by name (Including this)
const std::vector< const GNETagProperties * > getHierarchicalParentsRecuersively() const
get all parents, beginning from current element (root not included) untils this element
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
Supermode getSupermode() const
get supermode associated with this tag
GNENet * getNet() const
get the net object
static FXButton * buildFXButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXObject *tgt, FXSelector sel, FXuint opts=BUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build button
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
void clearItems()
Remove all items from the list.
bool hasAttrProperty(const GNEAttributeProperties *attrProperties)
check if the given attribute exist in comboBox
FXint appendAttrItem(const GNEAttributeProperties *attrProperties, FXColor bgColor=FXRGB(255, 255, 255), void *ptr=nullptr)
append item
long setCurrentItem(const GNEAttributeProperties *attrProperties, FXbool notify=FALSE)
Set the current item.
const GNEAttributeProperties * getCurrentAttrProperty() const
get current attribute property
FXint getNumItems() const
Return the number of items in the list.
void setTextColor(FXColor clr)
Change text color.
void disable()
Disable combo box.
void enable()
Enable combo box.
MFXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)