Remove warnings

parent 4cee65ef
Pipeline #17476 passed with stages
in 32 seconds
......@@ -116,6 +116,35 @@ void OutputHandler::Write(const char* message,...)
}
}
void STDIOHandler::Write(const char* message,...)
{
char msg[CLENGTH]="";
va_list ap;
va_start(ap, message);
vsprintf(msg, message, ap);
va_end(ap);
string str(msg);
if (str.find("ERROR") != string::npos)
{
cerr << msg << endl;
cerr.flush();
incrementErrors();
}
else if (str.find("WARNING") != string::npos)
{
cerr << msg << endl;
cerr.flush();
incrementWarnings();
}
else
{ // infos
cout << msg << endl;
cout.flush();
}
}
void STDIOHandler::Write(const string& str)
{
if (str.find("ERROR") != string::npos)
......
......@@ -61,6 +61,7 @@ public:
class STDIOHandler : public OutputHandler {
public:
void Write(const std::string& str);
void Write(const char *string,...);
};
class FileHandler : public OutputHandler {
......
......@@ -217,9 +217,9 @@ inline std::string polygon_to_string(const polygon_2d & polygon)
polygon_str.append(std::to_string(y));
polygon_str.append("), ");
}
for(auto ring: boost::geometry::interior_rings(polygon) )
for(auto pRing: boost::geometry::interior_rings(polygon) )
{
for(auto point: ring )
for(auto point: pRing )
{
double x = boost::geometry::get<0>(point);
double y = boost::geometry::get<1>(point);
......
......@@ -379,8 +379,8 @@ bool SubRoom::IsVisible(const Line &wall, const Point &position)
return wall_is_vis;
}
// p1 and p2 are supposed to be pedestrian's positions. This function does not work properly
// for visibility checks with walls, since the line connecting the pedestrian's position
// p1 and p2 are supposed to be pedestrian's positions. This function does not work properly
// for visibility checks with walls, since the line connecting the pedestrian's position
// with the nearest point on the wall IS intersecting with the wall.
bool SubRoom::IsVisible(const Point& p1, const Point& p2, bool considerHlines)
{
......@@ -744,13 +744,13 @@ string NormalSubRoom::WriteSubRoom() const
s.append("\t\t</wall>\n");
}
const Point& pos = obst->GetCentroid();
const Point& posCenter = obst->GetCentroid();
//add the obstacle caption
char tmp[CLENGTH];
sprintf(tmp, "\t\t<label centerX=\"%.2f\" centerY=\"%.2f\" centerZ=\"%.2f\" text=\"%d\" color=\"100\" />\n"
, pos.GetX() * FAKTOR, pos.GetY() * FAKTOR,GetElevation(pos)*FAKTOR ,obst->GetId());
s.append(tmp);
char Tmp[CLENGTH];
sprintf(Tmp, "\t\t<label centerX=\"%.2f\" centerY=\"%.2f\" centerZ=\"%.2f\" text=\"%d\" color=\"100\" />\n"
, posCenter.GetX() * FAKTOR, posCenter.GetY() * FAKTOR,GetElevation(posCenter)*FAKTOR ,obst->GetId());
s.append(Tmp);
}
return s;
......
......@@ -38,8 +38,8 @@ Method_A::Method_A()
{
_classicFlow = 0;
_vDeltaT = 0;
ub::matrix<double> _xCor(0,0);
ub::matrix<double> _yCor(0,0);
_xCor(0,0);
_yCor(0,0);
_firstFrame = nullptr;
_passLine = nullptr;
_deltaT = 100;
......
......@@ -34,8 +34,8 @@ using std::vector;
Method_B::Method_B()
{
ub::matrix<double> _xCor(0,0);
ub::matrix<double> _yCor(0,0);
_xCor(0,0);
_yCor(0,0);
_tIn = nullptr;
_tOut = nullptr;
_entrancePoint = {};
......
......@@ -198,7 +198,7 @@ bool Method_D::Process (const PedData& peddata,const fs::path& scriptsLocation,
}
if(_outputVoronoiCellData)
{ // output the Voronoi polygons of a frame
OutputVoroGraph(str_frid, polygons_id, NumPeds, XInFrame, YInFrame,VInFrame);
OutputVoroGraph(str_frid, polygons_id, NumPeds, VInFrame);
}
}
else
......@@ -404,7 +404,7 @@ void Method_D::GetProfiles(const string& frameId, const vector<polygon_2d>& poly
fclose(Prf_density);
}
void Method_D::OutputVoroGraph(const string & frameId, std::vector<std::pair<polygon_2d, int> >& polygons_id, int numPedsInFrame, vector<double>& XInFrame, vector<double>& YInFrame,const vector<double>& VInFrame)
void Method_D::OutputVoroGraph(const string & frameId, std::vector<std::pair<polygon_2d, int> >& polygons_id, int numPedsInFrame,const vector<double>& VInFrame)
{
//string voronoiLocation=_projectRootDir+"./Output/Fundamental_Diagram/Classical_Voronoi/VoronoiCell/id_"+_measureAreaId;
......@@ -444,9 +444,9 @@ void Method_D::OutputVoroGraph(const string & frameId, std::vector<std::pair<po
if(polys.is_open())
{
//for(vector<polygon_2d> polygon_iterator=polygons.begin(); polygon_iterator!=polygons.end(); polygon_iterator++)
for(auto && p:polygons_id)
for(auto && p_it : polygons_id)
{
poly = p.first;
poly = p_it.first;
for(auto&& point:poly.outer())
{
point.x(point.x()*CMtoM);
......@@ -460,7 +460,7 @@ void Method_D::OutputVoroGraph(const string & frameId, std::vector<std::pair<po
point.y(point.y()*CMtoM);
}
}
polys << p.second << " | " << dsv(poly) << endl;
polys << p_it.second << " | " << dsv(poly) << endl;
//polys <<dsv(poly)<< endl;
}
}
......
......@@ -102,8 +102,7 @@ private:
void OutputVoronoiResults(const std::vector<polygon_2d>& polygons, const std::string& frid, const std::vector<double>& VInFrame);
std::tuple<double,double> GetVoronoiDensityVelocity(const std::vector<polygon_2d>& polygon, const std::vector<double>& Velocity, const polygon_2d & measureArea);
void GetProfiles(const std::string& frameId, const std::vector<polygon_2d>& polygons, const std::vector<double>& velocity);
void OutputVoroGraph(const std::string & frameId, std::vector<std::pair<polygon_2d, int> >& polygons, int numPedsInFrame,std::vector<double>& XInFrame,
std::vector<double>& YInFrame,const std::vector<double>& VInFrame);
void OutputVoroGraph(const std::string & frameId, std::vector<std::pair<polygon_2d, int> >& polygons, int numPedsInFrame,const std::vector<double>& VInFrame);
void GetIndividualFD(const std::vector<polygon_2d>& polygon, const std::vector<double>& Velocity, const std::vector<int>& Id, const polygon_2d& measureArea, const std::string& frid);
/**
* Reduce the precision of the points to two digits
......
......@@ -197,7 +197,7 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c
}
if(_outputVoronoiCellData)
{ // output the Voronoi polygons of a frame
OutputVoroGraph(str_frid, polygons_id, NumPeds, XInFrame, YInFrame,VInFrame);
OutputVoroGraph(str_frid, polygons_id, NumPeds,VInFrame);
}
}
else
......@@ -396,7 +396,7 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c
fclose(Prf_density);
}
void Method_I::OutputVoroGraph(const string & frameId, std::vector<std::pair<polygon_2d, int> >& polygons_id, int numPedsInFrame, vector<double>& XInFrame, vector<double>& YInFrame,const vector<double>& VInFrame)
void Method_I::OutputVoroGraph(const string & frameId, std::vector<std::pair<polygon_2d, int> >& polygons_id, int numPedsInFrame,const vector<double>& VInFrame)
{
//string voronoiLocation=_projectRootDir+"./Output/Fundamental_Diagram/Classical_Voronoi/VoronoiCell/id_"+_measureAreaId;
......@@ -436,9 +436,9 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c
if(polys.is_open())
{
//for(vector<polygon_2d> polygon_iterator=polygons.begin(); polygon_iterator!=polygons.end(); polygon_iterator++)
for(auto && p:polygons_id)
for(auto && polygon_id:polygons_id)
{
poly = p.first;
poly = polygon_id.first;
for(auto&& point:poly.outer())
{
point.x(point.x()*CMtoM);
......@@ -452,7 +452,7 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c
point.y(point.y()*CMtoM);
}
}
polys << p.second << " | " << dsv(poly) << endl;
polys << polygon_id.second << " | " << dsv(poly) << endl;
//polys <<dsv(poly)<< endl;
}
}
......
......@@ -102,8 +102,7 @@ private:
void OutputVoronoiResults(const std::vector<polygon_2d>& polygons, const std::string& frid, const std::vector<double>& VInFrame);
std::tuple<double,double> GetVoronoiDensityVelocity(const std::vector<polygon_2d>& polygon, const std::vector<double>& Velocity, const polygon_2d & measureArea);
void GetProfiles(const std::string& frameId, const std::vector<polygon_2d>& polygons, const std::vector<double>& velocity);
void OutputVoroGraph(const std::string & frameId, std::vector<std::pair<polygon_2d, int> >& polygons, int numPedsInFrame,std::vector<double>& XInFrame,
std::vector<double>& YInFrame,const std::vector<double>& VInFrame);
void OutputVoroGraph(const std::string & frameId, std::vector<std::pair<polygon_2d, int> >& polygons, int numPedsInFrame,const std::vector<double>& VInFrame);
void GetIndividualFD(const std::vector<polygon_2d>& polygon, const std::vector<double>& Velocity, const std::vector<int>& Id, const polygon_2d& measureArea, const std::string& frid);
/**
* Reduce the precision of the points to two digits
......
......@@ -284,15 +284,15 @@ bool PedData::InitializeVariables(const fs::path& filename)
// are consecutive. 1, 2, 10,
// 11 does not work
//---------- get position of index in unique index vector ---------------
auto it = std::find(unique_ids.begin(), unique_ids.end(), _IdsTXT[i]);
if (it == unique_ids.end())
auto it_uid = std::find(unique_ids.begin(), unique_ids.end(), _IdsTXT[i]);
if (it_uid == unique_ids.end())
{
Log->Write("Error:\t Id %d does not exist in file", _IdsTXT[i]);
return false;
}
else
{
ID = std::distance(unique_ids.begin(), it);
ID = std::distance(unique_ids.begin(), it_uid);
}
//--------------------
int frm = _FramesTXT[i] - _minFrame;
......@@ -321,15 +321,15 @@ bool PedData::InitializeVariables(const fs::path& filename)
// indexes in the trajectories
// are consecutive
auto it = std::find(unique_ids.begin(), unique_ids.end(), _IdsTXT[i]);
if (it == unique_ids.end())
auto itIds = std::find(unique_ids.begin(), unique_ids.end(), _IdsTXT[i]);
if (itIds == unique_ids.end())
{
Log->Write("Error2:\t Id %d does not exist in file", _IdsTXT[i]);
return false;
}
else
{
id = std::distance(unique_ids.begin(), it);
id = std::distance(unique_ids.begin(), itIds);
}
int t =_FramesTXT[i]- _minFrame;
......
......@@ -447,10 +447,10 @@ point_type2 VoronoiDiagram::getIntersectionPoint(const point_2d& pt0, const poin
{
vector<point_2d> pt;
segment edge0(pt0, pt1);
vector<point_2d> const& points = square.outer();
for (vector<point_2d>::size_type i = 1; i < points.size(); ++i)
vector<point_2d> const& opoints = square.outer();
for (vector<point_2d>::size_type i = 1; i < opoints.size(); ++i)
{
segment edge1(points[i], points[i-1]);
segment edge1(opoints[i], opoints[i-1]);
if(intersects(edge0, edge1))
{
intersection(edge0, edge1, pt);
......@@ -459,7 +459,7 @@ point_type2 VoronoiDiagram::getIntersectionPoint(const point_2d& pt0, const poin
}
if(pt.empty())
{
segment edge1(points[3], points[0]);
segment edge1(opoints[3], opoints[0]);
intersection(edge0, edge1, pt);
}
point_type2 interpts(pt[0].x(), pt[0].y());
......
This diff is collapsed.
This diff is collapsed.
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