]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling/src/org/simantics/modeling/svg/CreateSVGElement.java
Combination of Simantics-platform related changes and fixes for district
[simantics/platform.git] / bundles / org.simantics.modeling / src / org / simantics / modeling / svg / CreateSVGElement.java
index 994d417c99b815ba4c3deae54511777a84e8fc05..1f302a64db4c2b7262339366bdb438123e7b3d11 100644 (file)
@@ -19,6 +19,10 @@ import org.simantics.utils.FileUtils;
 public class CreateSVGElement {
 
     public static void createSVGElement(WriteGraph g, Resource diagram, String suffix, byte[] data, double mposX, double mposY) throws DatabaseException {
 public class CreateSVGElement {
 
     public static void createSVGElement(WriteGraph g, Resource diagram, String suffix, byte[] data, double mposX, double mposY) throws DatabaseException {
+        createSVGElement(g, diagram, suffix, data, mposX, mposY);
+    }
+
+    public static Resource createSVGElementR(WriteGraph g, Resource diagram, String suffix, byte[] data, double mposX, double mposY) throws DatabaseException {
 
         Layer0 L0 = Layer0.getInstance(g);
         DiagramResource DIA = DiagramResource.getInstance(g);
 
         Layer0 L0 = Layer0.getInstance(g);
         DiagramResource DIA = DiagramResource.getInstance(g);
@@ -50,19 +54,22 @@ public class CreateSVGElement {
             throw new DatabaseException("Unknown image format " + suffix);
         OrderedSetUtils.addFirst(g, diagram, element);
         g.claim(diagram, L0.ConsistsOf, element);
             throw new DatabaseException("Unknown image format " + suffix);
         OrderedSetUtils.addFirst(g, diagram, element);
         g.claim(diagram, L0.ConsistsOf, element);
-
+        return element;
     }
     }
-    
+
     public static void importSVGElement(WriteGraph graph, Resource diagram, File file, double posX, double posY) throws DatabaseException, IOException {
     public static void importSVGElement(WriteGraph graph, Resource diagram, File file, double posX, double posY) throws DatabaseException, IOException {
-        
+        importSVGElementR(graph, diagram, file, posX, posY);
+    }
+
+    public static Resource importSVGElementR(WriteGraph graph, Resource diagram, File file, double posX, double posY) throws DatabaseException, IOException {
         final byte[] data = FileUtils.readFile(file);
         final byte[] data = FileUtils.readFile(file);
-        createSVGElement(graph, diagram, suffix(file.getName()), data, posX, posY);
+        return createSVGElementR(graph, diagram, suffix(file.getName()), data, posX, posY);
     }
     }
-    
+
     private static String suffix(String fileName) {
         int len = fileName.length();
         if(len < 3) return null;
         else return fileName.substring(len-3,len).toLowerCase();
     }
     private static String suffix(String fileName) {
         int len = fileName.length();
         if(len < 3) return null;
         else return fileName.substring(len-3,len).toLowerCase();
     }
-    
+
 }
 }