 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
40 GNEDetector(id, viewNet,
GLO_E1DETECTOR,
SUMO_TAG_E1DETECTOR, pos, freq, filename, vehicleTypes, name, friendlyPos, blockMovement, {
64 std::string errorPosition;
65 const double len =
getLaneParents().front()->getParentEdge().getNBEdge()->getFinalLength();
92 newPosition.
add(offset);
145 const double width = (double) 2.0 * s.
scale;
161 glScaled(exaggeration, exaggeration, 1);
164 glVertex2d(-1.0, -2);
168 glTranslated(0, 0, .01);
170 glVertex2d(0, 2 - .1);
171 glVertex2d(0, -2 + .1);
181 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
184 glVertex2f(-1.0, -2);
188 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
198 glRotated(90, 0, 0, -1);
215 glTranslated(-1, 0, 0);
309 return canParse<double>(value) && fabs(parse<double>(value)) <
getLaneParents().front()->getParentEdge().getNBEdge()->getFinalLength();
311 return (canParse<double>(value) && (parse<double>(value) >= 0));
323 return canParse<bool>(value);
325 return canParse<bool>(value);
327 return canParse<bool>(value);
352 myFreq = parse<SUMOTime>(value);
370 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)
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes
Position position
position of the block icon
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
const std::string & getAdditionalID() const
std::string getAdditionalProblem() const
return a string with the current additional problem
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
static const RGBColor BLACK
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
Position getPositionInView() const
Returns position of additional in view.
GNEDetectorE1(const std::string &id, GNELane *lane, GNEViewNet *viewNet, double pos, SUMOTime freq, const std::string &filename, const std::string &vehicleTypes, const std::string &name, bool friendlyPos, bool blockMovement)
Constructor.
std::vector< double > shapeRotations
The rotations of the single shape parts.
static bool isGenericParametersValid(const std::string &value)
check if given string can be parsed to a map/list of generic parameters
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
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
AdditionalMove myMove
variable AdditionalMove
GNEViewNet * myViewNet
The GNEViewNet this additional element belongs.
double getGeometryPositionOverLane() const
get position over lane that is applicable to the shape
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
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
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
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
RGBColor selectedAdditionalColor
additional selection color (busStops, Detectors...)
~GNEDetectorE1()
Destructor.
void selectAttributeCarrier(bool changeFlag=true)
bool isAdditionalValid() const
check if current additional is valid to be writed into XML (by default true, can be reimplemented in ...
GUIGlID getGlID() const
Returns the numerical id of the object.
const GNEAttributeCarrier * getDottedAC() const
get AttributeCarrier under cursor
void fixAdditionalProblem()
fix additional problem
static void drawShapeDottedContourRectangle(const GUIVisualizationSettings &s, const int type, const Position ¢er, const double width, const double height, const double rotation=0, const double offsetX=0, const double offsetY=0)
draw a dotted contour around the given Position with certain width and height
double scale
information about a lane's width (temporary, used for a single view)
void clearGeometry()
reset geometry
A point in 2D or 3D with translation and scaling methods.
double x() const
Returns the x-position.
std::string time2string(SUMOTime t)
GNEUndoList * getUndoList() const
get the undoList object
std::string getAttribute(SumoXMLAttr key) const
std::string myAdditionalName
name of additional
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
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.
GUIVisualizationColorSettings colorSettings
color settings
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
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
double y() const
Returns the y-position.
std::string getGenericParametersStr() const
return generic parameters in string format
block movement of a graphic element
std::string myFilename
The path to the output file.
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
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.
GNELane * retrieveLane(const std::string &id, bool failHard=true, bool checkVolatileChange=false)
get lane by id
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
static const RGBColor E1
color for E1 detectors
GUIVisualizationSizeSettings addSize
void add(const Position &pos)
Adds the given position to this one.
void updateGeometry()
update pre-computed geometry information
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
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)
Stores the information about how to visualize structures.
Position getLineCenter() const
get line center
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
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.
static const RGBColor WHITE
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects