Path: blob/main/src/netedit/frames/demand/GNEDistributionFrame.cpp
169684 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file GNEDistributionFrame.cpp14/// @author Pablo Alvarez Lopez15/// @date Jun 202316///17// The Widget for edit distribution elements18/****************************************************************************/1920#include <netedit/GNEApplicationWindow.h>21#include <netedit/GNENet.h>22#include <netedit/GNETagProperties.h>23#include <netedit/GNEUndoList.h>24#include <netedit/GNEViewParent.h>25#include <netedit/changes/GNEChange_DemandElement.h>26#include <netedit/elements/demand/GNERouteDistribution.h>27#include <netedit/elements/demand/GNEVTypeDistribution.h>28#include <netedit/frames/GNEAttributesEditor.h>29#include <utils/foxtools/MFXTextFieldIcon.h>30#include <utils/gui/div/GUIDesigns.h>3132#include "GNEDistributionFrame.h"3334#define TEMPORAL_FILENAME std::string()3536// ===========================================================================37// FOX callback mapping38// ===========================================================================3940FXDEFMAP(GNEDistributionFrame::DistributionEditor) DistributionEditorMap[] = {41FXMAPFUNC(SEL_COMMAND, MID_GNE_CREATE, GNEDistributionFrame::DistributionEditor::onCmdCreateDistribution),42FXMAPFUNC(SEL_COMMAND, MID_GNE_DELETE, GNEDistributionFrame::DistributionEditor::onCmdDeleteDistribution),43FXMAPFUNC(SEL_UPDATE, MID_GNE_DELETE, GNEDistributionFrame::DistributionEditor::onUpdDeleteDistribution),44};4546FXDEFMAP(GNEDistributionFrame::DistributionSelector) DistributionSelectorMap[] = {47FXMAPFUNC(SEL_COMMAND, MID_GNE_SET_TYPE, GNEDistributionFrame::DistributionSelector::onCmdSelectDistribution),48FXMAPFUNC(SEL_UPDATE, MID_GNE_SET_TYPE, GNEDistributionFrame::DistributionSelector::onCmdUpdateDistribution)49};505152FXDEFMAP(GNEDistributionFrame::DistributionRow) DistributionRowMap[] = {53FXMAPFUNC(SEL_COMMAND, MID_GNE_SET_TYPE, GNEDistributionFrame::DistributionRow::onCmdSetKey),54FXMAPFUNC(SEL_COMMAND, MID_GNE_SET_ATTRIBUTE, GNEDistributionFrame::DistributionRow::onCmdSetProbability),55FXMAPFUNC(SEL_COMMAND, MID_GNE_BUTTON_REMOVE, GNEDistributionFrame::DistributionRow::onCmdRemoveRow)56};5758FXDEFMAP(GNEDistributionFrame::DistributionValuesEditor) DistributionValuesEditorMap[] = {59FXMAPFUNC(SEL_COMMAND, MID_GNE_BUTTON_ADD, GNEDistributionFrame::DistributionValuesEditor::onCmdAddRow),60FXMAPFUNC(SEL_UPDATE, MID_GNE_BUTTON_ADD, GNEDistributionFrame::DistributionValuesEditor::onUpdAddRow)61};6263// Object implementation64FXIMPLEMENT(GNEDistributionFrame::DistributionEditor, MFXGroupBoxModule, DistributionEditorMap, ARRAYNUMBER(DistributionEditorMap))65FXIMPLEMENT(GNEDistributionFrame::DistributionSelector, MFXGroupBoxModule, DistributionSelectorMap, ARRAYNUMBER(DistributionSelectorMap))66FXIMPLEMENT(GNEDistributionFrame::DistributionRow, FXHorizontalFrame, DistributionRowMap, ARRAYNUMBER(DistributionRowMap))67FXIMPLEMENT(GNEDistributionFrame::DistributionValuesEditor, MFXGroupBoxModule, DistributionValuesEditorMap, ARRAYNUMBER(DistributionValuesEditorMap))686970// ===========================================================================71// method definitions72// ===========================================================================7374// ---------------------------------------------------------------------------75// GNEDistributionFrame::DistributionEditor - methods76// ---------------------------------------------------------------------------7778GNEDistributionFrame::DistributionEditor::DistributionEditor(GNEFrame* frameParent, SumoXMLTag distributionTag, GUIIcon icon) :79MFXGroupBoxModule(frameParent, TL("Distribution Editor")),80myFrameParent(frameParent),81myDistributionTag(distributionTag) {82// get staticTooltip menu83auto staticTooltipMenu = myFrameParent->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu();84// Create new distribution85myCreateDistributionButton = new MFXButtonTooltip(getCollapsableFrame(), staticTooltipMenu, TL("New"),86GUIIconSubSys::getIcon(icon), this, MID_GNE_CREATE, GUIDesignButton);87myCreateDistributionButton->setTipText(TLF("Create new %", toString(myDistributionTag)).c_str()),88// Delete distribution89myDeleteDistributionButton = new MFXButtonTooltip(getCollapsableFrame(), staticTooltipMenu, TL("Delete"),90GUIIconSubSys::getIcon(GUIIcon::MODEDELETE), this, MID_GNE_DELETE, GUIDesignButton);91myDeleteDistributionButton->setTipText(TLF("Delete current edited %", toString(myDistributionTag)).c_str()),92// show editor93show();94}959697GNEDistributionFrame::DistributionEditor::~DistributionEditor() {}9899100SumoXMLTag101GNEDistributionFrame::DistributionEditor::getDistributionTag() const {102return myDistributionTag;103}104105106long107GNEDistributionFrame::DistributionEditor::onCmdCreateDistribution(FXObject*, FXSelector, void*) {108auto undoList = myFrameParent->getViewNet()->getUndoList();109// obtain a new valid ID110const auto distributionID = myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->generateDemandElementID(myDistributionTag);111// create new distribution112GNEDemandElement* distribution = nullptr;113if (myDistributionTag == SUMO_TAG_VTYPE_DISTRIBUTION) {114distribution = new GNEVTypeDistribution(distributionID, myFrameParent->getViewNet()->getNet(), TEMPORAL_FILENAME, -1);115} else if (myDistributionTag == SUMO_TAG_ROUTE_DISTRIBUTION) {116distribution = new GNERouteDistribution(distributionID, myFrameParent->getViewNet()->getNet(), TEMPORAL_FILENAME);117} else {118throw ProcessError("Invalid distribution");119}120// add it using undoList (to allow undo-redo)121undoList->begin(distribution->getTagProperty()->getGUIIcon(), "create distribution");122undoList->add(new GNEChange_DemandElement(distribution, true), true);123undoList->end();124// refresh selector using created distribution125myDistributionSelector->setDistribution(distribution);126return 1;127}128129130long131GNEDistributionFrame::DistributionEditor::onCmdDeleteDistribution(FXObject*, FXSelector, void*) {132auto undoList = myFrameParent->getViewNet()->getUndoList();133auto currentDistribution = myDistributionSelector->getCurrentDistribution();134if (currentDistribution) {135// begin undo list operation136undoList->begin(currentDistribution->getTagProperty()->getGUIIcon(), "delete " + currentDistribution->getTagProperty()->getTagStr() + " distribution");137// remove distribution138myFrameParent->getViewNet()->getNet()->deleteDemandElement(myDistributionSelector->getCurrentDistribution(), undoList);139// end undo list operation140undoList->end();141// refresh selector142myDistributionSelector->refreshDistributionSelector();143}144return 1;145}146147148long149GNEDistributionFrame::DistributionEditor::onUpdDeleteDistribution(FXObject* sender, FXSelector, void*) {150// check if we have a selected distribution151if (myDistributionSelector->getCurrentDistribution()) {152return sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), nullptr);153} else {154return sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), nullptr);155}156}157158// ---------------------------------------------------------------------------159// GNETypeFrame::DistributionSelector - methods160// ---------------------------------------------------------------------------161162GNEDistributionFrame::DistributionSelector::DistributionSelector(GNEFrame* frameParent) :163MFXGroupBoxModule(frameParent, TL("Distribution selector")),164myFrameParent(frameParent) {165// Create MFXComboBoxIcon166myDistributionsComboBox = new MFXComboBoxIcon(getCollapsableFrame(), frameParent->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu(),167true, GUIDesignComboBoxVisibleItems, this, MID_GNE_SET_TYPE, GUIDesignComboBox);168// DistributionSelector is always shown169show();170}171172173GNEDistributionFrame::DistributionSelector::~DistributionSelector() {}174175176void177GNEDistributionFrame::DistributionSelector::setDistribution(GNEDemandElement* distribution) {178myCurrentDistribution = distribution;179refreshDistributionSelector();180}181182183GNEDemandElement*184GNEDistributionFrame::DistributionSelector::getCurrentDistribution() const {185return myCurrentDistribution;186187}188189190void191GNEDistributionFrame::DistributionSelector::refreshDistributionIDs() {192// fill distributions193fillDistributionComboBox();194// set current item195for (int i = 0; i < (int)myDistributionsComboBox->getNumItems(); i++) {196if (myDistributionsComboBox->getItemText(i) == myCurrentDistribution->getID()) {197myDistributionsComboBox->setCurrentItem(i);198}199}200}201202203void204GNEDistributionFrame::DistributionSelector::refreshDistributionSelector() {205// fill distributions206const auto distributions = fillDistributionComboBox();207// update current distribution (used if myCurrentDistribution was deleted during undo-redo)208myCurrentDistribution = myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveDemandElement(myCurrentDistribution, false);209// update comboBox210if (myCurrentDistribution) {211for (int i = 0; i < (int)myDistributionsComboBox->getNumItems(); i++) {212if (myDistributionsComboBox->getItemText(i) == myCurrentDistribution->getID()) {213myDistributionsComboBox->setCurrentItem(i);214}215}216} else if (distributions.size() > 0) {217// set first distribution218myCurrentDistribution = distributions.begin()->second;219}220// continue depending of myCurrentDistribution221if (myCurrentDistribution) {222// show modules223myAttributesEditor->showAttributesEditor(myCurrentDistribution, true);224myDistributionValuesEditor->showDistributionValuesEditor();225} else {226// hide modules227myAttributesEditor->hideAttributesEditor();228myDistributionValuesEditor->hideDistributionValuesEditor();229}230}231232233long234GNEDistributionFrame::DistributionSelector::onCmdSelectDistribution(FXObject*, FXSelector, void*) {235const auto viewNet = myFrameParent->getViewNet();236const auto& distributions = viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(myDistributionEditor->getDistributionTag());237// Check if value of myTypeMatchBox correspond of an allowed additional tags238for (const auto& distribution : distributions) {239if (distribution.second->getID() == myDistributionsComboBox->getText().text()) {240// set pointer241myCurrentDistribution = distribution.second;242// set color of myTypeMatchBox to black (valid)243myDistributionsComboBox->setTextColor(GUIDesignTextColorBlack);244// show modules245myAttributesEditor->showAttributesEditor(distribution.second, true);246myDistributionValuesEditor->showDistributionValuesEditor();247// update viewNet248viewNet->updateViewNet();249return 1;250}251}252// not found, then reset myCurrentDistribution253myCurrentDistribution = nullptr;254// hide modules255myAttributesEditor->hideAttributesEditor();256myDistributionValuesEditor->hideDistributionValuesEditor();257// set color of myTypeMatchBox to red (invalid)258myDistributionsComboBox->setTextColor(GUIDesignTextColorRed);259// update viewNet260viewNet->updateViewNet();261return 1;262}263264265long266GNEDistributionFrame::DistributionSelector::onCmdUpdateDistribution(FXObject* sender, FXSelector, void*) {267const auto& demandElements = myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getDemandElements();268if (demandElements.at(myDistributionEditor->getDistributionTag()).size() > 0) {269return sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), nullptr);270} else {271return sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), nullptr);272}273}274275276std::map<std::string, GNEDemandElement*>277GNEDistributionFrame::DistributionSelector::fillDistributionComboBox() {278// get ACs279const auto& ACs = myFrameParent->getViewNet()->getNet()->getAttributeCarriers();280// clear items281myDistributionsComboBox->clearItems();282// fill with distributions sorted by ID283std::map<std::string, GNEDemandElement*> distributions;284for (const auto& distribution : ACs->getDemandElements().at(myDistributionEditor->getDistributionTag())) {285distributions[distribution.second->getID()] = distribution.second;286}287for (const auto& distribution : distributions) {288myDistributionsComboBox->appendIconItem(distribution.first.c_str(), distribution.second->getACIcon());289}290// return distributions sorted by ID291return distributions;292}293294// ---------------------------------------------------------------------------295// GNEDistributionFrame::DistributionRow - methods296// ---------------------------------------------------------------------------297298GNEDistributionFrame::DistributionRow::DistributionRow(DistributionValuesEditor* attributeEditorParent, const GNEDemandElement* key, const double probability) :299FXHorizontalFrame(attributeEditorParent->getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame),300myDistributionValuesEditorParent(attributeEditorParent),301myKey(key),302myProbability(probability) {303// get staticTooltip menu304auto staticTooltipMenu = attributeEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu();305// create label306myIconLabel = new FXLabel(this, "", key->getACIcon(), GUIDesignLabelIconThick);307// Create and hide MFXTextFieldIcon for string attributes308myComboBoxKeys = new MFXComboBoxIcon(this, staticTooltipMenu, true, GUIDesignComboBoxVisibleItems,309this, MID_GNE_SET_TYPE, GUIDesignComboBox);310// Create and hide MFXTextFieldIcon for string attributes311myProbabilityTextField = new MFXTextFieldIcon(this, staticTooltipMenu, GUIIcon::EMPTY, this, MID_GNE_SET_ATTRIBUTE,312GUIDesignTextFieldFixedRestricted(50, TEXTFIELD_REAL));313// create delete buton314myDeleteRowButton = new MFXButtonTooltip(this, staticTooltipMenu,315"", GUIIconSubSys::getIcon(GUIIcon::REMOVE), this, MID_GNE_BUTTON_REMOVE, GUIDesignButtonIcon);316myDeleteRowButton->setTipText(TL("Delete distribution value"));317// only create if parent was created318if (getParent()->id() && attributeEditorParent->myDistributionSelector->getCurrentDistribution()) {319// create DistributionRow320FXHorizontalFrame::create();321// refresh row322refreshRow();323// Show DistributionRow324show();325}326}327328329void330GNEDistributionFrame::DistributionRow::destroy() {331// only destroy if parent was created332if (getParent()->id()) {333FXHorizontalFrame::destroy();334}335}336337338void339GNEDistributionFrame::DistributionRow::refreshRow() {340/*341// get distribution selector342const auto currentDistribution = myDistributionValuesEditorParent->myDistributionSelector->getCurrentDistribution();343// get possible keys344const auto possibleKeys = currentDistribution->getPossibleDistributionKeys(myDistributionValuesEditorParent->myDistributionValueTag);345// refill combo Box with possible values346myComboBoxKeys->clearItems();347myComboBoxKeys->appendIconItem(myKey->getID().c_str());348for (const auto& possibleKey : possibleKeys) {349myComboBoxKeys->appendIconItem(possibleKey.first.c_str());350}351myComboBoxKeys->setCurrentItem(0);352// adjust combo Box353myComboBoxKeys->setTextColor(GUIDesignTextColorBlack);354myComboBoxKeys->killFocus();355// set probability356myProbabilityTextField->setText(toString(myProbability).c_str());357myProbabilityTextField->setTextColor(GUIDesignTextColorBlack);358myProbabilityTextField->killFocus();359*/360}361362363double364GNEDistributionFrame::DistributionRow::getProbability() const {365return myProbability;366}367368369long370GNEDistributionFrame::DistributionRow::onCmdSetKey(FXObject*, FXSelector, void*) {371// get Undo list372//GNEUndoList* undoList = myDistributionValuesEditorParent->getFrameParent()->getViewNet()->getUndoList();373// get current distribution374auto currentDistribution = myDistributionValuesEditorParent->myDistributionSelector->getCurrentDistribution();375// get ACs376//const auto& ACs = myDistributionValuesEditorParent->getFrameParent()->getViewNet()->getNet()->getAttributeCarriers();377// continue if we have a distribution to edit378if (currentDistribution == nullptr) {379return 1;380}381/*382// check if new key is valid383if (isValidNewKey()) {384myComboBoxKeys->setTextColor(GUIDesignTextColorBlack);385// get new key386const auto newKey = ACs->retrieveDemandElement(myDistributionValuesEditorParent->myDistributionValueTag, myComboBoxKeys->getText().text());387// only change if is different of current key388if (myKey != newKey) {389// begin undo list390undoList->begin(myKey, "edit distribution key");391// remove distribution key392currentDistribution->removeDistributionKey(myKey, undoList);393// sert key and icon394myKey = ACs->retrieveDemandElement(myDistributionValuesEditorParent->myDistributionValueTag, myComboBoxKeys->getText().text());395myIconLabel->setIcon(myKey->getACIcon());396// add distribution key (and probability)397currentDistribution->addDistributionKey(myKey, myProbability, undoList);398// end undo list399undoList->end();400// refresh all rows401myDistributionValuesEditorParent->refreshRows();402}403} else {404myComboBoxKeys->setTextColor(GUIDesignTextColorRed);405myComboBoxKeys->killFocus();406}407*/408return 1;409}410411412long413GNEDistributionFrame::DistributionRow::onCmdSetProbability(FXObject*, FXSelector, void*) {414// get current distribution415auto currentDistribution = myDistributionValuesEditorParent->myDistributionSelector->getCurrentDistribution();416// continue if we have a distribution to edit417if (currentDistribution == nullptr) {418return 1;419}420// get probability421const std::string probabilityStr = myProbabilityTextField->getText().text();422//const double probability = GNEAttributeCarrier::canParse<double>(probabilityStr) ? GNEAttributeCarrier::parse<double>(probabilityStr) : -1;423// Check if set new probability424/*425if (probability >= 0) {426// set new probability427myProbability = probability;428// edit distribution value429currentDistribution->editDistributionValue(myKey, probability, myDistributionValuesEditorParent->getFrameParent()->getViewNet()->getUndoList());430// reset color431myProbabilityTextField->setTextColor(GUIDesignTextColorBlack);432// update sum label433myDistributionValuesEditorParent->updateSumLabel();434} else {435myProbabilityTextField->setTextColor(GUIDesignTextColorRed);436myProbabilityTextField->killFocus();437}438*/439return 1;440}441442443long444GNEDistributionFrame::DistributionRow::onCmdRemoveRow(FXObject*, FXSelector, void*) {445// get current distribution446auto currentDistribution = myDistributionValuesEditorParent->myDistributionSelector->getCurrentDistribution();447// continue if we have a distribution to edit448if (currentDistribution == nullptr) {449return 1;450}451// remove distribution key452//currentDistribution->removeDistributionKey(myKey, myDistributionValuesEditorParent->getFrameParent()->getViewNet()->getUndoList());453// remake rows454myDistributionValuesEditorParent->remakeRows();455return 1;456}457458459bool460GNEDistributionFrame::DistributionRow::isValidNewKey() const {461/*462const auto ACs = myDistributionValuesEditorParent->getFrameParent()->getViewNet()->getNet()->getAttributeCarriers();463// get element associated with key464//const auto element = ACs->retrieveDemandElement(myDistributionValuesEditorParent->myDistributionValueTag, myComboBoxKeys->getText().text(), false);465// first check if element exists466if (element) {467// avoid duplicated keys468return !myKey->keyExists(element);469} else {470return false;471}472*/473return false;474}475476// ---------------------------------------------------------------------------477// GNEDistributionFrame::DistributionValuesEditor - methods478// ---------------------------------------------------------------------------479480GNEDistributionFrame::DistributionValuesEditor::DistributionValuesEditor(GNEFrame* frameParent, DistributionEditor* distributionEditor,481DistributionSelector* distributionSelector, GNEAttributesEditor* attributesEditor, SumoXMLTag distributionValueTag) :482MFXGroupBoxModule(frameParent, TL("Distribution values")),483myFrameParent(frameParent),484myDistributionEditor(distributionEditor),485myDistributionSelector(distributionSelector),486myAttributesEditor(attributesEditor),487myDistributionValueTag(distributionValueTag) {488// set relations489myDistributionEditor->myDistributionSelector = myDistributionSelector;490myDistributionSelector->myDistributionEditor = myDistributionEditor;491myDistributionSelector->myAttributesEditor = myAttributesEditor;492myDistributionSelector->myDistributionValuesEditor = this;493// get staticTooltip menu494auto staticTooltipMenu = frameParent->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu();495// Create bot frame elements496myBotFrame = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);497auto addButton = new MFXButtonTooltip(myBotFrame, staticTooltipMenu, "", GUIIconSubSys::getIcon(GUIIcon::ADD), this, MID_GNE_BUTTON_ADD, GUIDesignButtonIcon);498addButton->setTipText(TL("Add new distribution value"));499new FXHorizontalFrame(myBotFrame, GUIDesignAuxiliarHorizontalFrame);500new FXLabel(myBotFrame, "", GUIIconSubSys::getIcon(GUIIcon::SUM), GUIDesignLabelIconThick);501mySumLabel = new FXLabel(myBotFrame, "", nullptr, GUIDesignLabelThickedFixed(50));502new FXLabel(myBotFrame, "", GUIIconSubSys::getIcon(GUIIcon::EMPTY), GUIDesignLabelFixed(GUIDesignHeight));503}504505506void507GNEDistributionFrame::DistributionValuesEditor::showDistributionValuesEditor() {508// remake rows509remakeRows();510// show DistributionValuesEditor511show();512}513514515void516GNEDistributionFrame::DistributionValuesEditor::hideDistributionValuesEditor() {517// hide also DistributionValuesEditor518hide();519}520521522void523GNEDistributionFrame::DistributionValuesEditor::remakeRows() {524// first remove all rows525for (auto& row : myDistributionRows) {526// destroy and delete all rows527if (row != nullptr) {528row->destroy();529delete row;530row = nullptr;531}532}533myDistributionRows.clear();534/*535// continue if we have a distribution to edit536if (myDistributionSelector->getCurrentDistribution()) {537// Iterate over distribution key-values538for (const auto& keyValue : myDistributionSelector->getCurrentDistribution()->getDistributionKeyValues()) {539// create distribution row540auto distributionRow = new DistributionRow(this, keyValue.first, keyValue.second);541// add into distribution rows542myDistributionRows.push_back(distributionRow);543}544}545*/546// reparent bot frame button (to place it at bottom)547myBotFrame->reparent(getCollapsableFrame());548}549550551void552GNEDistributionFrame::DistributionValuesEditor::refreshRows() {553// refresh rows554for (const auto& row : myDistributionRows) {555row->refreshRow();556}557}558559560GNEFrame*561GNEDistributionFrame::DistributionValuesEditor::getFrameParent() const {562return myFrameParent;563}564565566void567GNEDistributionFrame::DistributionValuesEditor::updateSumLabel() {568// update probability569double sumProbability = 0;570for (const auto& row : myDistributionRows) {571sumProbability += row->getProbability();572}573mySumLabel->setText(toString(sumProbability).c_str());574}575576577long578GNEDistributionFrame::DistributionValuesEditor::onCmdAddRow(FXObject*, FXSelector, void*) {579if (myDistributionSelector->getCurrentDistribution() == nullptr) {580return 1;581}582/*583// get next free key584const auto possibleKeys = myDistributionSelector->getCurrentDistribution()->getPossibleDistributionKeys(myDistributionValueTag);585if (possibleKeys.empty()) {586return 1;587}588// add first possible key589myDistributionSelector->getCurrentDistribution()->addDistributionKey(possibleKeys.begin()->second, 0.5, myFrameParent->getViewNet()->getUndoList());590// remake rows591remakeRows();592*/593return 1;594}595596597long598GNEDistributionFrame::DistributionValuesEditor::onUpdAddRow(FXObject* sender, FXSelector, void*) {599if (myDistributionSelector->getCurrentDistribution() == nullptr) {600mySumLabel->setText("");601return sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), nullptr);602} else {603// update sum label604updateSumLabel();605/*606// enable or disable add button depending of existents distributions607if (myDistributionSelector->getCurrentDistribution()->getPossibleDistributionKeys(myDistributionValueTag).size() > 0) {608return sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), nullptr);609} else {610return sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), nullptr);611}612*/613}614return 1;615}616617/****************************************************************************/618619620