A
Resource instance that encapsulates Cesium ion asset access.
此天体通常不直接即时化,使用 IonResource.fromAssetId .
| Name | Type | Description |
|---|---|---|
endpoint |
object | The result of the Cesium ion asset endpoint service. |
endpointResource |
Resource | 原始资源用于检索端点. |
- Ion
- IonImageryProvider
- createWorldTerrain
- https://cesium.com
See:
Extends
Members
readonly credits : Array.<Credit>
获得资产归属所需的信用.
资源的文件扩展名 .
- Inherited From:
如果资源有请求信头, 则为真 。 这相当于检查信头属性是否有密钥 .
- Inherited From:
Additional HTTP headers that will be sent with the request.
- Inherited From:
True if the Resource refers to a blob URI.
- Inherited From:
如果资源指的是一个交叉来源 URL .
- Inherited From:
True if the Resource refers to a data URI.
- Inherited From:
proxy : Proxy
装入资源时要使用的代理 .
- Inherited From:
Url 所附查询参数.
- Inherited From:
request : Request
将使用的请求对象。 仅供内部使用.
- Inherited From:
重试Callback在放弃前应该呼叫的次数.
- Inherited From:
当请求此资源失败时调用函数 。 如果它返回真,或者一个 Promise 确定为真,则请求会被重审.
- Inherited From:
URL中用于替换模板参数的密钥/值对.
- Inherited From:
使用模板值替换的 URL 到资源, 查询字符串 附加, 如果设置了 .
- Inherited From:
Methods
static Cesium.IonResource.fromAssetId(assetId, options) → Promise.<IonResource>
同步生成一个实例.
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
assetId |
number | The Cesium ion asset id. | ||||||||||||
options |
object |
optional
具有下列属性的天体:
|
Returns:
A Promise to an instance representing the Cesium ion Asset.
Examples:
// Load a Cesium3DTileset with asset ID of 124624234
try {
const resource = await Cesium.IonResource.fromAssetId(124624234);
const tileset = await Cesium.Cesium3DTileset.fromUrl(resource);
scene.primitives.add(tileset);
} catch (error) {
console.error(`Error creating tileset: ${error}`);
}
//Load a CZML file with asset ID of 10890
Cesium.IonResource.fromAssetId(10890)
.then(function (resource) {
viewer.dataSources.add(Cesium.CzmlDataSource.load(resource));
});
Appends a forward slash to the URL.
- Inherited From:
合并指定的对象和现有的查询参数。 这使得您可以同时添加许多参数,
而不是在查询Parameters 属性中一次添加一个.
| Name | Type | Description |
|---|---|---|
params |
object | 查询参数 |
- Inherited From:
clone(result) → Resource
复制资源实例.
| Name | Type | Description |
|---|---|---|
result |
Resource | optional 存储结果的对象 . |
Returns:
未提供修改的结果参数或新资源实例 .
- Inherited From:
同步删除给定的资源。 返回一个承诺,决心
生成结果,或者如果资源未加载,则拒绝。 数据已装入
使用 XMLHttp 请求,这意味着为了向另一个来源提出请求,
服务器必须启用 Cross-Origin 资源共享( CORS ) 信头 .
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
optional
下列属性的对象 :
|
Returns:
承诺在装入时将解决所要求的数据。 如果 NT%% 2 是真的, 且请求没有足够优先级, 返回未定义 .
- Inherited From:
Example:
resource.delete()
.then(function(body) {
// use the data
}).catch(function(error) {
// an error occurred
});
See:
同步加载给定资源 。 返回一个承诺,决心
生成结果,或者如果资源未加载,则拒绝。 数据已装入
使用 XMLHttp 请求,这意味着为了向另一个来源提出请求,
服务器必须启用 Cross-Origin 资源共享( CORS ) 信头 。 建议您使用
更具体的函数,例如抓Json、抓Blob等.
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
optional
下列属性的对象 :
|
Returns:
承诺在装入时将解决所要求的数据。 如果 NT%% 2 是真的, 且请求没有足够优先级, 返回未定义 .
- Inherited From:
Example:
resource.fetch()
.then(function(body) {
// use the data
}).catch(function(error) {
// an error occurred
});
See:
同步加载资源为原始二进制数据. 返回一个承诺,决心
a 矩阵缓冲器已装入,如果资源未装入,则拒绝。 数据已装入
使用 XMLHttp 请求,这意味着为了向另一个来源提出请求,
服务器必须启用 Cross-Origin 资源共享( CORS ) 信头 .
Returns:
承诺在装入时将解决所要求的数据。 如果 NT%% 2 是真的, 且请求没有足够优先级, 返回未定义 .
- Inherited From:
Example:
// load a single URL asynchronously
resource.fetchArrayBuffer().then(function(arrayBuffer) {
// use the data
}).catch(function(error) {
// an error occurred
});
See:
同步加载给定的资源为 blob 。 返回一个承诺,决心
a Blob 已装入,如果资源未装入,则拒绝。 数据已装入
使用 XMLHttp 请求,这意味着为了向另一个来源提出请求,
服务器必须启用 Cross-Origin 资源共享( CORS ) 信头 .
Returns:
承诺在装入时将解决所要求的数据。 如果 NT%% 2 是真的, 且请求没有足够优先级, 返回未定义 .
- Inherited From:
Example:
// load a single URL asynchronously
resource.fetchBlob().then(function(blob) {
// use the data
}).catch(function(error) {
// an error occurred
});
See:
同步加载给定的图像资源 。 返回一个承诺,决心
an ImageBitmap if
preferImageBitmap is true and the browser supports createImageBitmap or otherwise an
Image once loaded, or reject if the image failed to load.
| Name | Type | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
optional
具有下列属性的对象.
|
Returns:
承诺在装入时将解决所要求的数据。 如果 NT%% 2 是真的, 且请求没有足够优先级, 返回未定义 .
- Inherited From:
Example:
// load a single image asynchronously
resource.fetchImage().then(function(image) {
// use the loaded image
}).catch(function(error) {
// an error occurred
});
// load several images in parallel
Promise.all([resource1.fetchImage(), resource2.fetchImage()]).then(function(images) {
// images is an array containing all the loaded images
});
See:
同步加载给定资源为 JSON . 返回承诺,决心
a JSON object once loaded, or reject if the resource failed to load. The data is loaded
使用 XMLHttp 请求,这意味着为了向另一个来源提出请求,
the server must have Cross-Origin Resource Sharing (CORS) headers enabled. This function
adds 'Accept: application/json,*/*;q=0.01' to the request headers, if not
already specified.
Returns:
承诺在装入时将解决所要求的数据。 如果 NT%% 2 是真的, 且请求没有足够优先级, 返回未定义 .
- Inherited From:
Example:
resource.fetchJson().then(function(jsonData) {
// Do something with the JSON object
}).catch(function(error) {
// an error occurred
});
See:
请使用 NT 0 请求资源 .
| Name | Type | Default | Description |
|---|---|---|---|
callbackParameterName |
string |
'召回'
|
optional 服务器所期望的召回参数名称 . |
Returns:
承诺在装入时将解决所要求的数据。 如果 NT%% 2 是真的, 且请求没有足够优先级, 返回未定义 .
- Inherited From:
Example:
// load a data asynchronously
resource.fetchJsonp().then(function(data) {
// use the loaded data
}).catch(function(error) {
// an error occurred
});
See:
同步加载给定的资源为文本 。 返回一个承诺,决心
a 字符串已装入,如果资源未装入,则拒绝。 数据已装入
使用 XMLHttp 请求,这意味着为了向另一个来源提出请求,
服务器必须启用 Cross-Origin 资源共享( CORS ) 信头 .
Returns:
承诺在装入时将解决所要求的数据。 如果 NT%% 2 是真的, 且请求没有足够优先级, 返回未定义 .
- Inherited From:
Example:
// load text from a URL, setting a custom header
const resource = new Resource({
url: 'http://someUrl.com/someJson.txt',
headers: {
'X-Custom-Header' : 'some value'
}
});
resource.fetchText().then(function(text) {
// Do something with the text
}).catch(function(error) {
// an error occurred
});
See:
同步加载给定资源为 XML . 返回承诺,决心
an XML Document once loaded, or reject if the resource failed to load. The data is loaded
使用 XMLHttp 请求,这意味着为了向另一个来源提出请求,
服务器必须启用 Cross-Origin 资源共享( CORS ) 信头 .
Returns:
承诺在装入时将解决所要求的数据。 如果 NT%% 2 是真的, 且请求没有足够优先级, 返回未定义 .
- Inherited From:
Example:
// load XML from a URL, setting a custom header
Cesium.loadXML('http://someUrl.com/someXML.xml', {
'X-Custom-Header' : 'some value'
}).then(function(document) {
// Do something with the document
}).catch(function(error) {
// an error occurred
});
See:
返回资源的基础路径.
| Name | Type | Default | Description |
|---|---|---|---|
includeQuery |
boolean |
虚假
|
optional 是否包含查询字符串和片段构成uri |
Returns:
资源基数 NT% 0
- Inherited From:
getDerivedResource(options) → Resource
返回相对于当前实例的资源。 所有属性都与当前实例相同,除非选项被推翻.
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
具有下列属性的对象
|
Returns:
资源来源于当前版本.
- Inherited From:
返回 URL,可选择的查询字符串,并由代理处理.
| Name | Type | Default | Description |
|---|---|---|---|
query |
boolean |
false
|
optional If true, the query string is included. |
proxy |
boolean |
false
|
optional If true, the url is processed by the proxy object, if defined. |
Returns:
包含所有请求组件的url.
- Inherited From:
同步获得给定的资源头 。 返回一个承诺,决心
生成结果,或者如果资源未加载,则拒绝。 数据已装入
使用 XMLHttp 请求,这意味着为了向另一个来源提出请求,
服务器必须启用 Cross-Origin 资源共享( CORS ) 信头 .
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
optional
下列属性的对象 :
|
Returns:
承诺在装入时将解决所要求的数据。 如果 NT%% 2 是真的, 且请求没有足够优先级, 返回未定义 .
- Inherited From:
Example:
resource.head()
.then(function(headers) {
// use the data
}).catch(function(error) {
// an error occurred
});
See:
同步获得给定的资源选项 。 返回一个承诺,决心
生成结果,或者如果资源未加载,则拒绝。 数据已装入
使用 XMLHttp 请求,这意味着为了向另一个来源提出请求,
服务器必须启用 Cross-Origin 资源共享( CORS ) 信头 .
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
optional
下列属性的对象 :
|
Returns:
承诺在装入时将解决所要求的数据。 如果 NT%% 2 是真的, 且请求没有足够优先级, 返回未定义 .
- Inherited From:
Example:
resource.options()
.then(function(headers) {
// use the data
}).catch(function(error) {
// an error occurred
});
See:
同步补丁给定资源的数据 。 返回一个承诺,决心
生成结果,或者如果资源未加载,则拒绝。 数据已装入
使用 XMLHttp 请求,这意味着为了向另一个来源提出请求,
服务器必须启用 Cross-Origin 资源共享( CORS ) 信头 .
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data |
object | 与资源一起发布的数据 . | ||||||||||||
options |
object |
optional
下列属性的对象 :
|
Returns:
承诺在装入时将解决所要求的数据。 如果 NT%% 2 是真的, 且请求没有足够优先级, 返回未定义 .
- Inherited From:
Example:
resource.patch(data)
.then(function(result) {
// use the result
}).catch(function(error) {
// an error occurred
});
See:
同步向给定资源发送数据 。 返回一个承诺,决心
生成结果,或者如果资源未加载,则拒绝。 数据已装入
使用 XMLHttp 请求,这意味着为了向另一个来源提出请求,
服务器必须启用 Cross-Origin 资源共享( CORS ) 信头 .
| Name | Type | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data |
object | 与资源一起发布的数据 . | |||||||||||||||
options |
object |
optional
下列属性的对象 :
|
Returns:
承诺在装入时将解决所要求的数据。 如果 NT%% 2 是真的, 且请求没有足够优先级, 返回未定义 .
- Inherited From:
Example:
resource.post(data)
.then(function(result) {
// use the result
}).catch(function(error) {
// an error occurred
});
See:
同步将数据输入给定资源 。 返回一个承诺,决心
生成结果,或者如果资源未加载,则拒绝。 数据已装入
使用 XMLHttp 请求,这意味着为了向另一个来源提出请求,
服务器必须启用 Cross-Origin 资源共享( CORS ) 信头 .
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data |
object | 与资源一起发布的数据 . | ||||||||||||
options |
object |
optional
下列属性的对象 :
|
Returns:
承诺在装入时将解决所要求的数据。 如果 NT%% 2 是真的, 且请求没有足够优先级, 返回未定义 .
- Inherited From:
Example:
resource.put(data)
.then(function(result) {
// use the result
}).catch(function(error) {
// an error occurred
});
See:
合并指定的对象和现有的查询参数。 这使得您可以同时添加许多参数,
而不是在查询Parameters 属性中一次添加一个。 如果一个值已经设置, 它将被替换为新值 .
| Name | Type | Default | Description |
|---|---|---|---|
params |
object | 查询参数 | |
useAsDefault |
boolean |
false
|
optional If true the params will be used as the default values, so they will only be set if they are undefined. |
- Inherited From:
合并指定的对象和现有的模板值。 这使得您可以同时添加许多值,
而不是将它们一次添加到模板Values属性中。 如果一个值已经设定,它将成为数组,并将附加新的值.
| Name | Type | Default | Description |
|---|---|---|---|
template |
object | 模板值 | |
useAsDefault |
boolean |
false
|
optional If true the values will be used as the default values, so they will only be set if they are undefined. |
- Inherited From:
覆盖对象 # to String , 以使隐性字符串转换给出
complete URL represented by this Resource.
Returns:
The URL represented by this Resource
- Inherited From: