Search in sources :

Example 1 with PolylineGraphicsOptions

use of org.cesiumjs.cs.datasources.graphics.options.PolylineGraphicsOptions in project gwt-cs by iSergio.

the class PolylineDash method buildPanel.

@Override
public void buildPanel() {
    ViewerPanel csVPanel = new ViewerPanel();
    PolylineDashMaterialPropertyOptions materialPropertyOptions;
    PolylineGraphicsOptions polylineGraphicsOptions;
    EntityOptions entityOptions;
    materialPropertyOptions = new PolylineDashMaterialPropertyOptions();
    materialPropertyOptions.color = new ConstantProperty<>(Color.RED());
    polylineGraphicsOptions = new PolylineGraphicsOptions();
    polylineGraphicsOptions.width = new ConstantProperty<>(5);
    polylineGraphicsOptions.material = new PolylineDashMaterialProperty(materialPropertyOptions);
    polylineGraphicsOptions.positions = new ConstantProperty<>(Cartesian3.fromDegreesArrayHeights(new double[] { -75, 38, 250000, -125, 38, 250000 }));
    entityOptions = new EntityOptions();
    entityOptions.name = "Red dashed line";
    entityOptions.polyline = new PolylineGraphics(polylineGraphicsOptions);
    Entity redLine = csVPanel.getViewer().entities().add(entityOptions);
    materialPropertyOptions = new PolylineDashMaterialPropertyOptions();
    materialPropertyOptions.color = new ConstantProperty<>(Color.BLUE());
    materialPropertyOptions.gapColor = new ConstantProperty<>(Color.YELLOW());
    polylineGraphicsOptions = new PolylineGraphicsOptions();
    polylineGraphicsOptions.width = new ConstantProperty<>(30);
    polylineGraphicsOptions.material = new PolylineDashMaterialProperty(materialPropertyOptions);
    polylineGraphicsOptions.positions = new ConstantProperty<>(Cartesian3.fromDegreesArrayHeights(new double[] { -75, 40, 250000, -125, 40, 250000 }));
    entityOptions = new EntityOptions();
    entityOptions.name = "Wide blue dashed line with a gap color";
    entityOptions.polyline = new PolylineGraphics(polylineGraphicsOptions);
    Entity blueLine = csVPanel.getViewer().entities().add(entityOptions);
    materialPropertyOptions = new PolylineDashMaterialPropertyOptions();
    materialPropertyOptions.color = new ConstantProperty<>(Color.ORANGE());
    materialPropertyOptions.dashLength = new ConstantProperty<>(8.0);
    polylineGraphicsOptions = new PolylineGraphicsOptions();
    polylineGraphicsOptions.width = new ConstantProperty<>(5);
    polylineGraphicsOptions.material = new PolylineDashMaterialProperty(materialPropertyOptions);
    polylineGraphicsOptions.positions = new ConstantProperty<>(Cartesian3.fromDegreesArrayHeights(new double[] { 75, 42, 250000, -125, 42, 250000 }));
    entityOptions = new EntityOptions();
    entityOptions.name = "Orange dashed line with a short dash length";
    entityOptions.polyline = new PolylineGraphics(polylineGraphicsOptions);
    Entity orangeLine = csVPanel.getViewer().entities().add(entityOptions);
    materialPropertyOptions = new PolylineDashMaterialPropertyOptions();
    materialPropertyOptions.color = new ConstantProperty<>(Color.CYAN());
    materialPropertyOptions.dashPattern = new ConstantProperty<>(Integer.parseInt("110000001111", 2));
    polylineGraphicsOptions = new PolylineGraphicsOptions();
    polylineGraphicsOptions.width = new ConstantProperty<>(10);
    polylineGraphicsOptions.material = new PolylineDashMaterialProperty(materialPropertyOptions);
    polylineGraphicsOptions.positions = new ConstantProperty<>(Cartesian3.fromDegreesArrayHeights(new double[] { -75, 44, 250000, -125, 44, 250000 }));
    entityOptions = new EntityOptions();
    entityOptions.name = "Cyan dashed line with a dash pattern.";
    entityOptions.polyline = new PolylineGraphics(polylineGraphicsOptions);
    Entity cyanLine = csVPanel.getViewer().entities().add(entityOptions);
    materialPropertyOptions = new PolylineDashMaterialPropertyOptions();
    materialPropertyOptions.color = new ConstantProperty<>(Color.YELLOW());
    materialPropertyOptions.dashPattern = new ConstantProperty<>(Integer.parseInt("1010101010101010", 2));
    polylineGraphicsOptions = new PolylineGraphicsOptions();
    polylineGraphicsOptions.width = new ConstantProperty<>(10);
    polylineGraphicsOptions.material = new PolylineDashMaterialProperty(materialPropertyOptions);
    polylineGraphicsOptions.positions = new ConstantProperty<>(Cartesian3.fromDegreesArrayHeights(new double[] { -75, 46, 250000, -125, 46, 250000 }));
    entityOptions = new EntityOptions();
    entityOptions.name = "Yellow dashed line with a dash pattern.";
    entityOptions.polyline = new PolylineGraphics(polylineGraphicsOptions);
    Entity yellowLine = csVPanel.getViewer().entities().add(entityOptions);
    csVPanel.getViewer().zoomTo(csVPanel.getViewer().entities());
    contentPanel.add(new HTML("<p>Draw dashed polylines.</p>"));
    contentPanel.add(csVPanel);
    initWidget(contentPanel);
}
Also used : ViewerPanel(org.cesiumjs.cs.widgets.ViewerPanel) PolylineGraphicsOptions(org.cesiumjs.cs.datasources.graphics.options.PolylineGraphicsOptions) Entity(org.cesiumjs.cs.datasources.Entity) PolylineDashMaterialPropertyOptions(org.cesiumjs.cs.datasources.properties.options.PolylineDashMaterialPropertyOptions) PolylineDashMaterialProperty(org.cesiumjs.cs.datasources.properties.PolylineDashMaterialProperty) HTML(com.google.gwt.user.client.ui.HTML) PolylineGraphics(org.cesiumjs.cs.datasources.graphics.PolylineGraphics) EntityOptions(org.cesiumjs.cs.datasources.options.EntityOptions)

Aggregations

HTML (com.google.gwt.user.client.ui.HTML)1 Entity (org.cesiumjs.cs.datasources.Entity)1 PolylineGraphics (org.cesiumjs.cs.datasources.graphics.PolylineGraphics)1 PolylineGraphicsOptions (org.cesiumjs.cs.datasources.graphics.options.PolylineGraphicsOptions)1 EntityOptions (org.cesiumjs.cs.datasources.options.EntityOptions)1 PolylineDashMaterialProperty (org.cesiumjs.cs.datasources.properties.PolylineDashMaterialProperty)1 PolylineDashMaterialPropertyOptions (org.cesiumjs.cs.datasources.properties.options.PolylineDashMaterialPropertyOptions)1 ViewerPanel (org.cesiumjs.cs.widgets.ViewerPanel)1