 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
45 const std::vector<GNEEdge*>& parentEdges,
46 const std::vector<GNELane*>& parentLanes,
47 const std::vector<GNEShape*>& parentShapes,
48 const std::vector<GNEAdditional*>& parentAdditionals,
49 const std::vector<GNEDemandElement*>& parentDemandElements,
50 const std::vector<GNEEdge*>& childEdges,
51 const std::vector<GNELane*>& childLanes,
52 const std::vector<GNEShape*>& childShapes,
53 const std::vector<GNEAdditional*>& childAdditionals,
54 const std::vector<GNEDemandElement*>& childDemandElements) :
61 myAdditionalName(additionalName),
62 myBlockMovement(blockMovement),
64 mySpecialColor(nullptr) {
69 const std::vector<GNEEdge*>& parentEdges,
70 const std::vector<GNELane*>& parentLanes,
71 const std::vector<GNEShape*>& parentShapes,
72 const std::vector<GNEAdditional*>& parentAdditionals,
73 const std::vector<GNEDemandElement*>& parentDemandElements,
74 const std::vector<GNEEdge*>& childEdges,
75 const std::vector<GNELane*>& childLanes,
76 const std::vector<GNEShape*>& childShapes,
77 const std::vector<GNEAdditional*>& childAdditionals,
78 const std::vector<GNEDemandElement*>& childDemandElements) :
79 GUIGlObject(type, additionalParent->generateChildID(tag)),
85 myAdditionalName(additionalName),
86 myBlockMovement(blockMovement),
88 mySpecialColor(nullptr) {
140 if (i.isOptional() && !i.isVClasses()) {
142 if (i.getDefaultValue() != attributeValue) {
144 if (i.hasAttrSynonym()) {
145 device.
writeAttr(i.getAttrSynonym(), attributeValue);
148 if (i.isSVCPermission()) {
163 device.
writeAttr(i.getAttr(), attributeValue);
169 if (i.hasAttrSynonym()) {
170 device.
writeAttr(i.getAttrSynonym(), attributeValue);
173 if (i.isSVCPermission()) {
188 device.
writeAttr(i.getAttr(), attributeValue);
197 deviceChildren.
writeXMLHeader(
"rerouterValue",
"additional_file.xsd");
201 if (i->getParentAdditionals().size() < 1) {
202 i->writeAdditional(deviceChildren);
204 i->writeAdditional(deviceChildren);
207 deviceChildren.
close();
211 if (i->getParentAdditionals().size() < 2) {
212 i->writeAdditional(device);
214 i->writeAdditional(device);
279 i->startGeometryMoving();
300 i->endGeometryMoving();
327 new FXMenuCommand(ret, (
"Copy " +
getTagStr() +
" name to clipboard").c_str(),
nullptr, ret,
MID_COPY_NAME);
329 new FXMenuSeparator(ret);
336 new FXMenuSeparator(ret);
343 new FXMenuCommand(ret, (
"Cursor position over additional shape: " +
toString(innerPos)).c_str(),
nullptr,
nullptr, 0);
347 new FXMenuCommand(ret, (
"Cursor position over " +
toString(
SUMO_TAG_LANE) +
": " +
toString(innerPos + lanePos)).c_str(),
nullptr,
nullptr, 0);
353 new FXMenuCommand(ret, (
"Cursor position over additional shape: " +
toString(innerPos)).c_str(),
nullptr,
nullptr, 0);
357 new FXMenuCommand(ret, (
"Mouse position over " +
toString(
SUMO_TAG_EDGE) +
": " +
toString(innerPos + edgePos)).c_str(),
nullptr,
nullptr, 0);
396 myAdditional(additional) {}
401 if (myAdditional->myAdditionalGeometry.getShape().size() > 0 && myAdditional->myAdditionalGeometry.getShape().length() != 0) {
403 rotation = myAdditional->myAdditionalGeometry.getShape().rotationDegreeAtOffset((myAdditional->myAdditionalGeometry.getShape().length() / 2.)) - 90;
404 }
else if (additionalLane) {
422 glTranslated(position.x(), position.y(), myAdditional->getType() + 0.1);
426 glRotated(rotation, 0, 0, -1);
428 glRotated(180, 0, 0, 1);
430 glTranslated(offset.x(), offset.y(), 0);
432 if (myAdditional->drawUsingSelectColor()) {
433 if (!myAdditional->getTagProperty().canBlockMovement()) {
436 }
else if (myAdditional->myBlockMovement) {
444 if (!myAdditional->getTagProperty().canBlockMovement()) {
447 }
else if (myAdditional->myBlockMovement) {
468 if (i.hasStaticDefaultValue()) {
578 throw ProcessError(
"Calling non-implemented function checkChildAdditionalRestriction during saving of " +
getTagStr() +
". It muss be reimplemented in child class");
void writeAdditional(OutputDevice &device) const
writte additional element into a xml file
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
bool isAdditionalBlocked() const
Check if additional item is currently blocked (i.e. cannot be moved with mouse)
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_NMODE_SELECT
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
FXIcon * getIcon() const
get FXIcon associated to this AC
virtual Position getPositionInView() const =0
Returns position of additional in view.
An Element which don't belongs to GNENet but has influency in the simulation.
static bool isValidAdditionalID(const std::string &value)
whether the given string is a valid id for an additional object
A window containing a gl-object's parameter.
GNEAdditional(const std::string &id, GNEViewNet *viewNet, GUIGlObjectType type, SumoXMLTag tag, std::string additionalName, bool blockMovement, const std::vector< GNEEdge * > &parentEdges, const std::vector< GNELane * > &parentLanes, const std::vector< GNEShape * > &parentShapes, const std::vector< GNEAdditional * > &parentAdditionals, const std::vector< GNEDemandElement * > &parentDemandElements, const std::vector< GNEEdge * > &childEdges, const std::vector< GNELane * > &childLanes, const std::vector< GNEShape * > &childShapes, const std::vector< GNEAdditional * > &childAdditionals, const std::vector< GNEDemandElement * > &childDemandElements)
Constructor.
const std::string & getAdditionalID() const
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
const std::string getID() const
function to support debugging
#define WRITE_WARNING(msg)
An upper class for objects with additional parameters.
bool isPlacedInRTree() const
return true if Tag correspond to an element that has has to be placed in RTREE
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
bool canMaskStartEndPos() const
return true if tag correspond to an element that can mask the attributes "start" and "end" position a...
virtual Boundary getCenteringBoundary() const =0
Returns the boundary to which the view shall be centered in order to show the object.
Static storage of an output device and its base (abstract) implementation.
void setRotation(GNELane *additionalLane=nullptr)
set Rotation of block Icon (must be called in updateGeometry() function)
Boundary movingGeometryBoundary
boundary used during moving of elements (to avoid insertion in RTREE
double z() const
Returns the z-position.
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
void removeGLObjectFromGrid(GUIGlObject *o)
add GL Object into net
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
void updateAdditionalID(const std::string &oldID, GNEAdditional *additional)
update additional ID in container
begin/end of the description of a single lane
static OptionsCont & getOptions()
Retrieves the options.
void setDefaultValues()
change all attributes of additional with their default values (note: this cannot be undo)
open additional dialog (used in netedit)
Copy object name - popup entry.
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 isAdditionalValid() const
check if current additional is valid to be writed into XML (by default true, can be reimplemented in ...
void changeAdditionalID(const std::string &newID)
change ID of additional
bool hasMinimumNumberOfChildren() const
return true if tag correspond to an element that only have a limited number of children
static bool isValidDetectorID(const std::string &value)
whether the given string is a valid id for an detector
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
void close()
Closes the device and removes it from the dictionary.
std::string secondOriginalPosition
value for saving second original position over lane before moving
bool canWriteChildrenSeparate() const
return true if tag correspond to an element that can sort their children automatic
SumoXMLTag
Numbers representing SUMO-XML - element names.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
virtual std::string getAdditionalProblem() const
return a string with the current additional problem (by default empty, can be reimplemented in childr...
static void drawTexturedBox(int which, double size)
Draws a named texture as a box with the given size.
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
const RGBColor * mySpecialColor
pointer to special color (used for drawing Additional with a certain color, mainly used for selection...
AdditionalMove myMove
variable AdditionalMove
An special type of Attribute carrier that owns hierarchical elements.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
GNEViewNet * myViewNet
The GNEViewNet this additional element belongs.
static std::string getFilePath(const std::string &path)
Removes the file information from the given path.
const GNEGeometry::SegmentGeometry & getAdditionalSegmentGeometry() const
obtain additional segment geometry
bool hasAttribute(SumoXMLAttr attr) const
check if current TagProperties owns the attribute attr
A road/street connecting two junctions (netedit-version)
GNENet * getNet() const
get the net object
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
SumoXMLTag getTagSynonym() const
get tag synonym
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
virtual std::string getAttribute(SumoXMLAttr key) const =0
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
void reset()
Resets the boundary.
static const double lockIcon
lock icons
struct for pack all variables related with geometry of elemements divided in segments
bool isValidDetectorID(const std::string &newID) const
check if a new detector ID is valid
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
GUIVisualizationDetailSettings detailSettings
detail settings
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
const PositionVector & getShape() const
The shape of the additional element.
const PositionVector & getLaneShape() const
const GNEGeometry::Geometry & getAdditionalGeometry() const
obtain additional geometry
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
void mkItem(const char *name, bool dynamic, ValueSource< T > *src)
Adds a row which obtains its value from a ValueSource.
BlockIcon(GNEAdditional *additional)
constructor
void selectAttributeCarrier(bool changeFlag=true)
void writePermissions(OutputDevice &into, SVCPermissions permissions)
writes allowed disallowed attributes if needed;
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
GUIGlID getGlID() const
Returns the numerical id of the object.
begin/end of the description of an edge
static GUIGlID getTexture(GUITexture which)
returns a texture previously defined in the enum GUITexture
Network mode (Edges, junctions, etc..)
Supermode currentSupermode
the current supermode
A point in 2D or 3D with translation and scaling methods.
double x() const
Returns the x-position.
const TagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
GNEGeometry::Geometry myAdditionalGeometry
geometry to be precomputed in updateGeometry(...)
std::string myAdditionalName
name of additional
struct for pack all variables related with geometry of stop
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
bool myBlockMovement
boolean to check if additional element is blocked (i.e. cannot be moved with mouse)
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
~GNEAdditional()
Destructor.
void setSpecialColor(const RGBColor *color)
set special color
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
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
void addGLObjectIntoGrid(GUIGlObject *o)
add GL Object into net
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
double y() const
Returns the y-position.
virtual bool checkChildAdditionalRestriction() const
check restriction with the number of children
bool hasTagSynonym() const
return true if tag correspond to an element that will be written in XML with another tag
const std::string & getOptionalAdditionalName() const
Returns the additional name.
GNEViewNet * getViewNet() const
Returns a pointer to GNEViewNet in which additional element is located.
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
bool isDrawable() const
return true if tag correspond to a drawable element
GUISelectedStorage gSelected
A global holder of selected objects.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
An special type of Attribute carrier that owns hierarchical elements.
bool hasDialog() const
return true if tag correspond to an element that can be edited using a dialog
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
GNELane * retrieveLane(const std::string &id, bool failHard=true, bool checkVolatileChange=false)
get lane by id
reserved GLO type to pack all additionals
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
void endGeometryMoving()
begin movement (used when user click over additional to start a movement, to avoid problems with prob...
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 removeLockedObject(const GUIGlObjectType type)
set object unselected
const std::string & getTagStr() const
get tag assigned to this object in string format
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.
Copy typed object name - popup entry.
void startGeometryMoving()
Stores the information about how to visualize structures.
GNEGeometry::SegmentGeometry mySegmentGeometry
segment geometry to be precomputed in updateGeometry(...) (used by E2Multilane)
bool isValidAdditionalID(const std::string &newID) const
check if a new additional ID is valid
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Position originalViewPosition
value for saving first original position over lane before moving
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
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.
const std::vector< GNEAdditional * > & getChildAdditionals() const
return child additionals
virtual void openAdditionalDialog()
open Additional Dialog
void deselect(GUIGlID id)
Deselects the object with the given id.
bool canMaskXYZPositions() const
return true if tag correspond to an element that can mask the attributes "X", "Y" and "Z" position as...
GNEViewParent * getViewParent() const
get the net object
LockGLObjectTypes * getLockGLObjectTypes() const
get selected items Modul
virtual void fixAdditionalProblem()
fix additional problem (by default throw an exception, has to be reimplemented in children)
int getNumberOfAttributes() const
get number of attributes
void addedLockedObject(const GUIGlObjectType type)
set object selected