ソースを参照

change showxodrinvtk, add z value.

yuchuli 1 年間 前
コミット
687fdfc4af

+ 3 - 1
src/tool/view_showxodrinvtk/main.cpp

@@ -15,10 +15,12 @@ void viewerOneOff (pcl::visualization::PCLVisualizer& viewer)
 {
 {
     //设置背景颜色
     //设置背景颜色
    viewer.setBackgroundColor(0.0,0.0,0.0);
    viewer.setBackgroundColor(0.0,0.0,0.0);
-   viewer.resetCamera();
+
 
 
    ShowXODRINVTK(viewer);
    ShowXODRINVTK(viewer);
 
 
+   viewer.resetCamera();
+
 
 
 
 
 }
 }

+ 8 - 8
src/tool/view_showxodrinvtk/showxodrinvtk.cpp

@@ -10,7 +10,7 @@
 static int gnLineIndex = 0;
 static int gnLineIndex = 0;
 
 
 
 
-void DrawLine(std::vector<iv::LanePoint> & xveclastlp,std::vector<iv::LanePoint> & xveclp,pcl::visualization::PCLVisualizer& viewer)
+void DrawLine(std::vector<iv::LanePoint> & xveclastlp,std::vector<iv::LanePoint> & xveclp,pcl::visualization::PCLVisualizer& viewer, double  fz)
 {
 {
 
 
 
 
@@ -24,8 +24,8 @@ void DrawLine(std::vector<iv::LanePoint> & xveclastlp,std::vector<iv::LanePoint>
             {
             {
                 iv::LanePoint xLast = xveclastlp[j];
                 iv::LanePoint xLast = xveclastlp[j];
 
 
-                pcl::PointXYZ mass_center(xLast.mfX,xLast.mfY,0);
-                pcl::PointXYZ kinectZ(xNow.mfX,xNow.mfY,0);
+                pcl::PointXYZ mass_center(xLast.mfX,xLast.mfY,fz);
+                pcl::PointXYZ kinectZ(xNow.mfX,xNow.mfY,fz);
 
 
                 char strgeoname[256];
                 char strgeoname[256];
                 snprintf(strgeoname,256,"xodr%d",gnLineIndex);
                 snprintf(strgeoname,256,"xodr%d",gnLineIndex);
@@ -41,7 +41,7 @@ void DrawLine(std::vector<iv::LanePoint> & xveclastlp,std::vector<iv::LanePoint>
     }
     }
 }
 }
 
 
-void ShowRoad(pcl::visualization::PCLVisualizer& viewer,Road * pRoad)
+void ShowRoad(pcl::visualization::PCLVisualizer& viewer,Road * pRoad,double  fz)
 {
 {
 
 
     if(pRoad->GetLaneSectionCount()<1)
     if(pRoad->GetLaneSectionCount()<1)
@@ -79,7 +79,7 @@ void ShowRoad(pcl::visualization::PCLVisualizer& viewer,Road * pRoad)
         {
         {
 
 
             //Draw Line
             //Draw Line
-            DrawLine(xveclastlp,xveclp,viewer);
+            DrawLine(xveclastlp,xveclp,viewer,fz);
             xveclastlp = xveclp;
             xveclastlp = xveclp;
             flasthdg = fhdg;
             flasthdg = fhdg;
             flastS = s;
             flastS = s;
@@ -92,7 +92,7 @@ void ShowRoad(pcl::visualization::PCLVisualizer& viewer,Road * pRoad)
     {
     {
         pRoad->GetGeometryCoords(fRoadLen,x,y,fhdg);
         pRoad->GetGeometryCoords(fRoadLen,x,y,fhdg);
         xveclp = xodrfunc::GetAllLanePoint(pRoad,s,x,y,fhdg);
         xveclp = xodrfunc::GetAllLanePoint(pRoad,s,x,y,fhdg);
-        DrawLine(xveclastlp,xveclp,viewer);
+        DrawLine(xveclastlp,xveclp,viewer,fz);
     }
     }
 
 
 
 
@@ -100,7 +100,7 @@ void ShowRoad(pcl::visualization::PCLVisualizer& viewer,Road * pRoad)
 
 
 }
 }
 
 
-void ShowXODRINVTK(pcl::visualization::PCLVisualizer& viewer)
+void ShowXODRINVTK(pcl::visualization::PCLVisualizer& viewer,double  fz)
 {
 {
 
 
     char strpath[256];
     char strpath[256];
@@ -114,7 +114,7 @@ void ShowXODRINVTK(pcl::visualization::PCLVisualizer& viewer)
     unsigned int i;
     unsigned int i;
     for(i=0;i<xxodr.GetRoadCount();i++)
     for(i=0;i<xxodr.GetRoadCount();i++)
     {
     {
-        ShowRoad(viewer,xxodr.GetRoad(i));
+        ShowRoad(viewer,xxodr.GetRoad(i),fz);
     }
     }
 
 
 
 

+ 1 - 1
src/tool/view_showxodrinvtk/showxodrinvtk.h

@@ -3,6 +3,6 @@
 
 
 #include <pcl/visualization/cloud_viewer.h>
 #include <pcl/visualization/cloud_viewer.h>
 
 
-void ShowXODRINVTK(pcl::visualization::PCLVisualizer& viewer);
+void ShowXODRINVTK(pcl::visualization::PCLVisualizer& viewer,double  fz = 0.0);
 
 
 #endif // SHOWXODRINVTK_H
 #endif // SHOWXODRINVTK_H