 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
39 GNEDetector(id, viewNet,
GLO_E1DETECTOR_INSTANT,
SUMO_TAG_INSTANT_INDUCTION_LOOP, pos, 0, filename, vehicleTypes, name, friendlyPos, blockMovement, {
63 std::string errorPosition;
64 const double len =
getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
91 newPosition.
add(offset);
136 const double width = (double) 2.0 * s.
scale;
151 glScaled(exaggeration, exaggeration, 1);
154 glVertex2d(-1.0, -2);
158 glTranslated(0, 0, .01);
160 glVertex2d(0, 2 - .1);
161 glVertex2d(0, -2 + .1);
171 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
174 glVertex2f(-1.0, -2);
178 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
188 glRotated(90, 0, 0, -1);
205 glTranslated(-1, 0, 0);
207 glScaled(exaggeration, exaggeration, 1);
298 return canParse<double>(value) && fabs(parse<double>(value)) <
getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
310 return canParse<bool>(value);
312 return canParse<bool>(value);
314 return canParse<bool>(value);
360 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)
Position position
position of the block icon
void fixAdditionalProblem()
fix additional problem
std::string getParametersStr() const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
const std::string & getAdditionalID() const
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
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,...
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
void updateGeometryPosition(const GNELane *lane, const double posOverLane)
update position and rotation
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Position getPositionInView() const
Returns position of additional in view.
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
std::string getAttribute(SumoXMLAttr key) const
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
~GNEDetectorE1Instant()
Destructor.
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
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)
static const RGBColor E1Instant
color for E1 Instant detectors
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...)
bool isAdditionalValid() const
check if current additional is valid to be writed into XML (by default true, can be reimplemented in ...
const PositionVector & getShape() const
The shape of the additional element.
void selectAttributeCarrier(bool changeFlag=true)
GUIGlID getGlID() const
Returns the numerical id of the object.
const GNEAttributeCarrier * getDottedAC() const
get AttributeCarrier under cursor
void replaceParentLanes(GNEShape *elementChild, const std::string &newLaneIDs)
replace the parent edges of a shape
parameters "key1=value1|key2=value2|...|keyN=valueN"
double getRotation() const
get rotation
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 updateGeometry()
update pre-computed geometry information
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes
A point in 2D or 3D with translation and scaling methods.
double x() const
Returns the x-position.
GNEUndoList * getUndoList() const
get the undoList object
GNEGeometry::Geometry myAdditionalGeometry
geometry to be precomputed in updateGeometry(...)
std::string myAdditionalName
name of additional
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.
const Position & getPosition() const
get Position
GUIVisualizationColorSettings colorSettings
color settings
RGBColor selectionColor
basic selection color
void setParametersStr(const std::string ¶msString)
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
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.
static bool areParametersValid(const std::string &value, bool report=false)
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
GNEDetectorE1Instant(const std::string &id, GNELane *lane, GNEViewNet *viewNet, double pos, const std::string &filename, const std::string &vehicleTypes, const std::string &name, bool friendlyPos, bool blockMovement)
Constructor.
std::string getAdditionalProblem() const
return a string with the current additional problem
block movement of a graphic element
std::string myFilename
The path to the output file.
bool drawAdditionals(const double exaggeration) const
check if additionals must be drawn
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
GNELane * retrieveLane(const std::string &id, bool failHard=true, bool checkVolatileChange=false)
get lane by id
GUIVisualizationSizeSettings addSize
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...
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)
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
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...
bool isAttributeEnabled(SumoXMLAttr key) const
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
An instantenous induction loop.
Position offset
The offSet of the block icon.
static const RGBColor WHITE