private void initGraphics() {
if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 ||
Double.compare(getWidth(), 0.0) <= 0 || Double.compare(getHeight(), 0.0) <= 0) {
if (getPrefWidth() > 0 && getPrefHeight() > 0) {
setPrefSize(getPrefWidth(), getPrefHeight());
} else {
setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
}
}
getStyleClass().add("world");
Color fill = getFillColor();
Color stroke = getStrokeColor();
countryPaths.forEach((name, pathList) -> {
Country country = Country.valueOf(name);
pathList.forEach(path -> {
path.setFill(null == country.getColor() ? fill : country.getColor());
path.setStroke(stroke);
path.setStrokeWidth(0.2);
path.setOnMouseEntered(new WeakEventHandler<>(_mouseEnterHandler));
path.setOnMousePressed(new WeakEventHandler<>(_mousePressHandler));
path.setOnMouseReleased(new WeakEventHandler<>(_mouseReleaseHandler));
path.setOnMouseExited(new WeakEventHandler<>(_mouseExitHandler));
});
pane.getChildren().addAll(pathList);
});
group.getChildren().add(pane);
heatMap = HeatMapBuilder.create()
.prefSize(1009, 665)
.colorMapping(colorMapping)
.eventRadius(eventRadius)
.fadeColors(fadeColors)
.opacityDistribution(opacityDistribution)
.heatMapOpacity(heatMapOpacity)
.build();
getChildren().setAll(group, heatMap);
setBackground(new Background(new BackgroundFill(getBackgroundColor(), CornerRadii.EMPTY, Insets.EMPTY)));
}
World.java 文件源码
java
阅读 21
收藏 0
点赞 0
评论 0
项目:worldheatmap
作者:
评论列表
文章目录