76 int numberOfSegments = (int)
shape.size() - 1;
78 if (numberOfSegments >= 0) {
83 for (
int i = 0; i < numberOfSegments; ++i) {
100 std::vector<int> numberOfSegments;
103 int numSeg = (int)i.size() - 1;
104 numberOfSegments.push_back((numSeg >= 0) ? numSeg : 0);
109 for (
int i = 0; i < (int)multiShape.size(); i++) {
114 for (
int j = 0; j < numberOfSegments.at(i); j++) {
116 const Position& f = multiShape[i][j];
118 const Position& s = multiShape[i][j + 1];
132 const std::vector<GNEEdge*>& edgeParents,
133 const std::vector<GNELane*>& laneParents,
134 const std::vector<GNEShape*>& shapeParents,
135 const std::vector<GNEAdditional*>& additionalParents,
136 const std::vector<GNEDemandElement*>& demandElementParents,
137 const std::vector<GNEEdge*>& edgeChildren,
138 const std::vector<GNELane*>& laneChildren,
139 const std::vector<GNEShape*>& shapeChildren,
140 const std::vector<GNEAdditional*>& additionalChildren,
141 const std::vector<GNEDemandElement*>& demandElementChildren) :
156 const std::vector<GNEEdge*>& edgeParents,
157 const std::vector<GNELane*>& laneParents,
158 const std::vector<GNEShape*>& shapeParents,
159 const std::vector<GNEAdditional*>& additionalParents,
160 const std::vector<GNEDemandElement*>& demandElementParents,
161 const std::vector<GNEEdge*>& edgeChildren,
162 const std::vector<GNELane*>& laneChildren,
163 const std::vector<GNEShape*>& shapeChildren,
164 const std::vector<GNEAdditional*>& additionalChildren,
165 const std::vector<GNEDemandElement*>& demandElementChildren) :
220 if (i.isWriteXMLOptional() && !i.isCombinable()) {
222 if (i.getDefaultValue() != attribute) {
224 if (i.hasAttrSynonym()) {
225 device.
writeAttr(i.getAttrSynonym(), attribute);
228 if (i.isSVCPermission()) {
233 }
else if (myTagProperty.canMaskXYZPositions() && (i.getAttr() ==
SUMO_ATTR_POSITION)) {
243 device.
writeAttr(i.getAttr(), attribute);
249 if (i.hasAttrSynonym()) {
250 device.
writeAttr(i.getAttrSynonym(), attribute);
253 if (i.isSVCPermission()) {
258 }
else if (myTagProperty.canMaskXYZPositions() && (i.getAttr() ==
SUMO_ATTR_POSITION)) {
268 device.
writeAttr(i.getAttr(), attribute);
277 deviceChildren.
writeXMLHeader(
"rerouterValue",
"additional_file.xsd");
281 if (i->getAdditionalParents().size() < 1) {
282 i->writeAdditional(deviceChildren);
283 }
else if (myTagProperty.getTag() == i->getTagProperty().getParentTag()) {
284 i->writeAdditional(deviceChildren);
287 deviceChildren.
close();
291 if (i->getAdditionalParents().size() < 2) {
292 i->writeAdditional(device);
293 }
else if (myTagProperty.getTag() == i->getTagProperty().getParentTag()) {
294 i->writeAdditional(device);
359 i->startGeometryMoving();
380 i->endGeometryMoving();
413 new FXMenuCommand(ret, (
"Copy " +
getTagStr() +
" name to clipboard").c_str(),
nullptr, ret,
MID_COPY_NAME);
415 new FXMenuSeparator(ret);
422 new FXMenuSeparator(ret);
429 new FXMenuCommand(ret, (
"Cursor position inner additional: " +
toString(innerPos)).c_str(),
nullptr,
nullptr, 0);
433 new FXMenuCommand(ret, (
"Cursor position over " +
toString(
SUMO_TAG_LANE) +
": " +
toString(innerPos + lanePos)).c_str(),
nullptr,
nullptr, 0);
439 new FXMenuCommand(ret, (
"Cursor position inner additional: " +
toString(innerPos)).c_str(),
nullptr,
nullptr, 0);
442 const double edgePos = edge->
getLanes().at(0)->getGeometry().shape.nearest_offset_to_point2D(
myGeometry.
shape[0]);
443 new FXMenuCommand(ret, (
"Mouse position over " +
toString(
SUMO_TAG_EDGE) +
": " +
toString(innerPos + edgePos)).c_str(),
nullptr,
nullptr, 0);
498 myAdditional(additional) {}
506 }
else if (additionalLane) {
530 glRotated(180, 0, 0, 1);
570 if (i.hasStaticDefaultValue()) {
682 result += i.first +
"=" + i.second +
"|";
685 if (!result.empty()) {
692 std::vector<std::pair<std::string, std::string> >
694 std::vector<std::pair<std::string, std::string> > result;
697 result.push_back(std::make_pair(i.first, i.second));
708 std::vector<std::string> parsedValues;
711 parsedValues.push_back(stValues.
next());
714 for (
auto i : parsedValues) {
715 std::vector<std::string> parsedParameters;
718 parsedParameters.push_back(stParam.
next());
722 setParameter(parsedParameters.front(), parsedParameters.back());
731 throw ProcessError(
"Calling non-implemented function checkAdditionalChildRestriction during saving of " +
getTagStr() +
". It muss be reimplemented in child class");
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
static void drawTexturedBox(int which, double size)
Draws a named texture as a box with the given size.
virtual void openAdditionalDialog()
open Additional Dialog
const TagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
bool hasTagSynonym() const
return true if tag correspond to an element that will be written in XML with another tag ...
virtual void fixAdditionalProblem()
fix additional problem (by default throw an exception, has to be reimplemented in children) ...
Copy object name - popup entry.
void writePermissions(OutputDevice &into, SVCPermissions permissions)
writes allowed disallowed attributes if needed;
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
An special type of Attribute carrier that owns hierarchical elements.
void close()
Closes the device and removes it from the dictionary.
SumoXMLTag
Numbers representing SUMO-XML - element names.
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
bool isAdditionalBlocked() const
Check if additional item is currently blocked (i.e. cannot be moved with mouse)
SumoXMLTag getTagSynonym() const
get tag synonym
void writeAdditional(OutputDevice &device) const
writte additional element into a xml file
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
void addedLockedObject(const GUIGlObjectType type)
set object selected
PositionVector shape
The shape of the netElement element.
PositionVector multiShapeUnified
multi shape unified
void calculateMultiShapeRotationsAndLengths()
calculate multi shape rotations and lenghts
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
bool isDrawable() const
return true if tag correspond to a drawable element
void append(const PositionVector &v, double sameThreshold=2.0)
double z() const
Returns the z-position.
std::vector< double > shapeRotations
The rotations of the single shape parts.
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
begin/end of the description of a single lane
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
const std::string & getAdditionalID() const
std::string secondOriginalPosition
value for saving second original position over lane before moving
static GUIGlID getTexture(GUITexture which)
returns a texture previously defined in the enum GUITexture
struct for pack all variables related with geometry of elemement
GNEAdditional * myAdditional
pointer to additional parent
Stores the information about how to visualize structures.
virtual Boundary getCenteringBoundary() const =0
Returns the boundary to which the view shall be centered in order to show the object.
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
GNEViewParent * getViewParent() const
get the net object
Position offset
The offSet of the block icon.
double y() const
Returns the y-position.
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
PositionVector getShape() const
Returns additional element's shape.
void mkItem(const char *name, bool dynamic, ValueSource< T > *src)
Adds a row which obtains its value from a ValueSource.
double x() const
Returns the x-position.
bool isAttributeEnabled(SumoXMLAttr key) const
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
method for setting the attribute and letting the object perform additional changes ...
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
bool canMaskStartEndPos() const
return true if tag correspond to an element that can mask the attributes "start" and "end" position a...
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
FXIcon * getIcon() const
get FXIcon associated to this AC
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
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
BlockIcon(GNEAdditional *additional)
constructor
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
void setDefaultValues()
change all attributes of additional with their default values (note: this cannot be undo) ...
const RGBColor * mySpecialColor
pointer to special color (used for drawing Additional with a certain color, mainly used for selection...
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
bool hasNext()
returns the information whether further substrings exist
virtual bool checkAdditionalChildRestriction() const
check restriction with the number of children
static bool isValidGenericParameterKey(const std::string &value)
whether the given string is a valid key for a generic parameter
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used, also builds an entry for copying the geo-position.
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
const AdditionalGeometry & getAdditionalGeometry() const
obtain AdditionalGeometry
virtual bool isAdditionalValid() const
check if current additional is valid to be writed into XML (by default true, can be reimplemented in ...
const std::vector< GNEAdditional * > & getAdditionalChildren() const
return vector of additionals that have as Parent this edge (For example, Calibrators) ...
void changeAdditionalID(const std::string &newID)
change ID of additional
virtual std::string getAttribute(SumoXMLAttr key) const =0
GNEAdditional(const std::string &id, GNEViewNet *viewNet, GUIGlObjectType type, SumoXMLTag tag, std::string additionalName, bool blockMovement, const std::vector< GNEEdge *> &edgeParents, const std::vector< GNELane *> &laneParents, const std::vector< GNEShape *> &shapeParents, const std::vector< GNEAdditional *> &additionalParents, const std::vector< GNEDemandElement *> &demandElementParents, const std::vector< GNEEdge *> &edgeChildren, const std::vector< GNELane *> &laneChildren, const std::vector< GNEShape *> &shapeChildren, const std::vector< GNEAdditional *> &additionalChildren, const std::vector< GNEDemandElement *> &demandElementChildren)
Constructor.
#define WRITE_WARNING(msg)
static OptionsCont & getOptions()
Retrieves the options.
double rotation
The rotation of the block icon.
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) ...
const std::vector< GNEDemandElement * > & getDemandElementChildren() const
return vector of demand elements that have as Parent this edge (For example, Calibrators) ...
std::vector< std::vector< double > > multiShapeRotations
The rotations of the multi-shape parts.
virtual std::string getAdditionalProblem() const
return a string with the current additional problem (by default empty, can be reimplemented in childr...
GNEViewNet * myViewNet
The GNEViewNet this additional element belongs.
AdditionalMove myMove
variable AdditionalMove
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
An special type of Attribute carrier that owns hierarchical elements.
bool canBlockMovement() const
return true if tag correspond to an element that can block their movement
bool showLockIcon() const
check if lock icon should be visible
LockGLObjectTypes * getLockGLObjectTypes() const
get selected items Modul
static bool isValidGenericParameterValue(const std::string &value)
whether the given string is a valid value for a generic parameter
void updateAdditionalID(const std::string &oldID, GNEAdditional *additional)
update additional ID in container
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
int getNumberOfAttributes() const
get number of attributes
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.
A point in 2D or 3D with translation and scaling methods.
PositionVector shape
The shape of the additional element.
Supermode currentSupermode
the current supermode
std::string myAdditionalName
name of additional
void removeLockedObject(const GUIGlObjectType type)
set object unselected
void removeGLObjectFromGrid(GUIGlObject *o)
add GL Object into net
static bool isValidDetectorID(const std::string &value)
whether the given string is a valid id for an detector
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
void selectAttributeCarrier(bool changeFlag=true)
std::vector< std::vector< double > > multiShapeLengths
The lengths of the multi-shape shape parts.
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_NMODE_SELECT
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
bool isPlacedInRTree() const
return true if Tag correspond to an element that has has to be placed in RTREE
const std::string getID() const
function to support debugging
const NetElementGeometry & getGeometry() const
~GNEAdditional()
Destructor.
std::vector< PositionVector > multiShape
The multi-shape of the additional element (used by certain additionals)
void setSpecialColor(const RGBColor *color)
set special color
An upper class for objects with additional parameters.
bool myBlockMovement
boolean to check if additional element is blocked (i.e. cannot be moved with mouse) ...
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
void calculateShapeRotationsAndLengths()
calculate shape rotations and lenghts
begin/end of the description of an edge
std::vector< double > shapeLengths
The lengths of the single shape parts.
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element
A road/street connecting two junctions (netedit-version)
GUIVisualizationDetailSettings detailSettings
detail settings
reserved GLO type to pack all additionals
void reset()
Resets the boundary.
GNEViewNet * getViewNet() const
Returns a pointer to GNEViewNet in which additional element is located.
void deselect(GUIGlID id)
Deselects the object with the given id.
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
double length() const
Returns the length.
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
An Element which don't belongs to GNENet but has influency in the simulation.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
AdditionalGeometry myGeometry
geometry to be precomputed in updateGeometry(...)
const std::string & getTagStr() const
get tag assigned to this object in string format
Boundary movingGeometryBoundary
boundary used during moving of elements (to avoid insertion in RTREE
static const double lockIcon
lock icons
std::string getGenericParametersStr() const
return generic parameters in string format
open additional dialog (used in netedit)
GNENet * getNet() const
get the net object
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
GUIGlID getGlID() const
Returns the numerical id of the object.
Static storage of an output device and its base (abstract) implementation.
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
bool hasAttribute(SumoXMLAttr attr) const
check if current TagProperties owns the attribute attr
const TagProperties & getTagProperty() const
get Tag Property assigned to this object
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
bool isValidAdditionalID(const std::string &newID) const
check if a new additional ID is valid
static std::string getFilePath(const std::string &path)
Removes the file information from the given path.
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
void endGeometryMoving()
begin movement (used when user click over additional to start a movement, to avoid problems with prob...
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
bool hasDialog() const
return true if tag correspond to an element that can be edited using a dialog
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
AdditionalGeometry()
constructor
Network mode (Edges, junctions, etc..)
void addGLObjectIntoGrid(GUIGlObject *o)
add GL Object into net
GUISelectedStorage gSelected
A global holder of selected objects.
GNELane * retrieveLane(const std::string &id, bool failHard=true, bool checkVolatileChange=false)
get lane by id
void startGeometryMoving()
Copy typed object name - popup entry.
A window containing a gl-object's parameter.
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
void setRotation(GNELane *additionalLane=nullptr)
set Rotation of block Icon (must be called in updateGeometry() function)
bool hasMinimumNumberOfChildren() const
return true if tag correspond to an element that only have a limited number of children ...
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
void calculateMultiShapeUnified()
calculate multi shape unified
void clearParameter()
Clears the parameter map.
virtual Position getPositionInView() const =0
Returns position of additional in view.