Eclipse SUMO - Simulation of Urban MObility
GNEChange_TAZElement.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2020 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 single TAZElement is created or deleted
19 /****************************************************************************/
20 #include <config.h>
21 
22 #include <netedit/GNENet.h>
23 
24 #include "GNEChange_TAZElement.h"
25 
26 // ===========================================================================
27 // FOX-declarations
28 // ===========================================================================
29 FXIMPLEMENT_ABSTRACT(GNEChange_TAZElement, GNEChange, nullptr, 0)
30 
31 // ===========================================================================
32 // member method definitions
33 // ===========================================================================
34 
36  GNEChange(TAZElement, forward, TAZElement->isAttributeCarrierSelected()),
37  myTAZElement(TAZElement) {
38  myTAZElement->incRef("GNEChange_TAZElement");
39 }
40 
41 
43  myTAZElement->decRef("GNEChange_TAZElement");
44  if (myTAZElement->unreferenced()) {
45  // make sure that TAZElement are removed of TAZElementContainer (net) AND grid
47  // show extra information for tests
48  WRITE_DEBUG("Removing " + myTAZElement->getTagStr() + " '" + myTAZElement->getID() + "' from net in ~GNEChange_TAZElement()");
49  // remove TAZElement from AttributeCarreirs
51  }
52  // show extra information for tests
53  WRITE_DEBUG("delete " + myTAZElement->getTagStr() + " '" + myTAZElement->getID() + "' in ~GNEChange_TAZElement()");
54  delete myTAZElement;
55  }
56 }
57 
58 
59 void
61  if (myForward) {
62  // show extra information for tests
63  WRITE_DEBUG("Removing " + myTAZElement->getTagStr() + " '" + myTAZElement->getID() + "' from viewNet");
64  // unselect if mySelectedElement is enabled
65  if (mySelectedElement) {
67  }
68  // remove TAZElement from net
70  // restore container
72  } else {
73  // show extra information for tests
74  WRITE_DEBUG("Adding " + myTAZElement->getTagStr() + " '" + myTAZElement->getID() + "' into viewNet");
75  // select if mySelectedElement is enabled
76  if (mySelectedElement) {
78  }
79  // Add TAZElement in net
81  // restore container
83  }
84 }
85 
86 
87 void
89  if (myForward) {
90  // show extra information for tests
91  WRITE_DEBUG("Adding " + myTAZElement->getTagStr() + " '" + myTAZElement->getID() + "' into viewNet");
92  // select if mySelectedElement is enabled
93  if (mySelectedElement) {
95  }
96  // Add TAZElement in net
98  // Add element in parents and children
100  } else {
101  // show extra information for tests
102  WRITE_DEBUG("Removing " + myTAZElement->getTagStr() + " '" + myTAZElement->getID() + "' from viewNet");
103  // unselect if mySelectedElement is enabled
104  if (mySelectedElement) {
106  }
107  // remove TAZElement from net
109  // Remove element from parents and children
111  }
112 }
113 
114 
115 FXString
117  if (myForward) {
118  return ("Undo create " + myTAZElement->getTagStr()).c_str();
119  } else {
120  return ("Undo delete " + myTAZElement->getTagStr()).c_str();
121  }
122 }
123 
124 
125 FXString
127  if (myForward) {
128  return ("Redo create " + myTAZElement->getTagStr()).c_str();
129  } else {
130  return ("Redo delete " + myTAZElement->getTagStr()).c_str();
131  }
132 }
#define WRITE_DEBUG(msg)
Definition: MsgHandler.h:286
const std::string & getTagStr() const
get tag assigned to this object in string format
const GNETagProperties & getTagProperty() const
get Tag Property assigned to this object
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
GNENet * getNet() const
get pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
FXString redoName() const
get Redo name
GNETAZElement * myTAZElement
pointer to TAZElement
FXString undoName() const
return undoName
the function-object for an editing operation (abstract base)
Definition: GNEChange.h:65
bool myForward
we group antagonistic commands (create junction/delete junction) and keep them apart by this flag
Definition: GNEChange.h:215
const bool mySelectedElement
flag for check if element is selected
Definition: GNEChange.h:218
void addElementInParentsAndChildren(T *element)
add given element into parents and children (only use in redo() function)
Definition: GNEChange.h:106
void removeElementFromParentsAndChildren(T *element)
remove given element from parents and children (only use in redo() function)
Definition: GNEChange.h:161
void restoreHierarchicalContainers()
restore container (only use in undo() function)
Definition: GNEChange.cpp:82
void deleteTAZElement(GNETAZElement *TAZElement)
delete TAZElement element of GNENet container
void insertTAZElement(GNETAZElement *TAZElement)
Insert a TAZElement element int GNENet container.
GNETAZElement * retrieveTAZElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named TAZElement.
Definition: GNENet.cpp:3001
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
retrieve all attribute carriers of Net
Definition: GNENet.cpp:130
void decRef(const std::string &debugMsg="")
Decrease reference.
bool unreferenced()
check if object ins't referenced
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNETAZElement.h:45
const std::string & getID() const
get ID
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property