-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Support for loading 3D Tiles via CZML and Entity API #8580
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
/Build | ||
/Cesium-*.zip | ||
/cesium-*.tgz | ||
.directory | ||
.DS_Store | ||
Thumbs.db | ||
.eslintcache | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"> | ||
<meta name="description" content="CZML Model"> | ||
<meta name="cesium-sandcastle-labels" content="CZML"> | ||
<title>Cesium Demo</title> | ||
<script type="text/javascript" src="../Sandcastle-header.js"></script> | ||
<script type="text/javascript" src="../../../Build/CesiumUnminified/Cesium.js" nomodule></script> | ||
<script type="module" src="../load-cesium-es6.js"></script> | ||
</head> | ||
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html"> | ||
<style> | ||
@import url(../templates/bucket.css); | ||
</style> | ||
<div id="cesiumContainer" class="fullSize"></div> | ||
<div id="loadingOverlay"><h1>Loading...</h1></div> | ||
<div id="toolbar"></div> | ||
|
||
<script id="cesium_sandcastle_script"> | ||
function startup(Cesium) { | ||
'use strict'; | ||
//Sandcastle_Begin | ||
var czml = [{ | ||
"id" : "document", | ||
"version" : "1.0" | ||
}, { | ||
"id" : "BatchedColors", | ||
"name" : "BatchedColors", | ||
"tileset": { | ||
"uri" : "../../SampleData/Cesium3DTiles/Batched/BatchedColors/tileset.json" | ||
} | ||
}]; | ||
|
||
var viewer = new Cesium.Viewer('cesiumContainer', { | ||
shouldAnimate : true | ||
}); | ||
|
||
var dataSourcePromise = viewer.dataSources.add(Cesium.CzmlDataSource.load(czml)); | ||
|
||
dataSourcePromise.then(function(dataSource){ | ||
viewer.flyTo(dataSource.entities.getById('BatchedColors')); | ||
}).otherwise(function(error){ | ||
window.alert(error); | ||
}); | ||
//Sandcastle_End | ||
Sandcastle.finishedLoading(); | ||
} | ||
if (typeof Cesium !== 'undefined') { | ||
window.startupCalled = true; | ||
startup(Cesium); | ||
} | ||
</script> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
import defaultValue from '../Core/defaultValue.js'; | ||
import defined from '../Core/defined.js'; | ||
import defineProperties from '../Core/defineProperties.js'; | ||
import DeveloperError from '../Core/DeveloperError.js'; | ||
import Event from '../Core/Event.js'; | ||
import createPropertyDescriptor from './createPropertyDescriptor.js'; | ||
|
||
/** | ||
* A 3D Tiles tileset represented by an {@link Entity}. | ||
* The tileset modelMatrix is determined by the containing Entity position and orientation | ||
* or is left unset if position is undefined. | ||
* | ||
* @alias Cesium3DTilesetGraphics | ||
* @constructor | ||
* | ||
* @param {Object} [options] Object with the following properties: | ||
* @param {Property} [options.show=true] A boolean Property specifying the visibility of the tileset. | ||
* @param {Property} [options.uri] A string or Resource Property specifying the URI of the tileset. | ||
* @param {Property} [options.maximumScreenSpaceError] A number or Property specifying the maximum screen space error used to drive level of detail refinement. | ||
*/ | ||
function Cesium3DTilesetGraphics(options) { | ||
this._definitionChanged = new Event(); | ||
this._show = undefined; | ||
this._showSubscription = undefined; | ||
this._uri = undefined; | ||
this._uriSubscription = undefined; | ||
this._maximumScreenSpaceError = undefined; | ||
this._maximumScreenSpaceErrorSubscription = undefined; | ||
|
||
this.merge(defaultValue(options, defaultValue.EMPTY_OBJECT)); | ||
} | ||
|
||
defineProperties(Cesium3DTilesetGraphics.prototype, { | ||
/** | ||
* Gets the event that is raised whenever a property or sub-property is changed or modified. | ||
* @memberof Cesium3DTilesetGraphics.prototype | ||
* @type {Event} | ||
* @readonly | ||
*/ | ||
definitionChanged: { | ||
get: function() { | ||
return this._definitionChanged; | ||
} | ||
}, | ||
|
||
/** | ||
* Gets or sets the boolean Property specifying the visibility of the model. | ||
* @memberof Cesium3DTilesetGraphics.prototype | ||
* @type {Property} | ||
* @default true | ||
*/ | ||
show: createPropertyDescriptor('show'), | ||
|
||
/** | ||
* Gets or sets the string Property specifying the URI of the glTF asset. | ||
* @memberof Cesium3DTilesetGraphics.prototype | ||
* @type {Property} | ||
*/ | ||
uri: createPropertyDescriptor('uri'), | ||
|
||
/** | ||
* Gets or sets the maximum screen space error used to drive level of detail refinement. | ||
* @memberof Cesium3DTilesetGraphics.prototype | ||
* @type {Property} | ||
*/ | ||
maximumScreenSpaceError: createPropertyDescriptor('maximumScreenSpaceError') | ||
}); | ||
|
||
/** | ||
* Duplicates this instance. | ||
* | ||
* @param {Cesium3DTilesetGraphics} [result] The object onto which to store the result. | ||
* @returns {Cesium3DTilesetGraphics} The modified result parameter or a new instance if one was not provided. | ||
*/ | ||
Cesium3DTilesetGraphics.prototype.clone = function(result) { | ||
if (!defined(result)) { | ||
return new Cesium3DTilesetGraphics(this); | ||
} | ||
result.show = this.show; | ||
result.uri = this.uri; | ||
result.maximumScreenSpaceError = this.maximumScreenSpaceError; | ||
|
||
return result; | ||
}; | ||
|
||
/** | ||
* Assigns each unassigned property on this object to the value | ||
* of the same property on the provided source object. | ||
* | ||
* @param {Cesium3DTilesetGraphics} source The object to be merged into this object. | ||
*/ | ||
Cesium3DTilesetGraphics.prototype.merge = function(source) { | ||
//>>includeStart('debug', pragmas.debug); | ||
if (!defined(source)) { | ||
throw new DeveloperError('source is required.'); | ||
} | ||
//>>includeEnd('debug'); | ||
|
||
this.show = defaultValue(this.show, source.show); | ||
this.uri = defaultValue(this.uri, source.uri); | ||
this.maximumScreenSpaceError = defaultValue(this.maximumScreenSpaceError, source.maximumScreenSpaceError); | ||
}; | ||
|
||
export default Cesium3DTilesetGraphics; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't refer to a glTF asset. Copy/paste error from ModelGraphics?