85 FXIMPLEMENT(
GNEInspectorFrame, FXVerticalFrame, GNEInspectorFrameMap, ARRAYNUMBER(GNEInspectorFrameMap))
99 GNEFrame(horizontalFrameParent, viewNet, "Inspector"),
100 myPreviousElementInspect(
nullptr),
101 myPreviousElementDelete(
nullptr) {
105 myHeaderLeftFrame->hide();
106 myBackButton->hide();
192 std::vector<GNEAttributeCarrier*> itemsToInspect;
197 for (
const auto &i : selectedACs) {
199 itemsToInspect.push_back(i);
203 itemsToInspect.push_back(AC);
228 std::string headerString;
230 headerString =
"Net: ";
231 }
else if (dynamic_cast<GNEAdditional*>(
myInspectedACs.front())) {
232 headerString =
"Additional: ";
234 headerString =
"Shape: ";
370 const std::vector<GNEAttributeCarrier*>&
381 myInspectorFrameParent(inspectorFrameParent),
512 FXDialogBox* helpDialog =
new FXDialogBox(
this,
"GEO attributes Help",
GUIDesignDialogBox);
513 std::ostringstream help;
515 <<
" - Click in the same position\n" 516 <<
" for inspect next element\n" 517 <<
" - Shift + Click in the same\n" 518 <<
" position for inspect\n" 519 <<
" previous element";
523 helpDialog->create();
550 myAttributesEditorParent(attributeEditorParent),
587 myMultiple = GNEAttributeCarrier::parse<std::vector<std::string>>(value).size() > 1;
592 if (attrValue.isColor()) {
602 if (attrValue.isBool()) {
604 bool allBooleanValuesEqual =
true;
606 auto booleanVector = GNEAttributeCarrier::parse<std::vector<bool> >(value);
608 for (
const auto &i : booleanVector) {
609 if (i != booleanVector.front()) {
610 allBooleanValuesEqual =
false;
614 if(allBooleanValuesEqual) {
616 if (booleanVector.front()) {
626 if (attrValue.isNonEditable()) {
637 if (attrValue.isNonEditable()) {
643 }
else if (attrValue.isDiscrete()) {
645 if ((attrValue.getDiscreteValues().size() > 0) && attrValue.isCombinable()) {
658 for (
const auto &it : attrValue.getDiscreteValues()) {
662 myChoicesCombo->setNumVisible((
int)attrValue.getDiscreteValues().size());
667 if (attrValue.isNonEditable()) {
678 if (attrValue.isNonEditable()) {
684 }
else if (attrValue.isFloat() || attrValue.isTime()) {
690 if (attrValue.isNonEditable()) {
695 }
else if (attrValue.isInt()) {
701 if (attrValue.isNonEditable()) {
716 if (attrValue.isNonEditable()) {
751 if (
myTextFieldInt->getTextColor() == FXRGB(0, 0, 0) || forceRefresh) {
757 if (
myTextFieldReal->getTextColor() == FXRGB(0, 0, 0) || forceRefresh) {
769 if (
myChoicesCombo->getTextColor() == FXRGB(0, 0, 0) || forceRefresh) {
790 FXColorDialog colordialog(
this, tr(
"Color Dialog"));
791 colordialog.setTarget(
this);
799 if (colordialog.execute()) {
835 throw ProcessError(
"Invalid call to onCmdOpenAttributeDialog");
844 bool refreshGEOAndNeteditEditors =
false;
847 const auto& attrValues = tagValues.getAttributeProperties(
myAttr);
849 if (attrValues.isBool()) {
864 }
else if (attrValues.isDiscrete()) {
866 if ((attrValues.getDiscreteValues().size() > 0) &&
867 attrValues.isCombinable()) {
877 }
else if (attrValues.isFloat() || attrValues.isTime()) {
879 if (
myTextFieldReal->getText().empty() && attrValues.hasDefaultValue()) {
880 newVal = tagValues.getDefaultValue(
myAttr);
886 }
else if (attrValues.isInt()) {
888 if (
myTextFieldInt->getText().empty() && attrValues.hasDefaultValue()) {
889 newVal = tagValues.getDefaultValue(
myAttr);
895 }
else if (attrValues.isString()) {
898 newVal = tagValues.getDefaultValue(
myAttr);
910 refreshGEOAndNeteditEditors =
true;
933 if (attrValues.isCombinable()) {
938 }
else if (attrValues.isDiscrete()) {
941 }
else if (attrValues.isFloat() || attrValues.isTime()) {
952 if (refreshGEOAndNeteditEditors) {
958 if (attrValues.isCombinable()) {
961 }
else if (attrValues.isDiscrete()) {
964 }
else if (attrValues.isFloat() || attrValues.isTime()) {
980 std::string result(stringValue);
981 while (result.find(
", ") != std::string::npos) {
1037 std::set<std::string> occuringValues;
1039 occuringValues.insert(it_ac->getAttribute(i.first));
1042 std::ostringstream oss;
1043 for (
auto it_val = occuringValues.begin(); it_val != occuringValues.end(); it_val++) {
1044 if (it_val != occuringValues.begin()) {
1049 std::string value = oss.str();
1088 std::pair<GNEInspectorFrame::AttributesEditor::AttributeInput*, std::string> myAllowAttribute(
nullptr,
"");
1089 std::pair<GNEInspectorFrame::AttributesEditor::AttributeInput*, std::string> myDisallowAttribute(
nullptr,
"");
1101 std::set<std::string> occuringValues;
1103 occuringValues.insert(it_ac->getAttribute(i.first));
1106 std::ostringstream oss;
1107 for (
auto it_val = occuringValues.begin(); it_val != occuringValues.end(); it_val++) {
1108 if (it_val != occuringValues.begin()) {
1118 myAllowAttribute.second = oss.str();
1121 myDisallowAttribute.second = oss.str();
1137 if (myAllowAttribute.first && myDisallowAttribute.first) {
1139 if (myAllowAttribute.first->isCurrentAttributeValid() && !myDisallowAttribute.first->isCurrentAttributeValid()) {
1141 myDisallowAttribute.first->refreshAttributeInput(myDisallowAttribute.second,
true);
1144 if (myDisallowAttribute.first->isCurrentAttributeValid() && !myAllowAttribute.first->isCurrentAttributeValid()) {
1146 myAllowAttribute.first->refreshAttributeInput(myAllowAttribute.second,
true);
1211 if (tagValue.canBlockMovement()) {
1231 if (tagValue.canBlockShape()) {
1251 if (tagValue.canCloseShape()) {
1271 if (tagValue.hasParent() && tagValue.canBeReparent()) {
1275 std::set<std::string> parents;
1465 if (tagProperty.hasGEOPosition() || tagProperty.hasGEOShape()) {
1471 value &= GNEAttributeCarrier::parse<bool>(i->getAttribute(
SUMO_ATTR_GEO));
1535 if (tagProperty.hasGEOPosition()) {
1537 }
else if (tagProperty.hasGEOShape()) {
1553 if (tagProperty.hasGEOPosition()) {
1561 }
else if (tagProperty.hasGEOShape()) {
1570 throw ProcessError(
"myGEOAttributeTextField must be hidden becaurse there isn't GEO Attribute to edit");
1594 FXDialogBox* helpDialog =
new FXDialogBox(
this,
"GEO attributes Help",
GUIDesignDialogBox);
1595 std::ostringstream help;
1597 <<
" SUMO uses the World Geodetic System 84 (WGS84/UTM).\n" 1598 <<
" For a GEO-referenced network, geo coordinates are represented as pairs of Longitude and Latitude\n" 1599 <<
" in decimal degrees without extra symbols. (N,W..)\n" 1600 <<
" - Longitude: East-west position of a point on the Earth's surface.\n" 1601 <<
" - Latitude: North-south position of a point on the Earth's surface.\n" 1602 <<
" - CheckBox 'geo' enables or disables saving position in GEO coordinates\n";
1606 helpDialog->create();
1618 myEdgeTemplate(nullptr) {
1718 sender->handle(
this, FXSEL(SEL_COMMAND, ID_ENABLE),
nullptr);
1720 caption =
"No edge Template Set";
1721 sender->handle(
this, FXSEL(SEL_COMMAND, ID_DISABLE),
nullptr);
1723 sender->handle(
this, FXSEL(SEL_COMMAND, FXLabel::ID_SETSTRINGVALUE), (
void*)&caption);
void hideGenericParametersEditor()
hide netedit attributes editor
void refreshNeteditAttributesEditor(bool forceRefresh)
refresh netedit attributes
void copyTemplate(GNEEdge *tpl, GNEUndoList *undolist)
copy edge attributes from tpl
void showTemplateEditor()
show template editor
static const TagProperties & getTagProperties(SumoXMLTag tag)
get Tag Properties
FXLabel * myLabelBlockMovement
Label for Check blocked movement.
bool nextElement(const Position &clickedPosition)
try to go to next element if clicked position is near to saved position
SumoXMLTag
Numbers representing SUMO-XML - element names.
#define GUIDesignComboBoxNCol
number of column of every combo box
static RGBColor parseColor(std::string coldef)
Parses a color information.
#define GUIDesignCheckButtonAttribute
checkButton without thick extended over the frame used for attributes
void removeInspectedAC(GNEAttributeCarrier *ac)
remove AC from current inspected ACs
#define GUIDesignButtonAttribute
button extended over over column with thick and raise frame
GNEInspectorFrame * myInspectorFrameParent
current GNEInspectorFrame parent
FXHorizontalFrame * myHorizontalFrameBlockMovement
horizontal frame for block movement
bool selectEdges() const
whether inspection, selection and inversion should apply to edges or to lanes
long onCmdNeteditAttributeHelp(FXObject *, FXSelector, void *)
Called when user press the help button.
GNEInspectorFrame * myInspectorFrameParent
pointer to GNEInspectorFrame parent
const KeyPressed & getKeyPressed() const
get Key Pressed modul
std::vector< GNEAttributeCarrier * > myInspectedACs
the multi-selection currently being inspected
begin/end of the description of a junction
begin/end of the description of a single lane
FXLabel * getFrameHeaderLabel() const
get the label for the frame's header
TemplateEditor()
FOX needs this.
FXButton * mySetTemplateButton
set template button
AttributesEditor * myAttributesEditor
Attribute editor.
long onCmdPreviousElement(FXObject *, FXSelector, void *)
Inspect previous element (from top to bot)
void inspectClickedElement(const GNEViewNet::ObjectsUnderCursor &objectsUnderCursor, const Position &clickedPosition)
Inspect a singe element (the front of AC AttributeCarriers of ObjectUnderCursor.
block shape of a graphic element (Used mainly in GNEShapes)
const AttributeProperties & getAttributeProperties(SumoXMLAttr attr) const
get attribute (throw error if doesn't exist)
FXHorizontalFrame * myGEOAttributeFrame
horizontal frame for GEOAttribute
Position mySavedClickedPosition
saved clicked position
void showACHierarchy(GNEAttributeCarrier *AC)
show ACHierarchy
#define GUIDesignComboBoxAttribute
Combo box static (cannot be edited) extended over the matrix column.
void inspectFromDeleteFrame(GNEAttributeCarrier *AC, GNEAttributeCarrier *previousElement, bool previousElementWasMarked)
inspect called from DeleteFrame
void show()
show delete frame
connectio between two lanes
void hideACHierarchy()
hide ACHierarchy
const std::vector< GNEAttributeCarrier * > & getClickedAttributeCarriers() const
get vector with clicked ACs
NeteditAttributesEditor()
FOX needs this.
static RGBColor getRGBColor(FXColor col)
converts FXColor to RGBColor
GNEViewParent * getViewParent() const
get the net object
void inspectSingleElement(GNEAttributeCarrier *AC)
Inspect a single element.
go back to the previous element
FXTextField * myGEOAttributeTextField
textField for GEOAttribute
bool processClick(const Position &clickedPosition, GNEViewNet::ObjectsUnderCursor &objectsUnderCursor)
process click over Viewnet
static int getHigherNumberOfAttributes()
return the number of attributes of the tag with the most highter number of attributes ...
void refreshGEOAttributesEditor(bool forceRefresh)
refresh GEO attributes editor
Close shape of a polygon (Used by GNEPolys)
link,node: the traffic light id responsible for this link
void hideOverlappedInspection()
hide template editor
FXCheckButton * myUseGEOCheckButton
checkBox for use GEO
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
GEOAttributesEditor()
FOX needs this.
GNEFrame::ACHierarchy * myACHierarchy
Attribute Carrier Hierarchy.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
FXHorizontalFrame * myUseGEOFrame
horizontal frame for use GEO
void hideTemplateEditor()
hide template editor
GNEInspectorFrame * myInspectorFrameParent
current GNEInspectorFrame parent
std::vector< GNEAttributeCarrier * > getSelectedAttributeCarriers()
get all selected attribute carriers
void showNeteditAttributesEditor()
show netedit attributes editor
GNEViewNet * getViewNet() const
get view net
long onCmdSetGEOAttribute(FXObject *, FXSelector, void *)
Called when user change the current GEO Attribute.
virtual void selectAttributeCarrier(bool changeFlag=true)=0
GUIGlObjectType getGlTypeFront() const
get front GUI GL object type (or a pointer to nullptr if there isn't)
FXTextField * myTextFieldAdditionalParent
pointer for change additional parent
FXLabel * myLabelCloseShape
Label for close shape.
~GNEInspectorFrame()
Destructor.
OverlappedInspection * getOverlappedInspection() const
get OverlappedInspection modul
GenericParametersEditor * myGenericParametersEditor
Generic parameters editor.
long onCmdSetNeteditAttribute(FXObject *, FXSelector, void *)
Called when user change the current GEO Attribute.
GNEViewNet * myViewNet
View Net for changes.
long onCmdSetTemplate(FXObject *, FXSelector, void *)
set current edge as new template
const std::vector< GNEAttributeCarrier * > & getInspectedACs() const
get current list of inspected ACs
void hide()
hide inspector frame
FXHorizontalFrame * myHorizontalFrameAdditionalParent
horizontal frame for change additional parent
bool previousElement(const Position &clickedPosition)
try to go to previous element if clicked position is near to saved position
bool myPreviousElementDeleteWasMarked
flag to ckec if myPreviousElementDelete was marked in Delete Frame
FXLabel * myCurrentIndexLabel
label for current index
FXButton * myHelpButton
button for help
#define GUIDesignButtonIconRectangular
button only with icon (46x23)
void showGEOAttributesEditor()
show GEO attributes editor
GNEUndoList * getUndoList() const
get the undoList object
static const int InvalidTlIndex
size_t myItemIndex
current index item
AttributesEditor()
FOX needs this.
LockGLObjectTypes * getLockGLObjectTypes() const
get selected items
#define GUIDesignTextField
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
FXHorizontalFrame * myHorizontalFrameBlockShape
horizontal frame for block shape
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
~NeteditAttributesEditor()
destructor
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
A point in 2D or 3D with translation and scaling methods.
FXButton * myHelpButton
button for help
GNEInspectorFrame * myInspectorFrameParent
current GNEInspectorFrame parent
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames ...
GNEFrame::ACHierarchy * getACHierarchy() const
get ACHierarchy
virtual bool isAttributeCarrierSelected() const =0
check if attribute carrier is selected
FXButton * myCopyTemplateButton
copy template button
block movement of a graphic element
void setDottedAC(const GNEAttributeCarrier *AC)
set attributeCarrier under cursor
attribute edited trought dialog
bool controlKeyPressed() const
check if CONTROL key was pressed during click
node: the type of traffic light
FXLabel * myLabelAdditionalParent
Label for additional parent.
edge: the shape in xml-definition
long onCmdCopyTemplate(FXObject *, FXSelector, void *)
copy edge attributes from edge template
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_MODE_SELECT
FXHorizontalFrame * myHorizontalFrameCloseShape
horizontal frame for close shape
FXDEFMAP(GNEInspectorFrame::OverlappedInspection) OverlappedInspectionMap[]
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
FXButton * myHelpButton
button for help
void clearInspectedAC()
Clear all current inspected ACs.
void focusUpperElement()
focus upper element of frame
std::vector< GNEAttributeCarrier * > myOverlappedACs
objects under cursor
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
void incRef(const std::string &debugMsg="")
Increarse reference.
Dialog for edit rerouters.
#define GUIDesignButtonRectangular
little button rectangular (46x23) used in frames (For example, in "help" buttons) ...
long onUpdCopyTemplate(FXObject *, FXSelector, void *)
update the copy button with the name of the template
GNEAttributeCarrier * myPreviousElementInspect
pointer to previous element called by Inspector Frame
long onCmdGoBack(FXObject *, FXSelector, void *)
called when user toogle the go back button
FXCheckButton * myCheckBoxBlockShape
pointer to check box "Block Shape"
void decRef(const std::string &debugMsg="")
Decrease reference.
GNEEdge * myEdgeTemplate
the edge template
void refreshAttributeEditor(bool forceRefreshShape, bool forceRefreshPosition)
refresh attribute editor (only the valid values will be refresh)
long onCmdNextElement(FXObject *, FXSelector, void *)
Inspect next Element (from top to bot)
begin/end of the description of an edge
FXCheckButton * myCheckBoxBlockMovement
pointer to check box "Block movement"
bool overlappedInspectionShown() const
check if overlappedInspection modul is shown
void showOverlappedInspection(const GNEViewNet::ObjectsUnderCursor &objectsUnderCursor, const Position &clickedPosition)
show template editor
#define GUIDesignLabelCenterThick
label extended over frame with thick and with text justify to center and height of 23 ...
A road/street connecting two junctions (netedit-version)
FXButton * myPreviousElement
Previous element button.
~TemplateEditor()
destructor
#define GUIDesignTextFieldNCol
Num of column of text field.
long onCmdGEOAttributeHelp(FXObject *, FXSelector, void *)
Called when user press the help button.
static std::string replace(std::string str, const char *what, const char *by)
bool checkSavedPosition(const Position &clickedPosition) const
check if given position is near to saved position
GNEAttributeCarrier * myPreviousElementDelete
pointer to previous element called by Delete Frame
long onCmdOverlappingHelp(FXObject *, FXSelector, void *)
Called when user press the help button.
virtual void show()
show Frame
FXButton * myNextElement
Next element button.
#define GUIDesignDialogBox
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
GEOAttributesEditor * myGEOAttributesEditor
GEO Attributes editor.
void showGenericParametersEditor(GNEAttributeCarrier *AC)
show netedit attributes editor (used for edit generic parameters of an existent AC) ...
~OverlappedInspection()
destructor
FXLabel * myUseGEOLabel
Label for use GEO.
~GEOAttributesEditor()
destructor
TemplateEditor * getTemplateEditor() const
get template editor
NeteditAttributesEditor * myNeteditAttributesEditor
Netedit Attributes editor.
GNEInspectorFrame * getInspectorFrameParent() const
get InspectorFrame Parent
TemplateEditor * myTemplateEditor
Template editor.
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions) ...
FXLabel * myLabelBlockShape
Label for Check blocked shape.
bool IsObjectTypeLocked(const GUIGlObjectType type) const
check if an object is locked
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
#define GUIDesignTextFieldInt
text field extended over Frame with thick frame and limited to Integers
virtual void hide()
hide Frame
void setEdgeTemplate(GNEEdge *tpl)
seh the template edge (we assume shared responsibility via reference counting)
GNEAttributeCarrier * getAttributeCarrierFront() const
get front attribute carrier (or a pointer to nullptr if there isn't)
GNEDeleteFrame * getDeleteFrame() const
get frame for GNE_MODE_DELETE
void show()
show inspector frame
GNENet * getNet() const
get the net object
#define GUIDesignTextFieldReal
text field extended over Frame with thick frame and limited to Doubles/doubles
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
void hideNeteditAttributesEditor()
hide netedit attributes editor
FXCheckButton * myCheckBoxCloseShape
pointer to check box "Block movement"
#define GUIDesignButtonOK
void swapLane2Edge()
swap lane to edge
void inspectChild(GNEAttributeCarrier *AC, GNEAttributeCarrier *previousElement)
inspect child of already inspected element
const TagProperties & getTagProperty() const
get Tag Property assigned to this object
link: the index of the link within the traffic light
void openHelpAttributesDialog(const GNEAttributeCarrier::TagProperties &tagProperties) const
Open help attributes dialog.
virtual void unselectAttributeCarrier(bool changeFlag=true)=0
unselect attribute carrier using GUIGlobalSelection
parent of an additional element
GNEEdge * getEdgeTemplate() const
get the template edge (to copy attributes from)
void hideGEOAttributesEditor()
hide GEO attributes editor
FXButton * myBackButton
back Button
void inspectMultisection(const std::vector< GNEAttributeCarrier *> &ACs)
Inspect the given multi-selection.
bool shiftKeyPressed() const
check if SHIFT key was pressed during click
#define GUIDesignLabelAttribute
label extended over the matrix column with thick frame and height of 23
FXLabel * myGEOAttributeLabel
Label for GEOAttribute.
FXButton * myHelpButton
button for help
void hideAttributesEditorModul()
hide attribute editor
std::vector< GNEInspectorFrame::AttributesEditor::AttributeInput * > myVectorOfAttributeInputs
list of Attribute inputs
GNEInspectorFrame * myInspectorFrameParent
pointer to inspector frame parent
void showAttributeEditorModul()
show attributes of ac
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
long onCmdAttributeHelp(FXObject *, FXSelector, void *)
Called when user press the help button.
bool unreferenced()
check if object ins't referenced
FXHorizontalFrame * myHeaderLeftFrame
fame for left header elements
OverlappedInspection()
FOX needs this.
OverlappedInspection * myOverlappedInspection
Overlapped Inspection.