From 7bce4d6db7c9c52d8b6d196a40bc8d3d5d11ef10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Sza=C5=82omski?= Date: Sat, 8 Sep 2018 21:12:54 +0200 Subject: [PATCH] Extend Hexbin API (#11) * fix radiusRange handling, * add colorDomain and radiusDomain options, * bump version number for further release. --- README.md | 2 +- examples/simple-hexbinlayer-demo/pom.xml | 2 +- pom.xml | 2 +- .../leafletd3/client/wrapper/HexbinLayer.java | 33 ++++++++++++++++--- 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e9b0457..3fbf381 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Add the dependency: pl.itrack gwt-leaflet-d3 - 0.2.2 + 0.2.3 ``` diff --git a/examples/simple-hexbinlayer-demo/pom.xml b/examples/simple-hexbinlayer-demo/pom.xml index 6c4a5f7..8b99d8e 100644 --- a/examples/simple-hexbinlayer-demo/pom.xml +++ b/examples/simple-hexbinlayer-demo/pom.xml @@ -40,7 +40,7 @@ pl.itrack gwt-leaflet-d3 - 0.2.2 + 0.2.3 diff --git a/pom.xml b/pom.xml index 8314e4e..7868c67 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 pl.itrack gwt-leaflet-d3 - 0.2.2 + 0.2.3 gwt-lib GWT Leaflet plugin that allows integration with d3.js library A GWT JsInterop wrapper for collection of plugins for using d3.js with Leaflet diff --git a/src/main/java/pl/itrack/leafletd3/client/wrapper/HexbinLayer.java b/src/main/java/pl/itrack/leafletd3/client/wrapper/HexbinLayer.java index c29e916..0880457 100644 --- a/src/main/java/pl/itrack/leafletd3/client/wrapper/HexbinLayer.java +++ b/src/main/java/pl/itrack/leafletd3/client/wrapper/HexbinLayer.java @@ -40,7 +40,7 @@ public HexbinLayer(Config config) { public native void initialize(Config config); @JsMethod(name = "radiusRange") - public native HexbinLayer withRadiusRange(Integer[] radiusRange); + public native HexbinLayer withRadiusRange(double[] radiusRange); @JsMethod(name = "colorRange") public native HexbinLayer withColorRange(String[] colorRange); @@ -113,6 +113,12 @@ public static class Config { @JsProperty double duration; + @JsProperty + double[] colorDomain; + + @JsProperty + double[] radiusDomain; + Config() { } @@ -130,7 +136,7 @@ private Builder() { * @param radius default 12 * @return the builder */ - public Config.Builder withRadius(Double radius) { + public Config.Builder withRadius(double radius) { this.radius = radius; return this; } @@ -139,7 +145,7 @@ public Config.Builder withRadius(Double radius) { * @param opacity a stroke opacity; default 0.6 * @return the builder */ - public Config.Builder withOpacity(Double opacity) { + public Config.Builder withOpacity(double opacity) { this.opacity = opacity; return this; } @@ -148,11 +154,30 @@ public Config.Builder withOpacity(Double opacity) { * @param duration default 200 * @return the builder */ - public Config.Builder withDuration(Double duration) { + public Config.Builder withDuration(double duration) { this.duration = duration; return this; } + /** + * @param colorDomain default null + * @return the builder + */ + public Config.Builder withColorDomain(double[] colorDomain) { + this.colorDomain = colorDomain; + return this; + } + + /** + * @param radiusDomain default null + * @return the builder + */ + public Config.Builder withRadiusDomain(double[] radiusDomain) { + this.radiusDomain = radiusDomain; + return this; + } + + public Config build() { return this; }