60 #ifdef CHECK_MEMORY_LEAKS 71 myFrequency(frequency),
74 myFlowValues(flowValues) {
128 Position s =
myShape[i] + Position(1, 0);
161 for (std::vector<GNECalibrator::GNECalibratorFlow*>::const_iterator i =
myFlowValues.begin(); i !=
myFlowValues.end(); ++i) {
208 std::vector<GNECalibrator::GNECalibratorFlow*>
258 for (
int i = 0; i < (int)
myShape.size(); ++i) {
262 glTranslated(pos.
x(), pos.
y(),
getType());
263 glRotated(rot, 0, 0, 1);
265 glScaled(exaggeration, exaggeration, 1);
266 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
268 glBegin(GL_TRIANGLES);
269 glColor3d(1, .8f, 0);
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);
280 if (s.
scale * exaggeration >= 1.) {
281 glTranslated(0, 0, .1);
286 glRotated(180, 0, 1, 0);
287 glTranslated(-w / 2., 2, 0);
289 glTranslated(w / 2., -2, 0);
362 return (canParse<SUMOReal>(value) && parse<SUMOReal>(value) >= 0);
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) {}
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,
595 int departLaneInt = -1;
596 if (GNEAttributeCarrier::canParse<int>(departLane)) {
597 departLaneInt = GNEAttributeCarrier::parse<int>(departLane);
599 if ((departLaneInt < 0) && (departLane !=
"random") && (departLane !=
"free") &&
600 (departLane !=
"allowed") && (departLane !=
"best") && (departLane !=
"first")) {
612 if (GNEAttributeCarrier::canParse<SUMOReal>(departPos)) {
613 departPosFloat = GNEAttributeCarrier::parse<SUMOReal>(departPos);
615 if ((departPosFloat < 0) && (departPos !=
"random") && (departPos !=
"free") &&
616 (departPos !=
"random_free") && (departPos !=
"base") && (departPos !=
"last")) {
628 if (GNEAttributeCarrier::canParse<SUMOReal>(departSpeed)) {
629 departSpeedDouble = GNEAttributeCarrier::parse<SUMOReal>(departSpeed);
631 if ((departSpeedDouble < 0) && (departSpeed !=
"random") && (departSpeed !=
"max")) {
642 int arrivalLaneInt = -1;
643 if (GNEAttributeCarrier::canParse<int>(arrivalLane)) {
644 arrivalLaneInt = GNEAttributeCarrier::parse<int>(arrivalLane);
646 if ((arrivalLaneInt < 0) && (arrivalLane !=
"current")) {
658 if (GNEAttributeCarrier::canParse<SUMOReal>(arrivalPos)) {
659 arrivalPosFloat = GNEAttributeCarrier::parse<SUMOReal>(arrivalPos);
661 if ((arrivalPosFloat < 0) && (arrivalPos !=
"random") && (arrivalPos !=
"max")) {
673 if (GNEAttributeCarrier::canParse<SUMOReal>(arrivalSpeed)) {
674 arrivalSpeedDouble = GNEAttributeCarrier::parse<SUMOReal>(arrivalSpeed);
676 if ((arrivalSpeedDouble < 0) && (arrivalSpeed !=
"current")) {
695 if (personNumber < 0) {
706 if (containerNumber < 0) {
739 if (vehsPerHour < 0) {
760 if ((probability < 0) || (probability > 1)) {
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
int pfDrawString(const char *c)
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
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)
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.
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'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)
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
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.
GNELane * retrieveLane(const std::string &id, bool failHard=true)
get lane by id
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)
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.
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
~GNECalibratorFlow()
destructor
void pfSetScale(SUMOReal s)
void insertFlow(GNECalibratorFlow *flow)
insert a new flow
An Element which don't belongs to GNENet but has influency in the simulation.
std::string myArrivalSpeed
arrival speed
bool setColor(std::string color)
set color of flow
int myNumber
number of vehicle
SUMOReal y() const
Returns the y-position.
RGBColor myBaseColor
base color (Default green)
std::vector< SUMOReal > myShapeRotations
GNENet * getNet() const
get the net object
SUMOReal pfdkGetStringWidth(const char *c)
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.
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.
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)
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.