Eclipse SUMO - Simulation of Urban MObility
GNEDetectorE2.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 //
19 /****************************************************************************/
20 #include <netedit/GNENet.h>
21 #include <netedit/GNEUndoList.h>
22 #include <netedit/GNEViewNet.h>
26 #include <utils/gui/div/GLHelper.h>
28 
29 #include "GNEDetectorE2.h"
30 #include "GNEAdditionalHandler.h"
31 
32 
33 // ===========================================================================
34 // member method definitions
35 // ===========================================================================
36 
38  GNEDetector("", net, GLO_E2DETECTOR, tag, 0, 0, {}, "", {}, "", false, Parameterised::Map()),
39  myEndPositionOverLane(0),
40  myTimeThreshold(0),
41  mySpeedThreshold(0),
42 myJamThreshold(0) {
43  // reset default values
44  resetDefaultValues();
45 }
46 
47 
48 GNEDetectorE2::GNEDetectorE2(const std::string& id, GNELane* lane, GNENet* net, double pos, double length, const SUMOTime freq,
49  const std::string& trafficLight, const std::string& filename, const std::vector<std::string>& vehicleTypes, const std::string& name,
50  SUMOTime timeThreshold, double speedThreshold, double jamThreshold, bool friendlyPos,
51  const Parameterised::Map& parameters) :
52  GNEDetector(id, net, GLO_E2DETECTOR, SUMO_TAG_E2DETECTOR, pos, freq, {
53  lane
54 }, filename, vehicleTypes, name, friendlyPos, parameters),
55 myEndPositionOverLane(pos + length),
56 myTimeThreshold(timeThreshold),
57 mySpeedThreshold(speedThreshold),
58 myJamThreshold(jamThreshold),
59 myTrafficLight(trafficLight) {
60  // update centering boundary without updating grid
61  updateCenteringBoundary(false);
62 }
63 
64 
65 GNEDetectorE2::GNEDetectorE2(const std::string& id, std::vector<GNELane*> lanes, GNENet* net, double pos, double endPos, const SUMOTime freq,
66  const std::string& trafficLight, const std::string& filename, const std::vector<std::string>& vehicleTypes, const std::string& name, SUMOTime timeThreshold,
67  double speedThreshold, double jamThreshold, bool friendlyPos, const Parameterised::Map& parameters) :
68  GNEDetector(id, net, GLO_E2DETECTOR, GNE_TAG_E2DETECTOR_MULTILANE, pos, freq, lanes, filename, vehicleTypes, name, friendlyPos, parameters),
69  myEndPositionOverLane(endPos),
70  myTimeThreshold(timeThreshold),
71  mySpeedThreshold(speedThreshold),
72  myJamThreshold(jamThreshold),
73  myTrafficLight(trafficLight) {
74  // update centering boundary without updating grid
76 }
77 
78 
80 }
81 
82 
83 void
86  device.writeAttr(SUMO_ATTR_ID, getID());
87  if (!myAdditionalName.empty()) {
89  }
90  // continue depending of E2 type
92  device.writeAttr(SUMO_ATTR_LANE, getParentLanes().front()->getID());
95  } else {
99  }
100  if (myTrafficLight.size() > 0) {
102  }
103  if (getAttribute(SUMO_ATTR_PERIOD).size() > 0) {
105  }
106  if (myFilename.size() > 0) {
108  }
109  if (myVehicleTypes.size() > 0) {
111  }
114  }
117  }
120  }
121  if (myFriendlyPosition) {
122  device.writeAttr(SUMO_ATTR_FRIENDLY_POS, true);
123  }
124  // write parameters (Always after children to avoid problems with additionals.xsd)
125  writeParams(device);
126  device.closeTag();
127 }
128 
129 
130 bool
132  if (getParentLanes().size() == 1) {
133  // with friendly position enabled position are "always fixed"
134  if (myFriendlyPosition) {
135  return true;
136  } else {
137  return (myPositionOverLane >= 0) && (myEndPositionOverLane <= getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength());
138  }
139  } else {
140  // first check if there is connection between all consecutive lanes
142  // with friendly position enabled position are "always fixed"
143  if (myFriendlyPosition) {
144  return true;
145  } else {
146  return (myPositionOverLane >= 0) &&
147  (myEndPositionOverLane >= 0) &&
148  (myPositionOverLane <= getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) &&
149  (myEndPositionOverLane <= getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength());
150  }
151  } else {
152  return false;
153  }
154  }
155 }
156 
157 
158 std::string
160  // declare variable for error position
161  std::string errorFirstLanePosition, separator, errorLastLanePosition;
162  if (getParentLanes().size() == 1) {
163  // check positions over lane
164  if (myPositionOverLane < 0) {
165  errorFirstLanePosition = (toString(SUMO_ATTR_POSITION) + " < 0");
166  }
167  if (myPositionOverLane > getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) {
168  errorFirstLanePosition = (toString(SUMO_ATTR_POSITION) + " > lanes's length");
169  }
170  } else {
171  // abort if lanes aren't consecutives
173  return "lanes aren't consecutives";
174  }
175  // abort if lanes aren't connected
177  return "lanes aren't connected";
178  }
179  // check positions over first lane
180  if (myPositionOverLane < 0) {
181  errorFirstLanePosition = (toString(SUMO_ATTR_POSITION) + " < 0");
182  }
183  if (myPositionOverLane > getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) {
184  errorFirstLanePosition = (toString(SUMO_ATTR_POSITION) + " > lanes's length");
185  }
186  // check positions over last lane
187  if (myEndPositionOverLane < 0) {
188  errorLastLanePosition = (toString(SUMO_ATTR_ENDPOS) + " < 0");
189  }
190  if (myEndPositionOverLane > getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength()) {
191  errorLastLanePosition = (toString(SUMO_ATTR_ENDPOS) + " > lanes's length");
192  }
193  }
194  // check separator
195  if ((errorFirstLanePosition.size() > 0) && (errorLastLanePosition.size() > 0)) {
196  separator = " and ";
197  }
198  // return error message
199  return errorFirstLanePosition + separator + errorLastLanePosition;
200 }
201 
202 
203 void
205  if (getParentLanes().size() == 1) {
206  // obtain position and length
207  double newPositionOverLane = myPositionOverLane;
208  double newLength = (myEndPositionOverLane - myPositionOverLane);
209  // fix pos and length using fixE2DetectorPosition
210  GNEAdditionalHandler::fixLanePosition(newPositionOverLane, newLength, getParentLanes().at(0)->getParentEdge()->getNBEdge()->getFinalLength());
211  // set new position and length
212  setAttribute(SUMO_ATTR_POSITION, toString(newPositionOverLane), myNet->getViewNet()->getUndoList());
214  } else {
216  // build connections between all consecutive lanes
217  bool foundConnection = true;
218  int i = 0;
219  // iterate over all lanes, and stop if myE2valid is false
220  while (i < ((int)getParentLanes().size() - 1)) {
221  // change foundConnection to false
222  foundConnection = false;
223  // if a connection betwen "from" lane and "to" lane of connection is found, change myE2valid to true again
224  for (const auto& connection : getParentLanes().at(i)->getParentEdge()->getGNEConnections()) {
225  if ((connection->getLaneFrom() == getParentLanes().at(i)) && (connection->getLaneTo() == getParentLanes().at(i + 1))) {
226  foundConnection = true;
227  }
228  }
229  // if connection wasn't found
230  if (!foundConnection) {
231  // create new connection manually
232  NBEdge::Connection newCon(getParentLanes().at(i)->getIndex(), getParentLanes().at(i + 1)->getParentEdge()->getNBEdge(), getParentLanes().at(i + 1)->getIndex());
233  // allow to undo creation of new lane
234  myNet->getViewNet()->getUndoList()->add(new GNEChange_Connection(getParentLanes().at(i)->getParentEdge(), newCon, false, true), true);
235  }
236  // update lane iterator
237  i++;
238  }
239  } else {
240  // declare new positions
241  double newPositionOverLane = myPositionOverLane;
242  double newEndPositionOverLane = myEndPositionOverLane;
243  // fix pos and length checkAndFixDetectorPosition
245  newPositionOverLane, getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength(),
246  newEndPositionOverLane, getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength());
247  // set new position and endPosition
248  setAttribute(SUMO_ATTR_POSITION, toString(newPositionOverLane), myNet->getViewNet()->getUndoList());
249  setAttribute(SUMO_ATTR_ENDPOS, toString(newEndPositionOverLane), myNet->getViewNet()->getUndoList());
250  }
251  }
252 }
253 
254 
255 void
257  // check E2 detector
259  // compute path
261  } else {
262  // Cut shape using as delimitators fixed start position and fixed end position
264  // update centering boundary without updating grid
266  }
267 }
268 
269 
270 void
272  // Obtain exaggeration of the draw
273  const double E2Exaggeration = getExaggeration(s);
274  // first check if additional has to be drawn
276  // check exaggeration
277  if (s.drawAdditionals(E2Exaggeration)) {
278  // declare color
279  RGBColor E2Color, textColor;
280  // set color
281  if (drawUsingSelectColor()) {
283  textColor = E2Color.changedBrightness(-32);
284  } else if (areLaneConsecutives(getParentLanes())) {
285  E2Color = s.detectorSettings.E2Color;
286  textColor = RGBColor::BLACK;
287  }
288  // draw parent and child lines
290  // Start drawing adding an gl identificator
292  // push layer matrix
294  // translate to front
296  // set color
297  GLHelper::setColor(E2Color);
298  // draw geometry
300  // Check if the distance is enought to draw details
301  if (s.drawDetail(s.detailSettings.detectorDetails, E2Exaggeration)) {
302  // draw E2 Logo
303  drawDetectorLogo(s, E2Exaggeration, "E2", textColor);
304  }
305  // draw geometry points
308  // pop layer matrix
310  // Pop name
312  // draw lock icon
314  // check if dotted contours has to be drawn
317  E2Exaggeration, true, true);
318  }
319  if (myNet->getViewNet()->getFrontAttributeCarrier() == this) {
321  E2Exaggeration, true, true);
322  }
323  }
324  // Draw additional ID
325  drawAdditionalID(s);
326  // draw additional name
328  }
329 }
330 
331 
332 void
334  // calculate path
336 }
337 
338 
339 void
340 GNEDetectorE2::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const {
341  // calculate E2Detector width
342  const double E2DetectorWidth = s.addSize.getExaggeration(s, lane);
343  // check if E2 can be drawn
344  if (s.drawAdditionals(E2DetectorWidth) && myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
345  // calculate startPos
346  const double geometryDepartPos = getAttributeDouble(SUMO_ATTR_POSITION);
347  // get endPos
348  const double geometryEndPos = getAttributeDouble(SUMO_ATTR_ENDPOS);
349  // declare path geometry
350  GUIGeometry E2Geometry;
351  // update pathGeometry depending of first and last segment
352  if (segment->isFirstSegment() && segment->isLastSegment()) {
353  E2Geometry.updateGeometry(lane->getLaneGeometry().getShape(),
354  geometryDepartPos, geometryEndPos, // extrem positions
355  Position::INVALID, Position::INVALID); // extra positions
356  } else if (segment->isFirstSegment()) {
357  E2Geometry.updateGeometry(lane->getLaneGeometry().getShape(),
358  geometryDepartPos, -1, // extrem positions
359  Position::INVALID, Position::INVALID); // extra positions
360  } else if (segment->isLastSegment()) {
361  E2Geometry.updateGeometry(lane->getLaneGeometry().getShape(),
362  -1, geometryEndPos, // extrem positions
363  Position::INVALID, Position::INVALID); // extra positions
364  } else {
365  E2Geometry = lane->getLaneGeometry();
366  }
367  // obtain color
369  // Start drawing adding an gl identificator
371  // push layer matrix
373  // Start with the drawing of the area traslating matrix to origin
374  glTranslated(0, 0, getType() + offsetFront);
375  // Set color
376  GLHelper::setColor(E2Color);
377  // draw geometry
378  GUIGeometry::drawGeometry(s, myNet->getViewNet()->getPositionInformation(), E2Geometry, E2DetectorWidth);
379  // draw geometry points
380  if (segment->isFirstSegment() && segment->isLastSegment()) {
381  drawLeftGeometryPoint(myNet->getViewNet(), E2Geometry.getShape().front(), E2Geometry.getShapeRotations().front(), E2Color, true);
382  drawRightGeometryPoint(myNet->getViewNet(), E2Geometry.getShape().back(), E2Geometry.getShapeRotations().back(), E2Color, true);
383  } else if (segment->isFirstSegment()) {
384  drawLeftGeometryPoint(myNet->getViewNet(), E2Geometry.getShape().front(), E2Geometry.getShapeRotations().front(), E2Color, true);
385  } else if (segment->isLastSegment()) {
386  drawRightGeometryPoint(myNet->getViewNet(), E2Geometry.getShape().back(), E2Geometry.getShapeRotations().back(), E2Color, true);
387  }
388  // Pop layer matrix
390  // Pop name
392  // draw additional ID
393  if (!s.drawForRectangleSelection) {
394  drawName(getCenteringBoundary().getCenter(), s.scale, s.addName);
395  // check if this is the label segment
396  if (segment->isLabelSegment()) {
397  // calculate middle point
398  const double middlePoint = (E2Geometry.getShape().length2D() * 0.5);
399  // calculate position
400  const Position pos = E2Geometry.getShape().positionAtOffset2D(middlePoint);
401  // calculate rotation
402  const double rot = E2Geometry.getShape().rotationDegreeAtOffset(middlePoint);
403  // Start pushing matrix
405  // Traslate to position
406  glTranslated(pos.x(), pos.y(), getType() + offsetFront + 0.1);
407  // rotate over lane
409  // move
410  glTranslated(-1, 0, 0);
411  // scale text
412  glScaled(E2DetectorWidth, E2DetectorWidth, 1);
413  // draw E1 logo
414  GLHelper::drawText("E2 Multilane", Position(), .1, 1.5, RGBColor::BLACK);
415  // pop matrix
417  }
418  }
419  // check if shape dotted contour has to be drawn
421  // declare trim geometry to draw
422  const auto shape = (segment->isFirstSegment() || segment->isLastSegment()) ? E2Geometry.getShape() : lane->getLaneShape();
423  // draw inspected dotted contour
426  }
427  // draw front dotted contour
428  if ((myNet->getViewNet()->getFrontAttributeCarrier() == this)) {
430  }
431  }
432  }
433 }
434 
435 
436 void
437 GNEDetectorE2::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* /*segment*/, const double offsetFront) const {
438  // calculate E2Detector width
439  const double E2DetectorWidth = s.addSize.getExaggeration(s, fromLane);
440  // check if E2 can be drawn
441  if (s.drawAdditionals(E2DetectorWidth) && myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
442  // get flag for show only contour
444  // Start drawing adding an gl identificator
446  // Add a draw matrix
448  // Start with the drawing of the area traslating matrix to origin
449  glTranslated(0, 0, getType() + offsetFront);
450  // Set color of the base
451  if (drawUsingSelectColor()) {
453  } else {
455  }
456  // draw lane2lane
457  if (fromLane->getLane2laneConnections().exist(toLane)) {
458  // check if draw only contour
459  if (onlyContour) {
461  } else {
463  }
464  } else {
465  // Set invalid person plan color
467  // calculate invalid geometry
468  const GUIGeometry invalidGeometry({fromLane->getLaneShape().back(), toLane->getLaneShape().front()});
469  // check if draw only contour
470  if (onlyContour) {
471  GUIGeometry::drawContourGeometry(invalidGeometry, (0.5 * E2DetectorWidth));
472  } else {
473  // draw invalid geometry
474  GUIGeometry::drawGeometry(s, myNet->getViewNet()->getPositionInformation(), invalidGeometry, (0.5 * E2DetectorWidth));
475  }
476  }
477  // Pop last matrix
479  // Pop name
481  // check if shape dotted contour has to be drawn
483  // draw lane2lane dotted geometry
484  if (fromLane->getLane2laneConnections().exist(toLane)) {
486  E2DetectorWidth, 1, false, false);
487  }
488  }
489  if ((myNet->getViewNet()->getFrontAttributeCarrier() == this)) {
490  // draw lane2lane dotted geometry
491  if (fromLane->getLane2laneConnections().exist(toLane)) {
493  E2DetectorWidth, 1, false, false);
494  }
495  }
496  }
497 }
498 
499 
500 std::string
502  switch (key) {
503  case SUMO_ATTR_ID:
504  return getMicrosimID();
505  case SUMO_ATTR_LANE:
506  case SUMO_ATTR_LANES:
507  return parseIDs(getParentLanes());
508  case SUMO_ATTR_POSITION:
509  case SUMO_ATTR_STARTPOS:
511  case SUMO_ATTR_ENDPOS:
513  case SUMO_ATTR_PERIOD:
514  if (myPeriod == SUMOTime_MAX_PERIOD) {
515  return "";
516  } else {
517  return time2string(myPeriod);
518  }
519  case SUMO_ATTR_TLID:
520  return myTrafficLight;
521  case SUMO_ATTR_LENGTH:
523  case SUMO_ATTR_NAME:
524  return myAdditionalName;
525  case SUMO_ATTR_FILE:
526  return myFilename;
527  case SUMO_ATTR_VTYPES:
528  return toString(myVehicleTypes);
532  return toString(mySpeedThreshold);
534  return toString(myJamThreshold);
537  case GNE_ATTR_SELECTED:
539  case GNE_ATTR_PARAMETERS:
540  return getParametersStr();
542  return "";
543  default:
544  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
545  }
546 }
547 
548 
549 double
551  switch (key) {
552  case SUMO_ATTR_POSITION:
553  return myPositionOverLane;
554  case SUMO_ATTR_LENGTH:
556  case SUMO_ATTR_ENDPOS:
557  return myEndPositionOverLane;
558  default:
559  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
560  }
561 }
562 
563 
564 void
565 GNEDetectorE2::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
566  switch (key) {
567  case SUMO_ATTR_ID:
568  case SUMO_ATTR_LANE:
569  case SUMO_ATTR_LANES:
570  case SUMO_ATTR_POSITION:
571  case SUMO_ATTR_ENDPOS:
572  case SUMO_ATTR_PERIOD:
573  case SUMO_ATTR_TLID:
574  case SUMO_ATTR_LENGTH:
575  case SUMO_ATTR_NAME:
576  case SUMO_ATTR_FILE:
577  case SUMO_ATTR_VTYPES:
582  case GNE_ATTR_SELECTED:
583  case GNE_ATTR_PARAMETERS:
585  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
586  break;
587  default:
588  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
589  }
590 }
591 
592 
593 bool
594 GNEDetectorE2::isValid(SumoXMLAttr key, const std::string& value) {
595  switch (key) {
596  case SUMO_ATTR_ID:
597  if (value == getID()) {
598  return true;
599  } else if (isValidDetectorID(value)) {
600  return (myNet->getAttributeCarriers()->retrieveAdditional(GNE_TAG_E2DETECTOR_MULTILANE, value, false) == nullptr) &&
601  (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_E2DETECTOR, value, false) == nullptr);
602  } else {
603  return false;
604  }
605  case SUMO_ATTR_LANE:
606  if (value.empty()) {
607  return false;
608  } else {
609  return canParse<std::vector<GNELane*> >(myNet, value, false);
610  }
611  case SUMO_ATTR_LANES:
612  if (value.empty()) {
613  return false;
614  } else if (canParse<std::vector<GNELane*> >(myNet, value, false)) {
615  // check if lanes are consecutives
616  return lanesConsecutives(parse<std::vector<GNELane*> >(myNet, value));
617  } else {
618  return false;
619  }
620  case SUMO_ATTR_POSITION:
621  return canParse<double>(value);
622  case SUMO_ATTR_ENDPOS:
623  return canParse<double>(value);
624  case SUMO_ATTR_PERIOD:
625  if (value.empty()) {
626  return true;
627  } else {
628  return (canParse<double>(value) && (parse<double>(value) >= 0));
629  }
630  case SUMO_ATTR_TLID:
631  // temporal
632  return SUMOXMLDefinitions::isValidNetID(value);
633  case SUMO_ATTR_LENGTH:
634  return (canParse<double>(value) && (parse<double>(value) >= 0));
635  case SUMO_ATTR_NAME:
637  case SUMO_ATTR_FILE:
639  case SUMO_ATTR_VTYPES:
640  if (value.empty()) {
641  return true;
642  } else {
644  }
646  return canParse<SUMOTime>(value);
648  return (canParse<double>(value) && (parse<double>(value) >= 0));
650  return (canParse<double>(value) && (parse<double>(value) >= 0));
652  return canParse<bool>(value);
653  case GNE_ATTR_SELECTED:
654  return canParse<bool>(value);
655  case GNE_ATTR_PARAMETERS:
656  return areParametersValid(value);
657  default:
658  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
659  }
660 }
661 
662 // ===========================================================================
663 // private
664 // ===========================================================================
665 
666 void
667 GNEDetectorE2::setAttribute(SumoXMLAttr key, const std::string& value) {
668  switch (key) {
669  case SUMO_ATTR_ID:
670  // update microsimID
671  setMicrosimID(value);
672  break;
673  case SUMO_ATTR_LANE:
674  case SUMO_ATTR_LANES:
676  break;
677  case SUMO_ATTR_POSITION:
678  myPositionOverLane = parse<double>(value);
679  // update geometry (except for template)
680  if (getParentLanes().size() > 0) {
681  updateGeometry();
682  }
683  break;
684  case SUMO_ATTR_ENDPOS:
685  myEndPositionOverLane = parse<double>(value);
686  // update geometry (except for template)
687  if (getParentLanes().size() > 0) {
688  updateGeometry();
689  }
690  break;
691  case SUMO_ATTR_PERIOD:
692  if (value.empty()) {
694  } else {
695  myPeriod = string2time(value);
696  }
697  break;
698  case SUMO_ATTR_TLID:
699  myTrafficLight = value;
700  break;
701  case SUMO_ATTR_LENGTH:
702  myEndPositionOverLane = (myPositionOverLane + parse<double>(value));
703  // update geometry (except for template)
704  if (getParentLanes().size() > 0) {
705  updateGeometry();
706  }
707  break;
708  case SUMO_ATTR_NAME:
709  myAdditionalName = value;
710  break;
711  case SUMO_ATTR_FILE:
712  myFilename = value;
713  break;
714  case SUMO_ATTR_VTYPES:
715  myVehicleTypes = parse<std::vector<std::string> >(value);
716  break;
718  myTimeThreshold = TIME2STEPS(parse<double>(value));
719  break;
721  mySpeedThreshold = parse<double>(value);
722  break;
724  myJamThreshold = parse<double>(value);
725  break;
727  myFriendlyPosition = parse<bool>(value);
728  break;
729  case GNE_ATTR_SELECTED:
730  if (parse<bool>(value)) {
732  } else {
734  }
735  break;
736  case GNE_ATTR_PARAMETERS:
737  setParametersStr(value);
738  break;
740  shiftLaneIndex();
741  break;
742  default:
743  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
744  }
745 }
746 
747 
748 void
752  // change only start position
753  myPositionOverLane = moveResult.newFirstPos;
756  // change only end position
757  myEndPositionOverLane = moveResult.newFirstPos;
758  } else {
759  // change both position
760  myPositionOverLane = moveResult.newFirstPos;
761  myEndPositionOverLane = moveResult.newSecondPos;
762  }
763  // update geometry
764  updateGeometry();
765 }
766 
767 
768 void
770  // begin change attribute
771  undoList->begin(myTagProperty.getGUIIcon(), "position of " + getTagStr());
772  // set attributes depending of operation type
775  // set only start position
776  setAttribute(SUMO_ATTR_POSITION, toString(moveResult.newFirstPos), undoList);
779  // set only end position
780  setAttribute(SUMO_ATTR_ENDPOS, toString(moveResult.newFirstPos), undoList);
781  } else {
782  // set both positions
783  setAttribute(SUMO_ATTR_POSITION, toString(moveResult.newFirstPos), undoList);
784  setAttribute(SUMO_ATTR_ENDPOS, toString(moveResult.newSecondPos), undoList);
785  }
786  // end change attribute
787  undoList->end();
788 }
789 
790 
791 double
793  // get lane final and shape length
794  const double laneLength = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
795  // get startPosition
796  double fixedPos = myPositionOverLane;
797  // adjust fixedPos
798  if (fixedPos < 0) {
799  fixedPos += laneLength;
800  }
801  fixedPos *= getParentLanes().front()->getLengthGeometryFactor();
802  // return depending of fixedPos
803  if (fixedPos < 0) {
804  return 0;
805  } else if (fixedPos > (getParentLanes().front()->getLaneShapeLength() - POSITION_EPS)) {
806  return (getParentLanes().front()->getLaneShapeLength() - POSITION_EPS);
807  } else {
808  return fixedPos;
809  }
810 }
811 
812 
813 double
815  // get lane final and shape length
816  const double laneLength = getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength();
817  // get endPosition
818  double fixedPos = myEndPositionOverLane;
819  // adjust fixedPos
820  if (fixedPos < 0) {
821  fixedPos += laneLength;
822  }
823  fixedPos *= getParentLanes().back()->getLengthGeometryFactor();
824  // return depending of fixedPos
825  if (fixedPos < POSITION_EPS) {
826  return POSITION_EPS;
827  } else if (fixedPos > getParentLanes().back()->getLaneShapeLength()) {
828  return getParentLanes().back()->getLaneShapeLength();
829  } else {
830  return fixedPos;
831  }
832 }
833 
834 /****************************************************************************/
GUIGlObject::getType
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.h:146
SUMOXMLDefinitions::isValidAttribute
static bool isValidAttribute(const std::string &value)
whether the given string is a valid attribute for a certain key (for example, a name)
Definition: SUMOXMLDefinitions.cpp:1288
GNEAdditional::drawRightGeometryPoint
static void drawRightGeometryPoint(const GNEViewNet *viewNet, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false)
draw right geometry point
Definition: GNEAdditional.cpp:703
Parameterised::getParametersStr
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".
Definition: Parameterised.cpp:132
SUMOTime_MAX_PERIOD
#define SUMOTime_MAX_PERIOD
Definition: SUMOTime.h:35
SUMO_ATTR_HALTING_SPEED_THRESHOLD
@ SUMO_ATTR_HALTING_SPEED_THRESHOLD
Definition: SUMOXMLDefinitions.h:1077
GNEAttributeCarrier::getID
const std::string getID() const
get ID (all Attribute Carriers have one)
Definition: GNEAttributeCarrier.cpp:62
GNEDetectorE2::isAdditionalValid
bool isAdditionalValid() const
check if current additional is valid to be writed into XML
Definition: GNEDetectorE2.cpp:131
GNE_ATTR_SHIFTLANEINDEX
@ GNE_ATTR_SHIFTLANEINDEX
shift lane index (only used by elements over lanes)
Definition: SUMOXMLDefinitions.h:1361
SUMOTime
long long int SUMOTime
Definition: GUI.h:35
GNEViewNet::getDataViewOptions
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
Definition: GNEViewNet.cpp:562
GNEViewNetHelper::DataViewOptions::showAdditionals
bool showAdditionals() const
check if additionals has to be drawn
Definition: GNEViewNetHelper.cpp:2661
SUMO_ATTR_LENGTH
@ SUMO_ATTR_LENGTH
Definition: SUMOXMLDefinitions.h:559
SUMOXMLDefinitions::isValidFilename
static bool isValidFilename(const std::string &value)
whether the given string is a valid attribute for a filename (for example, a name)
Definition: SUMOXMLDefinitions.cpp:1294
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
GNEMoveElement::myMoveElementLateralOffset
double myMoveElementLateralOffset
move element lateral offset (used by elements placed over lanes
Definition: GNEMoveElement.h:250
GNEDetectorE2::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEDetectorE2.cpp:501
RGBColor::BLACK
static const RGBColor BLACK
Definition: RGBColor.h:193
GNEViewNet::drawTranslateFrontAttributeCarrier
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
Definition: GNEViewNet.cpp:1489
GUIVisualizationSettings::drawForRectangleSelection
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
Definition: GUIVisualizationSettings.h:961
GNEAttributeCarrier::myTagProperty
const GNETagProperties & myTagProperty
reference to tagProperty associated with this attribute carrier
Definition: GNEAttributeCarrier.h:289
Position::INVALID
static const Position INVALID
used to indicate that a position is valid
Definition: Position.h:293
GNEAttributeCarrier::parseIDs
static std::string parseIDs(const std::vector< T > &ACs)
parses a list of specific Attribute Carriers into a string of IDs
GUIGeometry::drawContourGeometry
static void drawContourGeometry(const GUIGeometry &geometry, const double width, const bool drawExtremes=false)
draw contour geometry
Definition: GUIGeometry.cpp:295
GNEAdditional::myAdditionalGeometry
GUIGeometry myAdditionalGeometry
geometry to be precomputed in updateGeometry(...)
Definition: GNEAdditional.h:305
GNENet
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
GNEDetectorE2::computePathElement
void computePathElement()
compute pathElement
Definition: GNEDetectorE2.cpp:333
GNEAdditional::shiftLaneIndex
void shiftLaneIndex()
shift lane index
Definition: GNEAdditional.cpp:340
GNEAdditional::drawLeftGeometryPoint
static void drawLeftGeometryPoint(const GNEViewNet *viewNet, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false)
draw left geometry point
Definition: GNEAdditional.cpp:697
GUIDottedGeometry::DottedContourType::INSPECT
@ INSPECT
GUIGeometry::getShape
const PositionVector & getShape() const
The shape of the additional element.
Definition: GUIGeometry.cpp:202
SUMO_ATTR_PERIOD
@ SUMO_ATTR_PERIOD
Definition: SUMOXMLDefinitions.h:938
GNEMoveResult
move result
Definition: GNEMoveElement.h:179
SUMO_ATTR_TLID
@ SUMO_ATTR_TLID
link,node: the traffic light id responsible for this link
Definition: SUMOXMLDefinitions.h:979
Parameterised::areParametersValid
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|....
Definition: Parameterised.cpp:197
GNEHierarchicalElement::getParentLanes
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
Definition: GNEHierarchicalElement.cpp:123
GNEUndoList::add
void add(GNEChange *command, bool doit=false, bool merge=true)
Add new command, executing it if desired. The new command will be merged with the previous command if...
Definition: GNEUndoList.cpp:332
GNEPathManager::Segment::isLabelSegment
bool isLabelSegment() const
check if segment is label segment
Definition: GNEPathManager.cpp:164
GNEAdditional::areLaneConsecutives
static bool areLaneConsecutives(const std::vector< GNELane * > &lanes)
check if the given lanes are consecutive
Definition: GNEAdditional.cpp:728
GNEDetectorE2::myTimeThreshold
SUMOTime myTimeThreshold
The time-based threshold that describes how much time has to pass until a vehicle is recognized as ha...
Definition: GNEDetectorE2.h:169
GNEDetectorE2::fixAdditionalProblem
void fixAdditionalProblem()
fix additional problem
Definition: GNEDetectorE2.cpp:204
Parameterised::Map
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45
GUIVisualizationAdditionalSettings::connectionColor
static const RGBColor connectionColor
connection color
Definition: GUIVisualizationSettings.h:362
GNELane::getLane2laneConnections
const GNELane2laneConnection & getLane2laneConnections() const
get Lane2laneConnection struct
Definition: GNELane.cpp:851
SUMO_ATTR_ID
@ SUMO_ATTR_ID
Definition: SUMOXMLDefinitions.h:544
GNEAdditionalHandler::fixMultiLanePosition
static void fixMultiLanePosition(double fromPos, const double fromLaneLength, double toPos, const double tolaneLength)
fix the given positions over two lanes
Definition: GNEAdditionalHandler.cpp:1898
GLHelper.h
SUMO_ATTR_LANE
@ SUMO_ATTR_LANE
Definition: SUMOXMLDefinitions.h:528
GNEDetector::myPeriod
SUMOTime myPeriod
The aggregation period the values the detector collects shall be summed up.
Definition: GNEDetector.h:175
SUMO_ATTR_ENDPOS
@ SUMO_ATTR_ENDPOS
Definition: SUMOXMLDefinitions.h:1134
GNEViewNet::isAttributeCarrierInspected
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
Definition: GNEViewNet.cpp:1448
GNENet::getAttributeCarriers
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition: GNENet.cpp:125
GNEDetector::myPositionOverLane
double myPositionOverLane
position of detector over Lane
Definition: GNEDetector.h:172
GLHelper::pushName
static void pushName(unsigned int name)
push Name
Definition: GLHelper.cpp:139
GLHelper::setColor
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:583
GNEDetector::myFriendlyPosition
bool myFriendlyPosition
Flag for friendly position.
Definition: GNEDetector.h:184
GUIDottedGeometry::drawDottedContourShape
static void drawDottedContourShape(const DottedContourType type, const GUIVisualizationSettings &s, const PositionVector &shape, const double width, const double exaggeration, const bool drawFirstExtrem, const bool drawLastExtrem, const double lineWidth=-1)
draw dotted contour for the given shape (used by additionals)
Definition: GUIDottedGeometry.cpp:323
SUMO_ATTR_FILE
@ SUMO_ATTR_FILE
Definition: SUMOXMLDefinitions.h:958
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:39
GUIVisualizationDetailSettings::detectorDetails
static const double detectorDetails
details for detectors
Definition: GUIVisualizationSettings.h:542
Parameterised::writeParams
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
Definition: Parameterised.cpp:185
GNEDetector::myVehicleTypes
std::vector< std::string > myVehicleTypes
attribute vehicle types
Definition: GNEDetector.h:181
GNEAttributeCarrier::drawUsingSelectColor
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
Definition: GNEAttributeCarrier.cpp:102
OutputDevice::closeTag
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
Definition: OutputDevice.cpp:271
GUIGeometry
Definition: GUIGeometry.h:30
GLHelper::pushMatrix
static void pushMatrix()
push matrix
Definition: GLHelper.cpp:117
GNELane2laneConnection::getLane2laneGeometry
const GUIGeometry & getLane2laneGeometry(const GNELane *toLane) const
get lane2lane geometry
Definition: GNELane2laneConnection.cpp:80
GNEAttributeCarrier::myNet
GNENet * myNet
pointer to net
Definition: GNEAttributeCarrier.h:292
GNEDetectorE2::myJamThreshold
double myJamThreshold
The minimum distance to the next standing vehicle in order to make this vehicle count as a participan...
Definition: GNEDetectorE2.h:175
GNEDetectorE2::writeAdditional
void writeAdditional(OutputDevice &device) const
write additional element into a xml file
Definition: GNEDetectorE2.cpp:84
GNEAttributeCarrier::GNEChange_Attribute
friend class GNEChange_Attribute
declare friend class
Definition: GNEAttributeCarrier.h:51
GUIGeometry::getShapeRotations
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
Definition: GUIGeometry.cpp:208
GUIDottedGeometry::DottedContourType::FRONT
@ FRONT
GUIVisualizationDetectorSettings::E2Width
static const double E2Width
E2 detector widths.
Definition: GUIVisualizationSettings.h:415
OutputDevice::writeAttr
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:251
RGBColor
Definition: RGBColor.h:38
GUIGlObject::setMicrosimID
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
Definition: GUIGlObject.cpp:198
GNEViewNet::getFrontAttributeCarrier
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
Definition: GNEViewNet.cpp:1475
GUIGeometry::updateGeometry
void updateGeometry(const PositionVector &shape)
update entire geometry
Definition: GUIGeometry.cpp:58
GUIVisualizationSettings::addName
GUIVisualizationTextSettings addName
Definition: GUIVisualizationSettings.h:858
GNE_TAG_E2DETECTOR_MULTILANE
@ GNE_TAG_E2DETECTOR_MULTILANE
an e2 detector over multiple lanes (placed here due create Additional Frame)
Definition: SUMOXMLDefinitions.h:85
GNEAdditional::isValidDetectorID
bool isValidDetectorID(const std::string &newID) const
check if a new detector ID is valid
Definition: GNEAdditional.cpp:242
GUIVisualizationSettings::detailSettings
GUIVisualizationDetailSettings detailSettings
detail settings
Definition: GUIVisualizationSettings.h:1024
SUMO_ATTR_STARTPOS
@ SUMO_ATTR_STARTPOS
Definition: SUMOXMLDefinitions.h:1133
GUIVisualizationSettings::detectorSettings
GUIVisualizationDetectorSettings detectorSettings
Detector settings.
Definition: GUIVisualizationSettings.h:1012
GNEAdditional::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEAdditional.cpp:127
GNEAttributeCarrier::lanesConsecutives
static bool lanesConsecutives(const std::vector< GNELane * > &lanes)
check if lanes are consecutives
Definition: GNEAttributeCarrier.cpp:366
GUIVisualizationColorSettings::selectedAdditionalColor
RGBColor selectedAdditionalColor
additional selection color (busStops, Detectors...)
Definition: GUIVisualizationSettings.h:151
GNELane::getLaneShape
const PositionVector & getLaneShape() const
get elements shape
Definition: GNELane.cpp:133
TIME2STEPS
#define TIME2STEPS(x)
Definition: SUMOTime.h:56
GNEDetectorE2::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNEDetectorE2.cpp:256
GNEAdditional::areLaneConnected
static bool areLaneConnected(const std::vector< GNELane * > &lanes)
check if the given lanes are connected
Definition: GNEAdditional.cpp:759
GNEDetectorE2::myTrafficLight
std::string myTrafficLight
Traffic light vinculated with this E2 Detector.
Definition: GNEDetectorE2.h:178
GNEMoveResult::newFirstPos
double newFirstPos
new first position
Definition: GNEMoveElement.h:207
GNEViewNet::getNetworkViewOptions
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
Definition: GNEViewNet.cpp:550
GNEDetector::drawDetectorLogo
void drawDetectorLogo(const GUIVisualizationSettings &s, const double exaggeration, const std::string &logo, const RGBColor &textColor) const
draw detector Logo
Definition: GNEDetector.cpp:230
GNEViewNet.h
GLHelper::drawText
static void drawText(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &col=RGBColor::BLACK, const double angle=0, const int align=0, double width=-1)
Definition: GLHelper.cpp:685
GNEAdditionalHandler.h
GNEUndoList::changeAttribute
void changeAttribute(GNEChange_Attribute *change)
special method for change attributes, avoid empty changes, always execute
Definition: GNEUndoList.cpp:367
PositionVector::rotationDegreeAtOffset
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
Definition: PositionVector.cpp:320
StringUtils::escapeXML
static std::string escapeXML(const std::string &orig, const bool maskDoubleHyphen=false)
Replaces the standard escapes by their XML entities.
Definition: StringUtils.cpp:240
GUIGlObject::getGlID
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.h:97
GUIGeometry::drawGeometry
static void drawGeometry(const GUIVisualizationSettings &s, const Position &mousePos, const GUIGeometry &geometry, const double width, double offset=0)
draw geometry
Definition: GUIGeometry.cpp:268
GNEAdditional::drawAdditionalName
void drawAdditionalName(const GUIVisualizationSettings &s) const
draw additional name
Definition: GNEAdditional.cpp:271
GNE_ATTR_PARAMETERS
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
Definition: SUMOXMLDefinitions.h:1331
GUIVisualizationSettings::scale
double scale
information about a lane's width (temporary, used for a single view)
Definition: GUIVisualizationSettings.h:946
GUIVisualizationSettings::additionalSettings
GUIVisualizationAdditionalSettings additionalSettings
Additional settings.
Definition: GUIVisualizationSettings.h:1009
Parameterised::setParametersStr
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"
Definition: Parameterised.cpp:170
GNEDetector
Definition: GNEDetector.h:31
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
GNEDetectorE2::drawPartialGL
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object (lane)
Definition: GNEDetectorE2.cpp:340
Position::x
double x() const
Returns the x-position.
Definition: Position.h:55
time2string
std::string time2string(SUMOTime t)
convert SUMOTime to string
Definition: SUMOTime.cpp:68
GNEAdditionalHandler::fixLanePosition
static void fixLanePosition(double &pos, double &length, const double laneLength)
fix given position over lane
Definition: GNEAdditionalHandler.cpp:1798
GNEViewNet::getUndoList
GNEUndoList * getUndoList() const
get the undoList object
Definition: GNEViewNet.cpp:1418
GNEAdditional::drawParentChildLines
void drawParentChildLines(const GUIVisualizationSettings &s, const RGBColor &color, const bool onlySymbols=false) const
draw parent and child lines
Definition: GNEAdditional.cpp:627
GNEViewNetHelper::LockIcon::drawLockIcon
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
Definition: GNEViewNetHelper.cpp:3545
GNEAdditional::myAdditionalName
std::string myAdditionalName
name of additional
Definition: GNEAdditional.h:308
RGBColor::RED
static const RGBColor RED
named colors
Definition: RGBColor.h:185
GNEDetectorE2::mySpeedThreshold
double mySpeedThreshold
The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting.
Definition: GNEDetectorE2.h:172
GNEPathManager::Segment::isFirstSegment
bool isFirstSegment() const
check if segment is the first path's segment
Definition: GNEPathManager.cpp:82
GNEChange_Connection
Definition: GNEChange_Connection.h:32
GNEViewNetHelper::NetworkViewOptions::showConnections
bool showConnections() const
check if select show connections checkbox is enabled
Definition: GNEViewNetHelper.cpp:2196
GNEAdditional::getExaggeration
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
Definition: GNEAdditional.cpp:121
GNEAdditional::replaceAdditionalParentLanes
void replaceAdditionalParentLanes(const std::string &value)
replace additional parent lanes
Definition: GNEAdditional.cpp:296
GNEPathManager::Segment::isLastSegment
bool isLastSegment() const
check if segment is the last path's segment
Definition: GNEPathManager.cpp:92
GNEDetectorE2.h
PositionVector::length2D
double length2D() const
Returns the length.
Definition: PositionVector.cpp:510
GUISUMOAbstractView::getPositionInformation
virtual Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Definition: GUISUMOAbstractView.cpp:202
GNEPathManager::calculateConsecutivePathLanes
void calculateConsecutivePathLanes(PathElement *pathElement, const std::vector< GNELane * > lanes)
calculate consecutive path lanes
Definition: GNEPathManager.cpp:752
GNEDetectorE2::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their correspondent attribute are valids
Definition: GNEDetectorE2.cpp:594
SUMO_ATTR_FRIENDLY_POS
@ SUMO_ATTR_FRIENDLY_POS
Definition: SUMOXMLDefinitions.h:1091
string2time
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition: SUMOTime.cpp:45
GNEAttributeCarrier::canParse
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
Definition: GNEAttributeCarrier.h:209
GNETagProperties::getTag
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
Definition: GNETagProperties.cpp:67
SUMO_ATTR_POSITION
@ SUMO_ATTR_POSITION
Definition: SUMOXMLDefinitions.h:526
GNENet::getViewNet
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1935
GNEDetectorE2::setAttribute
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes
Definition: GNEDetectorE2.cpp:565
GUIVisualizationSettings::colorSettings
GUIVisualizationColorSettings colorSettings
color settings
Definition: GUIVisualizationSettings.h:997
GNEMoveOperation::OperationType::TWO_LANES_MOVESECOND
@ TWO_LANES_MOVESECOND
GNEAttributeCarrier::parse
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc....
SUMO_ATTR_LANES
@ SUMO_ATTR_LANES
Definition: SUMOXMLDefinitions.h:929
GNEUndoList::end
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
Definition: GNEUndoList.cpp:235
GLIncludes.h
GUIGeometry::rotateOverLane
static void rotateOverLane(const double rot)
rotate over lane (used by Lock icons, detector logos, etc.)
Definition: GUIGeometry.cpp:602
OutputDevice::openTag
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
Definition: OutputDevice.cpp:257
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
GNEMoveOperation::OperationType::TWO_LANES_MOVEFIRST
@ TWO_LANES_MOVEFIRST
GNEDetector::updateCenteringBoundary
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
Definition: GNEDetector.cpp:101
GNEAdditional::drawAdditionalID
void drawAdditionalID(const GUIVisualizationSettings &s) const
draw additional ID
Definition: GNEAdditional.cpp:252
Position::y
double y() const
Returns the y-position.
Definition: Position.h:60
SUMO_ATTR_HALTING_TIME_THRESHOLD
@ SUMO_ATTR_HALTING_TIME_THRESHOLD
Definition: SUMOXMLDefinitions.h:1076
PositionVector::positionAtOffset2D
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
Definition: PositionVector.cpp:274
SUMO_ATTR_VTYPES
@ SUMO_ATTR_VTYPES
Definition: SUMOXMLDefinitions.h:923
GNEAttributeCarrier::isAttributeCarrierSelected
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
Definition: GNEAttributeCarrier.cpp:96
GNEDetectorE2::getEndGeometryPositionOverLane
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
Definition: GNEDetectorE2.cpp:814
GNEMoveResult::newSecondPos
double newSecondPos
new second position
Definition: GNEMoveElement.h:216
InvalidArgument
Definition: UtilExceptions.h:54
SUMOXMLDefinitions::isValidNetID
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element
Definition: SUMOXMLDefinitions.cpp:1260
GNEDetectorE2::GNEDetectorE2
GNEDetectorE2(SumoXMLTag tag, GNENet *net)
default Constructor
Definition: GNEDetectorE2.cpp:37
GNEDetectorE2::setMoveShape
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNEDetectorE2.cpp:749
GNEDetectorE2::myEndPositionOverLane
double myEndPositionOverLane
end position over lane (only for Multilane E2 detectors)
Definition: GNEDetectorE2.h:166
GNELane::getLaneGeometry
const GUIGeometry & getLaneGeometry() const
Definition: GNELane.cpp:127
GNEDetector::myFilename
std::string myFilename
The path to the output file.
Definition: GNEDetector.h:178
GNEAttributeCarrier::selectAttributeCarrier
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
Definition: GNEAttributeCarrier.cpp:74
GUIVisualizationSettings::drawAdditionals
bool drawAdditionals(const double exaggeration) const
check if additionals must be drawn
Definition: GUIVisualizationSettings.cpp:2289
GUIGlObject::getMicrosimID
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Definition: GUIGlObject.h:133
GNEDetectorE2::getStartGeometryPositionOverLane
double getStartGeometryPositionOverLane() const
get start position over lane that is applicable to the shape
Definition: GNEDetectorE2.cpp:792
GNEDetectorE2::getAdditionalProblem
std::string getAdditionalProblem() const
return a string with the current additional problem
Definition: GNEDetectorE2.cpp:159
PositionVector::getCentroid
Position getCentroid() const
Returns the centroid (closes the polygon if unclosed)
Definition: PositionVector.cpp:418
SUMO_ATTR_JAM_DIST_THRESHOLD
@ SUMO_ATTR_JAM_DIST_THRESHOLD
Definition: SUMOXMLDefinitions.h:1078
GLHelper::popMatrix
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:130
GNENetHelper::AttributeCarriers::retrieveAdditional
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
Definition: GNENetHelper.cpp:945
GUIVisualizationSettings::addSize
GUIVisualizationSizeSettings addSize
Definition: GUIVisualizationSettings.h:856
GNEDetectorE2::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEDetectorE2.cpp:271
GNEUndoList::begin
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...
Definition: GNEUndoList.cpp:205
GUIGlObject::drawName
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0, bool forceShow=false) const
draw name of item
Definition: GUIGlObject.cpp:374
GNEMoveOperation::OperationType::ONE_LANE_MOVESECOND
@ ONE_LANE_MOVESECOND
GNEDetectorE2::getAttributeDouble
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEDetectorE2.cpp:550
GNE_ATTR_SELECTED
@ GNE_ATTR_SELECTED
element is selected
Definition: SUMOXMLDefinitions.h:1315
GNEViewNet::getEditModes
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:538
GNETagProperties::getDefaultValue
const std::string & getDefaultValue(SumoXMLAttr attr) const
return the default value of the attribute of an element
Definition: GNETagProperties.cpp:144
GUIVisualizationSettings::drawDetail
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
Definition: GUIVisualizationSettings.cpp:2295
GNEAttributeCarrier::getTagStr
const std::string & getTagStr() const
get tag assigned to this object in string format
Definition: GNEAttributeCarrier.cpp:569
SUMOXMLDefinitions::isValidListOfTypeID
static bool isValidListOfTypeID(const std::string &value)
whether the given string is a valid list of ids for an edge or vehicle type (empty aren't allowed)
Definition: SUMOXMLDefinitions.cpp:1317
SUMO_ATTR_NAME
@ SUMO_ATTR_NAME
Definition: SUMOXMLDefinitions.h:546
GNEUndoList
Definition: GNEUndoList.h:42
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:583
GNEDetectorE2::~GNEDetectorE2
~GNEDetectorE2()
Destructor.
Definition: GNEDetectorE2.cpp:79
GNENet::getPathManager
GNEPathManager * getPathManager()
get path manager
Definition: GNENet.cpp:131
GNEMoveOperation::OperationType::ONE_LANE_MOVEFIRST
@ ONE_LANE_MOVEFIRST
NBEdge::Connection
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:201
GNEMoveResult::operationType
const GNEMoveOperation::OperationType operationType
move operation
Definition: GNEMoveElement.h:198
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:466
RGBColor::changedBrightness
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:200
GNEDetectorE2::commitMoveShape
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNEDetectorE2.cpp:769
GNEPathManager::Segment
segment
Definition: GNEPathManager.h:47
GLHelper::popName
static void popName()
pop Name
Definition: GLHelper.cpp:148
GNEAttributeCarrier::unselectAttributeCarrier
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNEAttributeCarrier.cpp:85
GUIVisualizationDetectorSettings::E2Color
static const RGBColor E2Color
color for E2 detectors
Definition: GUIVisualizationSettings.h:412
SUMO_TAG_E2DETECTOR
@ SUMO_TAG_E2DETECTOR
an e2 detector
Definition: SUMOXMLDefinitions.h:83
POSITION_EPS
#define POSITION_EPS
Definition: config.h:172
GNETagProperties::getGUIIcon
GUIIcon getGUIIcon() const
get GUI icon associated to this Tag
Definition: GNETagProperties.cpp:233
GNEViewNetHelper::EditModes::isCurrentSupermodeNetwork
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
Definition: GNEViewNetHelper.cpp:1929
GNELane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
GNELane2laneConnection::exist
bool exist(const GNELane *toLane) const
check if exist a lane2lane geometry for the given tolane
Definition: GNELane2laneConnection.cpp:74
GLO_E2DETECTOR
@ GLO_E2DETECTOR
a E2 detector
Definition: GUIGlObjectTypes.h:90
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:292
GNEUndoList.h
GNEChange_Connection.h
GNEConnection.h