]> gerrit.simantics Code Review - simantics/3d.git/blob - org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/utils/AxesDisplay.java
Scale tooltip font by display DPI.
[simantics/3d.git] / org.simantics.g3d.vtk / src / org / simantics / g3d / vtk / utils / AxesDisplay.java
1 package org.simantics.g3d.vtk.utils;
2
3 import org.simantics.g3d.vtk.common.VtkView;
4
5 import vtk.vtkAxesActor;
6 import vtk.vtkOrientationMarkerWidget;
7
8 public class AxesDisplay {
9         
10         
11         private VtkView panel;
12         
13         public AxesDisplay(VtkView panel) {
14                 this.panel = panel;
15         }
16         
17         public void show() {
18                 vtkAxesActor axes = new vtkAxesActor();
19                 axes.GetXAxisCaptionActor2D().GetCaptionTextProperty().SetColor(0,0,0);
20                 axes.GetYAxisCaptionActor2D().GetCaptionTextProperty().SetColor(0,0,0);
21                 axes.GetZAxisCaptionActor2D().GetCaptionTextProperty().SetColor(0,0,0);
22                 axes.GetXAxisCaptionActor2D().GetCaptionTextProperty().SetShadow(0);
23                 axes.GetYAxisCaptionActor2D().GetCaptionTextProperty().SetShadow(0);
24                 axes.GetZAxisCaptionActor2D().GetCaptionTextProperty().SetShadow(0);
25                 axes.GetXAxisCaptionActor2D().GetCaptionTextProperty().ItalicOff();
26                 axes.GetYAxisCaptionActor2D().GetCaptionTextProperty().ItalicOff();
27                 axes.GetZAxisCaptionActor2D().GetCaptionTextProperty().ItalicOff();
28                 axes.GetXAxisCaptionActor2D().GetCaptionTextProperty().Delete();
29                 axes.GetYAxisCaptionActor2D().GetCaptionTextProperty().Delete();
30                 axes.GetZAxisCaptionActor2D().GetCaptionTextProperty().Delete();
31                 axes.GetXAxisCaptionActor2D().Delete();
32                 axes.GetYAxisCaptionActor2D().Delete();
33                 axes.GetZAxisCaptionActor2D().Delete();
34                 vtkOrientationMarkerWidget widget = new vtkOrientationMarkerWidget();
35                 widget.SetOutlineColor(0.9300, 0.5700, 0.1300 );
36                 widget.SetOrientationMarker(axes);
37                 widget.SetInteractor(panel.getRenderWindowInteractor());
38                 //widget.SetViewport(0.8, 0.0, 1.0, 0.2); // bottom right
39                 //widget.SetViewport(0.0, 0.0, 0.4, 0.4);
40                 widget.SetViewport(0.0, 0.0, 0.2, 0.2);  // bottom left
41                 widget.SetEnabled(1);
42                 widget.InteractiveOff();
43                 
44                 panel.addDeletable(widget);
45                 panel.addDeletable(axes);
46         }
47
48 }