Path: blob/main/src/netedit/dialogs/tools/GNEPythonToolDialog.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 GNEPythonToolDialog.h14/// @author Pablo Alvarez Lopez15/// @date Jun 202216///17// Dialog for tools18/****************************************************************************/19#pragma once20#include <config.h>2122#include <netedit/dialogs/GNEDialog.h>23#include <utils/options/OptionsCont.h>2425#include "GNEPythonToolDialogElements.h"2627// ===========================================================================28// class declarations29// ===========================================================================3031class GNEPythonTool;32class MFXCheckableButton;3334// ===========================================================================35// class definitions36// ===========================================================================3738class GNEPythonToolDialog : protected GNEDialog {39/// @brief FOX-declaration40FXDECLARE(GNEPythonToolDialog)4142/// @brief declare friend class43friend class GNEPythonToolDialogElements;4445public:46/// @brief Constructor47GNEPythonToolDialog(GNEApplicationWindow* applicationWindow, GNEPythonTool* tool);4849/// @brief destructor50~GNEPythonToolDialog();5152/// @brief run internal test53void runInternalTest(const InternalTestStep::DialogArgument* dialogArgument);5455/// @brief get python tool56const GNEPythonTool* getPythonTool() const;5758/// @name FOX-callbacks59/// @{6061/// @brief enable/disable show toolTip62long onCmdShowToolTipsMenu(FXObject*, FXSelector, void*);6364/// @brief save options65long onCmdSave(FXObject*, FXSelector, void*);6667/// @brief load options68long onCmdLoad(FXObject*, FXSelector, void*);6970/// @brief set visualization (sorting and grouping)71long onCmdSetVisualization(FXObject*, FXSelector, void*);7273/// @brief event after press run button74long onCmdRun(FXObject*, FXSelector, void*);7576/// @brief event after press reset button77long onCmdReset(FXObject*, FXSelector, void*);7879/// @brief event for check if required attributes was set80long onUpdRequiredAttributes(FXObject* sender, FXSelector, void*);8182/// @}8384protected:85/// @brief internal class used for sorting options by categories86class CategoryOptions : public std::string {8788public:89/// @brief constructor90CategoryOptions(const std::string& category);9192/// @brief add option93void addOption(const std::string& name, Option* option);9495/// @brief get options96const std::vector<std::pair<std::string, Option*> >& getOptions() const;9798/// @brief sort options by name99void sortByName();100101private:102/// @brief options for this category103std::vector<std::pair<std::string, Option*> > myOptions;104105/// @brief default constructor106CategoryOptions() {}107};108109/// @brief FOX needs this110FOX_CONSTRUCTOR(GNEPythonToolDialog);111112/// @brief build arguments113void buildArguments(bool sortByName, bool groupedByCategories);114115/// @brief adjust parameter column116void adjustParameterColumn();117118/// @brief custom tools options119OptionsCont myCustomToolsOptions;120121/// @brief get options122std::vector<GNEPythonToolDialog::CategoryOptions> getOptions(OptionsCont& optionsCont) const;123124/// @brief get options sorted by category125std::vector<CategoryOptions> getOptionsByCategories(OptionsCont& optionsCont) const;126127/// @brief get number of row colums128int getNumRowColums() const;129130/// @brief get argument frame left131FXVerticalFrame* getArgumentFrameLeft() const;132133/// @brief get argument frame right134FXVerticalFrame* getArgumentFrameRight() const;135136/// @brief list of arguments sorted by categories137std::vector<GNEPythonToolDialogElements::Argument*> myArguments;138139/// @brief list of categories140std::vector<GNEPythonToolDialogElements::Category*> myCategories;141142private:143/// @brief menu for tooltips menu144MFXCheckableButton* myShowToolTipsMenu = nullptr;145146/// @brief check button to enable/diasble sorting147FXCheckButton* mySortedCheckButton = nullptr;148149/// @brief check button to enable/diasble grouping150FXCheckButton* myGroupedCheckButton = nullptr;151152/// @brief argument frame left153FXVerticalFrame* myArgumentFrameLeft = nullptr;154155/// @brief argument frame right156FXVerticalFrame* myArgumentFrameRight = nullptr;157158/// @brief python tool159GNEPythonTool* myPythonTool = nullptr;160161/// @brief Invalidated copy constructor.162GNEPythonToolDialog(const GNEPythonToolDialog&) = delete;163164/// @brief Invalidated assignment operator.165GNEPythonToolDialog& operator=(const GNEPythonToolDialog&) = delete;166};167168169