/**
* Create a new {@link GraphVisualizer} instance.
* <p>
* The passed {@link GraphStore} is observed by this class. If the {@link GraphStore}
* {@link org.dnacronym.hygene.parser.GfaFile} is updated, it will prompt a redraw. Changing the properties of this
* class will also prompt a redraw if the {@link org.dnacronym.hygene.parser.GfaFile} in {@link GraphStore} is not
* {@code null}.
*
* @param graphDimensionsCalculator {@link GraphDimensionsCalculator} used to calculate node positions
* @param query the {@link Query} used to get the currently queried nodes
* @param bookmarkStore the {@link BookmarkStore} used to draw bookmark indications
* @param graphAnnotation the {@link GraphAnnotation} used to draw annotations
*/
@Inject
public GraphVisualizer(final GraphDimensionsCalculator graphDimensionsCalculator, final Query query,
final BookmarkStore bookmarkStore, final GraphAnnotation graphAnnotation,
final GraphStore graphStore) {
HygeneEventBus.getInstance().register(this);
this.graphDimensionsCalculator = graphDimensionsCalculator;
this.query = query;
this.bookmarkStore = bookmarkStore;
this.colorRoulette = new ColorRoulette();
this.graphAnnotation = graphAnnotation;
this.graphStore = graphStore;
selectedSegmentProperty = new SimpleObjectProperty<>();
selectedSegmentProperty.addListener((observable, oldValue, newValue) -> draw());
hoveredSegmentProperty = new SimpleObjectProperty<>();
hoveredSegmentProperty.addListener((observable, oldValue, newValue) -> draw());
genomePaths = FXCollections.observableArrayList(new HashSet<>());
selectedGenomePaths = FXCollections.observableHashMap();
selectedGenomePaths.addListener((MapChangeListener<String, Color>) change -> draw());
edgeColorProperty = new SimpleObjectProperty<>(DEFAULT_EDGE_COLOR);
nodeHeightProperty = new SimpleDoubleProperty(DEFAULT_NODE_HEIGHT);
graphDimensionsCalculator.getNodeHeightProperty().bind(nodeHeightProperty);
edgeColorProperty.addListener((observable, oldValue, newValue) -> draw());
nodeHeightProperty.addListener((observable, oldValue, newValue) -> draw());
Node.setColorScheme(BasicSettingsViewController.NODE_COLOR_SCHEMES.get(0).getValue());
displayLaneBordersProperty = new SimpleBooleanProperty();
displayLaneBordersProperty.addListener((observable, oldValue, newValue) -> draw());
graphDimensionsCalculator.getGraphProperty()
.addListener((observable, oldValue, newValue) -> setGraph(newValue));
graphDimensionsCalculator.getObservableQueryNodes()
.addListener((ListChangeListener<Node>) change -> draw());
query.getQueriedNodes().addListener((ListChangeListener<Integer>) observable -> draw());
segmentDrawingToolkit = new SegmentDrawingToolkit();
snpDrawingToolkit = new SnpDrawingToolkit();
edgeDrawingToolkit = new EdgeDrawingToolkit();
graphAnnotationVisualizer = new GraphAnnotationVisualizer(graphDimensionsCalculator);
graphAnnotation.indexBuiltProperty().addListener((observable, oldValue, newValue) -> draw());
nodeHeightProperty.addListener((observable, oldValue, newValue) -> {
segmentDrawingToolkit.setNodeHeight(nodeHeightProperty.get());
snpDrawingToolkit.setNodeHeight(nodeHeightProperty.get());
draw();
});
segmentDrawingToolkit.setNodeHeight(nodeHeightProperty.get());
snpDrawingToolkit.setNodeHeight(nodeHeightProperty.get());
}
GraphVisualizer.java 文件源码
java
阅读 18
收藏 0
点赞 0
评论 0
项目:hygene
作者:
评论列表
文章目录