Eclipse SUMO - Simulation of Urban MObility
GNEEdgeDataFrame.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 // The Widget for add edgeData elements
19 /****************************************************************************/
20 #include <config.h>
21 
26 #include <netedit/GNEViewNet.h>
27 
28 #include "GNEEdgeDataFrame.h"
29 
30 
31 // ===========================================================================
32 // method definitions
33 // ===========================================================================
34 
35 GNEEdgeDataFrame::GNEEdgeDataFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet) :
36  GNEGenericDataFrame(horizontalFrameParent, viewNet, SUMO_TAG_MEANDATA_EDGE, false) {
37 }
38 
39 
41 
42 
43 bool
45  // first check if we clicked over an edge
46  if (objectsUnderCursor.getEdgeFront() && myDataSetSelector->getDataSet() && myIntervalSelector->getDataInterval()) {
47  // first check if the given interval there is already a EdgeData for the given ID
48  for (const auto& genericData : myIntervalSelector->getDataInterval()->getGenericDataChildren()) {
49  if ((genericData->getTagProperty().getTag() == SUMO_TAG_MEANDATA_EDGE) && (genericData->getParentEdges().front() == objectsUnderCursor.getEdgeFront())) {
50  // write warning
51  WRITE_WARNING("There is already a " + genericData->getTagStr() + " in edge '" + objectsUnderCursor.getEdgeFront()->getID() + "'");
52  // abort edge data creation
53  return false;
54  }
55  }
56  // finally create edgeData
58  // edgeData created, then return true
59  return true;
60  } else {
61  // invalid parent parameters
62  return false;
63  }
64 }
65 
66 
67 /****************************************************************************/
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:276
@ SUMO_TAG_MEANDATA_EDGE
an edge based mean data detector
static GNEGenericData * buildEdgeData(GNENet *net, bool allowUndoRedo, GNEDataInterval *dataIntervalParent, GNEEdge *edge, const std::map< std::string, std::string > &parameters)
Builds edgeData.
const std::vector< GNEGenericData * > & getGenericDataChildren() const
get generic data children
~GNEEdgeDataFrame()
Destructor.
GNEEdgeDataFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
bool addEdgeData(const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor, const GNEViewNetHelper::MouseButtonKeyPressed &mouseButtonKeyPressed)
add additional element
const std::map< std::string, std::string > & getParametersMap() const
get parameters as map
GNEViewNet * myViewNet
View Net.
Definition: GNEFrame.h:113
GNEDataSet * getDataSet() const
get current select data set ID
GNEDataInterval * getDataInterval() const
get current select data set ID
IntervalSelector * myIntervalSelector
interval selector modul
DataSetSelector * myDataSetSelector
dataSet selector modul
GNEFrameAttributesModuls::ParametersEditorCreator * myParametersEditorCreator
parameters editor creator
const std::string & getID() const
get ID
class used to group all variables related with objects under cursor after a click over view
GNEEdge * getEdgeFront() const
get front edge or a pointer to nullptr
GNENet * getNet() const
get the net object
class used to group all variables related with mouse buttons and key pressed after certain events