57 const std::string& name,
const double timeThreshold,
double speedThreshold,
double jamThreshold,
bool friendlyPos,
bool blockMovement) :
58 GNEDetector(id, viewNet,
GLO_E2DETECTOR,
SUMO_TAG_E2DETECTOR, lane, pos, freq, filename, vehicleTypes, name, friendlyPos, blockMovement),
60 myTimeThreshold(timeThreshold),
61 mySpeedThreshold(speedThreshold),
62 myJamThreshold(jamThreshold) {
108 int numberOfSegments = (int)
myShape.size() - 1;
111 if (numberOfSegments >= 0) {
118 for (
int i = 0; i < numberOfSegments; ++i) {
203 glTranslated(-0.75, 0, 0);
310 return canParse<double>(value);
312 return (canParse<double>(value) && (parse<double>(value) >= 0));
314 return (canParse<double>(value) && (parse<double>(value) >= 0));
326 return (canParse<double>(value) && (parse<double>(value) >= 0));
328 return (canParse<double>(value) && (parse<double>(value) >= 0));
330 return (canParse<double>(value) && (parse<double>(value) >= 0));
332 return canParse<bool>(value);
334 return canParse<bool>(value);
336 return canParse<bool>(value);
361 myFreq = parse<double>(value);
391 if (parse<bool>(value)) {
const GNEAttributeCarrier * getACUnderCursor() const
get AttributeCarrier under cursor
double scale
information about a lane's width (temporary, used for a single view)
void setBlockIconRotation(GNELane *additionalLane=nullptr)
static bool isValidAttribute(const std::string &value)
whether the given string is a valid attribute for a certain key (for example, a name) ...
static void drawBoxLines(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double width, int cornerDetail=0, double offset=0)
Draws thick lines.
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) ...
GUIVisualizationTextSettings addName
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
bool isDetectorPositionFixed() const
check if Position of detector is fixed
const std::string & getAdditionalID() const
returns Additional ID
Stores the information about how to visualize structures.
double y() const
Returns the y-position.
double x() const
Returns the x-position.
double myFreq
The aggregation period the values the detector collects shall be summed up.
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, int align=0, double width=-1)
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes ...
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
static const RGBColor BLACK
std::vector< double > myShapeRotations
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
void changeAdditionalID(const std::string &newID)
change ID of additional
Position getLineCenter() const
get line center
~GNEDetectorE2()
Destructor.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
GNEViewNet * myViewNet
The GNEViewNet this additional element belongs.
double mySpeedThreshold
The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting...
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
GUIVisualizationSizeSettings addSize
static const RGBColor selectedAdditionalColor
color of selected additionals
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void drawLockIcon(double size=0.5) const
draw lock icon
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
GNEEdge & getParentEdge()
Returns underlying parent edge.
PositionVector myShape
The shape of the additional element.
void updateGeometry(bool updateGrid)
update pre-computed geometry information
A point in 2D or 3D with translation and scaling methods.
std::string myAdditionalName
name of additional
static bool isGenericParametersValid(const std::string &value)
check if given string can be parsed to a map/list of generic parameters
void removeGLObjectFromGrid(GUIGlObject *o)
add GL Object into net
friend class GNEChange_Attribute
declare friend class
void selectAttributeCarrier(bool changeFlag=true)
block movement of a graphic element
std::string myVehicleTypes
attribute vehicle types
double getLengthGeometryFactor() const
get lenght geometry factor
std::vector< double > myShapeLengths
The lengths of the shape parts.
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
const std::string getID() const
function to support debugging
double myLength
E2 detector lenght.
PositionVector getSubpart(double beginOffset, double endOffset) const
get subpart of a position vector
GNEDetectorE2(const std::string &id, GNELane *lane, GNEViewNet *viewNet, double pos, double length, double freq, const std::string &filename, const std::string &vehicleTypes, const std::string &name, const double timeThreshold, double speedThreshold, double jamThreshold, bool friendlyPos, bool blockMovement)
Constructor.
bool myFriendlyPosition
Flag for friendly position.
double getFinalLength() const
get length that will be assigned to the lanes in the final network
Position myBlockIconOffset
The offSet of the block icon.
std::string myFilename
The path to the output file.
bool myBlockMovement
boolean to check if additional element is blocked (i.e. cannot be moved with mouse) ...
std::string getAttribute(SumoXMLAttr key) const
double getLength() const
get length of E2 Detector
const PositionVector & getShape() const
returns the shape of the lane
static void drawShapeDottedContour(const int type, const PositionVector &shape, const double width)
draw a dotted contour around the given Non closed shape with certain width
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
GNELane * myLane
The lane in which this detector is placed.
std::string getGenericParametersStr() const
return generic parameters in string format
GNENet * getNet() const
get the net object
GUIGlID getGlID() const
Returns the numerical id of the object.
double getExaggeration(const GUIVisualizationSettings &s, double factor=20) const
return the drawing size including exaggeration and constantSize values
double myTimeThreshold
The time-based threshold that describes how much time has to pass until a vehicle is recognized as ha...
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
bool isValidAdditionalID(const std::string &newID) const
check if a new additional ID is valid
double myJamThreshold
The minimum distance to the next standing vehicle in order to make this vehicle count as a participan...
static const RGBColor selectionColor
NBEdge * getNBEdge()
returns the internal NBEdge
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects
void addGLObjectIntoGrid(GUIGlObject *o)
add GL Object into net
static bool isValidFilename(const std::string &value)
whether the given string is a valid attribute for a filename (for example, a name) ...
GNELane * retrieveLane(const std::string &id, bool failHard=true, bool checkVolatileChange=false)
get lane by id
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
double myBlockIconRotation
The rotation of the block icon.
GNELane * changeLane(GNELane *oldLane, const std::string &newLaneID)
change lane of additional
double myPositionOverLane
position of detector over Lane
Position myBlockIconPosition
position of the block icon
SumoXMLTag getTag() const
get XML Tag assigned to this object