57 myElementSet(elementSet),
58 myIntervalSelector(
nullptr),
61 myMatchGenericDataTagComboBox(
nullptr),
62 myMatchGenericDataAttrComboBox(
nullptr),
63 myCurrentTag(defaultTag),
64 myCurrentAttribute(
toString(defaultAttr)),
65 myMatchGenericDataString(
nullptr) {
67 new FXLabel(getCollapsableFrame(),
TL(
"Interval [begin, end]"),
nullptr,
GUIDesignLabelThick(JUSTIFY_NORMAL));
91 enableMatchGenericDataAttribute();
93 myMatchGenericDataString->setText(defaultValue.c_str());
106 for (
const auto& dataInterval : dataSet.second->getDataIntervalChildren()) {
131 myBegin->setTextColor(FXRGB(0, 0, 0));
133 myEnd->setTextColor(FXRGB(0, 0, 0));
137 for (
const auto& genericDataTag : genericDataTags) {
138 if (genericDataTag.isDrawable()) {
186 myBegin->setTextColor(FXRGB(0, 0, 0));
189 myEnd->setTextColor(FXRGB(0, 0, 0));
202 if (GNEAttributeCarrier::canParse<double>(
myBegin->getText().text()) &&
203 GNEAttributeCarrier::canParse<double>(
myEnd->getText().text())) {
207 myBegin->setTextColor(FXRGB(0, 0, 0));
217 myBegin->setTextColor(FXRGB(255, 0, 0));
230 if (GNEAttributeCarrier::canParse<double>(
myBegin->getText().text()) &&
231 GNEAttributeCarrier::canParse<double>(
myEnd->getText().text())) {
233 myEnd->setText(
toString(GNEAttributeCarrier::parse<double>(
myEnd->getText().text())).c_str());
235 myEnd->setTextColor(FXRGB(0, 0, 0));
245 myEnd->setTextColor(FXRGB(255, 0, 0));
298 for (
const auto& genericDataTag : listOfTags) {
306 const double begin = GNEAttributeCarrier::parse<double>(
myBegin->getText().text());
307 const double end = GNEAttributeCarrier::parse<double>(
myEnd->getText().text());
318 for (
const auto& attribute : attributes) {
345 GNEAttributeCarrier::parse<double>(
myEnd->getText().text()));
351 for (
const auto& attribute : attributes) {
375 GNEAttributeCarrier::parse<double>(
myBegin->getText().text()),
376 GNEAttributeCarrier::parse<double>(
myEnd->getText().text()));
379 std::vector<GNEGenericData*> TAZReldatasFrom, TAZReldatasTo;
381 for (
const auto& TAZRelData : genericDatas) {
383 TAZReldatasFrom.push_back(TAZRelData);
385 TAZReldatasFrom.push_back(TAZRelData);
389 for (
const auto& TAZRelData : TAZReldatasFrom) {
391 TAZReldatasTo.push_back(TAZRelData);
393 TAZReldatasTo.push_back(TAZRelData);
397 genericDatas = TAZReldatasTo;
399 if (expression ==
"") {
408 char compOp = expression[0];
409 if ((compOp ==
'<') || (compOp ==
'>') || (compOp ==
'=')) {
410 expression = expression.substr(1);
415 if (GNEAttributeCarrier::canParse<double>(expression.c_str())) {
427 char compOp = expression[0];
428 if ((compOp ==
'=') || (compOp ==
'!') || (compOp ==
'^')) {
429 expression = expression.substr(1);
452 std::ostringstream help;
454 <<
TL(
"- The 'MatchGenericData Attribute' controls allow to specify a set of objects which are then applied to the current selection\n")
455 <<
TL(
" according to the current 'Modification Mode'.\n")
456 <<
TL(
" 1. Select an object type from the first input box\n")
457 <<
TL(
" 2. Select an attribute from the second input box\n")
458 <<
TL(
" 3. Enter a 'match expression' in the third input box and press <return>\n")
460 <<
TL(
"- The empty expression matches all objects\n")
461 <<
TL(
"- For numerical attributes the match expression must consist of a comparison operator ('<', '>', '=') and a number.\n")
462 <<
TL(
"- An object matches if the comparison between its attribute and the given number by the given operator evaluates to 'true'\n")
464 <<
TL(
"- For string attributes the match expression must consist of a comparison operator ('', '=', '!', '^') and a string.\n")
465 <<
TL(
" '' (no operator) matches if string is a substring of that object's attribute.\n")
466 <<
TL(
" '=' matches if string is an exact match.\n")
467 <<
TL(
" '!' matches if string is not a substring.\n")
468 <<
TL(
" '^' matches if string is not an exact match.\n")
470 <<
TL(
"- Examples:\n")
471 <<
TL(
" junction; id; 'foo' -> match all junctions that have 'foo' in their id\n")
472 <<
TL(
" junction; type; '=priority' -> match all junctions of type 'priority', but not of type 'priority_stop'\n")
473 <<
TL(
" edge; speed; '>10' -> match all edges with a speed above 10\n");
485 WRITE_DEBUG(
"Opening help dialog of selector frame");
487 additionalNeteditAttributesHelpDialog->create();
489 additionalNeteditAttributesHelpDialog->show(PLACEMENT_CURSOR);
493 getApp()->runModalFor(additionalNeteditAttributesHelpDialog);
495 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 GUIDesignComboBoxVisibleItems
#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, must be the last one
@ 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, const bool mergeCommonPlans)
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.
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.
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
MFXComboBoxIcon * myFromTAZComboBox
TextField for fromTAZ.
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.
void updateTAZComboBox()
FOX need this.
MFXComboBoxIcon * myToTAZComboBox
TextField for toTAZ.
long onCmdSetEnd(FXObject *, FXSelector, void *)
Called when the user change end text field.
MFXComboBoxIcon * myMatchGenericDataAttrComboBox
attributes of the match box
std::map< std::pair< double, double >, int > myIntervals
FXHorizontalFrame * myTAZHorizontalFrame
horizontal frame for TAZs,
const std::unordered_map< SumoXMLTag, std::unordered_map< const GUIGlObject *, GNEAdditional * > > & getAdditionals() const
get additionals
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::map< const std::string, 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 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
long setCurrentItem(const FXint index, FXbool notify=FALSE)
Set the current item (index is zero-based)
FXint getCurrentItem() const
Get the current item's index.
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.
FXColor getTextColor() const
Return text color.
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)