56 myElementSet(elementSet),
57 myIntervalSelector(
nullptr),
60 myMatchGenericDataTagComboBox(
nullptr),
61 myMatchGenericDataAttrComboBox(
nullptr),
62 myCurrentTag(defaultTag),
63 myCurrentAttribute(
toString(defaultAttr)),
64 myMatchGenericDataString(
nullptr) {
66 new FXLabel(getCollapsableFrame(),
"Interval [begin, end]",
nullptr,
GUIDesignLabelThick(JUSTIFY_NORMAL));
85 enableMatchGenericDataAttribute();
87 myMatchGenericDataAttrComboBox->setText(
TL(
"speed"));
90 myMatchGenericDataString->setText(defaultValue.c_str());
103 for (
const auto& dataInterval : dataSet->getDataIntervalChildren()) {
134 myBegin->setTextColor(FXRGB(0, 0, 0));
136 myEnd->setTextColor(FXRGB(0, 0, 0));
140 for (
const auto& genericDataTag : genericDataTags) {
141 if (genericDataTag.isDrawable()) {
190 myBegin->setTextColor(FXRGB(0, 0, 0));
193 myEnd->setTextColor(FXRGB(0, 0, 0));
206 if (GNEAttributeCarrier::canParse<double>(
myBegin->getText().text()) &&
207 GNEAttributeCarrier::canParse<double>(
myEnd->getText().text())) {
211 myBegin->setTextColor(FXRGB(0, 0, 0));
221 myBegin->setTextColor(FXRGB(255, 0, 0));
234 if (GNEAttributeCarrier::canParse<double>(
myBegin->getText().text()) &&
235 GNEAttributeCarrier::canParse<double>(
myEnd->getText().text())) {
237 myEnd->setText(
toString(GNEAttributeCarrier::parse<double>(
myEnd->getText().text())).c_str());
239 myEnd->setTextColor(FXRGB(0, 0, 0));
249 myEnd->setTextColor(FXRGB(255, 0, 0));
302 for (
const auto& genericDataTag : listOfTags) {
310 const double begin = GNEAttributeCarrier::parse<double>(
myBegin->getText().text());
311 const double end = GNEAttributeCarrier::parse<double>(
myEnd->getText().text());
322 for (
const auto& attribute : attributes) {
350 GNEAttributeCarrier::parse<double>(
myEnd->getText().text()));
356 for (
const auto& attribute : attributes) {
380 GNEAttributeCarrier::parse<double>(
myBegin->getText().text()),
381 GNEAttributeCarrier::parse<double>(
myEnd->getText().text()));
384 std::vector<GNEGenericData*> TAZReldatasFrom, TAZReldatasTo;
386 for (
const auto& TAZRelData : genericDatas) {
388 TAZReldatasFrom.push_back(TAZRelData);
390 TAZReldatasFrom.push_back(TAZRelData);
394 for (
const auto& TAZRelData : TAZReldatasFrom) {
396 TAZReldatasTo.push_back(TAZRelData);
398 TAZReldatasTo.push_back(TAZRelData);
402 genericDatas = TAZReldatasTo;
404 if (expression ==
"") {
413 char compOp = expression[0];
414 if ((compOp ==
'<') || (compOp ==
'>') || (compOp ==
'=')) {
415 expression = expression.substr(1);
420 if (GNEAttributeCarrier::canParse<double>(expression.c_str())) {
432 char compOp = expression[0];
433 if ((compOp ==
'=') || (compOp ==
'!') || (compOp ==
'^')) {
434 expression = expression.substr(1);
457 std::ostringstream help;
459 <<
TL(
"- The 'MatchGenericData Attribute' controls allow to specify a set of objects which are then applied to the current selection\n")
460 <<
TL(
" according to the current 'Modification Mode'.\n")
461 <<
TL(
" 1. Select an object type from the first input box\n")
462 <<
TL(
" 2. Select an attribute from the second input box\n")
463 <<
TL(
" 3. Enter a 'match expression' in the third input box and press <return>\n")
465 <<
TL(
"- The empty expression matches all objects\n")
466 <<
TL(
"- For numerical attributes the match expression must consist of a comparison operator ('<', '>', '=') and a number.\n")
467 <<
TL(
"- An object matches if the comparison between its attribute and the given number by the given operator evaluates to 'true'\n")
469 <<
TL(
"- For string attributes the match expression must consist of a comparison operator ('', '=', '!', '^') and a string.\n")
470 <<
TL(
" '' (no operator) matches if string is a substring of that object'ts attribute.\n")
471 <<
TL(
" '=' matches if string is an exact match.\n")
472 <<
TL(
" '!' matches if string is not a substring.\n")
473 <<
TL(
" '^' matches if string is not an exact match.\n")
475 <<
TL(
"- Examples:\n")
476 <<
TL(
" junction; id; 'foo' -> match all junctions that have 'foo' in their id\n")
477 <<
TL(
" junction; type; '=priority' -> match all junctions of type 'priority', but not of type 'priority_stop'\n")
478 <<
TL(
" edge; speed; '>10' -> match all edges with a speed above 10\n");
490 WRITE_DEBUG(
"Opening help dialog of selector frame");
492 additionalNeteditAttributesHelpDialog->create();
494 additionalNeteditAttributesHelpDialog->show(PLACEMENT_CURSOR);
498 getApp()->runModalFor(additionalNeteditAttributesHelpDialog);
500 WRITE_DEBUG(
"Close help dialog of selector frame");
FXDEFMAP(GNEMatchGenericDataAttribute) GNEMatchGenericDataAttributeMap[]
@ MID_GNE_SELECTORFRAME_SETINTERVAL
change interval
@ MID_GNE_SELECTORFRAME_TOTAZ
to TAZ field
@ 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
@ MID_GNE_SELECTORFRAME_FROMTAZ
from TAZ text field
#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 GUIDesignComboBoxStaticExtended
Combo box static (not editable) extended over the all frame.
#define GUIDesignTextFieldNCol
Num of column of text field.
#define GUIDesignButtonOK
#define GUIDesignLabelThick(justify)
label extended over frame with thick and with text justify to left
#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_TAZ
a traffic assignment zone
@ SUMO_TAG_NOTHING
invalid tag
@ SUMO_TAG_TAZREL
a relation between two TAZs
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)
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 onCmdSetToTAZ(FXObject *, FXSelector, void *)
Called when the user change toTAZ text field.
FXComboBox * myFromTAZComboBox
TextField for fromTAZ.
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
pointer to element set Parent
FXTextField * myEnd
TextField for end.
MFXComboBoxIcon * myIntervalSelector
tag of the match box
FXTextField * myMatchGenericDataString
string of the match
MFXComboBoxIcon * myMatchGenericDataTagComboBox
tag of the match box
long onCmdSelectTag(FXObject *, FXSelector, void *)
Called when the user selects a tag in the match box.
~GNEMatchGenericDataAttribute()
destructor
long onCmdSetFromTAZ(FXObject *, FXSelector, void *)
Called when the user change fromTAZ text field.
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.
FXComboBox * myToTAZComboBox
TextField for toTAZ.
void updateTAZComboBox()
FOX need this.
long onCmdSetEnd(FXObject *, FXSelector, void *)
Called when the user change end text field.
std::map< std::pair< double, double >, int > myIntervals
FXHorizontalFrame * myTAZHorizontalFrame
horizontal frame for TAZs,
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
const std::map< SumoXMLTag, std::set< GNEAdditional * > > & getAdditionals() const
get additionals
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
FXint getCurrentItem() const
Get the current item's index.
void setCurrentItem(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 setNumVisible(FXint nvis)
Set the number of visible items in the drop down list.
void clearItems()
Remove all items from the list.
virtual void disable()
Disable combo box.
FXint appendIconItem(const FXString &text, FXIcon *icon=nullptr, FXColor bgColor=FXRGB(255, 255, 255), void *ptr=nullptr)
append icon
virtual 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)