Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEElementTree.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 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/****************************************************************************/
18// Frame for show hierarchical elements
19/****************************************************************************/
20#include <config.h>
21
23#include <netedit/GNENet.h>
24#include <netedit/GNEUndoList.h>
25#include <netedit/GNEViewNet.h>
35
36#include "GNEElementTree.h"
37
38
39// ===========================================================================
40// FOX callback mapping
41// ===========================================================================
42
43FXDEFMAP(GNEElementTree) HierarchicalElementTreeMap[] = {
44 FXMAPFUNC(SEL_COMMAND, MID_GNE_CENTER, GNEElementTree::onCmdCenterItem),
46 FXMAPFUNC(SEL_COMMAND, MID_GNE_DELETE, GNEElementTree::onCmdDeleteItem),
50};
51
52
53// Object implementation
54FXIMPLEMENT(GNEElementTree, MFXGroupBoxModule, HierarchicalElementTreeMap, ARRAYNUMBER(HierarchicalElementTreeMap))
55
56
57// ===========================================================================
58// method definitions
59// ===========================================================================
60
62 MFXGroupBoxModule(frameParent, TL("Hierarchy")),
63 myFrameParent(frameParent),
64 myHE(nullptr),
65 myClickedAC(nullptr),
66 myClickedJunction(nullptr),
67 myClickedEdge(nullptr),
68 myClickedLane(nullptr),
69 myClickedCrossing(nullptr),
70 myClickedConnection(nullptr),
71 myClickedAdditional(nullptr),
72 myClickedDemandElement(nullptr),
73 myClickedDataSet(nullptr),
74 myClickedDataInterval(nullptr),
75 myClickedGenericData(nullptr) {
76 // Create tree list with fixed height
77 myTreeListDynamic = new MFXTreeListDynamic(getCollapsableFrame(), this, MID_GNE_ACHIERARCHY_SHOWCHILDMENU, GUIDesignTreeListFixedHeight);
78 hide();
79}
80
81
83
84
85void
87 myHE = dynamic_cast<GNEHierarchicalElement*>(AC);
88 // show GNEElementTree and refresh GNEElementTree
89 if (myHE) {
90 // refresh GNEElementTree
92 // show myTreeListDynamic
94 // show module
95 show();
96 }
97}
98
99
100void
102 // set all pointers null
103 myHE = nullptr;
104 myClickedAC = nullptr;
105 myClickedJunction = nullptr;
106 myClickedEdge = nullptr;
107 myClickedLane = nullptr;
108 myClickedCrossing = nullptr;
109 myClickedConnection = nullptr;
110 myClickedAdditional = nullptr;
111 myClickedDemandElement = nullptr;
112 myClickedDataSet = nullptr;
113 myClickedDataInterval = nullptr;
114 myClickedGenericData = nullptr;
115 // hide myTreeListDynamic
117 // hide module
118 hide();
119}
120
121
122void
124 // clear items
126 myTreeItemToACMap.clear();
128 // show children of myHE
129 if (myHE) {
131 }
132}
133
134
135void
137 // simply check if AC is the same of myHE
138 if (AC == myHE) {
139 myHE = nullptr;
140 }
141}
142
143
144long
145GNEElementTree::onCmdShowChildMenu(FXObject*, FXSelector, void* eventData) {
146 // obtain event
147 FXEvent* e = (FXEvent*)eventData;
148 // obtain FXTreeItem in the given position
149 FXTreeItem* item = myTreeListDynamic->getItemAt(e->win_x, e->win_y);
150 // open Pop-up if FXTreeItem has a Attribute Carrier vinculated
151 if (item && (myTreeItemsConnections.find(item) == myTreeItemsConnections.end())) {
152 createPopUpMenu(e->root_x, e->root_y, myTreeItemToACMap[item]);
153 }
154 return 1;
155}
156
157
158long
159GNEElementTree::onCmdCenterItem(FXObject*, FXSelector, void*) {
160 // Center item
161 if (myClickedJunction) {
163 } else if (myClickedEdge) {
165 } else if (myClickedLane) {
167 } else if (myClickedCrossing) {
169 } else if (myClickedConnection) {
171 } else if (myClickedAdditional) {
173 } else if (myClickedDemandElement) {
175 } else if (myClickedGenericData) {
177 }
178 // update view after centering
180 return 1;
181}
182
183
184long
189
190
191long
192GNEElementTree::onCmdDeleteItem(FXObject*, FXSelector, void*) {
193 const auto& inspectedElements = myFrameParent->getViewNet()->getInspectedElements();
194 // Remove Attribute Carrier
195 if (myClickedJunction) {
197 } else if (myClickedEdge) {
199 } else if (myClickedLane) {
201 } else if (myClickedCrossing) {
203 } else if (myClickedConnection) {
205 } else if (myClickedAdditional) {
207 } else if (myClickedDemandElement) {
208 // check that default VTypes aren't removed
210 WRITE_WARNINGF(TL("Default Vehicle Type '%' cannot be removed"), myClickedDemandElement->getAttribute(SUMO_ATTR_ID));
211 return 1;
213 // we need to check if we're removing the last person plan of a person.
214 auto planParent = myClickedDemandElement->getParentDemandElements().front();
215 if (planParent->getChildDemandElements().size() == 1) {
217 } else {
219 }
220 }
221 } else if (myClickedDataSet) {
223 } else if (myClickedDataInterval) {
224 // check if we have to remove data Set
227 } else {
229 }
230 } else if (myClickedGenericData) {
231 // check if we have to remove interval
233 // check if we have to remove data Set
236 } else {
238 }
239 } else {
241 }
242 }
243 // refresh AC Hierarchy
245 // check if inspector frame has to be shown again
246 if (inspectedElements.isInspectingSingleElement()) {
247 if (inspectedElements.getFirstAC() != myClickedAC) {
248 myFrameParent->getViewNet()->getViewParent()->getInspectorFrame()->inspectElement(inspectedElements.getFirstAC());
249 } else {
250 // inspect a nullptr element to reset inspector frame
252 }
253 }
254 return 1;
255}
256
257
258long
259GNEElementTree::onCmdMoveItemUp(FXObject*, FXSelector, void*) {
260 // currently only children of demand elements can be moved
263 // move element one position back
267 }
268 // refresh after moving child
270 return 1;
271}
272
273
274long
275GNEElementTree::onCmdMoveItemDown(FXObject*, FXSelector, void*) {
276 // currently only children of demand elements can be moved
279 // move element one position front
283 }
284 // refresh after moving child
286 return 1;
287}
288
289
290void
292 // get attributeCarriers
293 const auto& attributeCarriers = myFrameParent->getViewNet()->getNet()->getAttributeCarriers();
294 // first check that AC exist
295 if (clickedAC) {
296 // set current clicked AC
297 myClickedAC = clickedAC;
298 // cast all elements
299 myClickedJunction = attributeCarriers->retrieveJunction(clickedAC->getID(), false);
300 myClickedEdge = attributeCarriers->retrieveEdge(clickedAC->getID(), false);
301 myClickedLane = attributeCarriers->retrieveLane(clickedAC->getGUIGlObject(), false);
302 myClickedCrossing = attributeCarriers->retrieveCrossing(clickedAC->getGUIGlObject(), false);
303 myClickedConnection = attributeCarriers->retrieveConnection(clickedAC->getGUIGlObject(), false);
304 myClickedAdditional = attributeCarriers->retrieveAdditional(clickedAC->getGUIGlObject(), false);
305 myClickedDemandElement = attributeCarriers->retrieveDemandElement(clickedAC->getGUIGlObject(), false);
306 myClickedDataSet = attributeCarriers->retrieveDataSet(clickedAC->getID(), false);
307 myClickedDataInterval = attributeCarriers->retrieveDataInterval(clickedAC, false);
308 myClickedGenericData = attributeCarriers->retrieveGenericData(clickedAC->getGUIGlObject(), false);
309 // create FXMenuPane
310 FXMenuPane* pane = new FXMenuPane(myTreeListDynamic->getFXWindow());
311 // set item name and icon
313 // insert separator
314 new FXMenuSeparator(pane);
315 // create center menu command
316 FXMenuCommand* centerMenuCommand = GUIDesigns::buildFXMenuCommand(pane, TL("Center"), GUIIconSubSys::getIcon(GUIIcon::RECENTERVIEW), this, MID_GNE_CENTER);
317 // disable Centering for Vehicle Types, data sets and data intervals
320 centerMenuCommand->disable();
321 }
322 // create inspect and delete menu commands
323 FXMenuCommand* inspectMenuCommand = GUIDesigns::buildFXMenuCommand(pane, TL("Inspect"), GUIIconSubSys::getIcon(GUIIcon::MODEINSPECT), this, MID_GNE_INSPECT);
324 FXMenuCommand* deleteMenuCommand = GUIDesigns::buildFXMenuCommand(pane, TL("Delete"), GUIIconSubSys::getIcon(GUIIcon::MODEDELETE), this, MID_GNE_DELETE);
325 // check if inspect and delete menu commands has to be disabled
327 inspectMenuCommand->disable();
328 deleteMenuCommand->disable();
329 }
330 // now check if given AC support manually moving of their item up and down (Currently only for certain demand elements)
331 /* if (myClickedDemandElement && myClickedAC->getTagProperty().canBeSortedManually()) {
332 // insert separator
333 new FXMenuSeparator(pane);
334 // create both moving menu commands
335 FXMenuCommand* moveUpMenuCommand = GUIDesigns::buildFXMenuCommand(pane, "Move up", GUIIconSubSys::getIcon(GUIIcon::ARROW_UP), this, MID_GNE_ACHIERARCHY_MOVEUP);
336 FXMenuCommand* moveDownMenuCommand = GUIDesigns::buildFXMenuCommand(pane, "Move down", GUIIconSubSys::getIcon(GUIIcon::ARROW_DOWN), this, MID_GNE_ACHIERARCHY_MOVEDOWN);
337 // check if both commands has to be disabled
338 if (myClickedDemandElement->getTagProperty().isPlanStopPerson()) {
339 moveUpMenuCommand->setText(TL("Move up (Stops cannot be moved)"));
340 moveDownMenuCommand->setText(TL("Move down (Stops cannot be moved)"));
341 moveUpMenuCommand->disable();
342 moveDownMenuCommand->disable();
343 } else {
344 // check if moveUpMenuCommand has to be disabled
345 if (myClickedDemandElement->getParentDemandElements().front()->getChildDemandElements().front() == myClickedDemandElement) {
346 moveUpMenuCommand->setText(TL("Move up (It's already the first element)"));
347 moveUpMenuCommand->disable();
348 } else if (myClickedDemandElement->getParentDemandElements().front()->getPreviousChildDemandElement(myClickedDemandElement)->getTagProperty().isPlanStopPerson()) {
349 moveUpMenuCommand->setText(TL("Move up (Previous element is a Stop)"));
350 moveUpMenuCommand->disable();
351 }
352 // check if moveDownMenuCommand has to be disabled
353 if (myClickedDemandElement->getParentDemandElements().front()->getChildDemandElements().back() == myClickedDemandElement) {
354 moveDownMenuCommand->setText(TL("Move down (It's already the last element)"));
355 moveDownMenuCommand->disable();
356 } else if (myClickedDemandElement->getParentDemandElements().front()->getNextChildDemandElement(myClickedDemandElement)->getTagProperty().isPlanStopPerson()) {
357 moveDownMenuCommand->setText(TL("Move down (Next element is a Stop)"));
358 moveDownMenuCommand->disable();
359 }
360 }
361 } */
362 // Center in the mouse position and create pane
363 pane->setX(X);
364 pane->setY(Y);
365 pane->create();
366 pane->show();
367 } else {
368 // set all clicked elements to null
369 myClickedAC = nullptr;
370 myClickedJunction = nullptr;
371 myClickedEdge = nullptr;
372 myClickedLane = nullptr;
373 myClickedCrossing = nullptr;
374 myClickedConnection = nullptr;
375 myClickedAdditional = nullptr;
376 myClickedDemandElement = nullptr;
377 myClickedDataSet = nullptr;
378 myClickedDataInterval = nullptr;
379 myClickedGenericData = nullptr;
380 }
381}
382
383
384FXTreeItem*
386 // get attributeCarriers
387 const auto& attributeCarriers = myFrameParent->getViewNet()->getNet()->getAttributeCarriers();
388 // check tags
390 // check demand element type
391 switch (myHE->getTagProperty().getTag()) {
392 case SUMO_TAG_EDGE: {
393 // obtain Edge
394 GNEEdge* edge = attributeCarriers->retrieveEdge(myHE->getID(), false);
395 if (edge) {
396 // insert Junctions of edge in tree (Parallel because an edge has always two Junctions)
397 FXTreeItem* junctionSourceItem = myTreeListDynamic->appendItem(nullptr, (edge->getFromJunction()->getHierarchyName() + TL(" origin")).c_str(), edge->getFromJunction()->getACIcon());
398 FXTreeItem* junctionDestinationItem = myTreeListDynamic->appendItem(nullptr, (edge->getFromJunction()->getHierarchyName() + TL(" destination")).c_str(), edge->getFromJunction()->getACIcon());
399 junctionDestinationItem->setExpanded(true);
400 // Save items in myTreeItemToACMap
401 myTreeItemToACMap[junctionSourceItem] = edge->getFromJunction();
402 myTreeItemToACMap[junctionDestinationItem] = edge->getToJunction();
403 // return junction destination Item
404 return junctionDestinationItem;
405 } else {
406 return nullptr;
407 }
408 }
409 case SUMO_TAG_LANE: {
410 // obtain lane
411 GNELane* lane = attributeCarriers->retrieveLane(myHE->getID(), false);
412 if (lane) {
413 // obtain parent edge
414 GNEEdge* edge = attributeCarriers->retrieveEdge(lane->getParentEdge()->getID());
415 //insert Junctions of lane of edge in tree (Parallel because an edge has always two Junctions)
416 FXTreeItem* junctionSourceItem = myTreeListDynamic->appendItem(nullptr, (edge->getFromJunction()->getHierarchyName() + TL(" origin")).c_str(), edge->getFromJunction()->getACIcon());
417 FXTreeItem* junctionDestinationItem = myTreeListDynamic->appendItem(nullptr, (edge->getFromJunction()->getHierarchyName() + TL(" destination")).c_str(), edge->getFromJunction()->getACIcon());
418 junctionDestinationItem->setExpanded(true);
419 // Create edge item
420 FXTreeItem* edgeItem = myTreeListDynamic->appendItem(junctionDestinationItem, edge->getHierarchyName().c_str(), edge->getACIcon());
421 edgeItem->setExpanded(true);
422 // Save items in myTreeItemToACMap
423 myTreeItemToACMap[junctionSourceItem] = edge->getFromJunction();
424 myTreeItemToACMap[junctionDestinationItem] = edge->getToJunction();
425 myTreeItemToACMap[edgeItem] = edge;
426 // return edge item
427 return edgeItem;
428 } else {
429 return nullptr;
430 }
431 }
432 case SUMO_TAG_CROSSING: {
433 // obtain crossing parent junction
434 GNEJunction* junction = attributeCarriers->retrieveCrossing(myHE->getGUIGlObject())->getParentJunction();
435 // create junction item
436 FXTreeItem* junctionItem = myTreeListDynamic->appendItem(nullptr, junction->getHierarchyName().c_str(), junction->getACIcon());
437 junctionItem->setExpanded(true);
438 // Save items in myTreeItemToACMap
439 myTreeItemToACMap[junctionItem] = junction;
440 // return junction Item
441 return junctionItem;
442 }
443 case SUMO_TAG_CONNECTION: {
444 // obtain Connection
445 GNEConnection* connection = attributeCarriers->retrieveConnection(myHE->getID(), false);
446 if (connection) {
447 // create edge from item
448 FXTreeItem* edgeFromItem = myTreeListDynamic->appendItem(nullptr, connection->getEdgeFrom()->getHierarchyName().c_str(), connection->getEdgeFrom()->getACIcon());
449 edgeFromItem->setExpanded(true);
450 // create edge to item
451 FXTreeItem* edgeToItem = myTreeListDynamic->appendItem(nullptr, connection->getEdgeTo()->getHierarchyName().c_str(), connection->getEdgeTo()->getACIcon());
452 edgeToItem->setExpanded(true);
453 // create connection item
454 FXTreeItem* connectionItem = myTreeListDynamic->appendItem(edgeToItem, connection->getHierarchyName().c_str(), connection->getACIcon());
455 connectionItem->setExpanded(true);
456 // Save items in myTreeItemToACMap
457 myTreeItemToACMap[edgeFromItem] = connection->getEdgeFrom();
458 myTreeItemToACMap[edgeToItem] = connection->getEdgeTo();
459 myTreeItemToACMap[connectionItem] = connection;
460 // return connection item
461 return connectionItem;
462 } else {
463 return nullptr;
464 }
465 }
466 default:
467 break;
468 }
469 } else if (myHE->getTagProperty().getTag() == GNE_TAG_POILANE) {
470 // Obtain POILane
472 // obtain parent lane
473 GNELane* lane = attributeCarriers->retrieveLane(POILane->getParentLanes().at(0)->getID());
474 // obtain parent edge
475 GNEEdge* edge = attributeCarriers->retrieveEdge(lane->getParentEdge()->getID());
476 //insert Junctions of lane of edge in tree (Parallel because an edge has always two Junctions)
477 FXTreeItem* junctionSourceItem = myTreeListDynamic->appendItem(nullptr, (edge->getFromJunction()->getHierarchyName() + TL(" origin")).c_str(), edge->getFromJunction()->getACIcon());
478 FXTreeItem* junctionDestinationItem = myTreeListDynamic->appendItem(nullptr, (edge->getFromJunction()->getHierarchyName() + TL(" destination")).c_str(), edge->getFromJunction()->getACIcon());
479 junctionDestinationItem->setExpanded(true);
480 // Create edge item
481 FXTreeItem* edgeItem = myTreeListDynamic->appendItem(junctionDestinationItem, edge->getHierarchyName().c_str(), edge->getACIcon());
482 edgeItem->setExpanded(true);
483 // Create lane item
484 FXTreeItem* laneItem = myTreeListDynamic->appendItem(edgeItem, lane->getHierarchyName().c_str(), lane->getACIcon());
485 laneItem->setExpanded(true);
486 // Save items in myTreeItemToACMap
487 myTreeItemToACMap[junctionSourceItem] = edge->getFromJunction();
488 myTreeItemToACMap[junctionDestinationItem] = edge->getToJunction();
489 myTreeItemToACMap[edgeItem] = edge;
490 myTreeItemToACMap[laneItem] = lane;
491 // return Lane item
492 return laneItem;
493 } else if (myHE->getTagProperty().isAdditionalElement()) {
494 // Obtain Additional
495 const GNEAdditional* additional = attributeCarriers->retrieveAdditional(myHE->getGUIGlObject());
496 // declare auxiliary FXTreeItem, due a demand element can have multiple "roots"
497 FXTreeItem* root = nullptr;
498 // check if there is demand elements parents
499 if (additional->getParentAdditionals().size() > 0) {
500 // check if we have more than one edge
501 if (additional->getParentAdditionals().size() > 1) {
502 // insert first item
503 addListItem(additional->getParentAdditionals().front());
504 // insert "spacer"
505 if (additional->getParentAdditionals().size() > 2) {
506 addListItem(nullptr, ("..." + toString((int)additional->getParentAdditionals().size() - 2) + TL(" additionals...")).c_str(), 0, false);
507 }
508 }
509 // return last inserted item
510 root = addListItem(additional->getParentAdditionals().back());
511 }
512 // check if there is parent demand elements
513 if (additional->getParentDemandElements().size() > 0) {
514 // check if we have more than one demand element
515 if (additional->getParentDemandElements().size() > 1) {
516 // insert first item
517 addListItem(additional->getParentDemandElements().front());
518 // insert "spacer"
519 if (additional->getParentDemandElements().size() > 2) {
520 addListItem(nullptr, ("..." + toString((int)additional->getParentDemandElements().size() - 2) + TL(" demand elements...")).c_str(), 0, false);
521 }
522 }
523 // return last inserted item
524 root = addListItem(additional->getParentDemandElements().back());
525 }
526 // check if there is parent edges
527 if (additional->getParentEdges().size() > 0) {
528 // check if we have more than one edge
529 if (additional->getParentEdges().size() > 1) {
530 // insert first item
531 addListItem(additional->getParentEdges().front());
532 // insert "spacer"
533 if (additional->getParentEdges().size() > 2) {
534 addListItem(nullptr, ("..." + toString((int)additional->getParentEdges().size() - 2) + TL(" edges...")).c_str(), 0, false);
535 }
536 }
537 // return last inserted item
538 root = addListItem(additional->getParentEdges().back());
539 }
540 // check if there is parent lanes
541 if (additional->getParentLanes().size() > 0) {
542 // check if we have more than one parent lane
543 if (additional->getParentLanes().size() > 1) {
544 // insert first item
545 addListItem(additional->getParentLanes().front());
546 // insert "spacer"
547 if (additional->getParentLanes().size() > 2) {
548 addListItem(nullptr, ("..." + toString((int)additional->getParentLanes().size() - 2) + TL(" lanes...")).c_str(), 0, false);
549 }
550 }
551 // return last inserted item
552 root = addListItem(additional->getParentLanes().back());
553 }
554 // return last inserted list item
555 return root;
556 } else if (myHE->getTagProperty().isTAZElement()) {
557 // Obtain TAZElement
559 // declare auxiliary FXTreeItem, due a demand element can have multiple "roots"
560 FXTreeItem* root = nullptr;
561 // check if there is demand elements parents
562 if (TAZElement->getParentAdditionals().size() > 0) {
563 // check if we have more than one edge
564 if (TAZElement->getParentAdditionals().size() > 1) {
565 // insert first item
566 addListItem(TAZElement->getParentAdditionals().front());
567 // insert "spacer"
568 if (TAZElement->getParentAdditionals().size() > 2) {
569 addListItem(nullptr, ("..." + toString((int)TAZElement->getParentAdditionals().size() - 2) + TL(" TAZElements...")).c_str(), 0, false);
570 }
571 }
572 // return last inserted item
573 root = addListItem(TAZElement->getParentAdditionals().back());
574 }
575 // check if there is parent demand elements
576 if (TAZElement->getParentDemandElements().size() > 0) {
577 // check if we have more than one demand element
578 if (TAZElement->getParentDemandElements().size() > 1) {
579 // insert first item
580 addListItem(TAZElement->getParentDemandElements().front());
581 // insert "spacer"
582 if (TAZElement->getParentDemandElements().size() > 2) {
583 addListItem(nullptr, ("..." + toString((int)TAZElement->getParentDemandElements().size() - 2) + TL(" demand elements...")).c_str(), 0, false);
584 }
585 }
586 // return last inserted item
587 root = addListItem(TAZElement->getParentDemandElements().back());
588 }
589 // check if there is parent edges
590 if (TAZElement->getParentEdges().size() > 0) {
591 // check if we have more than one edge
592 if (TAZElement->getParentEdges().size() > 1) {
593 // insert first item
594 addListItem(TAZElement->getParentEdges().front());
595 // insert "spacer"
596 if (TAZElement->getParentEdges().size() > 2) {
597 addListItem(nullptr, ("..." + toString((int)TAZElement->getParentEdges().size() - 2) + TL(" edges...")).c_str(), 0, false);
598 }
599 }
600 // return last inserted item
601 root = addListItem(TAZElement->getParentEdges().back());
602 }
603 // check if there is parent lanes
604 if (TAZElement->getParentLanes().size() > 0) {
605 // check if we have more than one parent lane
606 if (TAZElement->getParentLanes().size() > 1) {
607 // insert first item
608 addListItem(TAZElement->getParentLanes().front());
609 // insert "spacer"
610 if (TAZElement->getParentLanes().size() > 2) {
611 addListItem(nullptr, ("..." + toString((int)TAZElement->getParentLanes().size() - 2) + TL(" lanes...")).c_str(), 0, false);
612 }
613 }
614 // return last inserted item
615 root = addListItem(TAZElement->getParentLanes().back());
616 }
617 // return last inserted list item
618 return root;
619 } else if (myHE->getTagProperty().isDemandElement()) {
620 // Obtain DemandElement
622 // declare auxiliar FXTreeItem, due a demand element can have multiple "roots"
623 FXTreeItem* root = nullptr;
624 // check if there are demand element parents
625 if (demandElement->getParentAdditionals().size() > 0) {
626 // check if we have more than one edge
627 if (demandElement->getParentAdditionals().size() > 1) {
628 // insert first item
629 addListItem(demandElement->getParentAdditionals().front());
630 // insert "spacer"
631 if (demandElement->getParentAdditionals().size() > 2) {
632 addListItem(nullptr, ("..." + toString((int)demandElement->getParentAdditionals().size() - 2) + TL(" additionals...")).c_str(), 0, false);
633 }
634 }
635 // return last inserted item
636 root = addListItem(demandElement->getParentAdditionals().back());
637 }
638 // check if there is parent demand elements
639 if (demandElement->getParentDemandElements().size() > 0) {
640 // check if we have more than one demand element
641 if (demandElement->getParentDemandElements().size() > 1) {
642 // insert first item
643 addListItem(demandElement->getParentDemandElements().front());
644 // insert "spacer"
645 if (demandElement->getParentDemandElements().size() > 2) {
646 addListItem(nullptr, ("..." + toString((int)demandElement->getParentDemandElements().size() - 2) + TL(" demand elements...")).c_str(), 0, false);
647 }
648 }
649 // return last inserted item
650 root = addListItem(demandElement->getParentDemandElements().back());
651 }
652 // check if there is parent edges
653 if (demandElement->getParentEdges().size() > 0) {
654 // check if we have more than one edge
655 if (demandElement->getParentEdges().size() > 1) {
656 // insert first item
657 addListItem(demandElement->getParentEdges().front());
658 // insert "spacer"
659 if (demandElement->getParentEdges().size() > 2) {
660 addListItem(nullptr, ("..." + toString((int)demandElement->getParentEdges().size() - 2) + TL(" edges...")).c_str(), 0, false);
661 }
662 }
663 // return last inserted item
664 root = addListItem(demandElement->getParentEdges().back());
665 }
666 // check if there is parent lanes
667 if (demandElement->getParentLanes().size() > 0) {
668 // check if we have more than one parent lane
669 if (demandElement->getParentLanes().size() > 1) {
670 // insert first item
671 addListItem(demandElement->getParentLanes().front());
672 // insert "spacer"
673 if (demandElement->getParentLanes().size() > 2) {
674 addListItem(nullptr, ("..." + toString((int)demandElement->getParentLanes().size() - 2) + TL(" lanes...")).c_str(), 0, false);
675 }
676 }
677 // return last inserted item
678 root = addListItem(demandElement->getParentLanes().back());
679 }
680 // return last inserted list item
681 return root;
682 } else if (myHE->getTagProperty().isDataElement()) {
683 // check if is a GNEDataInterval or a GNEGenericData
685 return nullptr;
686 } else if (myHE->getTagProperty().getTag() == SUMO_TAG_DATAINTERVAL) {
688 } else {
689 // Obtain DataElement
690 GNEGenericData* dataElement = dynamic_cast<GNEGenericData*>(myHE);
691 if (dataElement) {
692 // declare auxiliary FXTreeItem, due a data element can have multiple "roots"
693 FXTreeItem* root = nullptr;
694 // set dataset
696 // set data interval
697 addListItem(dataElement->getDataIntervalParent());
698 // check if there is data elements parents
699 if (dataElement->getParentAdditionals().size() > 0) {
700 // check if we have more than one edge
701 if (dataElement->getParentAdditionals().size() > 1) {
702 // insert first item
703 addListItem(dataElement->getParentAdditionals().front());
704 // insert "spacer"
705 if (dataElement->getParentAdditionals().size() > 2) {
706 addListItem(nullptr, ("..." + toString((int)dataElement->getParentAdditionals().size() - 2) + TL(" additionals...")).c_str(), 0, false);
707 }
708 }
709 // return last inserted item
710 root = addListItem(dataElement->getParentAdditionals().back());
711 }
712 // check if there is parent demand elements
713 if (dataElement->getParentDemandElements().size() > 0) {
714 // check if we have more than one demand element
715 if (dataElement->getParentDemandElements().size() > 1) {
716 // insert first item
717 addListItem(dataElement->getParentDemandElements().front());
718 // insert "spacer"
719 if (dataElement->getParentDemandElements().size() > 2) {
720 addListItem(nullptr, ("..." + toString((int)dataElement->getParentDemandElements().size() - 2) + TL(" demand elements...")).c_str(), 0, false);
721 }
722 }
723 // return last inserted item
724 root = addListItem(dataElement->getParentDemandElements().back());
725 }
726 // check if there is parent edges
727 if (dataElement->getParentEdges().size() > 0) {
728 // check if we have more than one edge
729 if (dataElement->getParentEdges().size() > 1) {
730 // insert first ege
731 if (dataElement->getTagProperty().getTag() == SUMO_TAG_EDGEREL) {
732 addListItem(dataElement->getParentEdges().front(), nullptr, "from ");
733 } else {
734 addListItem(dataElement->getParentEdges().front());
735 }
736 // insert "spacer"
737 if (dataElement->getParentEdges().size() > 2) {
738 addListItem(nullptr, ("..." + toString((int)dataElement->getParentEdges().size() - 2) + TL(" edges...")).c_str(), 0, false);
739 }
740 }
741 // insert last ege
742 if (dataElement->getTagProperty().getTag() == SUMO_TAG_EDGEREL) {
743 addListItem(dataElement->getParentEdges().back(), nullptr, "to ");
744 } else {
745 addListItem(dataElement->getParentEdges().back());
746 }
747 }
748 // check if there is parent lanes
749 if (dataElement->getParentLanes().size() > 0) {
750 // check if we have more than one parent lane
751 if (dataElement->getParentLanes().size() > 1) {
752 // insert first item
753 addListItem(dataElement->getParentLanes().front());
754 // insert "spacer"
755 if (dataElement->getParentLanes().size() > 2) {
756 addListItem(nullptr, ("..." + toString((int)dataElement->getParentLanes().size() - 2) + TL(" lanes...")).c_str(), 0, false);
757 }
758 }
759 // return last inserted item
760 root = addListItem(dataElement->getParentLanes().back());
761 }
762 // return last inserted list item
763 return root;
764 }
765 }
766 }
767 // there aren't parents
768 return nullptr;
769}
770
771
772void
774 if (HE->getTagProperty().isNetworkElement()) {
775 // Switch gl type of ac
776 switch (HE->getTagProperty().getTag()) {
777 case SUMO_TAG_JUNCTION: {
778 // retrieve junction
780 if (junction) {
781 // insert junction item
782 FXTreeItem* junctionItem = addListItem(HE, itemParent);
783 // insert edges
784 for (const auto& edge : junction->getChildEdges()) {
785 showHierarchicalElementChildren(edge, junctionItem);
786 }
787 // insert crossings
788 for (const auto& crossing : junction->getGNECrossings()) {
789 showHierarchicalElementChildren(crossing, junctionItem);
790 }
791 }
792 break;
793 }
794 case SUMO_TAG_EDGE: {
795 // retrieve edge
797 if (edge) {
798 // insert edge item
799 FXTreeItem* edgeItem = addListItem(HE, itemParent);
800 // insert lanes
801 for (const auto& lane : edge->getLanes()) {
802 showHierarchicalElementChildren(lane, edgeItem);
803 }
804 // insert child additional
805 for (const auto& additional : edge->getChildAdditionals()) {
806 showHierarchicalElementChildren(additional, edgeItem);
807 }
808 // insert child demand elements
809 for (const auto& demandElement : edge->getChildDemandElements()) {
810 showHierarchicalElementChildren(demandElement, edgeItem);
811 }
812 // insert child data elements
813 if (edge->getChildGenericDatas().size() > 0) {
814 // insert intermediate list item
815 FXTreeItem* dataElements = addListItem(edgeItem, TL("Data elements"), GUIIconSubSys::getIcon(GUIIcon::SUPERMODEDATA), false);
816 for (const auto& genericDatas : edge->getChildGenericDatas()) {
817 showHierarchicalElementChildren(genericDatas, dataElements);
818 }
819 }
820 }
821 break;
822 }
823 case SUMO_TAG_LANE: {
824 // retrieve lane
826 if (lane) {
827 // insert lane item
828 FXTreeItem* laneItem = addListItem(HE, itemParent);
829 // insert child additional
830 for (const auto& additional : lane->getChildAdditionals()) {
831 showHierarchicalElementChildren(additional, laneItem);
832 }
833 // insert demand elements children
834 for (const auto& demandElement : lane->getChildDemandElements()) {
835 showHierarchicalElementChildren(demandElement, laneItem);
836 }
837 // insert incoming connections of lanes (by default isn't expanded)
838 if (lane->getGNEIncomingConnections().size() > 0) {
839 std::vector<GNEConnection*> incomingLaneConnections = lane->getGNEIncomingConnections();
840 // insert intermediate list item
841 FXTreeItem* incomingConnections = addListItem(laneItem, TL("Incomings"), incomingLaneConnections.front()->getACIcon(), false);
842 // insert incoming connections
843 for (const auto& connection : incomingLaneConnections) {
844 showHierarchicalElementChildren(connection, incomingConnections);
845 }
846 }
847 // insert outcoming connections of lanes (by default isn't expanded)
848 if (lane->getGNEOutcomingConnections().size() > 0) {
849 std::vector<GNEConnection*> outcomingLaneConnections = lane->getGNEOutcomingConnections();
850 // insert intermediate list item
851 FXTreeItem* outgoingConnections = addListItem(laneItem, TL("Outgoing"), outcomingLaneConnections.front()->getACIcon(), false);
852 // insert outcoming connections
853 for (const auto& connection : outcomingLaneConnections) {
854 showHierarchicalElementChildren(connection, outgoingConnections);
855 }
856 }
857 }
858 break;
859 }
861 case SUMO_TAG_CONNECTION: {
862 // insert connection item
863 addListItem(HE, itemParent);
864 break;
865 }
866 default:
867 break;
868 }
870 // insert additional item
871 FXTreeItem* treeItem = addListItem(HE, itemParent);
872 // insert child edges
873 for (const auto& edge : HE->getChildEdges()) {
874 showHierarchicalElementChildren(edge, treeItem);
875 }
876 // insert child lanes
877 for (const auto& lane : HE->getChildLanes()) {
878 showHierarchicalElementChildren(lane, treeItem);
879 }
880 // insert additional symbols
881 std::vector<GNEAdditional*> symbols;
882 for (const auto& additional : HE->getChildAdditionals()) {
883 if (additional->getTagProperty().isSymbol()) {
884 symbols.push_back(additional);
885 }
886 }
887 if (symbols.size() > 0) {
888 // insert intermediate list item
889 const auto additionalParent = symbols.front()->getParentAdditionals().front();
890 const std::string symbolType = additionalParent->getTagProperty().hasAttribute(SUMO_ATTR_EDGES) ? TL("Edges") : TL("Lanes");
891 GUIIcon symbolIcon = additionalParent->getTagProperty().hasAttribute(SUMO_ATTR_EDGES) ? GUIIcon::EDGE : GUIIcon::LANE;
892 FXTreeItem* symbolListItem = addListItem(treeItem, symbolType, GUIIconSubSys::getIcon(symbolIcon), false);
893 // insert symbols
894 for (const auto& symbol : symbols) {
895 showHierarchicalElementChildren(symbol, symbolListItem);
896 }
897 }
898 // insert additional children
899 for (const auto& additional : HE->getChildAdditionals()) {
900 if (!additional->getTagProperty().isSymbol()) {
901 showHierarchicalElementChildren(additional, treeItem);
902 }
903 }
904 // insert child demand elements
905 for (const auto& demandElement : HE->getChildDemandElements()) {
906 showHierarchicalElementChildren(demandElement, treeItem);
907 }
908 // insert child data elements
909 if (HE->getChildGenericDatas().size() > 0) {
910 // insert intermediate list item
911 FXTreeItem* dataElements = addListItem(treeItem, TL("Data elements"), GUIIconSubSys::getIcon(GUIIcon::SUPERMODEDATA), false);
912 for (const auto& genericDatas : HE->getChildGenericDatas()) {
913 showHierarchicalElementChildren(genericDatas, dataElements);
914 }
915 }
916 } else if (HE->getTagProperty().isDataElement()) {
917 // insert data item
918 FXTreeItem* dataElementItem = addListItem(HE, itemParent);
919 // insert intervals
920 if (HE->getTagProperty().getTag() == SUMO_TAG_DATASET) {
922 // iterate over intervals
923 for (const auto& interval : dataSet->getDataIntervalChildren()) {
924 showHierarchicalElementChildren(interval.second, dataElementItem);
925 }
926 } else if (HE->getTagProperty().getTag() == SUMO_TAG_DATAINTERVAL) {
927 GNEDataInterval* dataInterval = dynamic_cast<GNEDataInterval*>(HE);
928 // iterate over generic datas
929 for (const auto& genericData : dataInterval->getGenericDataChildren()) {
930 showHierarchicalElementChildren(genericData, dataElementItem);
931 }
932 }
933 }
934}
935
936
937FXTreeItem*
938GNEElementTree::addListItem(GNEAttributeCarrier* AC, FXTreeItem* itemParent, std::string prefix, std::string sufix) {
939 // insert item in Tree list
940 FXTreeItem* item = myTreeListDynamic->appendItem(itemParent, (prefix + AC->getHierarchyName() + sufix).c_str(), AC->getACIcon());
941 // insert item in map
942 myTreeItemToACMap[item] = AC;
943 // by default item is expanded
944 item->setExpanded(true);
945 // return created FXTreeItem
946 return item;
947}
948
949
950FXTreeItem*
951GNEElementTree::addListItem(FXTreeItem* itemParent, const std::string& text, FXIcon* icon, bool expanded) {
952 // insert item in Tree list
953 FXTreeItem* item = myTreeListDynamic->appendItem(itemParent, text.c_str(), icon);
954 // expand item depending of flag expanded
955 item->setExpanded(expanded);
956 // return created FXTreeItem
957 return item;
958}
959
960/****************************************************************************/
FXDEFMAP(GNEElementTree) HierarchicalElementTreeMap[]
@ MID_GNE_DELETE
delete element
Definition GUIAppEnum.h:943
@ MID_GNE_CENTER
center element
Definition GUIAppEnum.h:951
@ MID_GNE_ACHIERARCHY_SHOWCHILDMENU
In GNEElementTree list, show child menu.
Definition GUIAppEnum.h:999
@ MID_GNE_ACHIERARCHY_MOVEUP
In GNEElementTree list, move element to up.
@ MID_GNE_INSPECT
inspect element
Definition GUIAppEnum.h:945
@ MID_GNE_ACHIERARCHY_MOVEDOWN
In GNEElementTree list, move element to down.
#define GUIDesignTreeListFixedHeight
tree list with fixed height
Definition GUIDesigns.h:680
GUIIcon
An enumeration of icons used by the gui applications.
Definition GUIIcons.h:33
@ SUPERMODEDATA
@ RECENTERVIEW
#define WRITE_WARNINGF(...)
Definition MsgHandler.h:296
#define TL(string)
Definition MsgHandler.h:315
@ SUMO_TAG_EDGEREL
a relation between two edges
@ SUMO_TAG_DATAINTERVAL
@ SUMO_TAG_VTYPE
description of a vehicle/person/container type
@ SUMO_TAG_CONNECTION
connectioon between two lanes
@ SUMO_TAG_JUNCTION
begin/end of the description of a junction
@ SUMO_TAG_CROSSING
crossing between edges for pedestrians
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ GNE_TAG_POILANE
Point of interest over Lane.
@ SUMO_TAG_DATASET
@ SUMO_TAG_EDGE
begin/end of the description of an edge
@ SUMO_ATTR_EDGES
the edges of a route
@ GNE_ATTR_DEFAULT_VTYPE
Flag to check if VType is a default VType.
@ SUMO_ATTR_ID
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
An Element which don't belong to GNENet but has influence in the simulation.
const std::string getID() const
get ID (all Attribute Carriers have one)
FXIcon * getACIcon() const
get FXIcon associated to this AC
virtual std::string getPopUpID() const =0
get PopPup ID (Used in AC Hierarchy)
const std::string & getTagStr() const
get tag assigned to this object in string format
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
virtual std::string getHierarchyName() const =0
get Hierarchy Name (Used in AC Hierarchy)
virtual GUIGlObject * getGUIGlObject()=0
GNEEdge * getEdgeFrom() const
get the name of the edge the vehicles leave
GNEEdge * getEdgeTo() const
get the name of the edge the vehicles may reach when leaving "from"
An Element which don't belong to GNENet but has influence in the simulation.
GNEDataSet * getDataSetParent() const
Returns a pointer to GNEDataSet parent.
const std::vector< GNEGenericData * > & getGenericDataChildren() const
get generic data children
const std::map< const double, GNEDataInterval * > & getDataIntervalChildren() const
get data interval children
virtual std::string getAttribute(SumoXMLAttr key) const =0
A road/street connecting two junctions (netedit-version)
Definition GNEEdge.h:53
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
Definition GNEEdge.cpp:1118
GNEJunction * getFromJunction() const
get from Junction (only used to increase readability)
Definition GNEEdge.h:77
GNEJunction * getToJunction() const
get from Junction (only used to increase readability)
Definition GNEEdge.h:82
std::set< FXTreeItem * > myTreeItemsConnections
set used to save tree items without AC assigned, the Incoming/Outcoming connections
GNEAttributeCarrier * myClickedAC
pointer to current clicked Attribute Carrier
FXTreeItem * showAttributeCarrierParents()
show child of current attributeCarrier
void createPopUpMenu(int X, int Y, GNEAttributeCarrier *clickedAC)
GNEDataInterval * myClickedDataInterval
data interval element (casted from myClickedAC)
GNEConnection * myClickedConnection
junction (casted from myClickedAC)
long onCmdCenterItem(FXObject *, FXSelector, void *)
called when user click over option "center" of child Menu
std::map< FXTreeItem *, GNEAttributeCarrier * > myTreeItemToACMap
map used to save the FXTreeItems items with their vinculated AC
GNEDataSet * myClickedDataSet
data set element (casted from myClickedAC)
long onCmdInspectItem(FXObject *, FXSelector, void *)
called when user click over option "inspect" of child menu
GNECrossing * myClickedCrossing
crossing (casted from myClickedAC)
void showHierarchicalElementChildren(GNEHierarchicalElement *HE, FXTreeItem *itemParent)
show children of given hierarchical element
GNEFrame * myFrameParent
frame Parent
GNEHierarchicalElement * myHE
hierarchical element
GNEGenericData * myClickedGenericData
generic data element (casted from myClickedAC)
long onCmdShowChildMenu(FXObject *, FXSelector, void *data)
long onCmdMoveItemUp(FXObject *, FXSelector, void *)
called when user click over option "Move up" of child menu
void hideHierarchicalElementTree()
hide GNEElementTree
GNEAdditional * myClickedAdditional
additional (casted from myClickedAC)
MFXTreeListDynamic * myTreeListDynamic
tree list dynamic to show the children of the element to erase
GNEDemandElement * myClickedDemandElement
demand element (casted from myClickedAC)
GNEJunction * myClickedJunction
junction (casted from myClickedAC)
FXTreeItem * addListItem(GNEAttributeCarrier *AC, FXTreeItem *itemParent=nullptr, std::string prefix="", std::string sufix="")
add item into list
long onCmdMoveItemDown(FXObject *, FXSelector, void *)
called when user click over option "Move down" of child menu
void refreshHierarchicalElementTree()
refresh GNEElementTree
GNEEdge * myClickedEdge
edge (casted from myClickedAC)
GNELane * myClickedLane
lane (casted from myClickedAC)
void removeCurrentEditedAttributeCarrier(const GNEAttributeCarrier *HE)
if given AttributeCarrier is the same of myHE, set it as nullptr
long onCmdDeleteItem(FXObject *, FXSelector, void *)
called when user click over option "delete" of child menu
~GNEElementTree()
destructor
void showHierarchicalElementTree(GNEAttributeCarrier *AC)
show GNEElementTree
static bool isSupermodeValid(const GNEViewNet *viewNet, const GNEAttributeCarrier *AC)
return true if AC can be edited in the current supermode
GNEViewNet * getViewNet() const
get view net
Definition GNEFrame.cpp:150
An Element which don't belong to GNENet but has influence in the simulation.
GNEDataInterval * getDataIntervalParent() const
get data interval parent
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNELane * > & getChildLanes() const
get child lanes
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const std::vector< GNEEdge * > & getChildEdges() const
get child edges
const std::vector< GNEEdge * > & getParentEdges() const
get parent edges
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
const std::vector< GNEAdditional * > & getChildAdditionals() const
return child additionals
const std::vector< GNEGenericData * > & getChildGenericDatas() const
return child generic data elements
void clearInspection()
clear inspection
void inspectElement(GNEAttributeCarrier *AC, GNEAttributeCarrier *previousInspectedAC=nullptr)
Inspect a single element.
const std::vector< GNECrossing * > & getGNECrossings() const
Returns GNECrossings.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition GNELane.h:46
std::vector< GNEConnection * > getGNEOutcomingConnections()
returns a vector with the outgoing GNEConnections of this lane
Definition GNELane.cpp:1944
std::vector< GNEConnection * > getGNEIncomingConnections()
returns a vector with the incoming GNEConnections of this lane
Definition GNELane.cpp:1923
GNEEdge * getParentEdge() const
get parent edge
Definition GNELane.cpp:196
GNELane * retrieveLane(const std::string &id, bool hardFail=true, bool checkVolatileChange=false) const
get lane by id
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
GNEJunction * retrieveJunction(const std::string &id, bool hardFail=true) const
get junction by id
GNEDataSet * retrieveDataSet(const std::string &id, bool hardFail=true) const
Returns the named data set.
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
void deleteEdge(GNEEdge *edge, GNEUndoList *undoList, bool recomputeConnections)
removes edge
Definition GNENet.cpp:433
void deleteLane(GNELane *lane, GNEUndoList *undoList, bool recomputeConnections)
removes lane
Definition GNENet.cpp:601
void deleteCrossing(GNECrossing *crossing, GNEUndoList *undoList)
remove crossing
Definition GNENet.cpp:658
void deleteAdditional(GNEAdditional *additional, GNEUndoList *undoList)
remove additional
Definition GNENet.cpp:676
void deleteDemandElement(GNEDemandElement *demandElement, GNEUndoList *undoList)
remove demand element
Definition GNENet.cpp:697
void deleteDataInterval(GNEDataInterval *dataInterval, GNEUndoList *undoList)
remove data interval
Definition GNENet.cpp:736
void deleteConnection(GNEConnection *connection, GNEUndoList *undoList)
remove connection
Definition GNENet.cpp:643
void deleteGenericData(GNEGenericData *genericData, GNEUndoList *undoList)
remove generic data
Definition GNENet.cpp:749
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:127
void deleteDataSet(GNEDataSet *dataSet, GNEUndoList *undoList)
remove data set
Definition GNENet.cpp:723
void deleteJunction(GNEJunction *junction, GNEUndoList *undoList)
removes junction and all incident edges
Definition GNENet.cpp:386
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
bool isPlan() const
plans
bool isTAZElement() const
return true if tag correspond to a TAZ element
bool isNetworkElement() const
element sets
bool isDataElement() const
return true if tag correspond to a data element
bool isType() const
demand elements
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)
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
void add(GNEChange *command, bool doit=false, bool merge=true)
Add new command, executing it if desired. The new command will be merged with the previous command if...
GNENet * getNet() const
get the net object
GNEViewNetHelper::InspectedElements & getInspectedElements()
get inspected elements
GNEViewParent * getViewParent() const
get the net object
GNEUndoList * getUndoList() const
get the undoList object
void updateViewNet(const bool ignoreViewUpdater=true) const
Mark the entire GNEViewNet to be repainted later.
GUIMainWindow * getGUIMainWindow() const
get GUIMainWindow App
GNEInspectorFrame * getInspectorFrame() const
get frame for inspect elements
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel, const bool disable=false)
build menu command
GUIGlID getGlID() const
Returns the numerical id of the object.
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
FXFont * getBoldFont()
get bold front
virtual void centerTo(GUIGlID id, bool applyZoom, double zoomDist=20)
centers to the chosen artifact
MFXGroupBoxModule (based on FXGroupBox)
MFXTreeListDynamic.
void show()
Show MFXTreeListDynamic.
void clearItems()
clear items
void hide()
Hide MFXTreeListDynamic.
FXWindow * getFXWindow()
get FXWindows associated with this MFXTreeListDynamic
FXTreeItem * getItemAt(FXint x, FXint y) const
Get item at x,y, if any.
FXTreeItem * appendItem(FXTreeItem *father, const FXString &text, FXIcon *oi, FXColor tColor=FXRGB(0, 0, 0))
append item with given text and icon