38 const std::string& vehicleTypes,
const std::string& name,
SUMOTime timeThreshold,
double speedThreshold,
double jamThreshold,
bool friendlyPos,
bool blockMovement) :
39 GNEDetector(id, net,
GLO_E2DETECTOR,
SUMO_TAG_E2DETECTOR, pos, freq, filename, vehicleTypes, name, friendlyPos, blockMovement, {
43 myEndPositionOverLane(0.),
44 myTimeThreshold(timeThreshold),
45 mySpeedThreshold(speedThreshold),
46 myJamThreshold(jamThreshold),
47 myTrafficLight(trafficLight) {
49 updateCenteringBoundary(
false);
53 GNEDetectorE2::GNEDetectorE2(
const std::string&
id, std::vector<GNELane*> lanes,
GNENet* net,
double pos,
double endPos,
const std::string& freq,
const std::string& trafficLight,
const std::string& filename,
54 const std::string& vehicleTypes,
const std::string& name,
SUMOTime timeThreshold,
double speedThreshold,
double jamThreshold,
bool friendlyPos,
bool blockMovement) :
55 GNEDetector(id, net,
GLO_E2DETECTOR,
SUMO_TAG_E2DETECTOR_MULTILANE, pos, freq, filename, vehicleTypes, name, friendlyPos, blockMovement, lanes),
57 myEndPositionOverLane(endPos),
58 myTimeThreshold(timeThreshold),
59 mySpeedThreshold(speedThreshold),
60 myJamThreshold(jamThreshold),
61 myTrafficLight(trafficLight) {
100 std::string errorFirstLanePosition, separator, errorLastLanePosition;
115 return "lanes aren't consecutives";
133 if ((errorFirstLanePosition.size() > 0) && (errorLastLanePosition.size() > 0)) {
137 return errorFirstLanePosition + separator + errorLastLanePosition;
155 bool foundConnection =
true;
160 foundConnection =
false;
162 for (
auto j :
getParentLanes().at(i)->getParentEdge()->getGNEConnections()) {
164 foundConnection =
true;
168 if (!foundConnection) {
255 if (startPosFixed < 0) {
258 if (endPosFixed < 0) {
265 startPosFixed =
getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength();
271 endPosFixed =
getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength();
433 return canParse<std::vector<GNELane*> >(
myNet, value,
false);
438 }
else if (
canParse<std::vector<GNELane*> >(
myNet, value,
false)) {
445 return canParse<double>(value);
447 return canParse<double>(value);
449 return value.empty() || (canParse<double>(value) && (parse<double>(value) >= 0));
454 return (canParse<double>(value) && (parse<double>(value) >= 0));
466 return canParse<SUMOTime>(value);
468 return (canParse<double>(value) && (parse<double>(value) >= 0));
470 return (canParse<double>(value) && (parse<double>(value) >= 0));
472 return canParse<bool>(value);
474 return canParse<bool>(value);
476 return canParse<bool>(value);
544 if (parse<bool>(value)) {
566 bool connectionFound =
false;
568 for (
auto j :
getParentLanes().at(i)->getParentEdge()->getGNEConnections()) {
570 connectionFound =
true;
574 if (!connectionFound) {
@ GLO_E2DETECTOR
a E2 detector
std::string time2string(SUMOTime t)
convert SUMOTime to string
@ SUMO_TAG_E2DETECTOR
an e2 detector
@ SUMO_TAG_E2DETECTOR_MULTILANE
an e2 detector over multiple lanes (used by Netedit)
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_JAM_DIST_THRESHOLD
@ GNE_ATTR_BLOCK_MOVEMENT
block movement of a graphic element
@ GNE_ATTR_SELECTED
element is selected
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_HALTING_TIME_THRESHOLD
@ SUMO_ATTR_HALTING_SPEED_THRESHOLD
@ SUMO_ATTR_TLID
link,node: the traffic light id responsible for this link
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
static bool checkAndFixDetectorPosition(double &pos, const double laneLength, const bool friendlyPos)
check if the position of a detector over a lane is valid
static bool fixE2DetectorPosition(double &pos, double &length, const double laneLength, const bool friendlyPos)
check if the position of a detector over a lane is valid
const std::string & getID() const
get ID
GNEGeometry::Geometry myAdditionalGeometry
geometry to be precomputed in updateGeometry(...)
void drawAdditionalID(const GUIVisualizationSettings &s) const
draw additional ID
void replaceAdditionalParentLanes(const std::string &value)
replace additional parent lanes
bool myBlockMovement
boolean to check if additional element is blocked (i.e. cannot be moved with mouse)
std::string myAdditionalName
name of additional
void drawAdditionalName(const GUIVisualizationSettings &s) const
draw additional name
GNEGeometry::SegmentGeometry myAdditionalSegmentGeometry
segment geometry to be precomputed in updateGeometry(...) (used by E2Multilane)
bool isValidDetectorID(const std::string &newID) const
check if a new detector ID is valid
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
friend class GNEChange_Attribute
declare friend class
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc....
const std::string & getTagStr() const
get tag assigned to this object in string format
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
static bool lanesConsecutives(const std::vector< GNELane * > &lanes)
check if lanes are consecutives
GNENet * myNet
pointer to net
static std::string parseIDs(const std::vector< T > &ACs)
parses a list of specific Attribute Carriers into a string of IDs
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
const GNETagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
void updateGeometry()
update pre-computed geometry information
std::string getAttribute(SumoXMLAttr key) const
bool isAdditionalValid() const
check if current additional is valid to be writed into XML (by default true, can be reimplemented in ...
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
GNEDetectorE2(const std::string &id, GNELane *lane, GNENet *net, double pos, double length, const std::string &freq, const std::string &trafficLight, const std::string &filename, const std::string &vehicleTypes, const std::string &name, SUMOTime timeThreshold, double speedThreshold, double jamThreshold, bool friendlyPos, bool blockMovement)
Constructor for Single-Lane E2 detectors.
double mySpeedThreshold
The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting.
double myJamThreshold
The minimum distance to the next standing vehicle in order to make this vehicle count as a participan...
bool areLaneConsecutives() const
check if lanes are consecutives
void fixAdditionalProblem()
fix additional problem
double myLength
E2 detector length.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes
SUMOTime myTimeThreshold
The time-based threshold that describes how much time has to pass until a vehicle is recognized as ha...
bool isAttributeEnabled(SumoXMLAttr key) const
std::string myTrafficLight
Traffic light vinculated with this E2 Detector.
~GNEDetectorE2()
Destructor.
double getLength() const
get length of E2 Detector
std::string getAdditionalProblem() const
return a string with the current additional problem
double myEndPositionOverLane
end position over lane (only for Multilane E2 detectors)
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
std::string myFilename
The path to the output file.
std::string myFreq
The aggregation period the values the detector collects shall be summed up.
double myPositionOverLane
position of detector over Lane
std::string myVehicleTypes
attribute vehicle types
bool myFriendlyPosition
Flag for friendly position.
void drawDetectorLogo(const GUIVisualizationSettings &s, const double exaggeration, const std::string &logo, const RGBColor &textColor) const
draw detector Logo
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape, double startPos=-1, double endPos=-1, const Position &extraFirstPosition=Position::INVALID, const Position &extraLastPosition=Position::INVALID)
update geometry shape
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
void updateID(GNEAttributeCarrier *AC, const std::string newID)
update ID
A NBNetBuilder extended by visualisation and editing capabilities.
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
retrieve all attribute carriers of Net
GNEViewNet * getViewNet() const
get view net
void calculateConsecutivePathLanes(SUMOVehicleClass vClass, const bool allowedVClass, const std::vector< GNEEdge * > &edges)
calculate consecutive path lanes (used by routes)
const std::vector< GNEPathElements::PathElement > & getPath() const
get path edges
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
GNEUndoList * getUndoList() const
get the undoList object
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, GUIGlObjectType objectType, const double extraOffset=0)
draw front attributeCarrier
GUIGlID getGlID() const
Returns the numerical id of the object.
Stores the information about how to visualize structures.
GUIVisualizationDetailSettings detailSettings
detail settings
GUIVisualizationSizeSettings addSize
bool drawDottedContour() const
check if dotted contour can be drawn
bool drawAdditionals(const double exaggeration) const
check if additionals must be drawn
GUIVisualizationColorSettings colorSettings
color settings
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
GUIVisualizationDetectorSettings detectorSettings
Detector settings.
static bool areParametersValid(const std::string &value, bool report=false, ParameterisedAttrType attrType=ParameterisedAttrType::STRING, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
void setParametersStr(const std::string ¶msString, const std::string kvsep="=", const std::string sep="|")
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
std::string getParametersStr(const std::string kvsep="=", const std::string sep="|") const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
static const RGBColor BLACK
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
static bool isValidFilename(const std::string &value)
whether the given string is a valid attribute for a filename (for example, a name)
static bool isValidListOfTypeID(const std::string &value)
whether the given string is a valid list of ids for an edge or vehicle type (empty aren't allowed)
static bool isValidAttribute(const std::string &value)
whether the given string is a valid attribute for a certain key (for example, a name)
struct for variables used in Geometry extremes
double laneEndPosition
arrival position over lane
double laneStartPosition
depart position over lane
static void drawDottedContourShape(const DottedContourType type, const GUIVisualizationSettings &s, const PositionVector &shape, const double width, const double exaggeration)
draw dotted contour for the given shape (used by additionals)
static void calculateLaneGeometricPath(GNEGeometry::SegmentGeometry &segmentGeometry, const std::vector< GNEPathElements::PathElement > &path, GNEGeometry::ExtremeGeometry &extremeGeometry)
calculate route between lanes
static void drawGeometry(const GNEViewNet *viewNet, const Geometry &geometry, const double width)
draw geometry
bool showAdditionals() const
check if additionals has to be drawn
static void drawLockIcon(const GNEAttributeCarrier *AC, const GNEGeometry::Geometry &geometry, const double exaggeration, const double offsetx, const double offsety, const bool overlane, const double size=0.5)
draw lock icon
RGBColor selectedAdditionalColor
additional selection color (busStops, Detectors...)
static const double detectorDetails
details for detectors
static const RGBColor E2Color
color for E2 detectors
static const double E2Width
E2 detector widths.
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
A structure which describes a connection between edges or lanes.