vtkDistanceWidget修改文本颜色

  vtkSmartPointer distanceActor;

 vtkAxisActor2D *axis =
        static_cast(
            _disMeasureList[i]->distanceActor->GetDistanceRepresentation())
            ->GetAxis();
    vtkPointHandleRepresentation2D *h1 =
        dynamic_cast(
            _disMeasureList[i]->distanceActor->GetDistanceRepresentation()->GetPoint1Representation());
    vtkPointHandleRepresentation2D *h2 =
        dynamic_cast(
            _disMeasureList[i]
                ->distanceActor->GetDistanceRepresentation()
                ->GetPoint1Representation());
    if (_disMeasureList[i]->isSelected) {
      axis->GetProperty()->SetColor(_colorDistanceSelected);
      if (h1) h1->GetProperty()->SetColor(_colorDistanceSelected);
      if (h2) h2->GetProperty()->SetColor(_colorDistanceSelected);

       auto _textProperty = vtkSmartPointer::New();
      _textProperty->SetColor(0, 0.776, 1);
      _textProperty->SetFontSize(20);
      _textProperty->SetOrientation(0.0);
      _textProperty->SetShadow(true);
      _textProperty->SetBold(false);
      _textProperty->SetItalic(false);
      _textProperty->SetFontFamilyAsString("Segoe UI");
      _textProperty->SetFontSize(18);
           
      axis->SetTitleTextProperty(_textProperty);

vtkDistanceWidget修改文本颜色_第1张图片

 

你可能感兴趣的:(VTK,C++,vtk)