73 myGenericDataFrameParent(genericDataFrameParent) {
85 myHorizontalFrameNewID->hide();
88 myCreateDataSetButton->hide();
90 refreshDataSetSelector(
nullptr);
102 myDataSetsComboBox->clearItems();
104 int currentItemIndex = -1;
106 for (
const auto& dataSet : myGenericDataFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getDataSets()) {
108 if ((currentItemIndex == -1) && (dataSet.second == currentDataSet)) {
109 currentItemIndex = myDataSetsComboBox->getNumItems();
111 myDataSetsComboBox->appendIconItem(dataSet.second->getID().c_str(), dataSet.second->getACIcon());
114 if (currentItemIndex != -1) {
115 myDataSetsComboBox->setCurrentItem(currentItemIndex, FALSE);
116 if (myGenericDataFrameParent->getIntervalSelector()) {
117 myGenericDataFrameParent->getIntervalSelector()->enableContents();
119 }
else if (myGenericDataFrameParent->getIntervalSelector()) {
120 myGenericDataFrameParent->getIntervalSelector()->disableContents();
125 if (myGenericDataFrameParent->myIntervalSelector) {
126 myGenericDataFrameParent->myIntervalSelector->refreshIntervalSelector();
133 if ((myNewDataSetCheckButton->getCheck() == TRUE) || (myDataSetsComboBox->getNumItems() == 0)) {
144 myGenericDataFrameParent->getIntervalSelector()->disableContents();
146 const std::string dataSetID = myNewDataSetIDTextField->getText().text();
148 if (myNewDataSetIDTextField->getTextColor() == FXRGB(255, 0, 0)) {
150 }
else if (dataSetID.empty()) {
152 }
else if (myGenericDataFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveDataSet(dataSetID,
false) !=
nullptr) {
156 GNEDataHandler dataHandler(myGenericDataFrameParent->getViewNet()->getNet(),
"",
157 myGenericDataFrameParent->getViewNet()->getViewParent()->getGNEAppWindows()->isUndoRedoAllowed(),
161 refreshDataSetSelector(myGenericDataFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveDataSet(dataSetID));
163 myNewDataSetCheckButton->setCheck(FALSE, TRUE);
179 myGenericDataFrameParent->myIntervalSelector->refreshIntervalSelector();
186 if (myNewDataSetCheckButton->getCheck() == TRUE) {
188 myHorizontalFrameNewID->show();
189 myCreateDataSetButton->show();
191 myDataSetsComboBox->hide();
194 myHorizontalFrameNewID->hide();
195 myCreateDataSetButton->hide();
197 myDataSetsComboBox->show();
200 myGenericDataFrameParent->myIntervalSelector->refreshIntervalSelector();
210 myGenericDataFrameParent(genericDataFrameParent) {
247 myNewIntervalCheckButton->enable();
248 myHorizontalFrameBegin->enable();
249 myBeginTextField->enable();
250 myHorizontalFrameEnd->enable();
251 myEndTextField->enable();
252 myCreateIntervalButton->enable();
253 myIntervalsTreelist->enable();
259 myNewIntervalCheckButton->disable();
260 myHorizontalFrameBegin->disable();
261 myBeginTextField->disable();
262 myHorizontalFrameEnd->disable();
263 myEndTextField->disable();
264 myCreateIntervalButton->disable();
265 myIntervalsTreelist->disable();
272 myIntervalsTreelist->clearItems();
273 myTreeItemIntervalMap.clear();
275 const GNEDataSet* dataSet = myGenericDataFrameParent->myDataSetSelector->getDataSet();
279 FXTreeItem* dataSetItem = myIntervalsTreelist->insertItem(
285 dataSetItem->setExpanded(
true);
288 addIntervalItem(interval.second, dataSetItem);
292 if (myGenericDataFrameParent->myAttributeSelector) {
293 myGenericDataFrameParent->myAttributeSelector->refreshAttributeSelector();
303 if (myIntervalsTreelist->getNumItems() > 0) {
304 for (
const auto& treeItem : myTreeItemIntervalMap) {
305 if (treeItem.first->isSelected()) {
306 return treeItem.second;
318 if (GNEAttributeCarrier::canParse<double>(myBeginTextField->getText().text()) &&
319 GNEAttributeCarrier::canParse<double>(myEndTextField->getText().text())) {
321 const double begin = GNEAttributeCarrier::parse<double>(myBeginTextField->getText().text());
322 const double end = GNEAttributeCarrier::parse<double>(myEndTextField->getText().text());
324 GNEDataSet* dataSet = myGenericDataFrameParent->myDataSetSelector->getDataSet();
327 GNEDataHandler dataHandler(myGenericDataFrameParent->getViewNet()->getNet(),
"",
328 myGenericDataFrameParent->getViewNet()->getViewParent()->getGNEAppWindows()->isUndoRedoAllowed(),
334 myNewIntervalCheckButton->setCheck(FALSE, TRUE);
343 myGenericDataFrameParent->myAttributeSelector->refreshAttributeSelector();
350 if (obj == myBeginTextField) {
352 if (GNEAttributeCarrier::canParse<double>(myBeginTextField->getText().text())) {
353 myBeginTextField->setTextColor(FXRGB(0, 0, 0));
354 myBeginTextField->killFocus();
356 myBeginTextField->setTextColor(FXRGB(255, 0, 0));
358 }
else if (obj == myEndTextField) {
360 if (GNEAttributeCarrier::canParse<double>(myEndTextField->getText().text())) {
361 myEndTextField->setTextColor(FXRGB(0, 0, 0));
362 myEndTextField->killFocus();
364 myEndTextField->setTextColor(FXRGB(255, 0, 0));
373 if (myNewIntervalCheckButton->getCheck() == TRUE) {
375 myHorizontalFrameBegin->show();
376 myHorizontalFrameEnd->show();
377 myCreateIntervalButton->show();
379 const GNEDataSet* dataSet = myGenericDataFrameParent->myDataSetSelector->getDataSet();
383 myBeginTextField->setText(
"0");
384 myEndTextField->setText(
"3600");
396 myHorizontalFrameBegin->hide();
397 myHorizontalFrameEnd->hide();
398 myCreateIntervalButton->hide();
401 refreshIntervalSelector();
409 FXTreeItem* item = myIntervalsTreelist->insertItem(
nullptr, itemParent,
414 myTreeItemIntervalMap[item] = dataInterval;
416 item->setExpanded(
true);
418 if (myTreeItemIntervalMap.size() == 1) {
419 item->setSelected(TRUE);
431 myGenericDataFrameParent(genericDataFrameParent),
432 myMinMaxLabel(nullptr),
452 const auto currentAttribute = myAttributesComboBox->getText();
454 myAttributesComboBox->clearItems();
456 myMinMaxLabel->setText(
TL(
"Scale: Min -> Max"));
458 if (myGenericDataFrameParent->myDataSetSelector->getDataSet() ==
nullptr) {
459 myAttributesComboBox->appendIconItem(
"<no dataSet selected>");
460 myAttributesComboBox->disable();
463 myAttributesComboBox->appendIconItem(
"<all>");
465 if (myGenericDataFrameParent->myIntervalSelector->getDataInterval() ==
nullptr) {
466 const auto parameters = myGenericDataFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveGenericDataParameters(
469 for (
const auto& attribute : parameters) {
470 myAttributesComboBox->appendIconItem(attribute.c_str());
474 const auto parameters = myGenericDataFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveGenericDataParameters(
476 myGenericDataFrameParent->myIntervalSelector->getDataInterval()->getAttribute(
SUMO_ATTR_BEGIN),
477 myGenericDataFrameParent->myIntervalSelector->getDataInterval()->getAttribute(
SUMO_ATTR_END));
479 for (
const auto& attribute : parameters) {
480 myAttributesComboBox->appendIconItem(attribute.c_str());
484 myAttributesComboBox->enable();
486 for (
int i = 0; i < myAttributesComboBox->getNumItems(); i++) {
487 if (myAttributesComboBox->getItemText(i) == currentAttribute.text()) {
488 myAttributesComboBox->setCurrentItem(i, TRUE);
495 myGenericDataFrameParent->getViewNet()->updateViewNet();
501 if (myAttributesComboBox->getNumItems() == 0) {
503 }
else if (myAttributesComboBox->getText() ==
TL(
"<all>")) {
506 return myAttributesComboBox->getText().text();
514 myMinMaxLabel->setText((
"Min: " +
toString(min) +
" -> Max: " +
toString(max)).c_str());
523 if (myAttributesComboBox->getText().empty()) {
524 myAttributesComboBox->setCurrentItem(0);
526 if (myAttributesComboBox->getText() ==
TL(
"<all>")) {
527 myMinMaxLabel->setText(
TL(
"Scale: Min -> Max"));
530 myGenericDataFrameParent->getViewNet()->updateViewNet();
586 edge.second->resetCandidateFlags();
FXDEFMAP(GNEGenericDataFrame::DataSetSelector) DataSetSelectorMap[]
@ MID_GNE_SET_ATTRIBUTE
attribute edited
@ MID_GNE_DATASET_SELECTED
GNEDataInterval selected in comboBox of IntervalBar.
@ MID_GNE_CREATE
create element
@ MID_GNE_DATAINTERVAL_SELECTED
GNEDataInterval selected in comboBox of IntervalBar.
@ MID_GNE_DATASET_NEW
create new data set
@ MID_GNE_SELECT
select element
#define GUIDesignTreeListFixedHeight
tree list with fixed height
#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 GUIDesignComboBoxVisibleItemsMedium
combo box medium small
#define GUIDesignTextFieldNCol
Num of column of text field.
#define GUIDesignCheckButton
checkButton placed in left position
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
#define WRITE_WARNING(msg)
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_END
weights: time range end
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
const std::string getID() const
get ID (all Attribute Carriers have one)
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
GNENet * getNet() const
get pointer to net
void buildDataSet(const std::string &dataSetID)
Builds DataSet (exclusive of netedit)
void buildDataInterval(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &dataSetID, const double begin, const double end)
Builds DataInterval.
An Element which don't belong to GNENet but has influence in the simulation.
double getAttributeDouble(SumoXMLAttr key) const
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
const std::map< const double, GNEDataInterval * > & getDataIntervalChildren() const
get data interval children
bool checkNewInterval(const double newBegin, const double newEnd)
check if a new GNEDataInterval with the given begin and end can be inserted in current GNEDataSet
static FXLabel * buildRainbow(FXComposite *parent)
build rainbow in frame modul
GNEViewNet * myViewNet
FOX need this.
virtual void show()
show Frame
virtual void hide()
hide Frame
AttributeSelector(GNEGenericDataFrame *genericDataFrameParent, SumoXMLTag tag)
FOX-declaration.
~AttributeSelector()
destructor
long onCmdSelectAttribute(FXObject *, FXSelector, void *)
Called when the user select a attribute in the combo boz.
const RGBColor & getScaledColor(const double min, const double max, const double value) const
get color for the given value
FXLabel * myMinMaxLabel
label for min/max attribute
void refreshAttributeSelector()
refresh interval selector
std::string getFilteredAttribute() const
get filtered attribute
MFXComboBoxIcon * myAttributesComboBox
combo box for attributes
GNEDataSet * getDataSet() const
get current select data set ID
long onCmdSelectDataSet(FXObject *obj, FXSelector, void *)
Called when the user select an existent data set.
~DataSetSelector()
destructor
long onCmdCreateDataSet(FXObject *, FXSelector, void *)
void refreshDataSetSelector(const GNEDataSet *currentDataSet)
refresh interval selector
long onCmdSetNewDataSetID(FXObject *, FXSelector, void *)
Called when the user set a new data set ID.
long onCmdSelectCheckButton(FXObject *obj, FXSelector, void *)
Called when the user select check button.
FXTreeList * myIntervalsTreelist
tree list to show the interval list
FXTreeItem * addIntervalItem(GNEDataInterval *dataInterval, FXTreeItem *itemParent=nullptr)
FOX needs this.
void enableContents() const
enable contents
FXHorizontalFrame * myHorizontalFrameEnd
interval end horizontal frame
GNEDataInterval * getDataInterval() const
get current select data set ID
long onCmdCreateInterval(FXObject *, FXSelector, void *)
~IntervalSelector()
destructor
void disableContents() const
disable contents
FXCheckButton * myNewIntervalCheckButton
check button to create a new interval
FXButton * myCreateIntervalButton
create interval button
IntervalSelector(GNEGenericDataFrame *genericDataFrameParent)
FOX-declaration.
FXTextField * myEndTextField
interval end
FXHorizontalFrame * myHorizontalFrameBegin
interval begin horizontal frame
long onCmdSetIntervalAttribute(FXObject *, FXSelector, void *)
Called when the user changes begin or end.
long onCmdSelectInterval(FXObject *, FXSelector, void *)
Called when the user select an interval in the list.
void refreshIntervalSelector()
refresh interval selector
long onCmdSelectCheckButton(FXObject *obj, FXSelector, void *)
Called when the user select check button.
FXTextField * myBeginTextField
interval begin text field
~GNEGenericDataFrame()
Destructor.
void updateFrameAfterUndoRedo()
function called after undo/redo in the current frame
GNEFrameAttributeModules::GenericDataAttributes * myGenericDataAttributes
parameters editor creator
virtual bool createPath(const bool useLastRoute)
create path
void intervalSelected()
interval selected
IntervalSelector * myIntervalSelector
interval selector modul
DataSetSelector * myDataSetSelector
dataSet selector modul
const AttributeSelector * getAttributeSelector() const
getattribute selector modul
GNEGenericDataFrame(GNEViewParent *viewParent, GNEViewNet *viewNet, SumoXMLTag tag, const bool pathCreator)
Constructor (protected due GNEGenericDataFrame is abtract)
GNEPathCreator * getPathCreator() const
get GNEPathCreator modul
AttributeSelector * myAttributeSelector
attribute selector modul
const DataSetSelector * getDataSetSelector() const
get dataSet selector modul
SumoXMLTag getTag() const
@bried get element type of this data frame
SumoXMLTag myGenericDataTag
generic data tag
GNEPathCreator * myPathCreator
edge path creator (used for Walks, rides and trips)
const IntervalSelector * getIntervalSelector() const
get interval selector modul
const std::map< const std::string, GNEEdge * > & getEdges() const
map with the ID and pointer to edges of net
GNEDataSet * retrieveDataSet(const std::string &id, bool hardFail=true) const
Returns the named data set.
GNEPathManager * getDataPathManager()
get data path manager
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
void showPathCreatorModule(const GNETagProperties &tagProperty, const bool consecutives)
show GNEPathCreator for the given tag
GNENet * getNet() const
get the net object
A single child window which contains a view of the simulation area.
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
MFXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)
static const RGBColor & getRainbowScaledColor(const double min, const double max, const double value)
get rainbow scaled color