71 myGenericDataFrameParent(genericDataFrameParent) {
83 myHorizontalFrameNewID->hide();
86 myCreateDataSetButton->hide();
88 refreshDataSetSelector(
nullptr);
100 myDataSetsComboBox->clearItems();
102 int currentItemIndex = -1;
104 for (
const auto& dataSet : myGenericDataFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getDataSets()) {
106 if ((currentItemIndex == -1) && (dataSet.second == currentDataSet)) {
107 currentItemIndex = myDataSetsComboBox->getNumItems();
109 myDataSetsComboBox->appendIconItem(dataSet.second->getID().c_str(), dataSet.second->getACIcon());
112 if (currentItemIndex != -1) {
113 myDataSetsComboBox->setCurrentItem(currentItemIndex, FALSE);
118 if (myGenericDataFrameParent->myIntervalSelector) {
119 myGenericDataFrameParent->myIntervalSelector->refreshIntervalSelector();
126 if ((myNewDataSetCheckButton->getCheck() == TRUE) || (myDataSetsComboBox->getNumItems() == 0)) {
137 const std::string dataSetID = myNewDataSetIDTextField->getText().text();
139 if (myNewDataSetIDTextField->getTextColor() == FXRGB(255, 0, 0)) {
141 }
else if (dataSetID.empty()) {
143 }
else if (myGenericDataFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveDataSet(dataSetID,
false) !=
nullptr) {
147 GNEDataHandler dataHandler(myGenericDataFrameParent->getViewNet()->getNet(),
"",
true,
false);
150 refreshDataSetSelector(myGenericDataFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveDataSet(dataSetID));
152 myNewDataSetCheckButton->setCheck(FALSE, TRUE);
168 myGenericDataFrameParent->myIntervalSelector->refreshIntervalSelector();
175 if (myNewDataSetCheckButton->getCheck() == TRUE) {
177 myHorizontalFrameNewID->show();
178 myCreateDataSetButton->show();
180 myDataSetsComboBox->hide();
183 myHorizontalFrameNewID->hide();
184 myCreateDataSetButton->hide();
186 myDataSetsComboBox->show();
189 myGenericDataFrameParent->myIntervalSelector->refreshIntervalSelector();
199 myGenericDataFrameParent(genericDataFrameParent) {
237 myIntervalsTreelist->clearItems();
238 myTreeItemIntervalMap.clear();
240 const GNEDataSet* dataSet = myGenericDataFrameParent->myDataSetSelector->getDataSet();
244 FXTreeItem* dataSetItem = myIntervalsTreelist->insertItem(
250 dataSetItem->setExpanded(
true);
253 addIntervalItem(interval.second, dataSetItem);
257 if (myGenericDataFrameParent->myAttributeSelector) {
258 myGenericDataFrameParent->myAttributeSelector->refreshAttributeSelector();
268 if (myIntervalsTreelist->getNumItems() > 0) {
269 for (
const auto& treeItem : myTreeItemIntervalMap) {
270 if (treeItem.first->isSelected()) {
271 return treeItem.second;
283 if (GNEAttributeCarrier::canParse<double>(myBeginTextField->getText().text()) &&
284 GNEAttributeCarrier::canParse<double>(myEndTextField->getText().text())) {
286 const double begin = GNEAttributeCarrier::parse<double>(myBeginTextField->getText().text());
287 const double end = GNEAttributeCarrier::parse<double>(myEndTextField->getText().text());
289 GNEDataSet* dataSet = myGenericDataFrameParent->myDataSetSelector->getDataSet();
292 GNEDataHandler dataHandler(myGenericDataFrameParent->getViewNet()->getNet(),
"",
true,
false);
297 myNewIntervalCheckButton->setCheck(FALSE, TRUE);
306 myGenericDataFrameParent->myAttributeSelector->refreshAttributeSelector();
313 if (obj == myBeginTextField) {
315 if (GNEAttributeCarrier::canParse<double>(myBeginTextField->getText().text())) {
316 myBeginTextField->setTextColor(FXRGB(0, 0, 0));
317 myBeginTextField->killFocus();
319 myBeginTextField->setTextColor(FXRGB(255, 0, 0));
321 }
else if (obj == myEndTextField) {
323 if (GNEAttributeCarrier::canParse<double>(myEndTextField->getText().text())) {
324 myEndTextField->setTextColor(FXRGB(0, 0, 0));
325 myEndTextField->killFocus();
327 myEndTextField->setTextColor(FXRGB(255, 0, 0));
336 if (myNewIntervalCheckButton->getCheck() == TRUE) {
338 myHorizontalFrameBegin->show();
339 myHorizontalFrameEnd->show();
340 myCreateIntervalButton->show();
342 const GNEDataSet* dataSet = myGenericDataFrameParent->myDataSetSelector->getDataSet();
346 myBeginTextField->setText(
"0");
347 myEndTextField->setText(
"3600");
359 myHorizontalFrameBegin->hide();
360 myHorizontalFrameEnd->hide();
361 myCreateIntervalButton->hide();
364 refreshIntervalSelector();
372 FXTreeItem* item = myIntervalsTreelist->insertItem(
nullptr, itemParent,
377 myTreeItemIntervalMap[item] = dataInterval;
379 item->setExpanded(
true);
381 if (myTreeItemIntervalMap.size() == 1) {
382 item->setSelected(TRUE);
394 myGenericDataFrameParent(genericDataFrameParent),
395 myMinMaxLabel(nullptr),
415 const auto currentAttribute = myAttributesComboBox->getText();
417 myAttributesComboBox->clearItems();
419 myMinMaxLabel->setText(
TL(
"Scale: Min -> Max"));
421 if (myGenericDataFrameParent->myDataSetSelector->getDataSet() ==
nullptr) {
422 myAttributesComboBox->appendIconItem(
"<no dataSet selected>");
423 myAttributesComboBox->disable();
426 myAttributesComboBox->appendIconItem(
"<all>");
428 if (myGenericDataFrameParent->myIntervalSelector->getDataInterval() ==
nullptr) {
429 const auto parameters = myGenericDataFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveGenericDataParameters(
432 for (
const auto& attribute : parameters) {
433 myAttributesComboBox->appendIconItem(attribute.c_str());
437 const auto parameters = myGenericDataFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveGenericDataParameters(
439 myGenericDataFrameParent->myIntervalSelector->getDataInterval()->getAttribute(
SUMO_ATTR_BEGIN),
440 myGenericDataFrameParent->myIntervalSelector->getDataInterval()->getAttribute(
SUMO_ATTR_END));
442 for (
const auto& attribute : parameters) {
443 myAttributesComboBox->appendIconItem(attribute.c_str());
447 myAttributesComboBox->enable();
449 for (
int i = 0; i < myAttributesComboBox->getNumItems(); i++) {
450 if (myAttributesComboBox->getItemText(i) == currentAttribute.text()) {
451 myAttributesComboBox->setCurrentItem(i, TRUE);
458 myGenericDataFrameParent->getViewNet()->updateViewNet();
464 if (myAttributesComboBox->getNumItems() == 0) {
466 }
else if (myAttributesComboBox->getText() ==
TL(
"<all>")) {
469 return myAttributesComboBox->getText().text();
477 myMinMaxLabel->setText((
"Min: " +
toString(min) +
" -> Max: " +
toString(max)).c_str());
486 if (myAttributesComboBox->getText().empty()) {
487 myAttributesComboBox->setCurrentItem(0);
489 if (myAttributesComboBox->getText() ==
TL(
"<all>")) {
490 myMinMaxLabel->setText(
TL(
"Scale: Min -> Max"));
493 myGenericDataFrameParent->getViewNet()->updateViewNet();
549 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)
add interval item into list
FXHorizontalFrame * myHorizontalFrameEnd
interval end horizontal frame
GNEDataInterval * getDataInterval() const
get current select data set ID
long onCmdCreateInterval(FXObject *, FXSelector, void *)
~IntervalSelector()
destructor
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
GNEDataSet * retrieveDataSet(const std::string &id, bool hardFail=true) const
Returns the named data set.
const std::map< std::string, GNEEdge * > & getEdges() const
map with the ID and pointer to edges of net
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