58#pragma warning(disable: 4355)
62 mySelectorFrameParent(selectorFrameParent),
65 for (
int i = 0; i < selectorFrameParent->
getViewNet()->getNet()->getTagPropertiesDatabase()->getHierarchyDepth() + 1; i++) {
96 tagComboBox->enable();
107 tagComboBox->disable();
108 tagComboBox->setTextColor(FXRGB(0, 0, 0));
140 for (
size_t i = 0; i < parentHierarchy.size(); i++) {
143 comboBox->clearItems();
147 if (parentHierarchy.at(i)->getHierarchicalParent()) {
148 for (
const auto tagSibling : parentHierarchy.at(i)->getHierarchicalParent()->getHierarchicalChildren()) {
149 if (tagSibling->isDrawable()) {
171 if (parentHierarchy.back()->getHierarchicalChildren().size() > 0) {
173 comboBoxChildren->clearItems();
176 for (
const auto childTagProperty : parentHierarchy.back()->getHierarchicalChildren()) {
177 comboBoxChildren->appendTagItem(childTagProperty);
179 comboBoxChildren->show();
181 comboBoxChildren->hide();
191 for (
const auto& attribute : attributes) {
219 int tagComboBoxIndex = 0;
222 tagComboBoxIndex = i;
227 const auto selectedTag =
myTagComboBoxVector.at(tagComboBoxIndex)->getCurrentTagProperty();
258 std::vector<GNEAttributeCarrier*> matches;
271 char compOp = expr[0];
272 if (compOp ==
'<' || compOp ==
'>' || compOp ==
'=') {
273 expr = expr.substr(1);
278 if (GNEAttributeCarrier::canParse<double>(expr.c_str())) {
279 matches =
getMatches(compOp, GNEAttributeCarrier::parse<double>(expr.c_str()), expr);
290 char compOp = expr[0];
291 if (compOp ==
'=' || compOp ==
'!' || compOp ==
'^') {
292 expr = expr.substr(1);
316 std::ostringstream 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")
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")
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")
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");
349 additionalNeteditAttributesHelpDialog->create();
351 additionalNeteditAttributesHelpDialog->show(PLACEMENT_CURSOR);
355 getApp()->runModalFor(additionalNeteditAttributesHelpDialog);
360std::vector<GNEAttributeCarrier*>
362 std::vector<GNEAttributeCarrier*> result;
366 for (
const auto& AC : allACbyTag) {
369 if (expr ==
"" && compOp ==
'@') {
370 result.push_back(AC);
378 result.push_back(AC);
383 result.push_back(AC);
388 result.push_back(AC);
397 if (acVal.find(expr) != std::string::npos) {
398 result.push_back(AC);
402 if (acVal.find(expr) == std::string::npos) {
403 result.push_back(AC);
408 result.push_back(AC);
413 result.push_back(AC);
424std::vector<GNEAttributeCarrier*>
426 std::vector<GNEAttributeCarrier*> result;
428 for (
const auto& genericData : genericDatas) {
429 if (expr ==
"" && compOp ==
'@') {
430 result.push_back(genericData);
433 std::istringstream buf(genericData->getParameter(attr,
"0"));
438 result.push_back(genericData);
443 result.push_back(genericData);
448 result.push_back(genericData);
454 std::string acVal = genericData->getAttributeForSelection(
GNE_ATTR_PARENT);
457 if (acVal.find(expr) != std::string::npos) {
458 result.push_back(genericData);
462 if (acVal.find(expr) == std::string::npos) {
463 result.push_back(genericData);
468 result.push_back(genericData);
473 result.push_back(genericData);
487 myMatchAttributeParent(matchAttributeParent) {
492 TL(
"Show all attributes"),
493 FXRGBA(255, 255, 255, 255),
497 TL(
"No common attributes defined"));
510 delete myTagPropertiesAllAttributes;
516 return myTagPropertiesAllAttributes;
522 return myAttributePropertiesNoCommon;
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();
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;
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;
583 myNetworkAttributeProperties = attrProperty;
585 myDemandAttributeProperties = attrProperty;
587 myDataAttributeProperties = attrProperty;
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;
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_GNE_SELECTORFRAME_PROCESSSTRING
process string
@ MID_GNE_SELECTORFRAME_TOGGLECOMMON
toogle only show common
#define GUIDesignComboBox
#define GUIDesignComboBoxNCol
number of column of every combo box
#define GUIDesignTextField
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
#define GUIDesignDialogBox
#define GUIDesignButtonRectangular
little rectangular button used in frames (For example, in "help" buttons)
#define GUIDesignTextFieldNCol
Num of column of text field.
#define GUIDesignButtonOK
#define GUIDesignComboBoxVisibleItems
#define GUIDesignCheckButton
checkButton placed in left position
#define GUIDesignHorizontalSeparator
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
@ SUMO_TAG_VEHICLE
description of a vehicle
@ SUMO_TAG_EDGE
begin/end of the description of an edge
@ GNE_ATTR_NOCOMMON
no common attributes
@ GNE_ATTR_PARENT
parent of an additional element
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
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
container with current edited properties
CurrentEditedProperties()=delete
default constructor
~CurrentEditedProperties()
destructor
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
const GNETagPropertiesDatabase * getTagPropertiesDatabase() const
get tag properties database
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)