zoukankan      html  css  js  c++  java
  • vtk画折线,并且禁止鼠标交互

    VTK画图,禁止鼠标拖动时滚动图形,鼠标滚轮滚动时放大/缩小图形的方法。

    renderLine.InteractiveOff();

    下面是VTK画折线的代码

    // Create five points
                double[,] p = new double[,] {
                    { 0.0, 0.0, 0.0 },
                    { 1.0, 0.0, 0.0 },
                    { 0.0, 1.0, 0.0 },
                    { 0.0, 1.0, 2.0 },
                    { 0.0, 3.0, 3.0 }
                };
    
                // Create the points
                vtkPoints points = vtkPoints.New();
                for (int i = 0; i < 5; i++)
                    points.InsertNextPoint(p[i, 0], p[i, 1], p[i, 2]);
    
    
                vtkPolyLine polyLine = vtkPolyLine.New();
                polyLine.GetPointIds().SetNumberOfIds(5);
                for (int i = 0; i < 5; i++)
                    polyLine.GetPointIds().SetId(i, i);
    
                // Create a cell array to store the lines in and add the lines to it
                vtkCellArray cells = vtkCellArray.New();
                cells.InsertNextCell(polyLine);
    
                vtkPolyData polyData = vtkPolyData.New();
                polyData.SetPoints(points);
                polyData.SetLines(cells);
    
                vtkPolyDataMapper mapper = vtkPolyDataMapper.New();
                mapper.SetInput(polyData);
                vtkActor actor = vtkActor.New();
                actor.SetMapper(mapper);
                //vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;
                //vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();
    
                //vtkRenderer renderLine = vtkRenderer.New();
                //renderLine.SetBackground(0.2, 0.3, 0.4);
                renderLine.AddActor(actor);
    
                renderLine.ResetCamera();
                vtkCamera camera = renderLine.GetActiveCamera();
                camera.Zoom(1.5);
    
    
                //渲染窗口添加网格渲染器
                renderWindow.AddRenderer(renderLine);
    
                //渲染窗口开启双缓冲
                renderWindow.SetDoubleBuffer(1);
                renderWindow.Render();
    
  • 相关阅读:
    【Mybatis源码解析】Mybatis的日志系统
    20200728
    【Mybatis源码解析】-Configuration
    【日志】怎么打印日志
    【OOM】几种常见的OOM异常
    树 [虚树, 动态规划]
    最大公约数 [动态规划]
    送分题 [组合计数]
    LCM [树状数组, HH的项链]
    AT1219 歴史の研究 [回滚莫队]
  • 原文地址:https://www.cnblogs.com/yahb/p/11345047.html
Copyright © 2011-2022 走看看