Eclipse SUMO - Simulation of Urban MObility
GNEPOI.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 class for visualizing and editing POIS in netedit (adapted from
15 // GUIPointOfInterest and NLHandler)
16 /****************************************************************************/
17 
18 
19 // ===========================================================================
20 // included modules
21 // ===========================================================================
22 #include <string>
26 #include <utils/gui/div/GLHelper.h>
29 #include <netedit/GNENet.h>
30 #include <netedit/GNEUndoList.h>
31 #include <netedit/GNEViewNet.h>
36 
37 #include "GNEPOI.h"
38 
39 
40 // ===========================================================================
41 // method definitions
42 // ===========================================================================
43 
44 GNEPOI::GNEPOI(GNENet* net, const std::string& id, const std::string& type, const RGBColor& color,
45  const Position& pos, bool geo, double layer, double angle, const std::string& imgFile,
46  bool relativePath, double width, double height, bool movementBlocked) :
47  GUIPointOfInterest(id, type, color, pos, geo, "", 0, 0, layer, angle, imgFile, relativePath, width, height),
48  GNEShape(net, SUMO_TAG_POI, movementBlocked, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}) {
49  // set GEO Position
50  myGEOPosition = pos;
51  GeoConvHelper::getFinal().cartesian2geo(myGEOPosition);
52 }
53 
54 
55 GNEPOI::GNEPOI(GNENet* net, const std::string& id, const std::string& type, const RGBColor& color,
56  double layer, double angle, const std::string& imgFile, bool relativePath, GNELane* lane, double posOverLane, double posLat,
57  double width, double height, bool movementBlocked) :
58  GUIPointOfInterest(id, type, color, Position(), false, lane->getID(), posOverLane, posLat, layer, angle, imgFile, relativePath, width, height),
59  GNEShape(net, SUMO_TAG_POILANE, movementBlocked, {}, {lane}, {}, {}, {}, {}, {}, {}, {}, {}) {
60 }
61 
62 
64 
65 
66 std::string
68  int counter = myNet->getPOIs().size();
69  while (myNet->retrievePOI(getID() + toString(childTag) + toString(counter), false) != nullptr) {
70  counter++;
71  }
72  return (getID() + toString(childTag) + toString(counter));
73 }
74 
75 
76 void
78 }
79 
80 
81 void
83 }
84 
85 
86 void
88  if (getParentLanes().size() > 0) {
89  // obtain fixed position over lane
90  double fixedPositionOverLane = myPosOverLane > getParentLanes().at(0)->getLaneShape().length() ? getParentLanes().at(0)->getLaneShape().length() : myPosOverLane < 0 ? 0 : myPosOverLane;
91  // write POILane using POI::writeXML
92  writeXML(device, false, 0, getParentLanes().at(0)->getID(), fixedPositionOverLane, myPosLat);
93  } else {
94  writeXML(device, myGeo);
95  }
96 }
97 
98 
99 void
100 GNEPOI::moveGeometry(const Position& oldPos, const Position& offset) {
101  if (!myBlockMovement) {
102  // Calculate new position using old position
103  Position newPosition = oldPos;
104  newPosition.add(offset);
105  // filtern position using snap to active grid
106  newPosition = myNet->getViewNet()->snapToActiveGrid(newPosition);
107  // set position depending of POI Type
108  if (getParentLanes().size() > 0) {
109  myPosOverLane = getParentLanes().at(0)->getLaneShape().nearest_offset_to_point2D(newPosition, false);
110  } else {
111  set(newPosition);
112  }
113  // Update geometry
114  updateGeometry();
115  }
116 }
117 
118 
119 void
121  if (!myBlockMovement) {
122  // restore original Position before moving (to avoid problems in GL Tree)
123  Position myNewPosition(*this);
124  set(oldPos);
125  // commit new position allowing undo/redo
126  if (getParentLanes().size() > 0) {
127  // restore old position before commit new position
128  double originalPosOverLane = getParentLanes().at(0)->getLaneShape().nearest_offset_to_point2D(oldPos, false);
129  undoList->p_begin("position of " + getTagStr());
130  undoList->p_add(new GNEChange_Attribute(this, myNet, SUMO_ATTR_POSITION, toString(myPosOverLane), true, toString(originalPosOverLane)));
131  undoList->p_end();
132  } else {
133  undoList->p_begin("position of " + getTagStr());
134  undoList->p_add(new GNEChange_Attribute(this, myNet, SUMO_ATTR_POSITION, toString(myNewPosition), true, toString(oldPos)));
135  undoList->p_end();
136  }
137  }
138 }
139 
140 
141 void
143  if (getParentLanes().size() > 0) {
144  // obtain fixed position over lane
145  double fixedPositionOverLane = myPosOverLane > getParentLanes().at(0)->getLaneShapeLength() ? getParentLanes().at(0)->getLaneShapeLength() : myPosOverLane < 0 ? 0 : myPosOverLane;
146  // set new position regarding to lane
147  set(getParentLanes().at(0)->getLaneShape().positionAtOffset(fixedPositionOverLane * getParentLanes().at(0)->getLengthGeometryFactor(), -myPosLat));
148  }
149 }
150 
151 
152 Position
154  return Position(x(), y());
155 }
156 
157 
158 Boundary
160  // Return Boundary depending if myMovingGeometryBoundary is initialised (important for move geometry)
163  } else {
165  }
166 }
167 
168 
169 GUIGlID
172 }
173 
174 
175 std::string
177  return myNet->getMicrosimID();
178 }
179 
180 
183  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
184  buildPopupHeader(ret, app);
187  // build selection and show parameters menu
190  if (getParentLanes().size() > 0) {
191  // build shape header
193  // add option for convert to GNEPOI
194  new FXMenuCommand(ret, ("Release from " + toString(SUMO_TAG_LANE)).c_str(), GUIIconSubSys::getIcon(ICON_LANE), &parent, MID_GNE_POI_TRANSFORM);
195  return ret;
196  } else {
197  // build shape header
199  // add option for convert to GNEPOI
200  new FXMenuCommand(ret, ("Attach to nearest " + toString(SUMO_TAG_LANE)).c_str(), GUIIconSubSys::getIcon(ICON_LANE), &parent, MID_GNE_POI_TRANSFORM);
201  }
202  return ret;
203 }
204 
205 
208  return GUIPointOfInterest::getParameterWindow(app, parent);
209 }
210 
211 
212 void
214  // first check if POI can be drawn
216  // check if boundary has to be drawn
217  if (s.drawBoundaries) {
219  }
220  // first clear vertices
221  myPOIVertices.clear();
222  // check if POI can be drawn
223  if (checkDraw(s)) {
224  // push name (needed for getGUIGlObjectsUnderCursor(...)
225  glPushName(getGlID());
226  // draw inner polygon
228  // draw an orange square mode if there is an image(see #4036)
229  if (!getShapeImgFile().empty() && myNet->getViewNet()->getTestingMode().isTestingEnabled()) {
230  // Add a draw matrix for drawing logo
231  glPushMatrix();
232  glTranslated(x(), y(), getType() + 0.01);
234  GLHelper::drawBoxLine(Position(0, 1), 0, 2, 1);
235  glPopMatrix();
236  }
237  // check if dotted contour has to be drawn
238  if (myNet->getViewNet()->getDottedAC() == this) {
240  const double exaggeration = s.poiSize.getExaggeration(s, this);
241  GLHelper::drawShapeDottedContourRectangle(s, getType(), *this, 2 * myHalfImgWidth * exaggeration, 2 * myHalfImgHeight * exaggeration);
242  } else if (myPOIVertices.size() > 0) {
243  glPushMatrix();
244  glTranslated(x(), y(), getType() + 0.01);
246  glPopMatrix();
247  }
248  }
249  // pop name
250  glPopName();
251  }
252  }
253 }
254 
255 
256 std::string
258  switch (key) {
259  case SUMO_ATTR_ID:
260  return myID;
261  case SUMO_ATTR_COLOR:
262  return toString(getShapeColor());
263  case SUMO_ATTR_LANE:
264  return myLane;
265  case SUMO_ATTR_POSITION:
266  if (getParentLanes().size() > 0) {
267  return toString(myPosOverLane);
268  } else {
269  return toString(*this);
270  }
272  return toString(myPosLat);
275  case SUMO_ATTR_GEO:
276  return toString(myGeo);
277  case SUMO_ATTR_TYPE:
278  return getShapeType();
279  case SUMO_ATTR_LAYER:
281  return "default";
282  } else {
283  return toString(getShapeLayer());
284  }
285  case SUMO_ATTR_IMGFILE:
286  return getShapeImgFile();
288  return toString(getShapeRelativePath());
289  case SUMO_ATTR_WIDTH:
290  return toString(getWidth());
291  case SUMO_ATTR_HEIGHT:
292  return toString(getHeight());
293  case SUMO_ATTR_ANGLE:
294  return toString(getShapeNaviDegree());
296  return toString(myBlockMovement);
297  case GNE_ATTR_SELECTED:
299  case GNE_ATTR_PARAMETERS:
300  return getParametersStr();
301  default:
302  throw InvalidArgument(getTagStr() + " attribute '" + toString(key) + "' not allowed");
303  }
304 }
305 
306 
307 void
308 GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
309  if (value == getAttribute(key)) {
310  return; //avoid needless changes, later logic relies on the fact that attributes have changed
311  }
312  switch (key) {
313  case SUMO_ATTR_ID:
314  case SUMO_ATTR_COLOR:
315  case SUMO_ATTR_LANE:
316  case SUMO_ATTR_POSITION:
319  case SUMO_ATTR_GEO:
320  case SUMO_ATTR_TYPE:
321  case SUMO_ATTR_LAYER:
322  case SUMO_ATTR_IMGFILE:
324  case SUMO_ATTR_WIDTH:
325  case SUMO_ATTR_HEIGHT:
326  case SUMO_ATTR_ANGLE:
328  case GNE_ATTR_SELECTED:
329  case GNE_ATTR_PARAMETERS:
330  undoList->p_add(new GNEChange_Attribute(this, myNet, key, value));
331  break;
332  default:
333  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
334  }
335 }
336 
337 
338 bool
339 GNEPOI::isValid(SumoXMLAttr key, const std::string& value) {
340  switch (key) {
341  case SUMO_ATTR_ID:
342  return SUMOXMLDefinitions::isValidTypeID(value) && (myNet->retrievePOI(value, false) == nullptr);
343  case SUMO_ATTR_COLOR:
344  return canParse<RGBColor>(value);
345  case SUMO_ATTR_LANE:
346  return (myNet->retrieveLane(value, false) != nullptr);
347  case SUMO_ATTR_POSITION:
348  if (getParentLanes().size() > 0) {
349  return canParse<double>(value);
350  } else {
351  return canParse<Position>(value);
352  }
354  return canParse<double>(value);
355  case SUMO_ATTR_GEOPOSITION: {
356  return canParse<Position>(value);
357  }
358  case SUMO_ATTR_GEO:
359  return canParse<bool>(value);
360  case SUMO_ATTR_TYPE:
361  return true;
362  case SUMO_ATTR_LAYER:
363  if (value == "default") {
364  return true;
365  } else {
366  return canParse<double>(value);
367  }
368  case SUMO_ATTR_IMGFILE:
369  if (value == "") {
370  return true;
371  } else {
372  // check that image can be loaded
373  return GUITexturesHelper::getTextureID(value) != -1;
374  }
376  return canParse<bool>(value);
377  case SUMO_ATTR_WIDTH:
378  return canParse<double>(value) && (parse<double>(value) > 0);
379  case SUMO_ATTR_HEIGHT:
380  return canParse<double>(value) && (parse<double>(value) > 0);
381  case SUMO_ATTR_ANGLE:
382  return canParse<double>(value);
384  return canParse<bool>(value);
385  case GNE_ATTR_SELECTED:
386  return canParse<bool>(value);
387  case GNE_ATTR_PARAMETERS:
388  return Parameterised::areParametersValid(value);
389  default:
390  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
391  }
392 }
393 
394 
395 bool
397  // check if we're in supermode Network
399  return true;
400  } else {
401  return false;
402  }
403 }
404 
405 // ===========================================================================
406 // private
407 // ===========================================================================
408 
409 void
410 GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value) {
411  switch (key) {
412  case SUMO_ATTR_ID: {
413  std::string oldID = myID;
414  myID = value;
415  myNet->changeShapeID(this, oldID);
416  setMicrosimID(value);
417  break;
418  }
419  case SUMO_ATTR_COLOR:
420  setShapeColor(parse<RGBColor>(value));
421  break;
422  case SUMO_ATTR_LANE:
423  myLane = value;
424  replaceParentLanes(this, value);
425  break;
426  case SUMO_ATTR_POSITION: {
427  if (getParentLanes().size() > 0) {
428  myPosOverLane = parse<double>(value);
429  } else {
430  // first remove object from grid due position is used for boundary
432  // set position
433  set(parse<Position>(value));
434  // set GEO Position
435  myGEOPosition.setx(this->x());
436  myGEOPosition.sety(this->y());
437  myGEOPosition.setz(this->z());
439  // add object into grid again
440  myNet->addGLObjectIntoGrid(this);
441  }
442  break;
443  }
445  myPosLat = parse<double>(value);
446  break;
447  case SUMO_ATTR_GEOPOSITION: {
448  // first remove object from grid due position is used for boundary
450  // set new position
451  myGEOPosition = parse<Position>(value);
452  // set cartesian Position
455  // add object into grid again
456  myNet->addGLObjectIntoGrid(this);
457  break;
458  }
459  case SUMO_ATTR_GEO:
460  myGeo = parse<bool>(value);
461  break;
462  case SUMO_ATTR_TYPE:
463  setShapeType(value);
464  break;
465  case SUMO_ATTR_LAYER:
466  if (value == "default") {
468  } else {
469  setShapeLayer(parse<double>(value));
470  }
471  break;
472  case SUMO_ATTR_IMGFILE:
473  // first remove object from grid due img file affect to boundary
475  setShapeImgFile(value);
476  // all textures must be refresh
478  // add object into grid again
479  myNet->addGLObjectIntoGrid(this);
480  break;
482  setShapeRelativePath(parse<bool>(value));
483  break;
484  case SUMO_ATTR_WIDTH:
485  if (getParentLanes().size() > 0) {
486  // set new width
487  setWidth(parse<double>(value));
488  } else {
489  // first remove object from grid due position is used for boundary
491  // set new width
492  setWidth(parse<double>(value));
493  // add object into grid again
494  myNet->addGLObjectIntoGrid(this);
495  }
496  break;
497  case SUMO_ATTR_HEIGHT:
498  if (getParentLanes().size() > 0) {
499  // set new height
500  setHeight(parse<double>(value));
501  } else {
502  // first remove object from grid due position is used for boundary
504  // set new height
505  setHeight(parse<double>(value));
506  // add object into grid again
507  myNet->addGLObjectIntoGrid(this);
508  }
509  break;
510  case SUMO_ATTR_ANGLE:
511  setShapeNaviDegree(parse<double>(value));
512  break;
514  myBlockMovement = parse<bool>(value);
515  break;
516  case GNE_ATTR_SELECTED:
517  if (parse<bool>(value)) {
519  } else {
521  }
522  break;
523  case GNE_ATTR_PARAMETERS:
524  setParametersStr(value);
525  break;
526  default:
527  throw InvalidArgument(getTagStr() + " attribute '" + toString(key) + "' not allowed");
528  }
529 }
530 
531 
532 const GUIGlObject*
534  return this;
535 }
536 
537 /****************************************************************************/
GUIGlObject::getType
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.cpp:180
GNEShape::myMovingGeometryBoundary
Boundary myMovingGeometryBoundary
boundary used during moving of elements
Definition: GNEShape.h:200
Shape::setShapeType
void setShapeType(const std::string &type)
Sets a new type.
Definition: Shape.h:122
SUMO_ATTR_TYPE
@ SUMO_ATTR_TYPE
Definition: SUMOXMLDefinitions.h:381
SUMO_ATTR_ANGLE
@ SUMO_ATTR_ANGLE
Definition: SUMOXMLDefinitions.h:794
GNEPOI::getParameterWindow
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GNEPOI.cpp:207
GUIParameterTableWindow
A window containing a gl-object's parameter.
Definition: GUIParameterTableWindow.h:62
Parameterised::getParametersStr
std::string getParametersStr() const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
Definition: Parameterised.cpp:112
SUMO_ATTR_IMGFILE
@ SUMO_ATTR_IMGFILE
Definition: SUMOXMLDefinitions.h:792
GNEAttributeCarrier::getID
const std::string getID() const
function to support debugging
Definition: GNEAttributeCarrier.cpp:1289
GNENet::retrievePOI
GNEPOI * retrievePOI(const std::string &id, bool failHard=true) const
get POI by id
Definition: GNENet.cpp:1115
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:72
GUIParameterTableWindow.h
GeoConvHelper::x2cartesian_const
bool x2cartesian_const(Position &from) const
Converts the given coordinate into a cartesian using the previous initialisation.
Definition: GeoConvHelper.cpp:417
GNEPOI::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEPOI.cpp:396
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
GNEPOI::endGeometryMoving
void endGeometryMoving()
begin movement (used when user click over edge to start a movement, to avoid problems with problems w...
Definition: GNEPOI.cpp:82
Shape::getShapeNaviDegree
double getShapeNaviDegree() const
Returns the angle of the Shape in navigational degrees.
Definition: Shape.h:96
PointOfInterest::myGeo
bool myGeo
flag to check if POI was loaded as GEO Position (main used by netedit)
Definition: PointOfInterest.h:176
GNEShape::selectAttributeCarrier
void selectAttributeCarrier(bool changeFlag=true)
Definition: GNEShape.cpp:108
GNEUndoList::p_end
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
Definition: GNEUndoList.cpp:79
Position::z
double z() const
Returns the z-position.
Definition: Position.h:66
OptionsCont.h
GUIVisualizationSettings::drawBoundaries
bool drawBoundaries
enable or disable draw boundaries
Definition: GUIVisualizationSettings.h:638
GNENet::removeGLObjectFromGrid
void removeGLObjectFromGrid(GUIGlObject *o)
add GL Object into net
Definition: GNENet.cpp:1328
GNENet
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:77
Position::setx
void setx(double x)
set position x
Definition: Position.h:71
GUIGLObjectPopupMenu.h
PointOfInterest::getHeight
double getHeight() const
Returns the image height of the POI.
Definition: PointOfInterest.h:94
PointOfInterest::writeXML
void writeXML(OutputDevice &out, const bool geo=false, const double zOffset=0., const std::string laneID="", const double pos=0., const double posLat=0.)
Definition: PointOfInterest.h:123
SUMO_TAG_LANE
@ SUMO_TAG_LANE
begin/end of the description of a single lane
Definition: SUMOXMLDefinitions.h:49
GUIPointOfInterest::checkDraw
bool checkDraw(const GUIVisualizationSettings &s) const
check if POI can be drawn
Definition: GUIPointOfInterest.cpp:130
SUMO_ATTR_COLOR
@ SUMO_ATTR_COLOR
A color information.
Definition: SUMOXMLDefinitions.h:704
GNEHierarchicalParentElements::getParentLanes
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
Definition: GNEHierarchicalParentElements.cpp:235
GNEPOI::commitGeometryMoving
void commitGeometryMoving(const Position &oldPos, GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNEPOI.cpp:120
SUMO_TAG_POI
@ SUMO_TAG_POI
begin/end of the description of a Point of interest
Definition: SUMOXMLDefinitions.h:53
Shape::setShapeImgFile
void setShapeImgFile(const std::string &imgFile)
Sets a new imgFile.
Definition: Shape.h:157
GNEPOI::moveGeometry
void moveGeometry(const Position &oldPos, const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEPOI.cpp:100
Shape::getShapeImgFile
const std::string & getShapeImgFile() const
Returns the imgFile of the Shape.
Definition: Shape.h:103
GNENet::changeShapeID
void changeShapeID(GNEShape *s, const std::string &OldID)
change Shape ID
Definition: GNENet.cpp:2622
SUMO_ATTR_ID
@ SUMO_ATTR_ID
Definition: SUMOXMLDefinitions.h:378
GLHelper.h
SUMO_ATTR_LANE
@ SUMO_ATTR_LANE
Definition: SUMOXMLDefinitions.h:637
PointOfInterest::myPosOverLane
double myPosOverLane
position over lane in which this POI is placed (main used by netedit)
Definition: PointOfInterest.h:182
ICON_LANE
@ ICON_LANE
Definition: GUIIcons.h:260
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:47
GUIIconSubSys::getIcon
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
Definition: GUIIconSubSys.cpp:609
GLHelper::setColor
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:621
GNEPOI::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their correspond attribute are valids
Definition: GNEPOI.cpp:339
Shape::getShapeColor
const RGBColor & getShapeColor() const
Returns the color of the Shape.
Definition: Shape.h:82
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:41
GUISUMOAbstractView::snapToActiveGrid
Position snapToActiveGrid(const Position &pos, bool snapXY=true) const
Returns a position that is mapped to the closest grid point if the grid is active.
Definition: GUISUMOAbstractView.cpp:196
gPrecisionGeo
int gPrecisionGeo
Definition: StdDefs.cpp:27
Shape::setShapeRelativePath
void setShapeRelativePath(bool relativePath)
Sets a new relativePath value.
Definition: Shape.h:164
GLHelper::drawBoundary
static void drawBoundary(const Boundary &b)
Draw a boundary (used for debugging)
Definition: GLHelper.cpp:817
GNEAttributeCarrier::GNEChange_Attribute
friend class GNEChange_Attribute
declare friend class
Definition: GNEAttributeCarrier.h:57
GNEUndoList::p_add
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
Definition: GNEUndoList.cpp:131
GNEPOI::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEPOI.cpp:159
GNEPOI::setAttribute
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes
Definition: GNEPOI.cpp:308
RGBColor
Definition: RGBColor.h:39
GUIGlObject::setMicrosimID
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
Definition: GUIGlObject.cpp:173
GNEViewNetHelper::TestingMode::isTestingEnabled
bool isTestingEnabled() const
check if testing mode is enabled
Definition: GNEViewNetHelper.cpp:1270
PointOfInterest::myHalfImgWidth
double myHalfImgWidth
The half width of the image when rendering this POI.
Definition: PointOfInterest.h:188
GNEPOI::~GNEPOI
~GNEPOI()
Destructor.
Definition: GNEPOI.cpp:63
GUIPointOfInterest
Definition: GUIPointOfInterest.h:45
NamedObjectCont::size
int size() const
Returns the number of stored items within the container.
Definition: NamedObjectCont.h:116
GUIVisualizationSettings::poiSize
GUIVisualizationSizeSettings poiSize
Definition: GUIVisualizationSettings.h:604
GNEShape
Definition: GNEShape.h:34
Shape::getShapeLayer
double getShapeLayer() const
Returns the layer of the Shape.
Definition: Shape.h:89
GeoConvHelper::getFinal
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
Definition: GeoConvHelper.h:105
GUIGlObject::buildNameCopyPopupEntry
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
Definition: GUIGlObject.cpp:225
SUMO_TAG_POILANE
@ SUMO_TAG_POILANE
begin/end of the description of a Point of interest over Lane (used by Netedit)
Definition: SUMOXMLDefinitions.h:55
GNEPOI::getGUIGlObject
const GUIGlObject * getGUIGlObject() const
get GUIGlObject associated to this GNEShape
Definition: GNEPOI.cpp:533
RGBColor::ORANGE
static const RGBColor ORANGE
Definition: RGBColor.h:195
GNEPOI::getPopUpMenu
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEPOI.cpp:182
GNEPOI::GNEPOI
GNEPOI(GNENet *net, const std::string &id, const std::string &type, const RGBColor &color, const Position &pos, bool geo, double layer, double angle, const std::string &imgFile, bool relativePath, double width, double height, bool movementBlocked)
Constructor.
Definition: GNEPOI.cpp:44
GNEViewNet::buildSelectionACPopupEntry
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:338
Position::set
void set(double x, double y)
set positions x and y
Definition: Position.h:86
GUITexturesHelper.h
GUIPointOfInterest::drawInnerPOI
void drawInnerPOI(const GUIVisualizationSettings &s, bool forceSelectionColor) const
draw inner POI (before pushName() )
Definition: GUIPointOfInterest.cpp:140
GNEShape::myNet
GNENet * myNet
the net to inform about updates
Definition: GNEShape.h:197
GNEViewNet.h
SUMO_ATTR_WIDTH
@ SUMO_ATTR_WIDTH
Definition: SUMOXMLDefinitions.h:386
PointOfInterest::setWidth
void setWidth(double width)
set the image width of the POI
Definition: PointOfInterest.h:109
GUIGlObject::getGlID
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.cpp:149
GNEViewNet::getDottedAC
const GNEAttributeCarrier * getDottedAC() const
get AttributeCarrier under cursor
Definition: GNEViewNet.cpp:1026
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
GNEHierarchicalParentElements::replaceParentLanes
void replaceParentLanes(GNEShape *elementChild, const std::string &newLaneIDs)
replace the parent edges of a shape
Definition: GNEHierarchicalParentElements.cpp:469
SUMO_ATTR_LAYER
@ SUMO_ATTR_LAYER
A layer number.
Definition: SUMOXMLDefinitions.h:712
GLHelper::drawShapeDottedContourAroundClosedShape
static void drawShapeDottedContourAroundClosedShape(const GUIVisualizationSettings &s, const int type, const PositionVector &shape)
draw a dotted contour around the given closed shape with certain width
Definition: GLHelper.cpp:496
GNE_ATTR_PARAMETERS
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
Definition: SUMOXMLDefinitions.h:989
GLHelper::drawShapeDottedContourRectangle
static void drawShapeDottedContourRectangle(const GUIVisualizationSettings &s, const int type, const Position &center, const double width, const double height, const double rotation=0, const double offsetX=0, const double offsetY=0)
draw a dotted contour around the given Position with certain width and height
Definition: GLHelper.cpp:560
GNE_SUPERMODE_NETWORK
@ GNE_SUPERMODE_NETWORK
Network mode (Edges, junctions, etc..)
Definition: GNEViewNetHelper.h:46
GNEShape::drawUsingSelectColor
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
Definition: GNEShape.cpp:144
GNEViewNetHelper::EditModes::currentSupermode
Supermode currentSupermode
the current supermode
Definition: GNEViewNetHelper.h:305
PointOfInterest::myHalfImgHeight
double myHalfImgHeight
The half height of the image when rendering this POI.
Definition: PointOfInterest.h:191
GeoConvHelper::cartesian2geo
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
Definition: GeoConvHelper.cpp:293
PointOfInterest::setHeight
void setHeight(double height)
set the image height of the POI
Definition: PointOfInterest.h:114
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GNEPOI::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNEPOI.cpp:142
Position::x
double x() const
Returns the x-position.
Definition: Position.h:56
GNEViewNet::getDemandViewOptions
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
Definition: GNEViewNet.cpp:458
SUMO_ATTR_GEOPOSITION
@ SUMO_ATTR_GEOPOSITION
Definition: SUMOXMLDefinitions.h:818
Shape::getShapeType
const std::string & getShapeType() const
Returns the (abstract) type of the Shape.
Definition: Shape.h:75
GUIGlObject
Definition: GUIGlObject.h:65
PointOfInterest::myLane
std::string myLane
ID of lane in which this POI is placed (main used by netedit)
Definition: PointOfInterest.h:179
Shape::getShapeRelativePath
bool getShapeRelativePath() const
Returns the relativePath of the Shape.
Definition: Shape.h:110
GNEViewNetHelper::DemandViewOptions::showShapes
bool showShapes() const
check if shapes has to be hide
Definition: GNEViewNetHelper.cpp:1779
SUMO_ATTR_RELATIVEPATH
@ SUMO_ATTR_RELATIVEPATH
Definition: SUMOXMLDefinitions.h:793
GNELane.h
GUIPointOfInterest::myPOIVertices
static std::vector< Position > myPOIVertices
after every iteration of drawgl, position of vertices that make the circle are saved here....
Definition: GUIPointOfInterest.h:125
GNEShape::myBlockMovement
bool myBlockMovement
flag to block movement
Definition: GNEShape.h:203
SUMO_ATTR_POSITION
@ SUMO_ATTR_POSITION
Definition: SUMOXMLDefinitions.h:660
GNEPOI::writeShape
void writeShape(OutputDevice &device)
writte shape element into a xml file
Definition: GNEPOI.cpp:87
GNENet::getViewNet
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2117
GUIGlObject::buildPopupHeader
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
Definition: GUIGlObject.cpp:207
PointOfInterest::myPosLat
double myPosLat
latereal position over lane in which this POI is placed (main used by netedit)
Definition: PointOfInterest.h:185
GUIPointOfInterest::getParameterWindow
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIPointOfInterest.cpp:72
ShapeContainer::getPOIs
const POIs & getPOIs() const
Returns all pois.
Definition: ShapeContainer.h:154
GNEPOI::getAttribute
std::string getAttribute(SumoXMLAttr key) const
method for getting the Attribute of an XML key
Definition: GNEPOI.cpp:257
Parameterised::setParametersStr
void setParametersStr(const std::string &paramsString)
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
Definition: Parameterised.cpp:139
GLIncludes.h
SUMO_ATTR_HEIGHT
@ SUMO_ATTR_HEIGHT
Definition: SUMOXMLDefinitions.h:789
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
GNEViewNet::getTestingMode
const GNEViewNetHelper::TestingMode & getTestingMode() const
get testing mode
Definition: GNEViewNet.cpp:440
GNENet::addGLObjectIntoGrid
void addGLObjectIntoGrid(GUIGlObject *o)
add GL Object into net
Definition: GNENet.cpp:1322
MID_GNE_POI_TRANSFORM
@ MID_GNE_POI_TRANSFORM
Transform POI to POILane, and viceversa.
Definition: GUIAppEnum.h:916
GUIMainWindow
Definition: GUIMainWindow.h:46
Position::y
double y() const
Returns the y-position.
Definition: Position.h:61
SUMOXMLDefinitions::isValidTypeID
static bool isValidTypeID(const std::string &value)
whether the given string is a valid id for an edge or vehicle type
Definition: SUMOXMLDefinitions.cpp:979
GNEPOI::getParentName
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEPOI.cpp:176
GUIGlObject::buildShapePopupOptions
void buildShapePopupOptions(GUIMainWindow &app, GUIGLObjectPopupMenu *ret, const std::string &type)
build basic shape popup options. Used to unify pop-ups menu in netedit and SUMO-GUI
Definition: GUIGlObject.cpp:302
Parameterised::areParametersValid
static bool areParametersValid(const std::string &value, bool report=false)
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
Definition: Parameterised.cpp:166
GUIGlID
unsigned int GUIGlID
Definition: GUIGlObject.h:42
InvalidArgument
Definition: UtilExceptions.h:56
GLHelper::drawBoxLine
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition: GLHelper.cpp:136
Shape::setShapeLayer
void setShapeLayer(const double layer)
Sets a new layer.
Definition: Shape.h:143
GNE_ATTR_BLOCK_MOVEMENT
@ GNE_ATTR_BLOCK_MOVEMENT
block movement of a graphic element
Definition: SUMOXMLDefinitions.h:981
GUIGlObject::buildShowParamsPopupEntry
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
Definition: GUIGlObject.cpp:248
SUMO_ATTR_POSITION_LAT
@ SUMO_ATTR_POSITION_LAT
Definition: SUMOXMLDefinitions.h:661
GUIGlObject::buildCenterPopupEntry
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
Definition: GUIGlObject.cpp:216
PointOfInterest::getWidth
double getWidth() const
Returns the image width of the POI.
Definition: PointOfInterest.h:89
GNENet::retrieveLane
GNELane * retrieveLane(const std::string &id, bool failHard=true, bool checkVolatileChange=false)
get lane by id
Definition: GNENet.cpp:1228
GUIPointOfInterest::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIPointOfInterest.cpp:83
GUITexturesHelper::clearTextures
static void clearTextures()
clears loaded textures
Definition: GUITexturesHelper.cpp:136
Position::add
void add(const Position &pos)
Adds the given position to this one.
Definition: Position.h:126
Boundary::isInitialised
bool isInitialised() const
check if Boundary is Initialised
Definition: Boundary.cpp:216
GNEViewNetHelper.h
GNE_ATTR_SELECTED
@ GNE_ATTR_SELECTED
element is selected
Definition: SUMOXMLDefinitions.h:971
StringTokenizer.h
GNEViewNet::getEditModes
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:434
Shape::setShapeNaviDegree
virtual void setShapeNaviDegree(const double angle)
Sets a new angle in navigational degrees.
Definition: Shape.h:150
GNEPOI.h
GNEAttributeCarrier::getTagStr
const std::string & getTagStr() const
get tag assigned to this object in string format
Definition: GNEAttributeCarrier.cpp:1267
GNEUndoList
Definition: GNEUndoList.h:48
Shape::DEFAULT_IMG_FILE
static const std::string DEFAULT_IMG_FILE
Definition: Shape.h:47
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
GNEPOI::myGEOPosition
Position myGEOPosition
Position of POI in GEO coordinates (Only used by POIs that aren't placed over lanes)
Definition: GNEPOI.h:197
GNEPOI::startGeometryMoving
void startGeometryMoving()
Definition: GNEPOI.cpp:77
Position::sety
void sety(double y)
set position y
Definition: Position.h:76
GNEPOI::getPositionInView
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEPOI.cpp:153
Named::myID
std::string myID
The name of the object.
Definition: Named.h:133
GNEUndoList::p_begin
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
Definition: GNEUndoList.cpp:72
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:372
GUITexturesHelper::getTextureID
static int getTextureID(const std::string &filename, const bool mirrorX=false)
return texture id for the given filename (initialize on first use)
Definition: GUITexturesHelper.cpp:112
GUIGlObject::getMicrosimID
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Definition: GUIGlObject.cpp:163
Position::setz
void setz(double z)
set position z
Definition: Position.h:81
GNEPOI::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEPOI.cpp:213
GNELane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
GNEPOI::getGlID
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GNEPOI.cpp:170
Shape::DEFAULT_LAYER_POI
static const double DEFAULT_LAYER_POI
Definition: Shape.h:45
SUMO_ATTR_GEO
@ SUMO_ATTR_GEO
Definition: SUMOXMLDefinitions.h:816
GNEShape::unselectAttributeCarrier
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNEShape.cpp:123
GNEChange_Attribute.h
GNENet.h
GUIVisualizationSizeSettings::getExaggeration
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
Definition: GUIVisualizationSettings.cpp:212
GNEPOI::generateChildID
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
Definition: GNEPOI.cpp:67
Shape::setShapeColor
void setShapeColor(const RGBColor &col)
Sets a new color.
Definition: Shape.h:129
GNEShape::isAttributeCarrierSelected
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
Definition: GNEShape.cpp:138
GNEUndoList.h
Position::Position
Position()
default constructor
Definition: Position.h:41