Path: blob/main/src/netedit/frames/common/GNEDeleteFrame.h
194318 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2026 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>24#include <netedit/frames/common/GNEGroupBoxModule.h>2526// ===========================================================================27// class declaration28// ===========================================================================2930class GNEHierarchicalElement;3132// ===========================================================================33// class definitions34// ===========================================================================3536class GNEDeleteFrame : public GNEFrame {3738public:3940// ===========================================================================41// class DeleteOptions42// ===========================================================================4344class DeleteOptions : public GNEGroupBoxModule {45/// @brief FOX-declaration46FXDECLARE(GNEDeleteFrame::DeleteOptions)4748public:49/// @brief constructor50DeleteOptions(GNEDeleteFrame* deleteFrameParent);5152/// @brief destructor53~DeleteOptions();5455/// @brief check if only delete geometry points checkbox is enabled56bool deleteOnlyGeometryPoints() const;5758/// @name FOX-callbacks59/// @{60/// @brief Called when user change an option61long onCmdSetOption(FXObject*, FXSelector, void*);6263/// @}6465protected:66/// @brief FOX need this67FOX_CONSTRUCTOR(DeleteOptions)6869private:70/// @brief delete frame parent71GNEDeleteFrame* myDeleteFrameParent;7273/// @brief checkbox for enable/disable delete only geometry points74FXCheckButton* myDeleteOnlyGeometryPoints;75};7677// ===========================================================================78// class ProtectElements79// ===========================================================================8081class ProtectElements : public GNEGroupBoxModule {82/// @brief FOX-declaration83FXDECLARE(GNEDeleteFrame::ProtectElements)8485public:86/// @brief constructor87ProtectElements(GNEDeleteFrame* deleteFrameParent);8889/// @brief destructor90~ProtectElements();9192/// @brief get delete frame parent93GNEDeleteFrame* getDeleteFrameParent() const;9495/// @brief check if protect additional elements checkbox is enabled96bool protectAdditionals() const;9798/// @brief check if protect TAZ elements checkbox is enabled99bool protectTAZs() const;100101/// @brief check if protect demand elements checkbox is enabled102bool protectDemandElements() const;103104/// @brief check if protect generic datas checkbox is enabled105bool protectGenericDatas() const;106107/// @name FOX-callbacks108/// @{109/// @brief protect all elements110long onCmdProtectAll(FXObject*, FXSelector, void*);111112/// @brief unprotect all elements113long onCmdUnprotectAll(FXObject*, FXSelector, void*);114115/// @brief update protect all elements116long onUpdProtectAll(FXObject*, FXSelector, void*);117118/// @brief update unprotect all elements119long onUpdUnprotectAll(FXObject*, FXSelector, void*);120121/// @}122123protected:124/// @brief FOX need this125FOX_CONSTRUCTOR(ProtectElements)126127private:128/// @brief pointer to delete frame parent129GNEDeleteFrame* myDeleteFrameParent = nullptr;130131/// @brief protect all button132FXButton* myProtectAllButton = nullptr;133134/// @brief unprotect all button135FXButton* myUnprotectAllButton = nullptr;136137/// @brief checkbox for enable/disable protect additionals138FXCheckButton* myProtectAdditionals = nullptr;139140/// @brief checkbox for enable/disable protect TAZs141FXCheckButton* myProtectTAZs = nullptr;142143/// @brief checkbox for enable/disable protect demand elements144FXCheckButton* myProtectDemandElements = nullptr;145146/// @brief checkbox for enable/disable protect generic datas147FXCheckButton* myProtectGenericDatas = nullptr;148149/// @brief Invalidated copy constructor.150ProtectElements(const ProtectElements&) = delete;151152/// @brief Invalidated assignment operator.153ProtectElements& operator=(const ProtectElements&) = delete;154};155156/// @brief struct for saving subordinated elements (Junction->Edge->Lane->(Additional | DemandElement)157class SubordinatedElements {158159public:160/// @brief constructor (for junctions)161SubordinatedElements(const GNEJunction* junction);162163/// @brief constructor (for edges)164SubordinatedElements(const GNEEdge* edge);165166/// @brief constructor (for lanes)167SubordinatedElements(const GNELane* lane);168169/// @brief constructor (for additionals)170SubordinatedElements(const GNEAdditional* additional);171172/// @brief constructor (for demandElements)173SubordinatedElements(const GNEDemandElement* demandElement);174175/// @brief constructor (for shapes)176SubordinatedElements(const GNEGenericData* genericData);177178/// @brief destructor179~SubordinatedElements();180181/// @brief if element can be removed182bool checkElements(const ProtectElements* protectElements);183184protected:185/// @brief parent of SubordinatedElements186const GNEAttributeCarrier* myAttributeCarrier;187188/// @brief pointer to view net189GNEViewNet* myViewNet;190191/// @brief parent additionals (except TAZs)192size_t myAdditionalParents;193194/// @brief child additional (except TAZs)195size_t myAdditionalChilds;196197/// @brief parent demand elements198size_t myDemandElementParents;199200/// @brief child demand elements201size_t myDemandElementChilds;202203/// @brief parent demand elements204size_t myGenericDataParents;205206/// @brief child demand elements207size_t myGenericDataChilds;208209private:210// default constructor for non-net elements211SubordinatedElements(const GNEAttributeCarrier* attributeCarrier, GNEViewNet* viewNet);212213// default constructor for Net Elements214SubordinatedElements(const GNEAttributeCarrier* attributeCarrier, GNEViewNet* viewNet, const GNEHierarchicalElement* hierarchicalElement);215216/// @brief add in originalSE the values of newSE217void addValuesFromSubordinatedElements(SubordinatedElements* originalSE, const SubordinatedElements& newSE);218219// @brief open warning dialog220void openWarningDialog(const std::string& elementType, const size_t number, const bool isChild, const bool runningInternalTests);221222/// @brief Invalidated copy constructor.223SubordinatedElements(const SubordinatedElements&) = delete;224225/// @brief Invalidated assignment operator.226SubordinatedElements& operator=(const SubordinatedElements&) = delete;227};228229/**@brief Constructor230* @brief viewParent GNEViewParent in which this GNEFrame is placed231* @brief viewNet viewNet that uses this GNEFrame232*/233GNEDeleteFrame(GNEViewParent* viewParent, GNEViewNet* viewNet);234235/// @brief Destructor236~GNEDeleteFrame();237238/// @brief show delete frame239void show();240241/// @brief hide delete frame242void hide();243244/// @brief remove selected attribute carriers (element)245void removeSelectedAttributeCarriers();246247/**@brief remove attribute carrier (element)248* @param viewObjects objects under cursors249*/250void removeAttributeCarrier(const GNEViewNetHelper::ViewObjectsSelector& viewObjects);251252/**@brief remove geometry point253* @param viewObjects objects under cursors254*/255bool removeGeometryPoint(const GNEViewNetHelper::ViewObjectsSelector& viewObjects);256257/// @brief get delete options modul258DeleteOptions* getDeleteOptions() const;259260/// @brief get protect elements modul261ProtectElements* getProtectElements() const;262263protected:264/// @brief check if there is selected ACs to delete265bool selectedACsToDelete() const;266267private:268/// @brief modul for delete options269DeleteOptions* myDeleteOptions = nullptr;270271/// @brief modul for protect elements272ProtectElements* myProtectElements = nullptr;273};274275276