Bladeren bron

fixed bug

jascha Bohne 8 jaren geleden
bovenliggende
commit
27a73f70f8

+ 0 - 20
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/graphs/GraphHelper.java

@@ -182,26 +182,6 @@ public class GraphHelper {
 	 */
 	public static void setAllDefaults(MyGraph g){
 		for (Node n : g.getNodeSet()) {
-			//yed conversion
-			if (!n.hasAttribute("ui.label") && n.hasAttribute("yEd.label")) {
-				n.addAttribute("ui.label", n.getAttribute("yEd.label").toString());
-				n.removeAttribute("yEd.label");
-			} else if(n.hasAttribute("ui.label")) {
-				n.removeAttribute("yEd.label");
-			}
-			if (n.hasAttribute("yEd.x") && !n.getAttribute("yEd.x").equals("")) {
-				n.addAttribute("x", Main.getInstance().convertAttributeTypes(n.getAttribute("yEd.x"), new Double(0.0)));
-				n.removeAttribute("yEd.x");
-			} else{
-				n.removeAttribute("yEd.x");
-			}
-			if (n.hasAttribute("yEd.y") && !n.getAttribute("yEd.y").equals("")) {
-				n.addAttribute("y", Main.getInstance().convertAttributeTypes(n.getAttribute("yEd.y"), new Double(0.0)));
-				n.removeAttribute("yEd.y");
-			} else {
-				n.removeAttribute("yEd.y");
-			}
-
 			//general defaults
 			if (!n.hasAttribute("ui.label")) {
 				n.addAttribute("ui.label", "");

+ 27 - 1
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/io/GraphMLImporter.java

@@ -50,10 +50,11 @@ public class GraphMLImporter {
 		for(Node n : g.getNodeSet()){
 			n.removeAttribute("ui.class");
 		}
+		yEdConversion(g);
 		return g;
 	}
 
-	
+
 	/**
 	 * Imports a GraphML file. Opens a open dialog. Returns null if the process
 	 * is aborted.
@@ -99,6 +100,7 @@ public class GraphMLImporter {
 		for(Node n : g.getNodeSet()){
 			n.removeAttribute("ui.class");
 		}
+		yEdConversion(g);
 		return g;
 	}
 
@@ -110,4 +112,28 @@ public class GraphMLImporter {
 	public LinkedList<SingleGraph> subGraphs() {
 		return fs.getSubGraphs();
 	}
+
+	public void yEdConversion(MyGraph g){
+		for(Node n : g.getNodeSet()) {
+			//yed conversion
+			if (!n.hasAttribute("ui.label") && n.hasAttribute("yEd.label")) {
+				n.addAttribute("ui.label", n.getAttribute("yEd.label").toString());
+				n.removeAttribute("yEd.label");
+			} else if(n.hasAttribute("ui.label")) {
+				n.removeAttribute("yEd.label");
+			}
+			if (n.hasAttribute("yEd.x") && !n.getAttribute("yEd.x").equals("")) {
+				n.addAttribute("x", Main.getInstance().convertAttributeTypes(n.getAttribute("yEd.x"), new Double(0.0)));
+				n.removeAttribute("yEd.x");
+			} else{
+				n.removeAttribute("yEd.x");
+			}
+			if (n.hasAttribute("yEd.y") && !n.getAttribute("yEd.y").equals("")) {
+				n.addAttribute("y", Main.getInstance().convertAttributeTypes(n.getAttribute("yEd.y"), new Double(0.0)));
+				n.removeAttribute("yEd.y");
+			} else {
+				n.removeAttribute("yEd.y");
+			}
+		}
+	}
 }