Skip to content

iSergio/cesiumjs4gwt

Repository files navigation

pipeline status pipeline status

GWT Cesium Wrapper

CesiumJS GWT Wrapper based on JsInterop 1.0.2 for GWT 2.8.x.

Showcase:

Java API looks like as JavaScript. What was done:

DrawInteraction features:

  • Pure java (Based on JsInterop wrapper without any JS code)
  • Based on Cesium-Drawhelper (But on GroundPrimitives)
  • Free hand mode (Shift pressed)
  • Two markers type - PointPrimitive and Billboard (Canvas image)
  • Draw works on EllipsoidTerrainProvider and other TerrainProvider's
  • Dynamic colours style and marker styles
  • Start and End draw listeners

DrawInteraction TODO:

  • On draw listeners (mouse move listeners and primitive change)
  • Snap points
  • Maximum points (finish draw on current points == maximumPoints)
  • Outline colour and width
  • EditInteraction
  • BillboardPrimitive
  • EllipsePrimitive

Issue

  • GXT work fine
  • GWT work fine
  • SmartGWT: ISC_DataBinding.js script destruct some functional of Cesium.js like as CesiumTerrain (what i find) (Fixed)

Getting started

You not need include JavaScript of Cesium into main html file, injection realised in GWT code. Now no need callback for ScriptInjection or AttachOrDetach, all worked "out from box". See Showcase or basic example:

public class HelloWorld extends AbstractExample {

    @Inject
    public HelloWorld(ShowcaseExampleStore store) {
        super("Hello World", "Use Viewer to start building new applications or easily embed Cesium into existing applications", new String[]{"Showcase", "Cesium", "3d", "Viewer"}, store);
    }

    @Override
    public void buildPanel() {
        // Create Cesium Viewer
        ViewerPanel csVPanel = new ViewerPanel();

        contentPanel.add(new HTML("<p>Use Viewer to start building new applications or easily embed Cesium into existing applications.</p>"));
        contentPanel.add(csVPanel);

        initWidget(contentPanel);
    }

    @Override
    public String[] getSourceCodeURLs() {
        String[] sourceCodeURLs = new String[1];
        sourceCodeURLs[0] = GWT.getModuleBaseURL() + "examples/" + "HelloWorld.txt";
        return sourceCodeURLs;
    }
}

Build library and examples:

== You need Java 8 for build examples.

  • mvn -U clean install

This project will be used in gwt-olcs and replace Cesium GWT