Eclipse SUMO - Simulation of Urban MObility
GNEAdditional.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
14 // A abstract class for representation of additional elements
15 /****************************************************************************/
16 
17 // ===========================================================================
18 // included modules
19 // ===========================================================================
20 #include <config.h>
21 
22 #include <netedit/GNENet.h>
23 #include <netedit/GNEViewNet.h>
24 #include <netedit/GNEViewParent.h>
37 
38 #include "GNEAdditional.h"
39 
40 // ===========================================================================
41 // member method definitions
42 // ===========================================================================
43 
44 GNEAdditional::GNEAdditional(const std::string& id, GNEViewNet* viewNet, GUIGlObjectType type, SumoXMLTag tag, std::string additionalName, bool blockMovement,
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) :
55  GUIGlObject(type, id),
57  Parameterised(),
58  GNEHierarchicalParentElements(this, parentEdges, parentLanes, parentShapes, parentAdditionals, parentDemandElements),
59  GNEHierarchicalChildElements(this, childEdges, childLanes, childShapes, childAdditionals, childDemandElements),
60  myViewNet(viewNet),
61  myAdditionalName(additionalName),
62  myBlockMovement(blockMovement),
63  myBlockIcon(this),
64  mySpecialColor(nullptr) {
65 }
66 
67 
68 GNEAdditional::GNEAdditional(GNEAdditional* additionalParent, GNEViewNet* viewNet, GUIGlObjectType type, SumoXMLTag tag, std::string additionalName, bool blockMovement,
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)),
81  Parameterised(),
82  GNEHierarchicalParentElements(this, parentEdges, parentLanes, parentShapes, parentAdditionals, parentDemandElements),
83  GNEHierarchicalChildElements(this, childEdges, childLanes, childShapes, childAdditionals, childDemandElements),
84  myViewNet(viewNet),
85  myAdditionalName(additionalName),
86  myBlockMovement(blockMovement),
87  myBlockIcon(this),
88  mySpecialColor(nullptr) {
89 }
90 
91 
93 
94 
95 std::string
97  int counter = (int)getChildAdditionals().size();
98  while (myViewNet->getNet()->retrieveAdditional(childTag, getID() + toString(childTag) + toString(counter), false) != nullptr) {
99  counter++;
100  }
101  return (getID() + toString(childTag) + toString(counter));
102 }
103 
104 
107  return myAdditionalGeometry;
108 }
109 
110 
113  return mySegmentGeometry;
114 }
115 
116 
117 void
119  mySpecialColor = color;
120 }
121 
122 
123 void
125  // first check if minimum number of children is correct
127  WRITE_WARNING(getTagStr() + " with ID='" + getID() + "' cannot be written");
128  } else {
129  // Open Tag or synonym Tag
132  } else {
133  device.openTag(myTagProperty.getTag());
134  }
135  // iterate over attributes and write it
136  for (auto i : myTagProperty) {
137  // obtain attribute
138  std::string attributeValue = getAttribute(i.getAttr());
139  // first check if attribute is optional but not vehicle classes
140  if (i.isOptional() && !i.isVClasses()) {
141  // Only write attributes with default value if is different from original
142  if (i.getDefaultValue() != attributeValue) {
143  // check if attribute must be written using a synonim
144  if (i.hasAttrSynonym()) {
145  device.writeAttr(i.getAttrSynonym(), attributeValue);
146  } else {
147  // SVC permissions uses their own writting function
148  if (i.isSVCPermission()) {
149  // disallow attribute musn't be written
150  if (i.getAttr() != SUMO_ATTR_DISALLOW) {
151  writePermissions(device, parseVehicleClasses(attributeValue));
152  }
153  } else if (myTagProperty.canMaskXYZPositions() && (i.getAttr() == SUMO_ATTR_POSITION)) {
154  // get position attribute and write it separate
155  Position pos = parse<Position>(getAttribute(SUMO_ATTR_POSITION));
156  device.writeAttr(SUMO_ATTR_X, toString(pos.x()));
157  device.writeAttr(SUMO_ATTR_Y, toString(pos.y()));
158  // write 0 only if is different from 0 (the default value)
159  if (pos.z() != 0) {
160  device.writeAttr(SUMO_ATTR_Z, toString(pos.z()));
161  }
162  } else {
163  device.writeAttr(i.getAttr(), attributeValue);
164  }
165  }
166  }
167  } else {
168  // Attributes without default values are always writted
169  if (i.hasAttrSynonym()) {
170  device.writeAttr(i.getAttrSynonym(), attributeValue);
171  } else {
172  // SVC permissions uses their own writting function
173  if (i.isSVCPermission()) {
174  // disallow attribute musn't be written
175  if (i.getAttr() != SUMO_ATTR_DISALLOW) {
176  writePermissions(device, parseVehicleClasses(attributeValue));
177  }
178  } else if (myTagProperty.canMaskXYZPositions() && (i.getAttr() == SUMO_ATTR_POSITION)) {
179  // get position attribute and write it separate
180  Position pos = parse<Position>(getAttribute(SUMO_ATTR_POSITION));
181  device.writeAttr(SUMO_ATTR_X, toString(pos.x()));
182  device.writeAttr(SUMO_ATTR_Y, toString(pos.y()));
183  // write 0 only if is different from 0 (the default value)
184  if (pos.z() != 0) {
185  device.writeAttr(SUMO_ATTR_Z, toString(pos.z()));
186  }
187  } else {
188  device.writeAttr(i.getAttr(), attributeValue);
189  }
190  }
191  }
192  }
193  // iterate over children and write it in XML (or in a different file)
195  // we assume that rerouter values files is placed in the same folder as the additional file
197  deviceChildren.writeXMLHeader("rerouterValue", "additional_file.xsd");
198  // save children in a different filename
199  for (auto i : getChildAdditionals()) {
200  // avoid to write two times additionals that haben two parents (Only write as child of first parent)
201  if (i->getParentAdditionals().size() < 1) {
202  i->writeAdditional(deviceChildren);
203  } else if (myTagProperty.getTag() == i->getTagProperty().getParentTag()) {
204  i->writeAdditional(deviceChildren);
205  }
206  }
207  deviceChildren.close();
208  } else {
209  for (auto i : getChildAdditionals()) {
210  // avoid to write two times additionals that haben two parents (Only write as child of first parent)
211  if (i->getParentAdditionals().size() < 2) {
212  i->writeAdditional(device);
213  } else if (myTagProperty.getTag() == i->getTagProperty().getParentTag()) {
214  i->writeAdditional(device);
215  }
216  }
217  }
218  // write parameters (Always after children to avoid problems with additionals.xsd)
219  writeParams(device);
220  // Close tag
221  device.closeTag();
222  }
223 }
224 
225 
226 bool
228  return true;
229 }
230 
231 
232 std::string
234  return "";
235 }
236 
237 
238 void
240  throw InvalidArgument(getTagStr() + " cannot fix any problem");
241 }
242 
243 
244 void
246  throw InvalidArgument(getTagStr() + " doesn't have an additional dialog");
247 }
248 
249 
250 void
252  // only move if additional is drawable
253  if (myTagProperty.isDrawable()) {
254  // always save original position over view
256  // check if position over lane or lanes has to be saved
259  // obtain start and end position
262  } else {
263  // obtain position attribute
265  }
269  // obtain start and end position
272  }
273  // save current centering boundary if element is placed in RTree
276  }
277  // start geometry in all children
278  for (const auto& i : getChildDemandElements()) {
279  i->startGeometryMoving();
280  }
281  }
282 }
283 
284 
285 void
287  // check that endGeometryMoving was called only once
288  if (myTagProperty.isDrawable()) {
289  // check if object must be placed in RTREE
291  // Remove object from net
293  // reset myMovingGeometryBoundary
295  // add object into grid again (using the new centering boundary)
297  }
298  // end geometry in all children
299  for (const auto& i : getChildDemandElements()) {
300  i->endGeometryMoving();
301  }
302  }
303 }
304 
305 
306 GNEViewNet*
308  return myViewNet;
309 }
310 
311 
312 bool
314  return myBlockMovement;
315 }
316 
317 
320  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
321  // build header
322  buildPopupHeader(ret, app);
323  // build menu command for center button and copy cursor position to clipboard
325  buildPositionCopyEntry(ret, false);
326  // buld menu commands for names
327  new FXMenuCommand(ret, ("Copy " + getTagStr() + " name to clipboard").c_str(), nullptr, ret, MID_COPY_NAME);
328  new FXMenuCommand(ret, ("Copy " + getTagStr() + " typed name to clipboard").c_str(), nullptr, ret, MID_COPY_TYPED_NAME);
329  new FXMenuSeparator(ret);
330  // build selection and show parameters menu
333  // show option to open additional dialog
334  if (myTagProperty.hasDialog()) {
335  new FXMenuCommand(ret, ("Open " + getTagStr() + " Dialog").c_str(), getIcon(), &parent, MID_OPEN_ADDITIONAL_DIALOG);
336  new FXMenuSeparator(ret);
337  }
338  // Show position parameters
341  // Show menu command inner position
343  new FXMenuCommand(ret, ("Cursor position over additional shape: " + toString(innerPos)).c_str(), nullptr, nullptr, 0);
344  // If shape isn't empty, show menu command lane position
345  if (myAdditionalGeometry.getShape().size() > 0) {
346  const double lanePos = lane->getLaneShape().nearest_offset_to_point2D(myAdditionalGeometry.getShape().front());
347  new FXMenuCommand(ret, ("Cursor position over " + toString(SUMO_TAG_LANE) + ": " + toString(innerPos + lanePos)).c_str(), nullptr, nullptr, 0);
348  }
351  // Show menu command inner position
353  new FXMenuCommand(ret, ("Cursor position over additional shape: " + toString(innerPos)).c_str(), nullptr, nullptr, 0);
354  // If shape isn't empty, show menu command edge position
355  if (myAdditionalGeometry.getShape().size() > 0) {
356  const double edgePos = edge->getLanes().at(0)->getLaneShape().nearest_offset_to_point2D(myAdditionalGeometry.getShape().front());
357  new FXMenuCommand(ret, ("Mouse position over " + toString(SUMO_TAG_EDGE) + ": " + toString(innerPos + edgePos)).c_str(), nullptr, nullptr, 0);
358  }
359  } else {
360  new FXMenuCommand(ret, ("Cursor position in view: " + toString(getPositionInView().x()) + "," + toString(getPositionInView().y())).c_str(), nullptr, nullptr, 0);
361  }
362  return ret;
363 }
364 
365 
368  // Create table
370  // Iterate over attributes
371  for (const auto& i : myTagProperty) {
372  // Add attribute and set it dynamic if aren't unique
373  if (i.isUnique()) {
374  ret->mkItem(i.getAttrStr().c_str(), false, getAttribute(i.getAttr()));
375  } else {
376  ret->mkItem(i.getAttrStr().c_str(), true, getAttribute(i.getAttr()));
377  }
378  }
379  // close building
380  ret->closeBuilding();
381  return ret;
382 }
383 
384 
385 const std::string&
387  return myAdditionalName;
388 }
389 
390 // ---------------------------------------------------------------------------
391 // GNEAdditional::BlockIcon - methods
392 // ---------------------------------------------------------------------------
393 
395  rotation(0.),
396  myAdditional(additional) {}
397 
398 
399 void
401  if (myAdditional->myAdditionalGeometry.getShape().size() > 0 && myAdditional->myAdditionalGeometry.getShape().length() != 0) {
402  // If length of the shape is distint to 0, Obtain rotation of center of shape
403  rotation = myAdditional->myAdditionalGeometry.getShape().rotationDegreeAtOffset((myAdditional->myAdditionalGeometry.getShape().length() / 2.)) - 90;
404  } else if (additionalLane) {
405  // If additional is over a lane, set rotation in the position over lane
406  double posOverLane = additionalLane->getLaneShape().nearest_offset_to_point2D(myAdditional->getPositionInView());
407  rotation = additionalLane->getLaneShape().rotationDegreeAtOffset(posOverLane) - 90;
408  } else {
409  // In other case, rotation is 0
410  rotation = 0;
411  }
412 }
413 
414 
415 void
416 GNEAdditional::BlockIcon::drawIcon(const GUIVisualizationSettings& s, const double exaggeration, const double size) const {
417  // check if block icon can be draw
418  if (!s.drawForRectangleSelection && s.drawDetail(s.detailSettings.lockIcon, exaggeration) && myAdditional->myViewNet->showLockIcon()) {
419  // Start pushing matrix
420  glPushMatrix();
421  // Traslate to middle of shape
422  glTranslated(position.x(), position.y(), myAdditional->getType() + 0.1);
423  // Set draw color
424  glColor3d(1, 1, 1);
425  // Rotate depending of rotation
426  glRotated(rotation, 0, 0, -1);
427  // Rotate 180 degrees
428  glRotated(180, 0, 0, 1);
429  // Traslate depending of the offset
430  glTranslated(offset.x(), offset.y(), 0);
431  // Draw icon depending of the state of additional
432  if (myAdditional->drawUsingSelectColor()) {
433  if (!myAdditional->getTagProperty().canBlockMovement()) {
434  // Draw not movable texture if additional isn't movable and is selected
436  } else if (myAdditional->myBlockMovement) {
437  // Draw lock texture if additional is movable, is blocked and is selected
439  } else {
440  // Draw empty texture if additional is movable, isn't blocked and is selected
442  }
443  } else {
444  if (!myAdditional->getTagProperty().canBlockMovement()) {
445  // Draw not movable texture if additional isn't movable
447  } else if (myAdditional->myBlockMovement) {
448  // Draw lock texture if additional is movable and is blocked
450  } else {
451  // Draw empty texture if additional is movable and isn't blocked
453  }
454  }
455  // Pop matrix
456  glPopMatrix();
457  }
458 }
459 
460 // ---------------------------------------------------------------------------
461 // GNEAdditional - protected methods
462 // ---------------------------------------------------------------------------
463 
464 void
466  // iterate over attributes and set default value
467  for (const auto& i : myTagProperty) {
468  if (i.hasStaticDefaultValue()) {
469  setAttribute(i.getAttr(), i.getDefaultValue());
470  }
471  }
472 }
473 
474 
475 const std::string&
477  return getMicrosimID();
478 }
479 
480 
481 bool
482 GNEAdditional::isValidAdditionalID(const std::string& newID) const {
483  if (SUMOXMLDefinitions::isValidAdditionalID(newID) && (myViewNet->getNet()->retrieveAdditional(myTagProperty.getTag(), newID, false) == nullptr)) {
484  return true;
485  } else {
486  return false;
487  }
488 }
489 
490 
491 bool
492 GNEAdditional::isValidDetectorID(const std::string& newID) const {
493  if (SUMOXMLDefinitions::isValidDetectorID(newID) && (myViewNet->getNet()->retrieveAdditional(myTagProperty.getTag(), newID, false) == nullptr)) {
494  return true;
495  } else {
496  return false;
497  }
498 }
499 
500 
501 void
502 GNEAdditional::changeAdditionalID(const std::string& newID) {
503  if (myViewNet->getNet()->retrieveAdditional(myTagProperty.getTag(), newID, false) != nullptr) {
504  throw InvalidArgument("An Additional with tag " + getTagStr() + " and ID = " + newID + " already exists");
505  } else {
506  // Save old ID
507  std::string oldID = getMicrosimID();
508  // set New ID
509  setMicrosimID(newID);
510  // update additional ID in the container of net
511  myViewNet->getNet()->updateAdditionalID(oldID, this);
512  }
513 }
514 
515 
516 void
518  if (!myViewNet) {
519  throw ProcessError("ViewNet cannot be nullptr");
520  } else {
522  // add object of list into selected objects
524  if (changeFlag) {
525  mySelected = true;
526  }
527  }
528 }
529 
530 
531 void
533  if (!myViewNet) {
534  throw ProcessError("ViewNet cannot be nullptr");
535  } else {
537  // remove object of list of selected objects
539  if (changeFlag) {
540  mySelected = false;
541 
542  }
543  }
544 }
545 
546 
547 bool
549  return mySelected;
550 }
551 
552 
553 bool
556  return true;
557  } else {
558  return false;
559  }
560 }
561 
562 
563 void
565  //
566 }
567 
568 
569 void
571  //
572 }
573 
574 
575 bool
577  // throw exception because this function mus be implemented in child (see GNEE3Detector)
578  throw ProcessError("Calling non-implemented function checkChildAdditionalRestriction during saving of " + getTagStr() + ". It muss be reimplemented in child class");
579 }
580 
581 
582 void
583 GNEAdditional::setEnabledAttribute(const int /*enabledAttributes*/) {
584  //
585 }
586 
587 /****************************************************************************/
GNEAdditional::writeAdditional
void writeAdditional(OutputDevice &device) const
writte additional element into a xml file
Definition: GNEAdditional.cpp:124
GNEAdditional::enableAttribute
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEAdditional.cpp:564
GNEAdditional::isAdditionalBlocked
bool isAdditionalBlocked() const
Check if additional item is currently blocked (i.e. cannot be moved with mouse)
Definition: GNEAdditional.cpp:313
GNEViewParent::getSelectorFrame
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_NMODE_SELECT
Definition: GNEViewParent.cpp:186
GNENet::retrieveAdditional
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
Definition: GNENet.cpp:2183
GNEAttributeCarrier::getIcon
FXIcon * getIcon() const
get FXIcon associated to this AC
Definition: GNEAttributeCarrier.cpp:1279
GNEAdditional::getPositionInView
virtual Position getPositionInView() const =0
Returns position of additional in view.
GNEAdditional
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
SUMOXMLDefinitions::isValidAdditionalID
static bool isValidAdditionalID(const std::string &value)
whether the given string is a valid id for an additional object
Definition: SUMOXMLDefinitions.cpp:984
GUIParameterTableWindow
A window containing a gl-object's parameter.
Definition: GUIParameterTableWindow.h:62
GNEAdditional::GNEAdditional
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.
Definition: GNEAdditional.cpp:44
GNEAdditional.h
GNEAdditional::getAdditionalID
const std::string & getAdditionalID() const
Definition: GNEAdditional.cpp:476
GNEAttributeCarrier::mySelected
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
Definition: GNEAttributeCarrier.h:788
GNEAttributeCarrier::getID
const std::string getID() const
function to support debugging
Definition: GNEAttributeCarrier.cpp:1289
SUMO_ATTR_DISALLOW
@ SUMO_ATTR_DISALLOW
Definition: SUMOXMLDefinitions.h:783
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:275
Parameterised
An upper class for objects with additional parameters.
Definition: Parameterised.h:42
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:72
GNEAttributeCarrier::TagProperties::isPlacedInRTree
bool isPlacedInRTree() const
return true if Tag correspond to an element that has has to be placed in RTREE
Definition: GNEAttributeCarrier.cpp:865
GUIParameterTableWindow.h
GNEHierarchicalChildElements::getChildDemandElements
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
Definition: GNEHierarchicalChildElements.cpp:296
GNEAttributeCarrier::TagProperties::canMaskStartEndPos
bool canMaskStartEndPos() const
return true if tag correspond to an element that can mask the attributes "start" and "end" position a...
Definition: GNEAttributeCarrier.cpp:895
GNEAdditional::getCenteringBoundary
virtual Boundary getCenteringBoundary() const =0
Returns the boundary to which the view shall be centered in order to show the object.
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
GNEAdditional::BlockIcon::setRotation
void setRotation(GNELane *additionalLane=nullptr)
set Rotation of block Icon (must be called in updateGeometry() function)
Definition: GNEAdditional.cpp:400
GNEAdditional::AdditionalMove::movingGeometryBoundary
Boundary movingGeometryBoundary
boundary used during moving of elements (to avoid insertion in RTREE
Definition: GNEAdditional.h:288
Position::z
double z() const
Returns the z-position.
Definition: Position.h:66
GUIVisualizationSettings::drawForRectangleSelection
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
Definition: GUIVisualizationSettings.h:647
OptionsCont.h
GNENet::removeGLObjectFromGrid
void removeGLObjectFromGrid(GUIGlObject *o)
add GL Object into net
Definition: GNENet.cpp:1328
GNEAdditional::generateChildID
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
Definition: GNEAdditional.cpp:96
GUIGLObjectPopupMenu.h
GUIGlobalSelection.h
GNENet::updateAdditionalID
void updateAdditionalID(const std::string &oldID, GNEAdditional *additional)
update additional ID in container
Definition: GNENet.cpp:2222
SUMO_ATTR_Z
@ SUMO_ATTR_Z
Definition: SUMOXMLDefinitions.h:400
GNETEXTURE_NOTMOVINGSELECTED
@ GNETEXTURE_NOTMOVINGSELECTED
Definition: GUITextures.h:41
SUMO_TAG_LANE
@ SUMO_TAG_LANE
begin/end of the description of a single lane
Definition: SUMOXMLDefinitions.h:49
SUMO_ATTR_EDGE
@ SUMO_ATTR_EDGE
Definition: SUMOXMLDefinitions.h:423
GNETEXTURE_LOCKSELECTED
@ GNETEXTURE_LOCKSELECTED
Definition: GUITextures.h:39
OptionsCont::getOptions
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:57
GNEAdditional::setDefaultValues
void setDefaultValues()
change all attributes of additional with their default values (note: this cannot be undo)
Definition: GNEAdditional.cpp:465
GNEViewNet
Definition: GNEViewNet.h:42
MID_OPEN_ADDITIONAL_DIALOG
@ MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:392
MID_COPY_NAME
@ MID_COPY_NAME
Copy object name - popup entry.
Definition: GUIAppEnum.h:382
SUMO_ATTR_LANE
@ SUMO_ATTR_LANE
Definition: SUMOXMLDefinitions.h:637
GNEAdditional::setAttribute
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
method for setting the attribute and letting the object perform additional changes
GNEAdditional::isAdditionalValid
virtual bool isAdditionalValid() const
check if current additional is valid to be writed into XML (by default true, can be reimplemented in ...
Definition: GNEAdditional.cpp:227
SUMO_ATTR_ENDPOS
@ SUMO_ATTR_ENDPOS
Definition: SUMOXMLDefinitions.h:798
GNEAdditional::changeAdditionalID
void changeAdditionalID(const std::string &newID)
change ID of additional
Definition: GNEAdditional.cpp:502
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:47
GNEAttributeCarrier::TagProperties::hasMinimumNumberOfChildren
bool hasMinimumNumberOfChildren() const
return true if tag correspond to an element that only have a limited number of children
Definition: GNEAttributeCarrier.cpp:852
SUMOXMLDefinitions::isValidDetectorID
static bool isValidDetectorID(const std::string &value)
whether the given string is a valid id for an detector
Definition: SUMOXMLDefinitions.cpp:989
GNEAdditional::unselectAttributeCarrier
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNEAdditional.cpp:532
OutputDevice::close
void close()
Closes the device and removes it from the dictionary.
Definition: OutputDevice.cpp:207
GNEAdditional::AdditionalMove::secondOriginalPosition
std::string secondOriginalPosition
value for saving second original position over lane before moving
Definition: GNEAdditional.h:297
GNEAttributeCarrier::TagProperties::canWriteChildrenSeparate
bool canWriteChildrenSeparate() const
return true if tag correspond to an element that can sort their children automatic
Definition: GNEAttributeCarrier.cpp:889
SUMO_ATTR_FILE
@ SUMO_ATTR_FILE
Definition: SUMOXMLDefinitions.h:664
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:41
GNEAdditional::getPopUpMenu
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEAdditional.cpp:319
GUIParameterTableWindow::closeBuilding
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
Definition: GUIParameterTableWindow.cpp:219
GNEAdditional::getAdditionalProblem
virtual std::string getAdditionalProblem() const
return a string with the current additional problem (by default empty, can be reimplemented in childr...
Definition: GNEAdditional.cpp:233
GUITexturesHelper::drawTexturedBox
static void drawTexturedBox(int which, double size)
Draws a named texture as a box with the given size.
Definition: GUITexturesHelper.cpp:72
GNEAttributeCarrier::TagProperties::getTag
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
Definition: GNEAttributeCarrier.cpp:523
Parameterised::writeParams
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
Definition: Parameterised.cpp:154
GNEAdditional::mySpecialColor
const RGBColor * mySpecialColor
pointer to special color (used for drawing Additional with a certain color, mainly used for selection...
Definition: GNEAdditional.h:356
GNEAdditional::myMove
AdditionalMove myMove
variable AdditionalMove
Definition: GNEAdditional.h:344
GNEHierarchicalChildElements
An special type of Attribute carrier that owns hierarchical elements.
Definition: GNEHierarchicalChildElements.h:45
OutputDevice::closeTag
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
Definition: OutputDevice.cpp:253
GNEAdditional::myViewNet
GNEViewNet * myViewNet
The GNEViewNet this additional element belongs.
Definition: GNEAdditional.h:335
FileHelpers::getFilePath
static std::string getFilePath(const std::string &path)
Removes the file information from the given path.
Definition: FileHelpers.cpp:76
GNEAdditional::getAdditionalSegmentGeometry
const GNEGeometry::SegmentGeometry & getAdditionalSegmentGeometry() const
obtain additional segment geometry
Definition: GNEAdditional.cpp:112
GNEJunction.h
GUIGlObjectType
GUIGlObjectType
Definition: GUIGlObjectTypes.h:39
GNEAttributeCarrier::TagProperties::hasAttribute
bool hasAttribute(SumoXMLAttr attr) const
check if current TagProperties owns the attribute attr
Definition: GNEAttributeCarrier.cpp:680
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:51
GNEViewNet::getNet
GNENet * getNet() const
get the net object
Definition: GNEViewNet.cpp:1014
parseVehicleClasses
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
Definition: SUMOVehicleClass.cpp:222
GNEAttributeCarrier::TagProperties::getTagSynonym
SumoXMLTag getTagSynonym() const
get tag synonym
Definition: GNEAttributeCarrier.cpp:670
GNEAdditional::isAttributeCarrierSelected
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
Definition: GNEAdditional.cpp:548
PositionVector::nearest_offset_to_point2D
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
Definition: PositionVector.cpp:817
OutputDevice::writeAttr
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:255
RGBColor
Definition: RGBColor.h:39
GNEAdditional::getAttribute
virtual std::string getAttribute(SumoXMLAttr key) const =0
GUIGlObject::setMicrosimID
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
Definition: GUIGlObject.cpp:173
Boundary::reset
void reset()
Resets the boundary.
Definition: Boundary.cpp:66
GUIVisualizationDetailSettings::lockIcon
static const double lockIcon
lock icons
Definition: GUIVisualizationSettings.h:286
GNEGeometry::SegmentGeometry
struct for pack all variables related with geometry of elemements divided in segments
Definition: GNEGeometry.h:116
GNEAdditional::isValidDetectorID
bool isValidDetectorID(const std::string &newID) const
check if a new detector ID is valid
Definition: GNEAdditional.cpp:492
GNEAdditional::setEnabledAttribute
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEAdditional.cpp:583
GUIVisualizationSettings::detailSettings
GUIVisualizationDetailSettings detailSettings
detail settings
Definition: GUIVisualizationSettings.h:683
SUMO_ATTR_STARTPOS
@ SUMO_ATTR_STARTPOS
Definition: SUMOXMLDefinitions.h:797
GUISelectedStorage::select
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
Definition: GUISelectedStorage.cpp:113
GNEGeometry::Geometry::getShape
const PositionVector & getShape() const
The shape of the additional element.
Definition: GNEGeometry.cpp:147
GNELane::getLaneShape
const PositionVector & getLaneShape() const
Definition: GNELane.cpp:86
GNEAdditional::getAdditionalGeometry
const GNEGeometry::Geometry & getAdditionalGeometry() const
obtain additional geometry
Definition: GNEAdditional.cpp:106
GNEViewNet::buildSelectionACPopupEntry
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:338
GUIParameterTableWindow::mkItem
void mkItem(const char *name, bool dynamic, ValueSource< T > *src)
Adds a row which obtains its value from a ValueSource.
Definition: GUIParameterTableWindow.h:108
GNEAdditional::BlockIcon::BlockIcon
BlockIcon(GNEAdditional *additional)
constructor
Definition: GNEAdditional.cpp:394
GNEDemandElement.h
GNEAdditional::selectAttributeCarrier
void selectAttributeCarrier(bool changeFlag=true)
Definition: GNEAdditional.cpp:517
GNEViewNet.h
writePermissions
void writePermissions(OutputDevice &into, SVCPermissions permissions)
writes allowed disallowed attributes if needed;
Definition: SUMOVehicleClass.cpp:309
PositionVector::rotationDegreeAtOffset
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
Definition: PositionVector.cpp:319
GUIGlObject::getGlID
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.cpp:149
SUMO_TAG_EDGE
@ SUMO_TAG_EDGE
begin/end of the description of an edge
Definition: SUMOXMLDefinitions.h:47
GUITextureSubSys::getTexture
static GUIGlID getTexture(GUITexture which)
returns a texture previously defined in the enum GUITexture
Definition: GUITextureSubSys.cpp:101
GNE_SUPERMODE_NETWORK
@ GNE_SUPERMODE_NETWORK
Network mode (Edges, junctions, etc..)
Definition: GNEViewNetHelper.h:46
ProcessError
Definition: UtilExceptions.h:39
GNEViewNetHelper::EditModes::currentSupermode
Supermode currentSupermode
the current supermode
Definition: GNEViewNetHelper.h:305
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
Position::x
double x() const
Returns the x-position.
Definition: Position.h:56
GNEEdge.h
GNEAttributeCarrier::myTagProperty
const TagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
Definition: GNEAttributeCarrier.h:785
GNEAdditional::myAdditionalGeometry
GNEGeometry::Geometry myAdditionalGeometry
geometry to be precomputed in updateGeometry(...)
Definition: GNEAdditional.h:338
SUMO_ATTR_Y
@ SUMO_ATTR_Y
Definition: SUMOXMLDefinitions.h:399
GNEAdditional::myAdditionalName
std::string myAdditionalName
name of additional
Definition: GNEAdditional.h:347
GNEGeometry::Geometry
struct for pack all variables related with geometry of stop
Definition: GNEGeometry.h:56
GNEAdditional::getParameterWindow
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GNEAdditional.cpp:367
GUIGlObject
Definition: GUIGlObject.h:65
GNEAdditional::myBlockMovement
bool myBlockMovement
boolean to check if additional element is blocked (i.e. cannot be moved with mouse)
Definition: GNEAdditional.h:350
GUISUMOAbstractView::getPositionInformation
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Definition: GUISUMOAbstractView.cpp:190
GNEEdge::getLanes
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
Definition: GNEEdge.cpp:874
GNELane.h
SUMO_ATTR_POSITION
@ SUMO_ATTR_POSITION
Definition: SUMOXMLDefinitions.h:660
GUIGlObject::buildPopupHeader
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
Definition: GUIGlObject.cpp:207
SUMO_ATTR_LANES
@ SUMO_ATTR_LANES
Definition: SUMOXMLDefinitions.h:638
GNEAdditional::~GNEAdditional
~GNEAdditional()
Destructor.
Definition: GNEAdditional.cpp:92
GNEViewParent.h
GNEAdditional::setSpecialColor
void setSpecialColor(const RGBColor *color)
set special color
Definition: GNEAdditional.cpp:118
GLIncludes.h
OutputDevice::openTag
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
Definition: OutputDevice.cpp:239
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
GNEAdditional::BlockIcon::drawIcon
void drawIcon(const GUIVisualizationSettings &s, const double exaggeration, const double size=0.5) const
draw lock icon
Definition: GNEAdditional.cpp:416
GNETEXTURE_EMPTY
@ GNETEXTURE_EMPTY
Definition: GUITextures.h:36
GNENet::addGLObjectIntoGrid
void addGLObjectIntoGrid(GUIGlObject *o)
add GL Object into net
Definition: GNENet.cpp:1322
GNESelectorFrame.h
GNEAdditional::disableAttribute
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEAdditional.cpp:570
OutputDevice::getDevice
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
Definition: OutputDevice.cpp:54
GUIMainWindow
Definition: GUIMainWindow.h:46
Position::y
double y() const
Returns the y-position.
Definition: Position.h:61
GNEAdditional::checkChildAdditionalRestriction
virtual bool checkChildAdditionalRestriction() const
check restriction with the number of children
Definition: GNEAdditional.cpp:576
GNEAttributeCarrier::TagProperties::hasTagSynonym
bool hasTagSynonym() const
return true if tag correspond to an element that will be written in XML with another tag
Definition: GNEAttributeCarrier.cpp:840
InvalidArgument
Definition: UtilExceptions.h:56
GNEAdditional::getOptionalAdditionalName
const std::string & getOptionalAdditionalName() const
Returns the additional name.
Definition: GNEAdditional.cpp:386
GNEAdditional::getViewNet
GNEViewNet * getViewNet() const
Returns a pointer to GNEViewNet in which additional element is located.
Definition: GNEAdditional.cpp:307
GUIGlObject::buildShowParamsPopupEntry
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
Definition: GUIGlObject.cpp:248
GNEAdditional::drawUsingSelectColor
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
Definition: GNEAdditional.cpp:554
GNEAttributeCarrier::TagProperties::isDrawable
bool isDrawable() const
return true if tag correspond to a drawable element
Definition: GNEAttributeCarrier.cpp:792
gSelected
GUISelectedStorage gSelected
A global holder of selected objects.
Definition: GUIGlobalSelection.cpp:33
GUIGlObject::buildCenterPopupEntry
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
Definition: GUIGlObject.cpp:216
GUIGlObject::buildPositionCopyEntry
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
Definition: GUIGlObject.cpp:266
GNEHierarchicalParentElements
An special type of Attribute carrier that owns hierarchical elements.
Definition: GNEHierarchicalParentElements.h:49
GNEAttributeCarrier::TagProperties::hasDialog
bool hasDialog() const
return true if tag correspond to an element that can be edited using a dialog
Definition: GNEAttributeCarrier.cpp:846
GNENet::retrieveEdge
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:1069
GNENet::retrieveLane
GNELane * retrieveLane(const std::string &id, bool failHard=true, bool checkVolatileChange=false)
get lane by id
Definition: GNENet.cpp:1228
config.h
GLO_ADDITIONAL
@ GLO_ADDITIONAL
reserved GLO type to pack all additionals
Definition: GUIGlObjectTypes.h:59
StringTokenizer.h
GNEViewNet::getEditModes
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:434
GNEAdditional::endGeometryMoving
void endGeometryMoving()
begin movement (used when user click over additional to start a movement, to avoid problems with prob...
Definition: GNEAdditional.cpp:286
GUIVisualizationSettings::drawDetail
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
Definition: GUIVisualizationSettings.cpp:1669
GNESelectorFrame::LockGLObjectTypes::removeLockedObject
void removeLockedObject(const GUIGlObjectType type)
set object unselected
Definition: GNESelectorFrame.cpp:573
GNEAttributeCarrier::getTagStr
const std::string & getTagStr() const
get tag assigned to this object in string format
Definition: GNEAttributeCarrier.cpp:1267
OutputDevice::writeXMLHeader
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.
Definition: OutputDevice.cpp:227
GNEUndoList
Definition: GNEUndoList.h:48
MID_COPY_TYPED_NAME
@ MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
Definition: GUIAppEnum.h:384
GNEAdditional::startGeometryMoving
void startGeometryMoving()
Definition: GNEAdditional.cpp:251
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
GNEAdditional::mySegmentGeometry
GNEGeometry::SegmentGeometry mySegmentGeometry
segment geometry to be precomputed in updateGeometry(...) (used by E2Multilane)
Definition: GNEAdditional.h:341
GNETEXTURE_LOCK
@ GNETEXTURE_LOCK
Definition: GUITextures.h:38
GNEAdditional::isValidAdditionalID
bool isValidAdditionalID(const std::string &newID) const
check if a new additional ID is valid
Definition: GNEAdditional.cpp:482
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:372
GNETEXTURE_NOTMOVING
@ GNETEXTURE_NOTMOVING
Definition: GUITextures.h:40
GNEAdditional::AdditionalMove::originalViewPosition
Position originalViewPosition
value for saving first original position over lane before moving
Definition: GNEAdditional.h:291
GUIGlObject::getMicrosimID
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Definition: GUIGlObject.cpp:163
GNETEXTURE_EMPTYSELECTED
@ GNETEXTURE_EMPTYSELECTED
Definition: GUITextures.h:37
SUMO_ATTR_X
@ SUMO_ATTR_X
Definition: SUMOXMLDefinitions.h:398
GNEAdditional::AdditionalMove::firstOriginalLanePosition
std::string firstOriginalLanePosition
value for saving first original position over lane before moving
Definition: GNEAdditional.h:294
GNELane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
GUITextureSubSys.h
GNEAttributeCarrier
Definition: GNEAttributeCarrier.h:54
GNEHierarchicalChildElements::getChildAdditionals
const std::vector< GNEAdditional * > & getChildAdditionals() const
return child additionals
Definition: GNEHierarchicalChildElements.cpp:131
GNEAdditional::openAdditionalDialog
virtual void openAdditionalDialog()
open Additional Dialog
Definition: GNEAdditional.cpp:245
GNENet.h
GUISelectedStorage::deselect
void deselect(GUIGlID id)
Deselects the object with the given id.
Definition: GUISelectedStorage.cpp:130
GNEAttributeCarrier::TagProperties::canMaskXYZPositions
bool canMaskXYZPositions() const
return true if tag correspond to an element that can mask the attributes "X", "Y" and "Z" position as...
Definition: GNEAttributeCarrier.cpp:901
GNEViewNet::getViewParent
GNEViewParent * getViewParent() const
get the net object
Definition: GNEViewNet.cpp:1008
GNESelectorFrame::getLockGLObjectTypes
LockGLObjectTypes * getLockGLObjectTypes() const
get selected items Modul
Definition: GNESelectorFrame.cpp:459
GNEAdditional::fixAdditionalProblem
virtual void fixAdditionalProblem()
fix additional problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEAdditional.cpp:239
GNEAttributeCarrier::TagProperties::getNumberOfAttributes
int getNumberOfAttributes() const
get number of attributes
Definition: GNEAttributeCarrier.cpp:648
GNESelectorFrame::LockGLObjectTypes::addedLockedObject
void addedLockedObject(const GUIGlObjectType type)
set object selected
Definition: GNESelectorFrame.cpp:567