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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
17 // A abstract class for representation of additional elements
18 /****************************************************************************/
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #ifdef _MSC_VER
24 #include <windows_config.h>
25 #else
26 #include <config.h>
27 #endif
28 
29 #include <string>
30 #include <iostream>
31 #include <utility>
35 #include <utils/common/ToString.h>
36 #include <utils/geom/GeomHelper.h>
44 #include <utils/gui/div/GLHelper.h>
48 
49 #include "GNEAdditional.h"
50 #include "GNELane.h"
51 #include "GNEEdge.h"
52 #include "GNEJunction.h"
53 #include "GNENet.h"
54 #include "GNEUndoList.h"
55 #include "GNEViewNet.h"
56 
57 
58 // ===========================================================================
59 // member method definitions
60 // ===========================================================================
61 
62 GNEAdditional::GNEAdditional(const std::string& id, GNEViewNet* viewNet, SumoXMLTag tag, GUIIcon icon, bool movable) :
64  GNEAttributeCarrier(tag, icon),
65  myViewNet(viewNet),
66  myBlocked(false),
67  myAdditionalParent(NULL),
68  myBlockIconRotation(0),
69  myMovable(movable) {
70 }
71 
72 
73 GNEAdditional::GNEAdditional(const std::string& id, GNEViewNet* viewNet, SumoXMLTag tag, GUIIcon icon, bool movable, GNEAdditional* additionalParent) :
75  GNEAttributeCarrier(tag, icon),
76  myViewNet(viewNet),
77  myBlocked(false),
78  myAdditionalParent(additionalParent),
80  myMovable(movable) {
81 }
82 
83 
84 GNEAdditional::GNEAdditional(const std::string& id, GNEViewNet* viewNet, SumoXMLTag tag, GUIIcon icon, bool movable, std::vector<GNEEdge*> edgeChilds) :
86  GNEAttributeCarrier(tag, icon),
87  myViewNet(viewNet),
88  myBlocked(false),
89  myAdditionalParent(NULL),
90  myEdgeChilds(edgeChilds),
92  myMovable(movable) {
93 }
94 
95 
96 GNEAdditional::GNEAdditional(const std::string& id, GNEViewNet* viewNet, SumoXMLTag tag, GUIIcon icon, bool movable, std::vector<GNELane*> laneChilds) :
98  GNEAttributeCarrier(tag, icon),
99  myViewNet(viewNet),
100  myBlocked(false),
101  myAdditionalParent(NULL),
102  myLaneChilds(laneChilds),
104  myMovable(movable) {
105 }
106 
107 
109 
110 
111 void
113  throw InvalidArgument(toString(getTag()) + " doesn't have an additional dialog");
114 }
115 
116 
117 GNEViewNet*
119  return myViewNet;
120 }
121 
122 
125  return myShape;
126 }
127 
128 
129 bool
131  return myBlocked;
132 }
133 
134 
135 bool
137  return gSelected.isSelected(getType(), getGlID());
138 }
139 
140 
143  return myAdditionalParent;
144 }
145 
146 
147 
148 void
150  // First check that additional wasn't already inserted
151  if (std::find(myAdditionalChilds.begin(), myAdditionalChilds.end(), additional) != myAdditionalChilds.end()) {
152  throw ProcessError(toString(additional->getTag()) + " with ID='" + additional->getID() + "' was already inserted in " + toString(getTag()) + " with ID='" + getID() + "'");
153  } else {
154  myAdditionalChilds.push_back(additional);
155  updateGeometry();
156  }
157 }
158 
159 
160 void
162  // First check that additional was already inserted
163  auto it = std::find(myAdditionalChilds.begin(), myAdditionalChilds.end(), additional);
164  if (it == myAdditionalChilds.end()) {
165  throw ProcessError(toString(additional->getTag()) + " with ID='" + additional->getID() + "' doesn't exist in " + toString(getTag()) + " with ID='" + getID() + "'");
166  } else {
167  myAdditionalChilds.erase(it);
168  updateGeometry();
169  }
170 }
171 
172 
173 const std::vector<GNEAdditional*>&
175  return myAdditionalChilds;
176 }
177 
178 
179 void
181  // Check that edge is valid and doesn't exist previously
182  if (edge == NULL) {
183  throw InvalidArgument("Trying to add an empty " + toString(SUMO_TAG_EDGE) + " child in " + toString(getTag()) + " with ID='" + getID() + "'");
184  } else if (std::find(myEdgeChilds.begin(), myEdgeChilds.end(), edge) != myEdgeChilds.end()) {
185  throw InvalidArgument("Trying to add a duplicate " + toString(SUMO_TAG_EDGE) + " child in " + toString(getTag()) + " with ID='" + getID() + "'");
186  } else {
187  myEdgeChilds.push_back(edge);
188  }
189 }
190 
191 
192 void
194  // Check that edge is valid and exist previously
195  if (edge == NULL) {
196  throw InvalidArgument("Trying to remove an empty " + toString(SUMO_TAG_EDGE) + " child in " + toString(getTag()) + " with ID='" + getID() + "'");
197  } else if (std::find(myEdgeChilds.begin(), myEdgeChilds.end(), edge) == myEdgeChilds.end()) {
198  throw InvalidArgument("Trying to remove a non previously inserted " + toString(SUMO_TAG_EDGE) + " child in " + toString(getTag()) + " with ID='" + getID() + "'");
199  } else {
200  myEdgeChilds.erase(std::find(myEdgeChilds.begin(), myEdgeChilds.end(), edge));
201  }
202 }
203 
204 
205 const std::vector<GNEEdge*>&
207  return myEdgeChilds;
208 }
209 
210 
211 void
213  // Check that lane is valid and doesn't exist previously
214  if (lane == NULL) {
215  throw InvalidArgument("Trying to add an empty " + toString(SUMO_TAG_EDGE) + " child in " + toString(getTag()) + " with ID='" + getID() + "'");
216  } else if (std::find(myLaneChilds.begin(), myLaneChilds.end(), lane) != myLaneChilds.end()) {
217  throw InvalidArgument("Trying to add a duplicate " + toString(SUMO_TAG_EDGE) + " child in " + toString(getTag()) + " with ID='" + getID() + "'");
218  } else {
219  myLaneChilds.push_back(lane);
220  }
221 }
222 
223 
224 void
226  // Check that lane is valid and exist previously
227  if (lane == NULL) {
228  throw InvalidArgument("Trying to remove an empty " + toString(SUMO_TAG_EDGE) + " child in " + toString(getTag()) + " with ID='" + getID() + "'");
229  } else if (std::find(myLaneChilds.begin(), myLaneChilds.end(), lane) == myLaneChilds.end()) {
230  throw InvalidArgument("Trying to remove a non previously inserted " + toString(SUMO_TAG_EDGE) + " child in " + toString(getTag()) + " with ID='" + getID() + "'");
231  } else {
232  myLaneChilds.erase(std::find(myLaneChilds.begin(), myLaneChilds.end(), lane));
233  }
234 }
235 
236 
237 const std::vector<GNELane*>&
239  return myLaneChilds;
240 }
241 
242 
243 const std::string&
245  return myViewNet->getNet()->getMicrosimID();
246 }
247 
248 
251  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
252  // build header
253  buildPopupHeader(ret, app);
254  // build menu command for center button and copy cursor position to clipboard
256  buildPositionCopyEntry(ret, false);
257  // buld menu commands for names
258  new FXMenuCommand(ret, ("Copy " + toString(getTag()) + " name to clipboard").c_str(), 0, ret, MID_COPY_NAME);
259  new FXMenuCommand(ret, ("Copy " + toString(getTag()) + " typed name to clipboard").c_str(), 0, ret, MID_COPY_TYPED_NAME);
260  new FXMenuSeparator(ret);
261  // build selection and show parameters menu
264  // show option to open additional dialog
265  if (canOpenDialog(getTag())) {
266  new FXMenuCommand(ret, ("Open " + toString(getTag()) + " Dialog").c_str(), getIcon(), &parent, MID_OPEN_ADDITIONAL_DIALOG);
267  new FXMenuSeparator(ret);
268  }
269  // get attributes
270  std::vector<SumoXMLAttr> attributes = getAttrs();
271  // Show position parameters
274  // Show menu command inner position
275  const double innerPos = myShape.nearest_offset_to_point2D(parent.getPositionInformation());
276  new FXMenuCommand(ret, ("Cursor position inner additional: " + toString(innerPos)).c_str(), 0, 0, 0);
277  // If shape isn't empty, show menu command lane position
278  if (myShape.size() > 0) {
279  const double lanePos = lane->getShape().nearest_offset_to_point2D(myShape[0]);
280  new FXMenuCommand(ret, ("Cursor position over " + toString(SUMO_TAG_LANE) + ": " + toString(innerPos + lanePos)).c_str(), 0, 0, 0);
281  }
282  } else if (hasAttribute(getTag(), SUMO_ATTR_EDGE)) {
284  // Show menu command inner position
285  const double innerPos = myShape.nearest_offset_to_point2D(parent.getPositionInformation());
286  new FXMenuCommand(ret, ("Cursor position inner additional: " + toString(innerPos)).c_str(), 0, 0, 0);
287  // If shape isn't empty, show menu command edge position
288  if (myShape.size() > 0) {
289  const double edgePos = edge->getLanes().at(0)->getShape().nearest_offset_to_point2D(myShape[0]);
290  new FXMenuCommand(ret, ("Mouse position over " + toString(SUMO_TAG_EDGE) + ": " + toString(innerPos + edgePos)).c_str(), 0, 0, 0);
291  }
292  } else {
293  new FXMenuCommand(ret, ("Cursor position in view: " + toString(getPositionInView().x()) + "," + toString(getPositionInView().y())).c_str(), 0, 0, 0);
294  }
295  return ret;
296 }
297 
298 
301  // get attributes
302  std::vector<SumoXMLAttr> attributes = getAttrs();
303  // Create table
304  GUIParameterTableWindow* ret = new GUIParameterTableWindow(app, *this, (int)attributes.size());
305  // Iterate over attributes
306  for (auto i : attributes) {
307  // Add attribute and set it dynamic if aren't unique
309  ret->mkItem(toString(i).c_str(), false, getAttribute(i));
310  } else {
311  ret->mkItem(toString(i).c_str(), true, getAttribute(i));
312  }
313  }
314  // close building
315  ret->closeBuilding();
316  return ret;
317 }
318 
319 
320 Boundary
322  // Return Boundary depenpding of myShape
323  if (myShape.size() > 0) {
325  b.grow(20);
326  return b;
327  } else {
328  return Boundary(-0.1, 0.1, 0, 1, 0, 1);
329  }
330 }
331 
332 
333 bool
334 GNEAdditional::isRouteValid(const std::vector<GNEEdge*>& edges, bool report) {
335  if (edges.size() == 0) {
336  // routes cannot be empty
337  return false;
338  } else if (edges.size() == 1) {
339  // routes with a single edge are valid
340  return true;
341  } else {
342  // iterate over edges to check that compounds a chain
343  auto it = edges.begin();
344  while (it != edges.end() - 1) {
345  GNEEdge* currentEdge = *it;
346  GNEEdge* nextEdge = *(it + 1);
347  // consecutive edges aren't allowed
348  if (currentEdge->getID() == nextEdge->getID()) {
349  return false;
350  }
351  // make sure that edges are consecutives
352  if (std::find(currentEdge->getGNEJunctionDestiny()->getGNEOutgoingEdges().begin(),
353  currentEdge->getGNEJunctionDestiny()->getGNEOutgoingEdges().end(),
354  nextEdge) == currentEdge->getGNEJunctionDestiny()->getGNEOutgoingEdges().end()) {
355  if (report) {
356  WRITE_WARNING("Parameter 'Route' invalid. " + toString(currentEdge->getTag()) + " '" + currentEdge->getID() +
357  "' ins't consecutive to " + toString(nextEdge->getTag()) + " '" + nextEdge->getID() + "'");
358  }
359  return false;
360  }
361  it++;
362  }
363  }
364  return true;
365 }
366 
367 
368 void
370  if (myShape.size() > 0 && myShape.length() != 0) {
371  // If length of the shape is distint to 0, Obtain rotation of center of shape
373  } else if (hasAttribute(getTag(), SUMO_ATTR_LANE)) {
374  // If additional is over a lane, set rotation in the position over lane
375  double posOverLane = additionalLane->getShape().nearest_offset_to_point2D(getPositionInView());
376  myBlockIconRotation = additionalLane->getShape().rotationDegreeAtOffset(posOverLane) - 90;
377  } else {
378  // In other case, rotation is 0
380  }
381 }
382 
383 
384 void
385 GNEAdditional::drawLockIcon(double size) const {
386  if (myViewNet->showLockIcon()) {
387  // Start pushing matrix
388  glPushMatrix();
389  // Traslate to middle of shape
390  glTranslated(myBlockIconPosition.x(), myBlockIconPosition.y(), getType() + 0.1);
391  // Set draw color
392  glColor3d(1, 1, 1);
393  // Rotate depending of myBlockIconRotation
394  glRotated(myBlockIconRotation, 0, 0, -1);
395  // Rotate 180 degrees
396  glRotated(180, 0, 0, 1);
397  // Traslate depending of the offset
398  glTranslated(myBlockIconOffset.x(), myBlockIconOffset.y(), 0);
399  // Draw icon depending of the state of additional
400  if (isAdditionalSelected()) {
401  if (myMovable == false) {
402  // Draw not movable texture if additional isn't movable and is selected
404  } else if (myBlocked) {
405  // Draw lock texture if additional is movable, is blocked and is selected
407  } else {
408  // Draw empty texture if additional is movable, isn't blocked and is selected
410  }
411  } else {
412  if (myMovable == false) {
413  // Draw not movable texture if additional isn't movable
415  } else if (myBlocked) {
416  // Draw lock texture if additional is movable and is blocked
418  } else {
419  // Draw empty texture if additional is movable and isn't blocked
421  }
422  }
423  // Pop matrix
424  glPopMatrix();
425  }
426 }
427 
428 
429 void
431  // first clear connection positions
434 
435  // calculate position and rotation of every simbol for every edge
436  for (auto i : myEdgeChilds) {
437  for (auto j : i->getLanes()) {
438  std::pair<Position, double> posRot;
439  // set position and lenght depending of shape's lengt
440  if (j->getShape().length() - 6 > 0) {
441  posRot.first = j->getShape().positionAtOffset(j->getShape().length() - 6);
442  posRot.second = j->getShape().rotationDegreeAtOffset(j->getShape().length() - 6);
443  } else {
444  posRot.first = j->getShape().positionAtOffset(j->getShape().length());
445  posRot.second = j->getShape().rotationDegreeAtOffset(j->getShape().length());
446  }
447  mySymbolsPositionAndRotation.push_back(posRot);
448  }
449  }
450 
451  // calculate position and rotation of every simbol for every lane
452  for (auto i : myLaneChilds) {
453  std::pair<Position, double> posRot;
454  // set position and lenght depending of shape's lengt
455  if (i->getShape().length() - 6 > 0) {
456  posRot.first = i->getShape().positionAtOffset(i->getShape().length() - 6);
457  posRot.second = i->getShape().rotationDegreeAtOffset(i->getShape().length() - 6);
458  } else {
459  posRot.first = i->getShape().positionAtOffset(i->getShape().length());
460  posRot.second = i->getShape().rotationDegreeAtOffset(i->getShape().length());
461  }
462  mySymbolsPositionAndRotation.push_back(posRot);
463  }
464 
465  // calculate position for every additional child
466  for (auto i : myAdditionalChilds) {
467  std::vector<Position> posConnection;
468  double A = std::abs(i->getPositionInView().x() - getPositionInView().x());
469  double B = std::abs(i->getPositionInView().y() - getPositionInView().y());
470  // Set positions of connection's vertex. Connection is build from Entry to E3
471  posConnection.push_back(i->getPositionInView());
472  if (getPositionInView().x() > i->getPositionInView().x()) {
473  if (getPositionInView().y() > i->getPositionInView().y()) {
474  posConnection.push_back(Position(i->getPositionInView().x() + A, i->getPositionInView().y()));
475  } else {
476  posConnection.push_back(Position(i->getPositionInView().x(), i->getPositionInView().y() - B));
477  }
478  } else {
479  if (getPositionInView().y() > i->getPositionInView().y()) {
480  posConnection.push_back(Position(i->getPositionInView().x(), i->getPositionInView().y() + B));
481  } else {
482  posConnection.push_back(Position(i->getPositionInView().x() - A, i->getPositionInView().y()));
483  }
484  }
485  posConnection.push_back(getPositionInView());
486  myChildConnectionPositions.push_back(posConnection);
487  }
488 
489  // calculate geometry for connections between parent and childs
490  for (auto i : mySymbolsPositionAndRotation) {
491  std::vector<Position> posConnection;
492  double A = std::abs(i.first.x() - getPositionInView().x());
493  double B = std::abs(i.first.y() - getPositionInView().y());
494  // Set positions of connection's vertex. Connection is build from Entry to E3
495  posConnection.push_back(i.first);
496  if (getPositionInView().x() > i.first.x()) {
497  if (getPositionInView().y() > i.first.y()) {
498  posConnection.push_back(Position(i.first.x() + A, i.first.y()));
499  } else {
500  posConnection.push_back(Position(i.first.x(), i.first.y() - B));
501  }
502  } else {
503  if (getPositionInView().y() > i.first.y()) {
504  posConnection.push_back(Position(i.first.x(), i.first.y() + B));
505  } else {
506  posConnection.push_back(Position(i.first.x() - A, i.first.y()));
507  }
508  }
509  posConnection.push_back(getPositionInView());
510  myChildConnectionPositions.push_back(posConnection);
511  }
512 }
513 
514 
515 void
517  // Iterate over myConnectionPositions
518  for (auto i : myChildConnectionPositions) {
519  // Add a draw matrix
520  glPushMatrix();
521  // traslate in the Z axis
522  glTranslated(0, 0, getType() - 0.01);
523  // Set color of the base
524  GLHelper::setColor(RGBColor(255, 235, 0));
525  for (auto j = i.begin(); (j + 1) != i.end(); j++) {
526  // Draw Lines
527  GLHelper::drawLine((*j), (*(j + 1)));
528  }
529  // Pop draw matrix
530  glPopMatrix();
531  }
532 }
533 
534 
535 const std::string&
537  return getMicrosimID();
538 }
539 
540 
541 bool
542 GNEAdditional::isValidAdditionalID(const std::string& newID) const {
543  if (isValidID(newID) && (myViewNet->getNet()->getAdditional(getTag(), newID) == NULL)) {
544  return true;
545  } else {
546  return false;
547  }
548 }
549 
550 
551 void
552 GNEAdditional::changeAdditionalID(const std::string& newID) {
553  if (myViewNet->getNet()->getAdditional(getTag(), newID) != NULL) {
554  throw InvalidArgument("An Additional with tag " + toString(getTag()) + " and ID = " + newID + " already exists");
555  } else if (isValidID(newID) == false) {
556  throw InvalidArgument("Additional ID " + newID + " contains invalid characters");
557  } else {
558  // Save old ID
559  std::string oldID = getMicrosimID();
560  // set New ID
561  setMicrosimID(newID);
562  // update additional ID in the container of net
563  myViewNet->getNet()->updateAdditionalID(oldID, this);
564  }
565 }
566 
567 
568 GNEEdge*
569 GNEAdditional::changeEdge(GNEEdge* oldEdge, const std::string& newEdgeID) {
570  if (oldEdge == NULL) {
571  throw InvalidArgument(toString(getTag()) + " with ID '" + getMicrosimID() + "' doesn't belong to an " + toString(SUMO_TAG_EDGE));
572  } else {
573  oldEdge->removeAdditionalChild(this);
574  GNEEdge* newEdge = myViewNet->getNet()->retrieveEdge(newEdgeID);
575  newEdge->addAdditionalChild(this);
576  updateGeometry();
577  return newEdge;
578  }
579 }
580 
581 
582 GNELane*
583 GNEAdditional::changeLane(GNELane* oldLane, const std::string& newLaneID) {
584  if (oldLane == NULL) {
585  throw InvalidArgument(toString(getTag()) + " with ID '" + getMicrosimID() + "' doesn't belong to a " + toString(SUMO_TAG_LANE));
586  } else {
587  oldLane->removeAdditionalChild(this);
588  GNELane* newLane = myViewNet->getNet()->retrieveLane(newLaneID);
589  newLane->addAdditionalChild(this);
590  updateGeometry();
591  return newLane;
592  }
593 }
594 
595 
596 void
597 GNEAdditional::changeAdditionalParent(const std::string& newAdditionalParentID) {
598  if (myAdditionalParent == NULL) {
599  throw InvalidArgument(toString(getTag()) + " with ID '" + getMicrosimID() + "' doesn't have an additional parent");
600  } else {
601  // remove this additional of the childs of parent additional
603  myAdditionalParent = myViewNet->getNet()->retrieveAdditional(newAdditionalParentID);
604  // add this additional int the childs of parent additional
606  updateGeometry();
607  }
608 }
609 
610 
611 /****************************************************************************/
void removeEdgeChild(GNEEdge *edge)
remove edge child
static void drawTexturedBox(int which, double size)
Draws a named texture as a box with the given size.
GNEAdditional(const std::string &id, GNEViewNet *viewNet, SumoXMLTag tag, GUIIcon icon, bool movable)
Constructor.
virtual void openAdditionalDialog()
open Additional Dialog
void addEdgeChild(GNEEdge *edge)
add edge child
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
SumoXMLTag
Numbers representing SUMO-XML - element names.
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:902
bool isAdditionalBlocked() const
Check if additional item is currently blocked (i.e. cannot be moved with mouse)
void removeAdditionalChild(GNEAdditional *additional)
remove additional child from this additional
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
const std::vector< GNEEdge * > & getGNEOutgoingEdges() const
Returns incoming GNEEdges.
begin/end of the description of a single lane
const std::vector< GNEEdge * > & getEdgeChilds() const
get edge chidls
const std::string & getAdditionalID() const
returns Additional ID
const std::vector< GNELane * > & getLaneChilds() const
get lanes of VSS
GUIIcon
An enumeration of icons used by the gui applications.
Definition: GUIIcons.h:42
static GUIGlID getTexture(GUITexture which)
returns a texture previously defined in the enum GUITexture
GNEAdditional * getAdditional(SumoXMLTag type, const std::string &id) const
Returns the named additional.
Definition: GNENet.cpp:1667
virtual const std::string & getParentName() const =0
Returns the name of the parent object (if any)
double y() const
Returns the y-position.
Definition: Position.h:67
PositionVector getShape() const
Returns additional element&#39;s shape.
double x() const
Returns the x-position.
Definition: Position.h:62
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
FXIcon * getIcon() const
get FXIcon assigned to this object
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:53
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
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.
void changeAdditionalID(const std::string &newID)
change ID of additional
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:47
virtual std::string getAttribute(SumoXMLAttr key) const =0
This functions has to be implemented in all GNEAttributeCarriers.
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:199
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
GNEViewNet * myViewNet
The GNEViewNet this additional element belongs.
std::vector< std::vector< Position > > myChildConnectionPositions
Matrix with the Vertex&#39;s positions of connections between parents an their childs.
static bool isValidID(const std::string &value)
true if value is a valid sumo ID
GNEAdditional * myAdditionalParent
pointer to Addititional parent
bool showLockIcon() const
check if lock icon should be visible
void drawChildConnections() const
draw connections between Parent and childrens
void updateAdditionalID(const std::string &oldID, GNEAdditional *additional)
update additional ID in container
Definition: GNENet.cpp:1721
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void drawLockIcon(double size=0.5) const
draw lock icon
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:55
static bool hasAttribute(SumoXMLTag tag, SumoXMLAttr attr)
check if an element with certain tag has a certain attribute
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:449
bool myMovable
flag to check if this additional is movable
void addAdditionalChild(GNEAdditional *additional)
add additional child to this edge
PositionVector myShape
The shape of the additional element.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:45
A list of positions.
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
GNEJunction * getGNEJunctionDestiny() const
returns the destination-junction
Definition: GNEEdge.cpp:323
Copy object name - popup entry.
Definition: GUIAppEnum.h:228
void updateChildConnections()
update Connection&#39;s geometry
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:301
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
std::vector< SumoXMLAttr > getAttrs() const
get vector of attributes
const std::string getID() const
function to support debugging
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:238
void removeAdditionalChild(GNEAdditional *additional)
remove additional child from this edge
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
Definition: GLHelper.cpp:276
~GNEAdditional()
Destructor.
Position myBlockIconOffset
The offSet of the block icon.
std::vector< GNEAdditional * > myAdditionalChilds
vector with the Additional childs
begin/end of the description of an edge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:56
static bool isUnique(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is unique (may not be edited for a multi-selection and don&#39;t have a default valu...
compound additional
GNEViewNet * getViewNet() const
Returns a pointer to GNEViewNet in which additional element is located.
const PositionVector & getShape() const
returns the shape of the lane
Definition: GNELane.cpp:599
bool myBlocked
boolean to check if additional element is blocked (i.e. cannot be moved with mouse) ...
const std::vector< GNELane * > & getLanes()
returns a reference to the lane vector
Definition: GNEEdge.cpp:653
double length() const
Returns the length.
GNEEdge * changeEdge(GNEEdge *oldEdge, const std::string &newEdgeID)
change edge of additional
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:59
GNEAdditional * getAdditionalParent() const
GNEAdditional * retrieveAdditional(const std::string &id, bool hardFail=true) const
Returns the named additional.
Definition: GNENet.cpp:1640
void setBlockIconRotation(GNELane *additionalLane=NULL)
std::vector< std::pair< Position, double > > mySymbolsPositionAndRotation
position and rotation of every simbol over lane
The popup menu of a globject.
static bool canOpenDialog(SumoXMLTag tag)
return true if element tag can open a values editor
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
GNENet * getNet() const
get the net object
GUIGlID getGlID() const
Returns the numerical id of the object.
Copy typed object name - popup entry.
Definition: GUIAppEnum.h:230
static bool isRouteValid(const std::vector< GNEEdge *> &edges, bool report)
check if a route is valid
void changeAdditionalParent(const std::string &newAdditionalParentID)
change additional parent of additional
Position getPositionInformation() const
Returns the cursor&#39;s x/y position within the network.
bool isValidAdditionalID(const std::string &newID) const
check if a new additional ID is valid
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
bool isAdditionalSelected() const
virtual void updateGeometry()=0
update pre-computed geometry information
void addAdditionalChild(GNEAdditional *additional)
add additional child to this additional
void removeLaneChild(GNELane *lane)
remove lane child
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
const std::vector< GNEAdditional * > & getAdditionalChilds() const
return vector of additionals that have as Parent this edge (For example, Calibrators) ...
void mkItem(const char *name, bool dynamic, ValueSource< unsigned > *src)
Adds a row which obtains its value from an unsigned-ValueSource.
GUISelectedStorage gSelected
A global holder of selected objects.
GNELane * retrieveLane(const std::string &id, bool failHard=true, bool checkVolatileChange=false)
get lane by id
Definition: GNENet.cpp:1000
A window containing a gl-object&#39;s parameter.
double myBlockIconRotation
The rotation of the block icon.
GNELane * changeLane(GNELane *oldLane, const std::string &newLaneID)
change lane of additional
void addLaneChild(GNELane *lane)
add lane child
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
Position myBlockIconPosition
position of the block icon
std::vector< GNELane * > myLaneChilds
vector with the lane childs of this additional
SumoXMLTag getTag() const
get XML Tag assigned to this object
std::vector< GNEEdge * > myEdgeChilds
vector with the edge childs of this additional
virtual Position getPositionInView() const =0
Returns position of additional in view.