Skip to content

Commit daa3849

Browse files
committed
Merge branch 'joswinter-knownMutations' into demo
2 parents 2f73fec + ef895d9 commit daa3849

File tree

4 files changed

+25
-9
lines changed

4 files changed

+25
-9
lines changed

lifetiles-core/src/main/resources/settings/lifetiles.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
empty_segments = false
33
mutations = true
44
num_vertices_bucket = 50
5+
bookmark_radius = 25
6+
bookmark_opacity = 0.35

lifetiles-graph/src/main/java/nl/tudelft/lifetiles/graph/controller/GraphController.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ private void repaintPosition(final double position) {
405405
if (currEndPosition != endBucket
406406
&& currStartPosition != startBucket || repaintNow) {
407407
Group graphDrawing = new Group();
408+
graphDrawing.setManaged(false);
408409
graphDrawing.getChildren().add(
409410
drawGraph(startBucket, endBucket));
410411
graphDrawing.getChildren().add(

lifetiles-graph/src/main/java/nl/tudelft/lifetiles/graph/view/Bookmark.java

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,38 @@
22

33
import javafx.scene.control.Tooltip;
44
import javafx.scene.paint.Color;
5-
import javafx.scene.shape.Rectangle;
5+
import javafx.scene.shape.Circle;
66
import nl.tudelft.lifetiles.annotation.model.KnownMutation;
7+
import nl.tudelft.lifetiles.core.util.Settings;
78

89
/**
910
* A bookmark is the equivalent of a known mutation mapped onto the graph.
1011
*
1112
* @author Jos
1213
*
1314
*/
14-
public class Bookmark extends Rectangle {
15+
public class Bookmark extends Circle {
1516

1617
/**
1718
* The standard opacity of the bookmark overlay.
1819
*/
19-
private static final double OPACITY = 0.5;
20+
private static final double OPACITY = Double.parseDouble(Settings.get("bookmark_opacity"));
2021

2122
/**
2223
* The standard color of the bookmark overlay.
2324
*/
2425
private static final Color STANDARD_COLOR = Color.YELLOW;
2526

27+
/**
28+
* The radius of the bookmark circle.
29+
*/
30+
private static final double RADIUS = Double.parseDouble(Settings.get("bookmark_radius"));
31+
32+
/**
33+
* Center of the segment so the origin of the circle is placed at the correct segment position.
34+
*/
35+
private static final double SEGMENT_CENTER = 0.5;
36+
2637
/**
2738
* Constructs a bookmark from a vertex, a annotation and a segment position.
2839
*
@@ -38,10 +49,10 @@ public class Bookmark extends Rectangle {
3849
public Bookmark(final VertexView vertex,
3950
final KnownMutation knownMutation, final long segmentPosition,
4051
final double scale) {
41-
super(vertex.HORIZONTALSCALE * scale, vertex.getHeight());
42-
setLayoutX(vertex.getLayoutX() + segmentPosition
52+
super(RADIUS);
53+
setLayoutX(vertex.getLayoutX() + (segmentPosition + SEGMENT_CENTER)
4354
* vertex.HORIZONTALSCALE * scale);
44-
setLayoutY(vertex.getLayoutY());
55+
setLayoutY(vertex.getLayoutY() + vertex.getHeight() / 2);
4556
setOpacity(OPACITY);
4657
setFill(STANDARD_COLOR);
4758

lifetiles-graph/src/test/java/nl/tudelft/lifetiles/graph/view/TileViewTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
import javafx.scene.input.MouseButton;
1717
import javafx.scene.input.MouseEvent;
1818
import javafx.scene.shape.Rectangle;
19+
import javafx.scene.shape.Circle;
1920
import nl.tudelft.lifetiles.annotation.model.KnownMutation;
2021
import nl.tudelft.lifetiles.annotation.model.KnownMutationMapper;
2122
import nl.tudelft.lifetiles.annotation.model.KnownMutationParser;
23+
import nl.tudelft.lifetiles.core.util.Settings;
2224
import nl.tudelft.lifetiles.graph.controller.GraphController;
2325
import nl.tudelft.lifetiles.graph.model.BucketCache;
2426
import nl.tudelft.lifetiles.graph.model.FactoryProducer;
@@ -107,7 +109,7 @@ public void drawVerticeTest() {
107109

108110
}
109111

110-
private Rectangle rec;
112+
private Circle bookmark;
111113
private VertexView vView1;
112114

113115
@Test
@@ -148,7 +150,7 @@ public void drawAnnotationTest() throws IOException, InterruptedException {
148150
Group result = tileview.drawGraph(buckets.getSegments(0, 1), graph,
149151
annotations, 1);
150152

151-
rec = (Rectangle) ((Group) result.getChildrenUnmodifiable().get(2))
153+
bookmark = (Circle) ((Group) result.getChildrenUnmodifiable().get(2))
152154
.getChildrenUnmodifiable().get(0);
153155

154156
vView1 = (VertexView) ((Group) result.getChildrenUnmodifiable()
@@ -157,7 +159,7 @@ public void drawAnnotationTest() throws IOException, InterruptedException {
157159
});
158160

159161
Thread.sleep(1000);
160-
assertEquals(rec.getHeight(), vView1.getHeight(), 1e-10);
162+
assertEquals(bookmark.getRadius(), Double.parseDouble(Settings.get("bookmark_radius")), 1e-10);
161163
}
162164

163165
@Test

0 commit comments

Comments
 (0)