read txt files starting with big frames

todo: slider still not working properly
parent 791c8232
Pipeline #20205 passed with stages
in 14 seconds
...@@ -47,6 +47,7 @@ FrameElement::FrameElement(int id) ...@@ -47,6 +47,7 @@ FrameElement::FrameElement(int id)
_radius[0] = std::numeric_limits<double>::quiet_NaN(); _radius[0] = std::numeric_limits<double>::quiet_NaN();
_radius[1] = std::numeric_limits<double>::quiet_NaN(); _radius[1] = std::numeric_limits<double>::quiet_NaN();
_radius[2] = std::numeric_limits<double>::quiet_NaN(); _radius[2] = std::numeric_limits<double>::quiet_NaN();
_minFrame = 0;
} }
FrameElement::~FrameElement() FrameElement::~FrameElement()
...@@ -54,6 +55,16 @@ FrameElement::~FrameElement() ...@@ -54,6 +55,16 @@ FrameElement::~FrameElement()
} }
void FrameElement::SetMinFrame(int minframe)
{
_minFrame = minframe;
}
int FrameElement::GetMinFrame()
{
return _minFrame;
}
void FrameElement::SetId(int index) void FrameElement::SetId(int index)
{ {
_id = index; _id = index;
...@@ -115,4 +126,3 @@ int FrameElement::GetId() ...@@ -115,4 +126,3 @@ int FrameElement::GetId()
{ {
return _id; return _id;
} }
...@@ -41,6 +41,9 @@ public: ...@@ -41,6 +41,9 @@ public:
void SetId(int _id); void SetId(int _id);
/// set/get the point ID /// set/get the point ID
int GetId(); int GetId();
void SetMinFrame(int minframe);
int GetMinFrame();
/// set/get the position of the point/agent /// set/get the position of the point/agent
void GetPos(double pos[3]); void GetPos(double pos[3]);
...@@ -65,7 +68,7 @@ private: ...@@ -65,7 +68,7 @@ private:
double _radius[3]; double _radius[3];
double _orientation[3]; double _orientation[3];
double _color; double _color;
int _minFrame;
}; };
#endif /* FRAME_ELEMENT_H_ */ #endif /* FRAME_ELEMENT_H_ */
...@@ -1031,7 +1031,7 @@ void MainWindow::slotCurrentAction(QString msg) ...@@ -1031,7 +1031,7 @@ void MainWindow::slotCurrentAction(QString msg)
// labelMode->setText(msg); // labelMode->setText(msg);
} }
void MainWindow::slotFrameNumber(unsigned long actualFrameCount) void MainWindow::slotFrameNumber(unsigned long actualFrameCount, unsigned long minFrame)
{ {
//compute the mamixum framenumber //compute the mamixum framenumber
...@@ -1039,6 +1039,7 @@ void MainWindow::slotFrameNumber(unsigned long actualFrameCount) ...@@ -1039,6 +1039,7 @@ void MainWindow::slotFrameNumber(unsigned long actualFrameCount)
if(extern_first_dataset_loaded) { if(extern_first_dataset_loaded) {
maxFrameCount=extern_trajectories_firstSet.getFramesNumber(); maxFrameCount=extern_trajectories_firstSet.getFramesNumber();
} }
maxFrameCount += minFrame;
if(actualFrameCount>maxFrameCount) actualFrameCount=maxFrameCount; if(actualFrameCount>maxFrameCount) actualFrameCount=maxFrameCount;
QString msg; QString msg;
...@@ -1291,6 +1292,7 @@ void MainWindow::slotUpdateSpeedSlider(int newValue) ...@@ -1291,6 +1292,7 @@ void MainWindow::slotUpdateSpeedSlider(int newValue)
/// update the position slider /// update the position slider
void MainWindow::slotUpdateFrameSlider(int newValue) void MainWindow::slotUpdateFrameSlider(int newValue)
{ {
// std::cout << "update frame slide " << newValue << "\n";
// first get the correct position // first get the correct position
int maxFrameCount=1; int maxFrameCount=1;
...@@ -1304,7 +1306,7 @@ void MainWindow::slotUpdateFrameSlider(int newValue) ...@@ -1304,7 +1306,7 @@ void MainWindow::slotUpdateFrameSlider(int newValue)
// then set the correct position // then set the correct position
if(extern_first_dataset_loaded) { if(extern_first_dataset_loaded) {
extern_trajectories_firstSet.setFrameCursorTo(update); extern_trajectories_firstSet.setFrameCursorTo(update);
//Debug::Error( " first dataset frames update to [1] : " <<update<<endl; // Debug::Error( " first dataset frames update to [1] : " <<update<<endl;
} }
} }
......
...@@ -138,7 +138,7 @@ public Q_SLOTS: ...@@ -138,7 +138,7 @@ public Q_SLOTS:
/// update the status message /// update the status message
void slotCurrentAction(QString msg); void slotCurrentAction(QString msg);
void slotFrameNumber(unsigned long timems); void slotFrameNumber(unsigned long timems, unsigned long minFrame);
void slotRunningTime(unsigned long timems); void slotRunningTime(unsigned long timems);
void slotRenderingTime(int fps); void slotRenderingTime(int fps);
void slotControlSequence(const char *); void slotControlSequence(const char *);
......
...@@ -1474,7 +1474,7 @@ bool SaxParser::ParseTxtFormat(const QString &fileName, SyncData* dataset, doubl ...@@ -1474,7 +1474,7 @@ bool SaxParser::ParseTxtFormat(const QString &fileName, SyncData* dataset, doubl
progressDialog.show(); progressDialog.show();
double unitFactor=FAKTOR;// @todo: use correct unit double unitFactor=FAKTOR;// @todo: use correct unit
int minFrame = 0;
while ( !in.atEnd() ) while ( !in.atEnd() )
{ {
QString line = in.readLine(); QString line = in.readLine();
...@@ -1501,11 +1501,23 @@ bool SaxParser::ParseTxtFormat(const QString &fileName, SyncData* dataset, doubl ...@@ -1501,11 +1501,23 @@ bool SaxParser::ParseTxtFormat(const QString &fileName, SyncData* dataset, doubl
int agentID=-1 ; int agentID=-1 ;
int frameID=-1; int frameID=-1;
double color=155 ; double color=155 ;
static int once = 1;
switch(pieces.size()) switch(pieces.size())
{ {
case 5: case 5:
agentID=pieces[0].toInt(); agentID=pieces[0].toInt();
frameID=pieces[1].toInt(); frameID=pieces[1].toInt();
if (once) // first frame we get
{
minFrame = frameID;
once = 0;
std::cout << "minFrame = " << minFrame << "\n";
}
// todo: for some reason when trajectories start
// with frames bigger than 0, display is not correct
pos[0]=pieces[2].toDouble()*unitFactor; pos[0]=pieces[2].toDouble()*unitFactor;
pos[1]=pieces[3].toDouble()*unitFactor; pos[1]=pieces[3].toDouble()*unitFactor;
pos[2]=pieces[4].toDouble()*unitFactor; pos[2]=pieces[4].toDouble()*unitFactor;
...@@ -1521,6 +1533,14 @@ bool SaxParser::ParseTxtFormat(const QString &fileName, SyncData* dataset, doubl ...@@ -1521,6 +1533,14 @@ bool SaxParser::ParseTxtFormat(const QString &fileName, SyncData* dataset, doubl
radius[0]=pieces[5].toDouble()*unitFactor; radius[0]=pieces[5].toDouble()*unitFactor;
radius[1]=pieces[6].toDouble()*unitFactor; radius[1]=pieces[6].toDouble()*unitFactor;
angle[2]=pieces[7].toDouble(); angle[2]=pieces[7].toDouble();
if (once) // first frame we get
{
minFrame = frameID;
std::cout << ">> minFrame = " << minFrame << "\n";
once = 0;
}
// std::cout << ">> minFrame = " << minFrame << " frame " << frameID<< "\n";
break; break;
default: default:
...@@ -1545,19 +1565,19 @@ bool SaxParser::ParseTxtFormat(const QString &fileName, SyncData* dataset, doubl ...@@ -1545,19 +1565,19 @@ bool SaxParser::ParseTxtFormat(const QString &fileName, SyncData* dataset, doubl
continue;//next line continue;//next line
break; break;
} }
frameID -= minFrame;
FrameElement *element = new FrameElement(agentID-1); FrameElement *element = new FrameElement(agentID-1);
element->SetPos(pos); element->SetPos(pos);
element->SetOrientation(angle); element->SetOrientation(angle);
element->SetRadius(radius); element->SetRadius(radius);
element->SetColor(color); element->SetColor(color);
element->SetMinFrame(minFrame);
if(dataset->GetFrames().count(frameID)<1) if(dataset->GetFrames().count(frameID)<1)
{ {
Frame* frame = new Frame(frameID); Frame* frame = new Frame(frameID);
frame->addElement(element); frame->addElement(element);
dataset->addFrame(frame); dataset->addFrame(frame);
//cout<<"adding frame: "<<frameID<<endl; // cout<<"adding frame: "<<frameID<<endl;
} }
else else
{ {
......
...@@ -306,8 +306,8 @@ void ThreadVisualisation::run() ...@@ -306,8 +306,8 @@ void ThreadVisualisation::run()
QObject::connect(renderingTimer, SIGNAL(signalRunningTime(unsigned long )), QObject::connect(renderingTimer, SIGNAL(signalRunningTime(unsigned long )),
this->parent(), SLOT(slotRunningTime(unsigned long ))); this->parent(), SLOT(slotRunningTime(unsigned long )));
QObject::connect(renderingTimer, SIGNAL(signalFrameNumber(unsigned long )), QObject::connect(renderingTimer, SIGNAL(signalFrameNumber(unsigned long, unsigned long )),
this->parent(), SLOT(slotFrameNumber(unsigned long ))); this->parent(), SLOT(slotFrameNumber(unsigned long, unsigned long )));
QObject::connect(renderingTimer, SIGNAL(signalRenderingTime(int)), QObject::connect(renderingTimer, SIGNAL(signalRenderingTime(int)),
this->parent(), SLOT(slotRenderingTime(int))); this->parent(), SLOT(slotRenderingTime(int)));
......
...@@ -113,6 +113,7 @@ void TimerCallback::Execute(vtkObject *caller, unsigned long eventId, ...@@ -113,6 +113,7 @@ void TimerCallback::Execute(vtkObject *caller, unsigned long eventId,
{ {
if (vtkCommand::TimerEvent == eventId) { if (vtkCommand::TimerEvent == eventId) {
int frameNumber=0; int frameNumber=0;
int minFrame=0;
int nPeds=0; int nPeds=0;
static bool isRecording =false; static bool isRecording =false;
int tid = * static_cast<int *>(callData); int tid = * static_cast<int *>(callData);
...@@ -174,7 +175,8 @@ void TimerCallback::Execute(vtkObject *caller, unsigned long eventId, ...@@ -174,7 +175,8 @@ void TimerCallback::Execute(vtkObject *caller, unsigned long eventId,
#endif #endif
extern_glyphs_pedestrians_3D->Update(); extern_glyphs_pedestrians_3D->Update();
} }
minFrame = frame->GetFrameElements()[0]->GetMinFrame();
frameNumber += minFrame;
if(SystemSettings::getShowTrajectories()) { if(SystemSettings::getShowTrajectories()) {
const std::vector<FrameElement *> &elements=frame->GetFrameElements(); const std::vector<FrameElement *> &elements=frame->GetFrameElements();
...@@ -242,7 +244,7 @@ void TimerCallback::Execute(vtkObject *caller, unsigned long eventId, ...@@ -242,7 +244,7 @@ void TimerCallback::Execute(vtkObject *caller, unsigned long eventId,
effectivefps = (effectivefps>desiredfps)?desiredfps:effectivefps; effectivefps = (effectivefps>desiredfps)?desiredfps:effectivefps;
emit signalFrameNumber(frameNumber); emit signalFrameNumber(frameNumber, minFrame);
emit signalRunningTime(frameNumber*iren->GetTimerDuration(tid)); emit signalRunningTime(frameNumber*iren->GetTimerDuration(tid));
emit signalRenderingTime(effectivefps); emit signalRenderingTime(effectivefps);
} }
...@@ -308,7 +310,7 @@ void TimerCallback::Execute(vtkObject *caller, unsigned long eventId, ...@@ -308,7 +310,7 @@ void TimerCallback::Execute(vtkObject *caller, unsigned long eventId,
#endif //TRAVISTO_FFMPEG #endif //TRAVISTO_FFMPEG
if(extern_shutdown_visual_thread) { if(extern_shutdown_visual_thread) {
emit signalFrameNumber(0); emit signalFrameNumber(0, 0);
// this will force an update of the windows // this will force an update of the windows
lastWinX=0; lastWinX=0;
...@@ -535,4 +537,3 @@ void TimerCallback::setTextActor(vtkTextActor* ra) ...@@ -535,4 +537,3 @@ void TimerCallback::setTextActor(vtkTextActor* ra)
{ {
runningTime=ra; runningTime=ra;
} }
...@@ -146,7 +146,7 @@ private: ...@@ -146,7 +146,7 @@ private:
Q_SIGNALS: Q_SIGNALS:
void signalStatusMessage(QString msg); void signalStatusMessage(QString msg);
void signalFrameNumber(unsigned long timems); void signalFrameNumber(unsigned long timems, unsigned long minframe);
void signalRunningTime(unsigned long timems); void signalRunningTime(unsigned long timems);
void signalRenderingTime(int fps); void signalRenderingTime(int fps);
...@@ -165,5 +165,3 @@ Q_SIGNALS: ...@@ -165,5 +165,3 @@ Q_SIGNALS:
#endif /* TIMERCALLBACK_H_ */ #endif /* TIMERCALLBACK_H_ */
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