67 myTransformToVehicle(
nullptr),
68 myTransformToVehicleWithEmbeddedRoute(
nullptr),
69 myTransformToRouteFlow(
nullptr),
70 myTransformToRouteFlowWithEmbeddedRoute(
nullptr),
71 myTransformToTrip(
nullptr),
72 myTransformToFlow(
nullptr) {
74 myVehicle->buildPopupHeader(
this, app);
76 myVehicle->buildCenterPopupEntry(
this);
77 myVehicle->buildPositionCopyEntry(
this,
false);
79 new FXMenuCommand(
this, (
"Copy " + myVehicle->getTagStr() +
" name to clipboard").c_str(),
nullptr,
this,
MID_COPY_NAME);
80 new FXMenuCommand(
this, (
"Copy " + myVehicle->getTagStr() +
" typed name to clipboard").c_str(),
nullptr,
this,
MID_COPY_TYPED_NAME);
81 new FXMenuSeparator(
this);
83 myVehicle->getViewNet()->buildSelectionACPopupEntry(
this, myVehicle);
84 myVehicle->buildShowParamsPopupEntry(
this);
93 FXMenuPane* transformOperation =
new FXMenuPane(
this);
94 this->insertMenuPaneChild(transformOperation);
95 new FXMenuCascade(
this,
"transform to",
nullptr, transformOperation);
98 myTransformToVehicleWithEmbeddedRoute =
new FXMenuCommand(transformOperation,
"Vehicle (embedded route)", vehicleIcon,
this,
MID_GNE_VEHICLE_TRANSFORM);
99 myTransformToRouteFlow =
new FXMenuCommand(transformOperation,
"RouteFlow", routeFlowIcon,
this,
MID_GNE_VEHICLE_TRANSFORM);
100 myTransformToRouteFlowWithEmbeddedRoute =
new FXMenuCommand(transformOperation,
"RouteFlow (embedded route)", routeFlowIcon,
this,
MID_GNE_VEHICLE_TRANSFORM);
105 if (myVehicle->getDemandElementParents().size() > 1) {
106 myTransformToVehicle->disable();
108 myTransformToVehicleWithEmbeddedRoute->disable();
111 if (myVehicle->getDemandElementParents().size() > 1) {
112 myTransformToRouteFlow->disable();
114 myTransformToRouteFlowWithEmbeddedRoute->disable();
116 }
else if (myVehicle->getTagProperty().getTag() ==
SUMO_TAG_TRIP) {
117 myTransformToTrip->disable();
118 }
else if (myVehicle->getTagProperty().getTag() ==
SUMO_TAG_FLOW) {
119 myTransformToFlow->disable();
152 mySelectedVehicles(selectedVehicle),
160 myTransformAllVehiclesToVehicle(nullptr),
161 myTransformAllVehiclesToVehicleWithEmbeddedRoute(nullptr),
162 myTransformAllVehiclesToRouteFlow(nullptr),
163 myTransformAllVehiclesToRouteFlowWithEmbeddedRoute(nullptr),
164 myTransformAllVehiclesToTrip(nullptr),
165 myTransformAllVehiclesToFlow(nullptr) {
172 new FXMenuCommand(
this, (
"Copy " + vehicle->
getTagStr() +
" name to clipboard").c_str(),
nullptr,
this,
MID_COPY_NAME);
174 new FXMenuSeparator(
this);
186 FXMenuPane* transformOperation =
new FXMenuPane(
this);
188 new FXMenuCascade(
this,
"transform to",
nullptr, transformOperation);
203 new FXMenuSeparator(transformOperation);
263 {}, {}, {}, {}, {vehicleType, route}, {}, {}, {}, {}, {}),
270 vtypeid = vehicleType->getID();
276 {}, {}, {}, {}, {vehicleType, route}, {}, {}, {}, {}, {}),
281 id = vehicleParameters.id;
283 vtypeid = vehicleType->getID();
289 {}, {}, {}, {}, {vehicleType}, {}, {}, {}, {}, {}),
294 id = vehicleParameters.id;
298 vtypeid = vehicleType->getID();
304 {}, {}, {}, {}, {vehicleType}, {}, {}, {}, {}, {}),
315 {}, {}, {}, {}, {vehicleType}, {}, {}, {}, {}, {}),
330 std::string departStr;
337 departStr.reserve(20 - departStr.size());
339 for (
int i = (
int)departStr.size(); i < 20; i++) {
340 departStr.insert(departStr.begin(),
'0');
373 if (
via.size() > 0) {
398 i->writeDemandElement(device);
434 return (
"Edge '" +
getEdgeParents().at((
int)i - 1)->getID() +
"' and edge '" +
getEdgeParents().at(i)->getID() +
"' aren't consecutives");
500 std::vector<std::string> FromViaToEdges;
504 FromViaToEdges.insert(FromViaToEdges.end(),
via.begin(),
via.end());
510 if (route.size() > 0) {
558 if (lane ==
nullptr) {
570 std::vector<std::vector<ConnectionGeometry> > connectionGeometryMatrix;
574 connectionGeometryMatrix.push_back(std::vector<ConnectionGeometry>());
590 std::vector<ConnectionGeometry> connectionGeometriesFiltered;
592 for (
int i = 0; i < (int)connectionGeometryMatrix.size(); i++) {
594 const auto& currentColumn = connectionGeometryMatrix.at(i);
595 const auto& nextColumn = ((i + 1) < (
int)connectionGeometryMatrix.size()) ? connectionGeometryMatrix.at(i + 1) : std::vector<ConnectionGeometry>();
600 if (currentColumn.empty()) {
603 }
else if (currentColumn.size() == 1) {
605 connectionGeometriesFiltered.push_back(currentColumn.front());
610 for (
auto currentConnection = currentColumn.begin(); currentConnection != currentColumn.end() && !stop; currentConnection++) {
612 const GNELane* previousLane = (connectionGeometriesFiltered.size() > 0) ? connectionGeometriesFiltered.back().laneTo :
nullptr;
616 for (
auto nextConnection = nextColumn.cbegin(); (nextConnection != nextColumn.cend()) && !stop; nextConnection++) {
617 if ((previousLane == currentConnection->laneFrom) && (currentConnection->laneTo == nextConnection->laneFrom)) {
618 connectionGeometriesFiltered.push_back(*currentConnection);
624 for (
auto nextConnection = nextColumn.cbegin(); (nextConnection != nextColumn.cend()) && !stop; nextConnection++) {
625 if (currentConnection->laneTo == nextConnection->laneFrom) {
626 connectionGeometriesFiltered.push_back(*currentConnection);
639 for (
auto connectionGeometry = connectionGeometriesFiltered.begin(); connectionGeometry != connectionGeometriesFiltered.end(); connectionGeometry++) {
641 connectionGeometry->calculateConnectionShape();
643 if (connectionGeometry == connectionGeometriesFiltered.begin()) {
645 auto laneGeometry = (connectionGeometry->laneFrom) ? connectionGeometry->laneFrom->
getGeometry() :
getEdgeParents().at(0)->getLaneByVClass(
getVClass())->getGeometry();
647 for (
int i = 0; i < (int)laneGeometry.shape.size(); i++) {
648 if (i < (
int)laneGeometry.shape.size() - 1) {
650 laneGeometry.shape[i],
651 laneGeometry.shapeLengths[i],
652 laneGeometry.shapeRotations[i],
true,
true);
655 laneGeometry.shape[i],
true,
true);
660 if (connectionGeometry->con) {
662 for (
const auto& connectionShapePos : connectionGeometry->connectionShape) {
666 for (
int i = 0; i < (int)connectionGeometry->laneTo->getGeometry().shape.size(); i++) {
667 if (i < (
int)connectionGeometry->laneTo->getGeometry().shape.size() - 1) {
669 connectionGeometry->laneTo->getGeometry().shape[i],
670 connectionGeometry->laneTo->getGeometry().shapeLengths[i],
671 connectionGeometry->laneTo->getGeometry().shapeRotations[i],
true,
true);
674 connectionGeometry->laneTo->getGeometry().shape[i],
true,
true);
677 }
else if ((connectionGeometry + 1) != connectionGeometriesFiltered.end()) {
679 for (
int i = 0; i < (int)(connectionGeometry + 1)->laneFrom->getGeometry().shape.size(); i++) {
680 if (i < (
int)(connectionGeometry + 1)->laneFrom->getGeometry().shape.size() - 1) {
682 (connectionGeometry + 1)->laneFrom->getGeometry().shape[i],
683 (connectionGeometry + 1)->laneFrom->getGeometry().shapeLengths[i],
684 (connectionGeometry + 1)->laneFrom->getGeometry().shapeRotations[i],
true,
true);
687 (connectionGeometry + 1)->laneFrom->getGeometry().shape[i],
true,
true);
692 for (
int i = 0; i < (int)connectionGeometry->laneTo->getGeometry().shape.size(); i++) {
693 if (i < (
int)connectionGeometry->laneTo->getGeometry().shape.size() - 1) {
695 connectionGeometry->laneTo->getGeometry().shape[i],
696 connectionGeometry->laneTo->getGeometry().shapeLengths[i],
697 connectionGeometry->laneTo->getGeometry().shapeRotations[i],
true,
true);
700 connectionGeometry->laneTo->getGeometry().shape[i],
true,
true);
729 return Position((A.
x() + B.
x()) / 2, (A.
y() + B.
y()) / 2);
739 std::vector<GNEVehicle*> selectedVehicles;
740 selectedVehicles.reserve(selectedDemandElements.size());
741 for (
const auto& i : selectedDemandElements) {
742 if (i->getTagProperty().isVehicle()) {
743 selectedVehicles.push_back(dynamic_cast<GNEVehicle*>(i));
770 vehicleBoundary.
add(
getFromEdge()->getLanes().front()->getGeometry().shape.front());
771 vehicleBoundary.
grow(20);
772 return vehicleBoundary;
784 double vehicleSizeSquared = width * length * exaggeration * width * length * exaggeration;
789 double vehicleRotation = 0;
813 glRotated(vehicleRotation, 0, 0, 1);
815 glTranslated(0, (-1) * length, 0);
833 glRotated(vehicleRotation, 0, 0, 1);
835 glTranslated(0, (-1) * length, 0);
838 double upscaleLength = exaggeration;
839 if ((exaggeration > 1) && (length > 5)) {
841 upscaleLength =
MAX2(1.0, upscaleLength * (5 + sqrt(length - 5)) / length);
843 glScaled(exaggeration, upscaleLength, 1);
874 glColor3d(0., 1., 0.);
877 glVertex2d(0., minGap);
878 glVertex2d(-.5, minGap);
879 glVertex2d(.5, minGap);
883 glTranslated(0,
MIN2(length / 2,
double(5)), -
getType());
884 glScaled(1 / exaggeration, 1 / upscaleLength, 1);
885 glRotated(-1 * vehicleRotation, 0, 0, 1);
1138 return canParse<RGBColor>(value);
1140 int dummyDepartLane;
1144 if (error.empty()) {
1155 double dummyDepartPos;
1159 return error.empty();
1162 double dummyDepartSpeed;
1166 if (error.empty()) {
1177 int dummyArrivalLane;
1181 return error.empty();
1184 double dummyArrivalPos;
1188 return error.empty();
1191 double dummyArrivalSpeed;
1195 return error.empty();
1200 return canParse<int>(value) && parse<int>(value) >= 0;
1202 return canParse<int>(value) && parse<int>(value) >= 0;
1206 double dummyDepartPosLat;
1210 return error.empty();
1213 double dummyArrivalPosLat;
1217 return error.empty();
1225 return error.empty();
1238 if (value.empty()) {
1241 return canParse<std::vector<GNEEdge*> >(
myViewNet->
getNet(), value,
false);
1245 if (canParse<double>(value)) {
1246 return (parse<double>(value) >= 0);
1251 if (value.empty()) {
1253 }
else if (canParse<double>(value)) {
1254 return (parse<double>(value) >= 0);
1259 if (value.empty()) {
1261 }
else if (canParse<double>(value)) {
1262 return (parse<double>(value) > 0);
1267 if (value.empty()) {
1269 }
else if (canParse<double>(value)) {
1270 return (parse<double>(value) > 0);
1275 if (value.empty()) {
1277 }
else if (canParse<double>(value)) {
1278 return (parse<double>(value) >= 0);
1283 if (canParse<int>(value)) {
1284 return (parse<int>(value) >= 0);
1290 return canParse<bool>(value);
1318 }
else if (newParametersSet & VEHPARS_END_SET) {
1320 }
else if (newParametersSet & VEHPARS_NUMBER_SET) {
1331 }
else if (newParametersSet & VEHPARS_END_SET) {
1333 }
else if (newParametersSet & VEHPARS_NUMBER_SET) {
1344 }
else if (newParametersSet & VEHPARS_END_SET) {
1346 }
else if (newParametersSet & VEHPARS_NUMBER_SET) {
1400 for (
const auto& i :
via) {
1418 laneFrom(_laneFrom),
1536 double hue = 180. + atan2(center.
x() - p.
x(), center.
y() - p.
y()) * 180. /
M_PI;
1545 double hue = 180. + atan2(center.
x() - p.
x(), center.
y() - p.
y()) * 180. /
M_PI;
1554 double hue = 180. + atan2(pb.
x() - pe.
x(), pb.
y() - pe.
y()) * 180. /
M_PI;
1557 double sat = pb.
distanceTo(pe) / minp.distanceTo(maxp);
1562 std::hash<const GNEVehicle*> ptr_hash;
1563 const double hue = (double)(ptr_hash(
this) % 360);
1564 const double sat = ((ptr_hash(
this) / 360) % 67) / 100.0 + 0.33;
1581 result += i.first +
"=" + i.second +
"|";
1584 if (!result.empty()) {
1591 std::vector<std::pair<std::string, std::string> >
1593 std::vector<std::pair<std::string, std::string> > result;
1596 result.push_back(std::make_pair(i.first, i.second));
1607 std::vector<std::string> parsedValues;
1610 parsedValues.push_back(stValues.
next());
1613 for (
auto i : parsedValues) {
1614 std::vector<std::string> parsedParameters;
1617 parsedParameters.push_back(stParam.
next());
1621 setParameter(parsedParameters.front(), parsedParameters.back());
1647 color = parse<RGBColor>(value);
1801 std::string oldDepart =
getBegin();
1827 if (!value.empty()) {
1829 via = parse< std::vector<std::string> >(value);
1866 if (parse<bool>(value)) {
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
const TagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
void compute()
compute demand element
bool hasTagSynonym() const
return true if tag correspond to an element that will be written in XML with another tag ...
std::string getParentName() const
Returns the name of the parent object.
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
Copy object name - popup entry.
SUMOTime repetitionEnd
The time at which the flow ends (only needed when using repetitionProbability)
struct used for calculating routes
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
static const RGBColor BLUE
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
double ymin() const
Returns minimum y-coordinate.
std::vector< GNEEdge * > calculateDijkstraRoute(SUMOVehicleClass vClass, const std::vector< GNEEdge *> &partialEdges) const
calculate Dijkstra route between a list of partial edges
SumoXMLTag
Numbers representing SUMO-XML - element names.
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
double xmax() const
Returns maximum x-coordinate.
RGBColor color
The vehicle's color, TraCI may change this.
A structure which describes a connection between edges or lanes.
static void transformToVehicle(GNEVehicle *originalVehicle, bool createEmbeddedRoute)
transform vehicle functions
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
SumoXMLTag getTagSynonym() const
get tag synonym
double scale
information about a lane's width (temporary, used for a single view)
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(...)
description of a vehicle type
static bool parseArrivalPosLat(const std::string &val, const std::string &element, const std::string &id, double &pos, ArrivalPosLatDefinition &apd, std::string &error)
Validates a given arrivalPosLat value.
void addedLockedObject(const GUIGlObjectType type)
set object selected
PositionVector shape
The shape of the netElement element.
GNEEdge * myFromEdge
from edge (used by flows and trips)
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
void append(const PositionVector &v, double sameThreshold=2.0)
NBEdge * toEdge
The edge the connections yields in.
std::string vtypeid
The vehicle's type id.
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
static void drawAction_drawVehicleAsBoxPlus(const double width, const double length)
draw vehicle as a Box
GUIVisualizationTextSettings personName
a flow definitio nusing a from-to edges instead of a route (used by router)
void startGeometryMoving()
ArrivalLaneDefinition
Possible ways to choose the arrival lane.
RGBColor selectedVehicleColor
vehicle selection color
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
static RGBColor fromHSV(double h, double s, double v)
Converts the given hsv-triplet to rgb, inspired by http://alvyray.com/Papers/CG/hsv2rgb.htm.
static const RGBColor WHITE
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
a flow definition nusing a route instead of a from-to edges route (used in NETEDIT) ...
const int VEHPARS_PROB_SET
Stores the information about how to visualize structures.
std::string getArrivalSpeed() const
obtain arrival speed parameter in string format
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
GNEViewParent * getViewParent() const
get the net object
double y() const
Returns the y-position.
void endGeometryMoving()
end geometry movement
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children) ...
const std::string & getDefaultValue(SumoXMLAttr attr) const
return the default value of the attribute of an element
The representation of a single edge during network building.
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
bool geometryDeprecated
mark geometry as deprecated (used to avoid multiple updates)
double repetitionProbability
The probability for emitting a vehicle per second.
static void transformToTrip(GNEVehicle *originalVehicle)
transform to trip
static void drawTextSettings(const GUIVisualizationTextSettings &settings, const std::string &text, const Position &pos, const double scale, const double angle=0, const double layer=2048)
int parametersSet
Information for the router which parameter were set, TraCI may modify this (whe changing color) ...
std::string time2string(SUMOTime t)
GUIVisualizationTextSettings vehicleName
double x() const
Returns the x-position.
const RGBColor & getColor() const
get color
std::string getArrivalPosLat() const
obtain arrival pos lat parameter in string format
ArrivalPosLatDefinition arrivalPosLatProcedure
Information how the vehicle shall choose the lateral arrival position.
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute) ...
void insertEdgeLengthRotSegment(const GNEDemandElement *element, const GNEEdge *edge, const Position pos, double length, double rotation, const bool visible, const bool valid)
insert edge segment with length and rotation (used to avoid unnecessary calculation in calculateParti...
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
weights: time range begin
double arrivalPosLat
(optional) The lateral position the vehicle shall arrive on
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
std::string getDepartPosLat() const
obtain depart pos lat parameter in string format
NBEdge * getTurnDestination(bool possibleDestination=false) const
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
const int VEHPARS_ARRIVALLANE_SET
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle's end speed shall be chosen.
void changeDemandElementID(const std::string &newID)
change ID of demand element
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
bool hasNext()
returns the information whether further substrings exist
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
ArrivalPosLatDefinition
Possible ways to choose the departure position.
const Boundary & getBoundary() const
returns the bounder of the network
GNEVehicle(SumoXMLTag tag, GNEViewNet *viewNet, const std::string &vehicleID, GNEDemandElement *vehicleType, GNEDemandElement *route)
default constructor for vehicles and routeFlows without embedded routes
const int VEHPARS_NUMBER_SET
const std::string DEFAULT_VTYPE_ID
static bool isValidGenericParameterKey(const std::string &value)
whether the given string is a valid key for a generic parameter
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used, also builds an entry for copying the geo-position.
A class that stores a 2D geometrical boundary.
static RouteCalculator * getRouteCalculatorInstance()
obtain instance of RouteCalculator
PositionVector customShape
custom shape for connection
begin/end of the description of a route
static const double vehicleShapes
details for draw person as shapes
GNEEdge * getToEdge() const
obtain to edge of this demand element
SUMOTime repetitionOffset
The time offset between vehicle reinsertions.
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
static OptionsCont & getOptions()
Retrieves the options.
const std::vector< GNEEdge * > & getEdgeParents() const
get edge parents
friend class GNEChange_EnableAttribute
const std::vector< GNEDemandElement * > & getDemandElementChildren() const
return vector of demand elements that have as Parent this edge (For example, Calibrators) ...
const int VEHPARS_ARRIVALSPEED_SET
double area() const
Returns the area (0 for non-closed)
static void transformToFlow(GNEVehicle *originalVehicle)
transform to flow
PositionVector shape
shape of Connection
GUIColorer vehicleColorer
The vehicle colorer.
const GNELane * laneFrom
lane from
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes ...
NBEdge * getNBEdge() const
returns the internal NBEdge
double departSpeed
(optional) The initial speed of the vehicle
SUMOVehicleParameter()
Constructor.
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
static void drawAction_drawVehicleAsTrianglePlus(const double width, const double length)
draw vehicle as a triangle
const GNELane * laneTo
lane to
std::vector< double > shapeRotations
The rotations of the single shape parts.
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
LockGLObjectTypes * getLockGLObjectTypes() const
get selected items Modul
static bool isValidGenericParameterValue(const std::string &value)
whether the given string is a valid value for a generic parameter
DepartLaneDefinition
Possible ways to choose a lane on depart.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
std::vector< GNEDemandElement * > retrieveDemandElements(bool onlySelected=false) const
return all demand elements
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
GNEEdge & getParentEdge()
Returns underlying parent edge.
std::string routeid
The vehicle's route id.
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
const int VEHPARS_DEPARTSPEED_SET
int getNumLanes() const
Returns the number of lanes.
std::string getDepartPos() const
obtain depart pos parameter in string format
const NBEdge::Connection * con
Pointer to NBEdge::Connection.
A point in 2D or 3D with translation and scaling methods.
DemandElementSegmentGeometry myDemandElementSegmentGeometry
demand element segment geometry
std::string getAttribute(SumoXMLAttr key) const
Supermode currentSupermode
the current supermode
double scaledSize(double scale, double constFactor=0.1) const
get scale size
bool drawMinGap
Information whether the minimum gap shall be drawn.
static bool isGenericParametersValid(const std::string &value)
check if given string can be parsed to a map/list of generic parameters
void removeLockedObject(const GUIGlObjectType type)
set object unselected
static const RGBColor DEFAULT_COLOR
The default color (for vehicle types and vehicles)
GNEEdge * getFromEdge() const
friend class GNEChange_Attribute
declare friend class
std::string getArrivalPos() const
obtain arrival pos parameter in string format
bool isAttributeEnabled(SumoXMLAttr key) const
void changeDemandElementParent(GNEShape *shapeTobeChanged, const std::string &newDemandElementParentID, int demandElementParentIndex)
change first demand element parent of a shape
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
const int VEHPARS_DEPARTPOSLAT_SET
void calculatePartialShapeRotationsAndLengths()
calculate partial shape, rotations and lengths
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
SUMOTime string2time(const std::string &r)
void write(OutputDevice &dev, const OptionsCont &oc, const SumoXMLTag tag=SUMO_TAG_VEHICLE, const std::string &typeID="") const
Writes the parameters as a beginning element.
const std::string & getDemandElementID() const
returns DemandElement ID
double xmin() const
Returns minimum x-coordinate.
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
const int VEHPARS_ROUTE_SET
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_NMODE_SELECT
transform vehicle to another vehicle type (ej: flow to trip)
Boundary & grow(double by)
extends the boundary by the given amount
static bool parseArrivalLane(const std::string &val, const std::string &element, const std::string &id, int &lane, ArrivalLaneDefinition &ald, std::string &error)
Validates a given arrivalLane value.
void insertEdgeSegment(const GNEDemandElement *element, const GNEEdge *edge, const Position pos, const bool visible, const bool valid)
insert edge segment
const std::string getID() const
function to support debugging
double angle
The current view rotation angle.
PositionVector connectionShape
calculated connection shape
void clearDemandElementSegmentGeometry()
clear demand element geometry
const NetElementGeometry & getGeometry() const
const T getColor(const double value) const
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
const int VEHPARS_PERIOD_SET
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
const int VEHPARS_COLOR_SET
int personNumber
The static number of persons in the vehicle when it departs (not including boarding persons) ...
static const double vehicleBoxes
details for draw person as boxes
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
std::string getArrivalLane() const
obtain arrival lane parameter in string format
std::vector< double > shapeLengths
The lengths of the single shape parts.
const int VEHPARS_END_SET
int departLane
(optional) The lane the vehicle shall depart from (index in edge)
std::string line
The vehicle's line (mainly for public transport)
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
begin/end of the description of an edge
double arrivalPos
(optional) The position the vehicle shall arrive on
DepartSpeedDefinition
Possible ways to choose the departure speed.
static void drawAction_drawVehicleAsPoly(const GUIVisualizationSettings &s, const SUMOVehicleShape shape, const double width, const double length, int carriageIndex=-1)
draw vehicle as a polygon
bool areEdgesConsecutives(SUMOVehicleClass vClass, GNEEdge *from, GNEEdge *to) const
check if exist a route between the two given consecutives edges
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element
const PositionVector & getShape() const
retrieve the junction shape
const int VEHPARS_VIA_SET
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
void selectAttributeCarrier(bool changeFlag=true)
inherited from GNEAttributeCarrier
std::vector< std::string > via
List of the via-edges the vehicle must visit.
static void drawShapeDottedContourRectangle(const GUIVisualizationSettings &s, const int type, const Position ¢er, const double width, const double height, const double rotation=0, const double offsetX=0, const double offsetY=0)
draw a dotted contour around the given Position with certain width and height
const int VEHPARS_ARRIVALPOSLAT_SET
double departPosLat
(optional) The lateral position the vehicle shall depart from
const int VEHPARS_LINE_SET
A road/street connecting two junctions (netedit-version)
GUIVisualizationDetailSettings detailSettings
detail settings
const int VEHPARS_ARRIVALPOS_SET
const std::vector< GNEDemandElement * > & getDemandElementParents() const
return vector of demand elements that have as Parent this edge (For example, Calibrators) ...
static const double vehicleTriangles
details for draw person as triangles
bool showNonInspectedDemandElements(const GNEDemandElement *demandElement) const
check if non inspected element has to be hidden
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
ConnectionGeometry()
default constructor (by default unused)
double departPos
(optional) The position the vehicle shall depart from
void updateDemandElementBegin(const std::string &oldBegin, GNEDemandElement *demandElement)
update demand element begin in container
bool showDemandElements() const
check if show demand elements checkbox is enabled
static const RGBColor RED
named colors
Structure representing possible vehicle parameter.
void deselect(GUIGlID id)
Deselects the object with the given id.
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
double length() const
Returns the length.
static void transformToRouteFlow(GNEVehicle *originalVehicle, bool createEmbeddedRoute)
transform routeFlow over an existent route
std::string getDepartLane() const
obtain depart lane parameter in string format
double getAttributeDouble(SumoXMLAttr key) const
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
PositionVector viaShape
shape of via
void updateGeometry()
update pre-computed geometry information
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
static bool parseDepartPos(const std::string &val, const std::string &element, const std::string &id, double &pos, DepartPosDefinition &dpd, std::string &error)
Validates a given departPos value.
const GNEAttributeCarrier * getDottedAC() const
get AttributeCarrier under cursor
const std::string & getTagStr() const
get tag assigned to this object in string format
Demanding mode (Routes, Vehicles etc..)
static bool parseDepartPosLat(const std::string &val, const std::string &element, const std::string &id, double &pos, DepartPosLatDefinition &dpd, std::string &error)
Validates a given departPosLat value.
static bool parseArrivalSpeed(const std::string &val, const std::string &element, const std::string &id, double &speed, ArrivalSpeedDefinition &asd, std::string &error)
Validates a given arrivalSpeed value.
SumoXMLTag tag
The vehicle tag.
const int VEHPARS_DEPARTLANE_SET
std::string getBegin() const
get begin time of demand element
static bool parseArrivalPos(const std::string &val, const std::string &element, const std::string &id, double &pos, ArrivalPosDefinition &apd, std::string &error)
Validates a given arrivalPos value.
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions) ...
int containerNumber
The static number of containers in the vehicle when it departs.
static bool parseDepartSpeed(const std::string &val, const std::string &element, const std::string &id, double &speed, DepartSpeedDefinition &dsd, std::string &error)
Validates a given departSpeed value.
std::string getDepartSpeed() const
obtain depart speed parameter in string format
GNENet * getNet() const
get the net object
bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
bool wasSet(int what) const
Returns whether the given parameter was set.
GNEEdge * myToEdge
to edge (used by flows and trips)
GUIGlID getGlID() const
Returns the numerical id of the object.
Position getCenter() const
Returns the center of the boundary.
const int VEHPARS_VTYPE_SET
std::vector< Connection > getConnectionsFromLane(int lane, NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
void changeEdgeParents(GNEShape *elementChild, const std::string &newEdgeIDs)
change edge parents of a shape
GNEViewNet * myViewNet
The GNEViewNet this demand element element belongs.
std::string getGenericParametersStr() const
return generic parameters in string format
SUMOVehicleShape getVehicleShapeID(const std::string &name)
Returns the class id of the shape class given by its name.
GNEViewNet * getViewNet() const
Returns a pointer to GNEViewNet in which demand element element is located.
Static storage of an output device and its base (abstract) implementation.
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
const TagProperties & getTagProperty() const
get Tag Property assigned to this object
std::vector< Segment >::const_iterator begin() const
begin iterator
ArrivalPosDefinition
Possible ways to choose the arrival position.
void calculateConnectionShape()
calculate connection shape (note: Only calculated if 'con' isn't nullptr)
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
GUIVisualizationColorSettings colorSettings
color settings
GUIVisualizationSizeSettings vehicleSize
const int VEHPARS_VPH_SET
double arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
a single trip definition (used by router)
std::string getDepart() const
obtain depart parameter in string format
static bool isValidTypeID(const std::string &value)
whether the given string is a valid id for an edge or vehicle type
const int VEHPARS_DEPARTPOS_SET
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Position getPositionInView() const
Returns position of demand element in view.
const int VEHPARS_PERSON_NUMBER_SET
ArrivalSpeedDefinition
Possible ways to choose the arrival speed.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
bool haveVia
check if Connection have a Via
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
double ymax() const
Returns maximum y-coordinate.
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
DepartPosDefinition
Possible ways to choose the departure position.
FXDEFMAP(GNEVehicle::GNESingleVehiclePopupMenu) GNESingleVehiclePopupMenuMap[]
const int VEHPARS_CONTAINER_NUMBER_SET
PositionVector computeSmoothShape(const PositionVector &begShape, const PositionVector &endShape, int numPoints, bool isTurnaround, double extrapolateBeg, double extrapolateEnd, NBNode *recordError=0, int shapeFlag=0) const
Compute a smooth curve between the given geometries.
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
GUISelectedStorage gSelected
A global holder of selected objects.
Copy typed object name - popup entry.
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
NBNode * getToNode() const
Returns the destination node of the edge.
void insertJunctionSegment(const GNEDemandElement *element, const GNEJunction *junction, const Position pos, const bool visible, const bool valid)
insert junction segment
static bool isValidVehicleID(const std::string &value)
whether the given string is a valid id for a vehicle or flow
DepartDefinition
Possible ways to depart.
static bool parseDepart(const std::string &val, const std::string &element, const std::string &id, SUMOTime &depart, DepartDefinition &dd, std::string &error)
Validates a given depart value.
ArrivalPosDefinition arrivalPosProcedure
Information how the vehicle shall choose the arrival position.
std::string id
The vehicle's id.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
An Element which don't belongs to GNENet but has influency in the simulation.
GNEViewNet * getViewNet() const
get view net
void clearParameter()
Clears the parameter map.
static bool parseDepartLane(const std::string &val, const std::string &element, const std::string &id, int &lane, DepartLaneDefinition &dld, std::string &error)
Validates a given departLane value.
DepartPosLatDefinition departPosLatProcedure
Information how the vehicle shall choose the lateral departure position.