51 const std::string& trafficLight,
const std::string& filename,
const std::vector<std::string>& vehicleTypes,
52 const std::vector<std::string>& nextEdges,
const std::string& detectPersons,
const std::string& name,
const SUMOTime timeThreshold,
53 double speedThreshold,
const double jamThreshold,
const bool friendlyPos,
const bool show,
const Parameterised::Map& parameters) :
57}, filename, vehicleTypes, nextEdges, detectPersons, name, friendlyPos, parameters),
58myEndPositionOverLane(pos + length),
59myTimeThreshold(timeThreshold),
60mySpeedThreshold(speedThreshold),
61myJamThreshold(jamThreshold),
62myTrafficLight(trafficLight),
68 const std::string& trafficLight,
const std::string& filename,
const std::vector<std::string>& vehicleTypes,
69 const std::vector<std::string>& nextEdges,
const std::string& detectPersons,
const std::string& name,
const SUMOTime timeThreshold,
70 double speedThreshold,
const double jamThreshold,
const bool friendlyPos,
const bool show,
const Parameterised::Map& parameters) :
72 pos, freq, lanes, filename, vehicleTypes, nextEdges, detectPersons, name, friendlyPos, parameters),
73 myEndPositionOverLane(endPos),
74 myTimeThreshold(timeThreshold),
75 mySpeedThreshold(speedThreshold),
76 myJamThreshold(jamThreshold),
77 myTrafficLight(trafficLight),
155 std::string errorFirstLanePosition, separator, errorLastLanePosition;
167 return TL(
"lanes aren't consecutives");
171 return TL(
"lanes aren't connected");
189 if ((errorFirstLanePosition.size() > 0) && (errorLastLanePosition.size() > 0)) {
190 separator =
TL(
" and ");
193 return errorFirstLanePosition + separator + errorLastLanePosition;
211 bool foundConnection =
true;
216 foundConnection =
false;
218 for (
const auto& connection :
getParentLanes().at(i)->getParentEdge()->getGNEConnections()) {
220 foundConnection =
true;
224 if (!foundConnection) {
239 newPositionOverLane,
getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength(),
240 newEndPositionOverLane,
getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength());
275 drawE2(s, d, E2Exaggeration);
446 }
else if (
canParse<std::vector<GNELane*> >(
myNet, value,
false)) {
453 return canParse<double>(value);
458 return (canParse<double>(value) && (parse<double>(value) >= 0));
460 return canParse<SUMOTime>(value);
462 return (canParse<double>(value) && (parse<double>(value) >= 0));
464 return (canParse<double>(value) && (parse<double>(value) >= 0));
466 return canParse<bool>(value);
478 const double exaggeration)
const {
501 glTranslated(0, 0, 0.1);
517 const GUIGeometry& geometry,
const double exaggeration)
const {
523 glTranslated(0, 0,
getType() + offsetFront);
537 if (geometry.
getShape().size() > 1) {
538 glTranslated(0, 0, 0.1);
555 glTranslated(pos.
x(), pos.
y(),
getType() + offsetFront + 0.1);
557 glRotated(rot, 0, 0, 1);
559 glTranslated(-1, 0, 0);
561 glScaled(exaggeration, exaggeration, 1);
573 const bool onlyContour,
const double offsetFront,
const GUIGeometry& geometry,
574 const double exaggeration)
const {
580 glTranslated(0, 0,
getType() + offsetFront);
584 }
else if (invalid) {
633 myShow = parse<bool>(value);
688 const double laneLength =
getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
693 fixedPos += laneLength;
699 }
else if (fixedPos > (
getParentLanes().front()->getLaneShapeLength() - POSITION_EPS)) {
700 return (
getParentLanes().front()->getLaneShapeLength() - POSITION_EPS);
710 const double laneLength =
getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength();
715 fixedPos += laneLength;
719 if (fixedPos < POSITION_EPS) {
721 }
else if (fixedPos >
getParentLanes().back()->getLaneShapeLength()) {
@ GLO_E2DETECTOR
a E2 detector
GUIIcon
An enumeration of icons used by the gui applications.
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ GNE_TAG_MULTI_LANE_AREA_DETECTOR
an e2 detector over multiple lanes (placed here due create Additional Frame)
@ SUMO_TAG_LANE_AREA_DETECTOR
alternative tag for e2 detector
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_JAM_DIST_THRESHOLD
@ SUMO_ATTR_HALTING_TIME_THRESHOLD
@ SUMO_ATTR_HALTING_SPEED_THRESHOLD
@ SUMO_ATTR_TLID
link,node: the traffic light id responsible for this link
@ SUMO_ATTR_SHOW_DETECTOR
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
static void drawTriangleAtEnd(const Position &p1, const Position &p2, double tLength, double tWidth, const double extraOffset=0)
Draws a triangle at the end of the given line.
static void popMatrix()
pop matrix
static void pushMatrix()
push matrix
static void drawText(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &col=RGBColor::BLACK, const double angle=0, const int align=0, double width=-1)
static void fixMultiLanePosition(double fromPos, const double fromLaneLength, double toPos, const double tolaneLength)
fix the given positions over two lanes
static void fixLanePosition(double &pos, double &length, const double laneLength)
fix given position over lane
static bool areLaneConnected(const std::vector< GNELane * > &lanes)
check if the given lanes are connected
void drawRightGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false) const
draw right geometry point
GNEContour myAdditionalContour
variable used for draw additional contours
GUIGeometry 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
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
void drawAdditionalName(const GUIVisualizationSettings &s) const
draw additional name
static bool areLaneConsecutives(const std::vector< GNELane * > &lanes)
check if the given lanes are consecutive
void drawLeftGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false) const
draw left geometry point
void drawParentChildLines(const GUIVisualizationSettings &s, const RGBColor &color, const bool onlySymbols=false) const
draw parent and child lines
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
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
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
const GNETagProperties & myTagProperty
reference to tagProperty associated with this attribute carrier
static void changeAttribute(GNEAttributeCarrier *AC, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList, const bool force=false)
change attribute
void calculateContourExtrudedShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double layer, const double extrusionWidth, const double scale, const bool closeFirstExtrem, const bool closeLastExtrem, const double offset) const
calculate contour extruded (used in elements formed by a central shape)
void drawDottedContours(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, const double lineWidth, const bool addOffset) const
draw dotted contours (basics, select, delete, inspect...)
void drawE2DetectorLogo(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double exaggeration, const std::string &logo, const RGBColor &textColor) const
draw E2 detector Logo
double myPositionOverLane
position of detector over Lane
bool isDetectorValid(SumoXMLAttr key, const std::string &value)
void setDetectorAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
double getDetectorAttributeDouble(SumoXMLAttr key) const
void writeDetectorValues(OutputDevice &device) const
write additional element into a xml file
bool myFriendlyPosition
Flag for friendly position.
std::string getDetectorAttribute(SumoXMLAttr key) const
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
bool exist(const GNELane *toLane) const
check if exist a lane2lane geometry for the given toLane
const GUIGeometry & getLane2laneGeometry(const GNELane *toLane) const
get lane2lane geometry
void drawE2PartialLane(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEPathManager::Segment *segment, const double offsetFront, const GUIGeometry &geometry, const double exaggeration) const
draw E2 partial lane
void writeAdditional(OutputDevice &device) const
write additional element into a xml file
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over junction.
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
void updateGeometry()
update pre-computed geometry information
double getAttributeDouble(SumoXMLAttr key) const
void fixAdditionalProblem()
fix additional problem
std::string getAttribute(SumoXMLAttr key) const
double myJamThreshold
The minimum distance to the next standing vehicle in order to make this vehicle count as a participan...
std::string myTrafficLight
Traffic light vinculated with this E2 Detector.
~GNELaneAreaDetector()
Destructor.
double myEndPositionOverLane
end position over lane (only for Multilane E2 detectors)
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
double getStartGeometryPositionOverLane() const
get start position over lane that is applicable to the shape
bool myShow
show or hidde detector in sumo-gui
bool isAdditionalValid() const
check if current additional is valid to be written into XML
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over lane.
void drawE2(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double exaggeration) const
draw E2 detector
GNELaneAreaDetector(SumoXMLTag tag, GNENet *net)
default Constructor
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes
double mySpeedThreshold
The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting.
std::string getAdditionalProblem() const
return a string with the current additional problem
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their correspondent attribute are valids
SUMOTime myTimeThreshold
The time-based threshold that describes how much time has to pass until a vehicle is recognized as ha...
void computePathElement()
compute pathElement
void drawE2PartialJunction(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const bool onlyContour, const double offsetFront, const GUIGeometry &geometry, const double exaggeration) const
draw E2 partial junction
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
const PositionVector & getLaneShape() const
get elements shape
const GNELane2laneConnection & getLane2laneConnections() const
get Lane2laneConnection struct
const GUIGeometry & getLaneGeometry() const
get lane geometry
double myMoveElementLateralOffset
move element lateral offset (used by elements placed over lanes
double newFirstPos
new first position
const GNEMoveOperation::OperationType operationType
move operation
double newSecondPos
new second position
A NBNetBuilder extended by visualisation and editing capabilities.
GNEPathManager * getNetworkPathManager()
get network path manager
GNEViewNet * getViewNet() const
get view net
const GNELane * getPreviousLane() const
get previous lane
const GNELane * getNextLane() const
get next lane
bool isLabelSegment() const
check if segment is label segment
const GNELane * getLane() const
get lane associated with this segment
bool isLastSegment() const
check if segment is the last path's segment
bool isFirstSegment() const
check if segment is the first path's segment
void calculateConsecutivePathLanes(PathElement *pathElement, const std::vector< GNELane * > &lanes)
calculate consecutive path lanes
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
const std::string & getDefaultValue(SumoXMLAttr attr) const
return the default value of the attribute of an element
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
void add(GNEChange *command, bool doit=false, bool merge=true)
Add new command, executing it if desired. The new command will be merged with the previous command if...
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
GNEUndoList * getUndoList() const
get the undoList object
bool selectingDetectorsTLSMode() const
check if we're selecting detectors in TLS mode
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
static void drawContourGeometry(const GUIGeometry &geometry, const double width, const bool drawExtremes=false)
draw contour geometry
static void drawGeometry(const GUIVisualizationSettings::Detail d, const GUIGeometry &geometry, const double width, double offset=0)
draw geometry
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape)
update entire geometry
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0, bool forceShow=false) const
draw name of item
Stores the information about how to visualize structures.
GUIVisualizationTextSettings addName
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
bool checkDrawAdditional(Detail d, const bool selected) const
check if draw additionals
Detail getDetailLevel(const double exaggeration) const
return the detail level
GUIVisualizationColorSettings colorSettings
color settings
GUIVisualizationDottedContourSettings dottedContourSettings
dotted contour settings
double scale
information about a lane's width (temporary, used for a single view)
GUIVisualizationAdditionalSettings additionalSettings
Additional settings.
GUIVisualizationDetectorSettings detectorSettings
Detector settings.
double getTextAngle(double objectAngle) const
return an angle that is suitable for reading text aligned with the given angle (degrees)
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
std::map< std::string, std::string > Map
parameters map
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
A point in 2D or 3D with translation and scaling methods.
static const Position INVALID
used to indicate that a position is valid
double x() const
Returns the x-position.
double y() const
Returns the y-position.
double length2D() const
Returns the length.
double length() const
Returns the length.
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
Position getCentroid() const
Returns the centroid (closes the polygon if unclosed)
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
static const RGBColor BLACK
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
static const RGBColor RED
named colors
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element
bool showAdditionals() const
check if additionals has to be drawn
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
static void drawLockIcon(const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position position, const double exaggeration, const double size=0.5, const double offsetx=0, const double offsety=0)
draw lock icon
bool showConnections() const
check if select show connections checkbox is enabled
static const RGBColor connectionColor
connection color
RGBColor selectedAdditionalColor
additional selection color (busStops, Detectors...)
static const RGBColor E2Color
color for E2 detectors
static const double E2Width
E2 detector widths.
static const double segmentWidth
width of dotted contour segments
A structure which describes a connection between edges or lanes.