Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/changes/GNEChange_TLS.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 GNEChange_TLS.h
15
/// @author Jakob Erdmann
16
/// @date July 2011
17
///
18
// A network change in which a traffic light is created or deleted
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include "GNEChange.h"
24
25
class GNEJunction;
26
27
// ===========================================================================
28
// class definitions
29
// ===========================================================================
30
/**
31
* @class GNEChange_TLS
32
* A network change in which a traffic light is created or deleted
33
*/
34
class GNEChange_TLS : public GNEChange {
35
FXDECLARE_ABSTRACT(GNEChange_TLS)
36
37
public:
38
/**@brief Constructor for creating/deleting a TLS
39
* @param[in] junction The junction to which the traffic light belong
40
* @param[in] tlDef The traffic light definition (may be 0 on creation)
41
* @param[in] forward Whether to create/delete (true/false)
42
* @param[in] tlID The id for the newly created tlDef (set to junction id if * "" is given)
43
*/
44
GNEChange_TLS(GNEJunction* junction, NBTrafficLightDefinition* tlDef, bool forward, bool forceInsert = false, const std::string tlID = "");
45
46
/**@brief Constructor for creating/deleting a TLS
47
* @param[in] junction The junction to which the traffic light belong
48
* @param[in] tlDef The traffic light definition (may be 0 on creation)
49
* @param[in] forward Whether to create/delete (true/false)
50
* @param[in] tlID The id for the newly created tlDef (set to junction id if * "" is given)
51
* @param[in] type TrafficLightType
52
*/
53
GNEChange_TLS(GNEJunction* junction, NBTrafficLightDefinition* tlDef, bool forward, TrafficLightType type,
54
bool forceInsert = false, const std::string tlID = "");
55
56
/**@brief Constructor for renaming a TLS
57
* @param[in] junction The junction to which the traffic light belong
58
* @param[in] tlDef The traffic light definition (may be 0 on creation)
59
* @param[in] newID new TL ID
60
*/
61
GNEChange_TLS(GNEJunction* junction, NBTrafficLightDefinition* tlDef, const std::string& newID);
62
63
/// @brief Destructor
64
~GNEChange_TLS();
65
66
/// @name inherited from GNEChange
67
/// @{
68
/// @brief get undo Name
69
std::string undoName() const;
70
71
/// @brief get Redo name
72
std::string redoName() const;
73
74
/// @brief undo action
75
void undo();
76
77
/// @brief redo action
78
void redo();
79
80
/// @}
81
82
private:
83
/**@brief we need the junction because it is the target of our change commands
84
* @note we assume shared responsibilty for the junction via reference counting
85
*/
86
GNEJunction* myJunction;
87
88
/**@brief the traffic light to be created/deleted. We assume no responsibility for the pointer
89
* @note since it is hard to track by which NBnodes a tlDef is used (may be more than one).
90
*/
91
NBTrafficLightDefinition* myTlDef;
92
93
/// @brief check if forceInsert is enabled
94
const bool myForceInsert;
95
96
/// @brief variables used for renaming TLS
97
const std::string myOldID;
98
const std::string myNewID;
99
};
100
101