48 myElementSet(elementSet),
49 myCurrentTag(defaultTag),
50 myCurrentAttribute(defaultAttr) {
64 myMatchString->setText(defaultValue.c_str());
100 std::vector<GNETagProperties> tagPropertiesStrings;
118 for (
const auto& tagProperty : tagPropertiesStrings) {
119 if (tagProperty.isDrawable() && (!tagProperty.requireProj() || proj)) {
171 tagPropertiesCopy.addAttribute(extraAttrProperty);
173 if (tagValue.canCloseShape()) {
179 tagPropertiesCopy.addAttribute(extraAttrProperty);
182 if (tagValue.isChild()) {
187 tagPropertiesCopy.addAttribute(extraAttrProperty);
191 for (
const auto& attribute : tagPropertiesCopy) {
225 char compOp = expr[0];
226 if (compOp ==
'<' || compOp ==
'>' || compOp ==
'=') {
227 expr = expr.substr(1);
232 if (GNEAttributeCarrier::canParse<double>(expr.c_str())) {
244 char compOp = expr[0];
245 if (compOp ==
'=' || compOp ==
'!' || compOp ==
'^') {
246 expr = expr.substr(1);
270 std::ostringstream help;
272 <<
TL(
"- The 'Match Attribute' controls allow to specify a set of objects which are then applied to the current selection\n")
273 <<
TL(
" according to the current 'Modification Mode'.\n")
274 <<
TL(
" 1. Select an object type from the first input box\n")
275 <<
TL(
" 2. Select an attribute from the second input box\n")
276 <<
TL(
" 3. Enter a 'match expression' in the third input box and press <return>\n")
278 <<
TL(
"- The empty expression matches all objects\n")
279 <<
TL(
"- For numerical attributes the match expression must consist of a comparison operator ('<', '>', '=') and a number.\n")
280 <<
TL(
"- An object matches if the comparison between its attribute and the given number by the given operator evaluates to 'true'\n")
282 <<
TL(
"- For string attributes the match expression must consist of a comparison operator ('', '=', '!', '^') and a string.\n")
283 <<
TL(
" '' (no operator) matches if string is a substring of that object's attribute.\n")
284 <<
TL(
" '=' matches if string is an exact match.\n")
285 <<
TL(
" '!' matches if string is not a substring.\n")
286 <<
TL(
" '^' matches if string is not an exact match.\n")
288 <<
TL(
"- Examples:\n")
289 <<
TL(
" junction; id; 'foo' -> match all junctions that have 'foo' in their id\n")
290 <<
TL(
" junction; type; '=priority' -> match all junctions of type 'priority', but not of type 'priority_stop'\n")
291 <<
TL(
" edge; speed; '>10' -> match all edges with a speed above 10\n");
303 WRITE_DEBUG(
"Opening help dialog of selector frame");
305 additionalNeteditAttributesHelpDialog->create();
307 additionalNeteditAttributesHelpDialog->show(PLACEMENT_CURSOR);
311 getApp()->runModalFor(additionalNeteditAttributesHelpDialog);
313 WRITE_DEBUG(
"Close help dialog of selector frame");
335 if (tagIndex == -1) {
357 for (
int i = 0; i < (int)tagProperty.getNumberOfAttributes(); i++) {
365 if (tagProperty.hasParameters()) {
372 if (tagProperty.canCloseShape()) {
379 if (tagProperty.isChild()) {
386 if (attrIndex == -1) {
388 if (tagProperty.getNumberOfAttributes() > 0) {
FXDEFMAP(GNEMatchAttribute) GNEMatchAttributeMap[]
@ MID_GNE_SELECTORFRAME_SELECTATTRIBUTE
select attribute in selector frame
@ MID_GNE_SELECTORFRAME_SELECTTAG
select tag in selector frame
@ MID_GNE_SELECTORFRAME_PROCESSSTRING
process string
#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 GUIDesignHorizontalSeparator
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_NOTHING
invalid tag, must be the last one
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ GNE_ATTR_PARENT
parent of an additional element
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ GNE_ATTR_CLOSE_SHAPE
Close shape of a polygon (Used by GNEPolys)
@ SUMO_ATTR_NOTHING
invalid attribute, must be the last one
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static const std::vector< GNETagProperties > getTagPropertiesByType(const int tagPropertyCategory, const bool mergeCommonPlans)
get tagProperties associated to the given GNETagProperties::TagType (NETWORKELEMENT,...
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
GNESelectorFrame * getSelectorFrameParent() const
get Selector Frame Parent
void showMatchAttribute(const GNEElementSet::Type type)
show match attributes
~GNEMatchAttribute()
destructor
MFXComboBoxIcon * myMatchAttrComboBox
attributes of the match box
FXButton * myMatchStringButton
match string button
SumoXMLAttr myCurrentAttribute
current SumoXMLTag Attribute
GNEElementSet * myElementSet
pointer to element set Parent
MFXComboBoxIcon * myMatchTagComboBox
tag of the match box
void updateTag()
FOX need this.
std::vector< GNETagProperties > myTagPropertiesString
vector with tagProperties
void updateAttribute()
update attribute
FXTextField * myMatchString
string of the match
void hideMatchAttribute()
hide match attributes
long onCmdSelMBTag(FXObject *, FXSelector, void *)
Called when the user selectes a tag in the match box.
long onCmdHelp(FXObject *, FXSelector, void *)
Called when the user clicks the help button.
long onCmdSelMBString(FXObject *, FXSelector, void *)
Called when the user enters a new selection expression.
long onCmdSelMBAttribute(FXObject *, FXSelector, void *)
Called when the user selectes a tag in the match box.
void enableMatchAttribute()
enable match attributes
void disableMatchAttribute()
disable match attributes
SumoXMLTag myCurrentTag
current SumoXMLTag tag
std::vector< GNEAttributeCarrier * > getMatches(const SumoXMLTag ACTag, const SumoXMLAttr ACAttr, const char compOp, const double val, const std::string &expr)
return ACs of the given type with matching attrs
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,
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
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
const std::string & getProjString() const
Returns the original projection definition.
long setCurrentItem(const FXint index, FXbool notify=FALSE)
Set the current item (index is zero-based)
FXint getNumItems() const
Return the number of items in the list.
FXString getText() const
Get the text.
void setTextColor(FXColor clr)
Change text color.
void clearItems()
Remove all items from the list.
void disable()
Disable combo box.
FXint appendIconItem(const FXString &text, FXIcon *icon=nullptr, FXColor bgColor=FXRGB(255, 255, 255), void *ptr=nullptr)
append icon item in the last position
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)