0
点赞
收藏
分享

微信扫一扫

VTK 标注控件 方向 Widget1.vtkOrientationMarkerWidget


1.vtkOrientationMarkerWidget

VTK 标注控件 方向 Widget1.vtkOrientationMarkerWidget_Orientation

vtkOrientationMarkerWidget用于操纵标记道具的2D小部件;
此类支持以交互方式操纵表示方向标记的道具的位置、大小和外观方向。此类的工作方式是将其内部渲染器添加到不同层上的外部“父”渲染器。输入方向标记在父渲染器上渲染为覆盖,因此显示为覆盖父场景中的所有道具。通过观察者机制使标记方向的摄影机视图与父对象的方向相匹配,从而产生一种错觉,即标记方向反映父对象场景中道具的方向。

成员:

#include <vtkAxesActor.h>
   #include <vtkOrientationMarkerWidget.h>

    vtkNew<vtkAxesActor> iconActor;
    vtkNew<vtkOrientationMarkerWidget> orientationWidget;

 实现:

orientationWidget->SetOutlineColor(0.9300, 0.5700, 0.1300);
       orientationWidget->SetInteractor(ui->widget->GetInteractor());
       orientationWidget->SetOrientationMarker(iconActor);
       orientationWidget->SetViewport(0.0, 0.0, 0.2, 0.2);
       orientationWidget->SetEnabled(1);
       orientationWidget->InteractiveOn();

2.vtkCameraOrientationWidget

 

VTK 标注控件 方向 Widget1.vtkOrientationMarkerWidget_Orientation_02

 注意: VTK 9.0 后才会有;

成员:


vtkNew<vtkCameraOrientationWidget> mOrientationWidget;


实现:

mOrientationWidget->SetParentRenderer(mRenderer);
     mOrientationWidget->On();

3.vtkTextActor

VTK 标注控件 方向 Widget1.vtkOrientationMarkerWidget_VTK_03

vtkNew<vtkTextActor> textActorT;
       vtkNew<vtkTextProperty> textProperty;
       textProperty->SetFontSize(60);
      // textProperty->SetFontFamily(VTK_FONT_FILE);
      // textProperty->SetFontFile(QString("E:/songti.ttf").toUtf8());
       textProperty->SetColor(1, 0, 0);
       textActorT->SetTextProperty(textProperty);
       textActorT->SetInput(QString::fromLocal8Bit("123ascdjdfdsf").toUtf8());
       textActorT->SetDisplayPosition(50, 50);
       mRenderer->AddActor(textActorT);

更复杂用法见vtkTextWidget

在渲染场景中生成一串标识文本,可以随意调整该文本在渲染场景中的位置,缩放其大小等

 

举报

相关推荐

0 条评论