Search in sources :

Example 1 with LabelGraphicsOptions

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

the class Terrain method sampleTerrainSuccess.

private void sampleTerrainSuccess() {
    Ellipsoid ellipsoid = Ellipsoid.WGS84();
    csVPanel.getViewer().scene().globe.depthTestAgainstTerrain = true;
    csVPanel.getViewer().entities().suspendEvents();
    csVPanel.getViewer().entities().removeAll();
    for (Cartographic position : terrainSamplePositions) {
        BigDecimal bd = new BigDecimal(position.height).setScale(1, RoundingMode.HALF_EVEN);
        BillboardGraphicsOptions billboardGraphicsOptions = new BillboardGraphicsOptions();
        billboardGraphicsOptions.verticalOrigin = new ConstantProperty<>(VerticalOrigin.BOTTOM());
        billboardGraphicsOptions.scale = new ConstantProperty<>(0.7);
        billboardGraphicsOptions.image = new ConstantProperty<>(GWT.getModuleBaseURL() + "images/facility.gif");
        LabelGraphicsOptions labelGraphicsOptions = new LabelGraphicsOptions();
        labelGraphicsOptions.text = new ConstantProperty<>(bd.toString());
        // HorizontalOrigin.CENTER());
        labelGraphicsOptions.horizontalOrigin = new ConstantProperty<>(HorizontalOrigin.CENTER());
        labelGraphicsOptions.scale = new ConstantProperty<>(0.3);
        labelGraphicsOptions.pixelOffset = new ConstantProperty<>(new Cartesian2(0, -14));
        labelGraphicsOptions.fillColor = new ConstantProperty<>(Color.RED());
        labelGraphicsOptions.outlineColor = new ConstantProperty<>(Color.WHITE());
        EntityOptions entityOptions = new EntityOptions();
        entityOptions.name = bd.toString();
        entityOptions.position = new ConstantPositionProperty(ellipsoid.cartographicToCartesian(position));
        entityOptions.billboard = new BillboardGraphics(billboardGraphicsOptions);
        entityOptions.label = new LabelGraphics(labelGraphicsOptions);
        csVPanel.getViewer().entities().add(new Entity(entityOptions));
    }
    csVPanel.getViewer().entities().resumeEvents();
}
Also used : Entity(org.cesiumjs.cs.datasources.Entity) BillboardGraphicsOptions(org.cesiumjs.cs.datasources.graphics.options.BillboardGraphicsOptions) BillboardGraphics(org.cesiumjs.cs.datasources.graphics.BillboardGraphics) LabelGraphics(org.cesiumjs.cs.datasources.graphics.LabelGraphics) ConstantPositionProperty(org.cesiumjs.cs.datasources.properties.ConstantPositionProperty) LabelGraphicsOptions(org.cesiumjs.cs.datasources.graphics.options.LabelGraphicsOptions) BigDecimal(java.math.BigDecimal) EntityOptions(org.cesiumjs.cs.datasources.options.EntityOptions)

Example 2 with LabelGraphicsOptions

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

the class Labels method addLabel.

private void addLabel() {
    LabelGraphicsOptions labelGraphicsOptions = new LabelGraphicsOptions();
    labelGraphicsOptions.text = new ConstantProperty<>("Philadelphia");
    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 3 with LabelGraphicsOptions

use of org.cesiumjs.cs.datasources.graphics.options.LabelGraphicsOptions 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 4 with LabelGraphicsOptions

use of org.cesiumjs.cs.datasources.graphics.options.LabelGraphicsOptions 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 5 with LabelGraphicsOptions

use of org.cesiumjs.cs.datasources.graphics.options.LabelGraphicsOptions 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)

Aggregations

LabelGraphics (org.cesiumjs.cs.datasources.graphics.LabelGraphics)10 LabelGraphicsOptions (org.cesiumjs.cs.datasources.graphics.options.LabelGraphicsOptions)10 EntityOptions (org.cesiumjs.cs.datasources.options.EntityOptions)10 ConstantPositionProperty (org.cesiumjs.cs.datasources.properties.ConstantPositionProperty)8 Entity (org.cesiumjs.cs.datasources.Entity)4 BigDecimal (java.math.BigDecimal)3 NearFarScalar (org.cesiumjs.cs.core.NearFarScalar)3 MouseMoveEvent (org.cesiumjs.cs.core.events.MouseMoveEvent)2 BillboardGraphics (org.cesiumjs.cs.datasources.graphics.BillboardGraphics)2 BillboardGraphicsOptions (org.cesiumjs.cs.datasources.graphics.options.BillboardGraphicsOptions)2 Cartesian2 (org.cesiumjs.cs.core.Cartesian2)1 ModelGraphics (org.cesiumjs.cs.datasources.graphics.ModelGraphics)1 ModelGraphicsOptions (org.cesiumjs.cs.datasources.graphics.options.ModelGraphicsOptions)1 ConstantProperty (org.cesiumjs.cs.datasources.properties.ConstantProperty)1 JsImage (org.cesiumjs.cs.js.JsImage)1 Camera (org.cesiumjs.cs.scene.Camera)1 Scene (org.cesiumjs.cs.scene.Scene)1