38#define BLACK_COLOR MFXUtils::getFXColor(RGBColor::BLACK)
39#define BLUE_COLOR MFXUtils::getFXColor(RGBColor::BLUE)
40#define RED_COLOR MFXUtils::getFXColor(RGBColor::RED)
59 GNEDialog(distributionParent->getNet()->getViewNet()->getViewParent()->getGNEAppWindows(),
60 TLF("Add % reference", distributionParent->getTagStr()), distributionParent->getTagProperty()->getGUIIcon(),
62 myDistributionParent(distributionParent) {
63 auto tooltipMenu = distributionParent->getNet()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu();
75 std::set<std::string> referenceIDs;
76 for (
const auto& reference : distributionParent->getHierarchicalElement()->getChildDemandElements()) {
77 if (reference->getTagProperty()->isDistributionReference()) {
78 referenceIDs.insert(reference->getParentDemandElements().at(1)->getID());
84 const auto& vTypes = distributionParent->getNet()->getAttributeCarriers()->getDemandElements().at(
SUMO_TAG_VTYPE);
86 for (
const auto& vType : vTypes) {
87 if (referenceIDs.count(vType.second->getID()) == 0) {
88 myCandidates[vType.second->getID()] = vType.second;
92 for (
const auto& vTypeID : myCandidates) {
93 myReferencesComboBox->appendIconItem(vTypeID.first.c_str());
97 const auto& routes = distributionParent->getNet()->getAttributeCarriers()->getDemandElements().at(
SUMO_TAG_ROUTE);
99 for (
const auto& route : routes) {
100 if (referenceIDs.count(route.second->getID()) == 0) {
101 myCandidates[route.second->getID()] = route.second;
105 for (
const auto& routeID : myCandidates) {
106 myReferencesComboBox->appendIconItem(routeID.first.c_str());
110 myReferencesComboBox->setCurrentItem(0, TRUE);
157 reference->
incRef(
"GNEDistributionRefDialog");
172 reference = candidate.second;
177 if (reference ==
nullptr) {
FXDEFMAP(GNEDistributionRefDialog) GNEDistributionRefDialogMap[]
@ MID_GNE_DISTRIBUTIONDIALOG_REFERENCE
change reference
@ MID_GNE_DISTRIBUTIONDIALOG_PROBABILITY
change probability
#define GUIDesignComboBox
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
#define GUIDesignComboBoxVisibleItems
#define GUIDesignTextFieldRestricted(type)
text field extended over Frame with thick frame (int)
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
@ SUMO_TAG_VTYPE
description of a vehicle/person/container type
@ SUMO_TAG_ROUTE_DISTRIBUTION
distribution of a route
@ SUMO_TAG_ROUTE
description of a route
@ SUMO_TAG_VTYPE_DISTRIBUTION
distribution of a vehicle type
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
bool isUndoRedoAllowed() const
const std::string getID() const override
get ID (all Attribute Carriers have one)
const std::string & getTagStr() const
get tag assigned to this object in string format
const GNETagProperties * getTagProperty() const
get tagProperty associated with this Attribute Carrier
GNENet * getNet() const
get pointer to net
virtual std::string getAttribute(SumoXMLAttr key) const =0
virtual GUIGlObject * getGUIGlObject()=0
get GUIGlObject associated with this AttributeCarrier
FXButton * myAcceptButton
accept button
long closeDialogAccepting()
close dialog accepting the changes
OpenType
Open dialog type.
long closeDialogCanceling()
close dialog declining the changes
long onCmdSetReference(FXObject *, FXSelector, void *)
event after choose a reference in the comboBox
long onCmdSetProbability(FXObject *, FXSelector, void *)
event after choose a reference in the probability
void runInternalTest(const InternalTestStep::DialogArgument *dialogArgument)
run internal test
MFXTextFieldIcon * myProbabilityTextField
textField probability
std::map< std::string, GNEDemandElement * > myCandidates
map with candidate IDs;
MFXComboBoxIcon * myReferencesComboBox
comboBox for references
GNEAttributeCarrier * myDistributionParent
FOX needs this.
~GNEDistributionRefDialog()
destructor
long onCmdAccept(FXObject *, FXSelector, void *)
event after press accept button
GNEDemandElement * myReferencedElement
current referenced element
void addChildElement(ChildType *element)
add child without updating parent (ONLY used if we're creating elements without undo-redo)
void insertDemandElement(GNEDemandElement *demandElement)
Insert a demand element in container.
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
GNEViewNet * getViewNet() const
get view net
void incRef(const std::string &debugMsg="")
Increase reference.
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
GNEViewParent * getViewParent() const
get the net object
GNEUndoList * getUndoList() const
get the undoList object
GNEApplicationWindow * getGNEAppWindows() const
get GNE Application Windows
dialog arguments, used for certain modal dialogs that can not be edited using tab
FXString getText() const
Get the text.
void setTextColor(FXColor clr)
Change text color.
FXColor getTextColor() const
Return text color.
FXColor getTextColor() const
Return text color.
FXString getText() const
Get the text for this label.
void setTextColor(FXColor clr)
Change text color.
void setText(const FXString &text, FXbool notify=FALSE)
Change the text and move cursor to end.