diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 05765634aed745ceb36369e259c5fc791574afd9..7b46263cbc6c8068e9ed9ac8f2f49864f71b21a7 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -389,6 +389,7 @@ void MainWindow::slotStopPlaying() { // maybe this is a feature ! extern_shutdown_visual_thread=true; waitForVisioThread(); + //waitForDataThread(); //reset all frames cursors resetAllFrameCursor(); @@ -1420,7 +1421,6 @@ void MainWindow::slotStartVisualisationThread(QString data,int numberOfAgents,fl slotToggleFirstPedestrianGroup(); QDomDocument doc(""); - //data = "<travisto>\n" +data+ "\n</travisto>\n"; QString errorMsg=""; doc.setContent(data,&errorMsg); @@ -1429,7 +1429,6 @@ void MainWindow::slotStartVisualisationThread(QString data,int numberOfAgents,fl Debug::Error("%s", (const char *)errorMsg.toStdString().c_str()); return; } - //QDomNode geoNode =doc.elementsByTagName("geometry").item(0); //FacilityGeometry *geo = parseGeometry(geoNode); FacilityGeometry *geo = parseGeometry(data); @@ -1437,6 +1436,11 @@ void MainWindow::slotStartVisualisationThread(QString data,int numberOfAgents,fl visualisationThread->slotSetFrameRate(frameRate); visualisationThread->setGeometry(geo); visualisationThread->start(); + + //enable some buttons + ui.BtRecord->setEnabled(true); + ui.BtStop->setEnabled(true); + } /// this method is called by the data transfer thread diff --git a/src/SaxParser.cpp b/src/SaxParser.cpp index c5e7be6c1666deb9655726ba8a4c3abc61209bb4..78eaeff4677990c201e2c2b39b65a4c5828530db 100644 --- a/src/SaxParser.cpp +++ b/src/SaxParser.cpp @@ -83,6 +83,8 @@ SaxParser::SaxParser(FacilityGeometry* geo, SyncData* data, double* fps){ parsingCrossings=false; color=0.0; dataset->clearFrames(); + //default header + InitHeader(0,0,0); } SaxParser::~SaxParser() { @@ -475,9 +477,11 @@ bool SaxParser::startElement(const QString & /* namespaceURI */, else if(at.localName(i)==_jps_xPos) { xPos=at.value(i).toDouble()*FAKTOR; + //xPos=at.value(i).toDouble(); } else if(at.localName(i)==_jps_yPos) { + //yPos=at.value(i).toDouble(); yPos=at.value(i).toDouble()*FAKTOR; } else if(at.localName(i)==_jps_zPos) @@ -488,10 +492,12 @@ bool SaxParser::startElement(const QString & /* namespaceURI */, else if(at.localName(i)==_jps_radiusA) { dia_a=at.value(i).toDouble()*FAKTOR; + //dia_a=at.value(i).toDouble(); } else if(at.localName(i)==_jps_radiusB) { dia_b=at.value(i).toDouble()*FAKTOR; + //dia_b=at.value(i).toDouble(); } else if(at.localName(i)==_jps_ellipseOrientation) { @@ -624,7 +630,7 @@ bool SaxParser::endElement(const QString & /* namespaceURI */, while(!currentFrame.empty()){ frame->addElement(currentFrame.back()); currentFrame.pop_back(); - //cout<<"not adding"<<endl; + //cout<<"not adding"<<endl; } //compute the polydata, might increase the runtime @@ -1244,20 +1250,7 @@ void SaxParser::parseGeometryXMLV04(QString filename, FacilityGeometry *geo) void SaxParser::InitHeader(int major, int minor, int patch) { - // set the parsing String map - if(minor==5 && patch==0){ - _jps_xPos=QString("xPos"); - _jps_yPos=QString("yPos"); - _jps_zPos=QString("zPos"); - _jps_xVel=QString("xVel"); - _jps_yVel=QString("yVel"); - _jps_zVel=QString("zVel"); - _jps_radiusA=QString("radiusA"); - _jps_radiusB=QString("radiusB"); - _jps_ellipseOrientation=QString("ellipseOrientation"); - _jps_ellipseColor=QString("ellipseColor"); - } - else if ( (minor==6) || (minor==5 && patch==1) ){ + if ( (minor==6) || (minor==5 && patch==1) ){ _jps_xPos=QString("x"); _jps_yPos=QString("y"); _jps_zPos=QString("z"); @@ -1271,6 +1264,18 @@ void SaxParser::InitHeader(int major, int minor, int patch) } else { + _jps_xPos=QString("xPos"); + _jps_yPos=QString("yPos"); + _jps_zPos=QString("zPos"); + _jps_xVel=QString("xVel"); + _jps_yVel=QString("yVel"); + _jps_zVel=QString("zVel"); + _jps_radiusA=QString("radiusA"); + _jps_radiusB=QString("radiusB"); + _jps_ellipseOrientation=QString("ellipseOrientation"); + _jps_ellipseColor=QString("ellipseColor"); + } + if(major!=0){ cout<<"unsupported header version: "<<major<<"."<<minor<<"."<<patch<<endl; cout<<"Please use 0.5 0.5.1 or 0.6 "<<endl; exit(0); diff --git a/src/ThreadVisualisation.cpp b/src/ThreadVisualisation.cpp index 7e34d36c9528f980d185975784b580729cffe430..2bcce0fd6f4269572a8d5ca5714a81cfbd442d82 100644 --- a/src/ThreadVisualisation.cpp +++ b/src/ThreadVisualisation.cpp @@ -141,7 +141,7 @@ void ThreadVisualisation::slotSetFrameRate(float fps){ void ThreadVisualisation::run(){ //deactivate the output windows - vtkObject::GlobalWarningDisplayOff(); + //vtkObject::GlobalWarningDisplayOff(); //emit signalStatusMessage("running"); @@ -219,7 +219,6 @@ void ThreadVisualisation::run(){ // Create a real circle, not a sphere { - VTK_CREATE(vtkRegularPolygonSource, polygonSource); polygonSource->GeneratePolygonOff(); polygonSource->SetNumberOfSides(50); @@ -297,11 +296,11 @@ void ThreadVisualisation::run(){ } - if(true || SystemSettings::get2D()){ - renderer->GetActiveCamera()->OrthogonalizeViewUp(); - renderer->GetActiveCamera()->ParallelProjectionOn(); - renderer->ResetCamera(); - } +// if(true || SystemSettings::get2D()){ +// renderer->GetActiveCamera()->OrthogonalizeViewUp(); +// renderer->GetActiveCamera()->ParallelProjectionOn(); +// renderer->ResetCamera(); +// } //create a timer for rendering the window TimerCallback *renderingTimer = new TimerCallback(); @@ -353,12 +352,14 @@ void ThreadVisualisation::run(){ // should be called after the observer has been added //renderWindow->Modified(); + //style->SetKeyPressActivationValue('R'); + //style->SetKeyPressActivation(true); + //save the top view camera _topViewCamera=vtkCamera::New(); //renderer->GetActiveCamera()->Modified(); _topViewCamera->DeepCopy(renderer->GetActiveCamera()); - //TODO: update all system settings setGeometryVisibility2D(SystemSettings::get2D()); setGeometryVisibility3D(!SystemSettings::get2D()); @@ -450,11 +451,17 @@ void ThreadVisualisation::initGlyphs2D() extern_glyphs_pedestrians->SetSourceConnection(strip->GetOutputPort()); //extern_glyphs_pedestrians->SetSourceConnection(agentShape->GetOutputPort()); + //first frame + Frame * frame = extern_trajectories_firstSet.getFrame(0); + vtkPolyData* pData=NULL; + if(frame) pData=frame->GetPolyData2D(); #if VTK_MAJOR_VERSION <= 5 extern_glyphs_pedestrians->SetSource(agentShape->GetOutput()); + if (frame )extern_glyphs_pedestrians->SetInput(pData); #else extern_glyphs_pedestrians->SetInputConnection(agentShape->GetOutputPort()); + if (frame) extern_glyphs_pedestrians->SetInputData(pData); #endif extern_glyphs_pedestrians->ThreeGlyphsOff(); @@ -478,7 +485,7 @@ void ThreadVisualisation::initGlyphs2D() mapper->SetLookupTable(lut); extern_glyphs_pedestrians_actor_2D->SetMapper(mapper); - extern_glyphs_pedestrians_actor_2D->GetProperty()->BackfaceCullingOn(); + //extern_glyphs_pedestrians_actor_2D->GetProperty()->BackfaceCullingOn(); renderer->AddActor(extern_glyphs_pedestrians_actor_2D); // structure for the labels @@ -526,10 +533,17 @@ void ThreadVisualisation::initGlyphs3D() extern_glyphs_pedestrians_3D->SetSourceConnection(agentShape->GetOutputPort()); + //first frame + Frame * frame = extern_trajectories_firstSet.getFrame(0); + vtkPolyData* pData=NULL; + if(frame) pData=frame->GetPolyData2D(); + #if VTK_MAJOR_VERSION <= 5 extern_glyphs_pedestrians_3D->SetSource(agentShape->GetOutput()); + if (frame )extern_glyphs_pedestrians_3D->SetInput(pData); #else extern_glyphs_pedestrians_3D->SetInputConnection(agentShape->GetOutputPort()); + if (frame )extern_glyphs_pedestrians_3D->SetInputData(pData); #endif extern_glyphs_pedestrians_3D->ThreeGlyphsOff(); @@ -549,7 +563,7 @@ void ThreadVisualisation::initGlyphs3D() mapper->SetLookupTable(lut); extern_glyphs_pedestrians_actor_3D->SetMapper(mapper); - extern_glyphs_pedestrians_actor_3D->GetProperty()->BackfaceCullingOn(); + //extern_glyphs_pedestrians_actor_3D->GetProperty()->BackfaceCullingOn(); renderer->AddActor(extern_glyphs_pedestrians_actor_3D); }