69 myMeanDataFrameParent(meanDataFrameParent) {
75 for (
const auto& meanDataType : meanDataTypes) {
76 myTypeComboBox->appendIconItem(meanDataType.getTagStr().c_str(),
GUIIconSubSys::getIcon(meanDataType.getGUIIcon()));
79 myCurrentMeanData = meanDataTypes.front();
90 return myCurrentMeanData;
97 myTypeComboBox->clearItems();
100 for (
const auto& meanDataType : meanDataTypes) {
101 myTypeComboBox->appendIconItem(meanDataType.getTagStr().c_str(),
GUIIconSubSys::getIcon(meanDataType.getGUIIcon()));
104 if (myCurrentMeanData.getTagStr() != myInvalidMeanData.getTagStr()) {
105 for (
int i = 0; i < (int)myTypeComboBox->getNumItems(); i++) {
106 if (myTypeComboBox->getItemText(i) == myCurrentMeanData.getTagStr()) {
107 myTypeComboBox->setCurrentItem(i);
111 myCurrentMeanData = meanDataTypes.front();
114 myMeanDataFrameParent->myMeanDataEditor->refreshMeanDataEditorModule();
116 myMeanDataFrameParent->myMeanDataEditor->showMeanDataEditorModule();
117 myMeanDataFrameParent->myMeanDataSelector->showMeanDataSelector();
126 for (
const auto& meanDataType : meanDataTypes) {
127 if (meanDataType.getTagStr() == myTypeComboBox->getText().text()) {
129 myCurrentMeanData = meanDataType;
131 myTypeComboBox->setTextColor(FXRGB(0, 0, 0));
133 myMeanDataFrameParent->myMeanDataEditor->refreshMeanDataEditorModule();
135 myMeanDataFrameParent->myMeanDataEditor->showMeanDataEditorModule();
136 myMeanDataFrameParent->myMeanDataSelector->showMeanDataSelector();
138 WRITE_DEBUG((
"Selected item '" + myTypeComboBox->getText() +
"' in MeanDataTypeSelector").text());
142 myCurrentMeanData = myInvalidMeanData;
144 myMeanDataFrameParent->myMeanDataEditor->refreshMeanDataEditorModule();
146 myMeanDataFrameParent->myMeanDataEditor->hideMeanDataEditorModule();
147 myMeanDataFrameParent->myMeanDataSelector->hideMeanDataSelector();
149 myTypeComboBox->setTextColor(FXRGB(255, 0, 0));
151 WRITE_DEBUG(
"Selected invalid item in MeanDataTypeSelector");
161 myMeanDataFrameParent(meanDataFrameParent) {
179 refreshMeanDataEditorModule();
193 if (myMeanDataFrameParent->myMeanDataSelector->getCurrentMeanData() ==
nullptr) {
195 myDeleteMeanDataButton->disable();
196 myCopyMeanDataButton->disable();
199 myDeleteMeanDataButton->enable();
200 myCopyMeanDataButton->enable();
210 SumoXMLTag meanDataTag = myMeanDataFrameParent->myMeanDataTypeSelector->getCurrentMeanData().getTag();
212 const std::string typeID = myMeanDataFrameParent->myViewNet->getNet()->getAttributeCarriers()->generateMeanDataID(meanDataTag);
215 myMeanDataFrameParent->myMeanDataTypeSelector->getCurrentMeanData().getTag(), typeID);
217 myMeanDataFrameParent->myViewNet->getUndoList()->begin(meanData,
"create meanData");
218 myMeanDataFrameParent->myViewNet->getUndoList()->add(
new GNEChange_MeanData(meanData,
true),
true);
219 myMeanDataFrameParent->myViewNet->getUndoList()->end();
221 myMeanDataFrameParent->myMeanDataSelector->setCurrentMeanData(meanData);
229 myMeanDataFrameParent->myViewNet->getUndoList()->begin(
GUIIcon::MODEDELETE,
"delete meanData");
231 myMeanDataFrameParent->myViewNet->getNet()->deleteMeanData(myMeanDataFrameParent->myMeanDataSelector->getCurrentMeanData(),
232 myMeanDataFrameParent->myViewNet->getUndoList());
234 myMeanDataFrameParent->myViewNet->getUndoList()->end();
236 myMeanDataFrameParent->myMeanDataSelector->refreshMeanDataSelector(
false);
244 SumoXMLTag meanDataTag = myMeanDataFrameParent->myMeanDataTypeSelector->getCurrentMeanData().getTag();
246 const std::string typeID = myMeanDataFrameParent->myViewNet->getNet()->getAttributeCarriers()->generateMeanDataID(meanDataTag);
248 GNEMeanData* meanData =
dynamic_cast<GNEMeanData*
>(myMeanDataFrameParent->myMeanDataSelector->getCurrentMeanData());
253 myMeanDataFrameParent->myMeanDataTypeSelector->getCurrentMeanData().getTag(), typeID);
255 myMeanDataFrameParent->myViewNet->getUndoList()->begin(meanDataCopy,
"copy meanData");
257 myMeanDataFrameParent->myViewNet->getUndoList()->add(
new GNEChange_MeanData(meanDataCopy,
true),
true);
259 myMeanDataFrameParent->myViewNet->getUndoList()->end();
261 myMeanDataFrameParent->myMeanDataSelector->refreshMeanDataSelector(
false);
263 myMeanDataFrameParent->myMeanDataSelector->setCurrentMeanData(meanDataCopy);
265 myMeanDataFrameParent->myMeanDataEditor->refreshMeanDataEditorModule();
276 myMeanDataFrameParent(typeFrameParent),
277 myCurrentMeanData(nullptr) {
303 refreshMeanDataSelector(
false);
312 myMeanDataFrameParent->myMeanDataAttributesEditor->hideAttributesEditor();
320 return myCurrentMeanData;
326 myCurrentMeanData = vMeanData;
327 refreshMeanDataSelector(
false);
334 SumoXMLTag meanDataTag = myMeanDataFrameParent->myMeanDataTypeSelector->getCurrentMeanData().getTag();
336 std::map<std::string, GNEMeanData*> sortedMeanDatas;
337 for (
const auto& meanData : myMeanDataFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getMeanDatas().at(meanDataTag)) {
338 sortedMeanDatas[meanData.second->getID()] = meanData.second;
341 myMeanDataComboBox->clearItems();
343 for (
const auto& sortedMeanData : sortedMeanDatas) {
344 myMeanDataComboBox->appendIconItem(sortedMeanData.first.c_str(), sortedMeanData.second->getACIcon());
347 if (myCurrentMeanData && myMeanDataFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveMeanData(myCurrentMeanData->getTagProperty().getTag(), myCurrentMeanData->getID(),
false)) {
348 bool validMeanData =
false;
349 for (
int i = 0; i < (int)myMeanDataComboBox->getNumItems(); i++) {
350 if (myMeanDataComboBox->getItemText(i) == myCurrentMeanData->getID()) {
351 myMeanDataComboBox->setCurrentItem(i);
352 validMeanData =
true;
355 if (!validMeanData) {
356 myCurrentMeanData =
nullptr;
359 myCurrentMeanData =
nullptr;
362 if (sortedMeanDatas.size() > 0) {
363 myMeanDataComboBox->enable();
365 if (myCurrentMeanData ==
nullptr) {
366 myCurrentMeanData = sortedMeanDatas.begin()->second;
369 myMeanDataComboBox->disable();
372 myMeanDataFrameParent->myMeanDataEditor->refreshMeanDataEditorModule();
374 if (!afterChangingID) {
375 if (myCurrentMeanData) {
376 myMeanDataFrameParent->myMeanDataAttributesEditor->showAttributesEditor(myCurrentMeanData);
378 myMeanDataFrameParent->myMeanDataAttributesEditor->hideAttributesEditor();
386 if (myCurrentMeanData) {
387 myMeanDataComboBox->updateIconItem(myMeanDataComboBox->getCurrentItem(), myCurrentMeanData->getID().c_str(), myCurrentMeanData->getACIcon());
395 SumoXMLTag meanDataTag = myMeanDataFrameParent->myMeanDataTypeSelector->getCurrentMeanData().getTag();
397 for (
const auto& meanData : myMeanDataFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getMeanDatas().at(meanDataTag)) {
398 if (meanData.second->getID() == myMeanDataComboBox->getText().text()) {
400 myCurrentMeanData = meanData.second;
402 myMeanDataComboBox->setTextColor(FXRGB(0, 0, 0));
404 myMeanDataFrameParent->myMeanDataEditor->refreshMeanDataEditorModule();
406 myMeanDataFrameParent->myMeanDataAttributesEditor->showAttributesEditor(myCurrentMeanData);
408 WRITE_DEBUG((
"Selected item '" + myMeanDataComboBox->getText() +
"' in MeanDataSelector").text());
410 myMeanDataFrameParent->getViewNet()->updateViewNet();
414 myCurrentMeanData =
nullptr;
416 myMeanDataFrameParent->myMeanDataEditor->refreshMeanDataEditorModule();
418 myMeanDataFrameParent->myMeanDataAttributesEditor->hideAttributesEditor();
420 myMeanDataComboBox->setTextColor(FXRGB(255, 0, 0));
422 WRITE_DEBUG(
"Selected invalid item in MeanDataSelector");
424 myMeanDataFrameParent->getViewNet()->updateViewNet();
433 GNEFrame(viewParent, viewNet,
TL(
"MeanData")) {
FXDEFMAP(GNEMeanDataFrame::MeanDataTypeSelector) meanDataSelectorMap[]
@ MID_GNE_DELETE
delete element
@ MID_GNE_COPY
copy element
@ MID_GNE_CREATE
create element
@ MID_GNE_SET_TYPE
used to select a type of element in a combo box
#define GUIDesignComboBox
#define GUIDesignComboBoxNCol
number of column of every combo box
#define GUIDesignComboBoxVisibleItems
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
static const std::vector< GNETagProperties > getTagPropertiesByType(const int tagPropertyCategory, const bool mergeCommonPlans)
get tagProperties associated to the given GNETagProperties::TagType (NETWORKELEMENT,...
GNEViewNet * getViewNet() const
get view net
virtual void show()
show Frame
virtual void hide()
hide Frame
void hideMeanDataEditorModule()
hide MeanDataEditor box
void refreshMeanDataEditorModule()
update MeanDataEditor modul
FXButton * myCopyMeanDataButton
"copy meanData"
~MeanDataEditor()
destructor
FXButton * myCreateMeanDataButton
"create meanData" button
long onCmdCopyMeanData(FXObject *, FXSelector, void *)
Called when "Copy Vehicle MeanData" button is clicked.
long onCmdCreateMeanData(FXObject *, FXSelector, void *)
MeanDataEditor(GNEMeanDataFrame *meanDataFrameParent)
FOX-declaration.
void showMeanDataEditorModule()
show MeanDataEditor modul
long onCmdDeletetMeanData(FXObject *, FXSelector, void *)
Called when "Delete Vehicle MeanData" button is clicked.
FXButton * myDeleteMeanDataButton
"delete meanData" button
~MeanDataSelector()
destructor
void showMeanDataSelector()
show MeanDataSelector
void hideMeanDataSelector()
hide MeanDataSelector
GNEMeanData * myCurrentMeanData
pointer to current meanData
MeanDataSelector(GNEMeanDataFrame *typeFrameParent)
FOX-declaration.
GNEMeanData * getCurrentMeanData() const
get current Vehicle MeanData
void refreshMeanDataSelectorIDs()
refresh meanData selector (only IDs, without refreshing attributes)
MFXComboBoxIcon * myMeanDataComboBox
comboBox with the list of meanDatas
void refreshMeanDataSelector(bool afterChangingID)
refresh meanData selector
void setCurrentMeanData(GNEMeanData *vMeanData)
set current Vehicle MeanData
GNEMeanDataFrame * myMeanDataFrameParent
pointer to Frame Parent
long onCmdSelectItem(FXObject *, FXSelector, void *)
void refreshMeanDataTypeSelector()
refresh meanData selector
const GNETagProperties & getCurrentMeanData() const
get current MeanData
~MeanDataTypeSelector()
destructor
long onCmdSelectItem(FXObject *, FXSelector, void *)
void attributeUpdated(SumoXMLAttr attribute)
function called after set a valid attribute in AttributeCreator/AttributeEditor/ParametersEditor/....
MeanDataSelector * myMeanDataSelector
meanData selector
~GNEMeanDataFrame()
Destructor.
GNEAttributesEditor * myMeanDataAttributesEditor
meanData attributes editor
GNEMeanDataFrame(GNEViewParent *viewParent, GNEViewNet *viewNet)
Constructor (protected due GNEMeanDataFrame is abtract)
MeanDataTypeSelector * myMeanDataTypeSelector
meanData type selector
void updateFrameAfterUndoRedo()
function called after undo/redo in the current frame
MeanDataEditor * myMeanDataEditor
meanData editor
An Element which don't belong to GNENet but has influence in the simulation.
const std::unordered_map< SumoXMLTag, std::map< const std::string, GNEMeanData * > > & getMeanDatas() const
get meanDatas
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
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
FXint appendIconItem(const FXString &text, FXIcon *icon=nullptr, FXColor bgColor=FXRGB(255, 255, 255), void *ptr=nullptr)
append icon item in the last position
MFXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)
C++ TraCI client API implementation.