40 const SUMOTime period,
const std::vector<GNELane*>& parentLanes,
const std::string& filename,
41 const std::vector<std::string>& vehicleTypes,
const std::vector<std::string>& nextEdges,
42 const std::string& detectPersons,
const std::string& name,
const bool friendlyPos,
44 GNEAdditional(id, net, type, tag, icon, name, {}, {}, parentLanes, {}, {}, {}),
46 myPositionOverLane(pos),
49 myVehicleTypes(vehicleTypes),
50 myNextEdges(nextEdges),
51 myDetectPersons(detectPersons),
52myFriendlyPosition(friendlyPos) {
57 const double pos,
const SUMOTime period,
const std::vector<GNELane*>& parentLanes,
const std::string& filename,
58 const std::string& name,
const bool friendlyPos,
const Parameterised::Map& parameters) :
59 GNEAdditional(net, type, tag, icon, name, {}, {}, parentLanes, {additionalParent}, {}, {}),
61myPositionOverLane(pos),
64myFriendlyPosition(friendlyPos) {
107 if (segment && segment->getJunction()) {
109 }
else if (segment && segment->getLane()) {
111 if (segment->getLaneIndex() == 0) {
113 }
else if (segment->getLaneIndex() == ((
int)
getParentLanes().size() - 1)) {
154 if (newE2Lanes.size() > 0) {
172 return (fixedPos *
getLane()->getLengthGeometryFactor());
288 return canParse<double>(value) && fabs(parse<double>(value)) <
getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
293 return (canParse<double>(value) && (parse<double>(value) >= 0));
318 return canParse<bool>(value);
320 return canParse<bool>(value);
385 myNextEdges = parse<std::vector<std::string> >(value);
394 if (parse<bool>(value)) {
424 glScaled(exaggeration, exaggeration, 1);
431 glVertex2d(-1.0, -2);
437 glTranslated(0, 0, .01);
441 glVertex2d(0, 2 - .1);
442 glVertex2d(0, -2 + .1);
450 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
455 glVertex2f(-1.0, -2);
461 glRotated(90, 0, 0, -1);
463 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
472 glTranslated(2, 0, 0);
483 const double exaggeration,
const std::string& logo,
const RGBColor& textColor)
const {
493 glTranslated(pos.
x(), pos.
y(), 0.1);
495 glScaled(exaggeration, exaggeration, 1);
506 const double exaggeration,
const std::string& logo,
const RGBColor& textColor)
const {
518 glTranslated(pos.
x(), pos.
y(), 0.1);
520 glScaled(exaggeration, exaggeration, 1);
@ NETWORK_MOVE
mode for moving network elements
GUIViewObjectsHandler gViewObjectsHandler
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
#define SUMOTime_MAX_PERIOD
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ GNE_TAG_MULTI_LANE_AREA_DETECTOR
an e2 detector over multiple lanes (placed here due create Additional Frame)
@ SUMO_TAG_LANE_AREA_DETECTOR
alternative tag for e2 detector
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ GNE_ATTR_SELECTED
element is selected
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ GNE_ATTR_SHIFTLANEINDEX
shift lane index (only used by elements over lanes)
@ SUMO_ATTR_DETECT_PERSONS
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
static void drawTriangleAtEnd(const Position &p1, const Position &p2, double tLength, double tWidth, const double extraOffset=0)
Draws a triangle at the end of the given line.
static void popMatrix()
pop matrix
static void pushMatrix()
push matrix
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, const int align=0, double width=-1)
static void fixLanePosition(double &pos, double &length, const double laneLength)
fix given position over lane
An Element which don't belong to GNENet but has influence in the simulation.
void setAdditionalID(const std::string &newID)
set additional ID
GUIGeometry myAdditionalGeometry
geometry to be precomputed in updateGeometry(...)
bool isValidDetectorID(const std::string &value) const
check if a new detector ID is valid
void replaceAdditionalParentLanes(const std::string &value)
replace additional parent lanes
void shiftLaneIndex()
shift lane index
GNEMoveOperation * getMoveOperationMultiLane(const double startPos, const double endPos)
get moveOperation for an element over multi lane
std::string myAdditionalName
name of additional
GNEMoveOperation * getMoveOperationSingleLane(const double startPos, const double endPos)
get moveOperation for an element over single lane
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
const std::string & getTagStr() const
get tag assigned to this object in string format
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
GNENet * myNet
pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
const GNETagProperties & myTagProperty
reference to tagProperty associated with this attribute carrier
static void changeAttribute(GNEAttributeCarrier *AC, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList, const bool force=false)
change attribute
SUMOTime myPeriod
The aggregation period the values the detector collects shall be summed up.
void drawE2DetectorLogo(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double exaggeration, const std::string &logo, const RGBColor &textColor) const
draw E2 detector Logo
std::string myFilename
The path to the output file.
double myPositionOverLane
position of detector over Lane
Position getPositionInView() const
Returns position of additional in view.
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
GNEDetector(const std::string &id, GNENet *net, GUIGlObjectType type, SumoXMLTag tag, FXIcon *icon, const double pos, const SUMOTime period, const std::vector< GNELane * > &parentLanes, const std::string &filename, const std::vector< std::string > &vehicleTypes, const std::vector< std::string > &nextEdges, const std::string &detectPersons, const std::string &name, const bool friendlyPos, const Parameterised::Map ¶meters)
Constructor.
~GNEDetector()
Destructor.
bool isDetectorValid(SumoXMLAttr key, const std::string &value)
double getPositionOverLane() const
get position over lane
double getGeometryPositionOverLane() const
get position over lane that is applicable to the shape
GNELane * getLane() const
get lane
virtual double getAttributeDouble(SumoXMLAttr key) const =0
void setDetectorAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
std::vector< std::string > myNextEdges
next edges
GNEMoveOperation * getMoveOperation()
get move operation
void drawE1Shape(const GUIVisualizationSettings::Detail d, const double exaggeration, const RGBColor &mainColor, const RGBColor &secondColor) const
draw E1 shape
const Parameterised::Map & getACParametersMap() const
get parameters map
double getDetectorAttributeDouble(SumoXMLAttr key) const
bool checkDrawMoveContour() const
check if draw move contour (red)
void writeDetectorValues(OutputDevice &device) const
write additional element into a xml file
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
bool myFriendlyPosition
Flag for friendly position.
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
std::string getDetectorAttribute(SumoXMLAttr key) const
std::vector< std::string > myVehicleTypes
attribute vehicle types
void drawE1DetectorLogo(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double exaggeration, const std::string &logo, const RGBColor &textColor) const
draw E1 detector Logo
std::string myDetectPersons
detect persons
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
method for setting the attribute and letting the object perform additional changes
std::string getParentName() const
Returns the name of the parent object.
NBEdge * getNBEdge() const
returns the internal NBEdge
std::string getNewListOfParents(const GNENetworkElement *currentElement, const GNENetworkElement *newNextElement) const
if use edge/parent lanes as a list of consecutive elements, obtain a list of IDs of elements after in...
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
GNEEdge * getParentEdge() const
get parent edge
bool getAllowChangeLane() const
allow change lane
CommonModeOptions * getCommonModeOptions() const
get common mode options
GNELane * retrieveLane(const std::string &id, bool hardFail=true, bool checkVolatileChange=false) const
get lane by id
A NBNetBuilder extended by visualisation and editing capabilities.
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
GNEViewNet * getViewNet() const
get view net
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
const GUIGlObject * getGUIGlObjectFront() const
get front GUIGLObject or a pointer to nullptr
bool isCurrentlyMovingElements() const
check if an element is being moved
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
const GNEViewNetHelper::EditNetworkElementShapes & getEditNetworkElementShapes() const
get Edit Shape module
GNEViewParent * getViewParent() const
get the net object
bool checkOverLockedElement(const GUIGlObject *GLObject, const bool isSelected) const
check if given element is locked (used for drawing select and delete contour)
const GNEViewNetHelper::ViewObjectsSelector & getViewObjectsSelector() const
get objects under cursor
GNEMoveFrame * getMoveFrame() const
get frame for move elements
static void rotateOverLane(const double rot)
rotate over lane (used by Lock icons, detector logos, etc.)
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
const PositionVector & getShape() const
The shape of the additional element.
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
const GNESegment * getSelectedSegment(const GUIGlObject *GLObject) const
get segment associated with the given GLObject (if exist)
Stores the information about how to visualize structures.
double getTextAngle(double objectAngle) const
return an angle that is suitable for reading text aligned with the given angle (degrees)
double getFinalLength() const
get length that will be assigned to the lanes in the final network
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
An upper class for objects with additional parameters.
static bool areParametersValid(const std::string &value, bool report=false, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
std::map< std::string, std::string > Map
parameters map
void setParametersStr(const std::string ¶msString, const std::string kvsep="=", const std::string sep="|")
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
std::string getParametersStr(const std::string kvsep="=", const std::string sep="|") const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
A point in 2D or 3D with translation and scaling methods.
double x() const
Returns the x-position.
double y() const
Returns the y-position.
double length2D() const
Returns the length.
Position getPolygonCenter() const
Returns the arithmetic of all corner points.
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
static StringBijection< PersonMode > PersonModeValues
person modes
static bool isValidListOfNetIDs(const std::string &value)
whether the given string is a valid list of id for a network (empty aren't allowed)
static bool isValidFilename(const std::string &value)
whether the given string is a valid attribute for a filename (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)
static bool isValidAttribute(const std::string &value)
whether the given string is a valid attribute for a certain key (for example, a name)
const std::string & getString(const T key) const
bool hasString(const std::string &str) const
static std::string escapeXML(const std::string &orig, const bool maskDoubleHyphen=false)
Replaces the standard escapes by their XML entities.
NetworkEditMode networkEditMode
the current Network edit mode
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
GNENetworkElement * getEditedNetworkElement() const
pointer to edited network element