 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
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, {
47 myEndPositionOverLane(0.),
48 myTimeThreshold(timeThreshold),
49 mySpeedThreshold(speedThreshold),
50 myJamThreshold(jamThreshold),
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),
58 myEndPositionOverLane(endPos),
59 myTimeThreshold(timeThreshold),
60 mySpeedThreshold(speedThreshold),
61 myJamThreshold(jamThreshold),
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)) {
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
static bool isValidAttribute(const std::string &value)
whether the given string is a valid attribute for a certain key (for example, a name)
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
Position position
position of the block icon
void checkE2MultilaneIntegrity()
check if E2 is valid (all of their lanes are connected, it must called after every operation which in...
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
const std::string & getAdditionalID() const
bool isAdditionalValid() const
check if current additional is valid to be writed into XML (by default true, can be reimplemented in ...
double myLength
E2 detector length.
void calculateMultiShapeRotationsAndLengths()
calculate multi shape rotations and lenghts
PositionVector shape
The shape of the additional element.
static bool isValidFilename(const std::string &value)
whether the given string is a valid attribute for a filename (for example, a name)
void setRotation(GNELane *additionalLane=nullptr)
set Rotation of block Icon (must be called in updateGeometry() function)
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
std::string getAttribute(SumoXMLAttr key) const
static const RGBColor BLACK
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
static std::string parseIDs(const std::vector< T > &ACs)
parses a list of specific Attribute Carriers into a string of IDs
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.
std::vector< std::vector< double > > multiShapeRotations
The rotations of the multi-shape parts.
PositionVector getSubpart(double beginOffset, double endOffset) const
get subpart of a position vector
static const RGBColor E2
color for E2 detectors
Position getPositionInView() const
Returns position of additional in view.
std::vector< double > shapeRotations
The rotations of the single shape parts.
void calculateMultiShapeUnified()
calculate multi shape unified
static bool isGenericParametersValid(const std::string &value)
check if given string can be parsed to a map/list of generic parameters
SUMOTime myTimeThreshold
The time-based threshold that describes how much time has to pass until a vehicle is recognized as ha...
void fixAdditionalProblem()
fix additional problem
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
void changeAdditionalID(const std::string &newID)
change ID of additional
double myPositionOverLane
position of detector over Lane
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
std::vector< PositionVector > multiShape
The multi-shape of the additional element (used by certain additionals)
std::string secondOriginalPosition
value for saving second original position over lane before moving
BlockIcon myBlockIcon
variable BlockIcon
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
bool myFriendlyPosition
Flag for friendly position.
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.
static const double detectorDetails
details for detectors
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
AdditionalMove myMove
variable AdditionalMove
GNEViewNet * myViewNet
The GNEViewNet this additional element belongs.
double myJamThreshold
The minimum distance to the next standing vehicle in order to make this vehicle count as a participan...
friend class GNEChange_Attribute
declare friend class
const std::vector< GNELane * > & getLaneParents() const
get lanes of VSS
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
GNENet * getNet() const
get the net object
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
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)
GUIVisualizationTextSettings addName
double getLength() const
get length of E2 Detector
bool isValidDetectorID(const std::string &newID) const
check if a new detector ID is valid
GUIVisualizationDetailSettings detailSettings
detail settings
std::string myVehicleTypes
attribute vehicle types
static bool lanesConsecutives(const std::vector< GNELane * > &lanes)
check if lanes are consecutives
RGBColor selectedAdditionalColor
additional selection color (busStops, Detectors...)
void updateGeometry()
update pre-computed geometry information
bool myE2valid
flag to check if E2 multilane is valid or invalid
void selectAttributeCarrier(bool changeFlag=true)
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
double getLengthGeometryFactor() const
get length geometry factor
GUIGlID getGlID() const
Returns the numerical id of the object.
const GNEAttributeCarrier * getDottedAC() const
get AttributeCarrier under cursor
double scale
information about a lane's width (temporary, used for a single view)
void clearGeometry()
reset geometry
GNELane * getLane() const
get lane
A point in 2D or 3D with translation and scaling methods.
double x() const
Returns the x-position.
const TagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
std::string time2string(SUMOTime t)
GNEUndoList * getUndoList() const
get the undoList object
std::string myAdditionalName
name of additional
static const RGBColor RED
named colors
double mySpeedThreshold
The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting.
bool showConnections() const
check if select show connections checkbox is enabled
bool myBlockMovement
boolean to check if additional element is blocked (i.e. cannot be moved with mouse)
double rotation
The rotation of the block icon.
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
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes
an e2 detector over multiple lanes (used by Netedit)
GUIVisualizationColorSettings colorSettings
color settings
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc....
RGBColor selectionColor
basic selection color
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
void drawIcon(const GUIVisualizationSettings &s, const double exaggeration, const double size=0.5) const
draw lock icon
double y() const
Returns the y-position.
std::string getGenericParametersStr() const
return generic parameters in string format
block movement of a graphic element
double myEndPositionOverLane
end position over lane (only for Multilane E2 detectors)
std::string myFilename
The path to the output file.
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
std::string getAdditionalProblem() const
return a string with the current additional problem
void changeLaneParents(GNEShape *elementChild, const std::string &newLaneIDs)
change edge parents of a shape
AdditionalGeometry myGeometry
geometry to be precomputed in updateGeometry(...)
SUMOTime myFreq
The aggregation period the values the detector collects shall be summed up.
GUIVisualizationSizeSettings addSize
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void add(const Position &pos)
Adds the given position to this one.
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
std::vector< double > shapeLengths
The lengths of the single shape parts.
const std::string & getTagStr() const
get tag assigned to this object in string format
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)
PositionVector multiShapeUnified
multi shape unified
Stores the information about how to visualize structures.
std::vector< std::vector< double > > multiShapeLengths
The lengths of the multi-shape shape parts.
Position getLineCenter() const
get line center
~GNEDetectorE2()
Destructor.
A structure which describes a connection between edges or lanes.
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...
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Position originalViewPosition
value for saving first original position over lane before moving
std::string firstOriginalLanePosition
value for saving first original position over lane before moving
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
static bool checkAndFixDetectorPosition(double &pos, const double laneLength, const bool friendlyPos)
check if the position of a detector over a lane is valid
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
Position offset
The offSet of the block icon.
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.
void calculateShapeRotationsAndLengths()
calculate shape rotations and lenghts
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects