64 myAttributeTable(attributeTable) {
66 const auto tooltipMenu = attributeTable->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu();
69 myAttributeLabel->hide();
71 myAttributeToggleEnableCheckButton =
new FXCheckButton(
this,
"Enable/Disable attribute checkBox",
this,
73 myAttributeToggleEnableCheckButton->hide();
75 myAttributeButton =
new MFXButtonTooltip(
this, tooltipMenu,
"button",
nullptr,
this,
79 myValueTextField->hide();
83 myValueComboBox->hide();
86 myValueCheckButton->hide();
90 myValueLaneUpButton->hide();
92 myValueLaneUpButton->setTipText(
TL(
"Move element up one lane"));
93 myValueLaneUpButton->setHelpText(
TL(
"Move element up one lane"));
97 myValueLaneDownButton->hide();
99 myValueLaneDownButton->setTipText(
TL(
"Move element down one lane"));
100 myValueLaneDownButton->setHelpText(
TL(
"Move element down one lane"));
124 const bool computedAttribute = multipleEditedACs ? false : firstEditedAC->isAttributeComputed(attribute);
129 if (!multipleEditedACs && attrProperty->
isVType()) {
135 if (ACParent ==
nullptr) {
140 if (multipleEditedACs && attrProperty->
isUnique()) {
148 if (attrProperty->
isFlow() && !attributeEnabled) {
152 if (tagPropertyParent->isVehicleStop() && !attributeEnabled) {
172 }
else if ((attribute ==
SUMO_ATTR_TYPE) && tagPropertyParent->hasTypeParent()) {
184 if (attrProperty->
isBool()) {
192 if (!multipleEditedACs && !tagPropertyParent->isNetworkElement() && (attribute ==
SUMO_ATTR_LANE)) {
276 if (!insertDefaultValues && usingDefaultValue) {
316 const auto doubleListValue = GNEAttributeCarrier::parse<std::vector<double> >(
myValueTextField->
getText().text());
318 for (
const auto doubleValue : doubleListValue) {
497 if (editedAC->isValid(attribute, newValue)) {
505 if (newValue.empty()) {
524 while (shape.find(
", ") != std::string::npos) {
532 if ((doubleValue - (
int)doubleValue) == 0) {
539 if (editedAC->isValid(attribute, newValue)) {
549 if (newValue.empty()) {
566 myAttributeTable(nullptr) {
578 return ACs->generateEdgeID();
580 return ACs->generateAdditionalID(parentTag);
582 return ACs->generateDemandElementID(parentTag);
584 return ACs->generateMeanDataID(parentTag);
586 return ACs->generateEdgeTypeID();
588 return ACs->generateDataSetID();
593 std::set<std::string> values;
596 if (editedAC->hasAttribute(attribute)) {
597 values.insert(editedAC->getAttribute(attribute));
601 std::ostringstream oss;
602 for (
auto it = values.begin(); it != values.end(); it++) {
603 if (it != values.begin()) {
753 const bool enabled,
const bool computed) {
755 bool allValuesEqual =
true;
757 std::vector<bool> booleanVector;
760 booleanVector = GNEAttributeCarrier::parse<std::vector<bool> >(value);
763 for (
const auto& booleanValue : booleanVector) {
764 if (booleanValue != booleanVector.front()) {
765 allValuesEqual =
false;
769 if (allValuesEqual) {
776 if ((booleanVector.size() > 0) && booleanVector.front()) {
799 const bool enabled,
const bool computed) {
801 bool allValuesEqual =
true;
803 std::vector<std::string> stringVector = GNEAttributeCarrier::parse<std::vector<std::string> >(value);
805 for (
const auto& stringValue : stringVector) {
806 if (stringValue != stringVector.front()) {
807 allValuesEqual =
false;
811 if (allValuesEqual) {
827 }
else if (attrProperty->
isVType()) {
831 std::map<std::string, GNEDemandElement*> sortedTypes;
832 for (
const auto& type : ACs->getDemandElements().at(
SUMO_TAG_VTYPE)) {
833 sortedTypes[type.second->getID()] = type.second;
835 for (
const auto& sortedType : sortedTypes) {
840 sortedTypes[typeDistribution.second->getID()] = typeDistribution.second;
842 for (
const auto& sortedType : sortedTypes) {
923 if ((lane->getIndex() + 1) >= (
int)lane->getParentEdge()->getChildLanes().size()) {
929 if ((lane->getIndex() - 1) < 0) {
950 }
else if (editModes.isCurrentSupermodeNetwork()) {
951 if (tagProperty->isNetworkElement() || tagProperty->isAdditionalElement()) {
956 }
else if (editModes.isCurrentSupermodeDemand() && tagProperty->isDemandElement()) {
958 }
else if (editModes.isCurrentSupermodeData() && (tagProperty->isDataElement() || tagProperty->isMeanData())) {
979 if (AC->isAttributeEnabled(attrProperty->
getAttr())) {
FXDEFMAP(GNEAttributesEditorRow) GNEAttributeRowMap[]
@ MID_GNE_ATTRIBUTESEDITORROW_MOVELANEUP
move lane up
@ MID_GNE_ATTRIBUTESEDITORROW_OPENDIALOG_FILE
open file dialog in attributes editor row
@ MID_GNE_ATTRIBUTESEDITORROW_SETATTRIBUTE
set attribute (string, bool, etc.) in attributes editor row
@ MID_GNE_ATTRIBUTESEDITORROW_OPENDIALOG_COLOR
open color dialog in attributes editor row
@ MID_GNE_ATTRIBUTESEDITORROW_REPARENT
reparent
@ MID_GNE_ATTRIBUTESEDITORROW_TOGGLEENABLEATTRIBUTE
toogle enable attribute in attributes editor row
@ MID_GNE_ATTRIBUTESEDITORROW_OPENDIALOG_ALLOW
open allow dialog in attributes editor row
@ MID_GNE_ATTRIBUTESEDITORROW_MOVELANEDOWN
move lane down
@ MID_GNE_ATTRIBUTESEDITORROW_INSPECTPARENT
inspect parent
#define GUIDesignButtonAttribute
button extended over over column with thick and raise frame
#define GUIDesignTextColorRed
red color (for invalid text)
#define GUIDesignButtonIcon
button only with icon
#define GUIDesignComboBoxAttribute
Combo box static (cannot be edited) extended over the matrix column.
#define GUIDesignTextField
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
#define GUIDesignBackgroundColorRed
red background color (for invalid text)
#define GUIDesignTextColorBlue
blue color (for default text)
#define GUIDesignComboBoxVisibleItems
#define GUIDesignTextColorBlack
black color (for correct text)
#define GUIDesignBackgroundColorWhite
white background color (for valid text)
#define GUIDesignCheckButton
checkButton placed in left position
#define GUIDesignCheckButtonAttribute
checkButton without thick extended over the frame used for attributes
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
SUMOVehicleClass getVehicleClassID(const std::string &name)
Returns the class id of the abstract class given by its name.
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
@ SUMO_TAG_VTYPE
description of a vehicle/person/container type
@ SUMO_TAG_TAZSINK
a sink within a district (connection road)
@ SUMO_TAG_JUNCTION
begin/end of the description of a junction
@ SUMO_TAG_VTYPE_DISTRIBUTION
distribution of a vehicle type
@ SUMO_TAG_TYPE
type (edge)
@ SUMO_TAG_TAZSOURCE
a source within a district (connection road)
@ SUMO_TAG_EDGE
begin/end of the description of an edge
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ GNE_ATTR_PARENT
parent of an additional element
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ GNE_ATTR_STOPOEXCEPTION
stop exceptions (virtual, used by edge and lanes)
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
@ SUMO_ATTR_EXPECTED_CONTAINERS
@ SUMO_ATTR_COLOR
A color information.
@ SUMO_ATTR_RIGHT_OF_WAY
How to compute right of way.
@ SUMO_ATTR_NOTHING
invalid attribute, must be the last one
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
void addDoubleListAttribute(const SumoXMLAttr attr, const std::vector< double > &value)
add double list attribute into current SumoBaseObject node
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
void addParameters(const std::string &value)
add parameters into current SumoBaseObject node (format: key=value1|key2=value2|.....
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc....
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
bool isVClass() const
return true if attribute is a VehicleClass
bool isProbability() const
return true if attribute is a probability
const std::string & getDefaultStringValue() const
get default value in string format
bool isColor() const
return true if attribute is a color
bool isBool() const
return true if attribute is boolean
const std::string & getAttrStr() const
get XML Attribute in string format (can be updated using alternative name)
bool isPosition() const
return true if attribute is a position
const std::vector< std::string > & getFilenameExtensions() const
get filename extensions in string format used in open dialogs
SUMOTime getDefaultTimeValue() const
get default time value
bool isList() const
return true if attribute is a list
double getDefaultDoubleValue() const
get default double value
bool isInt() const
return true if attribute is an integer
bool isDiscrete() const
return true if attribute is discrete
bool isFileOpen() const
return true if attribute is a filename open
int getDefaultIntValue() const
get default int value
const std::string & getDefinition() const
get default value
bool isVType() const
return true if attribute is a VType or vTypeDistribution
bool isUnique() const
return true if attribute is unique
bool isFloat() const
return true if attribute is a float
const RGBColor & getDefaultColorValue() const
get default bool value
const GNETagProperties * getTagPropertyParent() const
get reference to tagProperty parent
bool isSUMOTime() const
return true if attribute is a SUMOTime
bool hasDefaultValue() const
return true if attribute owns a default value
bool isFileSave() const
return true if attribute is a filename save
bool isFlow() const
return true if attribute is part of a flow definition
bool isActivatable() const
return true if attribute is activatable
bool isPositive() const
return true if attribute is positive
const std::vector< std::string > & getDiscreteValues() const
get discrete values
const Position & getDefaultPositionValue() const
get default position value
bool isAlwaysEnabled() const
return true if attribute is always enabled
SumoXMLAttr getAttr() const
get XML Attribute
bool isAttributeRowShown() const
check if current attribute row is shown
void enableElements(const GNEAttributeProperties *attrProperty, const bool forceDisable)
check if enable or disable all elements depending of current supermode or forceDisable
MFXButtonTooltip * myValueLaneUpButton
Button for move lane up.
void showValueComboBox(const GNEAttributeProperties *attrProperty, const std::string &value, const bool enabled, const bool computed)
show value for combo Box
FXCheckButton * myAttributeToggleEnableCheckButton
pointer to attribute menu check
MFXButtonTooltip * myAttributeButton
pointer to button that can be used for files, color, parent, vclass or inspect
long onCmdInspectParent(FXObject *, FXSelector, void *)
called when user press "inspect parent"
MFXButtonTooltip * myValueLaneDownButton
Button for move lane down.
const std::string getAttributeValue(const bool enabled) const
get value from edited ACs
long onCmdOpenColorDialog(FXObject *sender, FXSelector, void *arg)
called when user press "edit color" dialog
void showAttributeColor(const GNEAttributeProperties *attrProperty, const bool enabled)
show attribute button color
bool isAttributeEnabled(const GNEAttributeProperties *attrProperty) const
check if the given attribute is enabled
void showAttributeVClass(const GNEAttributeProperties *attrProperty, const bool enabled)
show attribute button vClass
MFXLabelTooltip * myAttributeLabel
pointer to attribute label
MFXComboBoxIcon * myValueComboBox
pointer to combo box for select choices
SumoXMLAttr fillSumoBaseObject(CommonXMLStructure::SumoBaseObject *baseObject, const bool insertDefaultValues) const
fill sumo Base object
bool isValueValid() const
check if current attribute row is valid
bool hideAttributeRow()
hide attribute row (always return false)
void showAttributeLabel(const GNEAttributeProperties *attrProperty)
show attribute label
GNEAttributesEditorType * myAttributeTable
pointer to attribute table parent
long onCmdToggleEnableAttribute(FXObject *, FXSelector, void *)
called when user press the checkBox for toogle enable/disable attribute
std::string getCurrentValue() const
get current value in string format
const GNEAttributeProperties * getAttrProperty() const
get attribute property
GNEAttributesEditorRow()
default constructor (needed for FOX)
long onCmdMoveLaneDown(FXObject *, FXSelector, void *)
called when user press "move lane down"
long onCmdMoveLaneUp(FXObject *, FXSelector, void *)
called when user press "move lane up"
void showMoveLaneButtons(const std::string &laneID)
show move lane buttons
void showAttributeToggleEnable(const GNEAttributeProperties *attrProperty, const bool value)
show attribute toogle enable
FXCheckButton * myValueCheckButton
pointer to menu check
void showAttributeInspectParent(const GNEAttributeProperties *attrProperty, const bool enabled)
show attribute button inspect parent
const GNEAttributeProperties * myAttrProperty
edited attribute property
void showValueCheckButton(const std::string &value, const bool enabled, const bool computed)
show value for check button
MFXTextFieldIcon * myValueTextField
pointer to text field for modify values
void hideAllAttributeElements()
hide all attribute elements
long onCmdSetAttribute(FXObject *obj, FXSelector, void *)
set new string/bool attribute
bool showAttributeRow(GNEAttributesEditorType *attributeTable, const GNEAttributeProperties *attrProperty, const bool forceDisable)
return true if attribute row was successfully show
void showAttributeFile(const GNEAttributeProperties *attrProperty, const bool enabled)
show attribute button file
long onCmdOpenFileDialog(FXObject *, FXSelector, void *)
called when user press "open file" dialog
void showAttributeReparent(const bool enabled)
show attribute button reparent
long onCmdOpenVClassDialog(FXObject *, FXSelector, void *)
called when user press "open allow" dialog
void showValueString(const std::string &value, const bool enabled, const bool computed)
show value for strings
long onCmdReparent(FXObject *, FXSelector, void *)
called when user press reparent button
GNEFrame * getFrameParent() const
pointer to GNEFrame parent
void moveLaneDown()
move lane down
bool isEditorTypeEditor() const
check if this is an attribute editor of type "editor"
GNEFrame * myFrameParent
pointer to GNEFrame parent
std::vector< GNEAttributeCarrier * > myEditedACs
current edited ACs
void setAttribute(SumoXMLAttr attr, const std::string &value)
set attribute in the current ACs (Callend from row)
void moveLaneUp()
move lane up
void inspectParent()
inspect parent (Callend from row)
const EditorType myEditorType
variable use for packing editorType type options
void enableReparent()
void enable reparent
void toggleEnableAttribute(SumoXMLAttr attr, const bool value)
set attribute in the current ACs (Callend from row)
GNEViewNet * getViewNet() const
get view net
GNELane * retrieveLane(const std::string &id, bool hardFail=true, bool checkVolatileChange=false) const
get lane by id
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
bool isMeanData() const
return true if tag correspond to a mean data element
GUIIcon getGUIIcon() const
get GUI icon associated to this tag property
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool isDemandElement() const
return true if tag correspond to a demand element
bool isAdditionalElement() const
return true if tag correspond to an additional element (note: this include TAZ, shapes and wires)
GNENet * getNet() const
get the net object
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
GNEViewParent * getViewParent() const
get the net object
GNEApplicationWindow * getGNEAppWindows() const
get GNE Application Windows
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
long setCurrentItem(const FXint index, FXbool notify=FALSE)
Set the current item (index is zero-based)
FXint findItem(const FXString &text) const
find item
FXint getNumItems() const
Return the number of items in the list.
void setBackColor(FXColor clr)
Set window background color.
FXString getText() const
Get the text.
void setTextColor(FXColor clr)
Change text color.
virtual void clearItems()
Remove all items from the list.
void disable()
Disable combo box.
FXColor getTextColor() const
Return text color.
FXint appendIconItem(const FXString &text, FXIcon *icon=nullptr, FXColor bgColor=FXRGB(255, 255, 255), void *ptr=nullptr)
append icon item in the last position
void enable()
Enable combo box.
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)
virtual void disable()
Disable text field.
virtual void killFocus()
Remove the focus from this window.
virtual void enable()
Enable text field.
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.
static FXIcon * getPOIIcon(POIIcon iconType)
returns icon associated to the given POI image
static const RGBColor BLACK
static StringBijection< POIIcon > POIIcons
POI icon values.
static StringBijection< RightOfWay > RightOfWayValues
righ of way algorithms
std::vector< T > getValues() const
get all keys
static std::string replace(std::string str, const std::string &what, const std::string &by)
Replaces all occurrences of the second string by the third string within the first string.
static FXIcon * getVClassIcon(const SUMOVehicleClass vc)
returns icon associated to the given vClass