Skip to content

Commit 9ea7671

Browse files
committed
Visualize interestingness and remove redundant circle.
1 parent 3946717 commit 9ea7671

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

dnainator-javafx/src/main/java/nl/tudelft/dnainator/javafx/drawables/strains/ClusterDrawable.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,13 @@ public class ClusterDrawable extends Group implements Drawable, Propertyable {
5757
protected static final double MEDIUM_RADIUS = 5;
5858
protected static final double LARGE_RADIUS = 6;
5959
protected static final int PIETHRESHOLD = 20;
60+
private static final int INTERESTINGNESS_THRESHOLD = 600;
6061
private Cluster cluster;
6162
private Set<String> sources;
6263
private Text label;
6364
private Pie pie;
6465
private Map<PropertyType, String> properties;
66+
private int interestingness;
6567

6668
/**
6769
* Construct a new mid level {@link ClusterDrawable} using the default graph.
@@ -74,6 +76,9 @@ public ClusterDrawable(ColorServer colorServer, Cluster cluster) {
7476
this.sources = cluster.getNodes().stream()
7577
.flatMap(e -> e.getSources().stream())
7678
.collect(Collectors.toSet());
79+
this.interestingness = cluster.getNodes().stream()
80+
.mapToInt(e -> e.getInterestingnessScore())
81+
.max().getAsInt();
7782
label = new Text(Integer.toString(cluster.getNodes().size()));
7883
setOnMouseClicked(e -> AbstractView.setLastClicked(this));
7984
draw(colorServer);
@@ -91,7 +96,7 @@ private void initProperties() {
9196
properties.put(ClusterPropertyTypes.SOURCES, cluster.getNodes().stream()
9297
.flatMap(e -> e.getSources().stream())
9398
.collect(Collectors.toList()).toString());
94-
99+
properties.put(ClusterPropertyTypes.SCORE, Integer.toString(interestingness));
95100
if (cluster.getNodes().size() == 1) {
96101
initSingletonProperties();
97102
}
@@ -114,10 +119,11 @@ private void initSingletonProperties() {
114119
private void draw(ColorServer colorServer) {
115120
double radius = getRadius();
116121

122+
Circle commonNode = new Circle(radius);
123+
getChildren().add(commonNode);
124+
117125
if (sources.size() > PIETHRESHOLD) {
118-
Circle commonNode = new Circle(radius);
119126
commonNode.getStyleClass().add("common-node");
120-
getChildren().add(commonNode);
121127
} else {
122128
colorServer.addListener(this::onColorServerChanged);
123129

@@ -128,6 +134,9 @@ private void draw(ColorServer colorServer) {
128134
pie = new Pie(radius, collect);
129135
getChildren().add(pie);
130136
}
137+
if (interestingness > INTERESTINGNESS_THRESHOLD) {
138+
commonNode.getStyleClass().add("interesting-node");
139+
}
131140
getChildren().add(label);
132141
}
133142

dnainator-javafx/src/main/resources/style.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@
4949
-fx-stroke-width: .5;
5050
}
5151

52+
.interesting-node {
53+
-fx-stroke: #FF0000;
54+
-fx-stroke-width: .5;
55+
}
56+
5257
AbstractNode {
5358
-fx-font-size: 4px;
5459
}

0 commit comments

Comments
 (0)