Browse Source

more more more fixes

jascha Bohne 7 years ago
parent
commit
2f40462018

+ 4 - 4
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/graphs/GraphManager.java

@@ -173,6 +173,7 @@ public class GraphManager {
 		}
 
 		for (Edge e : deletedEdges) {
+			Debug.out("Edge");
 			String sourceId = null;
 			String targetId = null;
 			attributes = new HashMap<String, Object>();
@@ -190,10 +191,9 @@ public class GraphManager {
 			}
 			g.addEdge(id, sourceId, targetId, e.isDirected());
 			g.getEdge(id).addAttributes(attributes);
-			if(g.getNode(Main.getInstance().getGraphManager().getActiveSubGraph() + newId) == null|| g.getNode(Main.getInstance().getGraphManager().getActiveSubGraph() + newId).getAttribute("originalElement") == null){
-				deletedEdges = new LinkedList<>();
-				deletedNode = null;
-				return;
+			if(g.getNode(Main.getInstance().getGraphManager().getActiveSubGraph() + newId) == null|| g.getNode(/*Main.getInstance().getGraphManager().getActiveSubGraph() + */newId).getAttribute("originalElement") == null){
+				Debug.out("GraphManager:195 skipped Node undelete propagation");
+				continue;
 			}
 			String origElement = GraphHelper.propagateElementUndeletion(g, e,
 					g.getNode(newId).getAttribute("originalElement"));

+ 16 - 0
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/io/GraphMLImporter.java

@@ -9,6 +9,7 @@ import org.graphstream.graph.Node;
 import de.tu_darmstadt.informatik.tk.scopviz.debug.Debug;
 import de.tu_darmstadt.informatik.tk.scopviz.graphs.GraphHelper;
 import de.tu_darmstadt.informatik.tk.scopviz.graphs.MyGraph;
+import de.tu_darmstadt.informatik.tk.scopviz.main.Layer;
 import de.tu_darmstadt.informatik.tk.scopviz.main.Main;
 import javafx.stage.FileChooser;
 import javafx.stage.FileChooser.ExtensionFilter;
@@ -50,6 +51,21 @@ public class GraphMLImporter {
 			e.printStackTrace();
 		}
 		if (fs.wasMultiGraph()) {
+			for(MyGraph gSub : fs.getSubGraphs()){
+				if("UNDERLAY".equals(gSub.getAttribute("layer"))){
+					gSub.removeAttribute("layer");
+					gSub.addAttribute("layer", Layer.UNDERLAY);
+				}else if("OPERATOR".equals(gSub.getAttribute("layer"))){
+					gSub.removeAttribute("layer");
+					gSub.addAttribute("layer", Layer.OPERATOR);
+				}else if("MAPPING".equals(gSub.getAttribute("layer"))){
+					gSub.removeAttribute("layer");
+					gSub.addAttribute("layer", Layer.MAPPING);
+				}else if("SYMBOL".equals(gSub.getAttribute("layer"))){
+					gSub.removeAttribute("layer");
+					gSub.addAttribute("layer", Layer.SYMBOL);
+				}
+			}
 			g = GraphHelper.newMerge(false, fs.getSubGraphs().toArray(new MyGraph[0]));
 		}
 		fs.removeSink(g);

+ 4 - 2
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/main/Main.java

@@ -84,7 +84,8 @@ public final class Main {
 		while (true) {
 			String tempID = i + "";
 			if (getGraphManager().getGraph().getNode(tempID) == null
-					&& getGraphManager().getGraph().getEdge(tempID) == null) {
+					&& getGraphManager().getGraph().getEdge(tempID) == null
+					&& getGraphManager().getGraph().getNode(getGraphManager().getGraph().getId()+tempID) == null) {
 				return (tempID);
 			} else {
 				i++;
@@ -96,7 +97,8 @@ public final class Main {
 		int i = 0;
 		while (true) {
 			String tempID = i + "";
-			if (gm.getGraph().getNode(tempID) == null && gm.getGraph().getEdge(tempID) == null) {
+			if (gm.getGraph().getNode(tempID) == null && gm.getGraph().getEdge(tempID) == null
+					&& gm.getGraph().getNode(gm.getGraph().getId()+tempID) == null){
 				return (tempID);
 			} else {
 				i++;

+ 3 - 1
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/metrics/OperatorInfoMetric.java

@@ -6,6 +6,7 @@ import java.util.stream.Collectors;
 import org.graphstream.graph.Edge;
 import org.graphstream.graph.Node;
 
+import de.tu_darmstadt.informatik.tk.scopviz.debug.Debug;
 import de.tu_darmstadt.informatik.tk.scopviz.graphs.MappingGraphManager;
 import de.tu_darmstadt.informatik.tk.scopviz.graphs.MyGraph;
 import de.tu_darmstadt.informatik.tk.scopviz.main.Layer;
@@ -34,7 +35,8 @@ public class OperatorInfoMetric implements ScopvizGraphMetric {
 		LinkedList<Pair<String, String>> result = new LinkedList<Pair<String, String>>();
 
 		for (MyGraph subGraph : g.getAllSubGraphs()) {
-			if (subGraph.getAttribute("layer") == Layer.OPERATOR && !subGraph.isComposite()) {
+			if ((subGraph.getAttribute("layer").equals("OPERATOR")|| subGraph.getAttribute("layer").equals(Layer.OPERATOR)) && !subGraph.isComposite()) {
+				Debug.out("no problems");
 				String graphId = subGraph.getId();
 				String info = "";
 				Double priority = Double.valueOf(subGraph.getAttribute("priority"));

+ 2 - 2
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/GraphDisplayManager.java

@@ -430,7 +430,7 @@ public final class GraphDisplayManager {
 		LinkedList<MyGraph> graphs = g.getAllSubGraphs();
 		Iterator<MyGraph> graphIter = graphs.iterator();
 		while (graphIter.hasNext()) {
-			if (!"UNDERLAY".equalsIgnoreCase(graphIter.next().getAttribute("layer"))) {
+			if (!Layer.UNDERLAY.equals(graphIter.next().getAttribute("layer"))) {
 				graphIter.remove();
 			}
 		}
@@ -443,7 +443,7 @@ public final class GraphDisplayManager {
 		graphs = g.getAllSubGraphs();
 		graphIter = graphs.iterator();
 		while (graphIter.hasNext()) {
-			if (!"OPERATOR".equalsIgnoreCase(graphIter.next().getAttribute("layer"))) {
+			if (!Layer.OPERATOR.equals(graphIter.next().getAttribute("layer"))) {
 				graphIter.remove();
 			}
 		}