38 const std::vector<GNEJunction*>& junctionParents,
39 const std::vector<GNEEdge*>& edgeParents,
40 const std::vector<GNELane*>& laneParents,
41 const std::vector<GNEAdditional*>& additionalParents,
42 const std::vector<GNEShape*>& shapeParents,
43 const std::vector<GNETAZElement*>& TAZElementParents,
44 const std::vector<GNEDemandElement*>& demandElementParents,
45 const std::vector<GNEGenericData*>& genericDataParents) :
47 GNEHierarchicalElement(net, tag, junctionParents, edgeParents, laneParents, additionalParents, shapeParents, TAZElementParents, demandElementParents, genericDataParents),
49 myAdditionalName(additionalName),
50 myBlockMovement(blockMovement),
51 mySpecialColor(nullptr) {
56 const std::vector<GNEJunction*>& junctionParents,
57 const std::vector<GNEEdge*>& edgeParents,
58 const std::vector<GNELane*>& laneParents,
59 const std::vector<GNEAdditional*>& additionalParents,
60 const std::vector<GNEShape*>& shapeParents,
61 const std::vector<GNETAZElement*>& TAZElementParents,
62 const std::vector<GNEDemandElement*>& demandElementParents,
63 const std::vector<GNEGenericData*>& genericDataParents) :
64 GUIGlObject(type, additionalParents.front()->getID()),
65 GNEHierarchicalElement(net, tag, junctionParents, edgeParents, laneParents, additionalParents, shapeParents, TAZElementParents, demandElementParents, genericDataParents),
67 myAdditionalName(additionalName),
68 myBlockMovement(blockMovement),
69 mySpecialColor(nullptr) {
127 const std::string attributeValue =
getAttribute(attrProperty.getAttr());
129 if (attrProperty.isOptional() && !attrProperty.isVClasses()) {
131 if (attrProperty.getDefaultValue() != attributeValue) {
133 if (attrProperty.hasAttrSynonym()) {
134 device.
writeAttr(attrProperty.getAttrSynonym(), attributeValue);
137 if (attrProperty.isSVCPermission()) {
152 device.
writeAttr(attrProperty.getAttr(), attributeValue);
158 if (attrProperty.hasAttrSynonym()) {
159 device.
writeAttr(attrProperty.getAttrSynonym(), attributeValue);
162 if (attrProperty.isSVCPermission()) {
177 device.
writeAttr(attrProperty.getAttr(), attributeValue);
186 deviceChildren.
writeXMLHeader(
"rerouterValue",
"additional_file.xsd");
190 if (additionalChild->getParentAdditionals().size() < 1) {
191 additionalChild->writeAdditional(deviceChildren);
192 }
else if (
myTagProperty.
getTag() == additionalChild->getTagProperty().getMasterTags().front()) {
193 additionalChild->writeAdditional(deviceChildren);
196 deviceChildren.
close();
200 if (!additionalChild->getTagProperty().isSymbol()) {
202 if (additionalChild->getParentAdditionals().size() < 2) {
203 additionalChild->writeAdditional(device);
204 }
else if (
myTagProperty.
getTag() == additionalChild->getTagProperty().getMasterTags().front()) {
205 additionalChild->writeAdditional(device);
286 new FXMenuSeparator(ret);
293 new FXMenuSeparator(ret);
361 glTranslated(0, 0,
getType() + offsetFront);
365 if (segment.isLaneSegment() && (segment.getLane() == lane)) {
384 if (segment.isLaneSegment() && (segment.getLane() == lane)) {
414 glTranslated(0, 0,
getType() + offsetFront);
452 if (i.hasStaticDefaultValue()) {
574 const double lanePosition = firstLaneShape.
length2D() >= endLaneposition ? endLaneposition : firstLaneShape.
length2D();
593 const std::map<std::string, std::string>&
602 throw ProcessError(
"Calling non-implemented function checkChildAdditionalRestriction during saving of " +
getTagStr() +
". It muss be reimplemented in child class");
@ MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
@ MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
@ MID_COPY_NAME
Copy object name - popup entry.
#define WRITE_WARNING(msg)
void writePermissions(OutputDevice &into, SVCPermissions permissions)
writes allowed disallowed attributes if needed;
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_E2DETECTOR_MULTILANE
an e2 detector over multiple lanes (used by Netedit)
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ SUMO_TAG_EDGE
begin/end of the description of an edge
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A class that stores a 2D geometrical boundary.
Position getCenter() const
Returns the center of the boundary.
static std::string getFilePath(const std::string &path)
Removes the file information from the given path.
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
static void drawBoxLines(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double width, int cornerDetail=0, double offset=0)
Draws thick lines.
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)
bool isAdditionalBlocked() const
Check if additional item is currently blocked (i.e. cannot be moved with mouse)
const std::string & getID() const
get ID
virtual std::string getAttribute(SumoXMLAttr key) const =0
virtual bool isAdditionalValid() const
check if current additional is valid to be writed into XML (by default true, can be reimplemented in ...
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
void updatePartialGeometry(const GNELane *lane)
partial update pre-computed geometry information
GUIGlObject * getGUIGlObject()
get GUIGlObject associated with this AttributeCarrier
void replaceAdditionalParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace additional parent
GNEGeometry::Geometry myAdditionalGeometry
geometry to be precomputed in updateGeometry(...)
virtual void openAdditionalDialog()
open Additional Dialog
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
void replaceAdditionalChildLanes(const std::string &value)
replace additional child lanes
void replaceAdditionalParentEdges(const std::string &value)
replace additional parent edges
void drawAdditionalID(const GUIVisualizationSettings &s) const
draw additional ID
void replaceAdditionalParentLanes(const std::string &value)
replace additional parent lanes
bool myBlockMovement
boolean to check if additional element is blocked (i.e. cannot be moved with mouse)
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Position getPositionInView() const
Returns position of additional in view.
void calculatePerpendicularLine(const double endLaneposition)
calculate perpendicular line between lane parents
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
std::string myAdditionalName
name of additional
void drawAdditionalName(const GUIVisualizationSettings &s) const
draw additional name
Boundary myBoundary
Additional Boundary.
virtual void fixAdditionalProblem()
fix additional problem (by default throw an exception, has to be reimplemented in children)
void setSpecialColor(const RGBColor *color)
set special color
const RGBColor * mySpecialColor
pointer to special color (used for drawing Additional with a certain color, mainly used for selection...
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
method for setting the attribute and letting the object perform additional changes
virtual bool checkChildAdditionalRestriction() const
check restriction with the number of children
GNEGeometry::SegmentGeometry myAdditionalSegmentGeometry
segment geometry to be precomputed in updateGeometry(...) (used by E2Multilane)
const GNEGeometry::SegmentGeometry & getAdditionalSegmentGeometry() const
obtain additional segment geometry
void replaceAdditionalChildEdges(const std::string &value)
replace additional child edges
GNEAdditional(const std::string &id, GNENet *net, GUIGlObjectType type, SumoXMLTag tag, std::string additionalName, bool blockMovement, const std::vector< GNEJunction * > &junctionParents, const std::vector< GNEEdge * > &edgeParents, const std::vector< GNELane * > &laneParents, const std::vector< GNEAdditional * > &additionalParents, const std::vector< GNEShape * > &shapeParents, const std::vector< GNETAZElement * > &TAZElementParents, const std::vector< GNEDemandElement * > &demandElementParents, const std::vector< GNEGenericData * > &genericDataParents)
Constructor.
bool isValidDetectorID(const std::string &newID) const
check if a new detector ID is valid
void replaceDemandElementParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace demand element parent
void writeAdditional(OutputDevice &device) const
writte additional element into a xml file
virtual ~GNEAdditional()
Destructor.
const std::string & getOptionalAdditionalName() const
Returns the additional name.
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position (Currently unused in shapes)
const GNEGeometry::Geometry & getAdditionalGeometry() const
obtain additional geometry
bool isValidAdditionalID(const std::string &newID) const
check if a new additional ID is valid
void setDefaultValues()
change all attributes of additional with their default values (note: this cannot be undo)
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const double offsetFront) const
Draws partial object (lane)
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
virtual std::string getAdditionalProblem() const
return a string with the current additional problem (by default empty, can be reimplemented in childr...
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc....
const std::string & getTagStr() const
get tag assigned to this object in string format
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
FXIcon * getIcon() const
get FXIcon associated to this AC
GNENet * myNet
pointer to net
GNENet * getNet() const
get pointer to net
const GNETagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
A road/street connecting two junctions (netedit-version)
NBEdge * getNBEdge() const
returns the internal NBEdge
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
class for pack all variables related with DottedGeometry
class for NETEDIT geometries over lanes
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape, double startPos=-1, double endPos=-1, const Position &extraFirstPosition=Position::INVALID, const Position &extraLastPosition=Position::INVALID)
update geometry shape
bool exist(const GNELane *toLane) const
check if exist a lane2lane geometry for the given tolane
const GNEGeometry::Geometry & getLane2laneGeometry(const GNELane *toLane) const
get lane2lane geometry
const GNEGeometry::DottedGeometry & getLane2laneDottedGeometry(const GNELane *toLane) const
get lane2lane dotted geometry
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const std::vector< GNEEdge * > & getParentEdges() const
get parent edges
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
const std::vector< GNEAdditional * > & getChildAdditionals() const
return child additionals
void replaceParentElements(T *elementChild, const U &newParents)
replace parent elements
void replaceChildElements(T *elementChild, const U &newChildren)
replace child elements
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
const PositionVector & getLaneShape() const
const GNEGeometry::DottedGeometry & getDottedLaneGeometry() const
get dotted lane geometry
const GNEGeometry::Lane2laneConnection & getLane2laneConnections() const
get Lane2laneConnection struct
int getIndex() const
returns the index of the lane
GNEEdge * getParentEdge() const
get arent edge
A NBNetBuilder extended by visualisation and editing capabilities.
GNELane * retrieveLane(const std::string &id, bool failHard=true, bool checkVolatileChange=false)
get lane by id
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true) const
get edge by id
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
GNEViewNet * getViewNet() const
get view net
An special type of Attribute carrier that owns hierarchical elements.
bool canMaskXYZPositions() const
return true if tag correspond to an element that can mask the attributes "X", "Y" and "Z" position as...
bool hasTagSynonym() const
return true if tag correspond to an element that will be written in XML with another tag
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool hasMinimumNumberOfChildren() const
return true if tag correspond to an element that only have a limited number of children
bool canWriteChildrenSeparate() const
return true if tag correspond to an element that can write their child in a different file
SumoXMLTag getTagSynonym() const
get tag synonym
bool hasDialog() const
return true if tag correspond to an element that can be edited using a dialog
bool hasAttribute(SumoXMLAttr attr) const
check if current TagProperties owns the attribute "attr"
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
GUIGlID getGlID() const
Returns the numerical id of the object.
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
A window containing a gl-object's parameter.
void mkItem(const char *name, bool dynamic, ValueSource< T > *src)
Adds a row which obtains its value from a ValueSource.
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Stores the information about how to visualize structures.
GUIVisualizationTextSettings addName
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
GUIVisualizationSizeSettings addSize
bool drawForPositionSelection
whether drawing is performed for the purpose of selecting objects with a single click
GUIVisualizationTextSettings addFullName
bool drawDottedContour() const
check if dotted contour can be drawn
bool drawAdditionals(const double exaggeration) const
check if additionals must be drawn
GUIVisualizationColorSettings colorSettings
color settings
double scale
information about a lane's width (temporary, used for a single view)
GUIVisualizationDetectorSettings detectorSettings
Detector settings.
double getTextAngle(double objectAngle) const
return an angle that is suitable for reading text aligned with the given angle (degrees)
double getLaneWidth() const
Returns the default width of lanes of this edge.
static OptionsCont & getOptions()
Retrieves the options.
Static storage of an output device and its base (abstract) implementation.
bool writeXMLHeader(const std::string &rootElement, const std::string &schemaFile, std::map< SumoXMLAttr, std::string > attrs=std::map< SumoXMLAttr, std::string >())
Writes an XML header with optional configuration.
void close()
Closes the device and removes it from the dictionary.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
A point in 2D or 3D with translation and scaling methods.
double x() const
Returns the x-position.
double z() const
Returns the z-position.
double y() const
Returns the y-position.
double length2D() const
Returns the length.
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
static const RGBColor RED
named colors
static bool isValidAdditionalID(const std::string &value)
whether the given string is a valid id for an additional object
static bool isValidDetectorID(const std::string &value)
whether the given string is a valid id for an detector
struct for variables used in Geometry extremes
double laneEndPosition
arrival position over lane
double laneStartPosition
depart position over lane
struct for pack all variables related with geometry of elemements divided in segments
static void drawDottedContourLane(const DottedContourType type, const GUIVisualizationSettings &s, const DottedGeometry &dottedGeometry, const double width, const bool drawFirstExtrem, const bool drawLastExtrem)
draw dotted contour for the given dottedGeometry (used by lanes, routes, etc.)
static void updateGeometricPath(GNEGeometry::SegmentGeometry &segmentGeometry, const GNELane *lane, GNEGeometry::ExtremeGeometry &extremeGeometry)
calculate route between edges
static void drawSegmentGeometry(const GNEViewNet *viewNet, const SegmentGeometry::Segment &segment, const double width)
draw geometry segment
static void drawGeometry(const GNEViewNet *viewNet, const Geometry &geometry, const double width)
draw geometry
bool showAdditionals() const
check if additionals has to be drawn
RGBColor selectedAdditionalColor
additional selection color (busStops, Detectors...)
static const RGBColor E2Color
color for E2 detectors
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
double scaledSize(double scale, double constFactor=0.1) const
get scale size