/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file GNEElementTree.h14/// @author Pablo Alvarez Lopez15/// @date Mar 202216///17// Frame for show hierarchical elements18/****************************************************************************/19#pragma once20#include <config.h>2122#include <utils/foxtools/MFXGroupBoxModule.h>23#include <utils/foxtools/MFXTreeListDynamic.h>2425// ===========================================================================26// class declaration27// ===========================================================================2829class GNEAdditional;30class GNEConnection;31class GNECrossing;32class GNEDataInterval;33class GNEDataSet;34class GNEDataSet;35class GNEDemandElement;36class GNEEdge;37class GNEFrame;38class GNEGenericData;39class GNEJunction;40class GNELane;41class GNETAZSourceSink;4243// ===========================================================================44// class definitions45// ===========================================================================4647class GNEElementTree : public MFXGroupBoxModule {48/// @brief FOX-declaration49FXDECLARE(GNEElementTree)5051public:52/// @brief constructor53GNEElementTree(GNEFrame* frameParent);5455/// @brief destructor56~GNEElementTree();5758/// @brief show GNEElementTree59void showHierarchicalElementTree(GNEAttributeCarrier* AC);6061/// @brief hide GNEElementTree62void hideHierarchicalElementTree();6364/// @brief refresh GNEElementTree65void refreshHierarchicalElementTree();6667/// @brief if given AttributeCarrier is the same of myHE, set it as nullptr68void removeCurrentEditedAttributeCarrier(const GNEAttributeCarrier* HE);6970/// @name FOX-callbacks71/// @{72/// @brief called when user press right click over an item of list of children73long onCmdShowChildMenu(FXObject*, FXSelector, void* data);7475/// @brief called when user click over option "center" of child Menu76long onCmdCenterItem(FXObject*, FXSelector, void*);7778/// @brief called when user click over option "inspect" of child menu79long onCmdInspectItem(FXObject*, FXSelector, void*);8081/// @brief called when user click over option "delete" of child menu82long onCmdDeleteItem(FXObject*, FXSelector, void*);8384/// @brief called when user click over option "Move up" of child menu85long onCmdMoveItemUp(FXObject*, FXSelector, void*);8687/// @brief called when user click over option "Move down" of child menu88long onCmdMoveItemDown(FXObject*, FXSelector, void*);89/// @}9091protected:92FOX_CONSTRUCTOR(GNEElementTree)9394// @brief create pop-up menu in the positions X-Y for the clicked attribute carrier95void createPopUpMenu(int X, int Y, GNEAttributeCarrier* clickedAC);9697/// @brief show child of current attributeCarrier98FXTreeItem* showAttributeCarrierParents();99100/// @brief show children of given hierarchical element101void showHierarchicalElementChildren(GNEAttributeCarrier* hierarchicalElement, FXTreeItem* itemParent);102103/// @brief add item into list104FXTreeItem* addListItem(GNEAttributeCarrier* AC, FXTreeItem* itemParent = nullptr, std::string prefix = "", std::string sufix = "");105106/// @brief add item into list107FXTreeItem* addListItem(FXTreeItem* itemParent, const std::string& text, FXIcon* icon, bool expanded);108109/// @brief check if current supermode is valid for select/remove the given AC110bool isSupermodeValid(const GNEAttributeCarrier* AC) const;111112private:113/// @brief frame Parent114GNEFrame* myFrameParent;115116/// @brief hierarchical element117GNEAttributeCarrier* myHierarchicalElement = nullptr;118119/// @brief pointer to current clicked Attribute Carrier120GNEAttributeCarrier* myClickedAC = nullptr;121122/// @brief junction (casted from myClickedAC)123GNEJunction* myClickedJunction = nullptr;124125/// @brief edge (casted from myClickedAC)126GNEEdge* myClickedEdge = nullptr;127128/// @brief lane (casted from myClickedAC)129GNELane* myClickedLane = nullptr;130131/// @brief crossing (casted from myClickedAC)132GNECrossing* myClickedCrossing = nullptr;133134/// @brief junction (casted from myClickedAC)135GNEConnection* myClickedConnection = nullptr;136137/// @brief additional (casted from myClickedAC)138GNEAdditional* myClickedAdditional = nullptr;139140/// @brief sourceSink (casted from myClickedAC)141GNETAZSourceSink* myClickedTAZSourceSink = nullptr;142143/// @brief demand element (casted from myClickedAC)144GNEDemandElement* myClickedDemandElement = nullptr;145146/// @brief data set element (casted from myClickedAC)147GNEDataSet* myClickedDataSet = nullptr;148149/// @brief data interval element (casted from myClickedAC)150GNEDataInterval* myClickedDataInterval = nullptr;151152/// @brief generic data element (casted from myClickedAC)153GNEGenericData* myClickedGenericData = nullptr;154155/// @brief tree list dynamic to show the children of the element to erase156MFXTreeListDynamic* myTreeListDynamic = nullptr;157158/// @brief map used to save the FXTreeItems items with their vinculated AC159std::map<FXTreeItem*, GNEAttributeCarrier*> myTreeItemToACMap;160161/// @brief set used to save tree items without AC assigned, the Incoming/Outcoming connections162std::set<FXTreeItem*> myTreeItemsConnections;163};164165166