Skip to content

Commit 4e08925

Browse files
committed
Merge pull request #94 from ProgrammingLife3/fix/resizeofzoombar
Fix/resizeofzoombar
2 parents f19e9a0 + 5be7370 commit 4e08925

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

src/main/java/tudelft/ti2806/pl3/Application.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ public void componentResized(ComponentEvent e) {
313313
size.setHeight((int) bounds.getHeight());
314314
size.calculate();
315315

316+
// resize all the views.
316317
getSideBarController().getPanel().setBounds(0, size.getMenubarHeight(),
317318
size.getSideBarWidth(), size.getHeight());
318319
getGraphController().getPanel().setBounds(0, 0, size.getWidth(),
@@ -322,6 +323,10 @@ public void componentResized(ComponentEvent e) {
322323
size.getWidth(), size.getZoomBarHeight());
323324
getPhyloController().getView().updateSize();
324325

326+
// recalculate the zoombar interestingness.
327+
getGraphController().calculateCollectInterest();
328+
getZoomBarController().graphLoaded();
329+
325330
main.repaint();
326331
}
327332
};

src/main/java/tudelft/ti2806/pl3/visualization/FilteredGraphModel.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ public class FilteredGraphModel extends Observable implements LoadingObservable,
5252
private CollectInterest collectInterest;
5353
private List<Genome> genomes;
5454

55+
private WrappedGraphData wrappedGraphData;
56+
5557
private Map<List<Filter<DataNode>>, Integer> filtersToGenomesCountMap;
5658

5759
/**
@@ -90,19 +92,26 @@ public void produceWrappedGraphData() {
9092
filter(resultNodes);
9193
List<Edge> resultEdges = originalGraphData.getEdgeListClone();
9294
EdgeUtil.removeAllDeadEdges(resultEdges, resultNodes);
93-
WrappedGraphData wrappedGraphData = new WrappedGraphData(resultNodes, resultEdges);
95+
wrappedGraphData = new WrappedGraphData(resultNodes, resultEdges);
9496
EdgeUtil.removeAllEmptyEdges(wrappedGraphData);
9597
collapsedNode = WrapUtil.collapseGraph(wrappedGraphData).getPositionedNodes().get(0);
9698
positionNodeYOnGenomeSpace.calculate(collapsedNode, null);
9799

98-
collectInterest = new CollectInterest(ScreenSize.getInstance().getWidth());
99-
collectInterest.calculate(wrappedGraphData.getPositionedNodes());
100100
calculateCollapse.calculate(collapsedNode, null);
101+
calculateCollectInterest();
101102
setChanged();
102103
notifyObservers();
103104
notifyLoadingObservers(false);
104105
}
105106

107+
/**
108+
* Calculate the CollectInterest based on the current screensize width.
109+
*/
110+
public void calculateCollectInterest(){
111+
collectInterest = new CollectInterest(ScreenSize.getInstance().getWidth());
112+
collectInterest.calculate(wrappedGraphData.getPositionedNodes());
113+
}
114+
106115
/**
107116
* Removes all edges of which one or both of their nodes is not on the originalWrappedGraphData.
108117
*

src/main/java/tudelft/ti2806/pl3/visualization/GraphController.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,10 @@ public void centerOnNode(DataNode node, Gene selected) throws NodeNotFoundExcept
203203
graphMoved();
204204
}
205205

206+
public void calculateCollectInterest(){
207+
filteredGraphModel.calculateCollectInterest();
208+
}
209+
206210
private double getCurrentZoomLevel() {
207211
return zoomedGraphModel.getZoomLevel();
208212
}

0 commit comments

Comments
 (0)