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-2026 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
21#include <fxkeys.h>
23#include <netedit/GNENet.h>
25#include <netedit/GNEUndoList.h>
26#include <netedit/GNEViewNet.h>
36
37#include "GNEElementTree.h"
38
39// ===========================================================================
40// FOX callback mapping
41// ===========================================================================
42
52
53
54// Object implementation
55FXIMPLEMENT(GNEElementTree, GNEGroupBoxModule, HierarchicalElementTreeMap, ARRAYNUMBER(HierarchicalElementTreeMap))
56
57// ===========================================================================
58// method definitions
59// ===========================================================================
60
62 GNEGroupBoxModule(frameParent, TL("Hierarchy")),
63 myFrameParent(frameParent) {
64 // Create tree list with fixed height
65 myTreeListDynamic = new MFXTreeListDynamic(getCollapsableFrame(), this, MID_GNE_ACHIERARCHY_SHOWCHILDMENU, GUIDesignTreeListFixedHeight);
66 hide();
67}
68
69
71
72
73void
76 // show GNEElementTree and refresh GNEElementTree
78 // refresh GNEElementTree
80 // show myTreeListDynamic
82 // show module
83 show();
84 }
85}
86
87
88void
90 // set all pointers null
91 myHierarchicalElement = nullptr;
92 myClickedAC = nullptr;
93 myClickedJunction = nullptr;
94 myClickedEdge = nullptr;
95 myClickedLane = nullptr;
96 myClickedCrossing = nullptr;
97 myClickedConnection = nullptr;
98 myClickedAdditional = nullptr;
99 myClickedTAZSourceSink = nullptr;
100 myClickedDemandElement = nullptr;
101 myClickedDataSet = nullptr;
102 myClickedDataInterval = nullptr;
103 myClickedGenericData = nullptr;
104 // hide myTreeListDynamic
106 // hide module
107 hide();
108}
109
110
111void
122
123
124void
126 // simply check if AC is the same of myHE
127 if (AC == myHierarchicalElement) {
128 myHierarchicalElement = nullptr;
129 }
130}
131
132
133long
134GNEElementTree::onCmdShowChildMenu(FXObject*, FXSelector, void* eventData) {
135 // obtain event
136 FXEvent* e = (FXEvent*)eventData;
137 // obtain FXTreeItem in the given position
138 FXTreeItem* item = myTreeListDynamic->getItemAt(e->win_x, e->win_y);
139 // open Pop-up if FXTreeItem has a Attribute Carrier vinculated
140 if (item && (myTreeItemsConnections.find(item) == myTreeItemsConnections.end())) {
141 createPopUpMenu(e->root_x, e->root_y, myTreeItemToACMap[item]);
142 }
143 return 1;
144}
145
146
147long
148GNEElementTree::onKeyPressItem(FXObject* obj, FXSelector sel, void* eventData) {
149 const FXEvent* e = (FXEvent*)eventData;
150 if ((e->code != KEY_Return) && (e->code != KEY_KP_Enter)) {
151 // let the tree list handle the key (e.g. arrows for navigation)
152 return 0;
153 }
154 FXTreeItem* item = myTreeListDynamic->getCurrentItem();
155 if (item && (myTreeItemsConnections.find(item) == myTreeItemsConnections.end())) {
156 const auto it = myTreeItemToACMap.find(item);
157 if ((it != myTreeItemToACMap.end()) && it->second) {
158 setClickedAC(it->second);
159 if (e->state & CONTROLMASK) {
161 onCmdCenterItem(obj, sel, eventData);
162 }
163 } else if (isSupermodeValid(myClickedAC)) {
164 onCmdInspectItem(obj, sel, eventData);
165 }
166 }
167 }
168 return 1;
169}
170
171
172long
173GNEElementTree::onCmdCenterItem(FXObject*, FXSelector, void*) {
174 // Center item
175 if (myClickedJunction) {
177 } else if (myClickedEdge) {
179 } else if (myClickedLane) {
181 } else if (myClickedCrossing) {
183 } else if (myClickedConnection) {
185 } else if (myClickedAdditional) {
187 } else if (myClickedTAZSourceSink) {
188 myFrameParent->getViewNet()->centerTo(myClickedTAZSourceSink->getParentEdges().front()->getGlID(), true, -1);
189 } else if (myClickedDemandElement) {
191 } else if (myClickedGenericData) {
193 }
194 // update view after centering
196 return 1;
197}
198
199
200long
205
206
207long
208GNEElementTree::onCmdDeleteItem(FXObject*, FXSelector, void*) {
209 const auto& inspectedElements = myFrameParent->getViewNet()->getInspectedElements();
210 // Remove Attribute Carrier
211 if (myClickedJunction) {
213 } else if (myClickedEdge) {
215 } else if (myClickedLane) {
217 } else if (myClickedCrossing) {
219 } else if (myClickedConnection) {
221 } else if (myClickedAdditional) {
223 } else if (myClickedTAZSourceSink) {
225 } else if (myClickedDemandElement) {
226 // check that default VTypes aren't removed
228 WRITE_WARNINGF(TL("Default Vehicle Type '%' cannot be removed"), myClickedDemandElement->getAttribute(SUMO_ATTR_ID));
229 return 1;
231 // we need to check if we're removing the last person plan of a person.
232 auto planParent = myClickedDemandElement->getParentDemandElements().front();
233 if (planParent->getChildDemandElements().size() == 1) {
235 } else {
237 }
238 }
239 } else if (myClickedDataSet) {
241 } else if (myClickedDataInterval) {
242 // check if we have to remove data Set
245 } else {
247 }
248 } else if (myClickedGenericData) {
249 // check if we have to remove interval
251 // check if we have to remove data Set
254 } else {
256 }
257 } else {
259 }
260 }
261 // refresh AC Hierarchy
263 // check if inspector frame has to be shown again
264 if (inspectedElements.isInspectingSingleElement()) {
265 if (inspectedElements.getFirstAC() != myClickedAC) {
266 myFrameParent->getViewNet()->getViewParent()->getInspectorFrame()->inspectElement(inspectedElements.getFirstAC());
267 } else {
268 // inspect a nullptr element to reset inspector frame
270 }
271 }
272 return 1;
273}
274
275
276long
277GNEElementTree::onCmdMoveItemUp(FXObject*, FXSelector, void*) {
278 // currently only children of demand elements can be moved
281 // move element one position back
285 }
286 // refresh after moving child
288 return 1;
289}
290
291
292long
293GNEElementTree::onCmdMoveItemDown(FXObject*, FXSelector, void*) {
294 // currently only children of demand elements can be moved
297 // move element one position front
301 }
302 // refresh after moving child
304 return 1;
305}
306
307
308void
310 // get attributeCarriers
311 const auto& attributeCarriers = myFrameParent->getViewNet()->getNet()->getAttributeCarriers();
312 // set current clicked AC
313 myClickedAC = clickedAC;
314 // cast all elements
315 myClickedJunction = attributeCarriers->retrieveJunction(clickedAC->getID(), false);
316 myClickedEdge = attributeCarriers->retrieveEdge(clickedAC->getID(), false);
317 myClickedLane = attributeCarriers->retrieveLane(clickedAC->getGUIGlObject(), false);
318 myClickedCrossing = attributeCarriers->retrieveCrossing(clickedAC->getGUIGlObject(), false);
319 myClickedConnection = attributeCarriers->retrieveConnection(clickedAC->getGUIGlObject(), false);
320 myClickedAdditional = attributeCarriers->retrieveAdditional(clickedAC->getGUIGlObject(), false);
321 myClickedTAZSourceSink = attributeCarriers->retrieveTAZSourceSink(clickedAC, false);
322 myClickedDemandElement = attributeCarriers->retrieveDemandElement(clickedAC->getGUIGlObject(), false);
323 myClickedDataSet = attributeCarriers->retrieveDataSet(clickedAC->getID(), false);
324 myClickedDataInterval = attributeCarriers->retrieveDataInterval(clickedAC, false);
325 myClickedGenericData = attributeCarriers->retrieveGenericData(clickedAC->getGUIGlObject(), false);
326}
327
328
329bool
331 // Vehicle Types, distributions, data sets and data intervals cannot be centered
334}
335
336
337void
339 // first check that AC exist
340 if (clickedAC) {
341 // set current clicked AC and cast all elements
342 setClickedAC(clickedAC);
343 // create FXMenuPane
344 FXMenuPane* pane = new FXMenuPane(myTreeListDynamic->getFXWindow());
345 // set item name and icon
347 // add extra info for TAZ Source Sinks
349 new FXMenuSeparator(pane);
350 GUIDesigns::buildFXMenuCommand(pane, TLF("Edge: %", myClickedTAZSourceSink->getParentEdges().front()->getID()), nullptr, nullptr, 0);
351 }
352 // insert separator
353 new FXMenuSeparator(pane);
354 // create center menu command
355 FXMenuCommand* centerMenuCommand = GUIDesigns::buildFXMenuCommandShortcut(pane, TL("Center"), "Ctrl+Enter", "", GUIIconSubSys::getIcon(GUIIcon::RECENTERVIEW), this, MID_GNE_CENTER);
356 // disable Centering for Vehicle Types, data sets and data intervals
358 centerMenuCommand->disable();
359 }
360 // create inspect and delete menu commands
361 FXMenuCommand* inspectMenuCommand = GUIDesigns::buildFXMenuCommandShortcut(pane, TL("Inspect"), "Enter", "", GUIIconSubSys::getIcon(GUIIcon::MODEINSPECT), this, MID_GNE_INSPECT);
362 FXMenuCommand* deleteMenuCommand = GUIDesigns::buildFXMenuCommand(pane, TL("Delete"), GUIIconSubSys::getIcon(GUIIcon::MODEDELETE), this, MID_GNE_DELETE);
363 // check if inspect and delete menu commands has to be disabled
365 inspectMenuCommand->disable();
366 deleteMenuCommand->disable();
367 }
368 // now check if given AC support manually moving of their item up and down (Currently only for certain demand elements)
369 /* if (myClickedDemandElement && myClickedAC->getTagProperty()->canBeSortedManually()) {
370 // insert separator
371 new FXMenuSeparator(pane);
372 // create both moving menu commands
373 FXMenuCommand* moveUpMenuCommand = GUIDesigns::buildFXMenuCommand(pane, "Move up", GUIIconSubSys::getIcon(GUIIcon::ARROW_UP), this, MID_GNE_ACHIERARCHY_MOVEUP);
374 FXMenuCommand* moveDownMenuCommand = GUIDesigns::buildFXMenuCommand(pane, "Move down", GUIIconSubSys::getIcon(GUIIcon::ARROW_DOWN), this, MID_GNE_ACHIERARCHY_MOVEDOWN);
375 // check if both commands has to be disabled
376 if (myClickedDemandElement->getTagProperty()->isPlanStopPerson()) {
377 moveUpMenuCommand->setText(TL("Move up (Stops cannot be moved)"));
378 moveDownMenuCommand->setText(TL("Move down (Stops cannot be moved)"));
379 moveUpMenuCommand->disable();
380 moveDownMenuCommand->disable();
381 } else {
382 // check if moveUpMenuCommand has to be disabled
383 if (myClickedDemandElement->getParentDemandElements().front()->getChildDemandElements().front() == myClickedDemandElement) {
384 moveUpMenuCommand->setText(TL("Move up (It's already the first element)"));
385 moveUpMenuCommand->disable();
386 } else if (myClickedDemandElement->getParentDemandElements().front()->getPreviousChildDemandElement(myClickedDemandElement)->getTagProperty()->isPlanStopPerson()) {
387 moveUpMenuCommand->setText(TL("Move up (Previous element is a Stop)"));
388 moveUpMenuCommand->disable();
389 }
390 // check if moveDownMenuCommand has to be disabled
391 if (myClickedDemandElement->getParentDemandElements().front()->getChildDemandElements().back() == myClickedDemandElement) {
392 moveDownMenuCommand->setText(TL("Move down (It's already the last element)"));
393 moveDownMenuCommand->disable();
394 } else if (myClickedDemandElement->getParentDemandElements().front()->getNextChildDemandElement(myClickedDemandElement)->getTagProperty()->isPlanStopPerson()) {
395 moveDownMenuCommand->setText(TL("Move down (Next element is a Stop)"));
396 moveDownMenuCommand->disable();
397 }
398 }
399 } */
400 // Center in the mouse position and create pane
401 pane->setX(X);
402 pane->setY(Y);
403 pane->create();
404 pane->show();
405 } else {
406 // set all clicked elements to null
407 myClickedAC = nullptr;
408 myClickedJunction = nullptr;
409 myClickedEdge = nullptr;
410 myClickedLane = nullptr;
411 myClickedCrossing = nullptr;
412 myClickedConnection = nullptr;
413 myClickedAdditional = nullptr;
414 myClickedTAZSourceSink = nullptr;
415 myClickedDemandElement = nullptr;
416 myClickedDataSet = nullptr;
417 myClickedDataInterval = nullptr;
418 myClickedGenericData = nullptr;
419 }
420}
421
422
423FXTreeItem*
425 // get attributeCarriers
426 const auto& attributeCarriers = myFrameParent->getViewNet()->getNet()->getAttributeCarriers();
427 // check tags
429 // check demand element type
431 case SUMO_TAG_EDGE: {
432 // obtain Edge
433 GNEEdge* edge = attributeCarriers->retrieveEdge(myHierarchicalElement->getID(), false);
434 if (edge == nullptr) {
435 return nullptr;
436 } else {
437 // insert Junctions of edge in tree (Parallel because an edge has always two Junctions)
438 FXTreeItem* junctionSourceItem = myTreeListDynamic->appendItem(nullptr, (edge->getFromJunction()->getHierarchyName() + TL(" origin")).c_str(), edge->getFromJunction()->getACIcon());
439 FXTreeItem* junctionDestinationItem = myTreeListDynamic->appendItem(nullptr, (edge->getFromJunction()->getHierarchyName() + TL(" destination")).c_str(), edge->getFromJunction()->getACIcon());
440 junctionDestinationItem->setExpanded(true);
441 // Save items in myTreeItemToACMap
442 myTreeItemToACMap[junctionSourceItem] = edge->getFromJunction();
443 myTreeItemToACMap[junctionDestinationItem] = edge->getToJunction();
444 // return junction destination Item
445 return junctionDestinationItem;
446 }
447 }
448 case SUMO_TAG_LANE: {
449 // obtain lane
450 GNELane* lane = attributeCarriers->retrieveLane(myHierarchicalElement->getID(), false);
451 if (lane == nullptr) {
452 return nullptr;
453 } else {
454 // obtain parent edge
455 GNEEdge* edge = attributeCarriers->retrieveEdge(lane->getParentEdge()->getID());
456 //insert Junctions of lane of edge in tree (Parallel because an edge has always two Junctions)
457 FXTreeItem* junctionSourceItem = myTreeListDynamic->appendItem(nullptr, (edge->getFromJunction()->getHierarchyName() + TL(" origin")).c_str(), edge->getFromJunction()->getACIcon());
458 FXTreeItem* junctionDestinationItem = myTreeListDynamic->appendItem(nullptr, (edge->getFromJunction()->getHierarchyName() + TL(" destination")).c_str(), edge->getFromJunction()->getACIcon());
459 junctionDestinationItem->setExpanded(true);
460 // Create edge item
461 FXTreeItem* edgeItem = myTreeListDynamic->appendItem(junctionDestinationItem, edge->getHierarchyName().c_str(), edge->getACIcon());
462 edgeItem->setExpanded(true);
463 // Save items in myTreeItemToACMap
464 myTreeItemToACMap[junctionSourceItem] = edge->getFromJunction();
465 myTreeItemToACMap[junctionDestinationItem] = edge->getToJunction();
466 myTreeItemToACMap[edgeItem] = edge;
467 // return edge item
468 return edgeItem;
469 }
470 }
471 case SUMO_TAG_CROSSING: {
472 // obtain crossing parent junction
473 auto crossing = attributeCarriers->retrieveCrossing(myHierarchicalElement->getGUIGlObject(), false);
474 if (crossing == nullptr) {
475 return nullptr;
476 } else {
477 GNEJunction* junction = crossing->getParentJunctions().front();
478 // create junction item
479 FXTreeItem* junctionItem = myTreeListDynamic->appendItem(nullptr, junction->getHierarchyName().c_str(), junction->getACIcon());
480 junctionItem->setExpanded(true);
481 // Save items in myTreeItemToACMap
482 myTreeItemToACMap[junctionItem] = junction;
483 // return junction Item
484 return junctionItem;
485 }
486 }
487 case SUMO_TAG_CONNECTION: {
488 // obtain Connection
489 GNEConnection* connection = attributeCarriers->retrieveConnection(myHierarchicalElement->getID(), false);
490 if (connection == nullptr) {
491 return nullptr;
492 } else {
493 // create edge from item
494 FXTreeItem* edgeFromItem = myTreeListDynamic->appendItem(nullptr, connection->getEdgeFrom()->getHierarchyName().c_str(), connection->getEdgeFrom()->getACIcon());
495 edgeFromItem->setExpanded(true);
496 // create edge to item
497 FXTreeItem* edgeToItem = myTreeListDynamic->appendItem(nullptr, connection->getEdgeTo()->getHierarchyName().c_str(), connection->getEdgeTo()->getACIcon());
498 edgeToItem->setExpanded(true);
499 // create connection item
500 FXTreeItem* connectionItem = myTreeListDynamic->appendItem(edgeToItem, connection->getHierarchyName().c_str(), connection->getACIcon());
501 connectionItem->setExpanded(true);
502 // Save items in myTreeItemToACMap
503 myTreeItemToACMap[edgeFromItem] = connection->getEdgeFrom();
504 myTreeItemToACMap[edgeToItem] = connection->getEdgeTo();
505 myTreeItemToACMap[connectionItem] = connection;
506 // return connection item
507 return connectionItem;
508 }
509 }
510 default:
511 break;
512 }
514 // Obtain POILane
515 const auto* POILane = attributeCarriers->retrieveAdditional(myHierarchicalElement->getGUIGlObject(), false);
516 if (POILane == nullptr) {
517 return nullptr;
518 } else {
519 // obtain parent lane
520 GNELane* lane = attributeCarriers->retrieveLane(POILane->getParentLanes().at(0)->getID());
521 // obtain parent edge
522 GNEEdge* edge = attributeCarriers->retrieveEdge(lane->getParentEdge()->getID());
523 //insert Junctions of lane of edge in tree (Parallel because an edge has always two Junctions)
524 FXTreeItem* junctionSourceItem = myTreeListDynamic->appendItem(nullptr, (edge->getFromJunction()->getHierarchyName() + TL(" origin")).c_str(), edge->getFromJunction()->getACIcon());
525 FXTreeItem* junctionDestinationItem = myTreeListDynamic->appendItem(nullptr, (edge->getFromJunction()->getHierarchyName() + TL(" destination")).c_str(), edge->getFromJunction()->getACIcon());
526 junctionDestinationItem->setExpanded(true);
527 // Create edge item
528 FXTreeItem* edgeItem = myTreeListDynamic->appendItem(junctionDestinationItem, edge->getHierarchyName().c_str(), edge->getACIcon());
529 edgeItem->setExpanded(true);
530 // Create lane item
531 FXTreeItem* laneItem = myTreeListDynamic->appendItem(edgeItem, lane->getHierarchyName().c_str(), lane->getACIcon());
532 laneItem->setExpanded(true);
533 // Save items in myTreeItemToACMap
534 myTreeItemToACMap[junctionSourceItem] = edge->getFromJunction();
535 myTreeItemToACMap[junctionDestinationItem] = edge->getToJunction();
536 myTreeItemToACMap[edgeItem] = edge;
537 myTreeItemToACMap[laneItem] = lane;
538 // return Lane item
539 return laneItem;
540 }
542 // Obtain Additional
543 const GNEAdditional* additional = attributeCarriers->retrieveAdditional(myHierarchicalElement->getGUIGlObject(), false);
544 if (additional == nullptr) {
545 return nullptr;
546 } else {
547 // declare auxiliary FXTreeItem, due a demand element can have multiple "roots"
548 FXTreeItem* root = nullptr;
549 // check if there is demand elements parents
550 if (additional->getParentAdditionals().size() > 0) {
551 // check if we have more than one edge
552 if (additional->getParentAdditionals().size() > 1) {
553 // insert first item
554 addListItem(additional->getParentAdditionals().front());
555 // insert "spacer"
556 if (additional->getParentAdditionals().size() > 2) {
557 addListItem(nullptr, ("..." + toString((int)additional->getParentAdditionals().size() - 2) + TL(" additionals...")).c_str(), 0, false);
558 }
559 }
560 // return last inserted item
561 root = addListItem(additional->getParentAdditionals().back());
562 }
563 // check if there is parent demand elements
564 if (additional->getParentDemandElements().size() > 0) {
565 // check if we have more than one demand element
566 if (additional->getParentDemandElements().size() > 1) {
567 // insert first item
568 addListItem(additional->getParentDemandElements().front());
569 // insert "spacer"
570 if (additional->getParentDemandElements().size() > 2) {
571 addListItem(nullptr, ("..." + toString((int)additional->getParentDemandElements().size() - 2) + TL(" demand elements...")).c_str(), 0, false);
572 }
573 }
574 // return last inserted item
575 root = addListItem(additional->getParentDemandElements().back());
576 }
577 // check if there is parent edges
578 if (additional->getParentEdges().size() > 0) {
579 // check if we have more than one edge
580 if (additional->getParentEdges().size() > 1) {
581 // insert first item
582 addListItem(additional->getParentEdges().front());
583 // insert "spacer"
584 if (additional->getParentEdges().size() > 2) {
585 addListItem(nullptr, ("..." + toString((int)additional->getParentEdges().size() - 2) + TL(" edges...")).c_str(), 0, false);
586 }
587 }
588 // return last inserted item
589 root = addListItem(additional->getParentEdges().back());
590 }
591 // check if there is parent lanes
592 if (additional->getParentLanes().size() > 0) {
593 // check if we have more than one parent lane
594 if (additional->getParentLanes().size() > 1) {
595 // insert first item
596 addListItem(additional->getParentLanes().front());
597 // insert "spacer"
598 if (additional->getParentLanes().size() > 2) {
599 addListItem(nullptr, ("..." + toString((int)additional->getParentLanes().size() - 2) + TL(" lanes...")).c_str(), 0, false);
600 }
601 }
602 // return last inserted item
603 root = addListItem(additional->getParentLanes().back());
604 }
605 // return last inserted list item
606 return root;
607 }
609 // Obtain TAZElement
610 const GNEAdditional* TAZElement = attributeCarriers->retrieveAdditional(myHierarchicalElement->getGUIGlObject(), false);
611 if (TAZElement == nullptr) {
612 return nullptr;
613 } else {
614 // declare auxiliary FXTreeItem, due a demand element can have multiple "roots"
615 FXTreeItem* root = nullptr;
616 // check if there is demand elements parents
617 if (TAZElement->getParentAdditionals().size() > 0) {
618 // check if we have more than one edge
619 if (TAZElement->getParentAdditionals().size() > 1) {
620 // insert first item
621 addListItem(TAZElement->getParentAdditionals().front());
622 // insert "spacer"
623 if (TAZElement->getParentAdditionals().size() > 2) {
624 addListItem(nullptr, ("..." + toString((int)TAZElement->getParentAdditionals().size() - 2) + TL(" TAZElements...")).c_str(), 0, false);
625 }
626 }
627 // return last inserted item
628 root = addListItem(TAZElement->getParentAdditionals().back());
629 }
630 // check if there is parent demand elements
631 if (TAZElement->getParentDemandElements().size() > 0) {
632 // check if we have more than one demand element
633 if (TAZElement->getParentDemandElements().size() > 1) {
634 // insert first item
635 addListItem(TAZElement->getParentDemandElements().front());
636 // insert "spacer"
637 if (TAZElement->getParentDemandElements().size() > 2) {
638 addListItem(nullptr, ("..." + toString((int)TAZElement->getParentDemandElements().size() - 2) + TL(" demand elements...")).c_str(), 0, false);
639 }
640 }
641 // return last inserted item
642 root = addListItem(TAZElement->getParentDemandElements().back());
643 }
644 // check if there is parent edges
645 if (TAZElement->getParentEdges().size() > 0) {
646 // check if we have more than one edge
647 if (TAZElement->getParentEdges().size() > 1) {
648 // insert first item
649 addListItem(TAZElement->getParentEdges().front());
650 // insert "spacer"
651 if (TAZElement->getParentEdges().size() > 2) {
652 addListItem(nullptr, ("..." + toString((int)TAZElement->getParentEdges().size() - 2) + TL(" edges...")).c_str(), 0, false);
653 }
654 }
655 // return last inserted item
656 root = addListItem(TAZElement->getParentEdges().back());
657 }
658 // check if there is parent lanes
659 if (TAZElement->getParentLanes().size() > 0) {
660 // check if we have more than one parent lane
661 if (TAZElement->getParentLanes().size() > 1) {
662 // insert first item
663 addListItem(TAZElement->getParentLanes().front());
664 // insert "spacer"
665 if (TAZElement->getParentLanes().size() > 2) {
666 addListItem(nullptr, ("..." + toString((int)TAZElement->getParentLanes().size() - 2) + TL(" lanes...")).c_str(), 0, false);
667 }
668 }
669 // return last inserted item
670 root = addListItem(TAZElement->getParentLanes().back());
671 }
672 // return last inserted list item
673 return root;
674 }
676 // Obtain DemandElement
677 GNEDemandElement* demandElement = attributeCarriers->retrieveDemandElement(myHierarchicalElement->getGUIGlObject(), false);
678 if (demandElement == nullptr) {
679 return nullptr;
680 } else {
681 // declare auxiliar FXTreeItem, due a demand element can have multiple "roots"
682 FXTreeItem* root = nullptr;
683 // check if there are demand element parents
684 if (demandElement->getParentAdditionals().size() > 0) {
685 // check if we have more than one edge
686 if (demandElement->getParentAdditionals().size() > 1) {
687 // insert first item
688 addListItem(demandElement->getParentAdditionals().front());
689 // insert "spacer"
690 if (demandElement->getParentAdditionals().size() > 2) {
691 addListItem(nullptr, ("..." + toString((int)demandElement->getParentAdditionals().size() - 2) + TL(" additionals...")).c_str(), 0, false);
692 }
693 }
694 // return last inserted item
695 root = addListItem(demandElement->getParentAdditionals().back());
696 }
697 // check if there is parent demand elements
698 if (demandElement->getParentDemandElements().size() > 0) {
699 // check if we have more than one demand element
700 if (demandElement->getParentDemandElements().size() > 1) {
701 // insert first item
702 addListItem(demandElement->getParentDemandElements().front());
703 // insert "spacer"
704 if (demandElement->getParentDemandElements().size() > 2) {
705 addListItem(nullptr, ("..." + toString((int)demandElement->getParentDemandElements().size() - 2) + TL(" demand elements...")).c_str(), 0, false);
706 }
707 }
708 // return last inserted item
709 root = addListItem(demandElement->getParentDemandElements().back());
710 }
711 // check if there is parent edges
712 if (demandElement->getParentEdges().size() > 0) {
713 // check if we have more than one edge
714 if (demandElement->getParentEdges().size() > 1) {
715 // insert first item
716 addListItem(demandElement->getParentEdges().front());
717 // insert "spacer"
718 if (demandElement->getParentEdges().size() > 2) {
719 addListItem(nullptr, ("..." + toString((int)demandElement->getParentEdges().size() - 2) + TL(" edges...")).c_str(), 0, false);
720 }
721 }
722 // return last inserted item
723 root = addListItem(demandElement->getParentEdges().back());
724 }
725 // check if there is parent lanes
726 if (demandElement->getParentLanes().size() > 0) {
727 // check if we have more than one parent lane
728 if (demandElement->getParentLanes().size() > 1) {
729 // insert first item
730 addListItem(demandElement->getParentLanes().front());
731 // insert "spacer"
732 if (demandElement->getParentLanes().size() > 2) {
733 addListItem(nullptr, ("..." + toString((int)demandElement->getParentLanes().size() - 2) + TL(" lanes...")).c_str(), 0, false);
734 }
735 }
736 // return last inserted item
737 root = addListItem(demandElement->getParentLanes().back());
738 }
739 // return last inserted list item
740 return root;
741 }
743 // check if is a GNEDataInterval or a GNEGenericData
745 return nullptr;
747 auto dataInterval = attributeCarriers->retrieveDataInterval(myHierarchicalElement, false);
748 if (dataInterval == nullptr) {
749 return nullptr;
750 } else {
751 return addListItem(dataInterval);
752 }
753 } else {
754 // Obtain DataElement
755 GNEGenericData* dataElement = dynamic_cast<GNEGenericData*>(myHierarchicalElement);
756 if (dataElement == nullptr) {
757 return nullptr;
758 } else {
759 // declare auxiliary FXTreeItem, due a data element can have multiple "roots"
760 FXTreeItem* root = nullptr;
761 // set dataset
763 // set data interval
764 addListItem(dataElement->getDataIntervalParent());
765 // check if there is data elements parents
766 if (dataElement->getParentAdditionals().size() > 0) {
767 // check if we have more than one edge
768 if (dataElement->getParentAdditionals().size() > 1) {
769 // insert first item
770 addListItem(dataElement->getParentAdditionals().front());
771 // insert "spacer"
772 if (dataElement->getParentAdditionals().size() > 2) {
773 addListItem(nullptr, ("..." + toString((int)dataElement->getParentAdditionals().size() - 2) + TL(" additionals...")).c_str(), 0, false);
774 }
775 }
776 // return last inserted item
777 root = addListItem(dataElement->getParentAdditionals().back());
778 }
779 // check if there is parent demand elements
780 if (dataElement->getParentDemandElements().size() > 0) {
781 // check if we have more than one demand element
782 if (dataElement->getParentDemandElements().size() > 1) {
783 // insert first item
784 addListItem(dataElement->getParentDemandElements().front());
785 // insert "spacer"
786 if (dataElement->getParentDemandElements().size() > 2) {
787 addListItem(nullptr, ("..." + toString((int)dataElement->getParentDemandElements().size() - 2) + TL(" demand elements...")).c_str(), 0, false);
788 }
789 }
790 // return last inserted item
791 root = addListItem(dataElement->getParentDemandElements().back());
792 }
793 // check if there is parent edges
794 if (dataElement->getParentEdges().size() > 0) {
795 // check if we have more than one edge
796 if (dataElement->getParentEdges().size() > 1) {
797 // insert first ege
798 if (dataElement->getTagProperty()->getTag() == SUMO_TAG_EDGEREL) {
799 addListItem(dataElement->getParentEdges().front(), nullptr, "from ");
800 } else {
801 addListItem(dataElement->getParentEdges().front());
802 }
803 // insert "spacer"
804 if (dataElement->getParentEdges().size() > 2) {
805 addListItem(nullptr, ("..." + toString((int)dataElement->getParentEdges().size() - 2) + TL(" edges...")).c_str(), 0, false);
806 }
807 }
808 // insert last ege
809 if (dataElement->getTagProperty()->getTag() == SUMO_TAG_EDGEREL) {
810 addListItem(dataElement->getParentEdges().back(), nullptr, "to ");
811 } else {
812 addListItem(dataElement->getParentEdges().back());
813 }
814 }
815 // check if there is parent lanes
816 if (dataElement->getParentLanes().size() > 0) {
817 // check if we have more than one parent lane
818 if (dataElement->getParentLanes().size() > 1) {
819 // insert first item
820 addListItem(dataElement->getParentLanes().front());
821 // insert "spacer"
822 if (dataElement->getParentLanes().size() > 2) {
823 addListItem(nullptr, ("..." + toString((int)dataElement->getParentLanes().size() - 2) + TL(" lanes...")).c_str(), 0, false);
824 }
825 }
826 // return last inserted item
827 root = addListItem(dataElement->getParentLanes().back());
828 }
829 // return last inserted list item
830 return root;
831 }
832 }
833 }
834 // no parents
835 return nullptr;
836}
837
838
839void
840GNEElementTree::showHierarchicalElementChildren(GNEAttributeCarrier* hierarchicalElement, FXTreeItem* itemParent) {
841 // get attributeCarriers
842 const auto& attributeCarriers = myFrameParent->getViewNet()->getNet()->getAttributeCarriers();
843 // create item
844 FXTreeItem* item = addListItem(hierarchicalElement, itemParent);
845 // junctions
846 for (const auto& junction : hierarchicalElement->getHierarchicalElement()->getChildJunctions()) {
847 showHierarchicalElementChildren(junction, item);
848 }
849 // edges
850 for (const auto& edge : hierarchicalElement->getHierarchicalElement()->getChildEdges()) {
852 }
853 // lanes
854 for (const auto& lane : hierarchicalElement->getHierarchicalElement()->getChildLanes()) {
856 }
857 // crossings
858 if (hierarchicalElement->getTagProperty()->getTag() == SUMO_TAG_JUNCTION) {
859 // retrieve junction
860 GNEJunction* junction = attributeCarriers->retrieveJunction(hierarchicalElement->getID(), false);
861 if (junction) {
862 // insert crossings
863 for (const auto& crossing : junction->getGNECrossings()) {
864 showHierarchicalElementChildren(crossing, item);
865 }
866 }
867 }
868 // connections
869 if (hierarchicalElement->getTagProperty()->getTag() == SUMO_TAG_LANE) {
870 // retrieve lane
871 GNELane* lane = attributeCarriers->retrieveLane(hierarchicalElement->getID(), false);
872 if (lane) {
873 // insert incoming connections of lanes (by default isn't expanded)
874 if (lane->getGNEIncomingConnections().size() > 0) {
875 std::vector<GNEConnection*> incomingLaneConnections = lane->getGNEIncomingConnections();
876 // insert intermediate list item
877 FXTreeItem* incomingConnections = addListItem(item, TL("Incomings"), incomingLaneConnections.front()->getACIcon(), false);
878 // insert incoming connections
879 for (const auto& connection : incomingLaneConnections) {
880 showHierarchicalElementChildren(connection, incomingConnections);
881 }
882 }
883 // insert outcoming connections of lanes (by default isn't expanded)
884 if (lane->getGNEOutcomingConnections().size() > 0) {
885 std::vector<GNEConnection*> outcomingLaneConnections = lane->getGNEOutcomingConnections();
886 // insert intermediate list item
887 FXTreeItem* outgoingConnections = addListItem(item, TL("Outgoing"), outcomingLaneConnections.front()->getACIcon(), false);
888 // insert outcoming connections
889 for (const auto& connection : outcomingLaneConnections) {
890 showHierarchicalElementChildren(connection, outgoingConnections);
891 }
892 }
893 }
894 }
895 // additionals
896 for (const auto& additional : hierarchicalElement->getHierarchicalElement()->getChildAdditionals()) {
897 if (!additional->getTagProperty()->isSymbol()) {
898 showHierarchicalElementChildren(additional, item);
899 }
900 }
901 // additionals symbols
902 for (const auto& additional : hierarchicalElement->getHierarchicalElement()->getChildAdditionals()) {
903 if (additional->getTagProperty()->isSymbol()) {
904 showHierarchicalElementChildren(additional, item);
905 }
906 }
907 // TAZ SourceSinks (avoiding show a high number)
908 if (hierarchicalElement->getHierarchicalElement()->getChildTAZSourceSinks().size() > 20) {
909 addListItem(item, TLF("SourceSinks (%)", toString(hierarchicalElement->getHierarchicalElement()->getChildTAZSourceSinks().size())), GUIIconSubSys::getIcon(GUIIcon::TAZ), false);
910 } else {
911 // show source and sinks separated
912 for (const auto& TAZSource : hierarchicalElement->getHierarchicalElement()->getChildTAZSourceSinks()) {
913 if (TAZSource->getTagProperty()->getTag() == SUMO_TAG_TAZSOURCE) {
914 showHierarchicalElementChildren(TAZSource, item);
915 }
916 }
917 for (const auto& TAZSink : hierarchicalElement->getHierarchicalElement()->getChildTAZSourceSinks()) {
918 if (TAZSink->getTagProperty()->getTag() == SUMO_TAG_TAZSINK) {
919 showHierarchicalElementChildren(TAZSink, item);
920 }
921 }
922 }
923 // insert child demand elements
924 for (const auto& demandElement : hierarchicalElement->getHierarchicalElement()->getChildDemandElements()) {
925 showHierarchicalElementChildren(demandElement, item);
926 }
927 // insert child data elements
928 if (hierarchicalElement->getHierarchicalElement()->getChildGenericDatas().size() > 0) {
929 // insert intermediate list item
930 FXTreeItem* dataElements = addListItem(item, TL("Data elements"), GUIIconSubSys::getIcon(GUIIcon::SUPERMODEDATA), false);
931 for (const auto& genericDatas : hierarchicalElement->getHierarchicalElement()->getChildGenericDatas()) {
932 showHierarchicalElementChildren(genericDatas, dataElements);
933 }
934 }
935 // data sets
936 if (hierarchicalElement->getTagProperty()->getTag() == SUMO_TAG_DATASET) {
937 GNEDataSet* dataSet = attributeCarriers->retrieveDataSet(hierarchicalElement->getID(), false);
938 if (dataSet) {
939 // iterate over intervals
940 for (const auto& interval : dataSet->getDataIntervalChildren()) {
941 showHierarchicalElementChildren(interval.second, item);
942 }
943 }
944 }
945 // data interval
946 if (hierarchicalElement->getTagProperty()->getTag() == SUMO_TAG_DATAINTERVAL) {
947 auto dataInterval = attributeCarriers->retrieveDataInterval(hierarchicalElement, false);
948 if (dataInterval) {
949 // iterate over generic datas
950 for (const auto& genericData : dataInterval->getGenericDataChildren()) {
951 showHierarchicalElementChildren(genericData, item);
952 }
953 }
954 } else if (hierarchicalElement->getHierarchicalElement()->getChildGenericDatas().size() > 0) {
955 // insert intermediate list item
956 FXTreeItem* dataElements = addListItem(item, TL("Data elements"), GUIIconSubSys::getIcon(GUIIcon::SUPERMODEDATA), false);
957 for (const auto& genericDatas : hierarchicalElement->getHierarchicalElement()->getChildGenericDatas()) {
958 showHierarchicalElementChildren(genericDatas, dataElements);
959 }
960 }
961}
962
963
964FXTreeItem*
965GNEElementTree::addListItem(GNEAttributeCarrier* AC, FXTreeItem* itemParent, std::string prefix, std::string sufix) {
966 if (AC) {
967 // insert item in Tree list
968 FXTreeItem* item = myTreeListDynamic->appendItem(itemParent, (prefix + AC->getHierarchyName() + sufix).c_str(), AC->getACIcon());
969 // insert item in map
970 myTreeItemToACMap[item] = AC;
971 // by default item is expanded
972 item->setExpanded(true);
973 // return created FXTreeItem
974 return item;
975 } else {
976 return nullptr;
977 }
978}
979
980
981FXTreeItem*
982GNEElementTree::addListItem(FXTreeItem* itemParent, const std::string& text, FXIcon* icon, bool expanded) {
983 if (itemParent) {
984 // insert item in Tree list
985 FXTreeItem* item = myTreeListDynamic->appendItem(itemParent, text.c_str(), icon);
986 // expand item depending of flag expanded
987 item->setExpanded(expanded);
988 // return created FXTreeItem
989 return item;
990 } else {
991 return nullptr;
992 }
993}
994
995
996bool
998 const auto& editModes = myFrameParent->getViewNet()->getEditModes();
999 const auto tagProperty = AC->getTagProperty();
1000 if (editModes.isCurrentSupermodeNetwork()) {
1001 if (tagProperty->isNetworkElement() || tagProperty->isAdditionalElement()) {
1002 return true;
1003 } else if ((tagProperty->getTag() == SUMO_TAG_TAZSOURCE) || (tagProperty->getTag() == SUMO_TAG_TAZSINK)) {
1004 return true;
1005 } else {
1006 return false;
1007 }
1008 } else if (editModes.isCurrentSupermodeDemand() &&
1009 tagProperty->isDemandElement()) {
1010 return true;
1011 } else if (editModes.isCurrentSupermodeData() &&
1012 (tagProperty->isDataElement() || tagProperty->isMeanData())) {
1013 return true;
1014 } else {
1015 return false;
1016 }
1017}
1018
1019/****************************************************************************/
FXDEFMAP(GNEElementTree) HierarchicalElementTreeMap[]
@ MID_GNE_DELETE
delete element
@ MID_GNE_CENTER
center element
@ MID_GNE_ACHIERARCHY_SHOWCHILDMENU
In GNEElementTree list, show child menu.
@ MID_GNE_ACHIERARCHY_MOVEUP
In GNEElementTree list, move element to up.
@ MID_GNE_INSPECT
inspect element
@ MID_GNE_ACHIERARCHY_MOVEDOWN
In GNEElementTree list, move element to down.
#define GUIDesignTreeListFixedHeight
tree list with fixed height
Definition GUIDesigns.h:696
@ SUPERMODEDATA
@ RECENTERVIEW
#define WRITE_WARNINGF(...)
Definition MsgHandler.h:299
#define TL(string)
Definition MsgHandler.h:316
#define TLF(string,...)
Definition MsgHandler.h:318
@ SUMO_TAG_EDGEREL
a relation between two edges
@ SUMO_TAG_DATAINTERVAL
@ SUMO_TAG_VTYPE
description of a vehicle/person/container type
@ SUMO_TAG_TAZSINK
a sink within a district (connection road)
@ 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_TAZSOURCE
a source within a district (connection road)
@ SUMO_TAG_EDGE
begin/end of the description of an edge
@ 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:57
FXIcon * getACIcon() const
get FXIcon associated to this AC
const std::string getID() const override
get ID (all Attribute Carriers have one)
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 GNEHierarchicalElement * getHierarchicalElement()=0
methods to retrieve the elements linked to this AttributeCarrier
virtual std::string getHierarchyName() const =0
get Hierarchy Name (Used in AC Hierarchy)
virtual std::string getAttribute(SumoXMLAttr key) const =0
virtual GUIGlObject * getGUIGlObject()=0
get GUIGlObject associated with this AttributeCarrier
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"
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
GNEJunction * getFromJunction() const
get from Junction (only used to increase readability)
Definition GNEEdge.h:87
GNEJunction * getToJunction() const
get from Junction (only used to increase readability)
Definition GNEEdge.h:92
long onKeyPressItem(FXObject *, FXSelector, void *data)
called when user press a key over the list of children (Enter: inspect, Ctrl+Enter: center)
std::set< FXTreeItem * > myTreeItemsConnections
set used to save tree items without AC assigned, the Incoming/Outcoming connections
bool isSupermodeValid(const GNEAttributeCarrier *AC) const
check if current supermode is valid for select/remove the given AC
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)
GNEFrame * myFrameParent
frame Parent
GNEAttributeCarrier * myHierarchicalElement
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
GNETAZSourceSink * myClickedTAZSourceSink
sourceSink (casted from myClickedAC)
void hideHierarchicalElementTree()
hide GNEElementTree
GNEAdditional * myClickedAdditional
additional (casted from myClickedAC)
void setClickedAC(GNEAttributeCarrier *clickedAC)
set myClickedAC and cast it to all myClicked* elements
MFXTreeListDynamic * myTreeListDynamic
tree list dynamic to show the children of the element to erase
bool canBeCentered(const GNEAttributeCarrier *AC) const
check if the given AC can be centered in the view
GNEDemandElement * myClickedDemandElement
demand element (casted from myClickedAC)
GNEJunction * myClickedJunction
junction (casted from myClickedAC)
void showHierarchicalElementChildren(GNEAttributeCarrier *hierarchicalElement, FXTreeItem *itemParent)
show children of given hierarchical element
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
GNEViewNet * getViewNet() const
get view net
Definition GNEFrame.cpp:145
GNEDataInterval * getDataIntervalParent() const
get data interval parent
GNEGroupBoxModule (based on FXGroupBox)
const GNEHierarchicalContainerChildren< GNEEdge * > & getChildEdges() const
get child edges
const GNEHierarchicalContainerParents< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const GNEHierarchicalContainerParents< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
const GNEHierarchicalContainerParents< GNEEdge * > & getParentEdges() const
get parent edges
const GNEHierarchicalContainerChildren< GNEGenericData * > & getChildGenericDatas() const
return child generic data elements
const GNEHierarchicalContainerChildren< GNELane * > & getChildLanes() const
get child lanes
const GNEHierarchicalContainerChildren< GNEAdditional * > & getChildAdditionals() const
return child additionals
const GNEHierarchicalContainerChildrenSet< GNETAZSourceSink * > & getChildTAZSourceSinks() const
return child TAZSourceSinks (Set)
const GNEHierarchicalContainerChildren< GNEJunction * > & getChildJunctions() const
get child junctions
const GNEHierarchicalContainerParents< GNEJunction * > & getParentJunctions() const
get parent junctions
const GNEHierarchicalContainerParents< GNELane * > & getParentLanes() const
get parent lanes
const GNEHierarchicalContainerChildren< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
void clearInspection()
clear inspection
void inspectElement(GNEAttributeCarrier *AC, GNEAttributeCarrier *previousInspectedAC=nullptr)
Inspect a single element.
const std::vector< GNECrossing * > & getGNECrossings() const
Returns GNECrossings.
std::vector< GNEConnection * > getGNEOutcomingConnections()
returns a vector with the outgoing GNEConnections of this lane
Definition GNELane.cpp:1964
std::vector< GNEConnection * > getGNEIncomingConnections()
returns a vector with the incoming GNEConnections of this lane
Definition GNELane.cpp:1943
GNEEdge * getParentEdge() const
get parent edge
Definition GNELane.cpp:216
void deleteEdge(GNEEdge *edge, GNEUndoList *undoList, bool recomputeConnections)
removes edge
Definition GNENet.cpp:485
void deleteLane(GNELane *lane, GNEUndoList *undoList, bool recomputeConnections)
removes lane
Definition GNENet.cpp:664
void deleteCrossing(GNECrossing *crossing, GNEUndoList *undoList)
remove crossing
Definition GNENet.cpp:721
void deleteAdditional(GNEAdditional *additional, GNEUndoList *undoList)
remove additional
Definition GNENet.cpp:739
void deleteDemandElement(GNEDemandElement *demandElement, GNEUndoList *undoList)
remove demand element
Definition GNENet.cpp:773
void deleteDataInterval(GNEDataInterval *dataInterval, GNEUndoList *undoList)
remove data interval
Definition GNENet.cpp:812
void deleteConnection(GNEConnection *connection, GNEUndoList *undoList)
remove connection
Definition GNENet.cpp:706
void deleteGenericData(GNEGenericData *genericData, GNEUndoList *undoList)
remove generic data
Definition GNENet.cpp:825
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:174
void deleteTAZSourceSink(GNETAZSourceSink *TAZSourceSink, GNEUndoList *undoList)
remove TAZSourceSink
Definition GNENet.cpp:764
void deleteDataSet(GNEDataSet *dataSet, GNEUndoList *undoList)
remove data set
Definition GNENet.cpp:799
void deleteJunction(GNEJunction *junction, GNEUndoList *undoList)
removes junction and all incident edges
Definition GNENet.cpp:438
std::string getHierarchyName() const override
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
network elements
bool isDataElement() const
return true if tag correspond to a data element
bool isType() const
demand elements
bool isDistributionReference() const
return true if tag correspond to a dstribution reference element
bool isDistribution() const
return true if tag correspond to a distribution element
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
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
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
static FXMenuCommand * buildFXMenuCommandShortcut(FXComposite *p, const std::string &text, const std::string &shortcut, const std::string &info, FXIcon *icon, FXObject *tgt, FXSelector sel)
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
MFXTreeListDynamic.
void show()
Show MFXTreeListDynamic.
void clearItems()
clear items
FXTreeItem * appendItem(FXTreeItem *father, const FXString &text, FXIcon *oi, FXColor tColor=GUIDesignTextColorBlack)
append item with given text and icon
FXTreeItem * getCurrentItem() const
Get current item (the one with keyboard focus), if any.
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.