Eclipse SUMO - Simulation of Urban MObility
GNEInspectorFrame.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3// Copyright (C) 2001-2022 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
19// The Widget for modifying network-element attributes (i.e. lane speed)
20/****************************************************************************/
21#include <config.h>
22
23#include <netedit/GNENet.h>
24#include <netedit/GNEUndoList.h>
25#include <netedit/GNEViewNet.h>
40
41#include "GNEInspectorFrame.h"
42#include "GNEDeleteFrame.h"
43
44
45// ===========================================================================
46// FOX callback mapping
47// ===========================================================================
48
49FXDEFMAP(GNEInspectorFrame) GNEInspectorFrameMap[] = {
51};
52
57};
58
62};
63
68};
69
73};
74
77};
78
79// Object implementation
80FXIMPLEMENT(GNEInspectorFrame, FXVerticalFrame, GNEInspectorFrameMap, ARRAYNUMBER(GNEInspectorFrameMap))
81FXIMPLEMENT(GNEInspectorFrame::NeteditAttributesEditor, MFXGroupBoxModule, NeteditAttributesEditorMap, ARRAYNUMBER(NeteditAttributesEditorMap))
82FXIMPLEMENT(GNEInspectorFrame::GEOAttributesEditor, MFXGroupBoxModule, GEOAttributesEditorMap, ARRAYNUMBER(GEOAttributesEditorMap))
83FXIMPLEMENT(GNEInspectorFrame::TemplateEditor, MFXGroupBoxModule, TemplateEditorMap, ARRAYNUMBER(TemplateEditorMap))
84FXIMPLEMENT(GNEInspectorFrame::ParametersEditor, MFXGroupBoxModule, ParametersEditorMap, ARRAYNUMBER(ParametersEditorMap))
85FXIMPLEMENT(GNEInspectorFrame::AdditionalDialog, MFXGroupBoxModule, AdditionalDialogMap, ARRAYNUMBER(AdditionalDialogMap))
86
87
88// ===========================================================================
89// method definitions
90// ===========================================================================
91
92// ---------------------------------------------------------------------------
93// GNEInspectorFrame::NeteditAttributesEditor - methods
94// ---------------------------------------------------------------------------
95
97 MFXGroupBoxModule(inspectorFrameParent, TL("Netedit attributes")),
98 myInspectorFrameParent(inspectorFrameParent) {
99 // Create mark as front element button
100 myMarkFrontElementButton = new FXButton(getCollapsableFrame(), TL("Mark as front element"), GUIIconSubSys::getIcon(GUIIcon::FRONTELEMENT),
102 // Create elements for parent additional
103 myLabelParentAdditional = new FXLabel(getCollapsableFrame(), "Parent", nullptr, GUIDesignLabelCenterThick);
104 myTextFieldParentAdditional = new FXTextField(getCollapsableFrame(), GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextField);
105 mySetNewParentButton = new MFXCheckableButton(false, getCollapsableFrame(),
106 inspectorFrameParent->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu(),
107 "Set new parent", nullptr, this, MID_GNE_SET_ATTRIBUTE, GUIDesignMFXCheckableButton);
108 // Create elements for close shape
109 myHorizontalFrameCloseShape = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
110 myLabelCloseShape = new FXLabel(myHorizontalFrameCloseShape, "Close shape", nullptr, GUIDesignLabelAttribute);
111 myCheckBoxCloseShape = new FXCheckButton(myHorizontalFrameCloseShape, "", this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
112 // Create help button
113 myHelpButton = new FXButton(getCollapsableFrame(), TL("Help"), nullptr, this, MID_HELP, GUIDesignButtonRectangular);
114}
115
116
118
119
120void
122 // get ACs
123 const auto& ACs = myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers();
124 // continue if there is edited ACs
125 if (ACs.size() > 0) {
126 // enable all editable elements
127 myTextFieldParentAdditional->enable();
128 myCheckBoxCloseShape->enable();
129 // obtain tag property (only for improve code legibility)
130 const auto& tagValue = ACs.front()->getTagProperty();
131 // check if item can be mark as front elmenet
132 if (ACs.size() == 1) {
133 // show NeteditAttributesEditor
134 show();
135 // show button
136 myMarkFrontElementButton->show();
137 // enable or disable
138 if (myInspectorFrameParent->getViewNet()->getFrontAttributeCarrier() == ACs.front()) {
139 myMarkFrontElementButton->disable();
140 } else {
141 myMarkFrontElementButton->enable();
142 }
143 }
144 // check if item can block their shape
145 if (tagValue.canCloseShape()) {
146 // show NeteditAttributesEditor
147 show();
148 // Iterate over AC to obtain values
149 bool value = true;
150 for (const auto& inspectedAC : ACs) {
151 value &= GNEAttributeCarrier::parse<bool>(inspectedAC->getAttribute(GNE_ATTR_CLOSE_SHAPE));
152 }
153 // show close shape frame
154 myHorizontalFrameCloseShape->show();
155 // show help button
156 myHelpButton->show();
157 // set check box value and update label
158 if (value) {
159 myCheckBoxCloseShape->setCheck(true);
160 myCheckBoxCloseShape->setText(TL("true"));
161 } else {
162 myCheckBoxCloseShape->setCheck(false);
163 myCheckBoxCloseShape->setText(TL("false"));
164 }
165 }
166 // Check if item has another item as parent and can be reparemt
167 if (tagValue.isChild() && tagValue.canBeReparent()) {
168 // show NeteditAttributesEditor
169 show();
170 // obtain additional Parent
171 std::set<std::string> parents;
172 for (const auto& inspectedAC : ACs) {
173 parents.insert(inspectedAC->getAttribute(GNE_ATTR_PARENT));
174 }
175 // show parent additional elements
176 myLabelParentAdditional->show();
177 myTextFieldParentAdditional->show();
178 mySetNewParentButton->show();
179 // reset new parent button
180 mySetNewParentButton->setChecked(false);
181 mySetNewParentButton->setText(TL("Set new parent"));
182 // set parent tag icon
183 const auto& parentTagProperty = GNEAttributeCarrier::getTagProperty(ACs.front()->getTagProperty().getParentTags().front());
184 mySetNewParentButton->setIcon(GUIIconSubSys::getIcon(parentTagProperty.getGUIIcon()));
185 // show help button
186 myHelpButton->show();
187 // set Label and TextField with the Tag and ID of parent
188 myLabelParentAdditional->setText((parentTagProperty.getTagStr() + " parent").c_str());
189 myTextFieldParentAdditional->setText(toString(parents).c_str());
190 }
191 // disable all editable elements if we're in demand mode and inspected AC isn't a demand element
192 if (GNEFrameAttributeModules::isSupermodeValid(myInspectorFrameParent->getViewNet(), ACs.front()) == false) {
193 myTextFieldParentAdditional->disable();
194 myCheckBoxCloseShape->disable();
195 }
196 }
197}
198
199
200void
202 // hide all elements of GroupBox
203 myLabelParentAdditional->hide();
204 myTextFieldParentAdditional->hide();
205 mySetNewParentButton->hide();
206 myHorizontalFrameCloseShape->hide();
207 myMarkFrontElementButton->hide();
208 myHelpButton->hide();
209 // hide groupbox
210 hide();
211}
212
213
214void
216 // get inspected Attribute carriers
217 const auto& ACs = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
218 if (ACs.size() > 0) {
219 // enable or disable mark front element button
220 if (myInspectorFrameParent->getViewNet()->getFrontAttributeCarrier() == ACs.front()) {
221 myMarkFrontElementButton->disable();
222 } else {
223 myMarkFrontElementButton->enable();
224 }
225 // refresh close shape
226 if (myHorizontalFrameCloseShape->shown()) {
227 // Iterate over AC to obtain values
228 bool value = true;
229 for (const auto& i : ACs) {
230 value &= GNEAttributeCarrier::parse<bool>(i->getAttribute(GNE_ATTR_CLOSE_SHAPE));
231 }
232 // set check box value and update label
233 if (value) {
234 myCheckBoxCloseShape->setCheck(true);
235 myCheckBoxCloseShape->setText(TL("true"));
236 } else {
237 myCheckBoxCloseShape->setCheck(false);
238 myCheckBoxCloseShape->setText(TL("false"));
239 }
240 }
241 // Check if item has another item as parent (Currently only for single Additionals)
242 if (myTextFieldParentAdditional->shown() && ((myTextFieldParentAdditional->getTextColor() == FXRGB(0, 0, 0)) || forceRefresh)) {
243 // set Label and TextField with the Tag and ID of parent
244 myLabelParentAdditional->setText((toString(ACs.front()->getTagProperty().getParentTags().front()) + " parent").c_str());
245 myTextFieldParentAdditional->setText(ACs.front()->getAttribute(GNE_ATTR_PARENT).c_str());
246 }
247 }
248}
249
250
251bool
253 if (!shown()) {
254 return false;
255 } else {
256 return (mySetNewParentButton->shown() && mySetNewParentButton->amChecked());
257 }
258}
259
260
261void
263 const auto& ACs = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
264 // check number of inspected ACs
265 if ((ACs.size() > 0) && clickedAC) {
266 // check parent tags
267 for (const auto& parentTag : ACs.front()->getTagProperty().getParentTags()) {
268 if (parentTag == clickedAC->getTagProperty().getTag()) {
269 // check if we're changing multiple attributes
270 if (ACs.size() > 1) {
271 myInspectorFrameParent->myViewNet->getUndoList()->begin(ACs.front()->getTagProperty().getGUIIcon(), "Change multiple attributes");
272 }
273 // replace the parent of all inspected elements
274 for (const auto& AC : ACs) {
275 AC->setAttribute(GNE_ATTR_PARENT, clickedAC->getID(), myInspectorFrameParent->myViewNet->getUndoList());
276 }
277 // finish change multiple attributes
278 if (ACs.size() > 1) {
279 myInspectorFrameParent->myViewNet->getUndoList()->end();
280 }
281 // stop select parent
282 stopSelectParent();
283 // resfresh netedit attributes editor
284 refreshNeteditAttributesEditor(true);
285 }
286 }
287 }
288}
289
290
291void
293 if (mySetNewParentButton->amChecked()) {
294 onCmdSetNeteditAttribute(mySetNewParentButton, 0, nullptr);
295 }
296}
297
298
299long
301 const auto& ACs = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
302 // make sure that ACs has elements
303 if (ACs.size() > 0) {
304 // check if we're changing multiple attributes
305 if (ACs.size() > 1) {
306 myInspectorFrameParent->myViewNet->getUndoList()->begin(ACs.front()->getTagProperty().getGUIIcon(), "Change multiple attributes");
307 }
308 if (obj == mySetNewParentButton) {
309 if (mySetNewParentButton->amChecked()) {
310 mySetNewParentButton->setText(TL("Set new parent"));
311 mySetNewParentButton->setChecked(false);
312 } else {
313 mySetNewParentButton->setText(("Click over " + toString(ACs.front()->getTagProperty().getParentTags().front())).c_str());
314 mySetNewParentButton->setChecked(true);
315 }
316 } else if (obj == myCheckBoxCloseShape) {
317 // set new values in all inspected Attribute Carriers
318 for (const auto& AC : ACs) {
319 if (myCheckBoxCloseShape->getCheck() == 1) {
320 AC->setAttribute(GNE_ATTR_CLOSE_SHAPE, "true", myInspectorFrameParent->myViewNet->getUndoList());
321 myCheckBoxCloseShape->setText(TL("true"));
322 } else {
323 AC->setAttribute(GNE_ATTR_CLOSE_SHAPE, "false", myInspectorFrameParent->myViewNet->getUndoList());
324 myCheckBoxCloseShape->setText(TL("false"));
325 }
326 }
327 } else if (obj == myTextFieldParentAdditional) {
328 if (ACs.front()->isValid(GNE_ATTR_PARENT, myTextFieldParentAdditional->getText().text())) {
329 // replace the parent of all inspected elements
330 for (const auto& AC : ACs) {
331 AC->setAttribute(GNE_ATTR_PARENT, myTextFieldParentAdditional->getText().text(), myInspectorFrameParent->myViewNet->getUndoList());
332 }
333 myTextFieldParentAdditional->setTextColor(FXRGB(0, 0, 0));
334 myTextFieldParentAdditional->killFocus();
335 } else {
336 myTextFieldParentAdditional->setTextColor(FXRGB(255, 0, 0));
337 }
338 }
339 // finish change multiple attributes
340 if (ACs.size() > 1) {
341 myInspectorFrameParent->myViewNet->getUndoList()->end();
342 }
343 // force refresh values of AttributesEditor and GEOAttributesEditor
344 myInspectorFrameParent->myAttributesEditor->refreshAttributeEditor(true, true);
345 myInspectorFrameParent->myGEOAttributesEditor->refreshGEOAttributesEditor(true);
346 }
347 return 1;
348}
349
350
351long
353 // check number of elements
354 if (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
355 // mark AC as front elemnet
356 myInspectorFrameParent->getViewNet()->setFrontAttributeCarrier(myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front());
357 // disable button
358 myMarkFrontElementButton->disable();
359 }
360 return 1;
361}
362
363
364long
366 // Create dialog box
367 FXDialogBox* additionalNeteditAttributesHelpDialog = new FXDialogBox(getCollapsableFrame(), "Netedit Attributes Help", GUIDesignDialogBox);
368 additionalNeteditAttributesHelpDialog->setIcon(GUIIconSubSys::getIcon(GUIIcon::MODEADDITIONAL));
369 // set help text
370 std::ostringstream help;
371 help
372 << TL("- Mark as front element: Mark element as front element (Will be drawn over all other elements)\n")
373 << TL("- Block movement: disable movement in move mode\n")
374 << TL("- Block shape: Disable moving of shape's vertices and edges. Entire shape can be moved'.\n")
375 << TL("- Close shape: Add or remove the last vertex with the same position of first edge'.");
376 // Create label with the help text
377 new FXLabel(additionalNeteditAttributesHelpDialog, help.str().c_str(), nullptr, GUIDesignLabelFrameInformation);
378 // Create horizontal separator
379 new FXHorizontalSeparator(additionalNeteditAttributesHelpDialog, GUIDesignHorizontalSeparator);
380 // Create frame for OK Button
381 FXHorizontalFrame* myHorizontalFrameOKButton = new FXHorizontalFrame(additionalNeteditAttributesHelpDialog, GUIDesignAuxiliarHorizontalFrame);
382 // Create Button Close (And two more horizontal frames to center it)
383 new FXHorizontalFrame(myHorizontalFrameOKButton, GUIDesignAuxiliarHorizontalFrame);
384 new FXButton(myHorizontalFrameOKButton, TL("OK\t\tclose"), GUIIconSubSys::getIcon(GUIIcon::ACCEPT), additionalNeteditAttributesHelpDialog, FXDialogBox::ID_ACCEPT, GUIDesignButtonOK);
385 new FXHorizontalFrame(myHorizontalFrameOKButton, GUIDesignAuxiliarHorizontalFrame);
386 // Write Warning in console if we're in testing mode
387 WRITE_DEBUG("Opening NeteditAttributesEditor help dialog");
388 // create Dialog
389 additionalNeteditAttributesHelpDialog->create();
390 // show in the given position
391 additionalNeteditAttributesHelpDialog->show(PLACEMENT_CURSOR);
392 // refresh APP
393 getApp()->refresh();
394 // open as modal dialog (will block all windows until stop() or stopModal() is called)
395 getApp()->runModalFor(additionalNeteditAttributesHelpDialog);
396 // Write Warning in console if we're in testing mode
397 WRITE_DEBUG("Closing NeteditAttributesEditor help dialog");
398 return 1;
399}
400
401// ---------------------------------------------------------------------------
402// GNEInspectorFrame::GEOAttributesEditor - methods
403// ---------------------------------------------------------------------------
404
406 MFXGroupBoxModule(inspectorFrameParent, TL("GEO Attributes")),
407 myInspectorFrameParent(inspectorFrameParent) {
408
409 // Create Frame for GEOAttribute
411 myGEOAttributeLabel = new FXLabel(myGEOAttributeFrame, "Undefined GEO Attribute", nullptr, GUIDesignLabelAttribute);
413
414 // Create Frame for use GEO
418
419 // Create help button
420 myHelpButton = new FXButton(getCollapsableFrame(), TL("Help"), nullptr, this, MID_HELP, GUIDesignButtonRectangular);
421}
422
423
425
426
427void
429 // make sure that ACs has elements
430 if (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() > 0) {
431 // enable all editable elements
432 myGEOAttributeTextField->enable();
433 myUseGEOCheckButton->enable();
434 // obtain tag property (only for improve code legibility)
435 const auto& tagProperty = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getTagProperty();
436 // check if item can use a geo position
437 if (tagProperty.hasGEOShape()) {
438 // show GEOAttributesEditor
439 show();
440 // Iterate over AC to obtain values
441 bool value = true;
442 for (const auto& i : myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers()) {
443 value &= GNEAttributeCarrier::parse<bool>(i->getAttribute(SUMO_ATTR_GEO));
444 }
445 // show use geo frame
446 myUseGEOFrame->show();
447 // set UseGEOCheckButton value of and update label (only if geo conversion is defined)
448 if (GeoConvHelper::getFinal().getProjString() != "!") {
449 myUseGEOCheckButton->enable();
450 if (value) {
451 myUseGEOCheckButton->setCheck(true);
452 myUseGEOCheckButton->setText(TL("true"));
453 } else {
454 myUseGEOCheckButton->setCheck(false);
455 myUseGEOCheckButton->setText(TL("false"));
456 }
457 } else {
458 myUseGEOCheckButton->disable();
459 }
460 if (tagProperty.hasGEOShape() && myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
461 myGEOAttributeFrame->show();
462 myGEOAttributeLabel->setText(toString(SUMO_ATTR_GEOSHAPE).c_str());
463 myGEOAttributeTextField->setTextColor(FXRGB(0, 0, 0));
464 // only allow edit if geo conversion is defined
465 if (GeoConvHelper::getFinal().getProjString() != "!") {
466 myGEOAttributeTextField->enable();
467 myGEOAttributeTextField->setText(myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getAttribute(SUMO_ATTR_GEOSHAPE).c_str());
468 } else {
469 myGEOAttributeTextField->disable();
470 myGEOAttributeTextField->setText(TL("No geo-conversion defined"));
471 }
472 }
473 }
474 // disable all editable elements if we're in demand mode and inspected AC isn't a demand element
475 if (GNEFrameAttributeModules::isSupermodeValid(myInspectorFrameParent->getViewNet(), myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()) == false) {
476 myGEOAttributeTextField->disable();
477 myUseGEOCheckButton->disable();
478 }
479 }
480}
481
482
483void
485 // hide all elements of GroupBox
486 myGEOAttributeFrame->hide();
487 myUseGEOFrame->hide();
488 // hide groupbox
489 hide();
490}
491
492
493void
495 // obtain tag property (only for improve code legibility)
496 const auto& tagProperty = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getTagProperty();
497 // Check that myGEOAttributeFrame is shown
498 if ((GeoConvHelper::getFinal().getProjString() != "!") && myGEOAttributeFrame->shown() && ((myGEOAttributeTextField->getTextColor() == FXRGB(0, 0, 0)) || forceRefresh)) {
499 if (tagProperty.hasGEOShape()) {
500 myGEOAttributeTextField->setText(myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getAttribute(SUMO_ATTR_GEOSHAPE).c_str());
501 }
502 myGEOAttributeTextField->setTextColor(FXRGB(0, 0, 0));
503 }
504}
505
506
507long
509 // make sure that ACs has elements
510 if ((GeoConvHelper::getFinal().getProjString() != "!") && (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() > 0)) {
511 if (obj == myGEOAttributeTextField) {
512 // obtain tag property (only for improve code legibility)
513 const auto& tagProperty = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getTagProperty();
514 // Change GEO Attribute depending of type (Position or shape)
515 if (tagProperty.hasGEOShape()) {
516 if (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->isValid(SUMO_ATTR_GEOSHAPE, myGEOAttributeTextField->getText().text())) {
517 myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->setAttribute(SUMO_ATTR_GEOSHAPE, myGEOAttributeTextField->getText().text(), myInspectorFrameParent->myViewNet->getUndoList());
518 myGEOAttributeTextField->setTextColor(FXRGB(0, 0, 0));
519 myGEOAttributeTextField->killFocus();
520 } else {
521 myGEOAttributeTextField->setTextColor(FXRGB(255, 0, 0));
522 }
523 } else {
524 throw ProcessError("myGEOAttributeTextField must be hidden becaurse there isn't GEO Attribute to edit");
525 }
526 } else if (obj == myUseGEOCheckButton) {
527 // update GEO Attribute of entire selection
528 for (const auto& i : myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers()) {
529 if (myUseGEOCheckButton->getCheck() == 1) {
530 i->setAttribute(SUMO_ATTR_GEO, "true", myInspectorFrameParent->myViewNet->getUndoList());
531 myUseGEOCheckButton->setText(TL("true"));
532 } else {
533 i->setAttribute(SUMO_ATTR_GEO, "false", myInspectorFrameParent->myViewNet->getUndoList());
534 myUseGEOCheckButton->setText(TL("false"));
535 }
536 }
537 }
538 // force refresh values of Attributes editor and NeteditAttributesEditor
539 myInspectorFrameParent->myAttributesEditor->refreshAttributeEditor(true, true);
540 myInspectorFrameParent->myNeteditAttributesEditor->refreshNeteditAttributesEditor(true);
541 }
542 return 1;
543}
544
545
546long
548 FXDialogBox* helpDialog = new FXDialogBox(getCollapsableFrame(), "GEO attributes Help", GUIDesignDialogBox);
549 std::ostringstream help;
550 help
551 << TL(" SUMO uses the World Geodetic System 84 (WGS84/UTM).\n")
552 << TL(" For a GEO-referenced network, geo coordinates are represented as pairs of Longitude and Latitude\n")
553 << TL(" in decimal degrees without extra symbols. (N,W..)\n")
554 << TL(" - Longitude: East-west position of a point on the Earth's surface.\n")
555 << TL(" - Latitude: North-south position of a point on the Earth's surface.\n")
556 << TL(" - CheckBox 'geo' enables or disables saving position in GEO coordinates\n");
557 new FXLabel(helpDialog, help.str().c_str(), nullptr, GUIDesignLabelFrameInformation);
558 // "OK"
559 new FXButton(helpDialog, TL("OK\t\tclose"), GUIIconSubSys::getIcon(GUIIcon::ACCEPT), helpDialog, FXDialogBox::ID_ACCEPT, GUIDesignButtonOK);
560 helpDialog->create();
561 helpDialog->show();
562 return 1;
563}
564
565// ---------------------------------------------------------------------------
566// GNEInspectorFrame::TemplateEditor - methods
567// ---------------------------------------------------------------------------
568
570 MFXGroupBoxModule(inspectorFrameParent, TL("Templates")),
571 myInspectorFrameParent(inspectorFrameParent),
572 myEdgeTemplate(nullptr) {
573 // Create set template button
574 mySetTemplateButton = new FXButton(getCollapsableFrame(), TL("Set as Template\t\t"), nullptr, this, MID_HOTKEY_SHIFT_F1_TEMPLATE_SET, GUIDesignButton);
575 // Create copy template button
577 // Create copy template button
578 myClearTemplateButton = new FXButton(getCollapsableFrame(), TL("clear Edge Template"), nullptr, this, MID_HOTKEY_SHIFT_F3_TEMPLATE_CLEAR, GUIDesignButton);
579}
580
581
583}
584
585
586void
588 // show template editor only if we're editing an edge in Network mode
589 if ((myInspectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeNetwork()) &&
590 (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getTagProperty().getTag() == SUMO_TAG_EDGE)) {
591 // show "Set As Template"
592 if (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
593 mySetTemplateButton->show();
594 mySetTemplateButton->setText(("Set edge '" + myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getID() + "' as Template").c_str());
595 }
596 // update buttons
597 updateButtons();
598 // show modul
599 show();
600 }
601}
602
603
604void
606 // hide template editor
607 hide();
608}
609
610
613 return myEdgeTemplate;
614}
615
616
617void
619 // delete previous template edge
620 if (myEdgeTemplate) {
621 delete myEdgeTemplate;
622 myEdgeTemplate = nullptr;
623 }
624 // update edge template
625 if (edge) {
626 myEdgeTemplate = new GNEEdgeTemplate(edge);
627 // use template by default
628 myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getViewParent()->getCreateEdgeFrame()->setUseEdgeTemplate();
629 }
630}
631
632
633void
635 if (myEdgeTemplate) {
636 myEdgeTemplate->updateLaneTemplates();
637 // use template by default
638 myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getViewParent()->getCreateEdgeFrame()->setUseEdgeTemplate();
639 }
640}
641
642void
644 // check if template editor AND mySetTemplateButton is enabled
645 if (shown() && mySetTemplateButton->isEnabled()) {
646 onCmdSetTemplate(nullptr, 0, nullptr);
647 }
648}
649
650
651void
653 // check if template editor AND myCopyTemplateButton is enabled
654 if (shown() && myCopyTemplateButton->isEnabled()) {
655 onCmdCopyTemplate(nullptr, 0, nullptr);
656 }
657}
658
659
660void
662 // check if template editor AND myClearTemplateButton is enabled
663 if (shown() && myClearTemplateButton->isEnabled()) {
664 onCmdClearTemplate(nullptr, 0, nullptr);
665 }
666}
667
668
669long
671 // first check that there is exactly an inspected edge
672 if (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() != 1) {
673 throw ProcessError("Only one edge must be inspected");
674 }
675 // retrieve edge ID (and throw exception if edge doesn't exist)
676 GNEEdge* edge = myInspectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->retrieveEdge(myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getID());
677 // set template
678 setEdgeTemplate(edge);
679 // update buttons
680 updateButtons();
681 return 1;
682}
683
684
685long
687 // first check
688 if (myEdgeTemplate) {
689 // begin copy template
690 myInspectorFrameParent->myViewNet->getUndoList()->begin(GUIIcon::EDGE, "copy edge template");
691 // iterate over inspected ACs
692 for (const auto& inspectedAC : myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers()) {
693 // avoid copy template in the same edge
694 if (inspectedAC->getID() != myEdgeTemplate->getID()) {
695 // retrieve edge ID (and throw exception if edge doesn't exist)
696 myInspectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->retrieveEdge(inspectedAC->getID())->copyTemplate(myEdgeTemplate, myInspectorFrameParent->myViewNet->getUndoList());
697 }
698 }
699 // end copy template
700 myInspectorFrameParent->myViewNet->getUndoList()->end();
701 // refresh inspector parent
702 myInspectorFrameParent->myAttributesEditor->refreshAttributeEditor(true, true);
703 // update view (to see visual changes)
704 myInspectorFrameParent->myViewNet->updateViewNet();
705 }
706 return 1;
707}
708
709
710long
712 // set null edge
713 setEdgeTemplate(nullptr);
714 // update buttons
715 updateButtons();
716 return 1;
717}
718
719
720void
722 // enable or disable clear buttons depending of myEdgeTemplate
723 if (myEdgeTemplate) {
724 // get inspected ACs
725 const auto& ACs = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
726 // update caption of copy button
727 if (ACs.size() == 1) {
728 myCopyTemplateButton->setText(("Copy '" + myEdgeTemplate->getID() + "' into edge '" + ACs.front()->getID() + "'").c_str());
729 } else {
730 myCopyTemplateButton->setText(("Copy '" + myEdgeTemplate->getID() + "' into " + toString(ACs.size()) + " selected edges").c_str());
731 }
732 // enable set and clear buttons
733 myCopyTemplateButton->enable();
734 myClearTemplateButton->enable();
735 } else {
736 // update caption of copy button
737 myCopyTemplateButton->setText(TL("No edge Template Set"));
738 // disable set and clear buttons
739 myCopyTemplateButton->disable();
740 myClearTemplateButton->disable();
741 }
742}
743
744// ---------------------------------------------------------------------------
745// GNEFrameAttributeModules::ParametersEditor - methods
746// ---------------------------------------------------------------------------
747
749 MFXGroupBoxModule(inspectorFrameParent, TL("Parameters")),
750 myInspectorFrameParent(inspectorFrameParent) {
751 // create textfield and buttons
753 myButtonEditParameters = new FXButton(getCollapsableFrame(), TL("Edit parameters"), nullptr, this, MID_GNE_OPEN_PARAMETERS_DIALOG, GUIDesignButton);
754}
755
756
758
759
760void
762 // firt check if there is
763 if ((myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers().size() > 0) &&
764 myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers().front()->getTagProperty().hasParameters()) {
765 // refresh ParametersEditor
766 refreshParametersEditor();
767 // show groupbox
768 show();
769 } else {
770 hide();
771 }
772}
773
774
775void
777 // hide groupbox
778 hide();
779}
780
781
782void
784 // get front AC
785 const GNEAttributeCarrier* frontAC = myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers().size() > 0 ? myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers().front() : nullptr;
786 // continue depending of frontAC
787 if (frontAC && frontAC->getTagProperty().hasParameters()) {
788 // check if we're editing a single or a multiple AC
789 if (myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
790 // set text field parameters
791 myTextFieldParameters->setText(frontAC->getAttribute(GNE_ATTR_PARAMETERS).c_str());
792 } else if (myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers().size() > 0) {
793 // check if parameters of all inspected ACs are different
794 std::string parameters = frontAC->getAttribute(GNE_ATTR_PARAMETERS);
795 for (const auto& AC : myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers()) {
796 if (parameters != AC->getAttribute(GNE_ATTR_PARAMETERS)) {
797 parameters = "different parameters";
798 }
799 }
800 // set text field
801 myTextFieldParameters->setText(parameters.c_str());
802 }
803 // reset color
804 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
805 // disable myTextFieldParameters if Tag correspond to an network element but we're in demand mode (or vice versa), disable all elements
806 if (GNEFrameAttributeModules::isSupermodeValid(myInspectorFrameParent->myViewNet, frontAC)) {
807 myTextFieldParameters->enable();
808 myButtonEditParameters->enable();
809 } else {
810 myTextFieldParameters->disable();
811 myButtonEditParameters->disable();
812 }
813 }
814}
815
816
819 return myInspectorFrameParent;
820}
821
822
823long
825 // get front AC
826 const GNEAttributeCarrier* frontAC = myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers().size() > 0 ? myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers().front() : nullptr;
827 // continue depending of frontAC
828 if (frontAC && frontAC->getTagProperty().hasParameters()) {
829 if (myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers().size() > 1) {
830 // write debug information
831 WRITE_DEBUG("Open multiple parameters dialog");
832 // open multiple parameters dialog
833 if (GNEMultipleParametersDialog(this).execute()) {
834 // write debug information
835 WRITE_DEBUG("Close multiple parameters dialog");
836 // update frame parent after attribute successfully set
837 myInspectorFrameParent->attributeUpdated();
838 // Refresh parameter EditorInspector
839 refreshParametersEditor();
840 } else {
841 // write debug information
842 WRITE_DEBUG("Cancel multiple parameters dialog");
843 }
844 } else {
845 // write debug information
846 WRITE_DEBUG("Open single parameters dialog");
847 if (GNESingleParametersDialog(this).execute()) {
848 // write debug information
849 WRITE_DEBUG("Close single parameters dialog");
850 // update frame parent after attribute successfully set
851 myInspectorFrameParent->attributeUpdated();
852 // Refresh parameter EditorInspector
853 refreshParametersEditor();
854 } else {
855 // write debug information
856 WRITE_DEBUG("Cancel single parameters dialog");
857 }
858 }
859 }
860 return 1;
861}
862
863
864long
866 const auto& ACs = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
867 // get front AC
868 GNEAttributeCarrier* frontAC = ACs.size() > 0 ? ACs.front() : nullptr;
869 // continue depending of frontAC
870 if (frontAC && frontAC->getTagProperty().hasParameters()) {
871 // check if current given string is valid
872 if (frontAC->isValid(GNE_ATTR_PARAMETERS, myTextFieldParameters->getText().text())) {
873 // parsed parameters ok, then set text field black and continue
874 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
875 myTextFieldParameters->killFocus();
876 // check inspected parameters
877 if (ACs.size() == 1) {
878 // begin undo list
879 myInspectorFrameParent->myViewNet->getUndoList()->begin(frontAC->getTagProperty().getGUIIcon(), "change parameters");
880 // set parameters
881 frontAC->setACParameters(myTextFieldParameters->getText().text(), myInspectorFrameParent->myViewNet->getUndoList());
882 // end undo list
883 myInspectorFrameParent->myViewNet->getUndoList()->end();
884 } else if (ACs.size() > 0) {
885 // begin undo list
886 myInspectorFrameParent->myViewNet->getUndoList()->begin(frontAC->getTagProperty().getGUIIcon(), "change multiple parameters");
887 // set parameters in all ACs
888 for (const auto& inspectedAC : ACs) {
889 inspectedAC->setACParameters(myTextFieldParameters->getText().text(), myInspectorFrameParent->myViewNet->getUndoList());
890 }
891 // end undo list
892 myInspectorFrameParent->myViewNet->getUndoList()->end();
893 }
894 // update frame parent after attribute successfully set
895 myInspectorFrameParent->attributeUpdated();
896 } else {
897 myTextFieldParameters->setTextColor(FXRGB(255, 0, 0));
898 }
899 }
900 return 1;
901}
902
903// ---------------------------------------------------------------------------
904// GNEInspectorFrame::AdditionalDialog - methods
905// ---------------------------------------------------------------------------
906
908 MFXGroupBoxModule(inspectorFrameParent, TL("Additional dialog")),
909 myInspectorFrameParent(inspectorFrameParent) {
910 // Create mark as front element button
911 myOpenAdditionalDialog = new FXButton(getCollapsableFrame(), TL("Additional dialog"), nullptr, this, MID_OPEN_ADDITIONAL_DIALOG, GUIDesignButton);
912}
913
914
916
917
918void
920 // check number of inspected elements
921 if (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
922 // get AC
923 const GNEAttributeCarrier* AC = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front();
924 // check AC
925 if (AC->getTagProperty().getTag() == SUMO_TAG_REROUTER) {
926 // update button
927 myOpenAdditionalDialog->setText(TL("Open rerouter dialog"));
928 myOpenAdditionalDialog->setIcon(GUIIconSubSys::getIcon(GUIIcon::REROUTER));
929 // show modul
930 show();
931 } else if (AC->getTagProperty().getTag() == SUMO_TAG_CALIBRATOR) {
932 // update button
933 myOpenAdditionalDialog->setText(TL("Open calibrator dialog"));
934 myOpenAdditionalDialog->setIcon(GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR));
935 // show modul
936 show();
937 } else if (AC->getTagProperty().getTag() == GNE_TAG_CALIBRATOR_LANE) {
938 // update button
939 myOpenAdditionalDialog->setText(TL("Open calibrator lane dialog"));
940 myOpenAdditionalDialog->setIcon(GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR));
941 // show modul
942 show();
943 } else if (AC->getTagProperty().getTag() == SUMO_TAG_VSS) {
944 // update button
945 myOpenAdditionalDialog->setText(TL("Open VSS dialog"));
946 myOpenAdditionalDialog->setIcon(GUIIconSubSys::getIcon(GUIIcon::VARIABLESPEEDSIGN));
947 // show modul
948 show();
949 }
950 } else {
951 // hide modul
952 hide();
953 }
954}
955
956
957void
959 // hide groupbox
960 hide();
961}
962
963
964long
966 // check number of inspected elements
967 if (myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
968 // get AC
969 GNEAttributeCarrier* AC = myInspectorFrameParent->myAttributesEditor->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front();
970 // check AC
971 if (AC->getTagProperty().getTag() == SUMO_TAG_REROUTER) {
972 // Open rerouter dialog
973 GNERerouterDialog(dynamic_cast<GNERerouter*>(AC));
975 // Open calibrator dialog
976 GNECalibratorDialog(dynamic_cast<GNECalibrator*>(AC));
977 } else if (AC->getTagProperty().getTag() == SUMO_TAG_VSS) {
978 // Open VSS dialog
980 }
981 }
982 return 1;
983}
984
985// ---------------------------------------------------------------------------
986// GNEInspectorFrame - methods
987// ---------------------------------------------------------------------------
988
990 GNEFrame(viewParent, viewNet, "Inspector"),
994
995 // Create back button
997 myHeaderLeftFrame->hide();
998 myBackButton->hide();
999
1000 // Create Overlapped Inspection modul
1002
1003 // Create Attributes Editor modul
1005
1006 // Create GEO Parameters Editor modul
1008
1009 // create parameters Editor modul
1011
1012 // create additional dialog
1014
1015 // Create Netedit Attributes Editor modul
1017
1018 // Create Template editor modul
1019 myTemplateEditor = new TemplateEditor(this);
1020
1021 // Create GNEElementTree modul
1023}
1024
1025
1027
1028
1029void
1031 // inspect a null element to reset inspector frame
1032 inspectSingleElement(nullptr);
1033 // stop select new element
1035 // show
1037}
1038
1039
1040void
1044}
1045
1046
1047bool
1049 // get unlocked attribute carrier front
1050 auto AC = objectsUnderCursor.getAttributeCarrierFront();
1051 // first check if we have clicked over an Attribute Carrier
1052 if (AC) {
1053 // if Control key is Pressed, select instead inspect element
1055 // toggle networkElement selection
1056 if (AC->isAttributeCarrierSelected()) {
1058 } else {
1059 AC->selectAttributeCarrier();
1060 }
1061 } else {
1062 // first check if we clicked over a GNEOverlappedInspection point
1064 if (!myOverlappedInspection->previousElement(clickedPosition)) {
1065 // inspect attribute carrier, (or multiselection if AC is selected)
1066 inspectClickedElement(objectsUnderCursor, clickedPosition);
1067 }
1068 } else if (!myOverlappedInspection->nextElement(clickedPosition)) {
1069 // inspect attribute carrier, (or multiselection if AC is selected)
1070 inspectClickedElement(objectsUnderCursor, clickedPosition);
1071 }
1072 // focus upper element of inspector frame
1074 }
1075 return true;
1076 } else {
1077 return false;
1078 }
1079}
1080
1081
1082bool
1084 // get unlocked attribute carrier front
1085 auto AC = objectsUnderCursor.getAttributeCarrierFront();
1086 // first check if we have clicked over a demand element
1087 if (AC) {
1088 // if Control key is Pressed, select instead inspect element
1090 // toggle networkElement selection
1091 if (AC->isAttributeCarrierSelected()) {
1093 } else {
1094 AC->selectAttributeCarrier();
1095 }
1096 } else {
1097 // first check if we clicked over a GNEOverlappedInspection point
1099 if (!myOverlappedInspection->previousElement(clickedPosition)) {
1100 // inspect attribute carrier, (or multiselection if AC is selected)
1101 inspectClickedElement(objectsUnderCursor, clickedPosition);
1102 }
1103 } else if (!myOverlappedInspection->nextElement(clickedPosition)) {
1104 // inspect attribute carrier, (or multiselection if AC is selected)
1105 inspectClickedElement(objectsUnderCursor, clickedPosition);
1106 }
1107 // focus upper element of inspector frame
1109 }
1110 return true;
1111 } else {
1112 return false;
1113 }
1114}
1115
1116
1117bool
1119 // get unlocked attribute carrier front
1120 auto AC = objectsUnderCursor.getAttributeCarrierFront();
1121 // first check if we have clicked over a data element
1122 if (AC) {
1123 // if Control key is Pressed, select instead inspect element
1125 // toggle networkElement selection
1126 if (AC->isAttributeCarrierSelected()) {
1128 } else {
1129 AC->selectAttributeCarrier();
1130 }
1131 } else {
1132 // first check if we clicked over a GNEOverlappedInspection point
1134 if (!myOverlappedInspection->previousElement(clickedPosition)) {
1135 // inspect attribute carrier, (or multiselection if AC is selected)
1136 inspectClickedElement(objectsUnderCursor, clickedPosition);
1137 }
1138 } else if (!myOverlappedInspection->nextElement(clickedPosition)) {
1139 // inspect attribute carrier, (or multiselection if AC is selected)
1140 inspectClickedElement(objectsUnderCursor, clickedPosition);
1141 }
1142 // focus upper element of inspector frame
1144 }
1145 return true;
1146 } else {
1147 return false;
1148 }
1149}
1150
1151
1152void
1154 // Use the implementation of inspect for multiple AttributeCarriers to avoid repetition of code
1155 std::vector<GNEAttributeCarrier*> itemsToInspect;
1156 if (AC != nullptr) {
1158 if (AC->isAttributeCarrierSelected()) {
1159 // obtain selected ACs depending of current supermode
1160 const auto selectedACs = myViewNet->getNet()->getAttributeCarriers()->getSelectedAttributeCarriers(false);
1161 // iterate over selected ACs
1162 for (const auto& selectedAC : selectedACs) {
1163 // filter ACs to inspect using Tag as criterium
1164 if (selectedAC->getTagProperty().getTag() == AC->getTagProperty().getTag()) {
1165 itemsToInspect.push_back(selectedAC);
1166 }
1167 }
1168 } else {
1169 itemsToInspect.push_back(AC);
1170 }
1171 }
1172 inspectMultisection(itemsToInspect);
1173}
1174
1175
1176void
1177GNEInspectorFrame::inspectMultisection(const std::vector<GNEAttributeCarrier*>& ACs) {
1178 // update inspected ACs in viewNet
1180 // hide back button
1181 myHeaderLeftFrame->hide();
1182 myBackButton->hide();
1183 // Hide all elements
1192 // If vector of attribute Carriers contain data
1193 if (ACs.size() > 0) {
1194 // Set header
1195 std::string headerString;
1196 if (ACs.front()->getTagProperty().isNetworkElement()) {
1197 headerString = "Net: ";
1198 } else if (ACs.front()->getTagProperty().isAdditionalElement()) {
1199 headerString = "Additional: ";
1200 } else if (ACs.front()->getTagProperty().isShapeElement()) {
1201 headerString = "Shape: ";
1202 } else if (ACs.front()->getTagProperty().isTAZElement()) {
1203 headerString = "TAZ: ";
1204 } else if (ACs.front()->getTagProperty().isWireElement()) {
1205 headerString = "WIRE: ";
1206 } else if (ACs.front()->getTagProperty().isVehicle()) {
1207 headerString = "Vehicle: ";
1208 } else if (ACs.front()->getTagProperty().isRoute()) {
1209 headerString = "Route: ";
1210 } else if (ACs.front()->getTagProperty().isPerson()) {
1211 headerString = "Person: ";
1212 } else if (ACs.front()->getTagProperty().isPersonPlan()) {
1213 headerString = "PersonPlan: ";
1214 } else if (ACs.front()->getTagProperty().isStop()) {
1215 headerString = "Stop: ";
1216 } else if (ACs.front()->getTagProperty().isDataElement()) {
1217 headerString = "Data: ";
1218 }
1219 if (ACs.size() > 1) {
1220 headerString += toString(ACs.size()) + " ";
1221 }
1222 headerString += ACs.front()->getTagStr();
1223 if (ACs.size() > 1) {
1224 headerString += "s";
1225 }
1226 // Set headerString into header label
1227 getFrameHeaderLabel()->setText(headerString.c_str());
1228
1229 // Show attributes editor
1231
1232 // show netedit attributes editor if we're inspecting elements with Netedit Attributes
1234
1235 // Show GEO Attributes Editor if we're inspecting elements with GEO Attributes
1237
1238 // show parameters editor
1240
1241 // show additional dialog
1243
1244 // If attributes correspond to an Edge and we aren't in demand mode, show template editor
1246
1247 // if we inspect a single Attribute carrier vector, show their children
1248 if (ACs.size() == 1) {
1250 }
1251 } else {
1252 getFrameHeaderLabel()->setText(TL("Inspect"));
1253 }
1254 // update frame width
1256}
1257
1258
1259void
1261 // Show back button if myPreviousElementInspect was defined
1262 myPreviousElementInspect = previousElement;
1263 if (myPreviousElementInspect != nullptr) {
1264 // disable myPreviousElementDelete to avoid inconsistences
1265 myPreviousElementDelete = nullptr;
1267 myHeaderLeftFrame->show();
1268 myBackButton->show();
1269 }
1270}
1271
1272
1273void
1274GNEInspectorFrame::inspectFromDeleteFrame(GNEAttributeCarrier* AC, GNEAttributeCarrier* previousElement, bool previousElementWasMarked) {
1275 myPreviousElementDelete = previousElement;
1276 myPreviousElementDeleteWasMarked = previousElementWasMarked;
1277 // Show back button if myPreviousElementDelete is valid
1278 if (myPreviousElementDelete != nullptr) {
1279 // disable myPreviousElementInspect to avoid inconsistences
1280 myPreviousElementInspect = nullptr;
1282 myHeaderLeftFrame->show();
1283 myBackButton->show();
1284 }
1285}
1286
1287
1288void
1290 // Only remove if there is inspected ACs
1293 // Inspect empty selection (to hide all Editors)
1295 }
1296}
1297
1298
1301 return myAttributesEditor;
1302}
1303
1304
1308}
1309
1310
1313 return myTemplateEditor;
1314}
1315
1316
1320}
1321
1322
1326}
1327
1328
1329long
1330GNEInspectorFrame::onCmdGoBack(FXObject*, FXSelector, void*) {
1331 // Inspect previous element or go back to Delete Frame
1334 myPreviousElementInspect = nullptr;
1335 } else if (myPreviousElementDelete != nullptr) {
1336 myPreviousElementDelete = nullptr;
1337 // Hide inspect frame and show delete frame
1338 hide();
1340 }
1341 return 1;
1342}
1343
1344
1345void
1347 // refresh Attribute Editor
1349 // refresh parametersEditor
1351 // refresh AC Hierarchy
1353}
1354
1355
1356void
1358 // if AC is a lane but selectEdges checkBox is enabled, then inspect their parent edge
1360 inspectSingleElement(dynamic_cast<GNELane*>(AC)->getParentEdge());
1361 } else {
1363 }
1364 // update view (due dotted contour)
1366}
1367
1368
1369void
1371 // get front unlocked AC
1372 const auto AC = objectsUnderCursor.getAttributeCarrierFront();
1373 // check if selection is blocked
1374 if (AC) {
1375 // inspect front element
1377 // show Overlapped Inspection modul
1378 myOverlappedInspection->showOverlappedInspection(objectsUnderCursor, clickedPosition);
1379 }
1380}
1381
1382
1383void
1388}
1389
1390
1391
1392/****************************************************************************/
FXDEFMAP(GNEInspectorFrame) GNEInspectorFrameMap[]
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition: GUIAppEnum.h:870
@ MID_GNE_OPEN_PARAMETERS_DIALOG
open parameters dialog
Definition: GUIAppEnum.h:908
@ MID_HELP
help button
Definition: GUIAppEnum.h:641
@ MID_GNE_INSPECTORFRAME_GOBACK
go back to the previous element
Definition: GUIAppEnum.h:1006
@ MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:460
@ MID_HOTKEY_SHIFT_F2_TEMPLATE_COPY
copy template
Definition: GUIAppEnum.h:222
@ MID_GNE_MARKFRONTELEMENT
mark item as front element
Definition: GUIAppEnum.h:950
@ MID_HOTKEY_SHIFT_F1_TEMPLATE_SET
set template
Definition: GUIAppEnum.h:220
@ MID_HOTKEY_SHIFT_F3_TEMPLATE_CLEAR
clear template
Definition: GUIAppEnum.h:224
#define GUIDesignMFXCheckableButton
checkable button extended over frame
Definition: GUIDesigns.h:135
#define GUIDesignButton
Definition: GUIDesigns.h:77
#define GUIDesignTextField
Definition: GUIDesigns.h:48
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition: GUIDesigns.h:397
#define GUIDesignLabelAttribute
label extended over the matrix column with thick frame
Definition: GUIDesigns.h:241
#define GUIDesignDialogBox
Definition: GUIDesigns.h:584
#define GUIDesignButtonRectangular
little button rectangula used in frames (For example, in "help" buttons)
Definition: GUIDesigns.h:83
#define GUIDesignButtonIconRectangular
button only with icon
Definition: GUIDesigns.h:89
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition: GUIDesigns.h:69
#define GUIDesignButtonOK
Definition: GUIDesigns.h:142
#define GUIDesignLabelCenterThick
label extended over frame with thick and with text justify to center
Definition: GUIDesigns.h:235
#define GUIDesignCheckButton
checkButton placed in left position
Definition: GUIDesigns.h:169
#define GUIDesignHorizontalSeparator
Definition: GUIDesigns.h:452
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition: GUIDesigns.h:271
@ MODEADDITIONAL
@ BIGARROWLEFT
@ FRONTELEMENT
@ VARIABLESPEEDSIGN
#define WRITE_DEBUG(msg)
Definition: MsgHandler.h:276
#define TL(string)
Definition: MsgHandler.h:282
@ SUMO_TAG_REROUTER
A rerouter.
@ GNE_TAG_CALIBRATOR_LANE
A calibrator placed over lane.
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ SUMO_TAG_CALIBRATOR
A calibrator placed over edge.
@ SUMO_TAG_VSS
A variable speed sign.
@ SUMO_TAG_EDGE
begin/end of the description of an edge
@ GNE_ATTR_PARENT
parent of an additional element
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_GEO
@ SUMO_ATTR_GEOSHAPE
@ GNE_ATTR_CLOSE_SHAPE
Close shape of a polygon (Used by GNEPolys)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
void setACParameters(const std::string &parameters, GNEUndoList *undoList)
set parameters (string)
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
GNENet * getNet() const
get pointer to net
virtual std::string getAttribute(SumoXMLAttr key) const =0
Dialog for edit calibrators.
void show()
show delete frame
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
void hideHierarchicalElementTree()
hide GNEElementTree
void refreshHierarchicalElementTree()
refresh GNEElementTree
void showHierarchicalElementTree(GNEAttributeCarrier *AC)
show GNEElementTree
void refreshAttributeEditor(bool forceRefreshShape, bool forceRefreshPosition)
refresh attribute editor (only the valid values will be refresh)
void showAttributeEditorModule(bool includeExtended, bool forceAttributeEnabled)
show attributes of multiple ACs
GNEFrame * getFrameParent() const
pointer to GNEFrame parent
static bool isSupermodeValid(const GNEViewNet *viewNet, const GNEAttributeCarrier *AC)
return true if AC can be edited in the current supermode
void setFrameWidth(const int newWidth)
set width of GNEFrame
Definition: GNEFrame.cpp:133
void focusUpperElement()
focus upper element of frame
Definition: GNEFrame.cpp:109
GNEViewNet * getViewNet() const
get view net
Definition: GNEFrame.cpp:150
FXLabel * getFrameHeaderLabel() const
get the label for the frame's header
Definition: GNEFrame.cpp:162
GNEViewNet * myViewNet
FOX need this.
Definition: GNEFrame.h:117
virtual void show()
show Frame
Definition: GNEFrame.cpp:115
virtual void hide()
hide Frame
Definition: GNEFrame.cpp:124
FXHorizontalFrame * myHeaderLeftFrame
fame for left header elements
Definition: GNEFrame.h:126
FXButton * myOpenAdditionalDialog
button for open additional dialog
long onCmdOpenAdditionalDialog(FXObject *, FXSelector, void *)
void hideAdditionalDialog()
hide netedit attributes editor
AdditionalDialog(GNEInspectorFrame *inspectorFrameParent)
FOX-declaration.
void showAdditionalDialog()
show netedit attributes editor
FXCheckButton * myUseGEOCheckButton
checkBox for use GEO
long onCmdGEOAttributeHelp(FXObject *, FXSelector, void *)
Called when user press the help button.
FXButton * myHelpButton
button for help
void showGEOAttributesEditor()
show GEO attributes editor
FXTextField * myGEOAttributeTextField
textField for GEOAttribute
FXLabel * myUseGEOLabel
Label for use GEO.
FXHorizontalFrame * myUseGEOFrame
horizontal frame for use GEO
GEOAttributesEditor(GNEInspectorFrame *inspectorFrameParent)
FOX-declaration.
long onCmdSetGEOAttribute(FXObject *, FXSelector, void *)
Called when user change the current GEO Attribute.
FXLabel * myGEOAttributeLabel
Label for GEOAttribute.
void refreshGEOAttributesEditor(bool forceRefresh)
refresh GEO attributes editor
void hideGEOAttributesEditor()
hide GEO attributes editor
FXHorizontalFrame * myGEOAttributeFrame
horizontal frame for GEOAttribute
bool isSelectingParent() const
check if we're selecting a new parent
long onCmdNeteditAttributeHelp(FXObject *, FXSelector, void *)
Called when user press the help button.
long onCmdSetNeteditAttribute(FXObject *, FXSelector, void *)
long onCmdMarkFrontElement(FXObject *, FXSelector, void *)
Called when user press button "Mark front element".
void refreshNeteditAttributesEditor(bool forceRefresh)
refresh netedit attributes
void setNewParent(GNEAttributeCarrier *clickedAC)
set new parent
void hideNeteditAttributesEditor()
hide netedit attributes editor
void stopSelectParent()
stop select new parent
void showNeteditAttributesEditor()
show netedit attributes editor
FXButton * myButtonEditParameters
button for edit parameters using specific dialog
long onCmdEditParameters(FXObject *, FXSelector, void *)
void showParametersEditor()
show netedit attributes EditorInspector
long onCmdSetParameters(FXObject *, FXSelector, void *)
Called when user udpate the parameter text field.
FXTextField * myTextFieldParameters
text field for write parameters
GNEInspectorFrame * getInspectorFrameParent() const
get inspector frame parent
void refreshParametersEditor()
refresh netedit attributes
ParametersEditor(GNEInspectorFrame *inspectorFrameParent)
FOX-declaration.
void hideParametersEditor()
hide netedit attributes EditorInspector
void hideTemplateEditor()
hide template editor
void clearTemplate()
clear template (used by shortcut)
void setEdgeTemplate(const GNEEdge *edge)
set edge template
FXButton * myClearTemplateButton
clear template button
FXButton * mySetTemplateButton
set template button
long onCmdCopyTemplate(FXObject *, FXSelector, void *)
copy edge attributes from edge template
void setTemplate()
set template (used by shortcut)
TemplateEditor(GNEInspectorFrame *inspectorFrameParent)
FOX-declaration.
FXButton * myCopyTemplateButton
copy template button
long onCmdSetTemplate(FXObject *, FXSelector, void *)
GNEEdgeTemplate * getEdgeTemplate() const
get edge template (to copy attributes from)
void copyTemplate()
copy template (used by shortcut)
void updateEdgeTemplate()
update edge template
void showTemplateEditor()
show template editor
long onCmdClearTemplate(FXObject *, FXSelector, void *)
clear current edge template
NeteditAttributesEditor * myNeteditAttributesEditor
Netedit Attributes editor.
GNEAttributeCarrier * myPreviousElementDelete
pointer to previous element called by Delete Frame
GNEFrameAttributeModules::AttributesEditor * getAttributesEditor() const
get AttributesEditor
void inspectChild(GNEAttributeCarrier *AC, GNEAttributeCarrier *previousElement)
inspect child of already inspected element
void inspectSingleElement(GNEAttributeCarrier *AC)
Inspect a single element.
GNEFrameAttributeModules::AttributesEditor * myAttributesEditor
Attribute editor.
void selectedOverlappedElement(GNEAttributeCarrier *AC)
open GNEAttributesCreator extended dialog (can be reimplemented in frame children)
TemplateEditor * getTemplateEditor() const
get template editor
GNEInspectorFrame(GNEViewParent *viewParent, GNEViewNet *viewNet)
Constructor.
GNEElementTree * getHierarchicalElementTree() const
get GNEElementTree modul
void clearInspectedAC()
Clear all current inspected ACs.
long onCmdGoBack(FXObject *, FXSelector, void *)
called when user toggle the go back button
bool processDataSupermodeClick(const Position &clickedPosition, GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
process click over Viewnet in Supermode Data
void show()
show inspector frame
GEOAttributesEditor * myGEOAttributesEditor
GEO Attributes editor.
ParametersEditor * myParametersEditor
Parameters editor inspector.
GNEAttributeCarrier * myPreviousElementInspect
Pointer to previous element called by Inspector Frame.
void attributeUpdated()
function called after set a valid attribute in AttributeEditor
bool myPreviousElementDeleteWasMarked
flag to ckec if myPreviousElementDelete was marked in Delete Frame
void inspectClickedElement(const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor, const Position &clickedPosition)
FOX need this.
GNEOverlappedInspection * myOverlappedInspection
Overlapped Inspection.
GNEOverlappedInspection * getOverlappedInspection() const
get GNEOverlappedInspection modul
AdditionalDialog * myAdditionalDialog
Additional dialog.
void hide()
hide inspector frame
void inspectFromDeleteFrame(GNEAttributeCarrier *AC, GNEAttributeCarrier *previousElement, bool previousElementWasMarked)
inspect called from DeleteFrame
GNEInspectorFrame::NeteditAttributesEditor * getNeteditAttributesEditor() const
get Netedit Attributes editor
FXButton * myBackButton
Back Button.
GNEElementTree * myHierarchicalElementTree
Attribute Carrier Hierarchy.
bool processNetworkSupermodeClick(const Position &clickedPosition, GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
process click over Viewnet in Supermode Network
void inspectMultisection(const std::vector< GNEAttributeCarrier * > &ACs)
Inspect the given multi-selection.
~GNEInspectorFrame()
Destructor.
TemplateEditor * myTemplateEditor
Template editor.
bool processDemandSupermodeClick(const Position &clickedPosition, GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
process click over Viewnet in Supermode Demand
void updateFrameAfterUndoRedo()
function called after undo/redo in the current frame (can be reimplemented in frame children)
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
std::vector< GNEAttributeCarrier * > getSelectedAttributeCarriers(const bool ignoreCurrentSupermode)
get all selected attribute carriers (or only relative to current supermode
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition: GNENet.cpp:132
void hideOverlappedInspection()
hide template editor
bool nextElement(const Position &clickedPosition)
try to go to next element if clicked position is near to saved position
bool previousElement(const Position &clickedPosition)
try to go to previous element if clicked position is near to saved position
void showOverlappedInspection(const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor, const Position &clickedPosition)
show template editor
Dialog for edit rerouters.
Dialog for edit parameters.
GUIIcon getGUIIcon() const
get GUI icon associated to this Tag
bool hasParameters() const
return true if Tag correspond to an element that supports parameters "key1=value1|key2=value2|....
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
class used to group all variables related with objects under cursor after a click over view
GNEAttributeCarrier * getAttributeCarrierFront() const
get front attribute carrier or a pointer to nullptr
GNENet * getNet() const
get the net object
const GNEViewNetHelper::MouseButtonKeyPressed & getMouseButtonKeyPressed() const
get Key Pressed module
Definition: GNEViewNet.cpp:662
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
Definition: GNEViewNet.cpp:644
GNEViewParent * getViewParent() const
get the net object
const std::vector< GNEAttributeCarrier * > & getInspectedAttributeCarriers() const
get inspected attribute carriers
void updateViewNet() const
Mark the entire GNEViewNet to be repainted later.
Definition: GNEViewNet.cpp:414
void setInspectedAttributeCarriers(const std::vector< GNEAttributeCarrier * > ACs)
set inspected attributeCarrier
A single child window which contains a view of the simulation area.
Definition: GNEViewParent.h:84
GNEDeleteFrame * getDeleteFrame() const
get frame for delete elements
int getFrameAreaWidth() const
get frame area width
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
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.
Definition: Position.h:37
bool shiftKeyPressed() const
check if SHIFT is pressed during current event
bool controlKeyPressed() const
check if CONTROL is pressed during current event
bool selectEdges() const
check if select edges checkbox is enabled