Fix writing to method I

- Add surrounding room
parent e293932f
Pipeline #17534 passed with stages
in 32 seconds
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
#endif #endif
using boost::geometry::dsv;
using namespace std; using namespace std;
OutputHandler* Log = new STDIOHandler(); OutputHandler* Log = new STDIOHandler();
...@@ -204,7 +204,7 @@ std::map<int, polygon_2d> Analysis::ReadGeometry(const fs::path& geometryFile, c ...@@ -204,7 +204,7 @@ std::map<int, polygon_2d> Analysis::ReadGeometry(const fs::path& geometryFile, c
_building->LoadGeometry(geometryFile.string()); _building->LoadGeometry(geometryFile.string());
// create the polygons // create the polygons
_building->InitGeometry(); _building->InitGeometry();
// _building->AddSurroundingRoom(); _building->AddSurroundingRoom();
double geo_minX = FLT_MAX; double geo_minX = FLT_MAX;
double geo_minY = FLT_MAX; double geo_minY = FLT_MAX;
...@@ -216,6 +216,8 @@ std::map<int, polygon_2d> Analysis::ReadGeometry(const fs::path& geometryFile, c ...@@ -216,6 +216,8 @@ std::map<int, polygon_2d> Analysis::ReadGeometry(const fs::path& geometryFile, c
//loop over all areas //loop over all areas
for(auto&& area: areas) for(auto&& area: areas)
{ {
std::cout << "area " << area->_id << "\n";
//search for the subroom that contains that area //search for the subroom that contains that area
for (auto&& it_room : _building->GetAllRooms()) for (auto&& it_room : _building->GetAllRooms())
{ {
...@@ -252,7 +254,7 @@ std::map<int, polygon_2d> Analysis::ReadGeometry(const fs::path& geometryFile, c ...@@ -252,7 +254,7 @@ std::map<int, polygon_2d> Analysis::ReadGeometry(const fs::path& geometryFile, c
} }
} }
} }
} }//room
if(geoPoly.count(area->_id)==0) if(geoPoly.count(area->_id)==0)
{ {
...@@ -265,8 +267,6 @@ std::map<int, polygon_2d> Analysis::ReadGeometry(const fs::path& geometryFile, c ...@@ -265,8 +267,6 @@ std::map<int, polygon_2d> Analysis::ReadGeometry(const fs::path& geometryFile, c
_highVertexY = geo_maxY; _highVertexY = geo_maxY;
_lowVertexX = geo_minX; _lowVertexX = geo_minX;
_lowVertexY = geo_minY; _lowVertexY = geo_minY;
using boost::geometry::dsv;
// cout<<"INFO: \tGeometry polygon is:\t" << dsv(geoPoly[1])<<endl;
return geoPoly; return geoPoly;
} }
......
...@@ -265,19 +265,25 @@ void Building::AddSurroundingRoom() ...@@ -265,19 +265,25 @@ void Building::AddSurroundingRoom()
x_max = x_max + 10.0; x_max = x_max + 10.0;
y_min = y_min - 10.0; y_min = y_min - 10.0;
y_max = y_max + 10.0; y_max = y_max + 10.0;
Log->Write("INFO: \tAdding surrounding room X: %f, Y: %f -- %f, %f\n", x_min, x_max, y_min, y_max);
SubRoom* bigSubroom = new NormalSubRoom(); SubRoom* bigSubroom = new NormalSubRoom();
bigSubroom->SetType("Subroom");
bigSubroom->SetPlanEquation(0,0,1); //@todo: dummy values
bigSubroom->SetRoomID(_rooms.size()); bigSubroom->SetRoomID(_rooms.size());
bigSubroom->SetSubRoomID(0); // should be the single subroom bigSubroom->SetSubRoomID(0); // should be the single subroom
bigSubroom->AddWall(Wall(Point(x_min, y_min), Point(x_min, y_max))); bigSubroom->AddWall(Wall(Point(x_min, y_min), Point(x_min, y_max)));
bigSubroom->AddWall(Wall(Point(x_min, y_max), Point(x_max, y_max))); bigSubroom->AddWall(Wall(Point(x_min, y_max), Point(x_max, y_max)));
bigSubroom->AddWall(Wall(Point(x_max, y_max), Point(x_max, y_min))); bigSubroom->AddWall(Wall(Point(x_max, y_max), Point(x_max, y_min)));
bigSubroom->AddWall(Wall(Point(x_max, y_min), Point(x_min, y_min))); bigSubroom->AddWall(Wall(Point(x_max, y_min), Point(x_min, y_min)));
vector<Line*> goals = vector<Line*>(); // dummy vector
bigSubroom->ConvertLineToPoly(goals);
Room * bigRoom = new Room(); Room * bigRoom = new Room();
bigRoom->AddSubRoom(bigSubroom); bigRoom->AddSubRoom(bigSubroom);
bigRoom->SetCaption("outside"); bigRoom->SetCaption("outside");
bigRoom->SetID(_rooms.size()); bigRoom->SetID(_rooms.size());
bigRoom->SetZPos(0); //@todo: dummy value
AddRoom(bigRoom); AddRoom(bigRoom);
_xMin = x_min; _xMin = x_min;
_xMax = x_max; _xMax = x_max;
......
...@@ -83,7 +83,7 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c ...@@ -83,7 +83,7 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c
_fps =peddata.GetFps(); _fps =peddata.GetFps();
int mycounter = 0; int mycounter = 0;
int minFrame = peddata.GetMinFrame(); int minFrame = peddata.GetMinFrame();
Log->Write("INFO:\tMethod D: frame rate fps: <%.2f>, start: <%d>, stop: <%d> (minFrame = %d)", _fps, _startFrame, _stopFrame, minFrame); Log->Write("INFO:\tMethod I: frame rate fps: <%.2f>, start: <%d>, stop: <%d> (minFrame = %d)", _fps, _startFrame, _stopFrame, minFrame);
if(_startFrame != _stopFrame) if(_startFrame != _stopFrame)
{ {
if(_startFrame==-1) if(_startFrame==-1)
...@@ -124,6 +124,7 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c ...@@ -124,6 +124,7 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c
Log->Write("------------------------ Analyzing with Method I -----------------------------"); Log->Write("------------------------ Analyzing with Method I -----------------------------");
//for(int frameNr = 0; frameNr < peddata.GetNumFrames(); frameNr++ ) //for(int frameNr = 0; frameNr < peddata.GetNumFrames(); frameNr++ )
//for(std::map<int , std::vector<int> >::iterator ite=_peds_t.begin();ite!=_peds_t.end();ite++) //for(std::map<int , std::vector<int> >::iterator ite=_peds_t.begin();ite!=_peds_t.end();ite++)
for(auto ite: _peds_t) for(auto ite: _peds_t)
{ {
int frameNr = ite.first; int frameNr = ite.first;
...@@ -154,10 +155,13 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c ...@@ -154,10 +155,13 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c
VInFrame.erase(VInFrame.begin() + i); VInFrame.erase(VInFrame.begin() + i);
Log->Write("Warning:\t Pedestrian removed"); Log->Write("Warning:\t Pedestrian removed");
i--; i--;
} }
} }
int NumPeds = IdInFrame.size(); int NumPeds = IdInFrame.size();
//--------------------------------------------------------------------------------------------------------------- // std::cout << "numpeds = " << NumPeds << "\n";
//---------------------------------------------------------------------------------------------------------------
if(_isOneDimensional) if(_isOneDimensional)
{ {
CalcVoronoiResults1D(XInFrame, VInFrame, IdInFrame, _areaForMethod_I->_poly,str_frid); CalcVoronoiResults1D(XInFrame, VInFrame, IdInFrame, _areaForMethod_I->_poly,str_frid);
...@@ -209,11 +213,11 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c ...@@ -209,11 +213,11 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c
Log->Write("WARNING: \tVoronoi Diagrams are not obtained!. Frame: %d (minFrame = %d)\n", frid, minFrame); Log->Write("WARNING: \tVoronoi Diagrams are not obtained!. Frame: %d (minFrame = %d)\n", frid, minFrame);
} }
} }
fclose(_fVoronoiRhoV); }//peds
if(_calcIndividualFD) fclose(_fVoronoiRhoV);
{ if(_calcIndividualFD)
fclose(_fIndividualFD); {
} fclose(_fIndividualFD);
} }
return return_value; return return_value;
} }
...@@ -551,6 +555,9 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c ...@@ -551,6 +555,9 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c
polygon_str.c_str(), polygon_str.c_str(),
v_str.c_str()); v_str.c_str());
} }
else{
std::cout << "empty interectio with the measurement aren\n";
}
temp++; 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