SUMO - Simulation of Urban MObility
GNECalibrator.cpp
Go to the documentation of this file.
1 /****************************************************************************/
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software; you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation; either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #ifdef _MSC_VER
25 #include <windows_config.h>
26 #else
27 #include <config.h>
28 #endif
29 
30 #include <string>
31 #include <iostream>
32 #include <utility>
37 #include <utils/common/ToString.h>
38 #include <utils/geom/GeomHelper.h>
45 #include <utils/gui/div/GLHelper.h>
49 
50 #include "GNECalibrator.h"
51 #include "GNEEdge.h"
52 #include "GNELane.h"
53 #include "GNEViewNet.h"
54 #include "GNEUndoList.h"
55 #include "GNENet.h"
56 #include "GNEChange_Attribute.h"
57 #include "GNERouteProbe.h"
58 #include "GNECalibratorDialog.h"
59 
60 #ifdef CHECK_MEMORY_LEAKS
61 #include <foreign/nvwa/debug_new.h>
62 #endif
63 
64 
65 // ===========================================================================
66 // member method definitions
67 // ===========================================================================
68 
69 GNECalibrator::GNECalibrator(const std::string& id, GNEEdge* edge, GNEViewNet* viewNet, SUMOReal pos, SUMOReal frequency, const std::string& output, const std::vector<GNECalibrator::GNECalibratorFlow*>& flowValues) :
71  myFrequency(frequency),
72  myOutput(output),
73  myRouteProbe(NULL),
74  myFlowValues(flowValues) {
75  // This additional belong to a edge
76  myEdge = edge;
77  // this additional ISN'T movable
78  myMovable = false;
79  // Update geometry;
81  // Set Colors
82  myBaseColor = RGBColor(255, 255, 50, 0);
83  myBaseColorSelected = RGBColor(255, 255, 125, 255);
84  // Center view in the position of calibrator
85  myViewNet->centerTo(getGlID(), false);
86 }
87 
88 
90  // delete all flows of calibrator
91  for (std::vector<GNECalibratorFlow*>::iterator i = myFlowValues.begin(); i != myFlowValues.end(); i++) {
92  delete(*i);
93  }
94 }
95 
96 
97 void
99  // This additional cannot be moved
100 }
101 
102 
103 void
105  // This additional cannot be moved
106 }
107 
108 
109 void
111  // Clear all containers
112  myShapeRotations.clear();
113  myShapeLengths.clear();
114 
115  // clear Shape
116  myShape.clear();
117 
118  // Iterate over lanes
119  for (int i = 0; i < (int)myEdge->getLanes().size(); i++) {
120 
121  // Get shape of lane parent
122  myShape.push_back(myEdge->getLanes().at(i)->getShape().positionAtOffset(myEdge->getLanes().at(i)->getPositionRelativeToParametricLenght(myPosition.x())));
123 
124  // Obtain first position
125  Position f = myShape[i] - Position(1, 0);
126 
127  // Obtain next position
128  Position s = myShape[i] + Position(1, 0);
129 
130  // Save rotation (angle) of the vector constructed by points f and s
131  myShapeRotations.push_back(myEdge->getLanes().at(i)->getShape().rotationDegreeAtOffset(myEdge->getLanes().at(i)->getPositionRelativeToParametricLenght(myPosition.x())) * -1);
132  }
133 
134  // Refresh element (neccesary to avoid grabbing problems)
136 }
137 
138 
139 Position
141  return myPosition;
142 }
143 
144 void
146  // Open calibrator dialog
147  GNECalibratorDialog calibratorDialog(this);
148 }
149 
150 
151 void
153  // Write parameters
154  device.openTag(getTag());
155  device.writeAttr(SUMO_ATTR_ID, getID());
156  device.writeAttr(SUMO_ATTR_LANE, myEdge->getLanes().at(0)->getID());
160  // Write all flows of this calibrator
161  for (std::vector<GNECalibrator::GNECalibratorFlow*>::const_iterator i = myFlowValues.begin(); i != myFlowValues.end(); ++i) {
162  // Open flow tag
163  device.openTag(SUMO_TAG_FLOW);
164  // Write begin
165  device.writeAttr(SUMO_ATTR_BEGIN, (*i)->getBegin());
166  // Write nd
167  device.writeAttr(SUMO_ATTR_END, (*i)->getEnd());
168  // Write type
169  device.writeAttr(SUMO_ATTR_TYPE, (*i)->getType());
170  // Write route
171  device.writeAttr(SUMO_ATTR_ROUTE, (*i)->getRoute());
172  // Write color
173  device.writeAttr(SUMO_ATTR_COLOR, (*i)->getColor());
174  // Write depart lane
175  device.writeAttr(SUMO_ATTR_DEPARTLANE, (*i)->getDepartLane());
176  // Write depart pos
177  device.writeAttr(SUMO_ATTR_DEPARTPOS, (*i)->getDepartPos());
178  // Write depart speed
179  device.writeAttr(SUMO_ATTR_DEPARTSPEED, (*i)->getDepartSpeed());
180  // Write arrival lane
181  device.writeAttr(SUMO_ATTR_ARRIVALLANE, (*i)->getArrivalLane());
182  // Write arrival pos
183  device.writeAttr(SUMO_ATTR_ARRIVALPOS, (*i)->getArrivalPos());
184  // Write arrival speed
185  device.writeAttr(SUMO_ATTR_ARRIVALSPEED, (*i)->getArrivalSpeed());
186  // Write line
187  device.writeAttr(SUMO_ATTR_LINE, (*i)->getLine());
188  // Write person number
189  device.writeAttr(SUMO_ATTR_PERSON_NUMBER, (*i)->getPersonNumber());
190  // Write container number
191  device.writeAttr(SUMO_ATTR_CONTAINER_NUMBER, (*i)->getContainerNumber());
192  // Write vehsPerHour
193  device.writeAttr(SUMO_ATTR_VEHSPERHOUR, (*i)->getVehsPerHour());
194  // Write period
195  device.writeAttr(SUMO_ATTR_PERIOD, (*i)->getPeriod());
196  // Write probability
197  device.writeAttr(SUMO_ATTR_PROB, (*i)->getProbability());
198  // Write number
199  device.writeAttr(SUMO_ATTR_NUMBER, (*i)->getNumber());
200  // Close flow tag
201  device.closeTag();
202  }
203  // Close tag
204  device.closeTag();
205 }
206 
207 
208 std::vector<GNECalibrator::GNECalibratorFlow*>
210  return myFlowValues;
211 }
212 
213 
214 void
215 GNECalibrator::setFlowValues(std::vector<GNECalibrator::GNECalibratorFlow*> calibratorFlowValues) {
216  myFlowValues = calibratorFlowValues;
217 }
218 
219 
220 void
222  std::vector<GNECalibratorFlow*>::iterator i = std::find(myFlowValues.begin(), myFlowValues.end(), flow);
223  if (i == myFlowValues.end()) {
224  myFlowValues.push_back(flow);
225  } else {
226  throw InvalidArgument("Flow duplicated in calibrator with id = '" + getID() + "'");
227  }
228 
229 }
230 
231 
232 void
234  std::vector<GNECalibratorFlow*>::iterator i = std::find(myFlowValues.begin(), myFlowValues.end(), flow);
235  if (i != myFlowValues.end()) {
236  myFlowValues.erase(i);
237  } else {
238  throw InvalidArgument("Flow doesn't exitst in calibrator with id = '" + getID() + "'");
239  }
240 
241 }
242 
243 
244 const std::string&
246  return myEdge->getMicrosimID();
247 }
248 
249 
250 void
252  // get values
253  glPushName(getGlID());
254  glLineWidth(1.0);
255  const SUMOReal exaggeration = s.addSize.getExaggeration(s);
256 
257  glPushName(getGlID());
258  for (int i = 0; i < (int)myShape.size(); ++i) {
259  const Position& pos = myShape[i];
260  SUMOReal rot = myShapeRotations[i];
261  glPushMatrix();
262  glTranslated(pos.x(), pos.y(), getType());
263  glRotated(rot, 0, 0, 1);
264  glTranslated(0, 0, getType());
265  glScaled(exaggeration, exaggeration, 1);
266  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
267 
268  glBegin(GL_TRIANGLES);
269  glColor3d(1, .8f, 0);
270  // base
271  glVertex2d(0 - 1.4, 0);
272  glVertex2d(0 - 1.4, 6);
273  glVertex2d(0 + 1.4, 6);
274  glVertex2d(0 + 1.4, 0);
275  glVertex2d(0 - 1.4, 0);
276  glVertex2d(0 + 1.4, 6);
277  glEnd();
278 
279  // draw text
280  if (s.scale * exaggeration >= 1.) {
281  glTranslated(0, 0, .1);
282  glColor3d(0, 0, 0);
283  pfSetPosition(0, 0);
284  pfSetScale(3.f);
285  SUMOReal w = pfdkGetStringWidth("C");
286  glRotated(180, 0, 1, 0);
287  glTranslated(-w / 2., 2, 0);
288  pfDrawString("C");
289  glTranslated(w / 2., -2, 0);
290  }
291  glPopMatrix();
292  }
293  drawName(getCenteringBoundary().getCenter(), s.scale, s.addName);
294  glPopName();
295 }
296 
297 
298 std::string
300  switch (key) {
301  case SUMO_ATTR_ID:
302  return getAdditionalID();
303  case SUMO_ATTR_LANE:
304  return toString(myEdge->getLanes().at(0)->getAttribute(SUMO_ATTR_ID));
305  case SUMO_ATTR_POSITION:
306  return toString(myPosition.x());
307  case SUMO_ATTR_FREQUENCY:
308  return toString(myFrequency);
309  case SUMO_ATTR_OUTPUT:
310  return myOutput;
312  if (myRouteProbe) {
313  return myRouteProbe->getID();
314  } else {
315  return "";
316  }
317  default:
318  throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'");
319  }
320 }
321 
322 
323 void
324 GNECalibrator::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
325  if (value == getAttribute(key)) {
326  return; //avoid needless changes, later logic relies on the fact that attributes have changed
327  }
328  switch (key) {
329  case SUMO_ATTR_ID:
330  case SUMO_ATTR_LANE:
331  case SUMO_ATTR_POSITION:
332  case SUMO_ATTR_FREQUENCY:
333  case SUMO_ATTR_OUTPUT:
335  undoList->p_add(new GNEChange_Attribute(this, key, value));
336  updateGeometry();
337  break;
338  default:
339  throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'");
340  }
341 
342 }
343 
344 
345 bool
346 GNECalibrator::isValid(SumoXMLAttr key, const std::string& value) {
347  switch (key) {
348  case SUMO_ATTR_ID:
349  if (myViewNet->getNet()->getAdditional(getTag(), value) == NULL) {
350  return true;
351  } else {
352  return false;
353  }
354  case SUMO_ATTR_LANE:
355  if (myViewNet->getNet()->retrieveLane(value, false) != NULL) {
356  return true;
357  } else {
358  return false;
359  }
360  case SUMO_ATTR_POSITION:
361  case SUMO_ATTR_FREQUENCY:
362  return (canParse<SUMOReal>(value) && parse<SUMOReal>(value) >= 0);
363  case SUMO_ATTR_OUTPUT:
364  return isValidFileValue(value);
366  if (myViewNet->getNet()->getAdditional(SUMO_TAG_ROUTEPROBE, value) != NULL) {
367  return true;
368  } else {
369  return false;
370  }
371  default:
372  throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'");
373  }
374 }
375 
376 // ===========================================================================
377 // private
378 // ===========================================================================
379 
380 void
381 GNECalibrator::setAttribute(SumoXMLAttr key, const std::string& value) {
382  switch (key) {
383  case SUMO_ATTR_ID:
384  setAdditionalID(value);
385  break;
386  case SUMO_ATTR_LANE:
387  changeLane(value);
388  break;
389  case SUMO_ATTR_POSITION:
390  myPosition = Position(parse<SUMOReal>(value), 0);
391  updateGeometry();
392  getViewNet()->update();
393  break;
394  case SUMO_ATTR_FREQUENCY:
395  myFrequency = parse<SUMOReal>(value);
396  break;
397  case SUMO_ATTR_OUTPUT:
398  myOutput = value;
399  break;
402  break;
403  default:
404  throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'");
405  }
406 }
407 
408 
409 // ===========================================================================
410 // Calibrator Flow
411 // ===========================================================================
412 
413 
414 GNECalibrator::GNECalibratorFlow::GNECalibratorFlow(GNECalibrator* calibratorParent, std::string type, std::string route) :
415  myCalibratorParent(calibratorParent), myType(type), myRoute(route), myColor(""), myDepartLane("first"),
416  myDepartPos("base"), myDepartSpeed("0"), myArrivalLane("current"), myArrivalPos("max"), myArrivalSpeed("current"),
417  myLine(""), myPersonNumber(0), myContainerNumber(0), myBegin(0), myEnd(0), myVehsPerHour(0), myPeriod(0), myProbability(0), myNumber(0) {}
418 
419 
420 GNECalibrator::GNECalibratorFlow::GNECalibratorFlow(GNECalibrator* calibratorParent, std::string type, std::string route,
421  std::string color, std::string departLane, std::string departPos, std::string departSpeed, std::string arrivalLane,
422  std::string arrivalPos, std::string arrivalSpeed, std::string line, int personNumber, int containerNumber,
423  SUMOReal begin, SUMOReal end, SUMOReal vehsPerHour, SUMOReal period, SUMOReal probability, int number) :
424  myCalibratorParent(calibratorParent), myType(type), myRoute(route), myColor(""), myDepartLane("first"),
425  myDepartPos("base"), myDepartSpeed("0"), myArrivalLane("current"), myArrivalPos("max"), myArrivalSpeed("current"),
427  // set parameters using the set functions, to avoid non valid values
428  setColor(color);
429  setDepartLane(departLane);
430  setDepartPos(departPos);
431  setDepartSpeed(departSpeed);
432  setArrivalLane(arrivalLane);
433  setArrivalPos(arrivalPos);
434  setArrivalSpeed(arrivalSpeed);
435  setLine(line);
436  setPersonNumber(personNumber);
437  setContainerNumber(containerNumber);
438  setBegin(begin);
439  setEnd(end);
440  setVehsPerHour(vehsPerHour);
441  setPeriod(period);
442  setProbability(probability);
443  setNumber(number);
444 }
445 
446 
448 
449 
452  return myCalibratorParent;
453 }
454 
455 
456 const std::string&
458  return myType;
459 }
460 
461 
462 const std::string&
464  return myRoute;
465 }
466 
467 
468 const std::string&
470  return myColor;
471 }
472 
473 
474 const std::string&
476  return myDepartLane;
477 }
478 
479 
480 const std::string&
482  return myDepartPos;
483 }
484 
485 
486 const std::string&
488  return myDepartSpeed;
489 }
490 
491 
492 const std::string&
494  return myArrivalLane;
495 }
496 
497 
498 const std::string&
500  return myArrivalPos;
501 }
502 
503 
504 const std::string&
506  return myArrivalSpeed;
507 }
508 
509 
510 const std::string&
512  return myLine;
513 }
514 
515 
516 int
518  return myPersonNumber;
519 }
520 
521 
522 int
524  return myContainerNumber;
525 }
526 
527 
528 SUMOReal
530  return myBegin;
531 }
532 
533 
534 SUMOReal
536  return myEnd;
537 }
538 
539 
540 SUMOReal
542  return myVehsPerHour;
543 }
544 
545 
546 SUMOReal
548  return myPeriod;
549 }
550 
551 
552 SUMOReal
554  return myProbability;
555 }
556 
557 
558 int
560  return myNumber;
561 }
562 
563 
564 bool
566  if (type.empty()) {
567  return false;
568  } else {
569  myType = type;
570  return true;
571  }
572 }
573 
574 
575 bool
577  if (route.empty()) {
578  return false;
579  } else {
580  myRoute = route;
581  return true;
582  }
583 }
584 
585 
586 bool
588  myColor = color;
589  return true;
590 }
591 
592 
593 bool
595  int departLaneInt = -1;
596  if (GNEAttributeCarrier::canParse<int>(departLane)) {
597  departLaneInt = GNEAttributeCarrier::parse<int>(departLane);
598  }
599  if ((departLaneInt < 0) && (departLane != "random") && (departLane != "free") &&
600  (departLane != "allowed") && (departLane != "best") && (departLane != "first")) {
601  return false;
602  } else {
603  myDepartLane = departLane;
604  return true;
605  }
606 }
607 
608 
609 bool
611  SUMOReal departPosFloat = -1;
612  if (GNEAttributeCarrier::canParse<SUMOReal>(departPos)) {
613  departPosFloat = GNEAttributeCarrier::parse<SUMOReal>(departPos);
614  }
615  if ((departPosFloat < 0) && (departPos != "random") && (departPos != "free") &&
616  (departPos != "random_free") && (departPos != "base") && (departPos != "last")) {
617  return false;
618  } else {
619  myDepartPos = departPos;
620  return true;
621  }
622 }
623 
624 
625 bool
627  SUMOReal departSpeedDouble = -1;
628  if (GNEAttributeCarrier::canParse<SUMOReal>(departSpeed)) {
629  departSpeedDouble = GNEAttributeCarrier::parse<SUMOReal>(departSpeed);
630  }
631  if ((departSpeedDouble < 0) && (departSpeed != "random") && (departSpeed != "max")) {
632  return false;
633  } else {
634  myDepartSpeed = departSpeed;
635  return true;
636  }
637 }
638 
639 
640 bool
642  int arrivalLaneInt = -1;
643  if (GNEAttributeCarrier::canParse<int>(arrivalLane)) {
644  arrivalLaneInt = GNEAttributeCarrier::parse<int>(arrivalLane);
645  }
646  if ((arrivalLaneInt < 0) && (arrivalLane != "current")) {
647  return false;
648  } else {
649  myDepartLane = arrivalLane;
650  return true;
651  }
652 }
653 
654 
655 bool
657  SUMOReal arrivalPosFloat = -1;
658  if (GNEAttributeCarrier::canParse<SUMOReal>(arrivalPos)) {
659  arrivalPosFloat = GNEAttributeCarrier::parse<SUMOReal>(arrivalPos);
660  }
661  if ((arrivalPosFloat < 0) && (arrivalPos != "random") && (arrivalPos != "max")) {
662  return false;
663  } else {
664  myDepartPos = arrivalPos;
665  return true;
666  }
667 }
668 
669 
670 bool
672  SUMOReal arrivalSpeedDouble = -1;
673  if (GNEAttributeCarrier::canParse<SUMOReal>(arrivalSpeed)) {
674  arrivalSpeedDouble = GNEAttributeCarrier::parse<SUMOReal>(arrivalSpeed);
675  }
676  if ((arrivalSpeedDouble < 0) && (arrivalSpeed != "current")) {
677  return false;
678  } else {
679  myDepartSpeed = arrivalSpeed;
680  return true;
681  }
682 }
683 
684 
685 bool
688  myLine = line;
689  return true;
690 }
691 
692 
693 bool
695  if (personNumber < 0) {
696  return false;
697  } else {
698  myPersonNumber = personNumber;
699  return true;
700  }
701 }
702 
703 
704 bool
706  if (containerNumber < 0) {
707  return false;
708  } else {
709  myContainerNumber = containerNumber;
710  return true;
711  }
712 }
713 
714 
715 bool
717  if (begin < 0) {
718  return false;
719  } else {
720  myBegin = begin;
721  return true;
722  }
723 }
724 
725 
726 bool
728  if (end < 0) {
729  return false;
730  } else {
731  myEnd = end;
732  return true;
733  }
734 }
735 
736 
737 bool
739  if (vehsPerHour < 0) {
740  return false;
741  } else {
742  myVehsPerHour = vehsPerHour;
743  return true;
744  }
745 }
746 
747 
748 bool
750  if (period < 0) {
751  return false;
752  } else {
753  myPeriod = period;
754  return true;
755  }
756 }
757 
758 bool
760  if ((probability < 0) || (probability > 1)) {
761  return false;
762  } else {
763  myProbability = probability;
764  return true;
765  }
766 }
767 
768 
769 bool
771  if (number < 0) {
772  return false;
773  } else {
774  myNumber = number;
775  return true;
776  }
777 }
778 
779 
780 /****************************************************************************/
SUMOReal getExaggeration(const GUIVisualizationSettings &s, SUMOReal factor=20) const
return the drawing size including exaggeration and constantSize values
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:256
int pfDrawString(const char *c)
Definition: polyfonts.c:1074
void writeAdditional(OutputDevice &device) const
writte additional element into a xml file
bool setDepartSpeed(std::string departSpeed)
set depart speed
int getContainerNumber() const
get number of containers
bool setPersonNumber(int personNumber)
set number of persons
a routeprobe detector
void setFlowValues(std::vector< GNECalibrator::GNECalibratorFlow * > calibratorFlowValues)
set Calbratorflow values
const std::string & getRoute() const
get route in which this flow is used
GUIVisualizationTextSettings addName
virtual void centerTo(GUIGlID id, bool applyZoom, SUMOReal zoomDist=20)
centers to the chosen artifact
SUMOReal getProbability() const
get probability of vehicle
std::string myRoute
route in which this flow is used
a flow definition (used by router)
std::string myDepartSpeed
depart speed
Stores the information about how to visualize structures.
SUMOReal getPeriod() const
get period of vehicle
void removeFlow(GNECalibratorFlow *flow)
remove a existent flow
bool setArrivalSpeed(std::string arrivalSpeed)
set arrival speed
~GNECalibrator()
Destructor.
std::string myType
type of flow
const std::string & getLine() const
get line of busStop/containerStop
void pfSetPosition(SUMOReal x, SUMOReal y)
Definition: polyfonts.c:480
std::vector< GNECalibrator::GNECalibratorFlow * > getFlowValues() const
get Calbratorflow values
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
SUMOReal getBegin() const
get begin time step
weights: time range begin
bool setVehsPerHour(SUMOReal vehsPerHour)
set vehicles per hour
SUMOReal myVehsPerHour
vehicles per hour
SUMOReal myEnd
time step end
GNERouteProbe * myRouteProbe
pointer to RouteProbe
std::string myDepartPos
depart position
bool setPeriod(SUMOReal period)
set period of vehicles
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
const std::string & getArrivalLane() const
get arrival lane
bool setNumber(int number)
set number of vehicles
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes ...
std::string myArrivalPos
arrival pos
SUMOReal x() const
Returns the x-position.
Definition: Position.h:63
int myPersonNumber
number of person
bool setBegin(SUMOReal begin)
set begin step
GUIGlID getGlID() const
Returns the numerical id of the object.
int myContainerNumber
number of container
void openAdditionalDialog()
open Calibrator Dialog
SUMOReal scale
information about a lane&#39;s width (temporary, used for a single view)
GNECalibrator * myCalibratorParent
pointer to calibrator parent
bool setArrivalLane(std::string arrivalLane)
set arrival lane
std::string myLine
line of bus/container stop
GNEViewNet * myViewNet
The GNEViewNet this additional element belongs.
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
GNECalibratorFlow(GNECalibrator *calibratorParent, std::string type, std::string route)
constructor
RGBColor myBaseColorSelected
base color selected (Default blue)
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
GNECalibrator(const std::string &id, GNEEdge *edge, GNEViewNet *viewNet, SUMOReal pos, SUMOReal frequency, const std::string &output, const std::vector< GNECalibrator::GNECalibratorFlow * > &flowValues)
Constructor.
GUIVisualizationSizeSettings addSize
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
bool setEnd(SUMOReal end)
set end step
static bool isValidFileValue(const std::string &value)
true if value is a valid file value
GNEViewNet * getViewNet() const
Returns a pointer to GNEViewNet in which additional element is located.
std::string myOutput
output of calibrator
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:55
std::vector< SUMOReal > myShapeLengths
The lengths of the shape parts.
bool myMovable
boolean to check if additional element is movable (with the mouse). By default true ...
const std::string & getAdditionalID() const
returns the ID of additional
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
void refreshAdditional(GNEAdditional *additional)
refreshes boundary information of an additional after a geometry update
Definition: GNENet.cpp:814
bool setRoute(std::string route)
set route in which this flow is used
std::string getAttribute(SumoXMLAttr key) const
PositionVector myShape
The shape of the additional element.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
GNELane * retrieveLane(const std::string &id, bool failHard=true)
get lane by id
Definition: GNENet.cpp:774
friend class GNEChange_Attribute
declare friend class
bool setContainerNumber(int containerNumber)
set number of container
void commmitAdditionalGeometryMoved(SUMOReal, SUMOReal, GNEUndoList *)
updated geometry changes in the attributes of additional
std::string myArrivalLane
arrival lane
std::vector< GNECalibratorFlow * > myFlowValues
Calbratorflow values.
std::string myColor
color of flow
bool setDepartPos(std::string departPos)
set depart position
void setAdditionalID(const std::string &id)
set the ID of additional
const std::string getID() const
function to support debugging
void drawName(const Position &pos, const SUMOReal scale, const GUIVisualizationTextSettings &settings, const SUMOReal angle=0) const
draw name of item
SUMOReal myProbability
probability
SUMOReal myBegin
time step begin
void changeLane(const std::string &laneID)
change lane of additional
int getNumber() const
get number of vehicles
SUMOReal getEnd() const
get end time step
SUMOReal getVehsPerHour() const
get vehicles per hour
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:54
Dialog for edit calibrators.
bool setLine(std::string line)
set line of busStop/containerStop
GNEAdditional * getAdditional(SumoXMLTag type, const std::string &id) const
Returns the named additional.
Definition: GNENet.cpp:1265
const std::string & getDepartPos() const
get depart position
bool setProbability(SUMOReal probability)
set probability of vehicle
bool setArrivalPos(std::string arrivalPos)
set arrival position
const std::vector< GNELane * > & getLanes()
returns a reference to the lane vector
Definition: GNEEdge.cpp:479
void pfSetScale(SUMOReal s)
Definition: polyfonts.c:465
void insertFlow(GNECalibratorFlow *flow)
insert a new flow
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:62
std::string myArrivalSpeed
arrival speed
weights: time range end
bool setColor(std::string color)
set color of flow
int myNumber
number of vehicle
SUMOReal y() const
Returns the y-position.
Definition: Position.h:68
RGBColor myBaseColor
base color (Default green)
std::vector< SUMOReal > myShapeRotations
GNENet * getNet() const
get the net object
Definition: GNEViewNet.cpp:989
SUMOReal pfdkGetStringWidth(const char *c)
Definition: polyfonts.c:1113
bool setDepartLane(std::string departLane)
set depart lane
SumoXMLTag getTag() const
get XML Tag assigned to this object
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
GNECalibrator * getCalibratorParent() const
get pointer to calibrator parent
Position myPosition
The position in which this additional element is located.
bool closeTag()
Closes the most recently opened tag.
#define SUMOReal
Definition: config.h:208
void updateGeometry()
update pre-computed geometry information
bool setType(std::string type)
set type of vehicle
SUMOReal myFrequency
Frequency of calibrator.
void moveAdditionalGeometry(SUMOReal, SUMOReal)
change the position of the calibrator geometry
const std::string & getDepartSpeed() const
get arrival speed
std::string myDepartLane
depart lane
GNEEdge * myEdge
The edge this additional belongs.
const std::string & getColor() const
get color of flow
const std::string & getParentName() const
Returns the name of the parent object (if any)
A color information.
int getPersonNumber() const
get number of persons
const std::string & getArrivalPos() const
get arrival position
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
const std::string & getArrivalSpeed() const
get arrival speed
const std::string & getType() const
get type of vehicle
const std::string & getDepartLane() const
get depart lane
Position getPositionInView() const
Returns position of Calibrator in view.