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-2022 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // A class for visualizing and editing POIS in netedit (adapted from
19 // GUIPointOfInterest and NLHandler)
20 /****************************************************************************/
21 #include <string>
22 #include <netedit/GNENet.h>
23 #include <netedit/GNEUndoList.h>
24 #include <netedit/GNEViewNet.h>
25 #include <netedit/GNEViewParent.h>
28 #include <utils/gui/div/GLHelper.h>
35 
36 #include "GNEPOI.h"
37 
38 
39 // ===========================================================================
40 // method definitions
41 // ===========================================================================
42 
44  PointOfInterest("", "", RGBColor::BLACK, Position(0, 0), false, "", 0, false, 0, 0, 0, "", false, 0, 0, "", std::map<std::string, std::string>()),
45  GNEShape("", net, GLO_POI, tag, {}, {}, {}, {}, {}, {}, {}, {}) {
46  // reset default values
47  resetDefaultValues();
48 }
49 
50 
51 GNEPOI::GNEPOI(GNENet* net, const std::string& id, const std::string& type, const RGBColor& color, const double xLon,
52  const double yLat, const bool geo, const double layer, const double angle, const std::string& imgFile,
53  const bool relativePath, const double width, const double height, const std::string& name,
54  const std::map<std::string, std::string>& parameters) :
55  PointOfInterest(id, type, color, Position(xLon, yLat), geo, "", 0, false, 0, layer, angle, imgFile, relativePath, width, height, name, parameters),
56  GNEShape(id, net, GLO_POI, geo ? GNE_TAG_POIGEO : SUMO_TAG_POI, {}, {}, {}, {}, {}, {}, {}, {}) {
57  // update position depending of GEO
58  if (geo) {
59  Position cartesian(x(), y());
61  set(cartesian.x(), cartesian.y());
62  }
63  // update centering boundary without updating grid
64  updateCenteringBoundary(false);
65 }
66 
67 
68 GNEPOI::GNEPOI(GNENet* net, const std::string& id, const std::string& type, const RGBColor& color, GNELane* lane, const double posOverLane,
69  const bool friendlyPos, const double posLat, const double layer, const double angle, const std::string& imgFile, const bool relativePath, const double width,
70  const double height, const std::string& name, const std::map<std::string, std::string>& parameters) :
71  PointOfInterest(id, type, color, Position(), false, lane->getID(), posOverLane, friendlyPos, posLat, layer, angle, imgFile, relativePath, width, height, name, parameters),
73 {}, {}, {lane}, {}, {}, {}, {}, {}
74  ) {
75  // update geometry (needed for POILanes)
76  updateGeometry();
77  // update centering boundary without updating grid
78  updateCenteringBoundary(false);
79 }
80 
81 
83 
84 
90  // get snap radius
92  // get mouse position
93  const Position mousePosition = myNet->getViewNet()->getPositionInformation();
94  // check if we're editing width or height
95  if ((myShapeWidth.size() == 0) || (myShapeHeight.size() == 0)) {
96  return nullptr;
97  } else if (myShapeHeight.front().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
98  // edit height
100  } else if (myShapeHeight.back().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
101  // edit height
103  } else if (myShapeWidth.front().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
104  // edit width
106  } else if (myShapeWidth.back().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
107  // edit width
109  } else {
110  return nullptr;
111  }
112  } else if (getTagProperty().getTag() == GNE_TAG_POILANE) {
113  // return move operation for POI placed over lane
114  return new GNEMoveOperation(this, getParentLanes().front(), myPosOverLane,
116  } else {
117  // return move operation for a position in view
118  return new GNEMoveOperation(this, *this);
119  }
120 }
121 
122 
123 void
124 GNEPOI::removeGeometryPoint(const Position /*clickedPosition*/, GNEUndoList* /*undoList*/) {
125  // nothing to remove
126 }
127 
128 
129 std::string
131  return "";
132 }
133 
134 
135 void
136 GNEPOI::setParameter(const std::string& key, const std::string& value) {
137  Parameterised::setParameter(key, value);
138 }
139 
140 
144  POIBaseObject->setTag(SUMO_TAG_POI);
145  // fill attributes
146  POIBaseObject->addStringAttribute(SUMO_ATTR_ID, myID);
151  POIBaseObject->addDoubleAttribute(SUMO_ATTR_WIDTH, getWidth());
152  POIBaseObject->addDoubleAttribute(SUMO_ATTR_HEIGHT, getHeight());
156  return POIBaseObject;
157 }
158 
159 
160 void
162  if (getParentLanes().size() > 0) {
163  // obtain fixed position over lane
164  double fixedPositionOverLane = myPosOverLane > getParentLanes().at(0)->getLaneShape().length() ? getParentLanes().at(0)->getLaneShape().length() : myPosOverLane < 0 ? 0 : myPosOverLane;
165  // write POILane using POI::writeXML
166  writeXML(device, false, 0, getParentLanes().at(0)->getID(), fixedPositionOverLane, myFriendlyPos, myPosLat);
167  } else {
168  writeXML(device, myGeo);
169  }
170 }
171 
172 
173 void
175  // set position
176  if (getParentLanes().size() > 0) {
177  // obtain fixed position over lane
178  double fixedPositionOverLane = myPosOverLane > getParentLanes().at(0)->getLaneShapeLength() ? getParentLanes().at(0)->getLaneShapeLength() : myPosOverLane < 0 ? 0 : myPosOverLane;
179  // set new position regarding to lane
180  set(getParentLanes().at(0)->getLaneShape().positionAtOffset(fixedPositionOverLane * getParentLanes().at(0)->getLengthGeometryFactor(), -myPosLat));
181  }
182  // check if update width and height shapes
183  if ((getWidth() > 0) && (getHeight() > 0)) {
184  // calculate shape lenght
185  myShapeHeight.clear();
186  myShapeHeight.push_back(Position(0, getHeight() * -0.5));
187  myShapeHeight.push_back(Position(0, getHeight() * 0.5));
188  // move
189  myShapeHeight.add(*this);
190  // calculate shape width
191  PositionVector leftShape = myShapeHeight;
192  leftShape.move2side(getWidth() * -0.5);
193  PositionVector rightShape = myShapeHeight;
194  rightShape.move2side(getWidth() * 0.5);
195  myShapeWidth = {leftShape.getCentroid(), rightShape.getCentroid()};
196  }
197 }
198 
199 
200 Position
202  return *this;
203 }
204 
205 
206 double
208  return s.poiSize.getExaggeration(s, this);
209 }
210 
211 
212 void
213 GNEPOI::updateCenteringBoundary(const bool updateGrid) {
214  // Remove object from net
215  if (updateGrid) {
217  }
218  // reset boundary
219  myBoundary.reset();
220  // add position (this POI)
221  myBoundary.add(*this);
222  // grow boundary
223  myBoundary.grow(10 + std::max(getWidth() * 0.5, getHeight() * 0.5));
224  // add object into net
225  if (updateGrid) {
226  myNet->addGLObjectIntoGrid(this);
227  }
228 }
229 
230 
231 GUIGlID
233  return GUIGlObject::getGlID();
234 }
235 
236 
237 std::string
239  if (getParentLanes().size() > 0) {
240  return getParentLanes().front()->getID();
241  } else {
242  return myNet->getMicrosimID();
243  }
244 }
245 
246 
249  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
250  buildPopupHeader(ret, app);
253  // build selection and show parameters menu
256  // continue depending of lane number
257  if (getParentLanes().size() > 0) {
258  // add option for convert to GNEPOI
260  return ret;
261  } else {
262  // add option for convert to GNEPOI
264  }
265  return ret;
266 }
267 
268 
271  GUIParameterTableWindow* ret = new GUIParameterTableWindow(app, *this);
272  // add items
273  ret->mkItem("type", false, getShapeType());
274  ret->mkItem("layer", false, getShapeLayer());
275  ret->closeBuilding(this);
276  return ret;
277 }
278 
279 
280 void
282  // first check if POI can be drawn
284  // check if boundary has to be drawn
285  if (s.drawBoundaries) {
287  }
288  // check if POI can be drawn
289  if (GUIPointOfInterest::checkDraw(s, this)) {
290  // obtain POIExaggeration
291  const double POIExaggeration = getExaggeration(s);
292  // push name (needed for getGUIGlObjectsUnderCursor(...)
294  // draw inner polygon
295  if (myNet->getViewNet()->getFrontAttributeCarrier() == this) {
298  } else {
301  }
302  // draw an orange square mode if there is an image(see #4036)
303  if (!getShapeImgFile().empty() && myNet->getViewNet()->getTestingMode().isTestingEnabled()) {
304  // Add a draw matrix for drawing logo
306  glTranslated(x(), y(), getType() + 0.01);
308  GLHelper::drawBoxLine(Position(0, 1), 0, 2, 1);
310  }
311  // draw geometry points
316  // pop name
318  // draw lock icon
320  // check if dotted contour has to be drawn
322  if (getShapeImgFile().empty()) {
324  } else {
326  }
327  }
328  // check if front dotted contour has to be drawn
329  if ((myNet->getViewNet()->getFrontAttributeCarrier() == this)) {
330  if (getShapeImgFile().empty()) {
332  } else {
334  }
335  }
336  }
337  }
338 }
339 
340 
341 std::string
343  switch (key) {
344  case SUMO_ATTR_ID:
345  return myID;
346  case SUMO_ATTR_COLOR:
347  return toString(getShapeColor());
348  case SUMO_ATTR_LANE:
349  return myLane;
350  case SUMO_ATTR_POSITION:
351  if (getParentLanes().size() > 0) {
352  return toString(myPosOverLane);
353  } else {
354  return toString(*this);
355  }
357  return toString(getFriendlyPos());
359  return toString(myPosLat);
360  case SUMO_ATTR_LON: {
361  // calculate geo position
362  Position GEOPosition(x(), y());
363  GeoConvHelper::getFinal().cartesian2geo(GEOPosition);
364  // return lon
365  return toString(GEOPosition.x());
366  }
367  case SUMO_ATTR_LAT: {
368  // calculate geo position
369  Position GEOPosition(x(), y());
370  GeoConvHelper::getFinal().cartesian2geo(GEOPosition);
371  // return lat
372  return toString(GEOPosition.y());
373  }
374  case SUMO_ATTR_TYPE:
375  return getShapeType();
376  case SUMO_ATTR_LAYER:
378  return "default";
379  } else {
380  return toString(getShapeLayer());
381  }
382  case SUMO_ATTR_IMGFILE:
383  return getShapeImgFile();
385  return toString(getShapeRelativePath());
386  case SUMO_ATTR_WIDTH:
387  return toString(getWidth());
388  case SUMO_ATTR_HEIGHT:
389  return toString(getHeight());
390  case SUMO_ATTR_ANGLE:
391  return toString(getShapeNaviDegree());
392  case SUMO_ATTR_NAME:
393  return getShapeName();
394  case GNE_ATTR_SELECTED:
396  case GNE_ATTR_PARAMETERS:
397  return getParametersStr();
399  return "";
400  default:
401  throw InvalidArgument(getTagStr() + " attribute '" + toString(key) + "' not allowed");
402  }
403 }
404 
405 
406 void
407 GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
408  switch (key) {
409  case SUMO_ATTR_ID:
410  case SUMO_ATTR_COLOR:
411  case SUMO_ATTR_LANE:
412  case SUMO_ATTR_POSITION:
415  case SUMO_ATTR_LON:
416  case SUMO_ATTR_LAT:
417  case SUMO_ATTR_TYPE:
418  case SUMO_ATTR_LAYER:
419  case SUMO_ATTR_IMGFILE:
421  case SUMO_ATTR_WIDTH:
422  case SUMO_ATTR_HEIGHT:
423  case SUMO_ATTR_ANGLE:
424  case SUMO_ATTR_NAME:
425  case GNE_ATTR_SELECTED:
426  case GNE_ATTR_PARAMETERS:
428  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
429  break;
430  default:
431  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
432  }
433 }
434 
435 
436 bool
437 GNEPOI::isValid(SumoXMLAttr key, const std::string& value) {
438  switch (key) {
439  case SUMO_ATTR_ID:
441  if (myTagProperty.getTag() == SUMO_TAG_POI) {
442  // POI
443  return (myNet->getAttributeCarriers()->retrieveShape(GNE_TAG_POILANE, value, false) == nullptr) &&
444  (myNet->getAttributeCarriers()->retrieveShape(GNE_TAG_POIGEO, value, false) == nullptr);
445  } else if (myTagProperty.getTag() == GNE_TAG_POILANE) {
446  // POILane
447  return (myNet->getAttributeCarriers()->retrieveShape(SUMO_TAG_POI, value, false) == nullptr) &&
448  (myNet->getAttributeCarriers()->retrieveShape(GNE_TAG_POIGEO, value, false) == nullptr);
449  } else if (myTagProperty.getTag() == GNE_TAG_POIGEO) {
450  // POI Geo
451  return (myNet->getAttributeCarriers()->retrieveShape(SUMO_TAG_POI, value, false) == nullptr) &&
452  (myNet->getAttributeCarriers()->retrieveShape(GNE_TAG_POILANE, value, false) == nullptr);
453  } else {
454  // invalid POI tag
455  return false;
456  }
457  } else {
458  // invalid id
459  return false;
460  }
461  case SUMO_ATTR_COLOR:
462  return canParse<RGBColor>(value);
463  case SUMO_ATTR_LANE:
464  return (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr);
465  case SUMO_ATTR_POSITION:
466  if (getParentLanes().size() > 0) {
467  return canParse<double>(value);
468  } else {
469  return canParse<Position>(value);
470  }
472  return canParse<bool>(value);
474  return canParse<double>(value);
475  case SUMO_ATTR_LON:
476  return canParse<double>(value);
477  case SUMO_ATTR_LAT:
478  return canParse<double>(value);
479  case SUMO_ATTR_TYPE:
480  return true;
481  case SUMO_ATTR_LAYER:
482  if (value == "default") {
483  return true;
484  } else {
485  return canParse<double>(value);
486  }
487  case SUMO_ATTR_IMGFILE:
488  if (value == "") {
489  return true;
490  } else {
491  // check that image can be loaded
492  return GUITexturesHelper::getTextureID(value) != -1;
493  }
495  return canParse<bool>(value);
496  case SUMO_ATTR_WIDTH:
497  return canParse<double>(value) && (parse<double>(value) > 0);
498  case SUMO_ATTR_HEIGHT:
499  return canParse<double>(value) && (parse<double>(value) > 0);
500  case SUMO_ATTR_ANGLE:
501  return canParse<double>(value);
502  case SUMO_ATTR_NAME:
504  case GNE_ATTR_SELECTED:
505  return canParse<bool>(value);
506  case GNE_ATTR_PARAMETERS:
507  return Parameterised::areParametersValid(value);
508  default:
509  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
510  }
511 }
512 
513 
514 bool
516  // check if we're in supermode Network
518  return true;
519  } else {
520  return false;
521  }
522 }
523 
524 
525 const std::map<std::string, std::string>&
527  return getParametersMap();
528 }
529 
530 // ===========================================================================
531 // private
532 // ===========================================================================
533 
534 void
535 GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value) {
536  switch (key) {
537  case SUMO_ATTR_ID: {
538  // update microsimID
539  setMicrosimID(value);
540  // set named ID
541  myID = value;
542  break;
543  }
544  case SUMO_ATTR_COLOR:
545  setShapeColor(parse<RGBColor>(value));
546  break;
547  case SUMO_ATTR_LANE:
548  myLane = value;
550  break;
551  case SUMO_ATTR_POSITION: {
552  if (getParentLanes().size() > 0) {
553  if (canParse<double>(value)) {
554  myPosOverLane = parse<double>(value);
555  }
556  } else {
557  // set position
558  set(parse<Position>(value));
559  }
560  // update centering boundary
562  // update geometry
563  updateGeometry();
564  break;
565  }
567  setFriendlyPos(parse<bool>(value));
568  break;
570  myPosLat = parse<double>(value);
571  // update centering boundary
573  // update geometry
574  updateGeometry();
575  break;
576  case SUMO_ATTR_LON: {
577  // calculate cartesian
578  Position cartesian(parse<double>(value), parse<double>(getAttribute(SUMO_ATTR_LAT)));
580  // set cartesian
581  set(cartesian);
582  // update centering boundary
584  // update geometry
585  updateGeometry();
586  break;
587  }
588  case SUMO_ATTR_LAT: {
589  // calculate cartesian
590  Position cartesian(parse<double>(getAttribute(SUMO_ATTR_LON)), parse<double>(value));
592  // set cartesian
593  set(cartesian);
594  // update centering boundary
596  // update geometry
597  updateGeometry();
598  break;
599  }
600  case SUMO_ATTR_TYPE:
601  setShapeType(value);
602  break;
603  case SUMO_ATTR_LAYER:
604  if (value == "default") {
606  } else {
607  setShapeLayer(parse<double>(value));
608  }
609  break;
610  case SUMO_ATTR_IMGFILE:
611  // first remove object from grid due img file affect to boundary
612  if (getID().size() > 0) {
614  }
615  setShapeImgFile(value);
616  // all textures must be refresh
618  // add object into grid again
619  if (getID().size() > 0) {
620  myNet->addGLObjectIntoGrid(this);
621  }
622  break;
624  setShapeRelativePath(parse<bool>(value));
625  break;
626  case SUMO_ATTR_WIDTH:
627  // set new width
628  setWidth(parse<double>(value));
629  // update centering boundary and geometry (except for templates)
630  if (getID().size() > 0) {
632  updateGeometry();
633  }
634  break;
635  case SUMO_ATTR_HEIGHT:
636  // set new height
637  setHeight(parse<double>(value));
638  // update centering boundary and geometry (except for templates)
639  if (getID().size() > 0) {
641  updateGeometry();
642  }
643  break;
644  case SUMO_ATTR_ANGLE:
645  setShapeNaviDegree(parse<double>(value));
646  break;
647  case SUMO_ATTR_NAME:
648  setShapeName(value);
649  break;
650  case GNE_ATTR_SELECTED:
651  if (parse<bool>(value)) {
653  } else {
655  }
656  break;
657  case GNE_ATTR_PARAMETERS:
658  setParametersStr(value);
659  break;
661  shiftLaneIndex();
662  break;
663  default:
664  throw InvalidArgument(getTagStr() + " attribute '" + toString(key) + "' not allowed");
665  }
666 }
667 
668 
669 void
671  // check what are being updated
673  myShapeHeight = moveResult.shapeToUpdate;
674  } else if (moveResult.operationType == GNEMoveOperation::OperationType::WIDTH) {
675  myShapeWidth = moveResult.shapeToUpdate;
676  } else {
677  if (getTagProperty().getTag() == GNE_TAG_POILANE) {
678  myPosOverLane = moveResult.newFirstPos;
679  } else {
680  set(moveResult.shapeToUpdate.front());
681  }
682  // update geometry
683  updateGeometry();
684  }
685 }
686 
687 
688 void
689 GNEPOI::commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList) {
690  // check what are being updated
692  undoList->begin(myTagProperty.getGUIIcon(), "height of " + getTagStr());
693  setAttribute(SUMO_ATTR_HEIGHT, toString(moveResult.shapeToUpdate.length2D()), undoList);
694  undoList->end();
695  } else if (moveResult.operationType == GNEMoveOperation::OperationType::WIDTH) {
696  undoList->begin(myTagProperty.getGUIIcon(), "width of " + getTagStr());
697  setAttribute(SUMO_ATTR_WIDTH, toString(moveResult.shapeToUpdate.length2D()), undoList);
698  undoList->end();
699  } else {
700  undoList->begin(GUIIcon::POI, "position of " + getTagStr());
701  if (getTagProperty().getTag() == GNE_TAG_POILANE) {
703  } else {
704  undoList->changeAttribute(new GNEChange_Attribute(this, SUMO_ATTR_POSITION, toString(moveResult.shapeToUpdate.front())));
705  }
706  undoList->end();
707  }
708 }
709 
710 /****************************************************************************/
@ NETWORK_MOVE
mode for moving network elements
@ MID_GNE_POI_TRANSFORM
Transform POI to POILane, and viceversa.
Definition: GUIAppEnum.h:1130
unsigned int GUIGlID
Definition: GUIGlObject.h:40
@ GLO_DOTTEDCONTOUR_FRONT
dotted contour front element (used in NETEDIT)
@ GLO_POI
a poi
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_POI
begin/end of the description of a Point of interest
@ GNE_TAG_POIGEO
Point of interest over view with GEO attributes.
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ GNE_TAG_POILANE
Point of interest over Lane.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_LANE
@ SUMO_ATTR_LON
@ GNE_ATTR_SELECTED
element is selected
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_POSITION_LAT
@ SUMO_ATTR_NAME
@ SUMO_ATTR_LAYER
A layer number.
@ SUMO_ATTR_ANGLE
@ SUMO_ATTR_HEIGHT
@ SUMO_ATTR_FRIENDLY_POS
@ SUMO_ATTR_LAT
@ SUMO_ATTR_TYPE
@ SUMO_ATTR_COLOR
A color information.
@ SUMO_ATTR_ID
@ SUMO_ATTR_IMGFILE
@ SUMO_ATTR_WIDTH
@ SUMO_ATTR_POSITION
@ GNE_ATTR_SHIFTLANEINDEX
shift lane index (only used by elements over lanes)
@ SUMO_ATTR_RELATIVEPATH
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:77
void reset()
Resets the boundary.
Definition: Boundary.cpp:65
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:299
void setTag(const SumoXMLTag tag)
set SumoBaseObject tag
void addBoolAttribute(const SumoXMLAttr attr, const bool value)
add bool attribute into current SumoBaseObject node
void addDoubleAttribute(const SumoXMLAttr attr, const double value)
add double attribute into current SumoBaseObject node
void addStringAttribute(const SumoXMLAttr attr, const std::string &value)
void addColorAttribute(const SumoXMLAttr attr, const RGBColor &value)
add color attribute into current SumoBaseObject node
static void drawBoundary(const Boundary &b)
Draw a boundary (used for debugging)
Definition: GLHelper.cpp:801
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:507
static void pushName(unsigned int name)
push Name
Definition: GLHelper.cpp:132
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:123
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition: GLHelper.cpp:231
static void popName()
pop Name
Definition: GLHelper.cpp:141
static void pushMatrix()
push matrix
Definition: GLHelper.cpp:114
static void drawRightGeometryPoint(const GNEViewNet *viewNet, const Position &pos, const double rot, const RGBColor &baseColor)
draw right geometry point
static void drawDownGeometryPoint(const GNEViewNet *viewNet, const Position &pos, const double rot, const RGBColor &baseColor)
draw down geometry point
static void drawUpGeometryPoint(const GNEViewNet *viewNet, const Position &pos, const double rot, const RGBColor &baseColor)
draw up geometry point
static void drawLeftGeometryPoint(const GNEViewNet *viewNet, const Position &pos, const double rot, const RGBColor &baseColor)
draw left geometry point
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
friend class GNEChange_Attribute
declare friend class
const std::string & getTagStr() const
get tag assigned to this object in string format
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
GNENet * myNet
pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
const GNETagProperties & myTagProperty
reference to tagProperty associated with this attribute carrier
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
bool getAllowChangeLane() const
allow change lane
CommonModeOptions * getCommonModeOptions() const
get common mode options
move operation
move result
double newFirstPos
new first position
const GNEMoveOperation::OperationType operationType
move operation
PositionVector shapeToUpdate
shape to update (edited in moveElement)
GNELane * retrieveLane(const std::string &id, bool hardFail=true, bool checkVolatileChange=false) const
get lane by id
GNEShape * retrieveShape(SumoXMLTag, const std::string &id, bool hardFail=true) const
Returns the named shape.
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
void addGLObjectIntoGrid(GNEAttributeCarrier *AC)
add GL Object into net
Definition: GNENet.cpp:1210
void removeGLObjectFromGrid(GNEAttributeCarrier *AC)
add GL Object into net
Definition: GNENet.cpp:1222
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition: GNENet.cpp:125
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1964
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
Definition: GNEPOI.cpp:526
PositionVector myShapeWidth
shape width of POI
Definition: GNEPOI.h:207
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEPOI.cpp:248
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GNEPOI.cpp:232
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNEPOI.cpp:689
~GNEPOI()
Destructor.
Definition: GNEPOI.cpp:82
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEPOI.cpp:238
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEPOI.cpp:515
Position getPositionInView() const
Returns position of shape in view.
Definition: GNEPOI.cpp:201
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNEPOI.cpp:670
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GNEPOI.cpp:270
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
Definition: GNEPOI.cpp:213
void writeShape(OutputDevice &device)
writte shape element into a xml file
Definition: GNEPOI.cpp:161
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
Definition: GNEPOI.cpp:130
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
Definition: GNEPOI.cpp:124
PositionVector myShapeHeight
shape height of POI
Definition: GNEPOI.h:210
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEPOI.cpp:281
const std::string & getID() const
needed to avoid diamond problem between PointOfInterest and GNEShape
Definition: GNEShape.cpp:53
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their correspond attribute are valids
Definition: GNEPOI.cpp:437
GNEPOI(SumoXMLTag tag, GNENet *net)
Constructor.
Definition: GNEPOI.cpp:43
void updateGeometry()
update pre-computed geometry information
Definition: GNEPOI.cpp:174
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration asociated with this GLObject
Definition: GNEPOI.cpp:207
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNEPOI.cpp:86
std::string getAttribute(SumoXMLAttr key) const
method for getting the Attribute of an XML key
Definition: GNEPOI.cpp:342
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
Definition: GNEPOI.cpp:136
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:407
CommonXMLStructure::SumoBaseObject * getSumoBaseObject() const
get SUMOBaseObject with all POIattributes
Definition: GNEPOI.cpp:142
Boundary myBoundary
object boundary
Definition: GNEShape.h:207
void shiftLaneIndex()
shift lane index
Definition: GNEShape.cpp:107
void replaceShapeParentLanes(const std::string &value)
replace shape parent lanes
Definition: GNEShape.cpp:101
GUIIcon getGUIIcon() const
get GUI icon associated to this Tag
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
void changeAttribute(GNEChange_Attribute *change)
special method for change attributes, avoid empty changes, always execute
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
Definition: GNEViewNet.cpp:537
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:513
const GNEViewNetHelper::MouseButtonKeyPressed & getMouseButtonKeyPressed() const
get Key Pressed modul
Definition: GNEViewNet.cpp:543
GNEViewParent * getViewParent() const
get the net object
const GNEViewNetHelper::TestingMode & getTestingMode() const
get testing mode
Definition: GNEViewNet.cpp:519
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:432
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
Definition: GNEViewNet.cpp:531
GNEMoveFrame * getMoveFrame() const
get frame for move elements
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
Definition: GUIDesigns.cpp:42
static void drawDottedSquaredShape(const DottedContourType type, const GUIVisualizationSettings &s, const Position &pos, const double width, const double height, const double offsetX, const double offsetY, const double rot, const double exaggeration)
draw dotted squared contour (used by additionals and demand elements)
static void drawDottedContourCircle(const DottedContourType type, const GUIVisualizationSettings &s, const Position &pos, const double radius, const double exaggeration)
draw dotted contour for the given Position and radius (used by Juctions and POIs)
The popup menu of a globject.
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
GUIGlID getGlID() const
Returns the numerical id of the object.
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
A window containing a gl-object's parameter.
void mkItem(const char *name, bool dynamic, ValueSource< T > *src)
Adds a row which obtains its value from a ValueSource.
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
static bool checkDraw(const GUIVisualizationSettings &s, const GUIGlObject *o)
check if POI can be drawn
static void drawInnerPOI(const GUIVisualizationSettings &s, const PointOfInterest *POI, const GUIGlObject *o, const bool disableSelectionColor, const double layer, const double width, const double height)
draw inner POI (before pushName() )
GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
static int getTextureID(const std::string &filename, const bool mirrorX=false)
return texture id for the given filename (initialize on first use)
static void clearTextures()
clears loaded textures
Stores the information about how to visualize structures.
bool drawBoundaries
enable or disable draw boundaries
GUIVisualizationSizeSettings poiSize
GUIVisualizationNeteditSizeSettings neteditSizeSettings
netedit size settings
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
bool x2cartesian_const(Position &from) const
Converts the given coordinate into a cartesian using the previous initialisation.
std::string myID
The name of the object.
Definition: Named.h:125
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
static bool areParametersValid(const std::string &value, bool report=false, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
void setParametersStr(const std::string &paramsString, const std::string kvsep="=", const std::string sep="|")
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
virtual void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
std::string getParametersStr(const std::string kvsep="=", const std::string sep="|") const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
A point-of-interest.
bool myGeo
flag to check if POI was loaded as GEO Position (main used by netedit)
bool getFriendlyPos() const
returns friendly position
void setHeight(double height)
set the image height of the POI
void setFriendlyPos(const bool friendlyPos)
set friendly position
double myPosLat
latereal position over lane in which this POI is placed (main used by netedit)
void setWidth(double width)
set the image width of the POI
double getHeight() const
Returns the image height of the POI.
bool myFriendlyPos
friendlyPos enable or disable friendly position for position over lane
std::string myLane
ID of lane in which this POI is placed (main used by netedit)
double myPosOverLane
position over lane in which this POI is placed (main used by netedit)
void writeXML(OutputDevice &out, const bool geo=false, const double zOffset=0., const std::string laneID="", const double pos=0., const bool friendlyPos=false, const double posLat=0.)
double getWidth() const
Returns the image width of the POI.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
Position()
default constructor
Definition: Position.h:40
void set(double x, double y)
set positions x and y
Definition: Position.h:85
double x() const
Returns the x-position.
Definition: Position.h:55
double y() const
Returns the y-position.
Definition: Position.h:60
A list of positions.
double length2D() const
Returns the length.
void add(double xoff, double yoff, double zoff)
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
Position getCentroid() const
Returns the centroid (closes the polygon if unclosed)
static const RGBColor ORANGE
Definition: RGBColor.h:191
static bool isValidTypeID(const std::string &value)
whether the given string is a valid id for an edge or vehicle type
static bool isValidAttribute(const std::string &value)
whether the given string is a valid attribute for a certain key (for example, a name)
const std::string getShapeName() const
Returns the name of the Shape.
Definition: Shape.h:109
const RGBColor & getShapeColor() const
Returns the color of the Shape.
Definition: Shape.h:83
static const double DEFAULT_LAYER_POI
Definition: Shape.h:44
void setShapeName(const std::string &name)
Sets a new shape name.
Definition: Shape.h:168
const std::string & getShapeImgFile() const
Returns the imgFile of the Shape.
Definition: Shape.h:104
void setShapeLayer(const double layer)
Sets a new layer.
Definition: Shape.h:149
bool getShapeRelativePath() const
Returns the relativePath of the Shape.
Definition: Shape.h:116
void setShapeType(const std::string &type)
Sets a new type.
Definition: Shape.h:128
void setShapeRelativePath(bool relativePath)
Sets a new relativePath value.
Definition: Shape.h:175
virtual void setShapeNaviDegree(const double angle)
Sets a new angle in navigational degrees.
Definition: Shape.h:156
void setShapeImgFile(const std::string &imgFile)
Sets a new imgFile.
Definition: Shape.h:163
void setShapeColor(const RGBColor &col)
Sets a new color.
Definition: Shape.h:135
double getShapeLayer() const
Returns the layer of the Shape.
Definition: Shape.h:90
double getShapeNaviDegree() const
Returns the angle of the Shape in navigational degrees.
Definition: Shape.h:97
const std::string & getShapeType() const
Returns the (abstract) type of the Shape.
Definition: Shape.h:76
bool showShapes() const
check if shapes has to be drawn
bool showShapes() const
check if shapes has to be drawn
NetworkEditMode networkEditMode
the current Network edit mode
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
static void drawLockIcon(const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position viewPosition, const double exaggeration, const double size=0.5, const double offsetx=0, const double offsety=0)
draw lock icon
bool shiftKeyPressed() const
check if SHIFT is pressed during current event
bool isTestingEnabled() const
check if testing mode is enabled
static const double additionalGeometryPointRadius
moving additional geometry point radius
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values