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