use of org.cesiumjs.cs.widgets.ViewerPanel in project gwt-cs by iSergio.
the class CustomHomeButton method buildPanel.
@Override
public void buildPanel() {
final PointGraphicsOptions pointOptions = new PointGraphicsOptions();
pointOptions.pixelSize = new ConstantProperty<>(5);
final EntityOptions entityOptions = new EntityOptions();
entityOptions.position = new ConstantPositionProperty(Cartesian3.fromDegrees(-73.986555, 40.735396, 0));
entityOptions.point = new PointGraphics(pointOptions);
final Entity entity = new Entity(entityOptions);
final ViewerOptions viewerOptions = new ViewerOptions();
final ViewerPanel viewer = new ViewerPanel(viewerOptions);
viewer.getViewer().homeButton().viewModel.tooltip = "Fly to New York";
viewer.getViewer().entities().add(entity);
viewer.getViewer().homeButton().viewModel.command.beforeExecute.addEventListener(new Event.Listener() {
@Override
public void function(Object... o) {
viewer.getViewer().flyTo(entity);
}
});
contentPanel.add(new HTML("<div>Click the home button to fly to New York.</div>"));
contentPanel.add(viewer);
initWidget(contentPanel);
}
use of org.cesiumjs.cs.widgets.ViewerPanel in project gwt-cs by iSergio.
the class ImageryAdjustment method buildPanel.
@Override
public void buildPanel() {
csVPanel = new ViewerPanel();
csVPanel.getViewer().imageryLayers().layerAdded.addEventListener(new UpdateViewModel());
csVPanel.getViewer().imageryLayers().layerRemoved.addEventListener(new UpdateViewModel());
csVPanel.getViewer().imageryLayers().layerMoved.addEventListener(new UpdateViewModel());
brightnessSlider = new Slider("brightness", 0, 300, 100);
brightnessSlider.setStep(1);
brightnessSlider.setWidth("150px");
brightnessSlider.addListener(new MSliderListener());
brightnessTBox = new TextBox();
brightnessTBox.addChangeHandler(new MChangeHandler());
brightnessTBox.setText("" + 1);
brightnessTBox.setSize("30px", "12px");
HorizontalPanel brightnessHPanel = new HorizontalPanel();
brightnessHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
brightnessHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
brightnessHPanel.setSpacing(10);
brightnessHPanel.add(brightnessSlider);
brightnessHPanel.add(brightnessTBox);
contrastSlider = new Slider("contrast", 0, 300, 100);
contrastSlider.setStep(1);
contrastSlider.setWidth("150px");
contrastSlider.addListener(new MSliderListener());
contrastTBox = new TextBox();
contrastTBox.addChangeHandler(new MChangeHandler());
contrastTBox.setText("" + 1);
contrastTBox.setSize("30px", "12px");
HorizontalPanel contrastHPanel = new HorizontalPanel();
contrastHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
contrastHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
contrastHPanel.setSpacing(10);
contrastHPanel.add(contrastSlider);
contrastHPanel.add(contrastTBox);
hueSlider = new Slider("hue", 0, 300, 0);
hueSlider.setStep(1);
hueSlider.setWidth("150px");
hueSlider.addListener(new MSliderListener());
hueTBox = new TextBox();
hueTBox.addChangeHandler(new MChangeHandler());
hueTBox.setText("" + 0);
hueTBox.setSize("30px", "12px");
HorizontalPanel hueHPanel = new HorizontalPanel();
hueHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
hueHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
hueHPanel.setSpacing(10);
hueHPanel.add(hueSlider);
hueHPanel.add(hueTBox);
saturationSlider = new Slider("saturation", 0, 300, 100);
saturationSlider.setStep(1);
saturationSlider.setWidth("150px");
saturationSlider.addListener(new MSliderListener());
saturationTBox = new TextBox();
saturationTBox.addChangeHandler(new MChangeHandler());
saturationTBox.setText("" + 1);
saturationTBox.setSize("30px", "12px");
HorizontalPanel saturationHPanel = new HorizontalPanel();
saturationHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
saturationHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
saturationHPanel.setSpacing(10);
saturationHPanel.add(saturationSlider);
saturationHPanel.add(saturationTBox);
gammaSlider = new Slider("gamma", 0, 300, 100);
gammaSlider.setStep(1);
gammaSlider.setWidth("150px");
gammaSlider.addListener(new MSliderListener());
gammaTBox = new TextBox();
gammaTBox.addChangeHandler(new MChangeHandler());
gammaTBox.setText("" + 1);
gammaTBox.setSize("30px", "12px");
HorizontalPanel gammaHPanel = new HorizontalPanel();
gammaHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
gammaHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
gammaHPanel.setSpacing(10);
gammaHPanel.add(gammaSlider);
gammaHPanel.add(gammaTBox);
FlexTable flexTable = new FlexTable();
flexTable.setCellSpacing(1);
flexTable.setCellPadding(1);
flexTable.setHTML(1, 0, "<font color=\"white\">Brightness</font>");
flexTable.setWidget(1, 1, brightnessHPanel);
flexTable.setHTML(2, 0, "<font color=\"white\">Contrast</font>");
flexTable.setWidget(2, 1, contrastHPanel);
flexTable.setHTML(3, 0, "<font color=\"white\">Hue</font>");
flexTable.setWidget(3, 1, hueHPanel);
flexTable.setHTML(4, 0, "<font color=\"white\">Saturation</font>");
flexTable.setWidget(4, 1, saturationHPanel);
flexTable.setHTML(5, 0, "<font color=\"white\">Gamma</font>");
flexTable.setWidget(5, 1, gammaHPanel);
AbsolutePanel aPanel = new AbsolutePanel();
aPanel.add(csVPanel);
aPanel.add(flexTable, 20, 20);
contentPanel.add(new HTML("<p>Adjust brightness, contrast, hue, saturation, and gamma of an imagery layer.</p>"));
contentPanel.add(aPanel);
initWidget(contentPanel);
}
use of org.cesiumjs.cs.widgets.ViewerPanel in project gwt-cs by iSergio.
the class ImageryLayersManipulation method buildPanel.
@Override
public void buildPanel() {
ViewerOptions viewerOptions = new ViewerOptions();
viewerOptions.baseLayerPicker = false;
ViewerPanel csVPanel = new ViewerPanel(viewerOptions);
imageryLayers = csVPanel.getViewer().imageryLayers();
setupLayers();
updateLayerList();
_callback.onSuccess(null);
HorizontalPanel baseLayersHPanel = new HorizontalPanel();
baseLayersHPanel.setSpacing(5);
baseLayersHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
baseLayersHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
final ListBox baseLayersLBox = new ListBox();
baseLayersHPanel.add(baseLayersLBox);
Slider baseLayersSlider = new Slider("baseLayersAlpha", 0, 100, 100);
baseLayersSlider.setWidth("200px");
baseLayersSlider.addListener(new MSliderListener());
baseLayersHPanel.add(baseLayersSlider);
baseLayersLBox.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent changeEvent) {
ListBox source = (ListBox) changeEvent.getSource();
ImageryLayer baseLayer = baseLayers.get(source.getSelectedValue());
int activeLayerIndex = 0;
int numLayers = layers.size();
for (int i = 0; i < numLayers; ++i) {
if (baseLayers.containsValue(layers.get(i))) {
activeLayerIndex = i;
}
}
ImageryLayer activeLayer = layers.get(activeLayerIndex);
float alpha = activeLayer.alpha;
boolean show = activeLayer.show;
imageryLayers.remove(activeLayer, false);
imageryLayers.add(baseLayer, numLayers - activeLayerIndex - 1);
baseLayer.show = show;
baseLayer.alpha = alpha;
updateLayerList();
selectedLayer = baseLayer;
}
});
Callback<Void, Void> cesiumCreated = new Callback<Void, Void>() {
@Override
public void onFailure(Void aVoid) {
//
}
@Override
public void onSuccess(Void aVoid) {
for (Map.Entry<String, ImageryLayer> entry : baseLayers.entrySet()) {
baseLayersLBox.addItem(entry.getKey(), entry.getKey());
}
}
};
addCallback(cesiumCreated);
contentPanel.add(new HTML("<p>Layer imagery from multiple sources, including WMS servers, Bing Maps, ArcGIS Online, OpenStreetMaps, and more, and adjust the alpha of each independently.</p>"));
contentPanel.add(baseLayersHPanel);
contentPanel.add(csVPanel);
initWidget(contentPanel);
}
use of org.cesiumjs.cs.widgets.ViewerPanel in project gwt-cs by iSergio.
the class Tiles3DInterior method buildPanel.
@Override
public void buildPanel() {
ViewerPanel csVPanel = new ViewerPanel();
csVPanel.getViewer().scene().primitives().add(Cesium3DTileset.create("https://beta.cesium.com/api/assets/1463?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI5ZGExZTdmMS0xZjA5LTQxODAtOThmYi04MWU1YjZkMWZjNjgiLCJpZCI6NDQsImFzc2V0cyI6WzE0NjNdLCJpYXQiOjE0OTkyNzYwNzV9.eTEtaAEBUehNIZushZQnp0On9BPRtZYS7XEWFwneSRU"));
Cartesian3 initialPosition = new Cartesian3(-1111583.3721328347, -5855888.151574568, 2262561.444696748);
org.cesiumjs.cs.core.HeadingPitchRoll initialOrientation = org.cesiumjs.cs.core.HeadingPitchRoll.fromDegrees(100.0, -15.0, 0.0);
ViewOptions viewOptions = new ViewOptions();
viewOptions.destinationPos = initialPosition;
viewOptions.orientation = initialOrientation;
viewOptions.endTransform = Matrix4.IDENTITY();
csVPanel.getViewer().scene().camera().setView(viewOptions);
contentPanel.add(new HTML("<p>A sample interior rendered with 3D Tiles.</p>"));
contentPanel.add(csVPanel);
initWidget(contentPanel);
}
use of org.cesiumjs.cs.widgets.ViewerPanel in project gwt-cs by iSergio.
the class Tiles3DPointCloud method buildPanel.
@Override
public void buildPanel() {
final ViewerPanel csVPanel = new ViewerPanel();
Cesium3DTileset tileset = (Cesium3DTileset) csVPanel.getViewer().scene().primitives().add(Cesium3DTileset.create("https://beta.cesium.com/api/assets/1460?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIyMzk2YzJiOS1jZGFmLTRlZmYtYmQ4MS00NTA3NjEwMzViZTkiLCJpZCI6NDQsImFzc2V0cyI6WzE0NjBdLCJpYXQiOjE0OTkyNjQ3NTV9.oWjvN52CRQ-dk3xtvD4e8ZnOHZhoWSpJLlw115mbQJM"));
tileset.readyPromise().then(new Fulfill<Cesium3DTileset>() {
@Override
public void onFulfilled(Cesium3DTileset value) {
BoundingSphere boundingSphere = value.boundingSphere();
csVPanel.getViewer().camera.viewBoundingSphere(boundingSphere, new org.cesiumjs.cs.core.HeadingPitchRange(0.0, -0.5, boundingSphere.radius));
csVPanel.getViewer().camera.lookAtTransform(Matrix4.IDENTITY());
}
});
contentPanel.add(new HTML("<p>Example styles for a point cloud tileset.</p>"));
contentPanel.add(csVPanel);
initWidget(contentPanel);
}
Aggregations