Eclipse SUMO - Simulation of Urban MObility
GNEDistributionFrame.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // The Widget for edit distribution elements
19 /****************************************************************************/
20 
21 #include <netedit/GNENet.h>
22 #include <netedit/GNEUndoList.h>
23 #include <netedit/GNEViewNet.h>
24 #include <netedit/GNEViewParent.h>
30 
31 #include "GNEDistributionFrame.h"
32 
33 
34 // ===========================================================================
35 // FOX callback mapping
36 // ===========================================================================
37 
42 };
43 
47 };
48 
49 
54 };
55 
56 FXDEFMAP(GNEDistributionFrame::DistributionValuesEditor) DistributionValuesEditorMap[] = {
59 };
60 
61 // Object implementation
62 FXIMPLEMENT(GNEDistributionFrame::DistributionEditor, MFXGroupBoxModule, DistributionEditorMap, ARRAYNUMBER(DistributionEditorMap))
63 FXIMPLEMENT(GNEDistributionFrame::DistributionSelector, MFXGroupBoxModule, DistributionSelectorMap, ARRAYNUMBER(DistributionSelectorMap))
64 FXIMPLEMENT(GNEDistributionFrame::DistributionRow, FXHorizontalFrame, DistributionRowMap, ARRAYNUMBER(DistributionRowMap))
65 FXIMPLEMENT(GNEDistributionFrame::DistributionValuesEditor, MFXGroupBoxModule, DistributionValuesEditorMap, ARRAYNUMBER(DistributionValuesEditorMap))
66 
67 
68 // ===========================================================================
69 // method definitions
70 // ===========================================================================
71 
72 // ---------------------------------------------------------------------------
73 // GNEDistributionFrame::DistributionEditor - methods
74 // ---------------------------------------------------------------------------
75 
77  MFXGroupBoxModule(frameParent, TL("Distribution Editor")),
78  myFrameParent(frameParent),
79  myDistributionTag(distributionTag) {
80  // get staticTooltip menu
81  auto staticTooltipMenu = myFrameParent->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu();
82  // Create new distribution
83  myCreateDistributionButton = new MFXButtonTooltip(getCollapsableFrame(), staticTooltipMenu, TL("New"),
85  myCreateDistributionButton->setTipText(TLF("Create new %", toString(myDistributionTag)).c_str()),
86  // Delete distribution
87  myDeleteDistributionButton = new MFXButtonTooltip(getCollapsableFrame(), staticTooltipMenu, TL("Delete"),
89  myDeleteDistributionButton->setTipText(TLF("Delete current edited %", toString(myDistributionTag)).c_str()),
90  // show editor
91  show();
92 }
93 
94 
96 
97 
100  return myDistributionTag;
101 }
102 
103 
104 long
106  auto undoList = myFrameParent->getViewNet()->getUndoList();
107  // obtain a new valid ID
108  const auto distributionID = myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->generateDemandElementID(myDistributionTag);
109  // create new distribution
110  GNEDemandElement* distribution = nullptr;
111  if (myDistributionTag == SUMO_TAG_VTYPE_DISTRIBUTION) {
112  distribution = new GNEVTypeDistribution(myFrameParent->getViewNet()->getNet(), distributionID, -1);
113  } else if (myDistributionTag == SUMO_TAG_ROUTE_DISTRIBUTION) {
114  distribution = new GNERouteDistribution(myFrameParent->getViewNet()->getNet(), distributionID);
115  } else {
116  throw ProcessError("Invalid distribution");
117  }
118  // add it using undoList (to allow undo-redo)
119  undoList->begin(distribution->getTagProperty().getGUIIcon(), "create distribution");
120  undoList->add(new GNEChange_DemandElement(distribution, true), true);
121  undoList->end();
122  // refresh selector using created distribution
123  myDistributionSelector->setDistribution(distribution);
124  return 1;
125 }
126 
127 
128 long
130  auto undoList = myFrameParent->getViewNet()->getUndoList();
131  auto currentDistribution = myDistributionSelector->getCurrentDistribution();
132  if (currentDistribution) {
133  // begin undo list operation
134  undoList->begin(currentDistribution->getTagProperty().getGUIIcon(), "delete " + currentDistribution->getTagProperty().getTagStr() + " distribution");
135  // remove distribution
136  myFrameParent->getViewNet()->getNet()->deleteDemandElement(myDistributionSelector->getCurrentDistribution(), undoList);
137  // end undo list operation
138  undoList->end();
139  // refresh selector
140  myDistributionSelector->refreshDistributionSelector();
141  }
142  return 1;
143 }
144 
145 
146 long
148  // check if we have a selected distribution
149  if (myDistributionSelector->getCurrentDistribution()) {
150  return sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), nullptr);
151  } else {
152  return sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), nullptr);
153  }
154 }
155 
156 // ---------------------------------------------------------------------------
157 // GNETypeFrame::DistributionSelector - methods
158 // ---------------------------------------------------------------------------
159 
161  MFXGroupBoxModule(frameParent, TL("Distribution selector")),
162  myFrameParent(frameParent) {
163  // Create MFXComboBoxIcon
166  // DistributionSelector is always shown
167  show();
168 }
169 
170 
172 
173 
174 void
176  myCurrentDistribution = distribution;
177  refreshDistributionSelector();
178 }
179 
180 
183  return myCurrentDistribution;
184 
185 }
186 
187 
188 void
190  // fill distributions
191  fillDistributionComboBox();
192  // set current item
193  for (int i = 0; i < (int)myDistributionsComboBox->getNumItems(); i++) {
194  if (myDistributionsComboBox->getItemText(i) == myCurrentDistribution->getID()) {
195  myDistributionsComboBox->setCurrentItem(i);
196  }
197  }
198 }
199 
200 
201 void
203  // fill distributions
204  const auto distributions = fillDistributionComboBox();
205  // update current distribution (used if myCurrentDistribution was deleted during undo-redo)
206  myCurrentDistribution = myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveDemandElement(myCurrentDistribution, false);
207  // update comboBox
208  if (myCurrentDistribution) {
209  for (int i = 0; i < (int)myDistributionsComboBox->getNumItems(); i++) {
210  if (myDistributionsComboBox->getItemText(i) == myCurrentDistribution->getID()) {
211  myDistributionsComboBox->setCurrentItem(i);
212  }
213  }
214  } else if (distributions.size() > 0) {
215  // set first distribution
216  myCurrentDistribution = distributions.begin()->second;
217  }
218  // continue depending of myCurrentDistribution
219  if (myCurrentDistribution) {
220  // set distribtution as inspected element
221  myFrameParent->getViewNet()->setInspectedAttributeCarriers({myCurrentDistribution});
222  // show modules
223  myAttributesEditor->showAttributeEditorModule(true);
224  myDistributionValuesEditor->showDistributionValuesEditor();
225  } else {
226  // remove inspected elements
227  myFrameParent->getViewNet()->setInspectedAttributeCarriers({});
228  // hide modules
229  myAttributesEditor->hideAttributesEditorModule();
230  myDistributionValuesEditor->hideDistributionValuesEditor();
231  }
232 }
233 
234 
235 long
237  const auto viewNet = myFrameParent->getViewNet();
238  const auto& distributions = viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(myDistributionEditor->getDistributionTag());
239  // Check if value of myTypeMatchBox correspond of an allowed additional tags
240  for (const auto& distribution : distributions) {
241  if (distribution.second->getID() == myDistributionsComboBox->getText().text()) {
242  // set pointer
243  myCurrentDistribution = distribution.second;
244  // set color of myTypeMatchBox to black (valid)
245  myDistributionsComboBox->setTextColor(FXRGB(0, 0, 0));
246  // set myCurrentType as inspected element
247  viewNet->setInspectedAttributeCarriers({distribution.second});
248  // show modules
249  myAttributesEditor->showAttributeEditorModule(true);
250  myDistributionValuesEditor->showDistributionValuesEditor();
251  // Write Warning in console if we're in testing mode
252  WRITE_DEBUG(("Selected item '" + myDistributionsComboBox->getText() + "' in DistributionSelector").text());
253  // update viewNet
254  viewNet->updateViewNet();
255  return 1;
256  }
257  }
258  // not found, then reset myCurrentDistribution
259  myCurrentDistribution = nullptr;
260  // hide modules
261  myAttributesEditor->hideAttributesEditorModule();
262  myDistributionValuesEditor->hideDistributionValuesEditor();
263  // set color of myTypeMatchBox to red (invalid)
264  myDistributionsComboBox->setTextColor(FXRGB(255, 0, 0));
265  // Write Warning in console if we're in testing mode
266  WRITE_DEBUG("Selected invalid item in DistributionSelector");
267  // update viewNet
268  viewNet->updateViewNet();
269  return 1;
270 }
271 
272 
273 long
275  const auto& demandElements = myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getDemandElements();
276  if (demandElements.at(myDistributionEditor->getDistributionTag()).size() > 0) {
277  return sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), nullptr);
278  } else {
279  return sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), nullptr);
280  }
281 }
282 
283 
284 std::map<std::string, GNEDemandElement*>
286  // get ACs
287  const auto& ACs = myFrameParent->getViewNet()->getNet()->getAttributeCarriers();
288  // clear items
289  myDistributionsComboBox->clearItems();
290  // fill with distributions sorted by ID
291  std::map<std::string, GNEDemandElement*> distributions;
292  for (const auto& distribution : ACs->getDemandElements().at(myDistributionEditor->getDistributionTag())) {
293  distributions[distribution.second->getID()] = distribution.second;
294  }
295  for (const auto& distribution : distributions) {
296  myDistributionsComboBox->appendIconItem(distribution.first.c_str(), distribution.second->getACIcon());
297  }
298  // return distributions sorted by ID
299  return distributions;
300 }
301 
302 // ---------------------------------------------------------------------------
303 // GNEDistributionFrame::DistributionRow - methods
304 // ---------------------------------------------------------------------------
305 
306 GNEDistributionFrame::DistributionRow::DistributionRow(DistributionValuesEditor* attributeEditorParent, const GNEDemandElement* key, const double probability) :
307  FXHorizontalFrame(attributeEditorParent->getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame),
308  myDistributionValuesEditorParent(attributeEditorParent),
309  myKey(key),
310  myProbability(probability) {
311  // get staticTooltip menu
312  auto staticTooltipMenu = attributeEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu();
313  // create label
314  myIconLabel = new FXLabel(this, "", key->getACIcon(), GUIDesignLabelIconThick);
315  // Create and hide MFXTextFieldTooltip for string attributes
318  // Create and hide MFXTextFieldTooltip for string attributes
319  myProbabilityTextField = new MFXTextFieldTooltip(this, staticTooltipMenu,
321  // create delete buton
322  myDeleteRowButton = new MFXButtonTooltip(this, staticTooltipMenu,
324  myDeleteRowButton->setTipText(TL("Delete distribution value"));
325  // only create if parent was created
326  if (getParent()->id() && attributeEditorParent->myDistributionSelector->getCurrentDistribution()) {
327  // create DistributionRow
328  FXHorizontalFrame::create();
329  // refresh row
330  refreshRow();
331  // Show DistributionRow
332  show();
333  }
334 }
335 
336 
337 void
339  // only destroy if parent was created
340  if (getParent()->id()) {
341  FXHorizontalFrame::destroy();
342  }
343 }
344 
345 
346 void
348  // get distribution selector
349  const auto currentDistribution = myDistributionValuesEditorParent->myDistributionSelector->getCurrentDistribution();
350  // get possible keys
351  const auto possibleKeys = currentDistribution->getPossibleDistributionKeys(myDistributionValuesEditorParent->myDistributionValueTag);
352  // refill combo Box with possible values
353  myComboBoxKeys->clearItems();
354  myComboBoxKeys->appendIconItem(myKey->getID().c_str());
355  for (const auto& possibleKey : possibleKeys) {
356  myComboBoxKeys->appendIconItem(possibleKey.first.c_str());
357  }
358  myComboBoxKeys->setCurrentItem(0);
359  // adjust combo Box
360  myComboBoxKeys->setTextColor(FXRGB(0, 0, 0));
361  myComboBoxKeys->killFocus();
362  // set probability
363  myProbabilityTextField->setText(toString(myProbability).c_str());
364  myProbabilityTextField->setTextColor(FXRGB(0, 0, 0));
365  myProbabilityTextField->killFocus();
366 }
367 
368 
369 double
371  return myProbability;
372 }
373 
374 
375 long
377  // get Undo list
378  GNEUndoList* undoList = myDistributionValuesEditorParent->getFrameParent()->getViewNet()->getUndoList();
379  // get current distribution
380  auto currentDistribution = myDistributionValuesEditorParent->myDistributionSelector->getCurrentDistribution();
381  // get ACs
382  const auto& ACs = myDistributionValuesEditorParent->getFrameParent()->getViewNet()->getNet()->getAttributeCarriers();
383  // continue if we have a distribution to edit
384  if (currentDistribution == nullptr) {
385  return 1;
386  }
387  // check if new key is valid
388  if (isValidNewKey()) {
389  myComboBoxKeys->setTextColor(FXRGB(0, 0, 0));
390  // get new key
391  const auto newKey = ACs->retrieveDemandElement(myDistributionValuesEditorParent->myDistributionValueTag, myComboBoxKeys->getText().text());
392  // only change if is different of current key
393  if (myKey != newKey) {
394  // begin undo list
395  undoList->begin(myKey, "edit distribution key");
396  // remove distribution key
397  currentDistribution->removeDistributionKey(myKey, undoList);
398  // sert key and icon
399  myKey = ACs->retrieveDemandElement(myDistributionValuesEditorParent->myDistributionValueTag, myComboBoxKeys->getText().text());
400  myIconLabel->setIcon(myKey->getACIcon());
401  // add distribution key (and probability)
402  currentDistribution->addDistributionKey(myKey, myProbability, undoList);
403  // end undo list
404  undoList->end();
405  // refresh all rows
406  myDistributionValuesEditorParent->refreshRows();
407  }
408  } else {
409  myComboBoxKeys->setTextColor(FXRGB(255, 0, 0));
410  myComboBoxKeys->killFocus();
411  }
412  return 1;
413 }
414 
415 
416 long
418  // get current distribution
419  auto currentDistribution = myDistributionValuesEditorParent->myDistributionSelector->getCurrentDistribution();
420  // continue if we have a distribution to edit
421  if (currentDistribution == nullptr) {
422  return 1;
423  }
424  // get probability
425  const std::string probabilityStr = myProbabilityTextField->getText().text();
426  const double probability = GNEAttributeCarrier::canParse<double>(probabilityStr) ? GNEAttributeCarrier::parse<double>(probabilityStr) : -1;
427  // Check if set new probability
428  if (probability >= 0) {
429  // set new probability
430  myProbability = probability;
431  // edit distribution value
432  currentDistribution->editDistributionValue(myKey, probability, myDistributionValuesEditorParent->getFrameParent()->getViewNet()->getUndoList());
433  // reset color
434  myProbabilityTextField->setTextColor(FXRGB(0, 0, 0));
435  // update sum label
436  myDistributionValuesEditorParent->updateSumLabel();
437  } else {
438  myProbabilityTextField->setTextColor(FXRGB(255, 0, 0));
439  myProbabilityTextField->killFocus();
440  }
441  return 1;
442 }
443 
444 
445 long
447  // get current distribution
448  auto currentDistribution = myDistributionValuesEditorParent->myDistributionSelector->getCurrentDistribution();
449  // continue if we have a distribution to edit
450  if (currentDistribution == nullptr) {
451  return 1;
452  }
453  // remove distribution key
454  currentDistribution->removeDistributionKey(myKey, myDistributionValuesEditorParent->getFrameParent()->getViewNet()->getUndoList());
455  // remake rows
456  myDistributionValuesEditorParent->remakeRows();
457  return 1;
458 }
459 
460 
461 bool
463  const auto ACs = myDistributionValuesEditorParent->getFrameParent()->getViewNet()->getNet()->getAttributeCarriers();
464  // get element associated with key
465  const auto element = ACs->retrieveDemandElement(myDistributionValuesEditorParent->myDistributionValueTag, myComboBoxKeys->getText().text(), false);
466  // first check if element exists
467  if (element) {
468  // avoid duplicated keys
469  return !myKey->keyExists(element);
470  } else {
471  return false;
472  }
473 }
474 
475 // ---------------------------------------------------------------------------
476 // GNEDistributionFrame::DistributionValuesEditor - methods
477 // ---------------------------------------------------------------------------
478 
480  DistributionSelector* distributionSelector, GNEFrameAttributeModules::AttributesEditor* attributesEditor, SumoXMLTag distributionValueTag) :
481  MFXGroupBoxModule(frameParent, TL("Distribution values")),
482  myFrameParent(frameParent),
483  myDistributionEditor(distributionEditor),
484  myDistributionSelector(distributionSelector),
485  myAttributesEditor(attributesEditor),
486  myDistributionValueTag(distributionValueTag) {
487  // set relations
492  // get staticTooltip menu
493  auto staticTooltipMenu = frameParent->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu();
494  // Create bot frame elements
496  auto addButton = new MFXButtonTooltip(myBotFrame, staticTooltipMenu, "", GUIIconSubSys::getIcon(GUIIcon::ADD), this, MID_GNE_BUTTON_ADD, GUIDesignButtonIcon);
497  addButton->setTipText(TL("Add new distribution value"));
498  new FXHorizontalFrame(myBotFrame, GUIDesignAuxiliarHorizontalFrame);
500  mySumLabel = new FXLabel(myBotFrame, "", nullptr, GUIDesignLabelThickedFixed(50));
502 }
503 
504 
505 void
507  // remake rows
508  remakeRows();
509  // show DistributionValuesEditor
510  show();
511 }
512 
513 
514 void
516  // hide also DistributionValuesEditor
517  hide();
518 }
519 
520 
521 void
523  // first remove all rows
524  for (auto& row : myDistributionRows) {
525  // destroy and delete all rows
526  if (row != nullptr) {
527  row->destroy();
528  delete row;
529  row = nullptr;
530  }
531  }
532  myDistributionRows.clear();
533  // continue if we have a distribution to edit
534  if (myDistributionSelector->getCurrentDistribution()) {
535  // Iterate over distribution key-values
536  for (const auto& keyValue : myDistributionSelector->getCurrentDistribution()->getDistributionKeyValues()) {
537  // create distribution row
538  auto distributionRow = new DistributionRow(this, keyValue.first, keyValue.second);
539  // add into distribution rows
540  myDistributionRows.push_back(distributionRow);
541  }
542  }
543  // reparent bot frame button (to place it at bottom)
544  myBotFrame->reparent(getCollapsableFrame());
545 }
546 
547 
548 void
550  // refresh rows
551  for (const auto& row : myDistributionRows) {
552  row->refreshRow();
553  }
554 }
555 
556 
557 GNEFrame*
559  return myFrameParent;
560 }
561 
562 
563 void
565  // update probability
566  double sumProbability = 0;
567  for (const auto& row : myDistributionRows) {
568  sumProbability += row->getProbability();
569  }
570  mySumLabel->setText(toString(sumProbability).c_str());
571 }
572 
573 
574 long
576  if (myDistributionSelector->getCurrentDistribution() == nullptr) {
577  return 1;
578  }
579  // get next free key
580  const auto possibleKeys = myDistributionSelector->getCurrentDistribution()->getPossibleDistributionKeys(myDistributionValueTag);
581  if (possibleKeys.empty()) {
582  return 1;
583  }
584  // add first possible key
585  myDistributionSelector->getCurrentDistribution()->addDistributionKey(possibleKeys.begin()->second, 0.5, myFrameParent->getViewNet()->getUndoList());
586  // remake rows
587  remakeRows();
588  return 1;
589 }
590 
591 
592 long
594  if (myDistributionSelector->getCurrentDistribution() == nullptr) {
595  mySumLabel->setText("");
596  return sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), nullptr);
597  } else {
598  // update sum label
599  updateSumLabel();
600  // enable or disable add button depending of existents distributions
601  if (myDistributionSelector->getCurrentDistribution()->getPossibleDistributionKeys(myDistributionValueTag).size() > 0) {
602  return sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), nullptr);
603  } else {
604  return sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), nullptr);
605  }
606  }
607 }
608 
609 /****************************************************************************/
FXDEFMAP(GNEDistributionFrame::DistributionEditor) DistributionEditorMap[]
@ MID_GNE_DELETE
delete element
Definition: GUIAppEnum.h:934
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition: GUIAppEnum.h:930
@ MID_GNE_BUTTON_REMOVE
remove button
Definition: GUIAppEnum.h:1422
@ MID_GNE_BUTTON_ADD
add button
Definition: GUIAppEnum.h:1420
@ MID_GNE_CREATE
create element
Definition: GUIAppEnum.h:932
@ MID_GNE_SET_TYPE
used to select a type of element in a combo box
Definition: GUIAppEnum.h:950
#define GUIDesignLabelFixed(width)
label, icon before text, text centered and custom width
Definition: GUIDesigns.h:252
#define GUIDesignButtonIcon
button only with icon
Definition: GUIDesigns.h:97
#define GUIDesignButton
Definition: GUIDesigns.h:88
#define GUIDesignComboBox
Definition: GUIDesigns.h:299
#define GUIDesignComboBoxNCol
number of column of every combo box
Definition: GUIDesigns.h:317
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition: GUIDesigns.h:405
#define GUIDesignComboBoxVisibleItemsMedium
combo box medium small
Definition: GUIDesigns.h:53
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition: GUIDesigns.h:80
#define GUIDesignTextFieldFixedRestricted(width, type)
text field with fixed width
Definition: GUIDesigns.h:74
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
Definition: GUIDesigns.h:258
#define GUIDesignLabelIconThick
label squared over frame with thick and with text justify to center
Definition: GUIDesigns.h:261
GUIIcon
An enumeration of icons used by the gui applications.
Definition: GUIIcons.h:33
#define WRITE_DEBUG(msg)
Definition: MsgHandler.h:306
#define TL(string)
Definition: MsgHandler.h:315
#define TLF(string,...)
Definition: MsgHandler.h:317
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_ROUTE_DISTRIBUTION
distribution of a route
@ SUMO_TAG_VTYPE_DISTRIBUTION
distribution of a vehicle type
int GUIDesignHeight
the default size for GUI elements
Definition: StdDefs.cpp:34
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
long onCmdDeleteDistribution(FXObject *, FXSelector, void *)
Called when "Delete distribution" button is clicked.
SumoXMLTag getDistributionTag() const
get distribution tag
long onUpdDeleteDistribution(FXObject *sender, FXSelector, void *)
Called when "Delete distribution" button is updated.
long onCmdCreateDistribution(FXObject *, FXSelector, void *)
Called when "create distribution" button is clicked.
DistributionSelector * myDistributionSelector
distribution selector
void destroy()
destroy DistributionRow (but don't delete)
long onCmdSetProbability(FXObject *, FXSelector, void *)
try to set new probability
MFXComboBoxIcon * myComboBoxKeys
comboBox with keys
long onCmdRemoveRow(FXObject *, FXSelector, void *)
remove row
long onCmdSetKey(FXObject *, FXSelector, void *)
try to set new key
DistributionRow(DistributionValuesEditor *attributeEditorParent, const GNEDemandElement *key, const double probability)
FOX-declaration.
double getProbability() const
get current probability
MFXTextFieldTooltip * myProbabilityTextField
textField to modify the probability attribute
MFXButtonTooltip * myDeleteRowButton
delete row button
GNEDemandElement * getCurrentDistribution() const
current distribution
DistributionValuesEditor * myDistributionValuesEditor
distribution values editor
std::map< std::string, GNEDemandElement * > fillDistributionComboBox()
FOX need this.
long onCmdSelectDistribution(FXObject *, FXSelector, void *)
Called when the user select distribution in ComboBox.
void refreshDistributionIDs()
refresh distribution IDs (only call when user change ID in internal attributes)
MFXComboBoxIcon * myDistributionsComboBox
comboBox with the list of distributions
DistributionEditor * myDistributionEditor
pointer to distribution editor
long onCmdUpdateDistribution(FXObject *sender, FXSelector, void *)
update distribution comboBox
GNEFrameAttributeModules::AttributesEditor * myAttributesEditor
attributes editor
void setDistribution(GNEDemandElement *distribution)
refresh modul
DistributionSelector(GNEFrame *frameParent)
constructor
long onUpdAddRow(FXObject *sender, FXSelector, void *)
Called when sum button button is updated.
GNEFrame * getFrameParent() const
pointer to GNEFrame parent
DistributionEditor * myDistributionEditor
distribution editor
DistributionValuesEditor(GNEFrame *frameParent, DistributionEditor *distributionEditor, DistributionSelector *distributionSelector, GNEFrameAttributeModules::AttributesEditor *attributesEditor, SumoXMLTag distributionValueTag)
constructor
long onCmdAddRow(FXObject *, FXSelector, void *)
Called when user press the add button.
DistributionSelector * myDistributionSelector
distribution selector
GNEFrameAttributeModules::AttributesEditor * myAttributesEditor
attributes editor
void showDistributionValuesEditor()
show attributes of multiple ACs
GNEViewNet * getViewNet() const
get view net
Definition: GNEFrame.cpp:150
GUIIcon getGUIIcon() const
get GUI icon associated to this Tag
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
GNEViewParent * getViewParent() const
get the net object
GNEApplicationWindow * getGNEAppWindows() const
get GNE Application Windows
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
MFXStaticToolTip * getStaticTooltipMenu() const
get static toolTip for menus
ComboBox with icon.
MFXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)