SUMO - Simulation of Urban MObility
GNEChange_Crossing.cpp
Go to the documentation of this file.
1 /****************************************************************************/
7 // A network change in which a single junction 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 "GNEChange_Crossing.h"
31 #include "GNENet.h"
32 #include "GNEViewNet.h"
33 #include "GNECrossing.h"
34 #include "GNEJunction.h"
35 
36 #ifdef CHECK_MEMORY_LEAKS
37 #include <foreign/nvwa/debug_new.h>
38 #endif
39 
40 
41 // ===========================================================================
42 // FOX-declarations
43 // ===========================================================================
44 FXIMPLEMENT_ABSTRACT(GNEChange_Crossing, GNEChange, NULL, 0)
45 
46 // ===========================================================================
47 // member method definitions
48 // ===========================================================================
49 
50 
51 GNEChange_Crossing::GNEChange_Crossing(GNEJunction* junctionParent, const std::vector<NBEdge*>& edges, SUMOReal width, bool priority, bool forward):
53  GNEChange(junctionParent->getNet(), forward),
54  myJunctionParent(junctionParent),
55  myEdges(edges),
56  myWidth(width),
57  myPriority(priority) {
58  assert(myNet);
59 }
60 
61 
63 
64 
66  if (myForward) {
67  // remove crossing of NBNode and update geometry
70  // Update view
71  myNet->getViewNet()->update();
72  } else {
73  // add crossing of NBNode and update geometry
76  // Update view
77  myNet->getViewNet()->update();
78  }
79 }
80 
81 
83  if (myForward) {
84  // add crossing of NBNode and update geometry
87  // Update view
88  myNet->getViewNet()->update();
89  } else {
90  // remove crossing of NBNode and update geometry
93  // Update view
94  myNet->getViewNet()->update();
95  }
96 }
97 
98 
99 FXString
101  if (myForward) {
102  return ("Undo create " + toString(SUMO_TAG_CROSSING)).c_str();
103  } else {
104  return ("Undo delete " + toString(SUMO_TAG_CROSSING)).c_str();
105  }
106 }
107 
108 
109 FXString
111  if (myForward) {
112  return ("Redo create " + toString(SUMO_TAG_CROSSING)).c_str();
113  } else {
114  return ("Redo delete " + toString(SUMO_TAG_CROSSING)).c_str();
115  }
116 }
the function-object for an editing operation (abstract base)
Definition: GNEChange.h:49
FXString undoName() const
return undoName
The representation of a single edge during network building.
Definition: NBEdge.h:71
NBNode * getNBNode() const
Return net build node.
SUMOReal myWidth
width of GNECrossing
void redo()
redo action
void removeCrossing(const EdgeVector &edges)
remove a pedestrian crossing from this node (identified by its edges)
Definition: NBNode.cpp:2557
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:55
GNEJunction * myJunctionParent
full information regarding the Junction in which GNECRossing is created
GNENet * myNet
the net to which operations shall be applied or which shall be informed about gui updates (we are not...
Definition: GNEChange.h:82
void addCrossing(EdgeVector edges, SUMOReal width, bool priority, bool fromSumoNet=false)
add a pedestrian crossing to this node
Definition: NBNode.cpp:2548
void updateGeometry()
Update the boundary of the junction.
Definition: GNEJunction.cpp:91
~GNEChange_Crossing()
Destructor.
bool myPriority
priority of GNECrossing
std::vector< NBEdge * > myEdges
vector to save all edges of GNECrossing
crossing between edges for pedestrians
void undo()
undo action
bool myForward
we group antagonistic commands (create junction/delete junction) and keep them apart by this flag ...
Definition: GNEChange.h:87
FXString redoName() const
get Redo name
#define SUMOReal
Definition: config.h:208
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1114