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
2db6c7af
Verified
Commit
2db6c7af
authored
May 31, 2019
by
Mohcine Chraibi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
write train files in trajectory txt
parent
487614fb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
2 deletions
+67
-2
IO/IODispatcher.cpp
IO/IODispatcher.cpp
+67
-2
No files found.
IO/IODispatcher.cpp
View file @
2db6c7af
...
...
@@ -370,16 +370,69 @@ std::string getEventFileName(const std::string & GetProjectFile)
TiXmlNode
*
xMainNode
=
doc
.
RootElement
();
string
eventfile
=
""
;
if
(
xMainNode
->
FirstChild
(
"events_file"
))
{
ret
=
xMainNode
->
FirstChild
(
"events_file"
)
->
FirstChild
()
->
Value
();
Log
->
Write
(
"INFO:
\t
events <"
+
eventfile
+
">"
);
ret
=
xMainNode
->
FirstChild
(
"events_file"
)
->
FirstChild
()
->
Value
Str
();
Log
->
Write
(
"INFO:
\t
events <"
+
ret
+
">"
);
}
else
{
Log
->
Write
(
"INFO:
\t
No events found"
);
return
ret
;
}
return
ret
;
}
// <train_constraints>
// <train_time_table>ttt.xml</train_time_table>
// <train_types>train_types.xml</train_types>
// </train_constraints>
std
::
string
getTrainTimeTableFileName
(
const
std
::
string
&
GetProjectFile
)
{
std
::
string
ret
=
""
;
TiXmlDocument
doc
(
GetProjectFile
);
if
(
!
doc
.
LoadFile
())
{
Log
->
Write
(
"ERROR:
\t
%s"
,
doc
.
ErrorDesc
());
Log
->
Write
(
"ERROR:
\t
GetTrainTimeTable could not parse the project file"
);
return
ret
;
}
TiXmlNode
*
xMainNode
=
doc
.
RootElement
();
string
tttfile
=
""
;
if
(
xMainNode
->
FirstChild
(
"train_constraints"
))
{
TiXmlNode
*
xFileNode
=
xMainNode
->
FirstChild
(
"train_constraints"
)
->
FirstChild
(
"train_time_table"
);
if
(
xFileNode
)
ret
=
xFileNode
->
FirstChild
()
->
ValueStr
();
Log
->
Write
(
"INFO:
\t
train_time_table <"
+
ret
+
">"
);
}
else
{
Log
->
Write
(
"INFO:
\t
No events no ttt file found"
);
return
ret
;
}
return
ret
;
}
std
::
string
getTrainTypeFileName
(
const
std
::
string
&
GetProjectFile
)
{
std
::
string
ret
=
""
;
TiXmlDocument
doc
(
GetProjectFile
);
if
(
!
doc
.
LoadFile
())
{
Log
->
Write
(
"ERROR:
\t
%s"
,
doc
.
ErrorDesc
());
Log
->
Write
(
"ERROR:
\t
GetTrainType could not parse the project file"
);
return
ret
;
}
TiXmlNode
*
xMainNode
=
doc
.
RootElement
();
string
tttfile
=
""
;
if
(
xMainNode
->
FirstChild
(
"train_constraints"
))
{
auto
xFileNode
=
xMainNode
->
FirstChild
(
"train_constraints"
)
->
FirstChild
(
"train_types"
);
if
(
xFileNode
)
ret
=
xFileNode
->
FirstChild
()
->
ValueStr
();
Log
->
Write
(
"INFO:
\t
train_types <"
+
ret
+
">"
);
}
else
{
Log
->
Write
(
"INFO:
\t
No events no train types file found"
);
return
ret
;
}
return
ret
;
}
std
::
string
getGoalFileName
(
const
std
::
string
&
GetProjectFile
)
{
std
::
string
ret
=
""
;
...
...
@@ -411,6 +464,8 @@ void TrajectoriesFLAT::WriteHeader(long nPeds, double fps, Building* building, i
std
::
string
sourceFileName
=
getSourceFileName
(
building
->
GetProjectFilename
());
std
::
string
goalFileName
=
getGoalFileName
(
building
->
GetProjectFilename
());
std
::
string
eventFileName
=
getEventFileName
(
building
->
GetProjectFilename
());
std
::
string
trainTimeTableFileName
=
getTrainTimeTableFileName
(
building
->
GetProjectFilename
());
std
::
string
trainTypeFileName
=
getTrainTypeFileName
(
building
->
GetProjectFilename
());
(
void
)
seed
;
(
void
)
nPeds
;
char
tmp
[
100
]
=
""
;
sprintf
(
tmp
,
"#description: jpscore (%s)"
,
JPSCORE_VERSION
);
...
...
@@ -436,6 +491,16 @@ void TrajectoriesFLAT::WriteHeader(long nPeds, double fps, Building* building, i
sprintf
(
tmp
,
"#events: %s"
,
eventFileName
.
c_str
());
Write
(
tmp
);
}
if
(
trainTimeTableFileName
!=
""
)
{
sprintf
(
tmp
,
"#trainTimeTable: %s"
,
trainTimeTableFileName
.
c_str
());
Write
(
tmp
);
}
if
(
trainTypeFileName
!=
""
)
{
sprintf
(
tmp
,
"#trainType: %s"
,
trainTypeFileName
.
c_str
());
Write
(
tmp
);
}
Write
(
"#ID: the agent ID"
);
Write
(
"#FR: the current frame"
);
Write
(
"#X,Y,Z: the agents coordinates (in metres)"
);
...
...
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