use of org.cesiumjs.cs.datasources.Entity in project gwt-cs by iSergio.
the class GeometryAndAppearances method buildPanel.
@Override
public void buildPanel() {
Math.setRandomNumberSeed(1234);
ViewerPanel csVPanel = new ViewerPanel();
StripeMaterialPropertyOptions stripeMaterialPropertyOptions = new StripeMaterialPropertyOptions();
stripeMaterialPropertyOptions.evenColor = new ConstantProperty<>(Color.WHITE().withAlpha(0.5f));
stripeMaterialPropertyOptions.oddColor = new ConstantProperty<>(Color.BLUE().withAlpha(0.5f));
stripeMaterialPropertyOptions.repeat = new ConstantProperty<>(5.0);
StripeMaterialProperty stripeMaterialProperty = new StripeMaterialProperty(stripeMaterialPropertyOptions);
RectangleGraphicsOptions rectangleGraphicsOptions = new RectangleGraphicsOptions();
rectangleGraphicsOptions.coordinates = new ConstantProperty<>(Rectangle.fromDegrees(-92.0, 20.0, -86.0, 27.0));
rectangleGraphicsOptions.outline = new ConstantProperty<>(true);
rectangleGraphicsOptions.outlineColor = new ConstantProperty<>(Color.WHITE());
rectangleGraphicsOptions.outlineWidth = new ConstantProperty<>(4);
rectangleGraphicsOptions.stRotation = new ConstantProperty<>(Math.toRadians(45));
rectangleGraphicsOptions.material = stripeMaterialProperty;
RectangleGraphics rectangleGraphics = new RectangleGraphics(rectangleGraphicsOptions);
EntityOptions entityOptions = new EntityOptions();
entityOptions.rectangle = rectangleGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
PolygonGraphicsOptions polygonGraphicsOptions = new PolygonGraphicsOptions();
polygonGraphicsOptions.hierarchy = new ConstantProperty<>(new PolygonHierarchy(Cartesian3.fromDegreesArray(new double[] { -107.0, 27.0, -107.0, 22.0, -102.0, 23.0, -97.0, 21.0, -97.0, 25.0 })));
polygonGraphicsOptions.outline = new ConstantProperty<>(true);
polygonGraphicsOptions.outlineColor = new ConstantProperty<>(Color.WHITE());
polygonGraphicsOptions.outlineWidth = new ConstantProperty<>(4);
polygonGraphicsOptions.material = stripeMaterialProperty;
PolygonGraphics polygonGraphics = new PolygonGraphics(polygonGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.polygon = polygonGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
EllipseGraphicsOptions ellipseGraphicsOptions = new EllipseGraphicsOptions();
ellipseGraphicsOptions.semiMinorAxis = new ConstantProperty<>(300000.0);
ellipseGraphicsOptions.semiMajorAxis = new ConstantProperty<>(500000.0);
ellipseGraphicsOptions.rotation = new ConstantProperty<>(Math.toRadians(-40.0));
ellipseGraphicsOptions.outline = new ConstantProperty<>(true);
ellipseGraphicsOptions.outlineColor = new ConstantProperty<>(Color.WHITE());
ellipseGraphicsOptions.outlineWidth = new ConstantProperty<>(4);
ellipseGraphicsOptions.stRotation = new ConstantProperty<>(Math.toRadians(22));
ellipseGraphicsOptions.material = stripeMaterialProperty;
EllipseGraphics ellipseGraphics = new EllipseGraphics(ellipseGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-80.0, 25.0));
entityOptions.ellipse = ellipseGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
ellipseGraphicsOptions = new EllipseGraphicsOptions();
ellipseGraphicsOptions.semiMinorAxis = new ConstantProperty<>(250000.0);
ellipseGraphicsOptions.semiMajorAxis = new ConstantProperty<>(250000.0);
ellipseGraphicsOptions.rotation = new ConstantProperty<>(Math.toRadians(-40.0));
ellipseGraphicsOptions.outline = new ConstantProperty<>(true);
ellipseGraphicsOptions.outlineColor = new ConstantProperty<>(Color.WHITE());
ellipseGraphicsOptions.outlineWidth = new ConstantProperty<>(4);
ellipseGraphicsOptions.stRotation = new ConstantProperty<>(Math.toRadians(90));
ellipseGraphicsOptions.material = stripeMaterialProperty;
ellipseGraphics = new EllipseGraphics(ellipseGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-72.0, 25.0));
entityOptions.ellipse = ellipseGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
rectangleGraphicsOptions = new RectangleGraphicsOptions();
rectangleGraphicsOptions.coordinates = new ConstantProperty<>(Rectangle.fromDegrees(-118.0, 38.0, -116.0, 40.0));
rectangleGraphicsOptions.extrudedHeight = new ConstantProperty<>(500000.0);
rectangleGraphicsOptions.outline = new ConstantProperty<>(true);
rectangleGraphicsOptions.outlineColor = new ConstantProperty<>(Color.WHITE());
rectangleGraphicsOptions.outlineWidth = new ConstantProperty<>(4);
rectangleGraphicsOptions.stRotation = new ConstantProperty<>(Math.toRadians(45));
ColorRandomOptions colorRandomOptions = new ColorRandomOptions();
colorRandomOptions.alpha = 1.0f;
rectangleGraphicsOptions.material = new ColorMaterialProperty(new ConstantProperty<>(Color.fromRandom(colorRandomOptions)));
rectangleGraphics = new RectangleGraphics(rectangleGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.rectangle = rectangleGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
ellipseGraphicsOptions = new EllipseGraphicsOptions();
ellipseGraphicsOptions.semiMinorAxis = new ConstantProperty<>(100000.0);
ellipseGraphicsOptions.semiMajorAxis = new ConstantProperty<>(200000.0);
ellipseGraphicsOptions.height = new ConstantProperty<>(100000.0);
ellipseGraphicsOptions.extrudedHeight = new ConstantProperty<>(200000.0);
ellipseGraphicsOptions.rotation = new ConstantProperty<>(Math.toRadians(90.0));
ellipseGraphicsOptions.outline = new ConstantProperty<>(true);
ellipseGraphicsOptions.outlineColor = new ConstantProperty<>(Color.WHITE());
ellipseGraphicsOptions.outlineWidth = new ConstantProperty<>(4);
colorRandomOptions = new ColorRandomOptions();
colorRandomOptions.alpha = 1.0f;
ellipseGraphicsOptions.material = new ColorMaterialProperty(new ConstantProperty<>(Color.fromRandom(colorRandomOptions)));
ellipseGraphics = new EllipseGraphics(ellipseGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-117.0, 35.0));
entityOptions.ellipse = ellipseGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
polygonGraphicsOptions = new PolygonGraphicsOptions();
polygonGraphicsOptions.hierarchy = new ConstantProperty<>(new PolygonHierarchy(Cartesian3.fromDegreesArray(new double[] { -118.0, 30.0, -115.0, 30.0, -117.1, 31.1, -118.0, 33.0 })));
polygonGraphicsOptions.height = new ConstantProperty<>(300000.0);
polygonGraphicsOptions.extrudedHeight = new ConstantProperty<>(700000.0);
polygonGraphicsOptions.outline = new ConstantProperty<>(true);
polygonGraphicsOptions.outlineColor = new ConstantProperty<>(Color.WHITE());
polygonGraphicsOptions.outlineWidth = new ConstantProperty<>(4);
colorRandomOptions = new ColorRandomOptions();
colorRandomOptions.alpha = 1.0f;
polygonGraphicsOptions.material = new ColorMaterialProperty(new ConstantProperty<>(Color.fromRandom(colorRandomOptions)));
polygonGraphics = new PolygonGraphics(polygonGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.polygon = polygonGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
CylinderGraphicsOptions cylinderGraphicsOptions = new CylinderGraphicsOptions();
cylinderGraphicsOptions.length = new ConstantProperty<>(200000.0);
cylinderGraphicsOptions.topRadius = new ConstantProperty<>(150000.0);
cylinderGraphicsOptions.bottomRadius = new ConstantProperty<>(150000.0);
cylinderGraphicsOptions.outline = new ConstantProperty<>(true);
cylinderGraphicsOptions.outlineColor = new ConstantProperty<>(Color.WHITE());
cylinderGraphicsOptions.outlineWidth = new ConstantProperty<>(4);
colorRandomOptions = new ColorRandomOptions();
colorRandomOptions.alpha = 1.0f;
cylinderGraphicsOptions.material = new ColorMaterialProperty(new ConstantProperty<>(Color.fromRandom(colorRandomOptions)));
CylinderGraphics cylinderGraphics = new CylinderGraphics(cylinderGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-70.0, 45.0, 100000.0));
entityOptions.cylinder = cylinderGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
for (int i = 0; i < 5; ++i) {
double height = 100000.0 + (200000.0 * i);
BoxGraphicsOptions boxGraphicsOptions = new BoxGraphicsOptions();
boxGraphicsOptions.dimensions = new ConstantPositionProperty(new Cartesian3(90000.0, 90000.0, 90000.0));
boxGraphicsOptions.outline = new ConstantProperty<>(true);
boxGraphicsOptions.outlineColor = new ConstantProperty<>(Color.WHITE());
colorRandomOptions = new ColorRandomOptions();
colorRandomOptions.alpha = 0.5f;
boxGraphicsOptions.material = new ColorMaterialProperty(new ConstantProperty<>(Color.fromRandom(colorRandomOptions)));
BoxGraphics boxGraphics = new BoxGraphics(boxGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-106.0, 45.0, height));
entityOptions.box = boxGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
EllipsoidGraphicsOptions ellipsoidGraphicsOptions = new EllipsoidGraphicsOptions();
ellipsoidGraphicsOptions.radii = new ConstantPositionProperty(new Cartesian3(45000.0, 45000.0, 90000.0));
ellipsoidGraphicsOptions.outline = new ConstantProperty<>(true);
ellipsoidGraphicsOptions.outlineColor = new ConstantProperty<>(Color.WHITE());
ellipsoidGraphicsOptions.outlineWidth = new ConstantProperty<>(2);
colorRandomOptions = new ColorRandomOptions();
colorRandomOptions.alpha = 0.5f;
ellipsoidGraphicsOptions.material = new ColorMaterialProperty(new ConstantProperty<>(Color.fromRandom(colorRandomOptions)));
EllipsoidGraphics ellipsoidGraphics = new EllipsoidGraphics(ellipsoidGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-102.0, 45.0, height));
entityOptions.ellipsoid = ellipsoidGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
ellipsoidGraphicsOptions = new EllipsoidGraphicsOptions();
ellipsoidGraphicsOptions.radii = new ConstantPositionProperty(new Cartesian3(67500.0, 67500.0, 67500.0));
ellipsoidGraphicsOptions.outline = new ConstantProperty<>(true);
ellipsoidGraphicsOptions.outlineColor = new ConstantProperty<>(Color.WHITE());
ellipsoidGraphicsOptions.outlineWidth = new ConstantProperty<>(2);
colorRandomOptions = new ColorRandomOptions();
colorRandomOptions.alpha = 0.5f;
ellipsoidGraphicsOptions.material = new ColorMaterialProperty(new ConstantProperty<>(Color.fromRandom(colorRandomOptions)));
ellipsoidGraphics = new EllipsoidGraphics(ellipsoidGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-98.0, 45.0, height));
entityOptions.ellipsoid = ellipsoidGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
}
WallGraphicsOptions wallGraphicsOptions = new WallGraphicsOptions();
wallGraphicsOptions.positions = new ConstantProperty<>(Cartesian3.fromDegreesArray(new double[] { -95.0, 50.0, -85.0, 50.0, -75.0, 50.0 }));
wallGraphicsOptions.maximumHeights = new ConstantProperty<>(new double[] { 500000, 1000000, 500000 });
wallGraphicsOptions.minimumHeights = new ConstantProperty<>(new double[] { 0, 500000, 0 });
wallGraphicsOptions.outline = new ConstantProperty<>(true);
wallGraphicsOptions.outlineColor = new ConstantProperty<>(Color.LIGHTGRAY());
wallGraphicsOptions.outlineWidth = new ConstantProperty<>(4);
colorRandomOptions = new ColorRandomOptions();
colorRandomOptions.alpha = 0.7f;
wallGraphicsOptions.material = new ColorMaterialProperty(new ConstantProperty<>(Color.fromRandom(colorRandomOptions)));
WallGraphics wallGraphics = new WallGraphics(wallGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.wall = wallGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
rectangleGraphicsOptions = new RectangleGraphicsOptions();
rectangleGraphicsOptions.coordinates = new ConstantProperty<>(Rectangle.fromDegrees(-92.0, 30.0, -85.0, 40.0));
rectangleGraphicsOptions.material = stripeMaterialProperty;
entityOptions = new EntityOptions();
entityOptions.rectangle = rectangleGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
polygonGraphicsOptions = new PolygonGraphicsOptions();
PolygonHierarchy polygonHierarchy = new PolygonHierarchy(Cartesian3.fromDegreesArray(new double[] { -109.0, 30.0, -95.0, 30.0, -95.0, 40.0, -109.0, 40.0 }), new PolygonHierarchy[] { new PolygonHierarchy(Cartesian3.fromDegreesArray(new double[] { -107.0, 31.0, -107.0, 39.0, -97.0, 39.0, -97.0, 31.0 }), new PolygonHierarchy[] { new PolygonHierarchy(Cartesian3.fromDegreesArray(new double[] { -105.0, 33.0, -99.0, 33.0, -99.0, 37.0, -105.0, 37.0 }), new PolygonHierarchy[] { new PolygonHierarchy(Cartesian3.fromDegreesArray(new double[] { -103.0, 34.0, -101.0, 34.0, -101.0, 36.0, -103.0, 36.0 })) }) }) });
polygonGraphicsOptions.hierarchy = new ConstantProperty<>(polygonHierarchy);
polygonGraphicsOptions.material = stripeMaterialProperty;
polygonGraphics = new PolygonGraphics(polygonGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.polygon = polygonGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
ellipseGraphicsOptions = new EllipseGraphicsOptions();
ellipseGraphicsOptions.semiMinorAxis = new ConstantProperty<>(200000.0);
ellipseGraphicsOptions.semiMajorAxis = new ConstantProperty<>(500000.0);
ellipseGraphicsOptions.rotation = new ConstantProperty<>(Math.toRadians(30.0));
ellipseGraphicsOptions.material = stripeMaterialProperty;
ellipseGraphics = new EllipseGraphics(ellipseGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.ellipse = ellipseGraphics;
entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-80.0, 35.0));
csVPanel.getViewer().entities().add(new Entity(entityOptions));
ellipseGraphicsOptions = new EllipseGraphicsOptions();
ellipseGraphicsOptions.semiMinorAxis = new ConstantProperty<>(200000.0);
ellipseGraphicsOptions.semiMajorAxis = new ConstantProperty<>(200000.0);
ellipseGraphicsOptions.rotation = new ConstantProperty<>(Math.toRadians(30.0));
ellipseGraphicsOptions.material = stripeMaterialProperty;
ellipseGraphics = new EllipseGraphics(ellipseGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.ellipse = ellipseGraphics;
entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-72.0, 35.0));
csVPanel.getViewer().entities().add(new Entity(entityOptions));
rectangleGraphicsOptions = new RectangleGraphicsOptions();
rectangleGraphicsOptions.coordinates = new ConstantProperty<>(Rectangle.fromDegrees(-110.0, 38.0, -107.0, 40.0));
rectangleGraphicsOptions.height = new ConstantProperty<>(700000.0);
rectangleGraphicsOptions.extrudedHeight = new ConstantProperty<>(1000000.0);
rectangleGraphicsOptions.rotation = new ConstantProperty<>(Math.toRadians(45));
colorRandomOptions = new ColorRandomOptions();
colorRandomOptions.alpha = 1.0f;
rectangleGraphicsOptions.material = new ColorMaterialProperty(new ConstantProperty<>(Color.fromRandom(colorRandomOptions)));
rectangleGraphics = new RectangleGraphics(rectangleGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.rectangle = rectangleGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
ellipseGraphicsOptions = new EllipseGraphicsOptions();
ellipseGraphicsOptions.semiMinorAxis = new ConstantProperty<>(100000.0);
ellipseGraphicsOptions.semiMajorAxis = new ConstantProperty<>(200000.0);
ellipseGraphicsOptions.height = new ConstantProperty<>(300000.0);
ellipseGraphicsOptions.extrudedHeight = new ConstantProperty<>(700000.0);
ellipseGraphicsOptions.rotation = new ConstantProperty<>(Math.toRadians(-40.0));
colorRandomOptions = new ColorRandomOptions();
colorRandomOptions.alpha = 1.0f;
ellipseGraphicsOptions.material = new ColorMaterialProperty(new ConstantProperty<>(Color.fromRandom(colorRandomOptions)));
ellipseGraphics = new EllipseGraphics(ellipseGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.ellipse = ellipseGraphics;
entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-110.0, 35.0));
csVPanel.getViewer().entities().add(new Entity(entityOptions));
polygonGraphicsOptions = new PolygonGraphicsOptions();
polygonGraphicsOptions.hierarchy = new ConstantProperty<>(new PolygonHierarchy(Cartesian3.fromDegreesArray(new double[] { -113.0, 30.0, -110.0, 30.0, -110.0, 33.0, -111.5, 31.0, -113.0, 33.0 })));
polygonGraphicsOptions.extrudedHeight = new ConstantProperty<>(300000.0);
colorRandomOptions = new ColorRandomOptions();
colorRandomOptions.alpha = 1.0f;
polygonGraphicsOptions.material = new ColorMaterialProperty(new ConstantProperty<>(Color.fromRandom(colorRandomOptions)));
polygonGraphics = new PolygonGraphics(polygonGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.polygon = polygonGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
cylinderGraphicsOptions = new CylinderGraphicsOptions();
cylinderGraphicsOptions.length = new ConstantProperty<>(400000.0);
cylinderGraphicsOptions.topRadius = new ConstantProperty<>(0.0);
cylinderGraphicsOptions.bottomRadius = new ConstantProperty<>(200000.0);
colorRandomOptions = new ColorRandomOptions();
colorRandomOptions.alpha = 1.0f;
cylinderGraphicsOptions.material = new ColorMaterialProperty(new ConstantProperty<>(Color.fromRandom(colorRandomOptions)));
cylinderGraphics = new CylinderGraphics(cylinderGraphicsOptions);
entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-70.0, 40.0, 200000.0));
entityOptions.cylinder = cylinderGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
for (int i = 0; i < 5; ++i) {
double height = 200000.0 * i;
ellipseGraphicsOptions = new EllipseGraphicsOptions();
ellipseGraphicsOptions.semiMinorAxis = new ConstantProperty<>(200000.0);
ellipseGraphicsOptions.semiMajorAxis = new ConstantProperty<>(200000.0);
ellipseGraphicsOptions.height = new ConstantProperty<>(height);
colorRandomOptions = new ColorRandomOptions();
colorRandomOptions.alpha = 0.5f;
ellipseGraphicsOptions.material = new ColorMaterialProperty(new ConstantProperty<>(Color.fromRandom(colorRandomOptions)));
ellipseGraphics = new EllipseGraphics(ellipseGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.ellipse = ellipseGraphics;
entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-65.0, 35.0));
csVPanel.getViewer().entities().add(new Entity(entityOptions));
rectangleGraphicsOptions = new RectangleGraphicsOptions();
rectangleGraphicsOptions.coordinates = new ConstantProperty<>(Rectangle.fromDegrees(-67.0, 27.0, -63.0, 32.0));
rectangleGraphicsOptions.height = new ConstantProperty<>(height);
colorRandomOptions = new ColorRandomOptions();
colorRandomOptions.alpha = 0.5f;
rectangleGraphicsOptions.material = new ColorMaterialProperty(new ConstantProperty<>(Color.fromRandom(colorRandomOptions)));
rectangleGraphics = new RectangleGraphics(rectangleGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.rectangle = rectangleGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
}
for (int i = 0; i < 5; ++i) {
double height = 100000.0 + (200000.0 * i);
BoxGraphicsOptions boxGraphicsOptions = new BoxGraphicsOptions();
boxGraphicsOptions.dimensions = new ConstantProperty<>(new Cartesian3(90000.0, 90000.0, 90000.0));
colorRandomOptions = new ColorRandomOptions();
colorRandomOptions.alpha = 1.0f;
boxGraphicsOptions.material = new ColorMaterialProperty(new ConstantProperty<>(Color.fromRandom(colorRandomOptions)));
BoxGraphics boxGraphics = new BoxGraphics(boxGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-108.0, 45.0, height));
entityOptions.box = boxGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
EllipsoidGraphicsOptions ellipsoidGraphicsOptions = new EllipsoidGraphicsOptions();
ellipsoidGraphicsOptions.radii = new ConstantPositionProperty(new Cartesian3(45000.0, 45000.0, 90000.0));
colorRandomOptions = new ColorRandomOptions();
colorRandomOptions.alpha = 1.0f;
ellipsoidGraphicsOptions.material = new ColorMaterialProperty(new ConstantProperty<>(Color.fromRandom(colorRandomOptions)));
EllipsoidGraphics ellipsoidGraphics = new EllipsoidGraphics(ellipsoidGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-104.0, 45.0, height));
entityOptions.ellipsoid = ellipsoidGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
ellipsoidGraphicsOptions = new EllipsoidGraphicsOptions();
ellipsoidGraphicsOptions.radii = new ConstantPositionProperty(new Cartesian3(67500.0, 67500.0, 67500.0));
colorRandomOptions = new ColorRandomOptions();
colorRandomOptions.alpha = 1.0f;
ellipsoidGraphicsOptions.material = new ColorMaterialProperty(new ConstantProperty<>(Color.fromRandom(colorRandomOptions)));
ellipsoidGraphics = new EllipsoidGraphics(ellipsoidGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-100.0, 45.0, height));
entityOptions.ellipsoid = ellipsoidGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
}
Cartesian3[] positions = new Cartesian3[40];
for (int i = 0; i < 40; ++i) {
positions[i] = Cartesian3.fromDegrees(-100.0 + i, 15.0);
}
PolylineGraphicsOptions polylineGraphicsOptions = new PolylineGraphicsOptions();
polylineGraphicsOptions.positions = new ConstantProperty<>(positions);
polylineGraphicsOptions.width = new ConstantProperty<>(10.0);
PolylineGlowMaterialPropertyOptions polylineGlowMaterialPropertyOptions = new PolylineGlowMaterialPropertyOptions();
polylineGlowMaterialPropertyOptions.color = new ConstantProperty<>(Color.DEEPSKYBLUE());
polylineGlowMaterialPropertyOptions.glowPower = new ConstantProperty<>(0.25);
polylineGraphicsOptions.material = new PolylineGlowMaterialProperty(polylineGlowMaterialPropertyOptions);
PolylineGraphics polylineGraphics = new PolylineGraphics(polylineGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.polyline = polylineGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
positions = new Cartesian3[40];
for (int i = 0; i < 40; ++i) {
positions[i] = Cartesian3.fromDegrees(-100.0 + i, 9.0);
}
wallGraphicsOptions = new WallGraphicsOptions();
wallGraphicsOptions.positions = new ConstantProperty<>(Cartesian3.fromDegreesArrayHeights(new double[] { -90.0, 43.0, 100000.0, -87.5, 45.0, 100000.0, -85.0, 43.0, 100000.0, -87.5, 41.0, 100000.0, -90.0, 43.0, 100000.0 }));
CheckerboardMaterialPropertyOptions checkerboardMaterialPropertyOptions = new CheckerboardMaterialPropertyOptions();
checkerboardMaterialPropertyOptions.repeat = new ConstantProperty<>(new Cartesian2(20.0, 6.0));
wallGraphicsOptions.material = new CheckerboardMaterialProperty(checkerboardMaterialPropertyOptions);
wallGraphics = new WallGraphics(wallGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.wall = wallGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
CorridorGraphicsOptions corridorGraphicsOptions = new CorridorGraphicsOptions();
corridorGraphicsOptions.positions = new ConstantProperty<>(Cartesian3.fromDegreesArray(new double[] { -120.0, 45.0, -125.0, 50.0, -125.0, 55.0 }));
corridorGraphicsOptions.width = new ConstantProperty<>(100000);
colorRandomOptions = new ColorRandomOptions();
colorRandomOptions.alpha = 1.0f;
corridorGraphicsOptions.material = new ColorMaterialProperty(new ConstantProperty<>(Color.fromRandom(colorRandomOptions)));
CorridorGraphics corridorGraphics = new CorridorGraphics(corridorGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.corridor = corridorGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
corridorGraphicsOptions = new CorridorGraphicsOptions();
corridorGraphicsOptions.positions = new ConstantProperty<>(Cartesian3.fromDegreesArray(new double[] { -120.0, 45.0, -125.0, 50.0, -125.0, 55.0 }));
corridorGraphicsOptions.width = new ConstantProperty<>(100000);
corridorGraphicsOptions.height = new ConstantProperty<>(300000);
corridorGraphicsOptions.extrudedHeight = new ConstantProperty<>(400000);
colorRandomOptions = new ColorRandomOptions();
colorRandomOptions.alpha = 0.7f;
corridorGraphicsOptions.material = new ColorMaterialProperty(new ConstantProperty<>(Color.fromRandom(colorRandomOptions)));
corridorGraphics = new CorridorGraphics(corridorGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.corridor = corridorGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
corridorGraphicsOptions = new CorridorGraphicsOptions();
corridorGraphicsOptions.positions = new ConstantProperty<>(Cartesian3.fromDegreesArray(new double[] { -120.0, 45.0, -125.0, 50.0, -125.0, 55.0 }));
corridorGraphicsOptions.width = new ConstantProperty<>(100000);
corridorGraphicsOptions.height = new ConstantProperty<>(700000.0);
corridorGraphicsOptions.outline = new ConstantProperty<>(true);
corridorGraphicsOptions.outlineColor = new ConstantProperty<>(Color.WHITE());
corridorGraphicsOptions.outlineWidth = new ConstantProperty<>(4);
colorRandomOptions = new ColorRandomOptions();
colorRandomOptions.alpha = 0.7f;
corridorGraphicsOptions.material = new ColorMaterialProperty(new ConstantProperty<>(Color.fromRandom(colorRandomOptions)));
corridorGraphics = new CorridorGraphics(corridorGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.corridor = corridorGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
PolylineVolumeGraphicsOptions polylineVolumeGraphicsOptions = new PolylineVolumeGraphicsOptions();
polylineVolumeGraphicsOptions.positions = new ConstantProperty<>(Cartesian3.fromDegreesArrayHeights(new double[] { -102.0, 15.0, 100000.0, -105.0, 20.0, 200000.0, -110.0, 20.0, 100000.0 }));
polylineVolumeGraphicsOptions.outline = new ConstantProperty<>(true);
polylineVolumeGraphicsOptions.outlineColor = new ConstantProperty<>(Color.WHITE());
polylineVolumeGraphicsOptions.outlineWidth = new ConstantProperty<>(1);
colorRandomOptions = new ColorRandomOptions();
colorRandomOptions.alpha = 1.0f;
polylineVolumeGraphicsOptions.material = new ColorMaterialProperty(new ConstantProperty<>(Color.fromRandom(colorRandomOptions)));
polylineVolumeGraphicsOptions.shape = new ConstantProperty<>(startPositions(7, 30000.0, 20000.0));
PolylineVolumeGraphics polylineVolumeGraphics = new PolylineVolumeGraphics(polylineVolumeGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.polylineVolume = polylineVolumeGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
polylineVolumeGraphicsOptions = new PolylineVolumeGraphicsOptions();
polylineVolumeGraphicsOptions.positions = new ConstantProperty<>(Cartesian3.fromDegreesArray(new double[] { -102.0, 15.0, -105.0, 20.0, -110.0, 20.0 }));
colorRandomOptions = new ColorRandomOptions();
colorRandomOptions.alpha = 1.0f;
polylineVolumeGraphicsOptions.material = new ColorMaterialProperty(new ConstantProperty<>(Color.fromRandom(colorRandomOptions)));
polylineVolumeGraphicsOptions.shape = new ConstantProperty<>(startPositions(7, 30000.0, 20000.0));
polylineVolumeGraphics = new PolylineVolumeGraphics(polylineVolumeGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.polylineVolume = polylineVolumeGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
polylineVolumeGraphicsOptions = new PolylineVolumeGraphicsOptions();
polylineVolumeGraphicsOptions.positions = new ConstantProperty<>(Cartesian3.fromDegreesArray(new double[] { -104.0, 13.0, -107.0, 18.0, -112.0, 18.0 }));
polylineVolumeGraphicsOptions.material = new ColorMaterialProperty(new ConstantProperty<>(Color.WHITE()));
polylineVolumeGraphicsOptions.shape = new ConstantProperty<>(computeCircle(40000));
polylineVolumeGraphics = new PolylineVolumeGraphics(polylineVolumeGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.polylineVolume = polylineVolumeGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
contentPanel.add(new HTML("<p>Demonstrates the wide variety of available geometry and appearances.</p>"));
contentPanel.add(csVPanel);
initWidget(contentPanel);
}
use of org.cesiumjs.cs.datasources.Entity in project gwt-cs by iSergio.
the class HeadingPitchRoll method buildPanel.
@Override
public void buildPanel() {
ViewerPanel csVPanel = new ViewerPanel();
pathPosition = new SampledPositionProperty();
PathGraphicsOptions pathGraphicsOptions = new PathGraphicsOptions();
pathGraphicsOptions.show = new ConstantProperty<>(true);
pathGraphicsOptions.leadTime = new ConstantProperty<>(0);
pathGraphicsOptions.trailTime = new ConstantProperty<>(60);
pathGraphicsOptions.width = new ConstantProperty<>(10);
pathGraphicsOptions.resolution = new ConstantProperty<>(1);
pathGraphicsOptions.material = PolylineGlowMaterialProperty.create(Color.PALEGOLDENROD(), 0.3);
EntityOptions entityOptions = new EntityOptions();
entityOptions.position = pathPosition;
entityOptions.name = "path";
entityOptions.path = new PathGraphics(pathGraphicsOptions);
Entity entityPath = csVPanel.getViewer().entities().add(entityOptions);
final org.cesiumjs.cs.scene.Camera camera = csVPanel.getViewer().camera;
final ScreenSpaceCameraController controller = csVPanel.getViewer().scene().screenSpaceCameraController();
final Cartesian3 center = new Cartesian3();
final org.cesiumjs.cs.core.HeadingPitchRoll hpRoll = new org.cesiumjs.cs.core.HeadingPitchRoll();
final HeadingPitchRange hpRange = new HeadingPitchRange();
position = Cartesian3.fromDegrees(-123.0744619, 44.0503706, 5000.0);
speedVector = new Cartesian3();
final Transforms.LocalFrameToFixedFrame fixedFrameTransform = Transforms.localFrameToFixedFrameGenerator("north", "west");
FromGltfOptions fromGltfOptions = new FromGltfOptions();
fromGltfOptions.url = GWT.getModuleBaseURL() + "SampleData/models/CesiumAir/Cesium_Air.glb";
// , fixedFrameTransform);
fromGltfOptions.modelMatrix = Transforms.headingPitchRollToFixedFrame(position, hpRoll, Ellipsoid.WGS84());
fromGltfOptions.minimumPixelSize = 128;
planePrimitive = (Model) csVPanel.getViewer().scene().primitives().add(Model.fromGltf(fromGltfOptions));
planePrimitive.readyPromise().then(new Fulfill<Model>() {
@Override
public void onFulfilled(Model model) {
ModelAnimationOptions modelAnimationOptions = new ModelAnimationOptions();
modelAnimationOptions.speedup = 0.5;
modelAnimationOptions.loop = ModelAnimationLoop.REPEAT();
model.activeAnimations.addAll(modelAnimationOptions);
// Zoom to model
r = 2.0 * max(model.boundingSphere().radius, ((PerspectiveFrustum) camera.frustum).near);
controller.minimumZoomDistance = r * 0.5;
Matrix4.multiplyByPoint(model.modelMatrix, model.boundingSphere().center, center);
double heading = Math.toRadians(230.0);
double pitch = Math.toRadians(-20.0);
hpRange.heading = heading;
hpRange.pitch = pitch;
hpRange.range = r * 50.0;
camera.lookAt(center, hpRange);
}
});
fromBehind = new CheckBox();
fromBehind.getElement().getStyle().setColor("white");
fromBehind.setWidth("100px");
fromBehind.setValue(false);
final com.google.gwt.user.client.ui.Label headingLabel = new Label();
headingLabel.getElement().getStyle().setColor("white");
headingLabel.setText("Heading:°");
final com.google.gwt.user.client.ui.Label pitchLabel = new Label();
pitchLabel.getElement().getStyle().setColor("white");
pitchLabel.setText("Pitch:°");
final com.google.gwt.user.client.ui.Label rollLabel = new Label();
rollLabel.getElement().getStyle().setColor("white");
rollLabel.setText("Roll:°");
final com.google.gwt.user.client.ui.Label speedLabel = new Label();
speedLabel.getElement().getStyle().setColor("white");
speedLabel.setText("Speed:m/s");
FlexTable flexTable = new FlexTable();
flexTable.setWidget(0, 0, headingLabel);
flexTable.setHTML(1, 0, "<font color=\"white\">← to left/→ to right</font>");
flexTable.setWidget(2, 0, pitchLabel);
flexTable.setHTML(3, 0, "<font color=\"white\">↑ to up/↓ to down</font>");
flexTable.setWidget(4, 0, rollLabel);
flexTable.setHTML(5, 0, "<font color=\"white\">← + ⇧ left/→ + ⇧ right</font>");
flexTable.setWidget(6, 0, speedLabel);
flexTable.setHTML(7, 0, "<font color=\"white\">↑ + ⇧ to speed up/↓ + ⇧ to speed down</font>");
flexTable.setHTML(8, 0, "<font color=\"white\">Following aircraft</font>");
flexTable.setWidget(8, 1, fromBehind);
AbsolutePanel aPanel = new AbsolutePanel();
aPanel.add(csVPanel);
aPanel.add(flexTable, 20, 20);
contentPanel.add(new HTML("<p>Click on the 3D window then use the keyboard to change settings.</p>"));
contentPanel.add(aPanel);
csVPanel.getViewer().scene().preRender().addEventListener(new Scene.Listener() {
@Override
public void function(Scene scene, JulianDate time) {
headingLabel.setText("Heading:" + Math.toDegrees(hpRoll.heading) + "°");
pitchLabel.setText("Pitch:" + Math.toDegrees(hpRoll.pitch) + "°");
rollLabel.setText("Roll:" + Math.toDegrees(hpRoll.roll) + "°");
speedLabel.setText("Speed:" + speed + "m/s");
speedVector = Cartesian3.multiplyByScalar(Cartesian3.UNIT_X(), speed / 10, speedVector);
position = Matrix4.multiplyByPoint(planePrimitive.modelMatrix, speedVector, position);
pathPosition.addSample(JulianDate.now(), position);
Transforms.headingPitchRollToFixedFrame(position, hpRoll, Ellipsoid.WGS84(), fixedFrameTransform, planePrimitive.modelMatrix);
if (fromBehind.getValue()) {
// Zoom to model
Matrix4.multiplyByPoint(planePrimitive.modelMatrix, planePrimitive.boundingSphere().center, center);
hpRange.heading = hpRoll.heading;
hpRange.pitch = hpRoll.pitch;
camera.lookAt(center, hpRange);
}
}
});
RootPanel.get().addDomHandler(new KeyDownHandler() {
@Override
public void onKeyDown(KeyDownEvent keyDownEvent) {
switch(keyDownEvent.getNativeKeyCode()) {
case 40:
if (keyDownEvent.getNativeEvent().getShiftKey()) {
speed = max(--speed, 1);
} else {
hpRoll.pitch -= deltaRadians;
if (hpRoll.pitch < -Math.TWO_PI()) {
hpRoll.pitch += Math.TWO_PI();
}
}
break;
case 38:
if (keyDownEvent.getNativeEvent().getShiftKey()) {
// speed up
speed = min(++speed, 100);
} else {
// pitch up
hpRoll.pitch += deltaRadians;
if (hpRoll.pitch > Math.TWO_PI()) {
hpRoll.pitch -= Math.TWO_PI();
}
}
break;
case 39:
if (keyDownEvent.getNativeEvent().getShiftKey()) {
// roll right
hpRoll.roll += deltaRadians;
if (hpRoll.roll > Math.TWO_PI()) {
hpRoll.roll -= Math.TWO_PI();
}
} else {
// turn right
hpRoll.heading += deltaRadians;
if (hpRoll.heading > Math.TWO_PI()) {
hpRoll.heading -= Math.TWO_PI();
}
}
break;
case 37:
if (keyDownEvent.getNativeEvent().getShiftKey()) {
// roll left until
hpRoll.roll -= deltaRadians;
if (hpRoll.roll < 0.0) {
hpRoll.roll += Math.TWO_PI();
}
} else {
// turn left
hpRoll.heading -= deltaRadians;
if (hpRoll.heading < 0.0) {
hpRoll.heading += Math.TWO_PI();
}
}
break;
default:
break;
}
}
}, KeyDownEvent.getType());
initWidget(contentPanel);
}
use of org.cesiumjs.cs.datasources.Entity in project gwt-cs by iSergio.
the class Interpolation method buildPanel.
@Override
public void buildPanel() {
csVPanel = new ViewerPanel();
csVPanel.getViewer().scene().globe.enableLighting = false;
CesiumTerrainProviderOptions cesiumTerrainProviderOptions = new CesiumTerrainProviderOptions();
cesiumTerrainProviderOptions.url = "https://assets.agi.com/stk-terrain/world";
cesiumTerrainProviderOptions.requestWaterMask = true;
cesiumTerrainProviderOptions.requestVertexNormals = true;
csVPanel.getViewer().terrainProvider = new CesiumTerrainProvider(cesiumTerrainProviderOptions);
csVPanel.getViewer().scene().globe.depthTestAgainstTerrain = true;
Math.setRandomNumberSeed(3);
_start = JulianDate.fromDate(new JsDate(2015, 2, 25, 16));
_stop = JulianDate.addSeconds(_start, 360, new JulianDate());
csVPanel.getViewer().clock().startTime = _start.clone();
csVPanel.getViewer().clock().stopTime = _stop.clone();
csVPanel.getViewer().clock().currentTime = _start.clone();
csVPanel.getViewer().clock().clockRange = ClockRange.LOOP_STOP();
csVPanel.getViewer().clock().multiplier = 10;
csVPanel.getViewer().timeline().zoomTo(_start, _stop);
PositionProperty position = computeCirclularFlight(-112.110693, 36.0994841, 0.03);
TimeIntervalOptions timeIntervalOptions = new TimeIntervalOptions();
timeIntervalOptions.start = _start;
timeIntervalOptions.stop = _stop;
ModelGraphicsOptions modelGraphicsOptions = new ModelGraphicsOptions();
modelGraphicsOptions.uri = new ConstantProperty<>(GWT.getModuleBaseURL() + "SampleData/models/CesiumAir/Cesium_Air.gltf");
modelGraphicsOptions.minimumPixelSize = new ConstantProperty<>(64);
PolylineGlowMaterialPropertyOptions polylineGlowMaterialPropertyOptions = new PolylineGlowMaterialPropertyOptions();
polylineGlowMaterialPropertyOptions.glowPower = new ConstantProperty<>(0.1);
polylineGlowMaterialPropertyOptions.color = new ConstantProperty<>(Color.YELLOW());
PathGraphicsOptions pathGraphicsOptions = new PathGraphicsOptions();
pathGraphicsOptions.resolution = new ConstantProperty<>(1);
pathGraphicsOptions.material = new PolylineGlowMaterialProperty(polylineGlowMaterialPropertyOptions);
pathGraphicsOptions.width = new ConstantProperty<>(10);
EntityOptions entityOptions = new EntityOptions();
entityOptions.availability = new TimeIntervalCollection(new TimeInterval[] { new TimeInterval(timeIntervalOptions) });
entityOptions.position = position;
entityOptions.orientation = new VelocityOrientationProperty(position);
entityOptions.model = new ModelGraphics(modelGraphicsOptions);
entityOptions.path = new PathGraphics(pathGraphicsOptions);
_entity = csVPanel.getViewer().entities().add(entityOptions);
ListBox interpolationsLBox = new ListBox();
interpolationsLBox.addItem("Interpolation: Linear Approximation", "0");
interpolationsLBox.addItem("Interpolation: Lagrange Polynomial Approximation", "1");
interpolationsLBox.addItem("Interpolation: Hermite Polynomial Approximation", "2");
interpolationsLBox.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent changeEvent) {
ListBox source = (ListBox) changeEvent.getSource();
SampledPropertyInterpolationOptions sampledPropertyInterpolationOptions = new SampledPropertyInterpolationOptions();
switch(source.getSelectedValue()) {
case "0":
sampledPropertyInterpolationOptions.interpolationDegree = 1;
sampledPropertyInterpolationOptions.interpolationAlgorithm = LinearApproximation.instance();
((SampledPositionProperty) _entity.position).setInterpolationOptions(sampledPropertyInterpolationOptions);
break;
case "1":
sampledPropertyInterpolationOptions.interpolationDegree = 5;
sampledPropertyInterpolationOptions.interpolationAlgorithm = LagrangePolynomialApproximation.instance();
((SampledPositionProperty) _entity.position).setInterpolationOptions(sampledPropertyInterpolationOptions);
break;
case "2":
sampledPropertyInterpolationOptions.interpolationDegree = 2;
sampledPropertyInterpolationOptions.interpolationAlgorithm = HermitePolynomialApproximation.instance();
((SampledPositionProperty) _entity.position).setInterpolationOptions(sampledPropertyInterpolationOptions);
break;
default:
break;
}
}
});
Button viewTopDownBtn = new Button("View Top Down");
viewTopDownBtn.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
Viewer viewer = csVPanel.getViewer();
viewer.trackedEntity = (Entity) JsObject.undefined();
viewer.zoomTo(viewer.entities(), new HeadingPitchRange(0, Math.toRadians(-90), 0));
}
});
Button viewSideBtn = new Button("View Side");
viewSideBtn.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
Viewer viewer = csVPanel.getViewer();
viewer.trackedEntity = (Entity) JsObject.undefined();
viewer.zoomTo(viewer.entities(), new HeadingPitchRange(Math.toRadians(-90), Math.toRadians(-15), 7500.0));
}
});
Button viewAircraftBtn = new Button("View Aircraft");
viewAircraftBtn.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
Viewer viewer = csVPanel.getViewer();
viewer.trackedEntity = _entity;
}
});
HorizontalPanel btnHPanel = new HorizontalPanel();
btnHPanel.setSpacing(5);
btnHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
btnHPanel.add(interpolationsLBox);
btnHPanel.add(viewTopDownBtn);
btnHPanel.add(viewSideBtn);
btnHPanel.add(viewAircraftBtn);
AbsolutePanel aPanel = new AbsolutePanel();
aPanel.add(csVPanel);
aPanel.add(btnHPanel, 20, 20);
contentPanel.add(new HTML("<p>This example shows simple Cesium application</p>"));
contentPanel.add(aPanel);
initWidget(contentPanel);
}
use of org.cesiumjs.cs.datasources.Entity in project gwt-cs by iSergio.
the class Billboards method addMarkerBillboards.
private void addMarkerBillboards() {
BillboardGraphicsOptions billboardGraphicsOptions = new BillboardGraphicsOptions();
billboardGraphicsOptions.image = new ConstantProperty<>(GWT.getModuleBaseURL() + "images/whiteShapes.png");
billboardGraphicsOptions.imageSubRegion = new ConstantProperty<>(new BoundingRectangle(49, 43, 18, 18));
billboardGraphicsOptions.color = new ConstantProperty<>(Color.LIME());
EntityOptions entityOptions = new EntityOptions();
entityOptions.billboard = new BillboardGraphics(billboardGraphicsOptions);
entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-75.59777, 40.03883));
csVPanel.getViewer().entities().add(new Entity(entityOptions));
billboardGraphicsOptions = new BillboardGraphicsOptions();
billboardGraphicsOptions.image = new ConstantProperty<>(GWT.getModuleBaseURL() + "images/whiteShapes.png");
billboardGraphicsOptions.imageSubRegion = new ConstantProperty<>(new BoundingRectangle(61, 23, 18, 18));
billboardGraphicsOptions.color = new ConstantProperty<>(new Color(0, 0.5, 1.0, 1.0));
entityOptions = new EntityOptions();
entityOptions.billboard = new BillboardGraphics(billboardGraphicsOptions);
entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-84.0, 39.0));
csVPanel.getViewer().entities().add(new Entity(entityOptions));
billboardGraphicsOptions = new BillboardGraphicsOptions();
billboardGraphicsOptions.image = new ConstantProperty<>(GWT.getModuleBaseURL() + "images/whiteShapes.png");
billboardGraphicsOptions.imageSubRegion = new ConstantProperty<>(new BoundingRectangle(67, 80, 14, 14));
billboardGraphicsOptions.color = new ConstantProperty<>(new Color(0.5, 0.9, 1.0, 1.0));
entityOptions = new EntityOptions();
entityOptions.billboard = new BillboardGraphics(billboardGraphicsOptions);
entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-70.0, 41.0));
csVPanel.getViewer().entities().add(new Entity(entityOptions));
billboardGraphicsOptions = new BillboardGraphicsOptions();
billboardGraphicsOptions.image = new ConstantProperty<>(GWT.getModuleBaseURL() + "images/whiteShapes.png");
billboardGraphicsOptions.imageSubRegion = new ConstantProperty<>(new BoundingRectangle(27, 103, 22, 22));
billboardGraphicsOptions.color = new ConstantProperty<>(Color.RED());
entityOptions = new EntityOptions();
entityOptions.billboard = new BillboardGraphics(billboardGraphicsOptions);
entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-73.0, 37.0));
csVPanel.getViewer().entities().add(new Entity(entityOptions));
billboardGraphicsOptions = new BillboardGraphicsOptions();
billboardGraphicsOptions.image = new ConstantProperty<>(GWT.getModuleBaseURL() + "images/whiteShapes.png");
billboardGraphicsOptions.imageSubRegion = new ConstantProperty<>(new BoundingRectangle(105, 105, 18, 18));
billboardGraphicsOptions.color = new ConstantProperty<>(Color.YELLOW());
entityOptions = new EntityOptions();
entityOptions.billboard = new BillboardGraphics(billboardGraphicsOptions);
entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-79.0, 35.0));
csVPanel.getViewer().entities().add(new Entity(entityOptions));
}
use of org.cesiumjs.cs.datasources.Entity in project gwt-cs by iSergio.
the class Billboards method addMultipleBillboards.
private void addMultipleBillboards() {
String logoUrl = GWT.getModuleBaseURL() + "images/Cesium_Logo_overlay.png";
String facilityUrl = GWT.getModuleBaseURL() + "images/facility.gif";
BillboardGraphicsOptions billboardGraphicsOptions = new BillboardGraphicsOptions();
billboardGraphicsOptions.image = new ConstantProperty<>(logoUrl);
BillboardGraphics billboardGraphics = new BillboardGraphics(billboardGraphicsOptions);
EntityOptions entityOptions = new EntityOptions();
entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-75.59777, 40.03883));
entityOptions.billboard = billboardGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
billboardGraphicsOptions = new BillboardGraphicsOptions();
billboardGraphicsOptions.image = new ConstantProperty<>(facilityUrl);
billboardGraphics = new BillboardGraphics(billboardGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-80.50, 35.14));
entityOptions.billboard = billboardGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
billboardGraphicsOptions = new BillboardGraphicsOptions();
billboardGraphicsOptions.image = new ConstantProperty<>(facilityUrl);
billboardGraphics = new BillboardGraphics(billboardGraphicsOptions);
entityOptions = new EntityOptions();
entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-80.12, 25.46));
entityOptions.billboard = billboardGraphics;
csVPanel.getViewer().entities().add(new Entity(entityOptions));
}
Aggregations