Fix writing to method I

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