Eclipse SUMO - Simulation of Urban MObility
GNEChange_TLS.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2001-2024 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 /****************************************************************************/
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 // ===========================================================================
34 class GNEChange_TLS : public GNEChange {
35  FXDECLARE_ABSTRACT(GNEChange_TLS)
36 
37 public:
44  GNEChange_TLS(GNEJunction* junction, NBTrafficLightDefinition* tlDef, bool forward, bool forceInsert = false, const std::string tlID = "");
45 
53  GNEChange_TLS(GNEJunction* junction, NBTrafficLightDefinition* tlDef, bool forward, TrafficLightType type,
54  bool forceInsert = false, const std::string tlID = "");
55 
61  GNEChange_TLS(GNEJunction* junction, NBTrafficLightDefinition* tlDef, const std::string& newID);
62 
65 
69  std::string undoName() const;
70 
72  std::string redoName() const;
73 
75  void undo();
76 
78  void redo();
79 
81 
82 private:
87 
92 
94  const bool myForceInsert;
95 
97  const std::string myOldID;
98  const std::string myNewID;
99 };
TrafficLightType
GNEJunction * myJunction
we need the junction because it is the target of our change commands
Definition: GNEChange_TLS.h:86
void undo()
undo action
GNEChange_TLS(GNEJunction *junction, NBTrafficLightDefinition *tlDef, bool forward, bool forceInsert=false, const std::string tlID="")
Constructor for creating/deleting a TLS.
const std::string myNewID
Definition: GNEChange_TLS.h:98
void redo()
redo action
std::string undoName() const
return undoName
~GNEChange_TLS()
Destructor.
const std::string myOldID
variables used for renaming TLS
Definition: GNEChange_TLS.h:97
std::string redoName() const
get Redo name
NBTrafficLightDefinition * myTlDef
the traffic light to be created/deleted. We assume no responsibility for the pointer
Definition: GNEChange_TLS.h:91
const bool myForceInsert
check if forceInsert is enabled
Definition: GNEChange_TLS.h:94
the function-object for an editing operation (abstract base)
Definition: GNEChange.h:56
The base class for traffic light logic definitions.