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 
31 
32 #include "GNEChange_Crossing.h"
33 #include "GNENet.h"
34 #include "GNEViewNet.h"
35 #include "GNECrossing.h"
36 #include "GNEJunction.h"
37 
38 
39 // ===========================================================================
40 // FOX-declarations
41 // ===========================================================================
42 FXIMPLEMENT_ABSTRACT(GNEChange_Crossing, GNEChange, NULL, 0)
43 
44 // ===========================================================================
45 // member method definitions
46 // ===========================================================================
47 
48 
49 GNEChange_Crossing::GNEChange_Crossing(GNEJunction* junctionParent, const std::vector<NBEdge*>& edges, double width, bool priority, bool forward):
51  GNEChange(junctionParent->getNet(), forward),
52  myJunctionParent(junctionParent),
53  myEdges(edges),
54  myWidth(width),
55  myPriority(priority) {
56  assert(myNet);
57 }
58 
59 
61 
62 
64  if (myForward) {
65  // show extra information for tests
67  WRITE_WARNING("Deleting " + toString(SUMO_TAG_CROSSING) + " from '" + myJunctionParent->getID() + "'");
68  }
69  // remove crossing of NBNode and update geometry
72  // Update view
73  myNet->getViewNet()->update();
74  } else {
75  // show extra information for tests
77  WRITE_WARNING("Deleting " + toString(SUMO_TAG_CROSSING) + " from '" + myJunctionParent->getID() + "'");
78  }
79  // add crossing of NBNode and update geometry
82  // Update view
83  myNet->getViewNet()->update();
84  }
85 }
86 
87 
89  if (myForward) {
90  // show extra information for tests
92  WRITE_WARNING("Deleting " + toString(SUMO_TAG_CROSSING) + " from '" + myJunctionParent->getID() + "'");
93  }
94  // add crossing of NBNode and update geometry
97  // Update view
98  myNet->getViewNet()->update();
99  } else {
100  // show extra information for tests
102  WRITE_WARNING("Deleting " + toString(SUMO_TAG_CROSSING) + " from '" + myJunctionParent->getID() + "'");
103  }
104  // remove crossing of NBNode and update geometry
107  // Update view
108  myNet->getViewNet()->update();
109  }
110 }
111 
112 
113 FXString
115  if (myForward) {
116  return ("Undo create " + toString(SUMO_TAG_CROSSING)).c_str();
117  } else {
118  return ("Undo delete " + toString(SUMO_TAG_CROSSING)).c_str();
119  }
120 }
121 
122 
123 FXString
125  if (myForward) {
126  return ("Redo create " + toString(SUMO_TAG_CROSSING)).c_str();
127  } else {
128  return ("Redo delete " + toString(SUMO_TAG_CROSSING)).c_str();
129  }
130 }
the function-object for an editing operation (abstract base)
Definition: GNEChange.h:49
GNENet * getNet() const
get Net in which this element is placed
The representation of a single edge during network building.
Definition: NBEdge.h:71
void redo()
redo action
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:200
bool isTestingModeEnabled() const
check if netedit is running in testing mode
Definition: GNEViewNet.cpp:405
void removeCrossing(const EdgeVector &edges)
remove a pedestrian crossing from this node (identified by its edges)
Definition: NBNode.cpp:2553
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:56
const std::string getID() const
function to support debugging
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
FXString undoName() const
return undoName
void updateGeometry()
Update the boundary of the junction.
Definition: GNEJunction.cpp:87
~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
void addCrossing(EdgeVector edges, double width, bool priority, bool fromSumoNet=false)
add a pedestrian crossing to this node
Definition: NBNode.cpp:2544
double myWidth
width of GNECrossing
NBNode * getNBNode() const
Return net build node.
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1165
FXString redoName() const
get Redo name