61#pragma warning(disable: 4355)
65 mySelectorFrameParent(selectorFrameParent),
69 for (
int i = 0; i < selectorFrameParent->
getViewNet()->getNet()->getTagPropertiesDatabase()->getHierarchyDepth() + 1; i++) {
100 tagComboBox->enable();
111 tagComboBox->disable();
144 for (
size_t i = 0; i < parentHierarchy.size(); i++) {
147 comboBox->clearItems();
151 if (parentHierarchy.at(i)->getHierarchicalParent()) {
152 for (
const auto tagSibling : parentHierarchy.at(i)->getHierarchicalParent()->getHierarchicalChildren()) {
153 if (tagSibling->isDrawable()) {
175 if (parentHierarchy.back()->getHierarchicalChildren().size() > 0) {
177 comboBoxChildren->clearItems();
180 for (
const auto childTagProperty : parentHierarchy.back()->getHierarchicalChildren()) {
181 comboBoxChildren->appendTagItem(childTagProperty);
183 comboBoxChildren->show();
185 comboBoxChildren->hide();
195 for (
const auto& attribute : attributes) {
223 int tagComboBoxIndex = 0;
226 tagComboBoxIndex = i;
231 const auto selectedTag =
myTagComboBoxVector.at(tagComboBoxIndex)->getCurrentTagProperty();
262 std::vector<GNEAttributeCarrier*> matches;
275 char compOp = expr[0];
276 if (compOp ==
'<' || compOp ==
'>' || compOp ==
'=') {
277 expr = expr.substr(1);
282 if (GNEAttributeCarrier::canParse<double>(expr.c_str())) {
283 matches =
getMatches(compOp, GNEAttributeCarrier::parse<double>(expr.c_str()), expr);
294 char compOp = expr[0];
295 if (compOp ==
'=' || compOp ==
'!' || compOp ==
'^') {
296 expr = expr.substr(1);
317 std::ostringstream help;
319 <<
TL(
"- The 'Match Attribute' controls allow to specify a set of objects which are then applied to the current selection") <<
"\n"
320 <<
TL(
" according to the current 'Modification Mode'.") <<
"\n"
321 <<
TL(
" 1. Select an object type from the first input box") <<
"\n"
322 <<
TL(
" 2. Select an attribute from the second input box") <<
"\n"
323 <<
TL(
" 3. Enter a 'match expression' in the third input box and press <return>") <<
"\n"
325 <<
TL(
"- The empty expression matches all objects") <<
"\n"
326 <<
TL(
"- For numerical attributes the match expression must consist of a comparison operator ('<', '>', '=') and a number.") <<
"\n"
327 <<
TL(
"- An object matches if the comparison between its attribute and the given number by the given operator evaluates to 'true'") <<
"\n"
329 <<
TL(
"- For string attributes the match expression must consist of a comparison operator ('', '=', '!', '^') and a string.") <<
"\n"
330 <<
TL(
" '' (no operator) matches if string is a substring of that object's attribute.") <<
"\n"
331 <<
TL(
" '=' matches if string is an exact match.") <<
"\n"
332 <<
TL(
" '!' matches if string is not a substring.") <<
"\n"
333 <<
TL(
" '^' matches if string is not an exact match.") <<
"\n"
336 <<
TL(
" junction; id; 'foo' -> match all junctions that have 'foo' in their id") <<
"\n"
337 <<
TL(
" junction; type; '=priority' -> match all junctions of type 'priority', but not of type 'priority_stop'") <<
"\n"
338 <<
TL(
" edge; speed; '>10' -> match all edges with a speed above 10");
341 TL(
"Netedit parameters Help"), help);
346std::vector<GNEAttributeCarrier*>
348 std::vector<GNEAttributeCarrier*> result;
352 for (
const auto& AC : allACbyTag) {
355 if (expr ==
"" && compOp ==
'@') {
356 result.push_back(AC);
364 result.push_back(AC);
369 result.push_back(AC);
374 result.push_back(AC);
383 if (acVal.find(expr) != std::string::npos) {
384 result.push_back(AC);
388 if (acVal.find(expr) == std::string::npos) {
389 result.push_back(AC);
394 result.push_back(AC);
399 result.push_back(AC);
410std::vector<GNEAttributeCarrier*>
412 std::vector<GNEAttributeCarrier*> result;
414 for (
const auto& genericData : genericDatas) {
415 if (expr ==
"" && compOp ==
'@') {
416 result.push_back(genericData);
419 std::istringstream buf(genericData->getParameter(attr,
"0"));
424 result.push_back(genericData);
429 result.push_back(genericData);
434 result.push_back(genericData);
440 std::string acVal = genericData->getAttributeForSelection(
GNE_ATTR_PARENT);
443 if (acVal.find(expr) != std::string::npos) {
444 result.push_back(genericData);
448 if (acVal.find(expr) == std::string::npos) {
449 result.push_back(genericData);
454 result.push_back(genericData);
459 result.push_back(genericData);
473 myMatchAttributeParent(matchAttributeParent) {
478 TL(
"Show all attributes"),
479 FXRGBA(255, 255, 255, 255),
483 TL(
"No common attributes defined"));
496 delete myTagPropertiesAllAttributes;
502 return myTagPropertiesAllAttributes;
508 return myAttributePropertiesNoCommon;
514 if (myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeNetwork()) {
515 return myNetworkTagProperties.back();
516 }
else if (myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
517 return myDemandTagProperties.back();
518 }
else if (myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeData()) {
519 return myDataTagProperties.back();
528 if (myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeNetwork()) {
529 return myNetworkAttributeProperties;
530 }
else if (myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
531 return myDemandAttributeProperties;
532 }
else if (myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeData()) {
533 return myDataAttributeProperties;
542 if (myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeNetwork()) {
543 return myNetworkMatchValue;
544 }
else if (myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
545 return myDemandMatchValue;
546 }
else if (myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeData()) {
547 return myDataMatchValue;
569 myNetworkAttributeProperties = attrProperty;
571 myDemandAttributeProperties = attrProperty;
573 myDataAttributeProperties = attrProperty;
580 if (myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeNetwork()) {
581 myNetworkMatchValue = value;
582 }
else if (myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
583 myDemandMatchValue = value;
584 }
else if (myMatchAttributeParent->mySelectorFrameParent->getViewNet()->getEditModes().isCurrentSupermodeData()) {
585 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 GUIDesignTextColorRed
red color (for invalid text)
#define GUIDesignComboBox
#define GUIDesignTextField
#define GUIDesignButtonRectangular
little rectangular button used in frames (For example, in "help" buttons)
#define GUIDesignTextFieldNCol
Num of column of text field.
#define GUIDesignComboBoxVisibleItems
#define GUIDesignTextColorBlack
black color (for correct text)
#define GUIDesignCheckButton
checkButton placed in left position
@ 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
GNEViewParent * getViewParent() const
get the net object
GNEApplicationWindow * getGNEAppWindows() const
get GNE Application Windows
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
MFXStaticToolTip * getStaticTooltipMenu() const
get static toolTip for menus
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)