Path: blob/main/src/netedit/frames/common/GNEDeleteFrame.h
169684 views
/****************************************************************************/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 GNEDeleteFrame.h14/// @author Pablo Alvarez Lopez15/// @date Dec 201616///17// The Widget for remove network-elements18/****************************************************************************/19#pragma once20#include <config.h>2122#include <netedit/GNEViewNetHelper.h>23#include <netedit/frames/GNEFrame.h>2425// ===========================================================================26// class declaration27// ===========================================================================2829class GNEHierarchicalElement;3031// ===========================================================================32// class definitions33// ===========================================================================3435class GNEDeleteFrame : public GNEFrame {3637public:3839// ===========================================================================40// class DeleteOptions41// ===========================================================================4243class DeleteOptions : public MFXGroupBoxModule {44/// @brief FOX-declaration45FXDECLARE(GNEDeleteFrame::DeleteOptions)4647public:48/// @brief constructor49DeleteOptions(GNEDeleteFrame* deleteFrameParent);5051/// @brief destructor52~DeleteOptions();5354/// @brief check if only delete geometry points checkbox is enabled55bool deleteOnlyGeometryPoints() const;5657/// @name FOX-callbacks58/// @{59/// @brief Called when user change an option60long onCmdSetOption(FXObject*, FXSelector, void*);6162/// @}6364protected:65/// @brief FOX need this66FOX_CONSTRUCTOR(DeleteOptions)6768private:69/// @brief delete frame parent70GNEDeleteFrame* myDeleteFrameParent;7172/// @brief checkbox for enable/disable delete only geometry points73FXCheckButton* myDeleteOnlyGeometryPoints;74};7576// ===========================================================================77// class ProtectElements78// ===========================================================================7980class ProtectElements : public MFXGroupBoxModule {81/// @brief FOX-declaration82FXDECLARE(GNEDeleteFrame::ProtectElements)8384public:85/// @brief constructor86ProtectElements(GNEDeleteFrame* deleteFrameParent);8788/// @brief destructor89~ProtectElements();9091/// @brief get delete frame parent92GNEDeleteFrame* getDeleteFrameParent() const;9394/// @brief check if protect additional elements checkbox is enabled95bool protectAdditionals() const;9697/// @brief check if protect TAZ elements checkbox is enabled98bool protectTAZs() const;99100/// @brief check if protect demand elements checkbox is enabled101bool protectDemandElements() const;102103/// @brief check if protect generic datas checkbox is enabled104bool protectGenericDatas() const;105106/// @name FOX-callbacks107/// @{108/// @brief protect all elements109long onCmdProtectAll(FXObject*, FXSelector, void*);110111/// @brief unprotect all elements112long onCmdUnprotectAll(FXObject*, FXSelector, void*);113114/// @brief update protect all elements115long onUpdProtectAll(FXObject*, FXSelector, void*);116117/// @brief update unprotect all elements118long onUpdUnprotectAll(FXObject*, FXSelector, void*);119120/// @}121122protected:123/// @brief FOX need this124FOX_CONSTRUCTOR(ProtectElements)125126private:127/// @brief pointer to delete frame parent128GNEDeleteFrame* myDeleteFrameParent = nullptr;129130/// @brief protect all button131FXButton* myProtectAllButton = nullptr;132133/// @brief unprotect all button134FXButton* myUnprotectAllButton = nullptr;135136/// @brief checkbox for enable/disable protect additionals137FXCheckButton* myProtectAdditionals = nullptr;138139/// @brief checkbox for enable/disable protect TAZs140FXCheckButton* myProtectTAZs = nullptr;141142/// @brief checkbox for enable/disable protect demand elements143FXCheckButton* myProtectDemandElements = nullptr;144145/// @brief checkbox for enable/disable protect generic datas146FXCheckButton* myProtectGenericDatas = nullptr;147148/// @brief Invalidated copy constructor.149ProtectElements(const ProtectElements&) = delete;150151/// @brief Invalidated assignment operator.152ProtectElements& operator=(const ProtectElements&) = delete;153};154155/// @brief struct for saving subordinated elements (Junction->Edge->Lane->(Additional | DemandElement)156class SubordinatedElements {157158public:159/// @brief constructor (for junctions)160SubordinatedElements(const GNEJunction* junction);161162/// @brief constructor (for edges)163SubordinatedElements(const GNEEdge* edge);164165/// @brief constructor (for lanes)166SubordinatedElements(const GNELane* lane);167168/// @brief constructor (for additionals)169SubordinatedElements(const GNEAdditional* additional);170171/// @brief constructor (for demandElements)172SubordinatedElements(const GNEDemandElement* demandElement);173174/// @brief constructor (for shapes)175SubordinatedElements(const GNEGenericData* genericData);176177/// @brief destructor178~SubordinatedElements();179180/// @brief if element can be removed181bool checkElements(const ProtectElements* protectElements);182183protected:184/// @brief parent of SubordinatedElements185const GNEAttributeCarrier* myAttributeCarrier;186187/// @brief pointer to view net188GNEViewNet* myViewNet;189190/// @brief parent additionals (except TAZs)191size_t myAdditionalParents;192193/// @brief child additional (except TAZs)194size_t myAdditionalChilds;195196/// @brief parent demand elements197size_t myDemandElementParents;198199/// @brief child demand elements200size_t myDemandElementChilds;201202/// @brief parent demand elements203size_t myGenericDataParents;204205/// @brief child demand elements206size_t myGenericDataChilds;207208private:209// default constructor for non-net elements210SubordinatedElements(const GNEAttributeCarrier* attributeCarrier, GNEViewNet* viewNet);211212// default constructor for Net Elements213SubordinatedElements(const GNEAttributeCarrier* attributeCarrier, GNEViewNet* viewNet, const GNEHierarchicalElement* hierarchicalElement);214215/// @brief add in originalSE the values of newSE216void addValuesFromSubordinatedElements(SubordinatedElements* originalSE, const SubordinatedElements& newSE);217218// @brief open warning dialog219void openWarningDialog(const std::string& elementType, const size_t number, const bool isChild, const bool runningInternalTests);220221/// @brief Invalidated copy constructor.222SubordinatedElements(const SubordinatedElements&) = delete;223224/// @brief Invalidated assignment operator.225SubordinatedElements& operator=(const SubordinatedElements&) = delete;226};227228/**@brief Constructor229* @brief viewParent GNEViewParent in which this GNEFrame is placed230* @brief viewNet viewNet that uses this GNEFrame231*/232GNEDeleteFrame(GNEViewParent* viewParent, GNEViewNet* viewNet);233234/// @brief Destructor235~GNEDeleteFrame();236237/// @brief show delete frame238void show();239240/// @brief hide delete frame241void hide();242243/// @brief remove selected attribute carriers (element)244void removeSelectedAttributeCarriers();245246/**@brief remove attribute carrier (element)247* @param viewObjects objects under cursors248*/249void removeAttributeCarrier(const GNEViewNetHelper::ViewObjectsSelector& viewObjects);250251/**@brief remove geometry point252* @param viewObjects objects under cursors253*/254bool removeGeometryPoint(const GNEViewNetHelper::ViewObjectsSelector& viewObjects);255256/// @brief get delete options modul257DeleteOptions* getDeleteOptions() const;258259/// @brief get protect elements modul260ProtectElements* getProtectElements() const;261262protected:263/// @brief check if there is selected ACs to delete264bool selectedACsToDelete() const;265266private:267/// @brief modul for delete options268DeleteOptions* myDeleteOptions = nullptr;269270/// @brief modul for protect elements271ProtectElements* myProtectElements = nullptr;272};273274275