From 7e8142b80067a2af52ceb5bdf3a9307756c1c78c Mon Sep 17 00:00:00 2001 From: Marko Luukkainen Date: Mon, 13 May 2019 15:06:48 +0300 Subject: [PATCH] Revised native library loading for VTK gitlab #2 Change-Id: If910a60f83ae69d3df81575262a69ac7ce2791c8 --- vtk/src/vtk/vtkJavaDep.java | 119 +++++++++++++++++++++++++++++++++ vtk/src/vtk/vtkObjectBase.java | 1 + vtk/src/vtk/vtkPanel.java | 105 +---------------------------- 3 files changed, 122 insertions(+), 103 deletions(-) create mode 100644 vtk/src/vtk/vtkJavaDep.java diff --git a/vtk/src/vtk/vtkJavaDep.java b/vtk/src/vtk/vtkJavaDep.java new file mode 100644 index 00000000..ade18371 --- /dev/null +++ b/vtk/src/vtk/vtkJavaDep.java @@ -0,0 +1,119 @@ +package vtk; + +/** + * Utility class to load vtk native libraries. + * + * @author luukkainen + * + */ +public class vtkJavaDep { + static String[] libs = new String[] { + "vtksys", + "vtkCommonCore", + "vtkWrappingJava", + "vtkCommonCoreJava", + "vtkCommonMath", + "vtkCommonMathJava", + "vtkCommonSystem", + "vtkCommonSystemJava", + "vtkCommonMisc", + "vtkCommonMiscJava", + "vtkCommonTransforms", + "vtkCommonTransformsJava", + "vtkCommonDataModel", + "vtkCommonDataModelJava", + "vtkCommonColor", + "vtkCommonColorJava", + "vtkCommonExecutionModel", + "vtkCommonExecutionModelJava", + "vtkCommonComputationalGeometry", + "vtkCommonComputationalGeometryJava", + "vtkexpat", + "vtkdoubleconversion", + "vtkjpeg", + "vtkzlib", + "vtklz4", + "vtklzma", + "vtktiff", + "vtkpng", + "vtkexpat", + "vtkhdf5", + "vtkhdf5_hl", + "vtkmetaio", + "vtkpugixml", + "vtksqlite", + "vtkogg", + "vtktheora", + "vtkverdict", + "vtkglew", + "vtkproj", + "vtkfreetype", + + "vtkImagingCore", + "vtkImagingCoreJava", + "vtkImagingMath", + "vtkImagingMathJava", + "vtkImagingFourier", + "vtkImagingFourierJava", + "vtkImagingSources", + "vtkImagingSourcesJava", + "vtkImagingHybrid", + "vtkImagingHybridJava", + "vtkImagingColor", + "vtkImagingColorJava", + "vtkImagingGeneral", + "vtkImagingGeneralJava", + + "vtkFiltersCore", + "vtkFiltersCoreJava", + "vtkFiltersGeometry", + "vtkFiltersGeometryJava", + "vtkFiltersGeneral", + "vtkFiltersGeneralJava", + "vtkFiltersSources", + "vtkFiltersSourcesJava", + "vtkFiltersGeneric", + "vtkFiltersGenericJava", + "vtkFiltersStatistics", + "vtkFiltersStatisticsJava", + "vtkFiltersExtraction", + "vtkFiltersExtractionJava", + "vtkFiltersModeling", + "vtkFiltersModelingJava", + + "vtkRenderingCore", + "vtkRenderingCoreJava", + "vtkRenderingOpenGL2", + "vtkRenderingOpenGL2Java", + "vtkRenderingVolume", + "vtkRenderingVolumeJava", + "vtkRenderingVolumeOpenGL2", + "vtkRenderingVolumeOpenGL2Java", + + "vtkRenderingFreeType", + "vtkRenderingFreeTypeJava", + "vtkRenderingAnnotation", + "vtkRenderingAnnotationJava", + + "vtkFiltersHybrid", + "vtkFiltersHybridJava", + + "vtkInteractionStyle", + "vtkInteractionStyleJava", + "vtkInteractionWidgets", + "vtkInteractionWidgetsJava", + "vtkInteractionImage", + "vtkInteractionImageJava", + + }; + + + static { + for (String lib : libs) + System.loadLibrary(lib); + } + + static void load() { + + } +} diff --git a/vtk/src/vtk/vtkObjectBase.java b/vtk/src/vtk/vtkObjectBase.java index 539aa966..5b88cd51 100644 --- a/vtk/src/vtk/vtkObjectBase.java +++ b/vtk/src/vtk/vtkObjectBase.java @@ -44,6 +44,7 @@ public class vtkObjectBase public static vtk.vtkJavaMemoryManager JAVA_OBJECT_MANAGER = new vtk.vtkJavaMemoryManagerImpl(); public vtkObjectBase() { + vtkJavaDep.load(); this.vtkId = this.VTKInit(); vtkObjectBase.JAVA_OBJECT_MANAGER.registerJavaObject(this.vtkId, this); } diff --git a/vtk/src/vtk/vtkPanel.java b/vtk/src/vtk/vtkPanel.java index 6747f924..aaa340ed 100644 --- a/vtk/src/vtk/vtkPanel.java +++ b/vtk/src/vtk/vtkPanel.java @@ -36,110 +36,8 @@ public class vtkPanel extends Canvas implements MouseListener, MouseMotionListen protected int InteractionMode = 1; protected boolean rendering = false; - static String[] libs = new String[] { - "vtksys", - "vtkCommonCore", - "vtkWrappingJava", - "vtkCommonCoreJava", - "vtkCommonMath", - "vtkCommonMathJava", - "vtkCommonSystem", - "vtkCommonSystemJava", - "vtkCommonMisc", - "vtkCommonMiscJava", - "vtkCommonTransforms", - "vtkCommonTransformsJava", - "vtkCommonDataModel", - "vtkCommonDataModelJava", - "vtkCommonColor", - "vtkCommonColorJava", - "vtkCommonExecutionModel", - "vtkCommonExecutionModelJava", - "vtkCommonComputationalGeometry", - "vtkCommonComputationalGeometryJava", - "vtkexpat", - "vtkdoubleconversion", - "vtkjpeg", - "vtkzlib", - "vtklz4", - "vtklzma", - "vtktiff", - "vtkpng", - "vtkexpat", - "vtkhdf5", - "vtkhdf5_hl", - "vtkmetaio", - "vtkpugixml", - "vtksqlite", - "vtkogg", - "vtktheora", - "vtkverdict", - "vtkglew", - "vtkproj", - "vtkfreetype", - - "vtkImagingCore", - "vtkImagingCoreJava", - "vtkImagingMath", - "vtkImagingMathJava", - "vtkImagingFourier", - "vtkImagingFourierJava", - "vtkImagingSources", - "vtkImagingSourcesJava", - "vtkImagingHybrid", - "vtkImagingHybridJava", - "vtkImagingColor", - "vtkImagingColorJava", - "vtkImagingGeneral", - "vtkImagingGeneralJava", - - "vtkFiltersCore", - "vtkFiltersCoreJava", - "vtkFiltersGeometry", - "vtkFiltersGeometryJava", - "vtkFiltersGeneral", - "vtkFiltersGeneralJava", - "vtkFiltersSources", - "vtkFiltersSourcesJava", - "vtkFiltersGeneric", - "vtkFiltersGenericJava", - "vtkFiltersStatistics", - "vtkFiltersStatisticsJava", - "vtkFiltersExtraction", - "vtkFiltersExtractionJava", - "vtkFiltersModeling", - "vtkFiltersModelingJava", - - "vtkRenderingCore", - "vtkRenderingCoreJava", - "vtkRenderingOpenGL2", - "vtkRenderingOpenGL2Java", - "vtkRenderingVolume", - "vtkRenderingVolumeJava", - "vtkRenderingVolumeOpenGL2", - "vtkRenderingVolumeOpenGL2Java", - - "vtkRenderingFreeType", - "vtkRenderingFreeTypeJava", - "vtkRenderingAnnotation", - "vtkRenderingAnnotationJava", - - "vtkFiltersHybrid", - "vtkFiltersHybridJava", - - "vtkInteractionStyle", - "vtkInteractionStyleJava", - "vtkInteractionWidgets", - "vtkInteractionWidgetsJava", - "vtkInteractionImage", - "vtkInteractionImageJava", - - }; - - static { - for (String lib : libs) - System.loadLibrary(lib); + vtkJavaDep.load(); } // Allow access to display lock() and unlock(). @@ -186,6 +84,7 @@ public class vtkPanel extends Canvas implements MouseListener, MouseMotionListen protected native int UnLock(); public vtkPanel() { + rw.AddRenderer(ren); addMouseListener(this); addMouseMotionListener(this); -- 2.47.1