 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
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();
130 if (obj == myTransformToVehicle) {
132 }
else if (obj == myTransformToVehicleWithEmbeddedRoute) {
134 }
else if (obj == myTransformToRouteFlow) {
136 }
else if (obj == myTransformToRouteFlowWithEmbeddedRoute) {
138 }
else if (obj == myTransformToTrip) {
140 }
else if (obj == myTransformToFlow) {
152 mySelectedVehicles(selectedVehicle),
154 myTransformToVehicle(nullptr),
155 myTransformToVehicleWithEmbeddedRoute(nullptr),
156 myTransformToRouteFlow(nullptr),
157 myTransformToRouteFlowWithEmbeddedRoute(nullptr),
158 myTransformToTrip(nullptr),
159 myTransformToFlow(nullptr),
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);
221 for (
const auto& i : mySelectedVehicles) {
222 if ((obj == myTransformToVehicle) &&
223 (i->getTagProperty().getTag() == myVehicleTag)) {
225 }
else if ((obj == myTransformToVehicleWithEmbeddedRoute) &&
226 (i->getTagProperty().getTag() == myVehicleTag)) {
228 }
else if ((obj == myTransformToRouteFlow) &&
229 (i->getTagProperty().getTag() == myVehicleTag)) {
231 }
else if ((obj == myTransformToRouteFlowWithEmbeddedRoute) &&
232 (i->getTagProperty().getTag() == myVehicleTag)) {
234 }
else if ((obj == myTransformToTrip) &&
235 (i->getTagProperty().getTag() == myVehicleTag)) {
237 }
else if ((obj == myTransformToFlow) &&
238 (i->getTagProperty().getTag() == myVehicleTag)) {
240 }
else if (obj == myTransformAllVehiclesToVehicle) {
242 }
else if (obj == myTransformAllVehiclesToVehicleWithEmbeddedRoute) {
244 }
else if (obj == myTransformAllVehiclesToRouteFlow) {
246 }
else if (obj == myTransformAllVehiclesToRouteFlowWithEmbeddedRoute) {
248 }
else if (obj == myTransformAllVehiclesToTrip) {
250 }
else if (obj == myTransformAllVehiclesToFlow) {
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}, {}, {}, {}, {}, {}),
306 myFromEdge(fromEdge),
315 {}, {}, {}, {}, {vehicleType}, {}, {}, {}, {}, {}),
317 myFromEdge(fromEdge),
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);
1400 for (
const auto& i :
via) {
1418 laneFrom(_laneFrom),
1425 laneFrom(_laneFrom),
1435 const NBEdge* NBEdgeFrom = laneFrom->getParentEdge().getNBEdge();
1437 if (con->customShape.size() != 0) {
1438 connectionShape = con->customShape;
1440 if (con->shape.size() != 0) {
1441 connectionShape = con->shape;
1444 connectionShape.
append(con->viaShape);
1449 laneFrom->getGeometry().shape,
1450 laneTo->getGeometry().shape,
1453 (double) 5. * (
double) con->toEdge->getNumLanes());
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)) {
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void append(NBEdge *continuation)
append another edge
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_NMODE_SELECT
double getAttributeDouble(SumoXMLAttr key) const
GNEViewNet * myViewNet
The GNEViewNet this demand element element belongs.
static const double vehicleBoxes
details for draw person as boxes
int personNumber
The static number of persons in the vehicle when it departs (not including boarding persons)
static const RGBColor DEFAULT_COLOR
The default color (for vehicle types and vehicles)
struct used for calculating routes
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
int containerNumber
The static number of containers in the vehicle when it departs.
static void transformToVehicle(GNEVehicle *originalVehicle, bool createEmbeddedRoute)
transform vehicle functions
bool wasSet(int what) const
Returns whether the given parameter was set.
An Element which don't belongs to GNENet but has influency in the simulation.
static void drawTextSettings(const GUIVisualizationTextSettings &settings, const std::string &text, const Position &pos, const double scale, const double angle=0, const double layer=2048)
ArrivalPosDefinition
Possible ways to choose the arrival position.
int parametersSet
Information for the router which parameter were set, TraCI may modify this (whe changing color)
void startGeometryMoving()
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
void selectAttributeCarrier(bool changeFlag=true)
inherited from GNEAttributeCarrier
const std::string getID() const
function to support debugging
void updateGeometry()
update pre-computed geometry information
static RouteCalculator * getRouteCalculatorInstance()
obtain instance of RouteCalculator
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle's end speed shall be chosen.
void calculatePartialShapeRotationsAndLengths()
calculate partial shape, rotations and lengths
RGBColor color
The vehicle's color, TraCI may change this.
double ymin() const
Returns minimum y-coordinate.
std::string getArrivalPos() const
obtain arrival pos parameter in string format
Static storage of an output device and its base (abstract) implementation.
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
std::string getDepartSpeed() const
obtain depart speed parameter in string format
double angle
The current view rotation angle.
std::string getGenericParametersStr() const
return generic parameters in string format
void insertEdgeSegment(const GNEDemandElement *element, const GNEEdge *edge, const Position pos, const bool visible, const bool valid)
insert edge segment
bool hasNext()
returns the information whether further substrings exist
GNEEdge * myToEdge
to edge (used by flows and trips)
void clearDemandElementSegmentGeometry()
clear demand element geometry
static void drawAction_drawVehicleAsPoly(const GUIVisualizationSettings &s, const SUMOVehicleShape shape, const double width, const double length, int carriageIndex=-1)
draw vehicle as a polygon
double departSpeed
(optional) The initial speed of the vehicle
friend class GNEChange_EnableAttribute
std::string vtypeid
The vehicle's type id.
const int VEHPARS_NUMBER_SET
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
static void transformToTrip(GNEVehicle *originalVehicle)
transform to trip
SUMOTime repetitionOffset
The time offset between vehicle reinsertions.
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.
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.
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.
GNEEdge * getFromEdge() const
std::vector< Connection > getConnectionsFromLane(int lane, NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
ArrivalPosLatDefinition
Possible ways to choose the departure position.
FXDEFMAP(GNEVehicle::GNESingleVehiclePopupMenu) GNESingleVehiclePopupMenuMap[]
static bool isGenericParametersValid(const std::string &value)
check if given string can be parsed to a map/list of generic parameters
bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
DepartDefinition
Possible ways to depart.
const int VEHPARS_ARRIVALSPEED_SET
double xmax() const
Returns maximum x-coordinate.
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
ArrivalLaneDefinition
Possible ways to choose the arrival lane.
static OptionsCont & getOptions()
Retrieves the options.
std::string getBegin() const
get begin time of demand element
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
bool showDemandElements() const
check if show demand elements checkbox is enabled
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
Position getPositionInView() const
Returns position of demand element in view.
const std::vector< GNEEdge * > & getEdgeParents() const
get edge parents
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.
double length() const
Returns the length.
GNEViewNet * getViewNet() const
Returns a pointer to GNEViewNet in which demand element element is located.
Structure representing possible vehicle parameter.
static void transformToFlow(GNEVehicle *originalVehicle)
transform to flow
Copy object name - popup entry.
GUIVisualizationSizeSettings vehicleSize
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
GUIColorer vehicleColorer
The vehicle colorer.
description of a vehicle type
void calculateConnectionShape()
calculate connection shape (note: Only calculated if 'con' isn't nullptr)
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
SUMOVehicleClass getVClass() const
obtain VClass related with this 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.
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
bool drawMinGap
Information whether the minimum gap shall be drawn.
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
SumoXMLTag
Numbers representing SUMO-XML - element names.
static const double vehicleShapes
details for draw person as shapes
const int VEHPARS_PROB_SET
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
const int VEHPARS_DEPARTSPEED_SET
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
PositionVector shape
The shape of the netElement element.
double scaledSize(double scale, double constFactor=0.1) const
get scale size
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
The representation of a single edge during network building.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
GNEEdge * myFromEdge
from edge (used by flows and trips)
SumoXMLTag tag
The vehicle tag.
std::string getDepartPosLat() const
obtain depart pos lat parameter in string format
weights: time range begin
A road/street connecting two junctions (netedit-version)
const int VEHPARS_ARRIVALLANE_SET
friend class GNEChange_Attribute
declare friend class
const int VEHPARS_ROUTE_SET
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
void changeDemandElementID(const std::string &newID)
change ID of demand element
std::string line
The vehicle's line (mainly for public transport)
GNENet * getNet() const
get the net object
SumoXMLTag getTagSynonym() const
get tag synonym
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
std::vector< double > shapeRotations
The rotations of the single shape parts.
a flow definition nusing a route instead of a from-to edges route (used in NETEDIT)
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
NBNode * getToNode() const
Returns the destination node of the edge.
ConnectionGeometry()
default constructor (by default unused)
std::vector< Segment >::const_iterator begin() const
begin iterator
void insertJunctionSegment(const GNEDemandElement *element, const GNEJunction *junction, const Position pos, const bool visible, const bool valid)
insert junction segment
a flow definitio nusing a from-to edges instead of a route (used by router)
const int VEHPARS_ARRIVALPOS_SET
GUIVisualizationDetailSettings detailSettings
detail settings
const TagProperties & getTagProperty() const
get Tag Property assigned to this object
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
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.
double xmin() const
Returns minimum x-coordinate.
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
std::string getArrivalPosLat() const
obtain arrival pos lat parameter in string format
std::string getDepart() const
obtain depart parameter in string format
const RGBColor & getColor() const
get color
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
bool isAttributeEnabled(SumoXMLAttr key) const
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
const int VEHPARS_COLOR_SET
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
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 fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
const std::string DEFAULT_VTYPE_ID
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
std::vector< GNEDemandElement * > retrieveDemandElements(bool onlySelected=false) const
return all demand elements
std::string id
The vehicle's id.
GUIGlID getGlID() const
Returns the numerical id of the object.
const GNEAttributeCarrier * getDottedAC() const
get AttributeCarrier under cursor
A class that stores a 2D geometrical boundary.
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
std::string getAttribute(SumoXMLAttr key) const
int getNumLanes() const
Returns the number of lanes.
double repetitionProbability
The probability for emitting a vehicle per second.
const int VEHPARS_VIA_SET
void compute()
compute demand element
begin/end of the description of an edge
double arrivalPos
(optional) The position the vehicle shall arrive on
const int VEHPARS_LINE_SET
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
static const RGBColor BLUE
double scale
information about a lane's width (temporary, used for a single view)
void changeDemandElementParent(GNEShape *shapeTobeChanged, const std::string &newDemandElementParentID, int demandElementParentIndex)
change first demand element parent of a shape
Supermode currentSupermode
the current supermode
GUIVisualizationTextSettings vehicleName
ArrivalPosDefinition arrivalPosProcedure
Information how the vehicle shall choose the arrival position.
A point in 2D or 3D with translation and scaling methods.
double x() const
Returns the x-position.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
const TagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
std::string time2string(SUMOTime t)
static bool isValidGenericParameterKey(const std::string &value)
whether the given string is a valid key for a generic parameter
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
double arrivalPosLat
(optional) The lateral position the vehicle shall arrive on
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.
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.
static const RGBColor RED
named colors
const int VEHPARS_ARRIVALPOSLAT_SET
void updateDemandElementBegin(const std::string &oldBegin, GNEDemandElement *demandElement)
update demand element begin in container
static RGBColor fromHSV(double h, double s, double v)
Converts the given hsv-triplet to rgb, inspired by http://alvyray.com/Papers/CG/hsv2rgb....
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
static void drawAction_drawVehicleAsBoxPlus(const double width, const double length)
draw vehicle as a Box
GNEEdge * getToEdge() const
obtain to edge of this demand element
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
static void transformToRouteFlow(GNEVehicle *originalVehicle, bool createEmbeddedRoute)
transform routeFlow over an existent route
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
std::string getDepartPos() const
obtain depart pos parameter in string format
std::string getDepartLane() const
obtain depart lane parameter in string format
SUMOTime string2time(const std::string &r)
const int VEHPARS_VPH_SET
double departPosLat
(optional) The lateral position the vehicle shall depart from
const NetElementGeometry & getGeometry() const
static bool isValidGenericParameterValue(const std::string &value)
whether the given string is a valid value for a generic parameter
const int VEHPARS_DEPARTLANE_SET
GNEViewNet * getViewNet() const
get view net
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions)
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
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.
GUIVisualizationColorSettings colorSettings
color settings
bool geometryDeprecated
mark geometry as deprecated (used to avoid multiple updates)
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
DepartLaneDefinition
Possible ways to choose a lane on depart.
static const double vehicleTriangles
details for draw person as triangles
SUMOTime repetitionEnd
The time at which the flow ends (only needed when using repetitionProbability)
bool showNonInspectedDemandElements(const GNEDemandElement *demandElement) const
check if non inspected element has to be hidden
int departLane
(optional) The lane the vehicle shall depart from (index in edge)
const Boundary & getBoundary() const
returns the bounder of the network
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
const int VEHPARS_VTYPE_SET
const PositionVector & getShape() const
retrieve the junction shape
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
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...
bool areEdgesConsecutives(SUMOVehicleClass vClass, GNEEdge *from, GNEEdge *to) const
check if exist a route between the two given consecutives edges
const std::string & getDefaultValue(SumoXMLAttr attr) const
return the default value of the attribute of an element
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
const int VEHPARS_DEPARTPOSLAT_SET
DemandElementSegmentGeometry myDemandElementSegmentGeometry
demand element segment geometry
const std::vector< GNEDemandElement * > & getDemandElementParents() const
return vector of demand elements that have as Parent this edge (For example, Calibrators)
double y() const
Returns the y-position.
std::vector< std::string > via
List of the via-edges the vehicle must visit.
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
static bool isValidTypeID(const std::string &value)
whether the given string is a valid id for an edge or vehicle type
Position getCenter() const
Returns the center of the boundary.
bool hasTagSynonym() const
return true if tag correspond to an element that will be written in XML with another tag
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_CONTAINER_NUMBER_SET
Demanding mode (Routes, Vehicles etc..)
const int VEHPARS_DEPARTPOS_SET
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
const int VEHPARS_PERSON_NUMBER_SET
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element
static bool isValidVehicleID(const std::string &value)
whether the given string is a valid id for a vehicle or flow
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
DepartPosDefinition
Possible ways to choose the departure position.
GUISelectedStorage gSelected
A global holder of selected objects.
const std::string & getDemandElementID() const
returns DemandElement ID
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
ArrivalPosLatDefinition arrivalPosLatProcedure
Information how the vehicle shall choose the lateral arrival position.
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
std::string getParentName() const
Returns the name of the parent object.
begin/end of the description of a route
void clearParameter()
Clears the parameter map.
SUMOVehicleShape getVehicleShapeID(const std::string &name)
Returns the class id of the shape class given by its name.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
GUIVisualizationTextSettings personName
std::vector< GNEEdge * > calculateDijkstraRoute(SUMOVehicleClass vClass, const std::vector< GNEEdge * > &partialEdges) const
calculate Dijkstra route between a list of partial edges
transform vehicle to another vehicle type (ej: flow to trip)
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Boundary & grow(double by)
extends the boundary by the given amount
DepartSpeedDefinition
Possible ways to choose the departure speed.
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
const int VEHPARS_PERIOD_SET
void removeLockedObject(const GUIGlObjectType type)
set object unselected
const std::string & getTagStr() const
get tag assigned to this object in string format
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Copy typed object name - popup entry.
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.
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Stores the information about how to visualize structures.
DepartPosLatDefinition departPosLatProcedure
Information how the vehicle shall choose the lateral departure position.
void changeEdgeParents(GNEShape *elementChild, const std::string &newEdgeIDs)
change edge parents of a shape
const int VEHPARS_END_SET
A structure which describes a connection between edges or lanes.
const std::vector< GNEDemandElement * > & getDemandElementChildren() const
return vector of demand elements that have as Parent this edge (For example, Calibrators)
std::string getArrivalLane() const
obtain arrival lane parameter in string format
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
RGBColor selectedVehicleColor
vehicle selection color
double area() const
Returns the area (0 for non-closed)
std::string getArrivalSpeed() const
obtain arrival speed parameter in string format
const T getColor(const double value) const
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
void endGeometryMoving()
end geometry movement
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
double departPos
(optional) The position the vehicle shall depart from
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
a single trip definition (used by router)
void deselect(GUIGlID id)
Deselects the object with the given id.
GNEViewParent * getViewParent() const
get the net object
LockGLObjectTypes * getLockGLObjectTypes() const
get selected items Modul
static const RGBColor WHITE
double ymax() const
Returns maximum y-coordinate.
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
double arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
std::vector< double > shapeLengths
The lengths of the single shape parts.
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects
NBEdge * getTurnDestination(bool possibleDestination=false) const
ArrivalSpeedDefinition
Possible ways to choose the arrival speed.
void addedLockedObject(const GUIGlObjectType type)
set object selected