SUMO - Simulation of Urban MObility
GNEChange_Connection.cpp
Go to the documentation of this file.
1 /****************************************************************************/
7 // A network change in which a single connection is created or deleted
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #ifdef _MSC_VER
25 #include <windows_config.h>
26 #else
27 #include <config.h>
28 #endif
29 
30 #include <cassert>
31 #include "GNEChange_Connection.h"
32 #include "GNEEdge.h"
33 
34 #ifdef CHECK_MEMORY_LEAKS
35 #include <foreign/nvwa/debug_new.h>
36 #endif
37 
38 
39 // ===========================================================================
40 // FOX-declarations
41 // ===========================================================================
42 FXIMPLEMENT_ABSTRACT(GNEChange_Connection, GNEChange, NULL, 0)
43 
44 // ===========================================================================
45 // member method definitions
46 // ===========================================================================
47 
48 
49 // Constructor for creating an edge
51  const std::string& toEdgeID, int toLane,
52  bool mayDefinitelyPass, bool forward):
53  GNEChange(0, forward),
54  myEdge(edge),
55  myFromLane(fromLane),
56  myToEdgeID(toEdgeID),
57  myToLane(toLane),
58  myPass(mayDefinitelyPass) {
59  myEdge->incRef("GNEChange_Connection");
60 }
61 
62 
64  assert(myEdge);
65  myEdge->decRef("GNEChange_Connection");
66  if (myEdge->unreferenced()) {
67  delete myEdge;
68  }
69 }
70 
71 
73  if (myForward) {
75  } else {
77  }
78 }
79 
80 
82  if (myForward) {
84  } else {
86  }
87 }
88 
89 
91  if (myForward) {
92  return ("Undo create connection");
93  } else {
94  return ("Undo delete connection");
95  }
96 }
97 
98 
100  if (myForward) {
101  return ("Redo create connection");
102  } else {
103  return ("Redo delete connection");
104  }
105 }
the function-object for an editing operation (abstract base)
Definition: GNEChange.h:49
int myToLane
the target lane of the connection
void addConnection(int fromLane, const std::string &toEdgeID, int toLane, bool mayPass)
adds a connection
Definition: GNEEdge.cpp:793
~GNEChange_Connection()
Destructor.
FXString undoName() const
return undoName
void decRef(const std::string &debugMsg="")
const std::string myToEdgeID
the id of the target edge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:54
bool myForward
we group antagonistic commands (create junction/delete junction) and keep them apart by this flag ...
Definition: GNEChange.h:87
void removeConnection(int fromLane, const std::string &toEdgeID, int toLane)
removes a connection
Definition: GNEEdge.cpp:801
bool myPass
whether this connection never yields
FXString redoName() const
get Redo name
int myFromLane
the lane from which the connection originates