The Higher Education and Research forge

Home My Page Projects Code Snippets Project Openings Complex Surface Machining Optimization
Summary Activity SCM

SCM Repository

authorJean-Max Redonnet <jean-max.redonnet@unniv-tlse3.fr>
Mon, 18 May 2020 20:38:23 +0000 (22:38 +0200)
committerJean-Max Redonnet <jean-max.redonnet@unniv-tlse3.fr>
Mon, 18 May 2020 20:38:23 +0000 (22:38 +0200)
src/org/ica/cosmo/tools/PathManager.java [deleted file]
src/org/ica/cosmo/tools/SurfaceMapDisplay.java [deleted file]

diff --git a/src/org/ica/cosmo/tools/PathManager.java b/src/org/ica/cosmo/tools/PathManager.java
deleted file mode 100644 (file)
index 8f53143..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.ica.cosmo.tools;
-
-import java.util.ArrayList;
-
-public class PathManager {
-       private static volatile PathManager instance = null;
-       private final String resourcesPath = new String("src/org/ica/cosmo/tests/resources/");
-       private final String tmpPath = System.getProperty("java.io.tmpdir");
-
-       public final static PathManager getInstance() {
-               if (PathManager.instance == null) {
-                       synchronized (PathManager.class) {
-                               if (PathManager.instance == null) {
-                                       PathManager.instance = new PathManager();
-                               }
-                       }
-               }
-               return PathManager.instance;
-       }
-
-       public String getResourcesPath() {
-               return resourcesPath;
-       }
-
-       public String getTmpPath() {
-               return tmpPath;
-       }
-
-       public String[] getAllowedTypes() {
-               ArrayList<String> list = new ArrayList<String>();
-               list.add(new String("java.**"));
-               list.add(new String("org.lgmt.dgl.**"));
-               list.add(new String("org.lgmt.jcam.**"));
-               list.add(new String("org.ica.cosmo.**"));
-               String[] a = new String[list.size()];
-               return list.toArray(a);
-       }
-}
diff --git a/src/org/ica/cosmo/tools/SurfaceMapDisplay.java b/src/org/ica/cosmo/tools/SurfaceMapDisplay.java
deleted file mode 100644 (file)
index 42faa8f..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.ica.cosmo.tools;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-import org.ica.cosmo.zoning.SurfaceMap;
-import org.ica.vtkviewer.VtkViewer;
-import org.ica.vtkviewer.model.VtkModel;
-import org.ica.vtkviewer.model.VtkSurfaceMap;
-
-import com.thoughtworks.xstream.XStream;
-
-import vtk.vtkNativeLibrary;
-
-public class SurfaceMapDisplay {
-       private final String resourcesPath = PathManager.getInstance().getResourcesPath();
-       private final String tmpPath = PathManager.getInstance().getTmpPath();
-
-       static {
-               if (!vtkNativeLibrary.LoadAllNativeLibraries()) {
-                       for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {
-                               if (!lib.IsLoaded()) {
-                                       System.out.println(lib.GetLibraryName() + " not loaded");
-                               }
-                       }
-               }
-               vtkNativeLibrary.DisableOutputWindow(null);
-       }
-
-       public static File newFile(File destinationDir, ZipEntry zipEntry) throws IOException {
-               File destFile = new File(destinationDir, zipEntry.getName());
-
-               String destDirPath = destinationDir.getCanonicalPath();
-               String destFilePath = destFile.getCanonicalPath();
-
-               if (!destFilePath.startsWith(destDirPath + File.separator)) {
-                       throw new IOException("Entry is outside of the target dir: " + zipEntry.getName());
-               }
-
-               return destFile;
-       }
-
-       public SurfaceMapDisplay(File file) {
-               SurfaceMap map = null;
-
-               String filename = file.getName();
-               String zipFile = new String(resourcesPath + filename);
-
-               File destDir = new File(tmpPath);
-               byte[] buffer = new byte[1024];
-               ZipInputStream zis;
-               File tmpFile = null;
-               try {
-                       zis = new ZipInputStream(new FileInputStream(zipFile));
-                       ZipEntry zipEntry;
-                       zipEntry = zis.getNextEntry();
-                       tmpFile = newFile(destDir, zipEntry);
-                       FileOutputStream fos = new FileOutputStream(tmpFile);
-                       int len;
-                       while ((len = zis.read(buffer)) > 0) {
-                               fos.write(buffer, 0, len);
-                       }
-                       fos.close();
-                       zipEntry = zis.getNextEntry();
-                       zis.closeEntry();
-                       zis.close();
-               } catch (FileNotFoundException e1) {
-                       e1.printStackTrace();
-               } catch (IOException e) {
-                       e.printStackTrace();
-               }
-
-               XStream xstream = new XStream();
-               XStream.setupDefaultSecurity(xstream);
-               xstream.allowTypesByWildcard(PathManager.getInstance().getAllowedTypes());
-               try {
-                       FileInputStream fis = new FileInputStream(tmpFile);
-                       map = (SurfaceMap) xstream.fromXML(fis);
-                       fis.close();
-               } catch (FileNotFoundException e) {
-                       e.printStackTrace();
-               } catch (IOException e) {
-                       e.printStackTrace();
-               }
-
-               if (map != null) {
-                       VtkModel model = new VtkModel();
-                       model.add(new VtkSurfaceMap(map));
-                       VtkViewer viewer = new VtkViewer(model, filename);
-                       viewer.run();
-               }
-       }
-}