diff --git a/cesiumjs4gwt-main/pom.xml b/cesiumjs4gwt-main/pom.xml index 4c9547f42aafd6123de715c4d63ca5d9d86e7c4f..9c72e8bcc44a236e615937bc307ba5ecf9f46dc9 100644 --- a/cesiumjs4gwt-main/pom.xml +++ b/cesiumjs4gwt-main/pom.xml @@ -7,7 +7,7 @@ cesiumjs4gwt org.cesiumjs - 1.91.0 + 1.91.1 CesiumJS GWT Wrapper diff --git a/cesiumjs4gwt-main/src/main/java/org/cesiumjs/cs/js/JsObject.java b/cesiumjs4gwt-main/src/main/java/org/cesiumjs/cs/js/JsObject.java index 2046e04c0fc97fa9c3290dfc17e3d306c7861114..765262daf1a93736e1655681739733c9f1e4f4d7 100644 --- a/cesiumjs4gwt-main/src/main/java/org/cesiumjs/cs/js/JsObject.java +++ b/cesiumjs4gwt-main/src/main/java/org/cesiumjs/cs/js/JsObject.java @@ -52,39 +52,44 @@ public class JsObject extends JavaScriptObject { return base; } - public final static native void setProperty(Object target, String name, Number value) /*-{ + public static native JsObject setProperty(Object target, String name, Number value) /*-{ if (target === undefined) { target = {}; } target[name] = value; + return target; }-*/; - public final static native void setProperty(Object target, String name, Boolean value) /*-{ + public static native JsObject setProperty(Object target, String name, Boolean value) /*-{ if (target === undefined) { target = {}; } target[name] = value; + return target; }-*/; - public final static native void setProperty(Object target, String name, String value) /*-{ + public static native JsObject setProperty(Object target, String name, String value) /*-{ if (target === undefined) { target = {}; } target[name] = value; + return target; }-*/; - public final static native void setProperty(Object target, String name, Object value) /*-{ + public static native JsObject setProperty(Object target, String name, Object value) /*-{ if (target === undefined) { target = {}; } target[name] = value; + return target; }-*/; - public final static native void setProperty(Object target, String name, JsObject value) /*-{ + public static native JsObject setProperty(Object target, String name, JsObject value) /*-{ if (target === undefined) { target = {}; } target[name] = value; + return target; }-*/; public final static native Number getNumber(Object target, String name) /*-{ @@ -117,24 +122,29 @@ public class JsObject extends JavaScriptObject { @JsProperty(namespace = JsPackage.GLOBAL, name = "undefined") public static native Object undefined(); - public final native void setProperty(String name, Number value) /*-{ + public final native JsObject setProperty(String name, Number value) /*-{ this[name] = value; + return this; }-*/; - public final native void setProperty(String name, Boolean value) /*-{ + public final native JsObject setProperty(String name, Boolean value) /*-{ this[name] = value; + return this; }-*/; - public final native void setProperty(String name, String value) /*-{ + public final native JsObject setProperty(String name, String value) /*-{ this[name] = value; + return this; }-*/; - public final native void setProperty(String name, Object value) /*-{ + public final native JsObject setProperty(String name, Object value) /*-{ this[name] = value; + return this; }-*/; - public final native void setProperty(String name, JsObject value) /*-{ + public final native JsObject setProperty(String name, JsObject value) /*-{ this[name] = value; + return this; }-*/; public final native Number getNumber(String name) /*-{ diff --git a/cesiumjs4gwt-showcase/pom.xml b/cesiumjs4gwt-showcase/pom.xml index bd600c34f69e5f73013423e3aed00849d6e9e823..9dd148a8dd32dab12b278c7270881c905134cf21 100644 --- a/cesiumjs4gwt-showcase/pom.xml +++ b/cesiumjs4gwt-showcase/pom.xml @@ -6,7 +6,7 @@ cesiumjs4gwt org.cesiumjs - 1.91.0 + 1.91.1 CesiumJS GWT Showcase diff --git a/cesiumjs4gwt-showcase/src/main/java/org/cleanlogic/cesiumjs4gwt/showcase/examples/GPX.java b/cesiumjs4gwt-showcase/src/main/java/org/cleanlogic/cesiumjs4gwt/showcase/examples/GPX.java index c2eb24a3cf57101fb73c3621d5cfb7dc098036f0..53a853de129e2e214f12a89283a08cda628f330d 100644 --- a/cesiumjs4gwt-showcase/src/main/java/org/cleanlogic/cesiumjs4gwt/showcase/examples/GPX.java +++ b/cesiumjs4gwt-showcase/src/main/java/org/cleanlogic/cesiumjs4gwt/showcase/examples/GPX.java @@ -17,7 +17,9 @@ package org.cleanlogic.cesiumjs4gwt.showcase.examples; import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.Document; import com.google.gwt.event.dom.client.ChangeEvent; +import com.google.gwt.event.dom.client.DomEvent; import com.google.gwt.user.client.ui.AbsolutePanel; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HorizontalPanel; @@ -69,10 +71,7 @@ public class GPX extends AbstractExample { initWidget(contentPanel); - csVPanel.getViewer().dataSources().add( - GpxDataSource.load(GWT.getModuleBaseURL() + "SampleData/gpx/lamina.gpx", - new GpxDataSourceOptions().setClampToGround(true)) - ).then(dataSource -> csVPanel.getViewer().flyTo(((GpxDataSource) dataSource).entities)); + DomEvent.fireNativeEvent(Document.get().createChangeEvent(), modelLBox); } @SuppressWarnings("unchecked") diff --git a/cesiumjs4gwt-showcase/src/main/java/org/cleanlogic/cesiumjs4gwt/showcase/examples/MSAA.java b/cesiumjs4gwt-showcase/src/main/java/org/cleanlogic/cesiumjs4gwt/showcase/examples/MSAA.java index 6f76bd2cb9a6c4853a437a12f2c4f7e1d3dc32cd..03029a80b7bebae962ba64f69c42b352675bd51f 100644 --- a/cesiumjs4gwt-showcase/src/main/java/org/cleanlogic/cesiumjs4gwt/showcase/examples/MSAA.java +++ b/cesiumjs4gwt-showcase/src/main/java/org/cleanlogic/cesiumjs4gwt/showcase/examples/MSAA.java @@ -17,7 +17,10 @@ package org.cleanlogic.cesiumjs4gwt.showcase.examples; import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.Document; import com.google.gwt.event.dom.client.ChangeEvent; +import com.google.gwt.event.dom.client.DomEvent; +import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.AbsolutePanel; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HorizontalPanel; @@ -34,10 +37,9 @@ import org.cesiumjs.cs.datasources.graphics.options.ModelGraphicsOptions; import org.cesiumjs.cs.datasources.options.EntityOptions; import org.cesiumjs.cs.datasources.properties.ConstantPositionProperty; import org.cesiumjs.cs.datasources.properties.ConstantProperty; -import org.cesiumjs.cs.datasources.properties.Property; +import org.cesiumjs.cs.js.JsObject; import org.cesiumjs.cs.scene.Cesium3DTileset; import org.cesiumjs.cs.scene.Scene; -import org.cesiumjs.cs.scene.options.ModelOptions; import org.cesiumjs.cs.scene.options.ViewOptions; import org.cesiumjs.cs.widgets.Viewer; import org.cesiumjs.cs.widgets.ViewerPanel; @@ -58,7 +60,14 @@ public class MSAA extends AbstractExample { @Override public void buildPanel() { - csVPanel = new ViewerPanel(); + ViewerOptions options = new ViewerOptions(); + options.terrainProvider = Cesium.createWorldTerrain(); + options.contextOptions = JsObject.create().setProperty("requestWebgl2", true); + csVPanel = new ViewerPanel(options); + + if (!csVPanel.getViewer().scene().msaaSupported()) { + Window.alert("This browser does not support MSAA."); + } ListBox modelLBox = new ListBox(); modelLBox.addItem("Statue of Liberty", "0"); @@ -86,6 +95,8 @@ public class MSAA extends AbstractExample { contentPanel.add(aPanel); initWidget(contentPanel); + + DomEvent.fireNativeEvent(Document.get().createChangeEvent(), modelLBox); } private void setModel(ChangeEvent event) { diff --git a/cesiumjs4gwt-showcase/src/main/resources/org/cleanlogic/cesiumjs4gwt/public/examples/GPX.txt b/cesiumjs4gwt-showcase/src/main/resources/org/cleanlogic/cesiumjs4gwt/public/examples/GPX.txt index 6e8432b2794200f95f7c4eddaefa0103fd982fbc..f01d4d6153ec112fd028797e3d7940c3dab3c241 100644 --- a/cesiumjs4gwt-showcase/src/main/resources/org/cleanlogic/cesiumjs4gwt/public/examples/GPX.txt +++ b/cesiumjs4gwt-showcase/src/main/resources/org/cleanlogic/cesiumjs4gwt/public/examples/GPX.txt @@ -1,7 +1,9 @@ package org.cleanlogic.cesiumjs4gwt.showcase.examples; import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.Document; import com.google.gwt.event.dom.client.ChangeEvent; +import com.google.gwt.event.dom.client.DomEvent; import com.google.gwt.user.client.ui.AbsolutePanel; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HorizontalPanel; @@ -53,10 +55,7 @@ public class GPX extends AbstractExample { initWidget(contentPanel); - csVPanel.getViewer().dataSources().add( - GpxDataSource.load(GWT.getModuleBaseURL() + "SampleData/gpx/lamina.gpx", - new GpxDataSourceOptions().setClampToGround(true)) - ).then(dataSource -> csVPanel.getViewer().flyTo(((GpxDataSource) dataSource).entities)); + DomEvent.fireNativeEvent(Document.get().createChangeEvent(), modelLBox); } @SuppressWarnings("unchecked") diff --git a/cesiumjs4gwt-showcase/src/main/resources/org/cleanlogic/cesiumjs4gwt/public/examples/MSAA.txt b/cesiumjs4gwt-showcase/src/main/resources/org/cleanlogic/cesiumjs4gwt/public/examples/MSAA.txt index 0293dd6cae8bc041cadd357fec73691db65fb1a6..26bdb9bca8aa4299f2b0630319a15235b0f32524 100644 --- a/cesiumjs4gwt-showcase/src/main/resources/org/cleanlogic/cesiumjs4gwt/public/examples/MSAA.txt +++ b/cesiumjs4gwt-showcase/src/main/resources/org/cleanlogic/cesiumjs4gwt/public/examples/MSAA.txt @@ -1,7 +1,10 @@ package org.cleanlogic.cesiumjs4gwt.showcase.examples; import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.Document; import com.google.gwt.event.dom.client.ChangeEvent; +import com.google.gwt.event.dom.client.DomEvent; +import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.AbsolutePanel; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HorizontalPanel; @@ -18,10 +21,9 @@ import org.cesiumjs.cs.datasources.graphics.options.ModelGraphicsOptions; import org.cesiumjs.cs.datasources.options.EntityOptions; import org.cesiumjs.cs.datasources.properties.ConstantPositionProperty; import org.cesiumjs.cs.datasources.properties.ConstantProperty; -import org.cesiumjs.cs.datasources.properties.Property; +import org.cesiumjs.cs.js.JsObject; import org.cesiumjs.cs.scene.Cesium3DTileset; import org.cesiumjs.cs.scene.Scene; -import org.cesiumjs.cs.scene.options.ModelOptions; import org.cesiumjs.cs.scene.options.ViewOptions; import org.cesiumjs.cs.widgets.Viewer; import org.cesiumjs.cs.widgets.ViewerPanel; @@ -42,7 +44,14 @@ public class MSAA extends AbstractExample { @Override public void buildPanel() { - csVPanel = new ViewerPanel(); + ViewerOptions options = new ViewerOptions(); + options.terrainProvider = Cesium.createWorldTerrain(); + options.contextOptions = JsObject.create().setProperty("requestWebgl2", true); + csVPanel = new ViewerPanel(options); + + if (!csVPanel.getViewer().scene().msaaSupported()) { + Window.alert("This browser does not support MSAA."); + } ListBox modelLBox = new ListBox(); modelLBox.addItem("Statue of Liberty", "0"); @@ -70,6 +79,8 @@ public class MSAA extends AbstractExample { contentPanel.add(aPanel); initWidget(contentPanel); + + DomEvent.fireNativeEvent(Document.get().createChangeEvent(), modelLBox); } private void setModel(ChangeEvent event) { diff --git a/pom.xml b/pom.xml index 17ecb12da6c0baea957978fb06ae643cdad0c5f5..b86a8d035a502a1fa6a8f841397fdc2e9c582578 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ org.cesiumjs cesiumjs4gwt pom - 1.91.0 + 1.91.1 CesiumJS GWT Framework