Commit 3eef4613 authored by Ulrich Kemloh's avatar Ulrich Kemloh

Removing the confusing concept of open obstacle

parent 16799c43
......@@ -56,13 +56,10 @@ BOOST_AUTO_TEST_CASE(Obstacle_Constr_setGet_Test)
obs1.AddWall(W1);
walls_test.emplace_back(W1);
obs1.SetCaption("obstacle" + std::to_string(i));
int flag = std::rand() % 2;
obs1.SetClosed(flag);
obs1.SetHeight(-i); // logically incorrect
obs1.SetId(i-1);
BOOST_CHECK(obs1.GetCaption() == "obstacle" + std::to_string(i));
BOOST_CHECK(obs1.GetClosed() == flag);
BOOST_CHECK(obs1.GetHeight() == -i); // logically incorrect
BOOST_CHECK(obs1.GetId() == (i-1));
BOOST_CHECK(obs1.GetAllWalls() == walls_test);
......@@ -120,7 +117,6 @@ BOOST_AUTO_TEST_CASE(Obstacle_Contains_test)
obs1.AddWall(w3);
obs1.AddWall(w4);
obs1.SetClosed(1);
obs1.ConvertLineToPoly();
// inside the obstacle check
......@@ -180,7 +176,6 @@ BOOST_AUTO_TEST_CASE(Obstacle_ConvertLineToPoly_Test)
obs1.AddWall(w2);
obs1.AddWall(w3);
obs1.AddWall(w4);
obs1.SetClosed(1);
//BOOST_CHECK_MESSAGE(obs1.ConvertLineToPoly() == false, obs1.ConvertLineToPoly());
......@@ -230,7 +225,6 @@ BOOST_AUTO_TEST_CASE(Obstacle_GetCentroid_Test)
obs1.AddWall(w2);
obs1.AddWall(w3);
obs1.SetClosed(1);
obs1.ConvertLineToPoly();
BOOST_CHECK(obs1.GetCentroid() == (P1 + P2 + P3) / 3);
......
......@@ -291,9 +291,9 @@ bool Building::InitGeometry()
//do the same for the obstacles that are closed
for(auto&& obst:itr_subroom.second->GetAllObstacles())
{
if (obst->GetClosed() == 1)
if(!obst->ConvertLineToPoly())
return false;
//if (obst->GetClosed() == 1)
if(!obst->ConvertLineToPoly())
return false;
}
}
}
......@@ -504,13 +504,13 @@ bool Building::LoadGeometry(const std::string &geometryfile)
int id = xmltof(xObstacle->Attribute("id"), -1);
int height = xmltof(xObstacle->Attribute("height"), 0);
double ObstClosed = xmltof(xObstacle->Attribute("closed"), 0);
//double ObstClosed = xmltof(xObstacle->Attribute("closed"), 0);
string ObstCaption = xmltoa(xObstacle->Attribute("caption"),"-1");
Obstacle* obstacle = new Obstacle();
obstacle->SetId(id);
obstacle->SetCaption(ObstCaption);
obstacle->SetClosed(ObstClosed);
//obstacle->SetClosed(ObstClosed);
obstacle->SetHeight(height);
//looking for polygons (walls)
......
......@@ -72,16 +72,6 @@ void Obstacle::SetCaption(string caption)
_caption = caption;
}
int Obstacle::GetClosed() const
{
return _isClosed;
}
void Obstacle::SetClosed(int closed)
{
_isClosed = closed;
}
double Obstacle::GetHeight() const
{
return _height;
......
......@@ -48,7 +48,14 @@ private:
std::vector<Point> _poly;
public:
/**
* Constructor
*/
Obstacle();
/**
* Destructor
*/
virtual ~Obstacle();
/**
......@@ -61,16 +68,6 @@ public:
*/
void SetCaption(std::string caption);
/**
* Set/Get the close state of the obstacle
*/
int GetClosed() const;
/**
* Set/Get the close state of the obstacle
*/
void SetClosed(int closed);
/**
* Set/Get the height of the obstacle.
* Is used for computing visibility
......
......@@ -566,7 +566,7 @@ vector<Point > PedDistributor::PossiblePositions(const SubRoom& r)
//only continue if...
if(tooNear==true) continue;
if((obst->GetClosed()==1) && (obst->Contains(pos)==true))
if(obst->Contains(pos))
{
tooNear=true;
break; // too close
......
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