use of org.cesiumjs.cs.datasources.graphics.LabelGraphics 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();
}
use of org.cesiumjs.cs.datasources.graphics.LabelGraphics 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);
}
use of org.cesiumjs.cs.datasources.graphics.LabelGraphics 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);
}
use of org.cesiumjs.cs.datasources.graphics.LabelGraphics 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);
}
use of org.cesiumjs.cs.datasources.graphics.LabelGraphics 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);
}
Aggregations