Commit e7b78dd7 authored by Mohcine Chraibi's avatar Mohcine Chraibi

Add destructor to class PedDistributor

parent da927a2e
......@@ -28,6 +28,10 @@ PedDistributionParser::PedDistributionParser(const Configuration* configuration)
}
PedDistributionParser::~PedDistributionParser() {
// delete _configuration;
}
bool PedDistributionParser::LoadPedDistribution(vector<std::shared_ptr<StartDistribution> >& startDis,
vector<std::shared_ptr<StartDistribution> >& startDisSub,
std::vector<std::shared_ptr<AgentsSource> >& startDisSources)
......
......@@ -28,10 +28,10 @@ class PedDistributionParser : public PedDistributionLoader {
public:
PedDistributionParser(const Configuration* configuration);
virtual bool LoadPedDistribution(std::vector<std::shared_ptr<StartDistribution>>& startDis,
std::vector<std::shared_ptr<StartDistribution>>& startDisSub,
std::vector<std::shared_ptr<AgentsSource>>& startDisSources) override;
~PedDistributionParser();
virtual bool LoadPedDistribution(std::vector<std::shared_ptr<StartDistribution> >& startDis,
std::vector<std::shared_ptr<StartDistribution> >& startDisSub,
std::vector<std::shared_ptr<AgentsSource> >& startDisSources) override;
private:
const Configuration* _configuration;
......
......@@ -186,10 +186,10 @@ void AgentsSourcesManager::ComputeBestPositionVoronoi(AgentsSource* src,
for (auto&& ped : peds)
{
double dist = (pos - ped->GetPos()).NormSquare();
if (dist < min_dist)
double distance = (pos - ped->GetPos()).NormSquare();
if (distance < min_dist)
{
min_dist = dist;
min_dist = distance;
}
}
map_dist_to_position[min_dist] = pos;
......
......@@ -14,6 +14,7 @@ public:
virtual bool LoadPedDistribution(std::vector<std::shared_ptr<StartDistribution>> &startDis,
std::vector<std::shared_ptr<StartDistribution>> &startDisSub,
std::vector<std::shared_ptr<AgentsSource>> &startDisSources) = 0;
virtual ~PedDistributionLoader() {};
};
#endif //JPSCORE_PEDDISTRIBUTIONLOADER_H
......
......@@ -62,7 +62,7 @@ PedDistributor::PedDistributor(const Configuration *configuration) : _configurat
}
parser->LoadPedDistribution(_start_dis,_start_dis_sub,_start_dis_sources);
delete parser;
}
......@@ -166,7 +166,7 @@ bool PedDistributor::Distribute(Building *building) const {
// Distributing
Log->Write("INFO: \tDistributing %d Agents in Room/Subrom [%d/%d]! Maximum allowed: %d", N, roomID, subroomID,
max_pos);
DistributeInSubRoom(sr, N, allpos, &pid, dist.get(), building);
DistributeInSubRoom(N, allpos, &pid, dist.get(), building);
Log->Write("\t...Done");
nPeds_is += N;
}
......@@ -242,7 +242,7 @@ bool PedDistributor::Distribute(Building *building) const {
dist->SetSubroomID(sr->GetSubRoomID());
//dist->SetSubroomUID(sr->GetSubRoomUID())
if (akt_anz[is] > 0) {
DistributeInSubRoom(sr, akt_anz[is], allFreePosInRoom[is], &pid, dist.get(), building);
DistributeInSubRoom(akt_anz[is], allFreePosInRoom[is], &pid, dist.get(), building);
}
}
nPeds_is += N;
......@@ -483,7 +483,7 @@ vector<Point> PedDistributor::PossiblePositions(const SubRoom &r) {
* nächsten Aufruf)
* - routing: wird benötigt um die Zielline der Fußgänger zu initialisieren
* */
void PedDistributor::DistributeInSubRoom(SubRoom *r, int nAgents, vector<Point> &positions, int *pid,
void PedDistributor::DistributeInSubRoom(int nAgents, vector<Point> &positions, int *pid,
StartDistribution *para, Building *building) const {
// set the pedestrians
for (int i = 0; i < nAgents; ++i) {
......
......@@ -77,7 +77,7 @@ public:
/**
* Distribute the pedestrians in the Subroom with the given parameters
*/
void DistributeInSubRoom(SubRoom *r, int N, std::vector<Point> &positions, int *pid,
void DistributeInSubRoom(int N, std::vector<Point> &positions, int *pid,
StartDistribution *parameters, Building *building) const;
/**
......
......@@ -684,8 +684,8 @@ void DirectionSubLocalFloorfield::Init(Building* buildingArg, double stepsize,
targets.emplace_back(pair.second);
}
}
std::string filename = "floorfield" + std::to_string(subroomUID) + ".vtk";
locffviafm[subroomUID]->writeFF(filename, targets);
std::string filename1 = "floorfield" + std::to_string(subroomUID) + ".vtk";
locffviafm[subroomUID]->writeFF(filename1, targets);
}
}
......
......@@ -2708,8 +2708,7 @@ namespace VisiLibity
}
void Guards::snap_to_boundary_of(const Environment& environment_temp,
double epsilon)
void Guards::snap_to_boundary_of(const Environment& environment_temp)
{
for(unsigned i=0; i<positions_.size(); i++)
positions_[i].snap_to_boundary_of(environment_temp);
......
......@@ -1781,8 +1781,7 @@ namespace VisiLibity
* \remarks O(N*n) time complexity, where N is the guard count and
* n is the number of vertices in \a environment_temp
*/
void snap_to_boundary_of(const Environment& environment_temp,
double epsilon=0.0);
void snap_to_boundary_of(const Environment& environment_temp);
/** \brief relocate each guard to closest Point on boundary if
* within \a epsilon of the boundary (of \a polygon_temp)
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment