Skip to content

Commit

Permalink
[JuPedSim] Corrected an error concerning JPS_VERSION + added comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoueraud87 authored and behrisch committed Mar 1, 2024
1 parent 2a2e562 commit 75f47df
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/microsim/transportables/MSPModel_JuPedSim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ MSPModel_JuPedSim::execute(SUMOTime time) {
GEOSGeometry* carriagesCollection = GEOSGeom_createCollection(GEOS_MULTIPOLYGON, carriagePolygons.data(), (unsigned int)carriagePolygons.size());
GEOSGeometry* rampsCollection = GEOSGeom_createCollection(GEOS_MULTIPOLYGON, rampPolygons.data(), (unsigned int)rampPolygons.size());
GEOSGeometry* carriagesAndRampsUnion = GEOSUnion(carriagesCollection, rampsCollection);
GEOSGeometry* pedestrianNetworkWithTrainsAndRamps = GEOSUnion(carriagesAndRampsUnion, myGEOSPedestrianNetwork);
GEOSGeometry* pedestrianNetworkWithTrainsAndRamps = GEOSUnion(carriagesAndRampsUnion, myGEOSPedestrianNetworkLargestComponent);
#ifdef DEBUG_GEOMETRY_GENERATION
dumpGeometry(pedestrianNetworkWithTrainsAndRamps, "pedestrianNetworkWithTrainsAndRamps.wkt");
#endif
Expand All @@ -471,7 +471,7 @@ MSPModel_JuPedSim::execute(SUMOTime time) {
dumpGeometry(pedestrianNetworkWithTrainsAndRampsLargestComponent, "pedestrianNetworkWithTrainsAndRamps.wkt");
#endif
myJPSGeometryWithTrainsAndRamps = buildJPSGeometryFromGEOSGeometry(pedestrianNetworkWithTrainsAndRampsLargestComponent);
#if JPS_VERSION > 106
#if JPS_VERSION > 110
JPS_Simulation_SwitchGeometry(myJPSSimulation, myJPSGeometryWithTrainsAndRamps, nullptr, nullptr);
#endif
removePolygonFromDrawing(PEDESTRIAN_NETWORK_ID);
Expand All @@ -484,7 +484,7 @@ MSPModel_JuPedSim::execute(SUMOTime time) {
#if JPS_VERSION >= 110
JPS_Simulation_SwitchGeometry(myJPSSimulation, myJPSGeometry, nullptr, nullptr);
removePolygonFromDrawing(PEDESTRIAN_NETWORK_CARRIAGES_AND_RAMPS_ID);
preparePolygonForDrawing(myGEOSPedestrianNetwork, PEDESTRIAN_NETWORK_ID, PEDESTRIAN_NETWORK_COLOR);
preparePolygonForDrawing(myGEOSPedestrianNetworkLargestComponent, PEDESTRIAN_NETWORK_ID, PEDESTRIAN_NETWORK_COLOR);
#endif
}
myAllStoppedTrainIDs = allStoppedTrainIDs;
Expand Down
27 changes: 25 additions & 2 deletions src/microsim/transportables/MSPModel_JuPedSim.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,29 +148,52 @@ class MSPModel_JuPedSim : public MSPModel {
int myNumStages;
};

/// @brief The network on which the simulation runs.
MSNet* const myNetwork;

/// @brief The shape container used to add polygons to the rendering pipeline.
ShapeContainer& myShapeContainer;

/// @brief Timestep used in the JuPedSim simulator.
const SUMOTime myJPSDeltaT;

/// @brief Threshold to decide if a pedestrian has ended its journey or not.
const double myExitTolerance;

int myNumActivePedestrians = 0;
std::vector<PState*> myPedestrianStates;

GEOSGeometry* myGEOSPedestrianNetwork;
/// @brief The GEOS polygon containing all computed connected components of the pedestrian network.
GEOSGeometry* myGEOSPedestrianNetwork; // Kept because the largest component refers to it.

/// @brief The GEOS polygon representing the largest (by area) connected component of the pedestrian network.
const GEOSGeometry* myGEOSPedestrianNetworkLargestComponent;

bool myHaveAdditionalWalkableAreas;

JPS_Geometry myJPSGeometry;
/// @brief The JPS polygon representing the largest connected component of the pedestrian network.
JPS_Geometry myJPSGeometry; // Kept because of dynamic geometry switching and JPS_Simulation object.

/// @brief The JPS polygon representing the largest connected component plus carriages and ramps.
JPS_Geometry myJPSGeometryWithTrainsAndRamps;
JPS_OperationalModel myJPSModel;
JPS_Simulation myJPSSimulation;

/// @brief Structure that keeps data related to vanishing areas (and other types of areas).
struct AreaData {
const std::string id;
const std::string areaType;
const std::vector<JPS_Point> areaBoundary;
const Parameterised::Map params;
};

/// @brief Array of special areas.
std::vector<AreaData> myAreas;

/// @brief The last time a pedestrian was removed in a vanishing area.
SUMOTime myLastRemovalTime = 0;

/// @brief Array of stopped trains, used to detect whether to add carriages and ramps to the geometry.
std::vector<SUMOTrafficObject::NumericalID> myAllStoppedTrainIDs;

static const int GEOS_QUADRANT_SEGMENTS;
Expand Down

0 comments on commit 75f47df

Please sign in to comment.