Search in sources :

Example 1 with NearFarScalar

use of org.cesiumjs.cs.core.NearFarScalar in project gwt-cs by iSergio.

the class Labels method scaleByDistance.

private void scaleByDistance() {
    LabelGraphicsOptions labelGraphicsOptions = new LabelGraphicsOptions();
    labelGraphicsOptions.text = new ConstantProperty<>("Philadelphia");
    labelGraphicsOptions.scaleByDistance = new NearFarScalar(1.5e2, 2.0, 1.5e7, 0.5);
    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) 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 2 with NearFarScalar

use of org.cesiumjs.cs.core.NearFarScalar in project gwt-cs by iSergio.

the class Labels method fadeByDistance.

private void fadeByDistance() {
    LabelGraphicsOptions labelGraphicsOptions = new LabelGraphicsOptions();
    labelGraphicsOptions.text = new ConstantProperty<>("New York");
    labelGraphicsOptions.translucencyByDistance = new ConstantProperty<>(new NearFarScalar(1.5e2, 1.0, 1.5e8, 0.0));
    EntityOptions entityOptions = new EntityOptions();
    entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-73.94, 40.67));
    entityOptions.label = new LabelGraphics(labelGraphicsOptions);
    csVPanel.getViewer().entities().add(entityOptions);
    labelGraphicsOptions = new LabelGraphicsOptions();
    labelGraphicsOptions.text = new ConstantProperty<>("'Atlanta'");
    labelGraphicsOptions.translucencyByDistance = new ConstantProperty<>(new NearFarScalar(1.5e5, 1.0, 1.5e7, 0.0));
    entityOptions = new EntityOptions();
    entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-84.39, 33.75));
    entityOptions.label = new LabelGraphics(labelGraphicsOptions);
    csVPanel.getViewer().entities().add(entityOptions);
}
Also used : 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 3 with NearFarScalar

use of org.cesiumjs.cs.core.NearFarScalar 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)

Aggregations

NearFarScalar (org.cesiumjs.cs.core.NearFarScalar)3 LabelGraphics (org.cesiumjs.cs.datasources.graphics.LabelGraphics)3 LabelGraphicsOptions (org.cesiumjs.cs.datasources.graphics.options.LabelGraphicsOptions)3 EntityOptions (org.cesiumjs.cs.datasources.options.EntityOptions)3 ConstantPositionProperty (org.cesiumjs.cs.datasources.properties.ConstantPositionProperty)3 Cartesian2 (org.cesiumjs.cs.core.Cartesian2)1 BillboardGraphics (org.cesiumjs.cs.datasources.graphics.BillboardGraphics)1 BillboardGraphicsOptions (org.cesiumjs.cs.datasources.graphics.options.BillboardGraphicsOptions)1 ConstantProperty (org.cesiumjs.cs.datasources.properties.ConstantProperty)1 JsImage (org.cesiumjs.cs.js.JsImage)1