Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/tools/GNEPythonTool.h
169678 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2025 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
/****************************************************************************/
14
/// @file GNEPythonTool.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Jun 2022
17
///
18
// Python tools used in netedit
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include <utils/foxtools/fxheader.h>
24
#include <utils/options/OptionsCont.h>
25
26
// ===========================================================================
27
// class declarations
28
// ===========================================================================
29
30
class GNEApplicationWindow;
31
32
// ===========================================================================
33
// class definitions
34
// ===========================================================================
35
36
class GNEPythonTool {
37
38
public:
39
/// @brief Constructor
40
GNEPythonTool(GNEApplicationWindow* applicationWindow, const std::string& toolPath,
41
const std::string& templateStr, FXMenuPane* menu);
42
43
/// @brief destructor
44
virtual ~GNEPythonTool();
45
46
/// @brief get tool name
47
const std::string& getToolName() const;
48
49
/// @brief get tools options
50
OptionsCont& getToolsOptions();
51
52
/// @brief get menu command
53
FXMenuCommand* getMenuCommand() const;
54
55
/// @brief set current values (used for set values like current folder and similar)
56
virtual void setCurrentValues();
57
58
/// @brief execute post processing
59
virtual void postProcessing();
60
61
/// @brief get command (python + script + arguments)
62
virtual std::string getCommand() const;
63
64
/// @brief get default value of the given parameter
65
const std::string getDefaultValue(const std::string& name) const;
66
67
/// @brief load configuration
68
bool loadConfiguration(const std::string& file);
69
70
/// @brief save configuration
71
void saveConfiguration(const std::string& file) const;
72
73
protected:
74
/// @brief application window
75
GNEApplicationWindow* myApplicationWindow = nullptr;
76
77
/// @brief menu command associated with this tool
78
FXMenuCommand* myMenuCommand = nullptr;
79
80
/// @brief tools options
81
OptionsCont myPythonToolsOptions;
82
83
/// @brief original tools options
84
OptionsCont myPythonToolsOptionsOriginal;
85
86
/// @brief python tool path relative to SUMO_HOME
87
const std::string myToolPath;
88
89
/// @brief tool name
90
const std::string myPythonToolName;
91
92
/// @brief get command (python + script)
93
std::string getCommandPath() const;
94
95
private:
96
/// @brief Invalidated copy constructor.
97
GNEPythonTool(const GNEPythonTool&) = delete;
98
99
/// @brief Invalidated assignment operator.
100
GNEPythonTool& operator=(const GNEPythonTool&) = delete;
101
};
102
103