Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
JPScore
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
92
Issues
92
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
JuPedSim
JPScore
Commits
ad48141e
Verified
Commit
ad48141e
authored
Jun 01, 2019
by
Mohcine Chraibi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove trans also from Building
parent
0803b675
Pipeline
#21039
passed with stages
in 9 minutes and 20 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
110 additions
and
99 deletions
+110
-99
geometry/Building.cpp
geometry/Building.cpp
+100
-94
geometry/Building.h
geometry/Building.h
+2
-0
geometry/SubRoom.cpp
geometry/SubRoom.cpp
+8
-5
No files found.
geometry/Building.cpp
View file @
ad48141e
...
@@ -504,132 +504,128 @@ bool Building::resetGeometry(std::shared_ptr<TrainTimeTable> tab)
...
@@ -504,132 +504,128 @@ bool Building::resetGeometry(std::shared_ptr<TrainTimeTable> tab)
{
{
// this function is composed of three copy/pasted blocks.
// this function is composed of three copy/pasted blocks.
int
room_id
,
subroom_id
;
int
room_id
,
subroom_id
;
SubRoom
*
subroom
;
// std::cout << "enter resetGeometry with tab id: " << tab->id << "\n" ;
// std::cout << "temp Added Walls\n";
// for(auto id_wall: TempAddedWalls)
// {
// std::cout << "i " << id_wall.first << "\n";
// auto walls = id_wall.second;
// for(auto wall: walls )
// std::cout << wall.toString() << "\n";
// }
// std::cout << "temp Removed Walls\n";
// for(auto id_wall: TempRemovedWalls)
// {
// std::cout << "i " << id_wall.first << "\n";
// auto walls = id_wall.second;
// for(auto wall: walls )
// std::cout << wall.toString() << "\n";
// }
// std::cout << "temp Added Doors\n";
// for(auto id_wall: TempAddedDoors)
// {
// std::cout << "i " << id_wall.first << "\n";
// auto walls = id_wall.second;
// for(auto wall: walls )
// std::cout << wall.toString() << "\n";
// }
// remove temp added walls
// remove temp added walls
for
(
auto
id_wall
:
TempAddedWalls
)
auto
tempWalls
=
TempAddedWalls
[
tab
->
id
];
for
(
auto
wall
:
tempWalls
)
{
{
int
i
=
id_wall
.
first
;
for
(
auto
platform
:
_platforms
)
if
(
i
!=
tab
->
id
)
continue
;
auto
tempWalls
=
id_wall
.
second
;
for
(
auto
wall
:
tempWalls
)
{
{
for
(
auto
platform
:
_platforms
)
// auto tracks = platform.second->tracks;
room_id
=
platform
.
second
->
rid
;
subroom_id
=
platform
.
second
->
sid
;
// auto room = this->GetAllRooms().at(room_id);
SubRoom
*
subroom
=
this
->
GetAllRooms
().
at
(
room_id
)
->
GetAllSubRooms
().
at
(
subroom_id
).
get
();
for
(
auto
subWall
:
subroom
->
GetAllWalls
())
{
{
auto
tracks
=
platform
.
second
->
tracks
;
if
(
subWall
==
wall
)
room_id
=
platform
.
second
->
rid
;
subroom_id
=
platform
.
second
->
sid
;
for
(
auto
r
:
GetAllRooms
())
{
{
if
(
r
.
first
!=
room_id
)
subroom
->
RemoveWall
(
wall
);
continue
;
// std::cout << KGRN << "RESET REMOVE wall " << wall.toString() << "\n" << RESET;
subroom
=
r
.
second
->
GetSubRoom
(
subroom_id
);
auto
it
=
std
::
find
(
tempWalls
.
begin
(),
tempWalls
.
end
(),
wall
);
}
if
(
it
!=
tempWalls
.
end
())
for
(
auto
track
:
tracks
)
{
auto
walls
=
track
.
second
;
for
(
auto
trackWall
:
walls
)
{
{
if
(
trackWall
==
wall
)
tempWalls
.
erase
(
it
);
{
subroom
->
RemoveWall
(
wall
);
auto
it
=
std
::
find
(
tempWalls
.
begin
(),
tempWalls
.
end
(),
wall
);
if
(
it
!=
tempWalls
.
end
())
{
// std::cout<< KGRN << "delete wall ..." << RESET <<std::endl;
// wallPiece.WriteToErrorLog();
tempWalls
.
erase
(
it
);
}
}
}
}
}
}
//if
}
}
//subroom
}
}
//platforms
}
}
TempAddedWalls
[
tab
->
id
]
=
tempWalls
;
/* // add remove walls */
/* // add remove walls */
for
(
auto
id_wall
:
TempRemovedWalls
)
auto
tempRemovedWalls
=
TempRemovedWalls
[
tab
->
id
];
for
(
auto
wall
:
tempRemovedWalls
)
{
{
int
i
=
id_wall
.
first
;
for
(
auto
platform
:
_platforms
)
if
(
i
!=
tab
->
id
)
continue
;
auto
tempWalls
=
id_wall
.
second
;
for
(
auto
wall
:
tempWalls
)
{
{
for
(
auto
platform
:
_platforms
)
auto
tracks
=
platform
.
second
->
tracks
;
room_id
=
platform
.
second
->
rid
;
subroom_id
=
platform
.
second
->
sid
;
SubRoom
*
subroom
=
this
->
GetAllRooms
().
at
(
room_id
)
->
GetAllSubRooms
().
at
(
subroom_id
).
get
();
for
(
auto
track
:
tracks
)
{
{
auto
tracks
=
platform
.
second
->
tracks
;
auto
walls
=
track
.
second
;
room_id
=
platform
.
second
->
rid
;
for
(
auto
trackWall
:
walls
)
subroom_id
=
platform
.
second
->
sid
;
for
(
auto
r
:
GetAllRooms
())
{
if
(
r
.
first
!=
room_id
)
continue
;
subroom
=
r
.
second
->
GetSubRoom
(
subroom_id
);
}
for
(
auto
track
:
tracks
)
{
{
auto
walls
=
track
.
second
;
if
(
trackWall
==
wall
)
for
(
auto
trackWall
:
walls
)
{
{
if
(
trackWall
==
wall
)
subroom
->
AddWall
(
wall
);
// std::cout << KGRN << "ADD BACK wall " << wall.toString() << "\n" << RESET;
auto
it
=
std
::
find
(
tempRemovedWalls
.
begin
(),
tempRemovedWalls
.
end
(),
wall
);
if
(
it
!=
tempRemovedWalls
.
end
())
{
{
subroom
->
AddWall
(
wall
);
tempRemovedWalls
.
erase
(
it
);
auto
it
=
std
::
find
(
tempWalls
.
begin
(),
tempWalls
.
end
(),
wall
);
if
(
it
!=
tempWalls
.
end
())
{
// std::cout<< KGRN << "delete wall ..." << RESET <<std::endl;
// wallPiece.WriteToErrorLog();
tempWalls
.
erase
(
it
);
}
}
}
}
}
}
}
}
}
}
}
}
}
TempRemovedWalls
[
tab
->
id
]
=
tempRemovedWalls
;
/* // remove added doors */
/* // remove added doors */
for
(
auto
id_wall
:
TempAddedDoors
)
auto
tempDoors
=
TempAddedDoors
[
tab
->
id
];
{
int
i
=
id_wall
.
first
;
if
(
i
!=
tab
->
id
)
continue
;
auto
tempWalls
=
id_wall
.
second
;
for
(
auto
door
:
tempWalls
)
for
(
auto
door
:
tempDoors
)
{
for
(
auto
platform
:
_platforms
)
{
{
for
(
auto
platform
:
_platforms
)
auto
tracks
=
platform
.
second
->
tracks
;
room_id
=
platform
.
second
->
rid
;
subroom_id
=
platform
.
second
->
sid
;
SubRoom
*
subroom
=
this
->
GetAllRooms
().
at
(
room_id
)
->
GetAllSubRooms
().
at
(
subroom_id
).
get
();
for
(
auto
subTrans
:
subroom
->
GetAllTransitions
())
{
{
auto
tracks
=
platform
.
second
->
tracks
;
if
(
*
subTrans
==
door
)
room_id
=
platform
.
second
->
rid
;
subroom_id
=
platform
.
second
->
sid
;
for
(
auto
r
:
GetAllRooms
())
{
if
(
r
.
first
!=
room_id
)
continue
;
subroom
=
r
.
second
->
GetSubRoom
(
subroom_id
);
}
for
(
auto
track
:
tracks
)
{
{
auto
walls
=
track
.
second
;
// Trnasitions are added to subrooms and building!!
for
(
auto
trackWall
:
walls
)
subroom
->
RemoveTransition
(
subTrans
);
this
->
RemoveTransition
(
subTrans
);
// std::cout << KGRN << "RESET remove door " << door.toString() << "\n" << RESET;
auto
it
=
std
::
find
(
tempDoors
.
begin
(),
tempDoors
.
end
(),
door
);
if
(
it
!=
tempDoors
.
end
())
{
{
if
(
trackWall
==
door
)
tempDoors
.
erase
(
it
);
{
subroom
->
RemoveTransition
(
&
door
);
auto
it
=
std
::
find
(
tempWalls
.
begin
(),
tempWalls
.
end
(),
door
);
if
(
it
!=
tempWalls
.
end
())
{
// std::cout<< KGRN << "delete wall ..." << RESET <<std::endl;
// wallPiece.WriteToErrorLog();
tempWalls
.
erase
(
it
);
}
}
}
}
}
}
}
}
}
}
}
}
TempAddedDoors
[
tab
->
id
]
=
tempDoors
;
// std::cout << "leave resetGeometry with tab id: " << tab->id << "\n" ;
// std::cout << "temp Added Walls: " << TempAddedWalls[tab->id].size() << "\n";
// std::cout << "temp Removed Walls: " << TempRemovedWalls[tab->id].size()<< "\n";
// std::cout << "temp Added Doors: " <<TempAddedDoors[tab->id].size() << "\n";
return
true
;
return
true
;
}
}
bool
Building
::
InitPlatforms
()
bool
Building
::
InitPlatforms
()
...
@@ -1159,10 +1155,20 @@ bool Building::AddCrossing(Crossing* line)
...
@@ -1159,10 +1155,20 @@ bool Building::AddCrossing(Crossing* line)
_crossings
[
IDCrossing
]
=
line
;
_crossings
[
IDCrossing
]
=
line
;
return
true
;
return
true
;
}
}
bool
Building
::
RemoveTransition
(
Transition
*
line
)
{
// std::cout << "enter Building Remove Transitions with " << _transitions.size() << "\n";
if
(
_transitions
.
count
(
line
->
GetID
())
!=
0
)
{
_transitions
.
erase
(
line
->
GetID
());
// std::cout << " enter Nuilding Remove Transitions with " << _transitions.size() << "\n";
return
true
;
}
// std::cout << "2 enter Nuilding Remove Transitions with " << _transitions.size() << "\n";
return
false
;
}
bool
Building
::
AddTransition
(
Transition
*
line
)
bool
Building
::
AddTransition
(
Transition
*
line
)
{
{
std
::
cout
<<
"building add
transition "
<<
line
->
GetID
()
<<
"
\n
"
;
// std::cout << "building add
transition "<< line->GetID()<< "\n";
if
(
_transitions
.
count
(
line
->
GetID
())
!=
0
)
{
if
(
_transitions
.
count
(
line
->
GetID
())
!=
0
)
{
char
tmp
[
CLENGTH
];
char
tmp
[
CLENGTH
];
sprintf
(
tmp
,
sprintf
(
tmp
,
...
...
geometry/Building.h
View file @
ad48141e
...
@@ -262,6 +262,8 @@ public:
...
@@ -262,6 +262,8 @@ public:
// ------------------------------------
// ------------------------------------
bool
AddCrossing
(
Crossing
*
line
);
bool
AddCrossing
(
Crossing
*
line
);
bool
RemoveTransition
(
Transition
*
line
);
bool
AddTransition
(
Transition
*
line
);
bool
AddTransition
(
Transition
*
line
);
bool
AddHline
(
Hline
*
line
);
bool
AddHline
(
Hline
*
line
);
...
...
geometry/SubRoom.cpp
View file @
ad48141e
...
@@ -251,16 +251,19 @@ bool SubRoom::AddCrossing(Crossing* line)
...
@@ -251,16 +251,19 @@ bool SubRoom::AddCrossing(Crossing* line)
bool
SubRoom
::
RemoveTransition
(
Transition
*
t
)
bool
SubRoom
::
RemoveTransition
(
Transition
*
t
)
{
{
auto
it
=
std
::
find
(
_transitions
.
begin
(),
_transitions
.
end
(),
t
);
auto
it
=
std
::
find
(
_transitions
.
begin
(),
_transitions
.
end
(),
t
);
// if (it != _transitions.end()) {
if
(
it
!=
_transitions
.
end
())
{
// _transitions.erase(it);
// std::cout << "subroom remove transition "<< t->GetID() << ", " << t->GetUniqueID()<< "\n";
_transitions
.
erase
(
it
);
RemoveGoalID
(
t
->
GetUniqueID
());
RemoveGoalID
(
t
->
GetUniqueID
());
// return true;
// std::cout << "enter Remove Transitions with " << _transitions.size() << "\n";
// }
return
true
;
}
// std::cout << "2 enter Remove Transitions with " << _transitions.size() << "\n";
return
false
;
return
false
;
}
}
bool
SubRoom
::
AddTransition
(
Transition
*
line
)
bool
SubRoom
::
AddTransition
(
Transition
*
line
)
{
{
std
::
cout
<<
"subroom addtransition "
<<
line
->
GetID
()
<<
", "
<<
line
->
GetUniqueID
()
<<
"
\n
"
;
//
std::cout << "subroom addtransition "<< line->GetID() << ", " << line->GetUniqueID()<< "\n";
_transitions
.
push_back
(
line
);
_transitions
.
push_back
(
line
);
_goalIDs
.
push_back
(
line
->
GetUniqueID
());
_goalIDs
.
push_back
(
line
->
GetUniqueID
());
return
true
;
return
true
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment