39 GNEDetectorE1::GNEDetectorE1(
const std::string&
id,
GNELane* lane,
GNEViewNet* viewNet,
double pos,
double freq,
const std::string& filename,
const std::string& vehicleTypes,
const std::string& name,
bool friendlyPos,
bool blockMovement) :
40 GNEDetector(id, viewNet,
GLO_E1DETECTOR,
SUMO_TAG_E1DETECTOR, pos, freq, filename, vehicleTypes, name, friendlyPos, blockMovement),
63 std::string errorPosition;
90 newPosition.
add(offset);
157 double width = (double) 2.0 * s.
scale;
172 glScaled(exaggeration, exaggeration, 1);
175 glVertex2d(-1.0, -2);
179 glTranslated(0, 0, .01);
181 glVertex2d(0, 2 - .1);
182 glVertex2d(0, -2 + .1);
193 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
196 glVertex2f(-1.0, -2);
200 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
211 glRotated(90, 0, 0, -1);
230 glTranslated(-1, 0, 0);
327 return canParse<double>(value);
329 return (canParse<double>(value) && (parse<double>(value) >= 0));
341 return canParse<bool>(value);
343 return canParse<bool>(value);
345 return canParse<bool>(value);
370 myFreq = parse<double>(value);
388 if (parse<bool>(value)) {
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
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 add(const Position &pos)
Adds the given position to this one.
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
const std::string & getAdditionalID() const
returns Additional ID
static const RGBColor SUMO_color_E1
color for E1 detectors
static const RGBColor WHITE
GNEDetectorE1(const std::string &id, GNELane *lane, GNEViewNet *viewNet, double pos, double freq, const std::string &filename, const std::string &vehicleTypes, const std::string &name, bool friendlyPos, bool blockMovement)
Constructor.
Stores the information about how to visualize structures.
Position offset
The offSet of the block icon.
double y() const
Returns the y-position.
Position snapToActiveGrid(const Position &pos) const
Returns a position that is mapped to the closest grid point if the grid is active.
double x() const
Returns the x-position.
bool isAdditionalValid() const
check if current additional is valid to be writed into XML (by default true, can be reimplemented in ...
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes ...
double myFreq
The aggregation period the values the detector collects shall be summed up.
~GNEDetectorE1()
Destructor.
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)
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.
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.
static const RGBColor BLACK
void fixAdditionalProblem()
fix additional problem
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
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
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.
GNEEdge & getParentEdge()
Returns underlying parent edge.
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
GNELane * myLane
The lane in which this detector is placed.
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.
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 removeGLObjectFromGrid(GUIGlObject *o)
add GL Object into net
friend class GNEChange_Attribute
declare friend class
void selectAttributeCarrier(bool changeFlag=true)
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(...)
block movement of a graphic element
RGBColor selectionColor
NETEDIT special colors.
std::string myVehicleTypes
attribute vehicle types
double getLengthGeometryFactor() const
get lenght geometry factor
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
const std::string getID() const
function to support debugging
bool myFriendlyPosition
Flag for friendly position.
double getFinalLength() const
get length that will be assigned to the lanes in the final network
RGBColor selectedAdditionalColor
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) ...
void updateGeometry(bool updateGrid)
update pre-computed geometry information
std::string getAttribute(SumoXMLAttr key) const
const PositionVector & getShape() const
returns the shape of the lane
GNELane * getLane() const
get lane
static void drawShapeDottedContour(const int type, const PositionVector &shape, const double width)
draw a dotted contour around the given Non closed shape with certain width
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 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.
std::string firstOriginalLanePosition
value for saving first original position over lane before moving
NBEdge * getNBEdge()
returns the internal NBEdge
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
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void addGLObjectIntoGrid(GUIGlObject *o)
add GL Object into net
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
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
GNELane * changeLane(GNELane *oldLane, const std::string &newLaneID)
change lane of additional
void setRotation(GNELane *additionalLane=nullptr)
set Rotation of block Icon (must be called in updateGeometry(bool updateGrid) function) ...
double myPositionOverLane
position of detector over Lane
void draw(double size=0.5) const
draw lock icon
std::string getAdditionalProblem() const
return a string with the current additional problem