model and clustering visualization: proof of concept

parent 1615dbeb
......@@ -120,6 +120,20 @@
<version>${Embedded-montiarc-math-rosmsg-generator.version}</version>
</dependency>
<dependency>
<groupId>org.graphstream</groupId>
<artifactId>gs-core</artifactId>
<version>1.3</version>
<optional>false</optional>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math</artifactId>
<version>2.1</version>
<optional>false</optional>
</dependency>
<!-- EMADL Dependencies -->
<dependency>
<groupId>de.monticore.lang.monticar</groupId>
......
......@@ -20,8 +20,6 @@ import java.util.stream.Collectors;
public class AutomaticClusteringHelper {
static double MAXCOST= 999999;
public static double[][] createAdjacencyMatrix(List<ExpandedComponentInstanceSymbol> subcomps, Collection<ConnectorSymbol> connectors, Map<String, Integer> subcompLabels) {
// Nodes = subcomponents
// Verts = connectors between subcomponents
......
package de.monticore.lang.monticar.generator.middleware.clustering;
public class SimpleModelViewer {
}
import org.graphstream.graph.Graph;
import org.graphstream.ui.view.Viewer;
import org.graphstream.ui.view.ViewerListener;
import org.graphstream.ui.view.ViewerPipe;
import javax.swing.*;
public class SimpleModelViewer implements ViewerListener {
private Graph graph;
protected boolean loop = true;
public SimpleModelViewer(Graph g) {
this.graph = g;
}
public void run() {
Viewer viewer = this.graph.display();
viewer.getDefaultView().add(new JLabel(graph.getId().toString()));
viewer.setCloseFramePolicy(Viewer.CloseFramePolicy.CLOSE_VIEWER); // set to "HIDE_ONLY" to allow for further communication
ViewerPipe fromViewer = viewer.newViewerPipe();
fromViewer.addViewerListener(this);
//fromViewer.addSink(this.graph);
while(loop) {
fromViewer.pump();
}
}
public void viewClosed(String id) {
this.loop = false;
}
public void buttonPushed(String id) {
//System.out.println("Button pushed on node "+id);
}
public void buttonReleased(String id) {
//System.out.println("Button released on node "+id);
}
}
\ No newline at end of file
......@@ -29,4 +29,12 @@ public class ComponentHelper {
subcomps.forEach(sc -> componentIndecies.put(sc.getFullName(), i[0]++));
return componentIndecies;
}
public static Map<Integer, String> getSubcompsLabels(List<ExpandedComponentInstanceSymbol> subcomps) {
Map<Integer, String> componentIndecies = new HashMap<>();
int[] i = {0};
subcomps.forEach(sc -> componentIndecies.put(i[0]++, sc.getFullName()));
return componentIndecies;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment