42 const std::string& name,
SUMOTime timeThreshold,
double speedThreshold,
double jamThreshold,
bool friendlyPos,
bool blockMovement) :
43 GNEDetector(id, viewNet,
GLO_E2DETECTOR,
SUMO_TAG_E2DETECTOR, pos, freq, filename, vehicleTypes, name, friendlyPos, blockMovement, {
56 const std::string& name,
SUMOTime timeThreshold,
double speedThreshold,
double jamThreshold,
bool friendlyPos,
bool blockMovement) :
57 GNEDetector(id, viewNet,
GLO_E2DETECTOR,
SUMO_TAG_E2DETECTOR_MULTILANE, pos, freq, filename, vehicleTypes, name, friendlyPos, blockMovement, lanes),
99 std::string errorFirstLanePosition, separator, errorLastLanePosition;
128 errorFirstLanePosition =
"lanes aren't consecutives";
132 if ((errorFirstLanePosition.size() > 0) && (errorLastLanePosition.size() > 0)) {
136 return errorFirstLanePosition + separator + errorLastLanePosition;
154 bool foundConnection =
true;
159 foundConnection =
false;
161 for (
auto j :
getLaneParents().at(i)->getParentEdge().getGNEConnections()) {
163 foundConnection =
true;
167 if (!foundConnection) {
198 newPosition.
add(offset);
208 if (newPositionOverLane < 0) {
210 }
else if (newPositionOverLane +
myLength > laneLenght) {
220 if ((newStartPosition >= 0) && (newStartPosition <=
getLaneParents().front()->getLaneShapeLength()) &&
221 (newEndPosition >= 0) && (newEndPosition <=
getLaneParents().back()->getLaneShapeLength())) {
254 double startPosFixed, endPosFixed;
265 startPosFixed =
getLaneParents().back()->getParentEdge().getNBEdge()->getFinalLength();
274 endPosFixed =
getLaneParents().back()->getParentEdge().getNBEdge()->getFinalLength();
296 startPosFixed =
getLaneParents().front()->getParentEdge().getNBEdge()->getFinalLength();
310 endPosFixed =
getLaneParents().back()->getParentEdge().getNBEdge()->getFinalLength();
320 for (
auto j :
getLaneParents().at(0)->getParentEdge().getGNEConnections()) {
333 for (
auto j :
getLaneParents().at(i)->getParentEdge().getGNEConnections()) {
380 for (
auto j :
getLaneParents().at(i)->getParentEdge().getGNEConnections()) {
445 glTranslated(-0.75, 0, 0);
460 glTranslated(-1.5, 0, 0);
468 glTranslated(1.2, 0, 0);
470 glRotated(90, 0, 0, 1);
582 return canParse<std::vector<GNELane*> >(
myViewNet->
getNet(), value,
false);
594 return canParse<double>(value);
596 return canParse<double>(value);
598 return (canParse<double>(value) && (parse<double>(value) >= 0));
600 return (canParse<double>(value) && (parse<double>(value) >= 0));
612 return canParse<SUMOTime>(value);
614 return (canParse<double>(value) && (parse<double>(value) >= 0));
616 return (canParse<double>(value) && (parse<double>(value) >= 0));
618 return canParse<bool>(value);
620 return canParse<bool>(value);
622 return canParse<bool>(value);
652 myFreq = parse<SUMOTime>(value);
682 if (parse<bool>(value)) {
const TagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
A structure which describes a connection between edges or lanes.
Position snapToActiveGrid(const Position &pos, bool snapXY=true) const
Returns a position that is mapped to the closest grid point if the grid is active.
double scale
information about a lane's width (temporary, used for a single view)
PositionVector multiShapeUnified
multi shape unified
void calculateMultiShapeRotationsAndLengths()
calculate multi shape rotations and lenghts
static bool checkAndFixDetectorPosition(double &pos, const double laneLength, const bool friendlyPos)
check if the position of a detector over a lane is valid
bool showConnections() const
check if select show connections checkbox is enabled
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
std::vector< double > shapeRotations
The rotations of the single shape parts.
void add(const Position &pos)
Adds the given position to this one.
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(...)
const std::string & getAdditionalID() const
std::string secondOriginalPosition
value for saving second original position over lane before moving
an e2 detector over multiple lanes (used by Netedit)
GNEDetectorE2(const std::string &id, GNELane *lane, GNEViewNet *viewNet, double pos, double length, SUMOTime freq, 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.
Stores the information about how to visualize structures.
Position offset
The offSet of the block icon.
double y() const
Returns the y-position.
static std::string parseIDs(const std::vector< T > &ACs)
parses a list of specific Attribute Carriers into a string of IDs
std::string time2string(SUMOTime t)
double x() const
Returns the x-position.
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)
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Position position
position of the block icon
BlockIcon myBlockIcon
variable BlockIcon
void clearGeometry()
reset geometry
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 ...
Position originalViewPosition
value for saving first original position over lane before moving
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
double myEndPositionOverLane
end position over lane (only for Multilane E2 detectors)
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
RGBColor selectedAdditionalColor
additional selection color (busStops, Detectors...)
void updateGeometry()
update pre-computed geometry information
static const RGBColor BLACK
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
double rotation
The rotation of the block icon.
bool isValidDetectorID(const std::string &newID) const
check if a new detector ID is valid
~GNEDetectorE2()
Destructor.
std::vector< std::vector< double > > multiShapeRotations
The rotations of the multi-shape parts.
SUMOTime myTimeThreshold
The time-based threshold that describes how much time has to pass until a vehicle is recognized as ha...
GNEViewNet * myViewNet
The GNEViewNet this additional element belongs.
AdditionalMove myMove
variable AdditionalMove
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
GNEUndoList * getUndoList() const
get the undoList object
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
A point in 2D or 3D with translation and scaling methods.
PositionVector shape
The shape of the additional element.
RGBColor selectionColor
basic selection color
static bool lanesConsecutives(const std::vector< GNELane *> &lanes)
check if lanes are consecutives
Position getPositionInView() const
Returns position of additional in view.
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
bool isAdditionalValid() const
check if current additional is valid to be writed into XML (by default true, can be reimplemented in ...
void checkE2MultilaneIntegrity()
check if E2 is valid (all of their lanes are connected, it must called after every operation which in...
friend class GNEChange_Attribute
declare friend class
void selectAttributeCarrier(bool changeFlag=true)
const std::vector< GNELane * > & getLaneParents() const
get lanes of VSS
block movement of a graphic element
std::string myVehicleTypes
attribute vehicle types
std::vector< std::vector< double > > multiShapeLengths
The lengths of the multi-shape shape parts.
bool myE2valid
flag to check if E2 multilane is valid or invalid
double getLengthGeometryFactor() const
get length geometry factor
static const double detectorDetails
details for detectors
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
double myLength
E2 detector length.
PositionVector getSubpart(double beginOffset, double endOffset) const
get subpart of a position vector
std::vector< PositionVector > multiShape
The multi-shape of the additional element (used by certain additionals)
void fixAdditionalProblem()
fix additional problem
bool myFriendlyPosition
Flag for friendly position.
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) ...
static void drawShapeDottedContourAroundShape(const GUIVisualizationSettings &s, const int type, const PositionVector &shape, const double width)
draw a dotted contour around the given Non closed shape with certain width
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
void calculateShapeRotationsAndLengths()
calculate shape rotations and lenghts
std::string getAttribute(SumoXMLAttr key) const
std::vector< double > shapeLengths
The lengths of the single shape parts.
double getLength() const
get length of E2 Detector
GUIVisualizationDetailSettings detailSettings
detail settings
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
SUMOTime myFreq
The aggregation period the values the detector collects shall be summed up.
void changeLaneParents(GNEShape *elementChild, const std::string &newLaneIDs)
change edge parents of a shape
static const RGBColor RED
named colors
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
const GNEAttributeCarrier * getDottedAC() const
get AttributeCarrier under cursor
AdditionalGeometry myGeometry
geometry to be precomputed in updateGeometry(...)
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
const std::string & getTagStr() const
get tag assigned to this object in string format
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.
GNELane * getLane() const
get lane
GUIVisualizationColorSettings colorSettings
color settings
double myJamThreshold
The minimum distance to the next standing vehicle in order to make this vehicle count as a participan...
std::string firstOriginalLanePosition
value for saving first original position over lane before moving
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
std::string getAdditionalProblem() const
return a string with the current additional problem
void drawIcon(const GUIVisualizationSettings &s, const double exaggeration, const double size=0.5) const
draw lock icon
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
static bool isValidFilename(const std::string &value)
whether the given string is a valid attribute for a filename (for example, a name) ...
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc.)
static const RGBColor E2
color for E2 detectors
void setRotation(GNELane *additionalLane=nullptr)
set Rotation of block Icon (must be called in updateGeometry() function)
double myPositionOverLane
position of detector over Lane
void calculateMultiShapeUnified()
calculate multi shape unified