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(),
TL(
"Interval [begin, end]"),
nullptr,
GUIDesignLabelThick(JUSTIFY_NORMAL));
90 enableMatchGenericDataAttribute();
92 myMatchGenericDataString->setText(defaultValue.c_str());
105 for (
const auto& dataInterval : dataSet.second->getDataIntervalChildren()) {
130 myBegin->setTextColor(FXRGB(0, 0, 0));
132 myEnd->setTextColor(FXRGB(0, 0, 0));
136 for (
const auto& genericDataTag : tagPropertiesGenericDatas) {
137 if (genericDataTag->isDrawable()) {
185 myBegin->setTextColor(FXRGB(0, 0, 0));
188 myEnd->setTextColor(FXRGB(0, 0, 0));
201 if (GNEAttributeCarrier::canParse<double>(
myBegin->getText().text()) &&
202 GNEAttributeCarrier::canParse<double>(
myEnd->getText().text())) {
206 myBegin->setTextColor(FXRGB(0, 0, 0));
216 myBegin->setTextColor(FXRGB(255, 0, 0));
229 if (GNEAttributeCarrier::canParse<double>(
myBegin->getText().text()) &&
230 GNEAttributeCarrier::canParse<double>(
myEnd->getText().text())) {
232 myEnd->setText(
toString(GNEAttributeCarrier::parse<double>(
myEnd->getText().text())).c_str());
234 myEnd->setTextColor(FXRGB(0, 0, 0));
244 myEnd->setTextColor(FXRGB(255, 0, 0));
297 for (
const auto& genericDataTag : tagPropertiesGenericDatas) {
305 const double begin = GNEAttributeCarrier::parse<double>(
myBegin->getText().text());
306 const double end = GNEAttributeCarrier::parse<double>(
myEnd->getText().text());
317 for (
const auto& attribute : attributes) {
344 GNEAttributeCarrier::parse<double>(
myEnd->getText().text()));
350 for (
const auto& attribute : attributes) {
374 GNEAttributeCarrier::parse<double>(
myBegin->getText().text()),
375 GNEAttributeCarrier::parse<double>(
myEnd->getText().text()));
378 std::vector<GNEGenericData*> TAZReldatasFrom, TAZReldatasTo;
380 for (
const auto& TAZRelData : genericDatas) {
382 TAZReldatasFrom.push_back(TAZRelData);
384 TAZReldatasFrom.push_back(TAZRelData);
388 for (
const auto& TAZRelData : TAZReldatasFrom) {
390 TAZReldatasTo.push_back(TAZRelData);
392 TAZReldatasTo.push_back(TAZRelData);
396 genericDatas = TAZReldatasTo;
398 if (expression ==
"") {
407 char compOp = expression[0];
408 if ((compOp ==
'<') || (compOp ==
'>') || (compOp ==
'=')) {
409 expression = expression.substr(1);
414 if (GNEAttributeCarrier::canParse<double>(expression.c_str())) {
426 char compOp = expression[0];
427 if ((compOp ==
'=') || (compOp ==
'!') || (compOp ==
'^')) {
428 expression = expression.substr(1);
451 std::ostringstream help;
453 <<
TL(
"- The 'MatchGenericData Attribute' controls allow to specify a set of objects which are then applied to the current selection\n")
454 <<
TL(
" according to the current 'Modification Mode'.\n")
455 <<
TL(
" 1. Select an object type from the first input box\n")
456 <<
TL(
" 2. Select an attribute from the second input box\n")
457 <<
TL(
" 3. Enter a 'match expression' in the third input box and press <return>\n")
459 <<
TL(
"- The empty expression matches all objects\n")
460 <<
TL(
"- For numerical attributes the match expression must consist of a comparison operator ('<', '>', '=') and a number.\n")
461 <<
TL(
"- An object matches if the comparison between its attribute and the given number by the given operator evaluates to 'true'\n")
463 <<
TL(
"- For string attributes the match expression must consist of a comparison operator ('', '=', '!', '^') and a string.\n")
464 <<
TL(
" '' (no operator) matches if string is a substring of that object's attribute.\n")
465 <<
TL(
" '=' matches if string is an exact match.\n")
466 <<
TL(
" '!' matches if string is not a substring.\n")
467 <<
TL(
" '^' matches if string is not an exact match.\n")
469 <<
TL(
"- Examples:\n")
470 <<
TL(
" junction; id; 'foo' -> match all junctions that have 'foo' in their id\n")
471 <<
TL(
" junction; type; '=priority' -> match all junctions of type 'priority', but not of type 'priority_stop'\n")
472 <<
TL(
" edge; speed; '>10' -> match all edges with a speed above 10\n");
484 additionalNeteditAttributesHelpDialog->create();
486 additionalNeteditAttributesHelpDialog->show(PLACEMENT_CURSOR);
490 getApp()->runModalFor(additionalNeteditAttributesHelpDialog);
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)
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,
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
const std::unordered_map< SumoXMLTag, std::unordered_map< const GUIGlObject *, GNEAdditional * >, std::hash< int > > & getAdditionals() const
get additionals
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
const GNETagPropertiesDatabase * getTagPropertiesDatabase() const
get tag properties database
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,
const std::vector< const GNETagProperties * > getTagPropertiesByType(const int tagPropertyCategory) const
get tagProperties associated to the given GNETagProperties::TagType (NETWORKELEMENT,...
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)