Reset changes to geometry

parent 6279f17d
Pipeline #20924 passed with stages
in 9 minutes and 17 seconds
......@@ -396,7 +396,7 @@ bool Building::InitGeometry()
return true;
}
const std::vector<Wall> Building::GetTrackWalls(Point TrackStart, Point TrackEnd, int & subroomId) const
const std::vector<Wall> Building::GetTrackWalls(Point TrackStart, Point TrackEnd, SubRoom * subroom) const
{
bool trackFound = false;
int track_id = -1;
......@@ -436,7 +436,7 @@ const std::vector<Wall> Building::GetTrackWalls(Point TrackStart, Point TrackEnd
} // plattforms
if(trackFound)
{
subroomId = _platforms.at(platform_id)->sid;
subroom = _platforms.at(platform_id)->sub;
mytrack = _platforms.at(platform_id)->tracks[track_id];
std::cout << "track has walls: " << mytrack.size() << "\n";
std::cout << "platform " << platform_id << " track " << track_id << "\n";
......@@ -495,7 +495,75 @@ const std::vector<std::pair<PointWall, PointWall > > Building::GetIntersectionPo
}// doors
return pws;
}
bool Building::resetTempVectors()
{
// remove temp added walls
for(auto wall: TempAddedWalls)
{
for (auto platform: _platforms)
{
auto tracks = platform.second->tracks;
for (auto track : tracks)
{
auto walls = track.second;
for(auto trackWall : walls)
{
if (trackWall == wall)
{
auto sub = platform.second->sub;
sub->RemoveWall(wall);
}
}
}
}
}
/* // add remove walls */
for(auto wall: TempRemovedWalls)
{
for (auto platform: _platforms)
{
auto tracks = platform.second->tracks;
for (auto track : tracks)
{
auto walls = track.second;
for(auto trackWall : walls)
{
if (trackWall == wall)
{
auto sub = platform.second->sub;
sub->AddWall(wall);
}
}
}
}
}
/* // remove added doors */
for(auto door: TempAddedDoors)
{
for (auto platform: _platforms)
{
auto tracks = platform.second->tracks;
for (auto track : tracks)
{
auto walls = track.second;
for(auto trackWall : walls)
{
if (trackWall == door)
{
auto sub = platform.second->sub;
sub->RemoveTransition(&door);
}
}
}
}
}
TempAddedWalls.clear();
TempRemovedWalls.clear();
TempAddedDoors.clear();
return true;
}
bool Building::InitPlatforms()
{
int num_platform = -1;
......@@ -504,7 +572,7 @@ bool Building::InitPlatforms()
Room* room = roomItr.second.get();
for (auto& subRoomItr : room->GetAllSubRooms())
{
SubRoom* subRoom = subRoomItr.second.get();
auto subRoom = subRoomItr.second.get();
int subroom_id = subRoom->GetSubRoomID();
if(subRoom->GetType() != "Platform" ) continue;
std::map<int, std::vector<Wall> > tracks;
......@@ -527,7 +595,7 @@ bool Building::InitPlatforms()
Platform{
num_platform,
room->GetID(),
subroom_id,
subRoom,
tracks,
});
AddPlatform(p);
......@@ -1267,6 +1335,7 @@ SubRoom* Building::GetSubRoomByUID(int uid) const
return nullptr;
}
//bool Building::IsVisible(Line* l1, Line* l2, bool considerHlines)
//{
//
......
......@@ -247,7 +247,17 @@ bool SubRoom::AddCrossing(Crossing* line)
_goalIDs.push_back(line->GetUniqueID());
return true;
}
// return true is walls was erased, otherwise false.
bool SubRoom::RemoveTransition(Transition * t)
{
auto it = std::find(_transitions.begin(), _transitions.end(), t);
// if (it != _transitions.end()) {
// _transitions.erase(it);
RemoveGoalID(t->GetUniqueID());
// return true;
// }
return false;
}
bool SubRoom::AddTransition(Transition* line)
{
_transitions.push_back(line);
......
......@@ -304,6 +304,7 @@ public:
//navigation
bool AddCrossing(Crossing* line);
bool AddTransition(Transition* line);
bool RemoveTransition(Transition * t);
bool AddHline(Hline* line);
void AddNeighbor(SubRoom* sub);
......
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