Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oneliner to Zoom to 3DTileset #6104

Merged
merged 19 commits into from
Jan 17, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
updated 3DTiles files in sandcastle to use zoomToTiles
  • Loading branch information
hanbollar committed Jan 9, 2018
commit 4c8a5be8d7b6f59bfa182eda1bf4ca1f0f56f8f2
4 changes: 1 addition & 3 deletions Apps/Sandcastle/gallery/3D Tiles Adjust Height.html
Original file line number Diff line number Diff line change
@@ -61,9 +61,7 @@
}));

tileset.readyPromise.then(function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since zoomTo now encapsulates the readyPromise, we can update these to be

viewer.zoomTo(tileset, new Cesium.HeadingPitchRange(...))
    .otherwise(function(error) {
        throw(error);
    });

var boundingSphere = tileset.boundingSphere;
viewer.camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0.0, -0.5, boundingSphere.radius * 2));
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
viewer.zoomToTileset(tileset, new Cesium.HeadingPitchRange(0.0, -0.5, tileset.boundingSphere.radius * 2));
}).otherwise(function(error) {
throw(error);
});
4 changes: 1 addition & 3 deletions Apps/Sandcastle/gallery/3D Tiles BIM.html
Original file line number Diff line number Diff line change
@@ -34,9 +34,7 @@
}));

tileset.readyPromise.then(function() {
var boundingSphere = tileset.boundingSphere;
viewer.camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0.5, -0.2, boundingSphere.radius * 4.0));
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
viewer.zoomToTileset(tileset, new Cesium.HeadingPitchRange(0.5, -0.2, tileset.boundingSphere.radius * 4.0));
}).otherwise(function(error) {
throw(error);
});
6 changes: 3 additions & 3 deletions Apps/Sandcastle/gallery/3D Tiles Batch Table Hierarchy.html
Original file line number Diff line number Diff line change
@@ -89,9 +89,9 @@
}));

tileset.readyPromise.then(function() {
var boundingSphere = tileset.boundingSphere;
viewer.camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0.0, -0.3, 0.0));
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
viewer.zoomToTileset(tileset, new Cesium.HeadingPitchRange(0.0, -0.3, 0.0));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is not based on the bounding sphere, so we don't need to wait for the readyPromise.

}).otherwise(function(error) {
throw(error);
});

var styles = [];
3 changes: 1 addition & 2 deletions Apps/Sandcastle/gallery/3D Tiles Clipping Planes.html
Original file line number Diff line number Diff line change
@@ -129,8 +129,7 @@
var boundingSphere = tileset.boundingSphere;
var radius = boundingSphere.radius;

viewer.camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0.5, -0.2, radius * 4.0));
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
viewer.zoomToTileset(tileset, new Cesium.HeadingPitchRange(0.5, -0.2, radius * 4.0));

for (var i = 0; i < clippingPlanes.length; ++i) {
var plane = clippingPlanes[i];
6 changes: 2 additions & 4 deletions Apps/Sandcastle/gallery/3D Tiles Formats.html
Original file line number Diff line number Diff line change
@@ -111,10 +111,8 @@
inspectorViewModel.tileset = tileset;
scene.primitives.add(tileset);
tileset.readyPromise.then(function(tileset) {
var boundingSphere = tileset.boundingSphere;
var range = Math.max(100.0 - boundingSphere.radius, 0.0); // Set a minimum offset of 100 meters
viewer.camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0, -2.0, range));
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);

viewer.zoomToTileset(tileset, new Cesium.HeadingPitchRange(0, -2.0, Math.max(100.0 - tileset.boundingSphere.radius, 0.0)));

var properties = tileset.properties;
if (Cesium.defined(properties) && Cesium.defined(properties.Height)) {
4 changes: 1 addition & 3 deletions Apps/Sandcastle/gallery/3D Tiles Inspector.html
Original file line number Diff line number Diff line change
@@ -36,9 +36,7 @@
}));

tileset.readyPromise.then(function() {
var boundingSphere = tileset.boundingSphere;
viewer.camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0.0, -0.5, boundingSphere.radius / 4.0));
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
viewer.zoomToTileset(tileset, new Cesium.HeadingPitchRange(0.0, -0.5, tileset.boundingSphere.radius / 4.0));
}).otherwise(function(error) {
throw(error);
});
Original file line number Diff line number Diff line change
@@ -37,9 +37,7 @@

// Move the camera to view the tileset on load.
tileset.readyPromise.then(function() {
var boundingSphere = tileset.boundingSphere;
viewer.camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0.0, -0.5, boundingSphere.radius));
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
viewer.zoomToTileset(tileset, new Cesium.HeadingPitchRange(0.0, -0.5, tileset.boundingSphere.radius));
}).otherwise(function(error) {
throw(error);
});
4 changes: 1 addition & 3 deletions Apps/Sandcastle/gallery/3D Tiles Photogrammetry.html
Original file line number Diff line number Diff line change
@@ -33,9 +33,7 @@
}));

tileset.readyPromise.then(function() {
var boundingSphere = tileset.boundingSphere;
viewer.camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0.0, -0.5, boundingSphere.radius));
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
viewer.zoomToTileset(tileset, new Cesium.HeadingPitchRange(0.0, -0.5, tileset.boundingSphere.radius));
}).otherwise(function(error) {
throw(error);
});
4 changes: 1 addition & 3 deletions Apps/Sandcastle/gallery/3D Tiles Point Cloud.html
Original file line number Diff line number Diff line change
@@ -34,9 +34,7 @@
}));

tileset.readyPromise.then(function() {
var boundingSphere = tileset.boundingSphere;
viewer.camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0.0, -0.5, boundingSphere.radius));
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
viewer.zoomToTileset(tileset, new Cesium.HeadingPitchRange(0.0, -0.5, tileset.boundingSphere.radius));
}).otherwise(function(error) {
throw(error);
});