use of org.cesiumjs.cs.collections.EntityCollection in project gwt-cs by iSergio.
the class Picking method drillDownPicking.
private void drillDownPicking() {
_pickedEntities = new EntityCollection();
_pickColor = Color.YELLOW().withAlpha(0.5f);
PolygonGraphicsOptions polygonGraphicsOptions = new PolygonGraphicsOptions();
polygonGraphicsOptions.hierarchy = new ConstantProperty<>(new PolygonHierarchy(Cartesian3.fromDegreesArray(new double[] { -70.0, 30.0, -60.0, 30.0, -60.0, 40.0, -70.0, 40.0 })));
polygonGraphicsOptions.height = new ConstantProperty<>(0);
EntityOptions entityOptions = new EntityOptions();
entityOptions.polygon = new PolygonGraphics(polygonGraphicsOptions);
Entity red = viewerPanel.getViewer().entities().add(new Entity(entityOptions));
makeProperty(red, Color.RED().withAlpha(0.5f));
polygonGraphicsOptions = new PolygonGraphicsOptions();
polygonGraphicsOptions.hierarchy = new ConstantProperty<>(new PolygonHierarchy(Cartesian3.fromDegreesArray(new double[] { -75.0, 34.0, -63.0, 34.0, -63.0, 40.0, -75.0, 40.0 })));
polygonGraphicsOptions.height = new ConstantProperty<>(0);
entityOptions = new EntityOptions();
entityOptions.polygon = new PolygonGraphics(polygonGraphicsOptions);
Entity blue = viewerPanel.getViewer().entities().add(new Entity(entityOptions));
makeProperty(blue, Color.BLUE().withAlpha(0.5f));
polygonGraphicsOptions = new PolygonGraphicsOptions();
polygonGraphicsOptions.hierarchy = new ConstantProperty<>(new PolygonHierarchy(Cartesian3.fromDegreesArray(new double[] { -67.0, 36.0, -55.0, 36.0, -55.0, 30.0, -67.0, 30.0 })));
polygonGraphicsOptions.height = new ConstantProperty<>(0);
entityOptions = new EntityOptions();
entityOptions.polygon = new PolygonGraphics(polygonGraphicsOptions);
Entity green = viewerPanel.getViewer().entities().add(new Entity(entityOptions));
makeProperty(green, Color.GREEN().withAlpha(0.5f));
// Move the primitive that the mouse is over to the top.
_handler = new ScreenSpaceEventHandler(viewerPanel.getViewer().scene().canvas());
_handler.setInputAction(new ScreenSpaceEventHandler.Listener<MouseMoveEvent>() {
@Override
public void function(MouseMoveEvent event) {
PickedObject[] pickedObjects = viewerPanel.getViewer().scene().drillPick(event.endPosition);
if (pickedObjects != null) {
_pickedEntities.removeAll();
for (PickedObject pickedObject : pickedObjects) {
Entity entity = (Entity) pickedObject.id;
_pickedEntities.add(entity);
}
}
}
}, ScreenSpaceEventType.MOUSE_MOVE());
}
Aggregations