Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private void initializeTable() {
// annotations in the graph
selectionManager.select(new ViewAnnotation(selection, selectionManager));
graphPaneController.centerOnLevel(
selection.getStartInGraph());
selection.start);
}
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Pane;
import javafx.scene.layout.Region;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import nl.tudelft.pl2016gr2.core.algorithms.subgraph.GraphOrdererThread;
import nl.tudelft.pl2016gr2.core.algorithms.subgraph.OrderedGraph;
Expand All @@ -35,6 +36,7 @@
import nl.tudelft.pl2016gr2.gui.view.graph.heatmap.IHeatmapColorer;
import nl.tudelft.pl2016gr2.gui.view.graph.heatmap.IndelDensity;
import nl.tudelft.pl2016gr2.gui.view.graph.heatmap.MutationDensity;
import nl.tudelft.pl2016gr2.gui.view.graph.heatmap.NoOverlapHeatmap;
import nl.tudelft.pl2016gr2.gui.view.graph.heatmap.OverlapHeatmap;
import nl.tudelft.pl2016gr2.gui.view.graph.heatmap.PhyloBubbleDensity;
import nl.tudelft.pl2016gr2.gui.view.graph.heatmap.PointMutationDensity;
Expand Down Expand Up @@ -226,6 +228,8 @@ private void addHeatmapOptions() {
heatmapOptions.put("Graph based bubbles", new GraphBubbleDensity(heatmapGraphics, zoomFactor));
heatmapOptions.put("Equalities between the graphs (dark = equal, light = not equal",
new OverlapHeatmap(heatmapGraphics, zoomFactor));
heatmapOptions.put("Differences between the graphs (dark = not equal, light = equal",
new NoOverlapHeatmap(heatmapGraphics, zoomFactor));
}

/**
Expand Down Expand Up @@ -734,8 +738,8 @@ private void clearCanvas() {
topEdgeCanvas.getWidth());
bottomEdgeCanvas.getGraphicsContext2D().clearRect(0, 0, bottomEdgeCanvas.getWidth(),
bottomEdgeCanvas.getWidth());
heatmap.getGraphicsContext2D().clearRect(0, 0, heatmap.getWidth(),
heatmap.getHeight());
heatmap.getGraphicsContext2D().setFill(Color.WHITE);
heatmap.getGraphicsContext2D().fillRect(0, 0, heatmap.getWidth(), heatmap.getHeight());
}

/**
Expand Down Expand Up @@ -865,7 +869,7 @@ private void drawAnnotationBox(GraphNode node, IViewGraphNode viewNode, Pane pan
if (!node.hasAnnotations()) {
return;
}
boolean odd = false;
double previousEndPosition = Double.NEGATIVE_INFINITY;
for (Annotation annotation : node.getAnnotations()) {
double annotationStart = calcAnnotationStart(annotation, viewNode, startLevel);
double annotationEnd = getAnnotationEnd(annotation, viewNode, startLevel);
Expand All @@ -876,11 +880,13 @@ private void drawAnnotationBox(GraphNode node, IViewGraphNode viewNode, Pane pan
viewAnnotation.setLayoutY(viewNode.centerYProperty().get() - viewNode.getHeight() / 2.0);
double maxHeight = viewNode.getHeight() / 2.0;
viewAnnotation.setHeight(Math.min(maxHeight, ANNOTATION_HEIGHT));
viewAnnotation.setOddOffset(odd);

if (annotationStart < previousEndPosition) {
viewAnnotation.setOddOffset();
} else {
previousEndPosition = annotationEnd;
}
pane.getChildren().add(viewAnnotation);
viewAnnotation.addLabel(pane);
odd = !odd;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,10 @@ public void addLabel(Pane pane) {
}

/**
* Sets a vertical offset if this label is the nth label of a node, where n is odd.
*
* @param setOffset if this is an odd node.
* Sets a vertical offset to this label so if doesn't overlap with a different label.
*/
public void setOddOffset(boolean setOffset) {
if (setOffset) {
setLayoutY(getLayoutY() + getHeight());
}
public void setOddOffset() {
setLayoutY(getLayoutY() + getHeight());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package nl.tudelft.pl2016gr2.gui.view.graph.heatmap;

import static nl.tudelft.pl2016gr2.gui.view.graph.heatmap.OverlapHeatmap.NO_OVERLAP_COLOR;
import static nl.tudelft.pl2016gr2.gui.view.graph.heatmap.OverlapHeatmap.OVERLAP_COLOR;

import javafx.beans.value.ObservableDoubleValue;
import javafx.scene.canvas.GraphicsContext;
import nl.tudelft.pl2016gr2.model.graph.nodes.SequenceNode;

/**
* This is a heatmap which indicates the positions of all of the non overlapping nodes (nodes which
* are not in both the top and bottom graph).
*
* @author Faris
*/
public class NoOverlapHeatmap extends AbstractHeatmap {

public NoOverlapHeatmap(GraphicsContext heatmapGraphics, ObservableDoubleValue zoomFactor) {
super(heatmapGraphics, zoomFactor);
}

@Override
protected double getWidthMultiplier() {
return 1.0;
}

@Override
public void visit(SequenceNode node) {
if (node.getGuiData().overlapping) {
setColor(NO_OVERLAP_COLOR);
} else {
setColor(OVERLAP_COLOR);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
*/
public class OverlapHeatmap extends AbstractHeatmap {

private static final Color OVERLAP_COLOR = Color.rgb(0, 0, 0, 0.2);
private static final Color NO_OVERLAP_COLOR = Color.rgb(255, 255, 255, 0.2);
public static final Color OVERLAP_COLOR = Color.rgb(0, 0, 0, 0.2);
public static final Color NO_OVERLAP_COLOR = Color.rgb(255, 255, 255, 0.2);

public OverlapHeatmap(GraphicsContext heatmapGraphics, ObservableDoubleValue zoomFactor) {
super(heatmapGraphics, zoomFactor);
Expand Down