SUMO - Simulation of Urban MObility
GNEDetector.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-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 //
16 /****************************************************************************/
17 
18 // ===========================================================================
19 // included modules
20 // ===========================================================================
21 #include <config.h>
22 
24 
25 #include "GNEDetector.h"
26 
27 
28 // ===========================================================================
29 // member method definitions
30 // ===========================================================================
31 
32 GNEDetector::GNEDetector(const std::string& id, GNEViewNet* viewNet, GUIGlObjectType type, SumoXMLTag tag,
33  double pos, double freq, const std::string& filename, const std::string& vehicleTypes, const std::string& name, bool friendlyPos, bool blockMovement) :
34  GNEAdditional(id, viewNet, type, tag, name, blockMovement),
35  myPositionOverLane(pos),
36  myFreq(freq),
37  myFilename(filename),
38  myVehicleTypes(vehicleTypes),
39  myFriendlyPosition(friendlyPos) {
40 }
41 
42 
44  double pos, double freq, const std::string& filename, const std::string& name, bool friendlyPos, bool blockMovement) :
45  GNEAdditional(additionalParent, viewNet, type, tag, name, blockMovement),
46  myPositionOverLane(pos),
47  myFreq(freq),
48  myFilename(filename),
49  myFriendlyPosition(friendlyPos) {
50 }
51 
52 
54 
55 
56 double
58  return myPositionOverLane;
59 }
60 
61 
64  if (myPositionOverLane < 0) {
65  return getLane()->getShape().front();
66  } else if (myPositionOverLane > getLane()->getShape().length()) {
67  return getLane()->getShape().back();
68  } else {
70  }
71 }
72 
73 
74 std::string
76  return getLane()->getMicrosimID();
77 }
78 
79 
80 std::string
82  return getTagStr() + ": " + getID();
83 }
84 
85 
86 std::string
88  return getTagStr();
89 }
90 
91 /****************************************************************************/
SumoXMLTag
Numbers representing SUMO-XML - element names.
double getPositionOverLane() const
get position over lane
Definition: GNEDetector.cpp:57
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEDetector.cpp:75
GUIGlObjectType
virtual GNELane * getLane() const =0
get lane
PositionVector getShape() const
Returns additional element&#39;s shape.
double myFreq
The aggregation period the values the detector collects shall be summed up.
Definition: GNEDetector.h:154
~GNEDetector()
Destructor.
Definition: GNEDetector.cpp:53
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEDetector.cpp:87
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEDetector.cpp:63
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
const std::string getID() const
function to support debugging
bool myFriendlyPosition
Flag for friendly position.
Definition: GNEDetector.h:163
std::string myFilename
The path to the output file.
Definition: GNEDetector.h:157
const PositionVector & getShape() const
returns the shape of the lane
Definition: GNELane.cpp:669
GNEDetector(const std::string &id, GNEViewNet *viewNet, GUIGlObjectType type, SumoXMLTag tag, double pos, double freq, const std::string &filename, const std::string &vehicleTypes, const std::string &name, bool friendlyPos, bool blockMovement)
Constructor.
Definition: GNEDetector.cpp:32
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
const std::string & getTagStr() const
get tag assigned to this object in string format
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEDetector.cpp:81
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
double myPositionOverLane
position of detector over Lane
Definition: GNEDetector.h:151