40 GNEDetector(id, viewNet,
GLO_E1DETECTOR_INSTANT,
SUMO_TAG_INSTANT_INDUCTION_LOOP, pos, 0, filename, vehicleTypes, name, friendlyPos, blockMovement, {
64 std::string errorPosition;
65 const double len =
getLaneParents().front()->getParentEdge().getNBEdge()->getFinalLength();
92 newPosition.
add(offset);
146 const double width = (double) 2.0 * s.
scale;
162 glScaled(exaggeration, exaggeration, 1);
165 glVertex2d(-1.0, -2);
169 glTranslated(0, 0, .01);
171 glVertex2d(0, 2 - .1);
172 glVertex2d(0, -2 + .1);
182 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
185 glVertex2f(-1.0, -2);
189 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
199 glRotated(90, 0, 0, -1);
216 glTranslated(-1, 0, 0);
306 return canParse<double>(value) && fabs(parse<double>(value)) <
getLaneParents().front()->getParentEdge().getNBEdge()->getFinalLength();
318 return canParse<bool>(value);
320 return canParse<bool>(value);
322 return canParse<bool>(value);
362 if (parse<bool>(value)) {
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)
static bool checkAndFixDetectorPosition(double &pos, const double laneLength, const bool friendlyPos)
check if the position of a detector over a lane is valid
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 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 updateGeometry()
update pre-computed geometry information
void add(const Position &pos)
Adds the given position to this one.
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
const std::string & getAdditionalID() const
static const RGBColor WHITE
Stores the information about how to visualize structures.
Position offset
The offSet of the block icon.
double y() const
Returns the y-position.
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)
static const RGBColor E1Instant
color for E1 Instant detectors
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
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
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...
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
RGBColor selectedAdditionalColor
additional selection color (busStops, Detectors...)
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
std::string getAttribute(SumoXMLAttr key) const
GNEViewNet * myViewNet
The GNEViewNet this additional element belongs.
AdditionalMove myMove
variable AdditionalMove
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)
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
double getGeometryPositionOverLane() const
get position over lane that is applicable to the shape
An instantenous induction loop.
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
Position getPositionInView() const
Returns position of additional in view.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes ...
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 commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(...)
friend class GNEChange_Attribute
declare friend class
bool isAdditionalValid() const
check if current additional is valid to be writed into XML (by default true, can be reimplemented in ...
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
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
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.
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) ...
~GNEDetectorE1Instant()
Destructor.
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
GUIVisualizationDetailSettings detailSettings
detail settings
void fixAdditionalProblem()
fix additional problem
void changeLaneParents(GNEShape *elementChild, const std::string &newLaneIDs)
change edge parents of a shape
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(...)
const std::string & getTagStr() const
get tag assigned to this object in string format
std::string getAdditionalProblem() const
return a string with the current additional problem
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.
GUIVisualizationColorSettings colorSettings
color settings
std::string firstOriginalLanePosition
value for saving first original position over lane before moving
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) ...
GNELane * retrieveLane(const std::string &id, bool failHard=true, bool checkVolatileChange=false)
get lane by id
void setRotation(GNELane *additionalLane=nullptr)
set Rotation of block Icon (must be called in updateGeometry() function)
double myPositionOverLane
position of detector over Lane