53 FXGroupBoxModule(elementSet->getSelectorFrameParent()->getContentFrame(), "Match GenericData Attribute"),
54 myElementSet(elementSet),
55 myIntervalSelector(
nullptr),
58 myMatchGenericDataTagComboBox(
nullptr),
59 myMatchGenericDataAttrComboBox(
nullptr),
60 myCurrentTag(defaultTag),
61 myCurrentAttribute(
toString(defaultAttr)),
62 myMatchGenericDataString(
nullptr) {
79 enableMatchGenericDataAttribute();
81 myMatchGenericDataAttrComboBox->setText(
"speed");
84 myMatchGenericDataString->setText(defaultValue.c_str());
97 for (
const auto& dataInterval : dataSet->getDataIntervalChildren()) {
128 myBegin->setTextColor(FXRGB(0, 0, 0));
130 myEnd->setTextColor(FXRGB(0, 0, 0));
134 for (
const auto& genericDataTag : genericDataTags) {
135 if (genericDataTag.isDrawable()) {
184 myBegin->setTextColor(FXRGB(0, 0, 0));
187 myEnd->setTextColor(FXRGB(0, 0, 0));
200 if (GNEAttributeCarrier::canParse<double>(
myBegin->getText().text()) &&
201 GNEAttributeCarrier::canParse<double>(
myEnd->getText().text())) {
203 myBegin->setTextColor(FXRGB(0, 0, 0));
213 myBegin->setTextColor(FXRGB(255, 0, 0));
226 if (GNEAttributeCarrier::canParse<double>(
myBegin->getText().text()) &&
227 GNEAttributeCarrier::canParse<double>(
myEnd->getText().text())) {
229 myEnd->setTextColor(FXRGB(0, 0, 0));
239 myEnd->setTextColor(FXRGB(255, 0, 0));
256 for (
const auto& genericDataTag : listOfTags) {
264 const double begin = GNEAttributeCarrier::parse<double>(
myBegin->getText().text());
265 const double end = GNEAttributeCarrier::parse<double>(
myEnd->getText().text());
276 for (
const auto& attribute : attributes) {
297 GNEAttributeCarrier::parse<double>(
myEnd->getText().text()));
303 for (
const auto& attribute : attributes) {
327 GNEAttributeCarrier::parse<double>(
myBegin->getText().text()),
328 GNEAttributeCarrier::parse<double>(
myEnd->getText().text()));
329 if (expression ==
"") {
338 char compOp = expression[0];
339 if ((compOp ==
'<') || (compOp ==
'>') || (compOp ==
'=')) {
340 expression = expression.substr(1);
345 if (GNEAttributeCarrier::canParse<double>(expression.c_str())) {
357 char compOp = expression[0];
358 if ((compOp ==
'=') || (compOp ==
'!') || (compOp ==
'^')) {
359 expression = expression.substr(1);
382 std::ostringstream help;
384 <<
"- The 'MatchGenericData Attribute' controls allow to specify a set of objects which are then applied to the current selection\n"
385 <<
" according to the current 'Modification Mode'.\n"
386 <<
" 1. Select an object type from the first input box\n"
387 <<
" 2. Select an attribute from the second input box\n"
388 <<
" 3. Enter a 'match expression' in the third input box and press <return>\n"
390 <<
"- The empty expression matches all objects\n"
391 <<
"- For numerical attributes the match expression must consist of a comparison operator ('<', '>', '=') and a number.\n"
392 <<
"- An object matches if the comparison between its attribute and the given number by the given operator evaluates to 'true'\n"
394 <<
"- For string attributes the match expression must consist of a comparison operator ('', '=', '!', '^') and a string.\n"
395 <<
" '' (no operator) matches if string is a substring of that object'ts attribute.\n"
396 <<
" '=' matches if string is an exact match.\n"
397 <<
" '!' matches if string is not a substring.\n"
398 <<
" '^' matches if string is not an exact match.\n"
401 <<
" junction; id; 'foo' -> match all junctions that have 'foo' in their id\n"
402 <<
" junction; type; '=priority' -> match all junctions of type 'priority', but not of type 'priority_stop'\n"
403 <<
" edge; speed; '>10' -> match all edges with a speed above 10\n";
415 WRITE_DEBUG(
"Opening help dialog of selector frame");
417 additionalNeteditAttributesHelpDialog->create();
419 additionalNeteditAttributesHelpDialog->show(PLACEMENT_CURSOR);
423 getApp()->runModalFor(additionalNeteditAttributesHelpDialog);
425 WRITE_DEBUG(
"Close help dialog of selector frame");
FXDEFMAP(GNEMatchGenericDataAttribute) GNEMatchGenericDataAttributeMap[]
@ MID_GNE_SELECTORFRAME_SETINTERVAL
change interval
@ MID_GNE_SELECTORFRAME_SELECTATTRIBUTE
select attribute in selector frame
@ MID_GNE_SELECTORFRAME_SETEND
end text field
@ MID_GNE_SELECTORFRAME_SELECTTAG
select tag in selector frame
@ MID_GNE_SELECTORFRAME_SETBEGIN
edit begin text field
@ 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 button rectangula used in frames (For example, in "help" buttons)
#define GUIDesignComboBoxStaticExtended
Combo box static (not editable) extended over the all frame.
#define GUIDesignTextFieldNCol
Num of column of text field.
#define GUIDesignButtonOK
#define GUIDesignHorizontalSeparator
#define GUIDesignLabelThick
label extended over frame with thick and with text justify to left
#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
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_END
weights: time range end
@ GNE_ATTR_DATASET
data set of a generic data
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
FXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toogled)
static const std::vector< GNETagProperties > getTagPropertiesByType(const int tagPropertyCategory)
get tagProperties associated to the given GNETagProperties::TagType (NETWORKELEMENT,...
GNESelectorFrame * getSelectorFrameParent() const
get Selector Frame Parent
GNEViewNet * getViewNet() const
get view net
long onCmdHelp(FXObject *, FXSelector, void *)
Called when the user clicks the help button.
long onCmdSetBegin(FXObject *, FXSelector, void *)
Called when the user change begin text field.
void disableMatchGenericDataAttribute()
disable match attributes
SumoXMLTag myCurrentTag
current SumoXMLTag tag
void enableMatchGenericDataAttribute()
enable match attributes
void hideMatchGenericDataAttribute()
hide match attributes
long onCmdSetInterval(FXObject *, FXSelector, void *)
Called when the user selects an interval.
FXComboBox * myMatchGenericDataAttrComboBox
attributes of the match box
std::string myCurrentAttribute
current string Attribute
GNEElementSet * myElementSet
FOX need this.
FXTextField * myEnd
TextField for end.
FXTextField * myMatchGenericDataString
string of the match
MFXIconComboBox * myIntervalSelector
tag of the match box
long onCmdSelectTag(FXObject *, FXSelector, void *)
Called when the user selects a tag in the match box.
~GNEMatchGenericDataAttribute()
destructor
void showMatchGenericDataAttribute()
show match attributes
long onCmdSelectAttribute(FXObject *, FXSelector, void *)
Called when the user selects an attribute in the match box.
long onCmdProcessString(FXObject *, FXSelector, void *)
Called when the user enters a new selection expression.
FXTextField * myBegin
TextField for begin.
MFXIconComboBox * myMatchGenericDataTagComboBox
tag of the match box
long onCmdSetEnd(FXObject *, FXSelector, void *)
Called when the user change end text field.
std::map< std::pair< double, double >, int > myIntervals
std::vector< GNEGenericData * > retrieveGenericDatas(const SumoXMLTag genericDataTag, const double begin, const double end)
retrieve generic datas within the given interval
std::set< std::string > retrieveGenericDataParameters(const std::string &genericDataTag, const double begin, const double end) const
return a set of parameters for the given data Interval
const std::set< GNEDataSet * > & getDataSets() const
get demand elements
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
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
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,
GNENet * getNet() const
get the net object
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
FXString getText() const
Get the text.
FXint getCurrentItem() const
Get the current item's index.
virtual void enable()
Enable combo box.
void setCurrentItem(FXint index, FXbool notify=FALSE)
Set the current item (index is zero-based)
void setTextColor(FXColor clr)
Change text color.
void clearItems()
Remove all items from the list.
FXint getNumItems() const
Return the number of items in the list.
void setNumVisible(FXint nvis)
Set the number of visible items in the drop down list.
FXint appendIconItem(const FXString &text, FXIcon *icon=nullptr, FXColor bgColor=FXRGB(255, 255, 255), void *ptr=nullptr)
append icon
virtual void disable()
Disable combo box.