#pragma once
#include <vector>
#include <libsumo/TraCIDefs.h>
#include <libsumo/VehicleType.h>
#ifndef LIBTRACI
class MSPerson;
class MSStage;
struct Reservation;
class PositionVector;
#endif
namespace LIBSUMO_NAMESPACE {
class Person {
public:
static double getSpeed(const std::string& personID);
static libsumo::TraCIPosition getPosition(const std::string& personID, const bool includeZ = false);
static libsumo::TraCIPosition getPosition3D(const std::string& personID);
static std::string getRoadID(const std::string& personID);
static std::string getLaneID(const std::string& personID);
static std::string getTypeID(const std::string& personID);
static double getWaitingTime(const std::string& personID);
static std::string getNextEdge(const std::string& personID);
static std::string getVehicle(const std::string& personID);
static int getRemainingStages(const std::string& personID);
static libsumo::TraCIStage getStage(const std::string& personID, int nextStageIndex = 0);
static std::vector<std::string> getEdges(const std::string& personID, int nextStageIndex = 0);
static double getAngle(const std::string& personID);
static double getSlope(const std::string& personID);
static double getLanePosition(const std::string& personID);
static double getWalkingDistance(const std::string& personID, const std::string& edgeID, double pos, int laneIndex = 0);
static double getWalkingDistance2D(const std::string& personID, double x, double y);
static std::vector<libsumo::TraCIReservation> getTaxiReservations(int onlyNew = 0);
static std::string splitTaxiReservation(std::string reservationID, const std::vector<std::string>& personIDs);
LIBSUMO_ID_PARAMETER_API
LIBSUMO_VEHICLE_TYPE_GETTER
static void add(const std::string& personID, const std::string& edgeID, double pos, double depart = libsumo::DEPARTFLAG_NOW, const std::string typeID = "DEFAULT_PEDTYPE");
static void appendStage(const std::string& personID, const libsumo::TraCIStage& stage);
static void replaceStage(const std::string& personID, const int stageIndex, const libsumo::TraCIStage& stage);
static void appendWaitingStage(const std::string& personID, double duration, const std::string& description = "waiting", const std::string& stopID = "");
static void appendWalkingStage(const std::string& personID, const std::vector<std::string>& edges, double arrivalPos, double duration = -1, double speed = -1, const std::string& stopID = "");
static void appendDrivingStage(const std::string& personID, const std::string& toEdge, const std::string& lines, const std::string& stopID = "");
static void removeStage(const std::string& personID, int nextStageIndex);
static void rerouteTraveltime(const std::string& personID);
static void moveTo(const std::string& personID, const std::string& laneID, double pos, double posLat = libsumo::INVALID_DOUBLE_VALUE);
static void moveToXY(const std::string& personID, const std::string& edgeID, const double x, const double y, double angle = libsumo::INVALID_DOUBLE_VALUE, const int keepRoute = 1, double matchThreshold = 100);
static void remove(const std::string& personID, char reason = libsumo::REMOVE_VAPORIZED);
static void setSpeed(const std::string& personID, double speed);
static void setType(const std::string& personID, const std::string& typeID);
LIBSUMO_VEHICLE_TYPE_SETTER
LIBSUMO_SUBSCRIPTION_API
#ifndef LIBTRACI
#ifndef SWIG
static void storeShape(const std::string& id, PositionVector& shape);
static std::shared_ptr<VariableWrapper> makeWrapper();
static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper, tcpip::Storage* paramData);
private:
static MSPerson* getPerson(const std::string& id);
static MSStage* convertTraCIStage(const TraCIStage& stage, const std::string personID);
static bool filterReservation(int stateFilter, const Reservation* res, std::vector<libsumo::TraCIReservation>& reservations);
class reservation_by_id_sorter {
public:
reservation_by_id_sorter() {};
int operator()(const TraCIReservation& r1, const TraCIReservation& r2) const;
};
private:
static SubscriptionResults mySubscriptionResults;
static ContextSubscriptionResults myContextSubscriptionResults;
#endif
#endif
private:
Person() = delete;
};
}