I tried to make vtkAnnotatedCubeActor
to display Chinese and some other languages, but I found that it’s not realistic to just SetXPlusFaceText(**Other font**)
like this. So I refers to use vtkTextActor to display chinese - Support - VTK and try to get the vtkTextActor
inside the vtkAnnotatedCubeActor
, with code like this:
vtkSmartPointer<vtkAnnotatedCubeActor> annotated_cube = vtkSmartPointer<vtkAnnotatedCubeActor>::New();
annotated_cube->SetFaceTextScale(1.0 / 1.6);
vtkSmartPointer<vtkPropCollection> props = vtkSmartPointer<vtkPropCollection>::New();
annotated_cube->GetActors(props);
props->InitTraversal();
vtkProp* prop;
while ((prop = props->GetNextProp()) != nullptr) {
vtkTextActor* actor = vtkTextActor::SafeDownCast(prop);
if (actor) {
actor->SetInput("V"); // V just for test if vtkTextActor works
}
}
But inside the vtkAnnotatedCubeActor shows:
vtkActor *XPlusFaceActor;
vtkActor *XMinusFaceActor;
vtkActor *YPlusFaceActor;
vtkActor *YMinusFaceActor;
vtkActor *ZPlusFaceActor;
vtkActor *ZMinusFaceActor;
and
//@{
/**
* Set/get the face text.
*/
vtkSetStringMacro( XPlusFaceText );
vtkGetStringMacro( XPlusFaceText );
vtkSetStringMacro( XMinusFaceText );
vtkGetStringMacro( XMinusFaceText );
vtkSetStringMacro( YPlusFaceText );
vtkGetStringMacro( YPlusFaceText );
vtkSetStringMacro( YMinusFaceText );
vtkGetStringMacro( YMinusFaceText );
vtkSetStringMacro( ZPlusFaceText );
vtkGetStringMacro( ZPlusFaceText );
vtkSetStringMacro( ZMinusFaceText );
vtkGetStringMacro( ZMinusFaceText );
I have no idea how to edit the TextProperty. Could you give me some advice? Great Thanks!
(If change the TextProperty won’t work, I also did another solution2 but I have no idea why it didn’t work…)