@@ -0,0 +1,2516 @@
+import vtk.vtkNativeLibrary;%0Aimport vtk.vtkActor;%0Aimport vtk.vtkRenderWindowInteractor;%0Aimport vtk.vtkSphereSource;%0Aimport vtk.vtkNamedColors;%0Aimport vtk.vtkPolyDataMapper;%0Aimport vtk.vtkCompassRepresentation;%0Aimport vtk.vtkCompassWidget;%0Aimport vtk.vtkRenderWindow;%0Aimport vtk.vtkRenderer;%0A%0A%0Apublic class CompassWidget  %7B%0A%09 // private static final long serialVersionUID = 1L;%0A%09  %0A%0A%09  // -----------------------------------------------------------------%0A%09  // Load VTK library and print which library was not properly loaded%0A%09  static %7B%0A%09    if (!vtkNativeLibrary.LoadAllNativeLibraries()) %7B%0A%09      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) %7B%0A%09        if (!lib.IsLoaded()) %7B%0A%09          System.out.println(lib.GetLibraryName() + %22 not loaded%22);%0A%09        %7D%0A%09      %7D%0A%09    %7D%0A%09    vtkNativeLibrary.DisableOutputWindow(null);%0A%09  %7D%0A%09  // -----------------------------------------------------------------%0A%09  %0A%09  public static void main(String s%5B%5D) %7B%0A%09%09 %0A%09%09  %0A%09%09  vtkNamedColors Color = new vtkNamedColors(); %0A%0A%09%09   //For Renderer Background Color%0A%09%09   double BgColor%5B%5D = new double%5B4%5D;%0A%09%09   %09   //Change Color Name to Use your own Color for Renderer Background%0A%09%09   Color.GetColor(%22Black%22,BgColor);%0A%09%09   %0A%09%09   %0A%09%09   //Create a Sphere%0A%09%09   vtkSphereSource Sphere = new vtkSphereSource();%0A%09%09   Sphere.SetCenter(0.0,0.0,0.0);%0A%09%09   Sphere.SetRadius(4.0);%0A%09%09   Sphere.Update();%0A%09%09   %0A%09%09   //Create a Mapper and Actor%0A%09%09   vtkPolyDataMapper Mapper = new vtkPolyDataMapper();%0A%09%09   Mapper.SetInputConnection(Sphere.GetOutputPort());%0A%0A%09%09   vtkActor Actor = new vtkActor();%0A%09%09   Actor.SetMapper(Mapper);%0A%09%09%0A%09%09   // An interactor%0A%09%09  vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();%0A%09%09  %0A%09%09  vtkCompassRepresentation CompassRepresentation = new vtkCompassRepresentation();%0A%09%09  vtkCompassWidget CompassWidget = new vtkCompassWidget();%0A%09%09  CompassWidget.SetRepresentation(CompassRepresentation);%0A%09%09  CompassWidget.EnabledOn();%0A%09%09  CompassWidget.SetInteractor(iren);%0A%09%09  %0A%09%09  %0A%09%09  // Create the renderer, render window and interactor.%0A%09    vtkRenderer ren = new vtkRenderer();%0A%09    vtkRenderWindow renWin = new vtkRenderWindow();%0A%09    renWin.AddRenderer(ren);%0A%09    renWin.SetInteractor(iren);%0A%09    iren.SetRenderWindow(renWin);%0A%09        %0A%09    // Visualise the arrow%0A%09    ren.AddActor(Actor);%0A%09    ren.SetBackground(BgColor);%0A%09    ren.ResetCamera();%0A%09        %0A%09    CompassWidget.EnabledOn();%0A%0A%09    renWin.SetSize(300, 300);%0A%09    renWin.Render();%0A%09        %0A%09%09  iren.Start();%0A%09     iren.Initialize();%0A%0A%09  %7D%0A%09%7D %0A

Create CompassWidget.java