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 /****************************************************************************/
15 // A class for visualizing and editing POIS in netedit (adapted from
16 // GUIPointOfInterest and NLHandler)
17 /****************************************************************************/
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <string>
27 #include <utils/gui/div/GLHelper.h>
30 #include <netedit/GNENet.h>
31 #include <netedit/GNEUndoList.h>
32 #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 (getLaneParents().size() > 0) {
89  // obtain fixed position over lane
90  double fixedPositionOverLane = myPosOverLane > getLaneParents().at(0)->getGeometry().shape.length() ? getLaneParents().at(0)->getGeometry().shape.length() : myPosOverLane < 0 ? 0 : myPosOverLane;
91  // write POILane using POI::writeXML
92  writeXML(device, false, 0, getLaneParents().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 (getLaneParents().size() > 0) {
109  myPosOverLane = getLaneParents().at(0)->getGeometry().shape.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 (getLaneParents().size() > 0) {
127  // restore old position before commit new position
128  double originalPosOverLane = getLaneParents().at(0)->getGeometry().shape.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 (getLaneParents().size() > 0) {
144  // obtain fixed position over lane
145  double fixedPositionOverLane = myPosOverLane > getLaneParents().at(0)->getLaneShapeLength() ? getLaneParents().at(0)->getLaneShapeLength() : myPosOverLane < 0 ? 0 : myPosOverLane;
146  // set new position regarding to lane
147  set(getLaneParents().at(0)->getGeometry().shape.positionAtOffset(fixedPositionOverLane * getLaneParents().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 (getLaneParents().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() && OptionsCont::getOptions().getBool("gui-testing")) {
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 (getLaneParents().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_GENERIC:
300  return getGenericParametersStr();
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_GENERIC:
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::isValidNetID(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 (getLaneParents().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_GENERIC:
388  return isGenericParametersValid(value);
389  default:
390  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
391  }
392 }
393 
394 
395 std::string
397  std::string result;
398  // Generate an string using the following structure: "key1=value1|key2=value2|...
399  for (auto i : getParametersMap()) {
400  result += i.first + "=" + i.second + "|";
401  }
402  // remove the last "|"
403  if (!result.empty()) {
404  result.pop_back();
405  }
406  return result;
407 }
408 
409 
410 std::vector<std::pair<std::string, std::string> >
412  std::vector<std::pair<std::string, std::string> > result;
413  // iterate over parameters map and fill result
414  for (auto i : getParametersMap()) {
415  result.push_back(std::make_pair(i.first, i.second));
416  }
417  return result;
418 }
419 
420 
421 void
422 GNEPOI::setGenericParametersStr(const std::string& value) {
423  // clear parameters
424  clearParameter();
425  // separate value in a vector of string using | as separator
426  std::vector<std::string> parsedValues;
427  StringTokenizer stValues(value, "|", true);
428  while (stValues.hasNext()) {
429  parsedValues.push_back(stValues.next());
430  }
431  // check that parsed values (A=B)can be parsed in generic parameters
432  for (auto i : parsedValues) {
433  std::vector<std::string> parsedParameters;
434  StringTokenizer stParam(i, "=", true);
435  while (stParam.hasNext()) {
436  parsedParameters.push_back(stParam.next());
437  }
438  // Check that parsed parameters are exactly two and contains valid chracters
439  if (parsedParameters.size() == 2 && SUMOXMLDefinitions::isValidGenericParameterKey(parsedParameters.front()) && SUMOXMLDefinitions::isValidGenericParameterValue(parsedParameters.back())) {
440  setParameter(parsedParameters.front(), parsedParameters.back());
441  }
442  }
443 }
444 
445 // ===========================================================================
446 // private
447 // ===========================================================================
448 
449 void
450 GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value) {
451  switch (key) {
452  case SUMO_ATTR_ID: {
453  std::string oldID = myID;
454  myID = value;
455  myNet->changeShapeID(this, oldID);
456  setMicrosimID(value);
457  break;
458  }
459  case SUMO_ATTR_COLOR:
460  setShapeColor(parse<RGBColor>(value));
461  break;
462  case SUMO_ATTR_LANE:
463  myLane = value;
464  changeLaneParents(this, value);
465  break;
466  case SUMO_ATTR_POSITION: {
467  if (getLaneParents().size() > 0) {
468  myPosOverLane = parse<double>(value);
469  } else {
470  // first remove object from grid due position is used for boundary
472  // set position
473  set(parse<Position>(value));
474  // set GEO Position
475  myGEOPosition = *this;
477  // add object into grid again
478  myNet->addGLObjectIntoGrid(this);
479  }
480  break;
481  }
483  myPosLat = parse<double>(value);
484  break;
485  case SUMO_ATTR_GEOPOSITION: {
486  // first remove object from grid due position is used for boundary
488  // set new position
489  myGEOPosition = parse<Position>(value);
490  // set cartesian Position
493  // add object into grid again
494  myNet->addGLObjectIntoGrid(this);
495  break;
496  }
497  case SUMO_ATTR_GEO:
498  myGeo = parse<bool>(value);
499  break;
500  case SUMO_ATTR_TYPE:
501  setShapeType(value);
502  break;
503  case SUMO_ATTR_LAYER:
504  if (value == "default") {
506  } else {
507  setShapeLayer(parse<double>(value));
508  }
509  break;
510  case SUMO_ATTR_IMGFILE:
511  // first remove object from grid due img file affect to boundary
513  setShapeImgFile(value);
514  // all textures must be refresh
516  // add object into grid again
517  myNet->addGLObjectIntoGrid(this);
518  break;
520  setShapeRelativePath(parse<bool>(value));
521  break;
522  case SUMO_ATTR_WIDTH:
523  if (getLaneParents().size() > 0) {
524  // set new width
525  setWidth(parse<double>(value));
526  } else {
527  // first remove object from grid due position is used for boundary
529  // set new width
530  setWidth(parse<double>(value));
531  // add object into grid again
532  myNet->addGLObjectIntoGrid(this);
533  }
534  break;
535  case SUMO_ATTR_HEIGHT:
536  if (getLaneParents().size() > 0) {
537  // set new height
538  setHeight(parse<double>(value));
539  } else {
540  // first remove object from grid due position is used for boundary
542  // set new height
543  setHeight(parse<double>(value));
544  // add object into grid again
545  myNet->addGLObjectIntoGrid(this);
546  }
547  break;
548  case SUMO_ATTR_ANGLE:
549  setShapeNaviDegree(parse<double>(value));
550  break;
552  myBlockMovement = parse<bool>(value);
553  break;
554  case GNE_ATTR_SELECTED:
555  if (parse<bool>(value)) {
557  } else {
559  }
560  break;
561  case GNE_ATTR_GENERIC:
563  break;
564  default:
565  throw InvalidArgument(getTagStr() + " attribute '" + toString(key) + "' not allowed");
566  }
567 }
568 
569 
570 const GUIGlObject*
572  return this;
573 }
574 
575 /****************************************************************************/
GUIGlObject::getType
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.cpp:181
GNEShape::myMovingGeometryBoundary
Boundary myMovingGeometryBoundary
boundary used during moving of elements
Definition: GNEShape.h:208
Shape::setShapeType
void setShapeType(const std::string &type)
Sets a new type.
Definition: Shape.h:123
SUMO_ATTR_TYPE
Definition: SUMOXMLDefinitions.h:382
SUMO_ATTR_ANGLE
Definition: SUMOXMLDefinitions.h:791
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:63
SUMO_ATTR_IMGFILE
Definition: SUMOXMLDefinitions.h:789
GNEAttributeCarrier::getID
const std::string getID() const
function to support debugging
Definition: GNEAttributeCarrier.cpp:1187
GNENet::retrievePOI
GNEPOI * retrievePOI(const std::string &id, bool failHard=true) const
get POI by id
Definition: GNENet.cpp:1066
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:73
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:418
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
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:97
PointOfInterest::myGeo
bool myGeo
flag to check if POI was loaded as GEO Position (main used by netedit)
Definition: PointOfInterest.h:177
GNEShape::selectAttributeCarrier
void selectAttributeCarrier(bool changeFlag=true)
Definition: GNEShape.cpp:109
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:80
OptionsCont.h
GUIVisualizationSettings::drawBoundaries
bool drawBoundaries
enable or disable draw boundaries
Definition: GUIVisualizationSettings.h:629
GNENet::removeGLObjectFromGrid
void removeGLObjectFromGrid(GUIGlObject *o)
add GL Object into net
Definition: GNENet.cpp:1279
StringTokenizer::hasNext
bool hasNext()
returns the information whether further substrings exist
Definition: StringTokenizer.cpp:95
GNENet
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:78
GUIGLObjectPopupMenu.h
PointOfInterest::getHeight
double getHeight() const
Returns the image height of the POI.
Definition: PointOfInterest.h:95
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:124
SUMO_TAG_LANE
begin/end of the description of a single lane
Definition: SUMOXMLDefinitions.h:50
GNEAttributeCarrier::isGenericParametersValid
static bool isGenericParametersValid(const std::string &value)
check if given string can be parsed to a map/list of generic parameters
Definition: GNEAttributeCarrier.cpp:1354
GUIPointOfInterest::checkDraw
bool checkDraw(const GUIVisualizationSettings &s) const
check if POI can be drawn
Definition: GUIPointOfInterest.cpp:131
SUMO_ATTR_COLOR
A color information.
Definition: SUMOXMLDefinitions.h:701
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
OptionsCont::getOptions
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
SUMO_TAG_POI
begin/end of the description of a Point of interest
Definition: SUMOXMLDefinitions.h:54
StringTokenizer::next
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
Definition: StringTokenizer.cpp:100
Shape::setShapeImgFile
void setShapeImgFile(const std::string &imgFile)
Sets a new imgFile.
Definition: Shape.h:158
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:104
GNENet::changeShapeID
void changeShapeID(GNEShape *s, const std::string &OldID)
change Shape ID
Definition: GNENet.cpp:2572
SUMO_ATTR_ID
Definition: SUMOXMLDefinitions.h:379
GLHelper.h
SUMO_ATTR_LANE
Definition: SUMOXMLDefinitions.h:635
PointOfInterest::myPosOverLane
double myPosOverLane
position over lane in which this POI is placed (main used by netedit)
Definition: PointOfInterest.h:183
ICON_LANE
Definition: GUIIcons.h:254
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:48
GUIIconSubSys::getIcon
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
Definition: GUIIconSubSys.cpp:602
GLHelper::setColor
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:616
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:83
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:42
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:194
gPrecisionGeo
int gPrecisionGeo
Definition: StdDefs.cpp:28
Shape::setShapeRelativePath
void setShapeRelativePath(bool relativePath)
Sets a new relativePath value.
Definition: Shape.h:165
GLHelper::drawBoundary
static void drawBoundary(const Boundary &b)
Draw a boundary (used for debugging)
Definition: GLHelper.cpp:812
GNEAttributeCarrier::GNEChange_Attribute
friend class GNEChange_Attribute
declare friend class
Definition: GNEAttributeCarrier.h:57
GNEHierarchicalElementParents::getLaneParents
const std::vector< GNELane * > & getLaneParents() const
get lanes of VSS
Definition: GNEHierarchicalElementParents.cpp:182
GNEUndoList::p_add
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
Definition: GNEUndoList.cpp:132
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:40
GUIGlObject::setMicrosimID
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
Definition: GUIGlObject.cpp:174
Parameterised::getParametersMap
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
Definition: Parameterised.cpp:105
PointOfInterest::myHalfImgWidth
double myHalfImgWidth
The half width of the image when rendering this POI.
Definition: PointOfInterest.h:189
GNEPOI::~GNEPOI
~GNEPOI()
Destructor.
Definition: GNEPOI.cpp:63
GUIPointOfInterest
Definition: GUIPointOfInterest.h:46
NamedObjectCont::size
int size() const
Returns the number of stored items within the container.
Definition: NamedObjectCont.h:117
GUIVisualizationSettings::poiSize
GUIVisualizationSizeSettings poiSize
Definition: GUIVisualizationSettings.h:595
GNEShape
Definition: GNEShape.h:35
Shape::getShapeLayer
double getShapeLayer() const
Returns the layer of the Shape.
Definition: Shape.h:90
GeoConvHelper::getFinal
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
Definition: GeoConvHelper.h:106
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:226
SUMO_TAG_POILANE
begin/end of the description of a Point of interest over Lane (used by Netedit)
Definition: SUMOXMLDefinitions.h:56
GNEPOI::getGUIGlObject
const GUIGlObject * getGUIGlObject() const
get GUIGlObject associated to this GNEShape
Definition: GNEPOI.cpp:571
RGBColor::ORANGE
static const RGBColor ORANGE
Definition: RGBColor.h:196
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:331
Position::set
void set(double x, double y)
set positions x and y
Definition: Position.h:87
GUITexturesHelper.h
StringTokenizer
Definition: StringTokenizer.h:62
GUIPointOfInterest::drawInnerPOI
void drawInnerPOI(const GUIVisualizationSettings &s, bool forceSelectionColor) const
draw inner POI (before pushName() )
Definition: GUIPointOfInterest.cpp:141
GNEShape::myNet
GNENet * myNet
the net to inform about updates
Definition: GNEShape.h:205
GNEViewNet.h
SUMO_ATTR_WIDTH
Definition: SUMOXMLDefinitions.h:387
PointOfInterest::setWidth
void setWidth(double width)
set the image width of the POI
Definition: PointOfInterest.h:110
GUIGlObject::getGlID
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.cpp:150
GNEViewNet::getDottedAC
const GNEAttributeCarrier * getDottedAC() const
get AttributeCarrier under cursor
Definition: GNEViewNet.cpp:939
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
SUMO_ATTR_LAYER
A layer number.
Definition: SUMOXMLDefinitions.h:709
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
GNEPOI::setGenericParametersStr
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
Definition: GNEPOI.cpp:422
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:555
GNEShape::drawUsingSelectColor
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
Definition: GNEShape.cpp:145
PointOfInterest::myHalfImgHeight
double myHalfImgHeight
The half height of the image when rendering this POI.
Definition: PointOfInterest.h:192
GeoConvHelper::cartesian2geo
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
Definition: GeoConvHelper.cpp:294
PointOfInterest::setHeight
void setHeight(double height)
set the image height of the POI
Definition: PointOfInterest.h:115
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
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:57
SUMOXMLDefinitions::isValidGenericParameterKey
static bool isValidGenericParameterKey(const std::string &value)
whether the given string is a valid key for a generic parameter
Definition: SUMOXMLDefinitions.cpp:1034
GNEViewNet::getDemandViewOptions
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
Definition: GNEViewNet.cpp:417
SUMO_ATTR_GEOPOSITION
Definition: SUMOXMLDefinitions.h:815
Shape::getShapeType
const std::string & getShapeType() const
Returns the (abstract) type of the Shape.
Definition: Shape.h:76
GUIGlObject
Definition: GUIGlObject.h:66
PointOfInterest::myLane
std::string myLane
ID of lane in which this POI is placed (main used by netedit)
Definition: PointOfInterest.h:180
Shape::getShapeRelativePath
bool getShapeRelativePath() const
Returns the relativePath of the Shape.
Definition: Shape.h:111
GNEViewNetHelper::DemandViewOptions::showShapes
bool showShapes() const
check if shapes has to be hide
Definition: GNEViewNetHelper.cpp:1778
SUMO_ATTR_RELATIVEPATH
Definition: SUMOXMLDefinitions.h:790
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:126
SUMOXMLDefinitions::isValidGenericParameterValue
static bool isValidGenericParameterValue(const std::string &value)
whether the given string is a valid value for a generic parameter
Definition: SUMOXMLDefinitions.cpp:1041
GNEShape::myBlockMovement
bool myBlockMovement
flag to block movement
Definition: GNEShape.h:211
SUMO_ATTR_POSITION
Definition: SUMOXMLDefinitions.h:658
GNEPOI::writeShape
void writeShape(OutputDevice &device)
writte shape element into a xml file
Definition: GNEPOI.cpp:87
GNEPOI::getGenericParameters
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
Definition: GNEPOI.cpp:411
GNENet::getViewNet
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2067
GNEPOI::getGenericParametersStr
std::string getGenericParametersStr() const
return generic parameters in string format
Definition: GNEPOI.cpp:396
GUIGlObject::buildPopupHeader
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
Definition: GUIGlObject.cpp:208
PointOfInterest::myPosLat
double myPosLat
latereal position over lane in which this POI is placed (main used by netedit)
Definition: PointOfInterest.h:186
GUIPointOfInterest::getParameterWindow
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIPointOfInterest.cpp:73
ShapeContainer::getPOIs
const POIs & getPOIs() const
Returns all pois.
Definition: ShapeContainer.h:155
GNEPOI::getAttribute
std::string getAttribute(SumoXMLAttr key) const
method for getting the Attribute of an XML key
Definition: GNEPOI.cpp:257
GLIncludes.h
SUMO_ATTR_HEIGHT
Definition: SUMOXMLDefinitions.h:786
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
GNE_ATTR_GENERIC
generic attribute
Definition: SUMOXMLDefinitions.h:986
GNENet::addGLObjectIntoGrid
void addGLObjectIntoGrid(GUIGlObject *o)
add GL Object into net
Definition: GNENet.cpp:1273
MID_GNE_POI_TRANSFORM
Transform POI to POILane, and viceversa.
Definition: GUIAppEnum.h:891
GUIMainWindow
Definition: GUIMainWindow.h:47
Position::y
double y() const
Returns the y-position.
Definition: Position.h:62
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:303
GUIGlID
unsigned int GUIGlID
Definition: GUIGlObject.h:43
InvalidArgument
Definition: UtilExceptions.h:57
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
SUMOXMLDefinitions::isValidNetID
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element
Definition: SUMOXMLDefinitions.cpp:964
Shape::setShapeLayer
void setShapeLayer(const double layer)
Sets a new layer.
Definition: Shape.h:144
GNE_ATTR_BLOCK_MOVEMENT
block movement of a graphic element
Definition: SUMOXMLDefinitions.h:978
GUIGlObject::buildShowParamsPopupEntry
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
Definition: GUIGlObject.cpp:249
SUMO_ATTR_POSITION_LAT
Definition: SUMOXMLDefinitions.h:659
GUIGlObject::buildCenterPopupEntry
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
Definition: GUIGlObject.cpp:217
GNEHierarchicalElementParents::changeLaneParents
void changeLaneParents(GNEShape *elementChild, const std::string &newLaneIDs)
change edge parents of a shape
Definition: GNEHierarchicalElementParents.cpp:460
Parameterised::setParameter
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
Definition: Parameterised.cpp:45
PointOfInterest::getWidth
double getWidth() const
Returns the image width of the POI.
Definition: PointOfInterest.h:90
GNENet::retrieveLane
GNELane * retrieveLane(const std::string &id, bool failHard=true, bool checkVolatileChange=false)
get lane by id
Definition: GNENet.cpp:1179
Parameterised::clearParameter
void clearParameter()
Clears the parameter map.
Definition: Parameterised.cpp:99
GUIPointOfInterest::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIPointOfInterest.cpp:84
GUITexturesHelper::clearTextures
static void clearTextures()
clears loaded textures
Definition: GUITexturesHelper.cpp:137
Shape::setShapeNaviDegree
void setShapeNaviDegree(const double angle)
Sets a new angle in navigational degrees.
Definition: Shape.h:151
Position::add
void add(const Position &pos)
Adds the given position to this one.
Definition: Position.h:127
Boundary::isInitialised
bool isInitialised() const
check if Boundary is Initialised
Definition: Boundary.cpp:217
GNE_ATTR_SELECTED
element is selected
Definition: SUMOXMLDefinitions.h:968
StringTokenizer.h
GNEPOI.h
GNEAttributeCarrier::getTagStr
const std::string & getTagStr() const
get tag assigned to this object in string format
Definition: GNEAttributeCarrier.cpp:1165
GNEUndoList
Definition: GNEUndoList.h:49
Shape::DEFAULT_IMG_FILE
static const std::string DEFAULT_IMG_FILE
Definition: Shape.h:48
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:346
GNEPOI::myGEOPosition
Position myGEOPosition
Position of POI in GEO coordinates (Only used by POIs that aren't placed over lanes)
Definition: GNEPOI.h:207
GNEPOI::startGeometryMoving
void startGeometryMoving()
Definition: GNEPOI.cpp:77
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:134
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:73
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:373
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:113
GUIGlObject::getMicrosimID
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Definition: GUIGlObject.cpp:164
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:46
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:46
SUMO_ATTR_GEO
Definition: SUMOXMLDefinitions.h:813
GNEShape::unselectAttributeCarrier
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNEShape.cpp:124
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:130
GNEShape::isAttributeCarrierSelected
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
Definition: GNEShape.cpp:139
GNEUndoList.h
Position::Position
Position()
default constructor
Definition: Position.h:42