51 myFrameParent(frameParent),
52 myTemplateAC(
nullptr) {
54 myAttributesCreatorRows.resize(128 ,
nullptr);
56 myFlowEditor =
new GNEFlowEditor(frameParent->getViewNet(), frameParent);
89 throw ProcessError(
"invalid templateAC in showAttributesCreatorModule");
114 const auto& attrProperties = row->getAttrProperties();
116 const bool rowEnabled = row->isAttributesCreatorRowEnabled();
118 const bool hasDefaultStaticValue = !attrProperties.hasDefaultValue() || (attrProperties.getDefaultValue() != row->getValue());
120 const bool isFlowDefinitionAttribute = attrProperties.isFlow();
122 const bool isActivatableAttribute = attrProperties.isActivatable() && row->getAttributeCheckButtonCheck();
124 if (rowEnabled && (includeAll || hasDefaultStaticValue || isFlowDefinitionAttribute || isActivatableAttribute)) {
126 if (attrProperties.isInt()) {
127 const int intValue = GNEAttributeCarrier::canParse<int>(row->getValue()) ? GNEAttributeCarrier::parse<int>(row->getValue()) : GNEAttributeCarrier::parse<int>(attrProperties.getDefaultValue());
129 }
else if (attrProperties.isFloat()) {
130 const double doubleValue = GNEAttributeCarrier::canParse<double>(row->getValue()) ? GNEAttributeCarrier::parse<double>(row->getValue()) : GNEAttributeCarrier::parse<double>(attrProperties.getDefaultValue());
132 }
else if (attrProperties.isBool()) {
133 const bool boolValue = GNEAttributeCarrier::canParse<bool>(row->getValue()) ? GNEAttributeCarrier::parse<bool>(row->getValue()) : GNEAttributeCarrier::parse<bool>(attrProperties.getDefaultValue());
135 }
else if (attrProperties.isPosition()) {
136 const Position positionValue = GNEAttributeCarrier::canParse<Position>(row->getValue()) ? GNEAttributeCarrier::parse<Position>(row->getValue()) : GNEAttributeCarrier::parse<Position>(attrProperties.getDefaultValue());
138 }
else if (attrProperties.isSUMOTime()) {
139 const SUMOTime timeValue = GNEAttributeCarrier::canParse<SUMOTime>(row->getValue()) ? GNEAttributeCarrier::parse<SUMOTime>(row->getValue()) : GNEAttributeCarrier::parse<SUMOTime>(attrProperties.getDefaultValue());
141 }
else if (attrProperties.isColor()) {
142 const RGBColor colorValue = GNEAttributeCarrier::canParse<RGBColor>(row->getValue()) ? GNEAttributeCarrier::parse<RGBColor>(row->getValue()) : GNEAttributeCarrier::parse<RGBColor>(attrProperties.getDefaultValue());
144 }
else if (attrProperties.isList()) {
145 if (attrProperties.isPosition()) {
146 const PositionVector positionVectorValue = GNEAttributeCarrier::canParse<PositionVector>(row->getValue()) ? GNEAttributeCarrier::parse<PositionVector>(row->getValue()) : GNEAttributeCarrier::parse<PositionVector>(attrProperties.getDefaultValue());
149 const std::vector<std::string> stringVectorValue = GNEAttributeCarrier::canParse<std::vector<std::string> >(row->getValue()) ?
GNEAttributeCarrier::parse<std::vector<std::string> >(row->getValue()) : GNEAttributeCarrier::parse<std::vector<std::string> >(attrProperties.getDefaultValue());
173 std::string errorMessage;
175 if (extra.size() == 0) {
247 bool showFlowEditor =
false;
251 bool showAttribute =
true;
253 if (attribute.isUnique() && (attribute.getAttr() !=
SUMO_ATTR_ID)) {
254 showAttribute =
false;
260 showAttribute =
false;
264 showAttribute =
false;
267 if (attribute.isFlow()) {
268 showAttribute =
false;
269 showFlowEditor =
true;
273 showAttribute =
false;
280 showAttribute =
false;
297 if (showFlowEditor) {
FXDEFMAP(GNEAttributesCreator) AttributesCreatorMap[]
@ DEMAND_CONTAINER
Mode for editing container.
@ DEMAND_PERSON
Mode for editing person.
@ DEMAND_VEHICLE
Mode for editing vehicles.
@ MID_GNE_RESET
reset element
#define GUIDesignButtonIcon
button only with icon
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
#define GUIDesignButtonRectangular
little rectangular button used in frames (For example, in "help" buttons)
@ SUMO_TAG_VAPORIZER
vaporizer of vehicles
@ GNE_ATTR_PARENT
parent of an additional element
@ GNE_ATTR_SELECTED
element is selected
@ SUMO_ATTR_NOTHING
invalid attribute, must be the last one
void addIntAttribute(const SumoXMLAttr attr, const int value)
add int attribute into current SumoBaseObject node
void addPositionVectorAttribute(const SumoXMLAttr attr, const PositionVector &value)
add PositionVector attribute into current SumoBaseObject node
void addBoolAttribute(const SumoXMLAttr attr, const bool value)
add bool attribute into current SumoBaseObject node
void addTimeAttribute(const SumoXMLAttr attr, const SUMOTime value)
add time attribute into current SumoBaseObject node
void addStringListAttribute(const SumoXMLAttr attr, const std::vector< std::string > &value)
add string list attribute into current SumoBaseObject node
void addDoubleAttribute(const SumoXMLAttr attr, const double value)
add double attribute into current SumoBaseObject node
void addPositionAttribute(const SumoXMLAttr attr, const Position &value)
add Position attribute into current SumoBaseObject node
void addStringAttribute(const SumoXMLAttr attr, const std::string &value)
add string attribute into current SumoBaseObject node
void addColorAttribute(const SumoXMLAttr attr, const RGBColor &value)
add color attribute into current SumoBaseObject node
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc....
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
void resetDefaultValues()
reset attribute carrier to their default values
void refreshRows(const bool createRows)
refresh rows
~GNEAttributesCreator()
destructor
void getAttributesAndValues(CommonXMLStructure::SumoBaseObject *baseObject, bool includeAll) const
get attributes and their values
bool areValuesValid() const
check if parameters of attributes are valid
GNEAttributeCarrier * getCurrentTemplateAC() const
get current template AC
void showAttributesCreatorModule(GNEAttributeCarrier *templateAC, const std::vector< SumoXMLAttr > &hiddenAttributes)
show GNEAttributesCreator modul
GNEAttributeCarrier * myTemplateAC
current templateAC
FXHorizontalFrame * myFrameButtons
frame buttons
long onCmdReset(FXObject *, FXSelector, void *)
void hideAttributesCreatorModule()
hide group box
void showWarningMessage(std::string extra="") const
show warning message with information about non-valid attributes
std::vector< GNEAttributesCreatorRow * > myAttributesCreatorRows
vector with the GNEAttributesCreatorRow
void disableAttributesCreator()
disable GNEAttributesCreator
GNEFlowEditor * myFlowEditor
pointer to myFlowEditor
GNEFrame * getFrameParent() const
return frame parent
void refreshAttributesCreator()
refresh attribute creator
FXButton * myResetButton
reset button
long onCmdHelp(FXObject *, FXSelector, void *)
Called when help button is pressed.
GNEFrame * myFrameParent
pointer to Frame Parent
std::vector< SumoXMLAttr > myHiddenAttributes
hidden attributes
void getFlowAttributes(CommonXMLStructure::SumoBaseObject *baseObject)
get flow attributes
void showFlowEditor(GNEAttributeCarrier *firstEditedFlow, const std::unordered_set< GNEAttributeCarrier * > editedFlows)
show GNEFlowEditor modul
void hideFlowEditor()
hide group box
bool shownFlowEditor() const
shown GNEFlowEditor modul
bool areFlowValuesValid() const
check if parameters of attributes are valid
GNEViewNet * getViewNet() const
get view net
void openHelpAttributesDialog(const GNEAttributeCarrier *AC) const
Open help attributes dialog.
const std::string & getTagStr() const
get Tag vinculated with this attribute Property in String Format (used to avoid multiple calls to toS...
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
void setStatusBarText(const std::string &text)
set statusBar text
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
MFXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)
A point in 2D or 3D with translation and scaling methods.
DemandEditMode demandEditMode
the current Demand edit mode
bool isCurrentSupermodeDemand() const
@check if current supermode is Demand