add grid annotation
This commit is contained in:
@@ -55,9 +55,12 @@ void Viewport::SetupPipeline(vtkRenderWindowInteractor* iren)
|
|||||||
m_Annotation->GetTextProperty()->SetFontFamilyToArial();
|
m_Annotation->GetTextProperty()->SetFontFamilyToArial();
|
||||||
m_Annotation->GetTextProperty()->SetOpacity(0.5);
|
m_Annotation->GetTextProperty()->SetOpacity(0.5);
|
||||||
m_Annotation->SetMaximumFontSize(10);
|
m_Annotation->SetMaximumFontSize(10);
|
||||||
m_Annotation->SetText(0, "uLib VTK Viewer - OpenCMT all right reserved.");
|
m_Annotation->SetText(0, "uLib VTK Viewer - OpenCMT viewer.");
|
||||||
m_Renderer->AddViewProp(m_Annotation);
|
m_Renderer->AddViewProp(m_Annotation);
|
||||||
|
|
||||||
|
// right corner annotation
|
||||||
|
m_Annotation->SetText(1, "Grid: -");
|
||||||
|
|
||||||
// Orientation axes marker (bottom-left corner)
|
// Orientation axes marker (bottom-left corner)
|
||||||
vtkNew<vtkAxesActor> axes;
|
vtkNew<vtkAxesActor> axes;
|
||||||
m_Marker->SetInteractor(iren);
|
m_Marker->SetInteractor(iren);
|
||||||
@@ -376,6 +379,17 @@ void Viewport::UpdateGrid()
|
|||||||
if (m_OriginAxes) {
|
if (m_OriginAxes) {
|
||||||
m_OriginAxes->SetScaleFactor(spacing);
|
m_OriginAxes->SetScaleFactor(spacing);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update annotation for grid size
|
||||||
|
char gridLabel[32];
|
||||||
|
if (spacing >= 1000.0) {
|
||||||
|
sprintf(gridLabel, "Grid: %.0f m", spacing / 1000.0);
|
||||||
|
} else if (spacing >= 10.0) {
|
||||||
|
sprintf(gridLabel, "Grid: %.0f cm", spacing / 10.0);
|
||||||
|
} else {
|
||||||
|
sprintf(gridLabel, "Grid: %.0f mm", spacing);
|
||||||
|
}
|
||||||
|
m_Annotation->SetText(1, gridLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user