Search in sources :

Example 21 with EntityOptions

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

the class Labels method setRightToLeft.

private void setRightToLeft() {
    Label.enableRightToLeftDetection = true;
    LabelGraphicsOptions labelGraphicsOptions = new LabelGraphicsOptions();
    labelGraphicsOptions.text = new ConstantProperty<>("Master (אדון): Hello\nתלמיד (student): שלום");
    EntityOptions entityOptions = new EntityOptions();
    entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-75.1641667, 39.9522222));
    entityOptions.label = new LabelGraphics(labelGraphicsOptions);
    csVPanel.getViewer().entities().add(entityOptions);
}
Also used : LabelGraphics(org.cesiumjs.cs.datasources.graphics.LabelGraphics) ConstantPositionProperty(org.cesiumjs.cs.datasources.properties.ConstantPositionProperty) LabelGraphicsOptions(org.cesiumjs.cs.datasources.graphics.options.LabelGraphicsOptions) EntityOptions(org.cesiumjs.cs.datasources.options.EntityOptions)

Example 22 with EntityOptions

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

the class Labels method offsetByDistance.

private void offsetByDistance() {
    final JsImage image = new JsImage();
    image.onload = new JsImage.Listener() {

        @Override
        public void function() {
            BillboardGraphicsOptions billboardGraphicsOptions = new BillboardGraphicsOptions();
            billboardGraphicsOptions.scaleByDistance = new ConstantProperty<>(new NearFarScalar(1.5e2, 5.0, 1.5e7, 0.5));
            billboardGraphicsOptions.image = new ConstantProperty<>(image);
            LabelGraphicsOptions labelGraphicsOptions = new LabelGraphicsOptions();
            labelGraphicsOptions.text = new ConstantProperty<>("Label on top of scaling billboard");
            labelGraphicsOptions.font = new ConstantProperty<>("20px sans-serif");
            labelGraphicsOptions.showBackground = new ConstantProperty<>(true);
            labelGraphicsOptions.horizontalOrigin = new ConstantProperty<>(HorizontalOrigin.CENTER());
            labelGraphicsOptions.pixelOffset = new ConstantProperty<>(new Cartesian2(0.0, -image.height));
            labelGraphicsOptions.pixelOffsetScaleByDistance = new ConstantProperty<>(new NearFarScalar(1.5e2, 3.0, 1.5e7, 0.5));
            EntityOptions entityOptions = new EntityOptions();
            entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-75.1641667, 39.9522222));
            entityOptions.billboard = new BillboardGraphics(billboardGraphicsOptions);
            entityOptions.label = new LabelGraphics(labelGraphicsOptions);
            csVPanel.getViewer().entities().add(entityOptions);
        }
    };
    image.src = GWT.getModuleBaseURL() + "images/facility.gif";
}
Also used : JsImage(org.cesiumjs.cs.js.JsImage) ConstantProperty(org.cesiumjs.cs.datasources.properties.ConstantProperty) Cartesian2(org.cesiumjs.cs.core.Cartesian2) BillboardGraphicsOptions(org.cesiumjs.cs.datasources.graphics.options.BillboardGraphicsOptions) BillboardGraphics(org.cesiumjs.cs.datasources.graphics.BillboardGraphics) LabelGraphics(org.cesiumjs.cs.datasources.graphics.LabelGraphics) NearFarScalar(org.cesiumjs.cs.core.NearFarScalar) ConstantPositionProperty(org.cesiumjs.cs.datasources.properties.ConstantPositionProperty) LabelGraphicsOptions(org.cesiumjs.cs.datasources.graphics.options.LabelGraphicsOptions) EntityOptions(org.cesiumjs.cs.datasources.options.EntityOptions)

Example 23 with EntityOptions

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

the class Labels method setProperties.

private void setProperties() {
    LabelGraphicsOptions labelGraphicsOptions = new LabelGraphicsOptions();
    labelGraphicsOptions.text = new ConstantProperty<>("Philadelphia");
    EntityOptions entityOptions = new EntityOptions();
    entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-75.1641667, 39.9522222, 300000.0));
    entityOptions.label = new LabelGraphics(labelGraphicsOptions);
    Entity entity = csVPanel.getViewer().entities().add(entityOptions);
    entity.label.scale = new ConstantProperty<>(2.0);
    entity.label.showBackground = new ConstantProperty<>(true);
}
Also used : Entity(org.cesiumjs.cs.datasources.Entity) LabelGraphics(org.cesiumjs.cs.datasources.graphics.LabelGraphics) ConstantPositionProperty(org.cesiumjs.cs.datasources.properties.ConstantPositionProperty) LabelGraphicsOptions(org.cesiumjs.cs.datasources.graphics.options.LabelGraphicsOptions) EntityOptions(org.cesiumjs.cs.datasources.options.EntityOptions)

Example 24 with EntityOptions

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

the class Labels method setFont.

private void setFont() {
    LabelGraphicsOptions labelGraphicsOptions = new LabelGraphicsOptions();
    labelGraphicsOptions.text = new ConstantProperty<>("Philadelphia");
    labelGraphicsOptions.font = new ConstantProperty<>("24px Helvetica");
    labelGraphicsOptions.fillColor = new ConstantProperty<>(Color.SKYBLUE());
    labelGraphicsOptions.outlineColor = new ConstantProperty<>(Color.BLACK());
    labelGraphicsOptions.outlineWidth = new ConstantProperty<>(2);
    labelGraphicsOptions.style = new ConstantProperty<>(LabelStyle.FILL_AND_OUTLINE());
    EntityOptions entityOptions = new EntityOptions();
    entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-75.1641667, 39.9522222));
    entityOptions.label = new LabelGraphics(labelGraphicsOptions);
    csVPanel.getViewer().entities().add(entityOptions);
}
Also used : LabelGraphics(org.cesiumjs.cs.datasources.graphics.LabelGraphics) ConstantPositionProperty(org.cesiumjs.cs.datasources.properties.ConstantPositionProperty) LabelGraphicsOptions(org.cesiumjs.cs.datasources.graphics.options.LabelGraphicsOptions) EntityOptions(org.cesiumjs.cs.datasources.options.EntityOptions)

Example 25 with EntityOptions

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

the class Models3DColoring method createModel.

private void createModel(String url, double height) {
    csVPanel.getViewer().entities().removeAll();
    ModelGraphicsOptions modelGraphicsOptions = new ModelGraphicsOptions();
    modelGraphicsOptions.uri = new ConstantProperty<>(url);
    modelGraphicsOptions.minimumPixelSize = new ConstantProperty<>(128);
    modelGraphicsOptions.maximumScale = new ConstantProperty<>(20000);
    modelGraphicsOptions.color = new ConstantProperty<>(getColor(colorStr, alpha));
    modelGraphicsOptions.colorBlendAmount = new ConstantProperty<>(colorBlendMode);
    modelGraphicsOptions.silhouetteColor = new ConstantProperty<>(silhouetteColor);
    modelGraphicsOptions.silhouetteSize = new ConstantProperty<>(silhouetteSize);
    ModelGraphics modelGraphics = new ModelGraphics(modelGraphicsOptions);
    Cartesian3 position = Cartesian3.fromDegrees(-123.0744619, 44.0503706, height);
    double heading = Math.toRadians(135);
    double pitch = 0;
    double roll = 0;
    org.cesiumjs.cs.core.HeadingPitchRoll hpr = new org.cesiumjs.cs.core.HeadingPitchRoll(heading, pitch, roll);
    Quaternion orientation = Transforms.headingPitchRollQuaternion(position, hpr);
    EntityOptions entityOptions = new EntityOptions();
    entityOptions.name = url;
    entityOptions.position = new ConstantPositionProperty(position);
    entityOptions.orientation = new ConstantProperty<>(orientation);
    entityOptions.model = modelGraphics;
    csVPanel.getViewer().trackedEntity = csVPanel.getViewer().entities().add(entityOptions);
    ;
}
Also used : ConstantPositionProperty(org.cesiumjs.cs.datasources.properties.ConstantPositionProperty) ModelGraphics(org.cesiumjs.cs.datasources.graphics.ModelGraphics) EntityOptions(org.cesiumjs.cs.datasources.options.EntityOptions) ModelGraphics(org.cesiumjs.cs.datasources.graphics.ModelGraphics) org.cesiumjs.cs.core(org.cesiumjs.cs.core) ModelGraphicsOptions(org.cesiumjs.cs.datasources.graphics.options.ModelGraphicsOptions)

Aggregations

EntityOptions (org.cesiumjs.cs.datasources.options.EntityOptions)41 Entity (org.cesiumjs.cs.datasources.Entity)27 ConstantPositionProperty (org.cesiumjs.cs.datasources.properties.ConstantPositionProperty)27 BillboardGraphics (org.cesiumjs.cs.datasources.graphics.BillboardGraphics)13 BillboardGraphicsOptions (org.cesiumjs.cs.datasources.graphics.options.BillboardGraphicsOptions)13 ViewerPanel (org.cesiumjs.cs.widgets.ViewerPanel)13 ModelGraphics (org.cesiumjs.cs.datasources.graphics.ModelGraphics)11 ModelGraphicsOptions (org.cesiumjs.cs.datasources.graphics.options.ModelGraphicsOptions)11 LabelGraphics (org.cesiumjs.cs.datasources.graphics.LabelGraphics)10 LabelGraphicsOptions (org.cesiumjs.cs.datasources.graphics.options.LabelGraphicsOptions)10 HTML (com.google.gwt.user.client.ui.HTML)8 ConstantProperty (org.cesiumjs.cs.datasources.properties.ConstantProperty)6 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)5 ColorMaterialProperty (org.cesiumjs.cs.datasources.properties.ColorMaterialProperty)5 ViewerOptions (org.cesiumjs.cs.widgets.options.ViewerOptions)5 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)4 MouseMoveEvent (org.cesiumjs.cs.core.events.MouseMoveEvent)4 CesiumTerrainProvider (org.cesiumjs.cs.core.providers.CesiumTerrainProvider)4 CesiumTerrainProviderOptions (org.cesiumjs.cs.core.providers.options.CesiumTerrainProviderOptions)4 Scene (org.cesiumjs.cs.scene.Scene)4