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->hideAttributesEditorModule();
320 return myCurrentMeanData;
326 myCurrentMeanData = vMeanData;
327 refreshMeanDataSelector(
false);
333 auto& inspectedElements = myMeanDataFrameParent->getViewNet()->getInspectedElements();
335 SumoXMLTag meanDataTag = myMeanDataFrameParent->myMeanDataTypeSelector->getCurrentMeanData().getTag();
337 std::map<std::string, GNEMeanData*> sortedMeanDatas;
338 for (
const auto& meanData : myMeanDataFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getMeanDatas().at(meanDataTag)) {
339 sortedMeanDatas[meanData.second->getID()] = meanData.second;
342 myMeanDataComboBox->clearItems();
344 for (
const auto& sortedMeanData : sortedMeanDatas) {
345 myMeanDataComboBox->appendIconItem(sortedMeanData.first.c_str(), sortedMeanData.second->getACIcon());
348 if (myCurrentMeanData && myMeanDataFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveMeanData(myCurrentMeanData->getTagProperty().getTag(), myCurrentMeanData->getID(),
false)) {
349 bool validMeanData =
false;
350 for (
int i = 0; i < (int)myMeanDataComboBox->getNumItems(); i++) {
351 if (myMeanDataComboBox->getItemText(i) == myCurrentMeanData->getID()) {
352 myMeanDataComboBox->setCurrentItem(i);
353 validMeanData =
true;
356 if (!validMeanData) {
357 myCurrentMeanData =
nullptr;
360 myCurrentMeanData =
nullptr;
363 if (sortedMeanDatas.size() > 0) {
364 myMeanDataComboBox->enable();
366 if (myCurrentMeanData ==
nullptr) {
367 myCurrentMeanData = sortedMeanDatas.begin()->second;
370 myMeanDataComboBox->disable();
373 myMeanDataFrameParent->myMeanDataEditor->refreshMeanDataEditorModule();
375 if (!afterChangingID) {
376 if (myCurrentMeanData) {
378 inspectedElements.inspectAC(myCurrentMeanData);
379 myMeanDataFrameParent->myMeanDataAttributesEditor->showAttributeEditorModule(
false);
382 inspectedElements.inspectAC({});
383 myMeanDataFrameParent->myMeanDataAttributesEditor->hideAttributesEditorModule();
391 if (myCurrentMeanData) {
392 myMeanDataComboBox->updateIconItem(myMeanDataComboBox->getCurrentItem(), myCurrentMeanData->getID().c_str(), myCurrentMeanData->getACIcon());
400 SumoXMLTag meanDataTag = myMeanDataFrameParent->myMeanDataTypeSelector->getCurrentMeanData().getTag();
402 for (
const auto& meanData : myMeanDataFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getMeanDatas().at(meanDataTag)) {
403 if (meanData.second->getID() == myMeanDataComboBox->getText().text()) {
405 myCurrentMeanData = meanData.second;
407 myMeanDataComboBox->setTextColor(FXRGB(0, 0, 0));
409 myMeanDataFrameParent->myMeanDataEditor->refreshMeanDataEditorModule();
411 myMeanDataFrameParent->getViewNet()->getInspectedElements().inspectAC(myCurrentMeanData);
413 myMeanDataFrameParent->myMeanDataAttributesEditor->showAttributeEditorModule(
false);
415 WRITE_DEBUG((
"Selected item '" + myMeanDataComboBox->getText() +
"' in MeanDataSelector").text());
417 myMeanDataFrameParent->getViewNet()->updateViewNet();
421 myCurrentMeanData =
nullptr;
423 myMeanDataFrameParent->myMeanDataEditor->refreshMeanDataEditorModule();
425 myMeanDataFrameParent->myMeanDataAttributesEditor->hideAttributesEditorModule();
427 myMeanDataComboBox->setTextColor(FXRGB(255, 0, 0));
429 WRITE_DEBUG(
"Selected invalid item in MeanDataSelector");
431 myMeanDataFrameParent->getViewNet()->updateViewNet();
440 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 GUIDesignComboBoxVisibleItemsMedium
combo box medium small
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 *)
GNEFrameAttributeModules::AttributesEditor * myMeanDataAttributesEditor
meanData attributes editor
void attributeUpdated(SumoXMLAttr attribute)
function called after set a valid attribute in AttributeCreator/AttributeEditor/ParametersEditor/....
MeanDataSelector * myMeanDataSelector
meanData selector
~GNEMeanDataFrame()
Destructor.
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.