diff --git a/JPSvis.pro b/JPSvis.pro index 2d20037198396b255fa6426213c011281d3c8a69..334a50ea1e6b6ebe0a0d3cf27a28d8d479321fdb 100644 --- a/JPSvis.pro +++ b/JPSvis.pro @@ -1,19 +1,111 @@ TEMPLATE = app -TARGET = JPSvis +TARGET = TraVisTo CONFIG += qt +#CONFIG += static QT += xml network +#avoid some annoying dependencies +#QMAKE_LFLAGS += -static -static-libgcc -static-libstdc++ +#QMAKE_LFLAGS += -static-libstdc++ +#QMAKE_CXXFLAGS += -static -static -static-libstdc++ +#QMAKE_CXXFLAGS += -static + greaterThan(QT_MAJOR_VERSION, 4):QT += widgets win32 { INCLUDEPATH += C:/VTK/include/vtk-6.1 + + LIBS += -LC:/VTK/bin \ + #LIBS += -LC:/VTK/bin_static/lib \ + -lwsock32 \ + -lvtkCommonCore-6.1 \ + -lvtkRenderingOpenGL-6.1 \ + -lvtkCommonDataModel-6.1 \ + -lvtkCommonMath-6.1 \ + -lvtkCommonMisc-6.1 \ + -lvtkCommonSystem-6.1 \ + -lvtkCommonTransforms-6.1 \ + -lvtkCommonExecutionModel-6.1 \ + -lvtkImagingHybrid-6.1 \ + -lvtkIOImage-6.1 \ + -lvtkDICOMParser-6.1 \ + -lvtkjpeg-6.1 \ + -lvtkmetaio-6.1 \ + -lvtkzlib-6.1 \ + -lvtkpng-6.1 \ + -lvtktiff-6.1 \ + -lvtkRenderingCore-6.1 \ + -lvtkCommonComputationalGeometry-6.1 \ + -lvtkFiltersCore-6.1 \ + -lvtkFiltersExtraction-6.1 \ + -lvtkFiltersGeneral-6.1 \ + -lvtkFiltersStatistics-6.1 \ + -lvtkalglib-6.1 \ + -lvtkImagingFourier-6.1 \ + -lvtkImagingCore-6.1 \ + -lvtkFiltersGeometry-6.1 \ + -lvtkFiltersSources-6.1 \ + -lvtkRenderingLabel-6.1 \ + -lvtkRenderingFreeType-6.1 \ + -lvtkfreetype-6.1 \ + -lvtkftgl-6.1 \ + -lvtkRenderingFreeTypeOpenGL-6.1 \ + -lvtkRenderingAnnotation-6.1 \ + -lvtkIOMovie-6.1 \ + -lvtkoggtheora-6.1 \ + -lvtkInteractionStyle-6.1 \ + -lvtkCommonCore-6.1 \ + -lvtksys-6.1 \ +#second round +# -lvtksys-6.1 \ +# -lvtkRenderingOpenGL-6.1 \ +# -lvtkCommonCore-6.1 \ +# -lvtkCommonDataModel-6.1 \ +# -lvtkCommonMath-6.1 \ +# -lvtkCommonMisc-6.1 \ +# -lvtkCommonSystem-6.1 \ +# -lvtkCommonTransforms-6.1 \ +# -lvtkCommonExecutionModel-6.1 \ +# -lvtkImagingHybrid-6.1 \ +# -lvtkIOImage-6.1 \ +# -lvtkDICOMParser-6.1 \ +# -lvtkjpeg-6.1 \ +# -lvtkmetaio-6.1 \ +# -lvtkzlib-6.1 \ +# -lvtkpng-6.1 \ +# -lvtktiff-6.1 \ +# -lvtkRenderingCore-6.1 \ +# -lvtkCommonComputationalGeometry-6.1 \ +# -lvtkFiltersCore-6.1 \ +# -lvtkFiltersExtraction-6.1 \ +# -lvtkFiltersGeneral-6.1 \ +# -lvtkFiltersStatistics-6.1 \ +# -lvtkalglib-6.1 \ +# -lvtkImagingFourier-6.1 \ +# -lvtkImagingCore-6.1 \ +# -lvtkFiltersGeometry-6.1 \ +# -lvtkFiltersSources-6.1 \ +# -lvtkRenderingLabel-6.1 \ +# -lvtkRenderingFreeType-6.1 \ +# -lvtkfreetype-6.1 \ +# -lvtkftgl-6.1 \ +# -lvtkRenderingFreeTypeOpenGL-6.1 \ +# -lvtkRenderingAnnotation-6.1 \ +# -lvtkIOMovie-6.1 \ +# -lvtkoggtheora-6.1 \ +# -lvtkInteractionStyle-6.1 \ + } + +win32_ { + INCLUDEPATH += C:/VTK/include/vtk-6.1 - LIBS += -LC:/VTK/bin \ + LIBS += -LC:/VTK/bin \ +# LIBS += -LC:/VTK/bin_static/lib \ + -lvtkCommonCore-6.1 \ -lvtkalglib-6.1 \ -lvtkChartsCore-6.1 \ -lvtkCommonColor-6.1 \ -lvtkCommonComputationalGeometry-6.1 \ - -lvtkCommonCore-6.1 \ -lvtkCommonDataModel-6.1 \ -lvtkCommonExecutionModel-6.1 \ -lvtkCommonMath-6.1 \ @@ -279,26 +371,81 @@ unix_6 { -lvtkzlib-6.0 \ } -unix_5 { +#dynamic linking with vtk5.10 +unix { INCLUDEPATH += /usr/include/vtk-5.8 -LIBS += -L/usr/lib/ \ - -lvtkCommon \ - -lvtkDICOMParser \ - -lvtkFiltering \ - -lvtkGenericFiltering \ - -lvtkGraphics \ - -lvtkHybrid \ - -lvtkIO \ - -lvtkImaging \ - -lvtkRendering \ - -lvtkVolumeRendering \ - -lvtkWidgets \ - -lvtkexoIIc \ - -lvtkftgl \ - -lvtksys \ - -lvtkverdict \ - -lvtkParallel \ - -lvtkmetaio +LIBS += -L/usr/lib \ +#INCLUDEPATH +=/usr/local/include/vtk-5.10 +#LIBS += -L/usr/local/lib/vtk-5.10 \ +# -lvtkCommon \ +# -lvtkDICOMParser \ +# -lvtkFiltering \ +# -lvtkGenericFiltering \ +# -lvtkGraphics \ +# -lvtkHybrid \ +# -lvtkIO \ +# -lvtkImaging \ +# -lvtkRendering \ +# -lvtkVolumeRendering \ +# -lvtkWidgets \ +# -lvtkexoIIc \ +# -lvtkftgl \ +# -lvtksys \ +# -lvtkverdict \ +# -lvtkParallel \ +# -lvtkmetaio \ +# +-lvtkRendering \ +-lvtkCommon \ +-lvtkHybrid \ +-lvtkIO \ +-lvtkGraphics \ +-lvtkFiltering \ + + } + +#Static compilation +unix_static { +#INCLUDEPATH += /usr/include/vtk-5.8 +#LIBS += -L/usr/lib \ +INCLUDEPATH +=/usr/local/include/vtk-5.10 +LIBS += -L/usr/local/lib/vtk-5.10 \ +-lvtkRendering \ +-lvtkCommon \ +-lvtkHybrid \ +-lvtkIO \ +-lvtkGraphics \ +-lvtkFiltering \ +-lvtkCommon \ +-lvtkverdict \ +-lvtkParallel \ +-lvtkexoIIc \ +-lvtkImaging \ +-lvtkDICOMParser \ +-lvtkmetaio \ +-lvtkftgl \ +#-lLSDyna \ +-lvtkViews \ +-lvtksys \ +-lvtkpng \ +-lvtktiff \ +-lvtkjpeg \ +-lvtklibxml2 \ +-lvtkzlib \ +-lvtkexpat \ +-lvtkfreetype \ +-lGL \ +-lXt \ +-lX11 \ +-lXext \ +-ldl \ +#-lpng \ +#-ltiff \ +#-ljpeg \ +#-lxml2 \ +#-lz \ +#-lexpat \ +#-lfreetype \ } macx { diff --git a/src/SaxParser.cpp b/src/SaxParser.cpp index c9bb2ce8193efc8e05056f0d7498b83c901d3598..8734ce20d9351716d6edfdb0ba6e9745cc6364ec 100644 --- a/src/SaxParser.cpp +++ b/src/SaxParser.cpp @@ -88,445 +88,435 @@ bool SaxParser::startElement(const QString & /* namespaceURI */, const QString & /* localName */, const QString &qName, const QXmlAttributes &at) { - if (qName == "header") { - for(int i=0;i<at.length();i++){ - if(at.localName(i)=="version") - { - //cout<<"version: "<<at.value(i).toStdString()<<endl; - } - } - }else if (qName == "file") { - for(int i=0;i<at.length();i++){ - if(at.localName(i)=="location") - { - QString fileName=at.value(i); - if(!fileName.isEmpty()) - { - if(fileName.endsWith(".xml",Qt::CaseInsensitive)) - { - SaxParser::parseGeometryJPS(fileName,geometry); - } - else if (fileName.endsWith(".trav",Qt::CaseInsensitive)) - { - SaxParser::parseGeometryTRAV(fileName,geometry); - } - } - } - } - } - else if (qName == "floor") { - double xMin=0, - xMax=0, - yMin=0, - yMax=0; - - for(int i=0;i<at.length();i++){ - if(at.localName(i)=="xMin") - { - xMin=at.value(i).toDouble(); - } - else if(at.localName(i)=="xMax") - { - xMax=at.value(i).toDouble(); - } - else if(at.localName(i)=="yMin") - { - yMin=at.value(i).toDouble(); - } - else if(at.localName(i)=="yMax") - { - yMax=at.value(i).toDouble(); - } - - } - geometry->addFloor(xMin,yMin,xMax,yMax); - } - else if (qName == "cuboid") { - double length=0, height=0, - width=0, color=0; - double center[3]={0,0,0}; - - for(int i=0;i<at.length();i++){ - if(at.localName(i)=="centerX") - { - center[0]=at.value(i).toDouble(); - } - else if(at.localName(i)=="centerY") - { - center[1]=at.value(i).toDouble(); - } - else if(at.localName(i)=="centerZ") - { - center[2]=at.value(i).toDouble(); - } - else if(at.localName(i)=="length") - { - length=at.value(i).toDouble(); - } - else if(at.localName(i)=="height") - { - height=at.value(i).toDouble(); - } - else if(at.localName(i)=="width") - { - width=at.value(i).toDouble(); - } - else if(at.localName(i)=="color") - { - color=at.value(i).toDouble(); - } - } - geometry->addObjectBox(center,height,width,length,color); - - } - else if (qName == "sphere") { - double radius=0, color=0; - double center[3]={0,0,0}; - - for(int i=0;i<at.length();i++){ - if(at.localName(i)=="centerX") - { - center[0]=at.value(i).toDouble(); - } - else if(at.localName(i)=="centerY") - { - center[1]=at.value(i).toDouble(); - } - else if(at.localName(i)=="centerZ") - { - center[2]=at.value(i).toDouble(); - } - else if(at.localName(i)=="radius") - { - radius=at.value(i).toDouble(); - } - else if(at.localName(i)=="color") - { - color=at.value(i).toDouble(); - } - } - geometry->addObjectSphere(center,radius,color); - } - else if (qName == "label") { - double color=0; - double center[3]={0,0,0}; - QString text; - - for(int i=0;i<at.length();i++){ - if(at.localName(i)=="centerX") - { - center[0]=at.value(i).toDouble(); - } - else if(at.localName(i)=="centerY") - { - center[1]=at.value(i).toDouble(); - } - else if(at.localName(i)=="centerZ") - { - center[2]=at.value(i).toDouble(); - } - else if(at.localName(i)=="text") - { - text=at.value(i); - } - else if(at.localName(i)=="color") - { - color=at.value(i).toDouble(); - } - } - geometry->addObjectLabel(center,center,text.toStdString(),color); - } - else if (qName == "cylinder") { - double height=0, radius=0, color=0; - double center[3]={0,0,0}; - double rotation[3]={0,0,0}; - - for(int i=0;i<at.length();i++){ - if(at.localName(i)=="centerX") - { - center[0]=at.value(i).toDouble(); - } - else if(at.localName(i)=="centerY") - { - center[1]=at.value(i).toDouble(); - } - else if(at.localName(i)=="centerZ") - { - center[2]=at.value(i).toDouble(); - } - else if(at.localName(i)=="height") - { - height=at.value(i).toDouble(); - } - else if(at.localName(i)=="radius") - { - radius=at.value(i).toDouble(); - } - else if(at.localName(i)=="color") - { - color=at.value(i).toDouble(); - } - else if(at.localName(i)=="angleX") - { - rotation[0]=at.value(i).toDouble(); - } - else if(at.localName(i)=="angleY") - { - rotation[1]=at.value(i).toDouble(); - } - else if(at.localName(i)=="angleZ") - { - rotation[2]=at.value(i).toDouble(); - } - } - geometry->addObjectCylinder(center,radius,height,rotation,color); - } - else if (qName == "agents") { - } else if (qName == "roomCaption") { - } else if (qName == "frameRate") { - } else if (qName == "geometry") { - } - else if (qName == "wall") - { - parsingWalls=true; - thickness=15; - height=250; - color=0; - caption=""; - - for(int i=0;i<at.length();i++){ - if(at.localName(i)=="thickness") - { - thickness=at.value(i).toDouble(); - } - else if(at.localName(i)=="height") - { - height=at.value(i).toDouble(); - } - else if(at.localName(i)=="color") - { - color=at.value(i).toDouble(); - } - else if(at.localName(i)=="caption") - { - caption=at.value(i); - } - } - - } - else if (qName == "door") - { - parsingWalls=false; - thickness=15; - height=250; - color=255; - caption=""; - - for(int i=0;i<at.length();i++){ - if(at.localName(i)=="thickness") - { - thickness=at.value(i).toDouble(); - } - else if(at.localName(i)=="height") - { - height=at.value(i).toDouble(); - } - else if(at.localName(i)=="color") - { - color=at.value(i).toDouble(); - } - else if(at.localName(i)=="caption") - { - caption=at.value(i); - } - } - - } - else if (qName == "timeFirstFrame") - { - unsigned long timeFirstFrame_us=0; - unsigned long timeFirstFrame_s=0; - - for(int i=0;i<at.length();i++) - { - if(at.localName(i)=="microsec") - { - timeFirstFrame_us=at.value(i).toULong(); - } - else if(at.localName(i)=="sec") - { - timeFirstFrame_s=at.value(i).toULong(); - } - } - dataset->setDelayAbsolute(timeFirstFrame_s,timeFirstFrame_us); - } - else if (qName == "point") - { - double xPos=0; - double yPos=0; - double zPos=0; - - for(int i=0;i<at.length();i++) - { - if(at.localName(i)=="xPos") - { - xPos=at.value(i).toDouble(); - } - else if(at.localName(i)=="yPos") - { - yPos=at.value(i).toDouble(); - } - else if(at.localName(i)=="zPos") - { - zPos=at.value(i).toDouble(); - } - } - double CHT[3]={color,height,thickness}; - - JPoint* pt= new JPoint(xPos,yPos,zPos); - pt->setColorHeightThicknes(CHT); - currentPointsList.push_back(pt); - - } else if (qName == "frame") { - - } else if (qName == "agent") { - - int id=0; - double xPos=0; - double yPos=0; - double zPos=0; - double agent_color =std::numeric_limits<double>::quiet_NaN(); - double xVel=std::numeric_limits<double>::quiet_NaN(); - double yVel=std::numeric_limits<double>::quiet_NaN(); - double zVel=std::numeric_limits<double>::quiet_NaN(); - double dia_a=std::numeric_limits<double>::quiet_NaN(); - double dia_b=std::numeric_limits<double>::quiet_NaN(); - double el_angle=std::numeric_limits<double>::quiet_NaN(); - double el_color=std::numeric_limits<double>::quiet_NaN(); - double el_x=std::numeric_limits<double>::quiet_NaN(); - double el_y=std::numeric_limits<double>::quiet_NaN(); - double el_z=std::numeric_limits<double>::quiet_NaN(); - - for(int i=0;i<at.length();i++) - { - if(at.localName(i)=="ID") - { - id=at.value(i).toInt(); - //TODO: maybe you should change ur format to take the ID 0 as first valid ID. - if (id==0){ - //slotErrorOutput("Person with ID=0 detected. ID should start with 1 !"); - return false; - } - } - else if(at.localName(i)=="xPos") - { - xPos=at.value(i).toDouble(); - } - else if(at.localName(i)=="yPos") - { - yPos=at.value(i).toDouble(); - } - else if(at.localName(i)=="zPos") - { - zPos=at.value(i).toDouble(); - } - else if(at.localName(i)=="agentColor") - { - agent_color=at.value(i).toDouble(); - } - else if(at.localName(i)=="xVel") - { - xVel=at.value(i).toDouble(); - } - else if(at.localName(i)=="yVel") - { - yVel=at.value(i).toDouble(); - } - else if(at.localName(i)=="zVel") - { - zVel=at.value(i).toDouble(); - } + if (qName == "header") { + for(int i=0;i<at.length();i++){ + if(at.localName(i)=="version") + { + double version=at.value(i).toDouble(); + InitHeader(version); + } + } + }else if (qName == "file") { + for(int i=0;i<at.length();i++){ + if(at.localName(i)=="location") + { + QString fileName=at.value(i); + if(!fileName.isEmpty()) + { + if(fileName.endsWith(".xml",Qt::CaseInsensitive)) + { + SaxParser::parseGeometryJPS(fileName,geometry); + } + else if (fileName.endsWith(".trav",Qt::CaseInsensitive)) + { + SaxParser::parseGeometryTRAV(fileName,geometry); + } + } + } + } + } + else if (qName == "floor") { + double xMin=0, + xMax=0, + yMin=0, + yMax=0; + + for(int i=0;i<at.length();i++){ + if(at.localName(i)=="xMin") + { + xMin=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)=="xMax") + { + xMax=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)=="yMin") + { + yMin=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)=="yMax") + { + yMax=at.value(i).toDouble()*FAKTOR; + } - else if(at.localName(i)=="radiusA") - { - dia_a=at.value(i).toDouble(); - } - else if(at.localName(i)=="radiusB") - { - dia_b=at.value(i).toDouble(); - } - else if(at.localName(i)=="ellipseOrientation") - { - el_angle=at.value(i).toDouble(); - } - else if(at.localName(i)=="ellipseColor") - { - el_color=at.value(i).toDouble(); - } - else if(at.localName(i)=="xEll") - { - el_x=at.value(i).toDouble(); - } - else if(at.localName(i)=="yEll") - { - el_y=at.value(i).toDouble(); - } - else if(at.localName(i)=="zEll") - { - el_z=at.value(i).toDouble(); - } - } + } + geometry->addFloor(xMin,yMin,xMax,yMax); + } + else if (qName == "cuboid") { + double length=0, height=0, + width=0, color=0; + double center[3]={0,0,0}; + + for(int i=0;i<at.length();i++){ + if(at.localName(i)=="centerX") + { + center[0]=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)=="centerY") + { + center[1]=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)=="centerZ") + { + center[2]=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)=="length") + { + length=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)=="height") + { + height=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)=="width") + { + width=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)=="color") + { + color=at.value(i).toDouble()*FAKTOR; + } + } + geometry->addObjectBox(center,height,width,length,color); + + } + else if (qName == "sphere") { + double radius=0, color=0; + double center[3]={0,0,0}; + + for(int i=0;i<at.length();i++){ + if(at.localName(i)=="centerX") + { + center[0]=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)=="centerY") + { + center[1]=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)=="centerZ") + { + center[2]=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)=="radius") + { + radius=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)=="color") + { + color=at.value(i).toDouble(); + } + } + geometry->addObjectSphere(center,radius,color); + } + else if (qName == "label") { + double color=0; + double center[3]={0,0,0}; + QString text; + + for(int i=0;i<at.length();i++){ + if(at.localName(i)=="centerX") + { + center[0]=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)=="centerY") + { + center[1]=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)=="centerZ") + { + center[2]=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)=="text") + { + text=at.value(i); + } + else if(at.localName(i)=="color") + { + color=at.value(i).toDouble(); + } + } + geometry->addObjectLabel(center,center,text.toStdString(),color); + } + else if (qName == "cylinder") { + double height=0, radius=0, color=0; + double center[3]={0,0,0}; + double rotation[3]={0,0,0}; + + for(int i=0;i<at.length();i++){ + if(at.localName(i)=="centerX") + { + center[0]=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)=="centerY") + { + center[1]=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)=="centerZ") + { + center[2]=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)=="height") + { + height=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)=="radius") + { + radius=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)=="color") + { + color=at.value(i).toDouble(); + } + else if(at.localName(i)=="angleX") + { + rotation[0]=at.value(i).toDouble(); + } + else if(at.localName(i)=="angleY") + { + rotation[1]=at.value(i).toDouble(); + } + else if(at.localName(i)=="angleZ") + { + rotation[2]=at.value(i).toDouble(); + } + } + geometry->addObjectCylinder(center,radius,height,rotation,color); + } + else if (qName == "agents") { + } else if (qName == "roomCaption") { + } else if (qName == "frameRate") { + } else if (qName == "geometry") { + } + else if (qName == "wall") + { + parsingWalls=true; + thickness=15; + height=250; + color=0; + caption=""; + + for(int i=0;i<at.length();i++){ + if(at.localName(i)=="thickness") + { + thickness=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)=="height") + { + height=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)=="color") + { + color=at.value(i).toDouble(); + } + else if(at.localName(i)=="caption") + { + caption=at.value(i); + } + } + + } + else if (qName == "door") + { + parsingWalls=false; + thickness=15; + height=250; + color=255; + caption=""; + + for(int i=0;i<at.length();i++){ + if(at.localName(i)=="thickness") + { + thickness=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)=="height") + { + height=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)=="color") + { + color=at.value(i).toDouble(); + } + else if(at.localName(i)=="caption") + { + caption=at.value(i); + } + } + + } + else if (qName == "timeFirstFrame") + { + unsigned long timeFirstFrame_us=0; + unsigned long timeFirstFrame_s=0; + + for(int i=0;i<at.length();i++) + { + if(at.localName(i)=="microsec") + { + timeFirstFrame_us=at.value(i).toULong(); + } + else if(at.localName(i)=="sec") + { + timeFirstFrame_s=at.value(i).toULong(); + } + } + dataset->setDelayAbsolute(timeFirstFrame_s,timeFirstFrame_us); + } + else if (qName == "point") + { + double xPos=0; + double yPos=0; + double zPos=0; + + for(int i=0;i<at.length();i++) + { + if(at.localName(i)=="xPos") + { + xPos=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)=="yPos") + { + yPos=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)=="zPos") + { + zPos=at.value(i).toDouble()*FAKTOR; + } + } + double CHT[3]={color,height,thickness}; + + JPoint* pt= new JPoint(xPos,yPos,zPos); + pt->setColorHeightThicknes(CHT); + currentPointsList.push_back(pt); + + } else if (qName == "frame") { + + } else if (qName == "agent") { + + int id=0; + double xPos=0; + double yPos=0; + double zPos=0; + double agent_color =std::numeric_limits<double>::quiet_NaN(); + double xVel=std::numeric_limits<double>::quiet_NaN(); + double yVel=std::numeric_limits<double>::quiet_NaN(); + double zVel=std::numeric_limits<double>::quiet_NaN(); + double dia_a=std::numeric_limits<double>::quiet_NaN(); + double dia_b=std::numeric_limits<double>::quiet_NaN(); + double el_angle=std::numeric_limits<double>::quiet_NaN(); + double el_color=std::numeric_limits<double>::quiet_NaN(); + double el_x=std::numeric_limits<double>::quiet_NaN(); + double el_y=std::numeric_limits<double>::quiet_NaN(); + double el_z=std::numeric_limits<double>::quiet_NaN(); + + for(int i=0;i<at.length();i++) + { + if(at.localName(i)=="ID") + { + id=at.value(i).toInt(); + //TODO: maybe you should change ur format to take the ID 0 as first valid ID. + if (id==0){ + //slotErrorOutput("Person with ID=0 detected. ID should start with 1 !"); + return false; + } + } + else if(at.localName(i)==_jps_xPos) + { + xPos=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)==_jps_yPos) + { + yPos=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)==_jps_zPos) + { + zPos=at.value(i).toDouble()*FAKTOR; + } - //coordinates of the ellipse, default to the head of the agent - if(isnan(el_x)) el_x=xPos; - if(isnan(el_y)) el_y=yPos; - if(isnan(el_z)) el_z=zPos; - - double pos[3]={xPos,yPos,zPos}; - double vel[3]={xVel,yPos,zPos}; - double ellipse[7]={el_x,el_y,el_z,dia_a,dia_b,el_angle,el_color}; - double para[2]={agent_color,el_angle}; - - TrajectoryPoint * point = new TrajectoryPoint(id-1); - point->setEllipse(ellipse); - point->setPos(pos); - point->setVel(vel); - point->setAgentInfo(para); - currentFrame.push_back(point); - } - else if (qName == "agentInfo") - { - double height=std::numeric_limits<double>::quiet_NaN(); - int color=std::numeric_limits<int>::quiet_NaN(); - int id=std::numeric_limits<int>::quiet_NaN(); - - for(int i=0;i<at.length();i++) - { - if(at.localName(i)=="ID") - { - id=at.value(i).toInt(); - } - if(at.localName(i)=="height") - { - height=at.value(i).toDouble(); - } - if(at.localName(i)=="color") - { - color=at.value(i).toDouble(); - } - } - if(isnan(id)) return true; + else if(at.localName(i)==_jps_radiusA) + { + dia_a=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)==_jps_radiusB) + { + dia_b=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)==_jps_ellipseOrientation) + { + el_angle=at.value(i).toDouble(); + } + else if(at.localName(i)==_jps_ellipseColor) + { + el_color=at.value(i).toDouble(); + } + else if(at.localName(i)=="agentColor") + { + agent_color=at.value(i).toDouble(); + } + else if(at.localName(i)==_jps_xVel) + { + xVel=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)==_jps_yVel) + { + yVel=at.value(i).toDouble()*FAKTOR; + } + else if(at.localName(i)==_jps_zVel) + { + zVel=at.value(i).toDouble()*FAKTOR; + } - if(!isnan(height)){ - initialPedestriansHeights.append(QString::number(id)); - initialPedestriansHeights.append(QString::number(height)); - } - if(!isnan(color)){ - initialPedestriansColors.append(QString::number(id)); - initialPedestriansColors.append(QString::number(color)); - } - } - return true; + } + + //coordinates of the ellipse, default to the head of the agent + if(isnan(el_x)) el_x=xPos; + if(isnan(el_y)) el_y=yPos; + if(isnan(el_z)) el_z=zPos; + + double pos[3]={xPos,yPos,zPos}; + double vel[3]={xVel,yPos,zPos}; + double ellipse[7]={el_x,el_y,el_z,dia_a,dia_b,el_angle,el_color}; + double para[2]={agent_color,el_angle}; + + TrajectoryPoint * point = new TrajectoryPoint(id-1); + point->setEllipse(ellipse); + point->setPos(pos); + point->setVel(vel); + point->setAgentInfo(para); + currentFrame.push_back(point); + } + else if (qName == "agentInfo") + { + double height=std::numeric_limits<double>::quiet_NaN(); + int color=std::numeric_limits<int>::quiet_NaN(); + int id=std::numeric_limits<int>::quiet_NaN(); + + for(int i=0;i<at.length();i++) + { + if(at.localName(i)=="ID") + { + id=at.value(i).toInt(); + } + if(at.localName(i)=="height") + { + height=at.value(i).toDouble()*FAKTOR; + } + if(at.localName(i)=="color") + { + color=at.value(i).toDouble(); + } + } + if(isnan(id)) return true; + + if(!isnan(height)){ + initialPedestriansHeights.append(QString::number(id)); + initialPedestriansHeights.append(QString::number(height)); + } + if(!isnan(color)){ + initialPedestriansColors.append(QString::number(id)); + initialPedestriansColors.append(QString::number(color)); + } + } + return true; } bool SaxParser::characters(const QString &str) { @@ -766,9 +756,9 @@ void SaxParser::parseGeometryTRAV(QString content, FacilityGeometry *geometry,QD QDomElement el = walls.item(i).toElement(); //wall thickness, default to 30 cm - double thickness = el.attribute("thickness","15").toDouble(); + double thickness = el.attribute("thickness","15").toDouble()*FAKTOR; //wall height default to 250 cm - double height = el.attribute("height","250").toDouble(); + double height = el.attribute("height","250").toDouble()*FAKTOR; //wall color default to blue double color = el.attribute("color","0").toDouble(); @@ -777,13 +767,13 @@ void SaxParser::parseGeometryTRAV(QString content, FacilityGeometry *geometry,QD QDomNodeList points = el.elementsByTagName("point"); for (unsigned int i = 0; i < points.length() - 1; i++) { - double x1=points.item(i).toElement().attribute("xPos", "0").toDouble(); - double y1=points.item(i).toElement().attribute("yPos", "0").toDouble(); - double z1=points.item(i).toElement().attribute("zPos", "0").toDouble(); + double x1=points.item(i).toElement().attribute("xPos", "0").toDouble()*FAKTOR; + double y1=points.item(i).toElement().attribute("yPos", "0").toDouble()*FAKTOR; + double z1=points.item(i).toElement().attribute("zPos", "0").toDouble()*FAKTOR; - double x2=points.item(i+1).toElement().attribute("xPos", "0").toDouble(); - double y2=points.item(i+1).toElement().attribute("yPos", "0").toDouble(); - double z2=points.item(i+1).toElement().attribute("zPos", "0").toDouble(); + double x2=points.item(i+1).toElement().attribute("xPos", "0").toDouble()*FAKTOR; + double y2=points.item(i+1).toElement().attribute("yPos", "0").toDouble()*FAKTOR; + double z2=points.item(i+1).toElement().attribute("zPos", "0").toDouble()*FAKTOR; geometry->addWall(x1, y1,z1 ,x2, y2,z2,thickness,height,color); } } @@ -794,9 +784,9 @@ void SaxParser::parseGeometryTRAV(QString content, FacilityGeometry *geometry,QD QDomElement el = doors.item(i).toElement(); //door thickness, default to 15 cm - double thickness = el.attribute("thickness","15").toDouble(); + double thickness = el.attribute("thickness","15").toDouble()*FAKTOR; //door height default to 250 cm - double height = el.attribute("height","250").toDouble(); + double height = el.attribute("height","250").toDouble()*FAKTOR; //door color default to blue double color = el.attribute("color","255").toDouble(); @@ -806,13 +796,13 @@ void SaxParser::parseGeometryTRAV(QString content, FacilityGeometry *geometry,QD //Debug::Messages("found: " << points.length() <<" for this wall" <<endl; for (unsigned int i = 0; i < points.length() - 1; i++) { - double x1=points.item(i).toElement().attribute("xPos", "0").toDouble(); - double y1=points.item(i).toElement().attribute("yPos", "0").toDouble(); - double z1=points.item(i).toElement().attribute("zPos", "0").toDouble(); + double x1=points.item(i).toElement().attribute("xPos", "0").toDouble()*FAKTOR; + double y1=points.item(i).toElement().attribute("yPos", "0").toDouble()*FAKTOR; + double z1=points.item(i).toElement().attribute("zPos", "0").toDouble()*FAKTOR; - double x2=points.item(i+1).toElement().attribute("xPos", "0").toDouble(); - double y2=points.item(i+1).toElement().attribute("yPos", "0").toDouble(); - double z2=points.item(i+1).toElement().attribute("zPos", "0").toDouble(); + double x2=points.item(i+1).toElement().attribute("xPos", "0").toDouble()*FAKTOR; + double y2=points.item(i+1).toElement().attribute("yPos", "0").toDouble()*FAKTOR; + double z2=points.item(i+1).toElement().attribute("zPos", "0").toDouble()*FAKTOR; geometry->addDoor(x1, y1, z1, x2, y2,z2,thickness,height,color); } } @@ -821,11 +811,11 @@ void SaxParser::parseGeometryTRAV(QString content, FacilityGeometry *geometry,QD for (unsigned int i = 0; i < spheres.length(); i++) { double center[3]; - center[0] = spheres.item(i).toElement().attribute("centerX", "0").toDouble(); - center[1]= spheres.item(i).toElement().attribute("centerY", "0").toDouble(); - center[2]= spheres.item(i).toElement().attribute("centerZ", "0").toDouble(); - double color= spheres.item(i).toElement().attribute("color", "0").toDouble(); - double radius= spheres.item(i).toElement().attribute("radius", "0").toDouble(); + center[0] = spheres.item(i).toElement().attribute("centerX", "0").toDouble()*FAKTOR; + center[1]= spheres.item(i).toElement().attribute("centerY", "0").toDouble()*FAKTOR; + center[2]= spheres.item(i).toElement().attribute("centerZ", "0").toDouble()*FAKTOR; + double color= spheres.item(i).toElement().attribute("color", "0").toDouble()*FAKTOR; + double radius= spheres.item(i).toElement().attribute("radius", "0").toDouble()*FAKTOR; //double width = spheres.item(i).toElement().attribute("width", "0").toDouble(); //double height= spheres.item(i).toElement().attribute("height", "0").toDouble(); @@ -835,49 +825,49 @@ void SaxParser::parseGeometryTRAV(QString content, FacilityGeometry *geometry,QD for (unsigned int i = 0; i < cuboids.length(); i++) { double center[3]; - center[0] = cuboids.item(i).toElement().attribute("centerX", "0").toDouble(); - center[1]= cuboids.item(i).toElement().attribute("centerY", "0").toDouble(); - center[2]= cuboids.item(i).toElement().attribute("centerZ", "0").toDouble(); + center[0] = cuboids.item(i).toElement().attribute("centerX", "0").toDouble()*FAKTOR; + center[1]= cuboids.item(i).toElement().attribute("centerY", "0").toDouble()*FAKTOR; + center[2]= cuboids.item(i).toElement().attribute("centerZ", "0").toDouble()*FAKTOR; double color= cuboids.item(i).toElement().attribute("color", "0").toDouble(); - double length= cuboids.item(i).toElement().attribute("length", "0").toDouble(); - double width = cuboids.item(i).toElement().attribute("width", "0").toDouble(); - double height= cuboids.item(i).toElement().attribute("height", "0").toDouble(); + double length= cuboids.item(i).toElement().attribute("length", "0").toDouble()*FAKTOR; + double width = cuboids.item(i).toElement().attribute("width", "0").toDouble()*FAKTOR; + double height= cuboids.item(i).toElement().attribute("height", "0").toDouble()*FAKTOR; geometry->addObjectBox(center,height,width,length,color); // Debug::Error("cuboids: "<<length<<" || " <<width << " || "<<height<<" || "<<color<<endl; } // floors - for (unsigned int i = 0; i < floors.length(); i++) { + for ( int i = 0; i < floors.length(); i++) { - double left =floors.item(i).toElement().attribute("xMin","0").toDouble(); - double right =floors.item(i).toElement().attribute("xMax","0").toDouble(); - double up =floors.item(i).toElement().attribute("yMax","0").toDouble(); - double down =floors.item(i).toElement().attribute("yMin","0").toDouble(); - double z =floors.item(i).toElement().attribute("z","0").toDouble(); + double left =floors.item(i).toElement().attribute("xMin","0").toDouble()*FAKTOR; + double right =floors.item(i).toElement().attribute("xMax","0").toDouble()*FAKTOR; + double up =floors.item(i).toElement().attribute("yMax","0").toDouble()*FAKTOR; + double down =floors.item(i).toElement().attribute("yMin","0").toDouble()*FAKTOR; + double z =floors.item(i).toElement().attribute("z","0").toDouble()*FAKTOR; geometry->addFloor(left,down,right,up,z); } // cylinders - for (unsigned int i = 0; i < cylinders.length(); i++) { + for ( int i = 0; i < cylinders.length(); i++) { double center[3], rotation[3]; - center[0] = cylinders.item(i).toElement().attribute("centerX", "0").toDouble(); - center[1]= cylinders.item(i).toElement().attribute("centerY", "0").toDouble(); - center[2]= cylinders.item(i).toElement().attribute("centerZ", "0").toDouble(); + center[0] = cylinders.item(i).toElement().attribute("centerX", "0").toDouble()*FAKTOR; + center[1]= cylinders.item(i).toElement().attribute("centerY", "0").toDouble()*FAKTOR; + center[2]= cylinders.item(i).toElement().attribute("centerZ", "0").toDouble()*FAKTOR; double color= cylinders.item(i).toElement().attribute("color", "0").toDouble(); - double radius= cylinders.item(i).toElement().attribute("radius", "0").toDouble(); - double height= cylinders.item(i).toElement().attribute("height", "0").toDouble(); + double radius= cylinders.item(i).toElement().attribute("radius", "0").toDouble()*FAKTOR; + double height= cylinders.item(i).toElement().attribute("height", "0").toDouble()*FAKTOR; rotation[0] = cylinders.item(i).toElement().attribute("angleX", "90").toDouble(); rotation[1] = cylinders.item(i).toElement().attribute("angleY", "0").toDouble(); rotation[2] = cylinders.item(i).toElement().attribute("angleZ", "0").toDouble(); geometry->addObjectCylinder(center,radius,height,rotation,color); } - //Tlabels - for (unsigned int i = 0; i < labels.length(); i++) { + //Labels + for ( int i = 0; i < labels.length(); i++) { double center[3]; - center[0] = labels.item(i).toElement().attribute("centerX", "0").toDouble(); - center[1]= labels.item(i).toElement().attribute("centerY", "0").toDouble(); - center[2]= labels.item(i).toElement().attribute("centerZ", "0").toDouble(); + center[0] = labels.item(i).toElement().attribute("centerX", "0").toDouble()*FAKTOR; + center[1]= labels.item(i).toElement().attribute("centerY", "0").toDouble()*FAKTOR; + center[2]= labels.item(i).toElement().attribute("centerZ", "0").toDouble()*FAKTOR; double color= labels.item(i).toElement().attribute("color", "0").toDouble(); string caption= labels.item(i).toElement().attribute("text", "").toStdString(); geometry->addObjectLabel(center,center,caption,color); @@ -891,12 +881,12 @@ void SaxParser::parseGeometryXMLV04(QString filename, FacilityGeometry *geo){ QDomDocument doc(""); QFile file(filename); - int size =file.size()/(1024*1024); + //int size =file.size()/(1024*1024); - if(size>100){ - cout<<"The file is too large: "<<filename.toStdString()<<endl; - return; - } + //if(size>100){ + // cout<<"The file is too large: "<<filename.toStdString()<<endl; + // return; + //} if (!file.open(QIODevice::ReadOnly)) { qDebug()<<"could not open the file: "<<filename<<endl; @@ -977,7 +967,7 @@ void SaxParser::parseGeometryXMLV04(QString filename, FacilityGeometry *geo){ } QDomNodeList xObstaclesList=doc.elementsByTagName("obstacle"); - for (unsigned int i = 0; i < xObstaclesList.length(); i++) { + for ( int i = 0; i < xObstaclesList.length(); i++) { QDomElement xPoly = xObstaclesList.item(i).firstChildElement("polygon"); while(!xPoly.isNull()) { //wall thickness, default to 30 cm @@ -1003,7 +993,7 @@ void SaxParser::parseGeometryXMLV04(QString filename, FacilityGeometry *geo){ } QDomNodeList xCrossingsList=doc.elementsByTagName("crossing"); - for (unsigned int i = 0; i < xCrossingsList.length(); i++) { + for (int i = 0; i < xCrossingsList.length(); i++) { QDomElement xCrossing = xCrossingsList.item(i).toElement(); QDomNodeList xVertices=xCrossing.elementsByTagName("vertex"); @@ -1029,7 +1019,7 @@ void SaxParser::parseGeometryXMLV04(QString filename, FacilityGeometry *geo){ } QDomNodeList xTransitionsList=doc.elementsByTagName("transition"); - for (unsigned int i = 0; i < xTransitionsList.length(); i++) { + for ( int i = 0; i < xTransitionsList.length(); i++) { QDomElement xTransition = xTransitionsList.item(i).toElement(); QDomNodeList xVertices=xTransition.elementsByTagName("vertex"); @@ -1054,3 +1044,38 @@ void SaxParser::parseGeometryXMLV04(QString filename, FacilityGeometry *geo){ geo->addObjectLabel(center,center,id,21); } } + +void SaxParser::InitHeader(double version) +{ + // set the parsing String map + if(version==0.5){ + _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 (version==0.6){ + _jps_xPos=QString("x"); + _jps_yPos=QString("y"); + _jps_zPos=QString("z"); + _jps_xVel=QString("xV"); + _jps_yVel=QString("yV"); + _jps_zVel=QString("zV"); + _jps_radiusA=QString("rA"); + _jps_radiusB=QString("rB"); + _jps_ellipseOrientation=QString("eO"); + _jps_ellipseColor=QString("eC"); + } + else + { + cout<<"unsupported header version: "<<version<<endl; + cout<<"Please use 0.5 or 0.6 "<<endl; + exit(0); + } +} diff --git a/src/SaxParser.h b/src/SaxParser.h index 109033dc1ee73cffdd172e10b0a6ef845966403c..a4ae9edd73f936ecb670cd8f5924aa1a9f5d4714 100644 --- a/src/SaxParser.h +++ b/src/SaxParser.h @@ -46,52 +46,67 @@ class FacilityGeometry; class SaxParser: public QXmlDefaultHandler { public: - SaxParser(FacilityGeometry* geometry,SyncData* dataset, double * fps); - virtual ~SaxParser(); - bool startElement(const QString &namespaceURI, - const QString &localName, - const QString &qName, - const QXmlAttributes &attributes); - bool endElement(const QString &namespaceURI, - const QString &localName, - const QString &qName); - bool characters(const QString &str); - bool fatalError(const QXmlParseException &exception); - bool attributeDecl(const QString& eName, - const QString& aName, - const QString& type, - const QString& valueDefault, - const QString& value); - - /// provided for convenience and will be removed in the next version - static void parseGeometryJPS(QString content, FacilityGeometry *geo); - - /// provided for convenience and will be removed in the next version - static void parseGeometryXMLV04(QString content, FacilityGeometry *geo); - - /// provided for convenience and will be removed in the next version + SaxParser(FacilityGeometry* geometry,SyncData* dataset, double * fps); + virtual ~SaxParser(); + bool startElement(const QString &namespaceURI, + const QString &localName, + const QString &qName, + const QXmlAttributes &attributes); + bool endElement(const QString &namespaceURI, + const QString &localName, + const QString &qName); + bool characters(const QString &str); + bool fatalError(const QXmlParseException &exception); + bool attributeDecl(const QString& eName, + const QString& aName, + const QString& type, + const QString& valueDefault, + const QString& value); + + /// provided for convenience and will be removed in the next version + static void parseGeometryJPS(QString content, FacilityGeometry *geo); + + /// provided for convenience and will be removed in the next version + static void parseGeometryXMLV04(QString content, FacilityGeometry *geo); + + /// provided for convenience and will be removed in the next version static void parseGeometryTRAV(QString content, FacilityGeometry *geo,QDomNode geoNode=QDomNode()); private: - //clear the mo - void clearPoints(); - FacilityGeometry* geometry; - SyncData* dataset; - double*para; - QString currentText; - QStringList initialPedestriansColors; - QStringList initialPedestriansHeights; - std::vector<JPoint *> currentPointsList; - std::vector<TrajectoryPoint *> currentFrame; - bool parsingWalls; - - //wall and door parameters - double thickness; - double height; - double color; - - //actual caption of door/wall - QString caption; + //clear the mo + void clearPoints(); + void InitHeader(double version); + +private: + FacilityGeometry* geometry; + SyncData* dataset; + double*para; + QString currentText; + QStringList initialPedestriansColors; + QStringList initialPedestriansHeights; + std::vector<JPoint *> currentPointsList; + std::vector<TrajectoryPoint *> currentFrame; + bool parsingWalls; + + //wall and door parameters + double thickness; + double height; + double color; + + //actual caption of door/wall + QString caption; + + //header dependant variables + QString _jps_xPos; + QString _jps_yPos; + QString _jps_zPos; + QString _jps_xVel; + QString _jps_yVel; + QString _jps_zVel; + QString _jps_radiusA; + QString _jps_radiusB; + QString _jps_ellipseOrientation; + QString _jps_ellipseColor; }; diff --git a/src/ThreadDataTransfert.cpp b/src/ThreadDataTransfert.cpp index 55647ff405b8cb677275e26b89551d3a3b09d06d..2a4251cd63d99fc5efec9485ffc8f4f137d18727 100644 --- a/src/ThreadDataTransfert.cpp +++ b/src/ThreadDataTransfert.cpp @@ -55,6 +55,7 @@ #include "network/TraVisToServer.h" #include "geometry/FacilityGeometry.h" +#include "general/Macros.h" #include "Debug.h" @@ -169,8 +170,6 @@ void ThreadDataTransfer::slotProcessMessage(QString& data){ errNr++; Debug::Error(">> %s",(const char *)errorMsg.toStdString().c_str()); Debug::Error(">> %s",(const char *)data.toStdString().c_str()); - //Debug::Error(">> %d", errNr); - //Debug::Error(">> %s", (const char *)data.toStdString().c_str()); return; } @@ -267,40 +266,40 @@ void ThreadDataTransfer::parseDataNode(QDomNodeList frames){ //emit signal_CurrentAction("parsing data"); - for (unsigned int i = 0; i < frames.length(); i++) { + for (int i = 0; i < frames.length(); i++) { Frame *newFrame = new Frame(); QDomElement el = frames.item(i).toElement(); QDomNodeList agents = el.elementsByTagName("agent"); //cout << "found: " << agents.length() <<" agents" <<endl; - for (unsigned int i = 0; i < agents.length(); i++) { + for (int i = 0; i < agents.length(); i++) { bool ok=false; int id=agents.item(i).toElement().attribute("ID").toInt(&ok); if(!ok) continue; // invalid ID - double xPos=agents.item(i).toElement().attribute("xPos","0").toDouble(); - double yPos=agents.item(i).toElement().attribute("yPos","0").toDouble(); - double zPos=agents.item(i).toElement().attribute("zPos","0").toDouble(); + double xPos=agents.item(i).toElement().attribute("xPos","0").toDouble()*FAKTOR; + double yPos=agents.item(i).toElement().attribute("yPos","0").toDouble()*FAKTOR; + double zPos=agents.item(i).toElement().attribute("zPos","0").toDouble()*FAKTOR; double agent_color =std::numeric_limits<double>::quiet_NaN(); - double xVel=agents.item(i).toElement().attribute("xVel").toDouble(&ok); + double xVel=agents.item(i).toElement().attribute("xVel").toDouble(&ok)*FAKTOR; if(!ok)xVel=std::numeric_limits<double>::quiet_NaN(); - double yVel=agents.item(i).toElement().attribute("yVel").toDouble(&ok); + double yVel=agents.item(i).toElement().attribute("yVel").toDouble(&ok)*FAKTOR; if(!ok)yVel=std::numeric_limits<double>::quiet_NaN(); - double zVel=agents.item(i).toElement().attribute("zVel").toDouble(&ok); + double zVel=agents.item(i).toElement().attribute("zVel").toDouble(&ok)*FAKTOR; if(!ok)zVel=std::numeric_limits<double>::quiet_NaN(); //coordinates of the ellipse, default to the head of the agent - double el_x=agents.item(i).toElement().attribute("xEll").toDouble(&ok); + double el_x=agents.item(i).toElement().attribute("xEll").toDouble(&ok)*FAKTOR; if(!ok) el_x=xPos; - double el_y=agents.item(i).toElement().attribute("yEll").toDouble(&ok); + double el_y=agents.item(i).toElement().attribute("yEll").toDouble(&ok)*FAKTOR; if(!ok) el_y=yPos; - double el_z=agents.item(i).toElement().attribute("zEll").toDouble(&ok); + double el_z=agents.item(i).toElement().attribute("zEll").toDouble(&ok)*FAKTOR; if(!ok) el_z=zPos; - double dia_a=agents.item(i).toElement().attribute("radiusA").toDouble(&ok); + double dia_a=agents.item(i).toElement().attribute("radiusA").toDouble(&ok)*FAKTOR; if(!ok)dia_a=std::numeric_limits<double>::quiet_NaN(); - double dia_b=agents.item(i).toElement().attribute("radiusB").toDouble(&ok); + double dia_b=agents.item(i).toElement().attribute("radiusB").toDouble(&ok)*FAKTOR; if(!ok)dia_b=std::numeric_limits<double>::quiet_NaN(); double el_angle=agents.item(i).toElement().attribute("ellipseOrientation").toDouble(&ok); if(!ok){el_angle=std::numeric_limits<double>::quiet_NaN(); } @@ -387,7 +386,7 @@ void ThreadDataTransfer::parseShapeNode(QDomNode shape){ QStringList colors; - for (unsigned int i = 0; i < agents.length(); i++) { + for (int i = 0; i < agents.length(); i++) { bool ok=false; int id=agents.item(i).toElement().attribute("ID").toInt(&ok); diff --git a/src/geometry/FacilityGeometry.cpp b/src/geometry/FacilityGeometry.cpp index b899607806af1d286103fa1632f9cf6e2fa44aab..6a1f8beb297df2a5f7f104cc14ef1f6d7b48ab29 100644 --- a/src/geometry/FacilityGeometry.cpp +++ b/src/geometry/FacilityGeometry.cpp @@ -591,7 +591,7 @@ void FacilityGeometry::addNewElementText(double center[3], double orientation[3] //tprop->BoldOn(); //tprop->ShadowOn(); //tprop->SetLineSpacing(1.0); - tprop->SetFontSize(SystemSettings::getPedestrianCaptionSize()); + tprop->SetFontSize(SystemSettings::getPedestrianCaptionSize()); double colorRGB[3]; lookupTable->GetColor(color, colorRGB);