69 myTypeFrameParent(typeFrameParent),
74 for (
const auto& vType : myTypeFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getDemandElements().at(
SUMO_TAG_VTYPE)) {
76 myTypeComboBox->appendIconItem(vType->getID().c_str(), vType->getACIcon(), FXRGB(255, 255, 200));
80 for (
const auto& vType : myTypeFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getDemandElements().at(
SUMO_TAG_VTYPE)) {
82 myTypeComboBox->appendIconItem(vType->getID().c_str(), vType->getACIcon());
88 if (myTypeComboBox->getNumItems() <= 20) {
89 myTypeComboBox->setNumVisible((
int)myTypeComboBox->getNumItems());
91 myTypeComboBox->setNumVisible(20);
110 refreshTypeSelector();
118 myTypeComboBox->clearItems();
120 for (
const auto& vType : myTypeFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getDemandElements().at(
SUMO_TAG_VTYPE)) {
122 myTypeComboBox->appendIconItem(vType->getID().c_str(), vType->getACIcon(), FXRGB(255, 255, 200));
126 for (
const auto& vType : myTypeFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getDemandElements().at(
SUMO_TAG_VTYPE)) {
128 myTypeComboBox->appendIconItem(vType->getID().c_str(), vType->getACIcon());
132 if (myTypeComboBox->getNumItems() <= 20) {
133 myTypeComboBox->setNumVisible((
int)myTypeComboBox->getNumItems());
135 myTypeComboBox->setNumVisible(20);
139 for (
int i = 0; i < (int)myTypeComboBox->getNumItems(); i++) {
140 if (myTypeComboBox->getItem(i).text() ==
myCurrentType->getID()) {
141 myTypeComboBox->setCurrentItem(i);
151 for (
int i = 0; i < (int)myTypeComboBox->getNumItems(); i++) {
152 if (myTypeComboBox->getItem(i).text() ==
myCurrentType->getID()) {
153 myTypeComboBox->setCurrentItem(i);
158 myTypeFrameParent->myTypeEditor->refreshTypeEditorModule();
160 myTypeFrameParent->getViewNet()->setInspectedAttributeCarriers({
myCurrentType});
162 myTypeFrameParent->myTypeAttributesEditor->showAttributeEditorModule(
false,
true);
163 myTypeFrameParent->myAttributesEditorExtended->showAttributesEditorExtendedModule();
164 myTypeFrameParent->myVTypeDistributions->showVTypeDistributionsModule();
179 for (
const auto& vType : myTypeFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getDemandElements().at(
SUMO_TAG_VTYPE)) {
180 if (vType->getID() == myTypeComboBox->getText().text()) {
184 myTypeComboBox->setTextColor(FXRGB(0, 0, 0));
186 myTypeFrameParent->myTypeEditor->refreshTypeEditorModule();
188 myTypeFrameParent->getViewNet()->setInspectedAttributeCarriers({
myCurrentType});
190 myTypeFrameParent->myTypeAttributesEditor->showAttributeEditorModule(
false,
true);
191 myTypeFrameParent->myAttributesEditorExtended->showAttributesEditorExtendedModule();
192 myTypeFrameParent->myVTypeDistributions->showVTypeDistributionsModule();
194 WRITE_DEBUG((
"Selected item '" + myTypeComboBox->getText() +
"' in TypeSelector").text());
196 myTypeFrameParent->getViewNet()->updateViewNet();
202 myTypeFrameParent->myTypeEditor->refreshTypeEditorModule();
204 myTypeFrameParent->myTypeAttributesEditor->hideAttributesEditorModule();
205 myTypeFrameParent->myAttributesEditorExtended->hideAttributesEditorExtendedModule();
206 myTypeFrameParent->myVTypeDistributions->hideVTypeDistributionsModule();
208 myTypeComboBox->setTextColor(FXRGB(255, 0, 0));
210 WRITE_DEBUG(
"Selected invalid item in TypeSelector");
212 myTypeFrameParent->getViewNet()->updateViewNet();
222 myTypeFrameParent(typeFrameParent) {
237 refreshTypeEditorModule();
251 if (myTypeFrameParent->myTypeSelector->getCurrentType() ==
nullptr) {
253 myDeleteResetTypeButton->disable();
254 myCopyTypeButton->disable();
255 }
else if (GNEAttributeCarrier::parse<bool>(myTypeFrameParent->myTypeSelector->getCurrentType()->getAttribute(
GNE_ATTR_DEFAULT_VTYPE))) {
257 myCopyTypeButton->enable();
259 myDeleteResetTypeButton->setText(
TL(
"Reset Type"));
263 myDeleteResetTypeButton->enable();
265 myDeleteResetTypeButton->disable();
269 myCopyTypeButton->enable();
271 myDeleteResetTypeButton->setText(
TL(
"Delete Type"));
273 myDeleteResetTypeButton->enable();
283 const std::string typeID = myTypeFrameParent->myViewNet->getNet()->getAttributeCarriers()->generateDemandElementID(
SUMO_TAG_VTYPE);
287 myTypeFrameParent->myViewNet->getUndoList()->begin(
GUIIcon::VTYPE,
"create vehicle type");
289 myTypeFrameParent->myViewNet->getUndoList()->end();
291 myTypeFrameParent->myTypeSelector->setCurrentType(type);
293 myTypeFrameParent->myTypeEditor->refreshTypeEditorModule();
313 const std::string typeID = myTypeFrameParent->myViewNet->getNet()->getAttributeCarriers()->generateDemandElementID(
SUMO_TAG_VTYPE);
315 GNEVType* vType =
dynamic_cast<GNEVType*
>(myTypeFrameParent->myTypeSelector->getCurrentType());
321 myTypeFrameParent->myViewNet->getUndoList()->begin(
GUIIcon::VTYPE,
"copy vehicle type");
325 myTypeFrameParent->myViewNet->getUndoList()->end();
327 myTypeFrameParent->myTypeSelector->refreshTypeSelector();
329 myTypeFrameParent->myTypeSelector->setCurrentType(typeCopy);
331 myTypeFrameParent->myTypeEditor->refreshTypeEditorModule();
340 myTypeFrameParent->getViewNet()->getUndoList()->begin(
GUIIcon::VTYPE,
"reset default vehicle type values");
345 myTypeFrameParent->myTypeSelector->getCurrentType()->setAttribute(attrProperty.getAttr(),
"", myTypeFrameParent->myViewNet->getUndoList());
361 myTypeFrameParent->myTypeSelector->getCurrentType()->setAttribute(
GNE_ATTR_DEFAULT_VTYPE_MODIFIED,
"false", myTypeFrameParent->myViewNet->getUndoList());
363 myTypeFrameParent->getViewNet()->getUndoList()->end();
365 myTypeFrameParent->myTypeSelector->refreshTypeSelector();
372 if (myTypeFrameParent->myTypeSelector->getCurrentType()->getChildDemandElements().size() > 0) {
373 std::string plural = myTypeFrameParent->myTypeSelector->getCurrentType()->getChildDemandElements().size() == 1 ? (
"") : (
"s");
375 WRITE_DEBUG(
"Opening FXMessageBox 'remove vType'");
377 FXuint answer = FXMessageBox::question(getApp(), MBOX_YES_NO,
379 (
"Delete " +
toString(
SUMO_TAG_VTYPE) +
" '" + myTypeFrameParent->myTypeSelector->getCurrentType()->getID() +
380 "' will remove " +
toString(myTypeFrameParent->myTypeSelector->getCurrentType()->getChildDemandElements().size()) +
381 " vehicle" + plural +
". Continue?").c_str());
385 WRITE_DEBUG(
"Closed FXMessageBox 'remove vType' with 'No'");
386 }
else if (answer == 4) {
387 WRITE_DEBUG(
"Closed FXMessageBox 'remove vType' with 'ESC'");
391 myTypeFrameParent->myViewNet->getUndoList()->begin(
GUIIcon::VTYPE,
"delete vehicle type");
393 myTypeFrameParent->myViewNet->getNet()->deleteDemandElement(myTypeFrameParent->myTypeSelector->getCurrentType(),
394 myTypeFrameParent->myViewNet->getUndoList());
396 myTypeFrameParent->myViewNet->getUndoList()->end();
400 myTypeFrameParent->myViewNet->getUndoList()->begin(
GUIIcon::VTYPE,
"delete vehicle type");
402 myTypeFrameParent->myViewNet->getNet()->deleteDemandElement(myTypeFrameParent->myTypeSelector->getCurrentType(),
403 myTypeFrameParent->myViewNet->getUndoList());
405 myTypeFrameParent->myViewNet->getUndoList()->end();
415 myTypeFrameParent(typeFrameParent) {
428 return myTypeFrameParent;
441 myVTypeDistributionsDialog->close();
448 return myVTypeDistributionsDialog;
455 myVTypeDistributionsDialog->openDialog();
464 GNEFrame(viewParent, viewNet,
"Types") {
FXDEFMAP(GNETypeFrame::TypeSelector) typeSelectorMap[]
@ MID_GNE_DELETE
delete element
@ MID_GNE_SET_ATTRIBUTE_DIALOG
attribute edited trough dialog
@ 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
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_TAXI
vehicle is a taxi
@ SVC_PEDESTRIAN
pedestrian
const std::string DEFAULT_TAXITYPE_ID
const std::string DEFAULT_PEDTYPE_ID
const std::set< std::string > DEFAULT_VTYPES
const std::string DEFAULT_VTYPE_ID
const std::string DEFAULT_CONTAINERTYPE_ID
const std::string DEFAULT_BIKETYPE_ID
@ SUMO_TAG_VTYPE
description of a vehicle/person/container type
@ GNE_ATTR_DEFAULT_VTYPE
Flag to check if VType is a default VType.
@ GNE_ATTR_DEFAULT_VTYPE_MODIFIED
Flag to check if a default VType was modified.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
An Element which don't belong to GNENet but has influence in the simulation.
void showAttributesEditorExtendedModule()
show AttributesEditorExtended modul
void showAttributeEditorModule(bool includeExtended, bool forceAttributeEnabled)
show attributes of multiple ACs
GNEFrame * getFrameParent() const
pointer to GNEFrame parent
GNEViewNet * getViewNet() const
get view net
GNEViewNet * myViewNet
FOX need this.
virtual void show()
show Frame
virtual void hide()
hide Frame
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
void resetType()
reset type
long onCmdDeleteResetType(FXObject *, FXSelector, void *)
Called when "Delete/Reset Vehicle Type" button is clicked.
void deleteType()
delete type
void showTypeEditorModule()
show TypeEditor modul
FXButton * myCreateTypeButton
"create vehicle type" button
long onCmdCreateType(FXObject *, FXSelector, void *)
FXButton * myDeleteResetTypeButton
"delete/reset vehicle type" button
FXButton * myCopyTypeButton
"copy vehicle type"
TypeEditor(GNETypeFrame *typeFrameParent)
FOX-declaration.
void hideTypeEditorModule()
hide TypeEditor box
void refreshTypeEditorModule()
update TypeEditor modul
long onCmdCopyType(FXObject *, FXSelector, void *)
Called when "Copy Vehicle Type" button is clicked.
void setCurrentType(GNEDemandElement *vType)
set current Vehicle Type
void refreshTypeSelectorIDs()
refresh vehicle type selector (only IDs, without refreshing attributes)
long onCmdSelectItem(FXObject *, FXSelector, void *)
GNEDemandElement * getCurrentType() const
get current Vehicle Type
void refreshTypeSelector()
refresh vehicle type selector
~TypeSelector()
destructor
~VTypeDistributions()
destructor
void showVTypeDistributionsModule()
show VTypeDistributions modul
long onCmdOpenDialog(FXObject *, FXSelector, void *)
GNEVTypeDistributionsDialog * myVTypeDistributionsDialog
VType distribution dialog.
GNETypeFrame * getTypeFrameParent() const
get pointer to type frame Parent
void hideVTypeDistributionsModule()
hide group box
VTypeDistributions(GNETypeFrame *typeFrameParent)
FOX-declaration.
GNEVTypeDistributionsDialog * getVTypeDistributionsDialog() const
get vType distribution dialog
GNEFrameAttributeModules::AttributesEditorExtended * myAttributesEditorExtended
modul for open extended attributes dialog
void attributesEditorExtendedDialogOpened()
open GNEAttributesCreator extended dialog (used for editing advance attributes of Vehicle Types)
GNETypeFrame(GNEViewParent *viewParent, GNEViewNet *viewNet)
Constructor.
TypeSelector * getTypeSelector() const
get vehicle type selector
void attributeUpdated()
function called after set a valid attribute in AttributeCreator/AttributeEditor/ParametersEditor/....
GNEFrameAttributeModules::AttributesEditor * myTypeAttributesEditor
editorinternal vehicle type attributes
VTypeDistributions * myVTypeDistributions
modul for open vType distributions dialog
TypeEditor * myTypeEditor
Vehicle Type editor (Create, copy, etc.)
~GNETypeFrame()
Destructor.
TypeSelector * myTypeSelector
vehicle type selector
Dialog for edit parameters.
Dialog for editing calibrator vehicle types.
GNENet * getNet() const
get the net object
void setInspectedAttributeCarriers(const std::vector< GNEAttributeCarrier * > ACs)
set inspected attributeCarrier
A single child window which contains a view of the simulation area.
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
MFXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)