English中文

IonResource

new Cesium.IonResource(endpoint, endpointResource)

A Resource 封装Cesium ion资产访问的实例。该对象通常不直接实例化,使用 instance that encapsulates Cesium ion asset access. This object is normally not instantiated directly, use IonResource.fromAssetId.
名称 Name 类型 Type 说明 Description
endpoint object Cesium ion资产端点服务的结果。 The result of the Cesium ion asset endpoint service.
endpointResource Resource 用于检索端点的原始资源。 The original resource used to retrieve the endpoint.
另见: See:

继承 Extends

成员 Members

readonly credits : Array.<Credit>

获取资产归属所需的积分。 Gets the credits required for attribution of the asset.

readonly extension : string

资源的文件扩展名。 The file extension of the resource.
继承自: Inherited From:

hasHeaders : boolean

如果资源具有请求标头,则为 True。这相当于检查 headers 属性是否有任何键。 True if the Resource has request headers. This is equivalent to checking if the headers property has any keys.
继承自: Inherited From:
将随请求发送的附加 HTTP 标头。 Additional HTTP headers that will be sent with the request.
继承自: Inherited From:
如果资源引用 blob URI,则为 true。 True if the Resource refers to a blob URI.
继承自: Inherited From:

isCrossOriginUrl : boolean

如果资源引用跨源 URL,则为 true。 True if the Resource refers to a cross origin URL.
继承自: Inherited From:
如果资源引用数据 URI,则为 True。 True if the Resource refers to a data URI.
继承自: Inherited From:
加载资源时要使用的代理。 A proxy to be used when loading the resource.
继承自: Inherited From:

readonly queryParameters : object

附加到 url 的查询参数。 Query parameters appended to the url.
继承自: Inherited From:
将使用的 Request 对象。仅供内部使用。 A Request object that will be used. Intended for internal use only.
继承自: Inherited From:

retryAttempts : number

放弃之前应调用 retryCallback 的次数。 The number of times the retryCallback should be called before giving up.
继承自: Inherited From:

retryCallback : function

对此资源的请求失败时调用的函数。如果它返回 true 或解析为 true 的 Promise,则将重试该请求。 Function to call when a request for this resource fails. If it returns true or a Promise that resolves to true, the request will be retried.
继承自: Inherited From:

readonly templateValues : object

用于替换 url 中模板参数的键/值对。 The key/value pairs used to replace template parameters in the url.
继承自: Inherited From:
资源的 url,其中替换了模板值,附加了查询字符串,并由代理编码(如果已设置)。 The url to the resource with template values replaced, query string appended and encoded by proxy if one was set.
继承自: Inherited From:

方法 Methods

static Cesium.IonResource.fromAssetId(assetId, options)Promise.<IonResource>

异步创建实例。 Asynchronously creates an instance.
名称 Name 类型 Type 说明 Description
assetId number Cesium离子资产 ID。 The Cesium ion asset id.
options object 可选 optional 具有以下属性的对象: An object with the following properties:
名称 Name 类型 Type 默认值 Default 说明 Description
accessToken string Ion.defaultAccessToken 可选 optional 要使用的访问令牌。 The access token to use.
server string | Resource Ion.defaultServer 可选 optional Cesium ion API 服务器的资源。 The resource to the Cesium ion API server.
返回: Returns:
对代表Cesium离子资产的实例的 Promise。 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));
  });

appendForwardSlash()

将正斜杠附加到 URL。 Appends a forward slash to the URL.
继承自: Inherited From:

appendQueryParameters(params)

组合指定的对象和现有的查询参数。这允许您一次添加多个参数,而不是一次将一个参数添加到 queryParameters 属性。 Combines the specified object and the existing query parameters. This allows you to add many parameters at once, as opposed to adding them one at a time to the queryParameters property.
名称 Name 类型 Type 说明 Description
params object 查询参数 The query parameters
继承自: Inherited From:
Duplicates a Resource instance.
名称 Name 类型 Type 说明 Description
result Resource 可选 optional 用于存储结果的对象。 The object onto which to store the result.
返回: Returns:
修改后的结果参数或新的资源实例(如果未提供)。 The modified result parameter or a new Resource instance if one was not provided.
继承自: Inherited From:

delete(options)Promise.<any>|undefined

异步删除给定资源。返回一个承诺,该承诺将在加载后解决结果,或者如果资源加载失败则拒绝。数据使用 XMLHttpRequest 加载,这意味着为了向另一个源发出请求,服务器必须启用跨源资源共享 (CORS) 标头。 Asynchronously deletes the given resource. Returns a promise that will resolve to the result once loaded, or reject if the resource failed to load. The data is loaded using XMLHttpRequest, which means that in order to make requests to another origin, the server must have Cross-Origin Resource Sharing (CORS) headers enabled.
名称 Name 类型 Type 说明 Description
options object 可选 optional 具有以下属性的对象: Object with the following properties:
名称 Name 类型 Type 说明 Description
responseType string 可选 optional 响应类型。这控制返回的项目的类型。 The type of response. This controls the type of item returned.
headers object 可选 optional 与请求一起发送的其他 HTTP 标头(如果有)。 Additional HTTP headers to send with the request, if any.
overrideMimeType string 可选 optional 覆盖服务器返回的 MIME 类型。 Overrides the MIME type returned by the server.
返回: Returns:
加载时将解析为请求的数据的承诺。 Returns undefined if a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle 为 true,并且该请求没有足够高的优先级。 is true and the request does not have high enough priority.
继承自: Inherited From:
示例: Example:
resource.delete()
  .then(function(body) {
      // use the data
  }).catch(function(error) {
      // an error occurred
  });
另见: See:

fetch(options)Promise.<any>|undefined

异步加载给定资源。返回一个承诺,该承诺将在加载后解决结果,或者如果资源加载失败则拒绝。数据使用 XMLHttpRequest 加载,这意味着为了向另一个源发出请求,服务器必须启用跨源资源共享 (CORS) 标头。建议您使用更具体的功能,例如。 fetchJson、fetchBlob 等 Asynchronously loads the given resource. Returns a promise that will resolve to the result once loaded, or reject if the resource failed to load. The data is loaded using XMLHttpRequest, which means that in order to make requests to another origin, the server must have Cross-Origin Resource Sharing (CORS) headers enabled. It's recommended that you use the more specific functions eg. fetchJson, fetchBlob, etc.
名称 Name 类型 Type 说明 Description
options object 可选 optional 具有以下属性的对象: Object with the following properties:
名称 Name 类型 Type 说明 Description
responseType string 可选 optional 响应类型。这控制返回的项目的类型。 The type of response. This controls the type of item returned.
headers object 可选 optional 与请求一起发送的其他 HTTP 标头(如果有)。 Additional HTTP headers to send with the request, if any.
overrideMimeType string 可选 optional 覆盖服务器返回的 MIME 类型。 Overrides the MIME type returned by the server.
返回: Returns:
加载时将解析为请求的数据的承诺。 Returns undefined if a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle 为 true,并且该请求没有足够高的优先级。 is true and the request does not have high enough priority.
继承自: Inherited From:
示例: Example:
resource.fetch()
  .then(function(body) {
      // use the data
  }).catch(function(error) {
      // an error occurred
  });
另见: See:

fetchArrayBuffer()Promise.<ArrayBuffer>|undefined

将资源作为原始二进制数据异步加载。返回一个承诺,一旦加载,该承诺将解析为 ArrayBuffer;如果资源加载失败,则返回一个拒绝。数据使用 XMLHttpRequest 加载,这意味着为了向另一个源发出请求,服务器必须启用跨源资源共享 (CORS) 标头。 Asynchronously loads the resource as raw binary data. Returns a promise that will resolve to an ArrayBuffer once loaded, or reject if the resource failed to load. The data is loaded using XMLHttpRequest, which means that in order to make requests to another origin, the server must have Cross-Origin Resource Sharing (CORS) headers enabled.
返回: Returns:
加载时将解析为请求的数据的承诺。 Returns undefined if a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle 为 true,并且该请求没有足够高的优先级。 is true and the request does not have high enough priority.
继承自: Inherited From:
示例: Example:
// load a single URL asynchronously
resource.fetchArrayBuffer().then(function(arrayBuffer) {
    // use the data
}).catch(function(error) {
    // an error occurred
});
另见: See:

fetchBlob()Promise.<Blob>|undefined

将给定资源作为 blob 异步加载。返回一个承诺,一旦加载,该承诺将解析为 Blob;如果资源加载失败,则返回拒绝。数据使用 XMLHttpRequest 加载,这意味着为了向另一个源发出请求,服务器必须启用跨源资源共享 (CORS) 标头。 Asynchronously loads the given resource as a blob. Returns a promise that will resolve to a Blob once loaded, or reject if the resource failed to load. The data is loaded using XMLHttpRequest, which means that in order to make requests to another origin, the server must have Cross-Origin Resource Sharing (CORS) headers enabled.
返回: Returns:
加载时将解析为请求的数据的承诺。 Returns undefined if a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle 为 true,并且该请求没有足够高的优先级。 is true and the request does not have high enough priority.
继承自: Inherited From:
示例: Example:
// load a single URL asynchronously
resource.fetchBlob().then(function(blob) {
    // use the data
}).catch(function(error) {
    // an error occurred
});
另见: See:

fetchImage(options)Promise.<(ImageBitmap|HTMLImageElement)>|undefined

异步加载给定的图像资源。返回一个将解决的承诺 Asynchronously loads the given image resource. Returns a promise that will resolve to an ImageBitmap if preferImageBitmap 是 true 并且浏览器支持 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 具有以下属性的对象。 An object with the following properties.
名称 Name 类型 Type 默认值 Default 说明 Description
preferBlob boolean false 可选 optional 如果为 true,我们将通过 blob 加载图像。 If true, we will load the image via a blob.
preferImageBitmap boolean false 可选 optional 如果为 true,则图像将在获取期间被解码,并且 If true, image will be decoded during fetch and an ImageBitmap 被返回。 is returned.
flipY boolean false 可选 optional 如果为 true,则图像将在解码期间垂直翻转。仅当浏览器支持时才适用 If true, image will be vertically flipped during decode. Only applies if the browser supports createImageBitmap.
skipColorSpaceConversion boolean false 可选 optional 如果为 true,则图像中的任何自定义伽马或颜色配置文件都将被忽略。仅当浏览器支持时才适用 If true, any custom gamma or color profiles in the image will be ignored. Only applies if the browser supports createImageBitmap.
返回: Returns:
加载时将解析为请求的数据的承诺。 Returns undefined if a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle 为 true,并且该请求没有足够高的优先级。 is true and the request does not have high enough priority.
继承自: 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:

fetchJson()Promise.<any>|undefined

以 JSON 形式异步加载给定资源。返回一个承诺,一旦加载,该承诺将解析为 JSON 对象,如果资源加载失败,则拒绝。数据使用 XMLHttpRequest 加载,这意味着为了向另一个源发出请求,服务器必须启用跨源资源共享 (CORS) 标头。如果尚未指定,此函数会将“Accept: application/json,*/*;q=0.01”添加到请求标头中。 Asynchronously loads the given resource as JSON. Returns a promise that will resolve to a JSON object once loaded, or reject if the resource failed to load. The data is loaded using XMLHttpRequest, which means that in order to make requests to another origin, the server must have Cross-Origin Resource Sharing (CORS) headers enabled. This function adds 'Accept: application/json,&#42;&#47;&#42;;q=0.01' to the request headers, if not already specified.
返回: Returns:
加载时将解析为请求的数据的承诺。 Returns undefined if a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle 为 true,并且该请求没有足够高的优先级。 is true and the request does not have high enough priority.
继承自: Inherited From:
示例: Example:
resource.fetchJson().then(function(jsonData) {
    // Do something with the JSON object
}).catch(function(error) {
    // an error occurred
});
另见: See:

fetchJsonp(callbackParameterName)Promise.<any>|undefined

使用 JSONP 请求资源。 Requests a resource using JSONP.
名称 Name 类型 Type 默认值 Default 说明 Description
callbackParameterName string 'callback' 可选 optional 服务器期望的回调参数名称。 The callback parameter name that the server expects.
返回: Returns:
加载时将解析为请求的数据的承诺。 Returns undefined if a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle 为 true,并且该请求没有足够高的优先级。 is true and the request does not have high enough priority.
继承自: Inherited From:
示例: Example:
// load a data asynchronously
resource.fetchJsonp().then(function(data) {
    // use the loaded data
}).catch(function(error) {
    // an error occurred
});
另见: See:

fetchText()Promise.<string>|undefined

以文本形式异步加载给定资源。返回一个承诺,一旦加载,该承诺将解析为字符串,如果资源加载失败,则拒绝。数据使用 XMLHttpRequest 加载,这意味着为了向另一个源发出请求,服务器必须启用跨源资源共享 (CORS) 标头。 Asynchronously loads the given resource as text. Returns a promise that will resolve to a String once loaded, or reject if the resource failed to load. The data is loaded using XMLHttpRequest, which means that in order to make requests to another origin, the server must have Cross-Origin Resource Sharing (CORS) headers enabled.
返回: Returns:
加载时将解析为请求的数据的承诺。 Returns undefined if a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle 为 true,并且该请求没有足够高的优先级。 is true and the request does not have high enough priority.
继承自: 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:

fetchXML()Promise.<XMLDocument>|undefined

以 XML 形式异步加载给定资源。返回一个承诺,一旦加载,该承诺将解析为 XML 文档,如果资源加载失败,则拒绝。数据使用 XMLHttpRequest 加载,这意味着为了向另一个源发出请求,服务器必须启用跨源资源共享 (CORS) 标头。 Asynchronously loads the given resource as XML. Returns a promise that will resolve to an XML Document once loaded, or reject if the resource failed to load. The data is loaded using XMLHttpRequest, which means that in order to make requests to another origin, the server must have Cross-Origin Resource Sharing (CORS) headers enabled.
返回: Returns:
加载时将解析为请求的数据的承诺。 Returns undefined if a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle 为 true,并且该请求没有足够高的优先级。 is true and the request does not have high enough priority.
继承自: 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:

getBaseUri(includeQuery)string

返回资源的基本路径。 Returns the base path of the Resource.
名称 Name 类型 Type 默认值 Default 说明 Description
includeQuery boolean false 可选 optional 是否包含 uri 中的查询字符串和片段 Whether or not to include the query string and fragment form the uri
返回: Returns:
资源的基本 URI The base URI of the resource
继承自: Inherited From:

getDerivedResource(options)Resource

返回相对于当前实例的资源。除非在选项中覆盖,否则所有属性都与当前实例相同。 Returns a resource relative to the current instance. All properties remain the same as the current instance unless overridden in options.
名称 Name 类型 Type 说明 Description
options object 具有以下属性的对象 An object with the following properties
名称 Name 类型 Type 默认值 Default 说明 Description
url string 可选 optional 将相对于当前实例的 url 进行解析的 url。 The url that will be resolved relative to the url of the current instance.
queryParameters object 可选 optional 包含查询参数的对象,这些参数将与当前实例的查询参数相结合。 An object containing query parameters that will be combined with those of the current instance.
templateValues object 可选 optional 用于替换模板值的键/值对(例如 {x})。这些将与当前实例的那些相结合。 Key/Value pairs that are used to replace template values (eg. {x}). These will be combined with those of the current instance.
headers object {} 可选 optional 将发送的附加 HTTP 标头。 Additional HTTP headers that will be sent.
proxy Proxy 可选 optional 加载资源时要使用的代理。 A proxy to be used when loading the resource.
retryCallback Resource.RetryCallback 可选 optional 加载资源失败时调用的函数。 The function to call when loading the resource fails.
retryAttempts number 可选 optional 放弃之前应调用 retryCallback 的次数。 The number of times the retryCallback should be called before giving up.
request Request 可选 optional 将使用的 Request 对象。仅供内部使用。 A Request object that will be used. Intended for internal use only.
preserveQueryParameters boolean false 可选 optional 如果为 true,这将保留当前资源和派生资源中的所有查询参数。如果为 false,派生参数将替换当前资源的参数。 If true, this will keep all query parameters from the current resource and derived resource. If false, derived parameters will replace those of the current resource.
返回: Returns:
从当前资源派生的资源。 The resource derived from the current one.
继承自: Inherited From:

getUrlComponent(query, proxy)string

返回 url,可选带有查询字符串并由代理处理。 Returns the url, optional with the query string and processed by a proxy.
名称 Name 类型 Type 默认值 Default 说明 Description
query boolean false 可选 optional 如果为 true,则包含查询字符串。 If true, the query string is included.
proxy boolean false 可选 optional 如果为 true,则 url 将由代理对象(如果已定义)处理。 If true, the url is processed by the proxy object, if defined.
返回: Returns:
包含所有请求组件的 url。 The url with all the requested components.
继承自: Inherited From:
异步获取给定资源的标头。返回一个承诺,该承诺将在加载后解决结果,或者如果资源加载失败则拒绝。数据使用 XMLHttpRequest 加载,这意味着为了向另一个源发出请求,服务器必须启用跨源资源共享 (CORS) 标头。 Asynchronously gets headers the given resource. Returns a promise that will resolve to the result once loaded, or reject if the resource failed to load. The data is loaded using XMLHttpRequest, which means that in order to make requests to another origin, the server must have Cross-Origin Resource Sharing (CORS) headers enabled.
名称 Name 类型 Type 说明 Description
options object 可选 optional 具有以下属性的对象: Object with the following properties:
名称 Name 类型 Type 说明 Description
responseType string 可选 optional 响应类型。这控制返回的项目的类型。 The type of response. This controls the type of item returned.
headers object 可选 optional 与请求一起发送的其他 HTTP 标头(如果有)。 Additional HTTP headers to send with the request, if any.
overrideMimeType string 可选 optional 覆盖服务器返回的 MIME 类型。 Overrides the MIME type returned by the server.
返回: Returns:
加载时将解析为请求的数据的承诺。 Returns undefined if a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle 为 true,并且该请求没有足够高的优先级。 is true and the request does not have high enough priority.
继承自: Inherited From:
示例: Example:
resource.head()
  .then(function(headers) {
      // use the data
  }).catch(function(error) {
      // an error occurred
  });
另见: See:

options(options)Promise.<any>|undefined

异步获取给定资源的选项。返回一个承诺,该承诺将在加载后解决结果,或者如果资源加载失败则拒绝。数据使用 XMLHttpRequest 加载,这意味着为了向另一个源发出请求,服务器必须启用跨源资源共享 (CORS) 标头。 Asynchronously gets options the given resource. Returns a promise that will resolve to the result once loaded, or reject if the resource failed to load. The data is loaded using XMLHttpRequest, which means that in order to make requests to another origin, the server must have Cross-Origin Resource Sharing (CORS) headers enabled.
名称 Name 类型 Type 说明 Description
options object 可选 optional 具有以下属性的对象: Object with the following properties:
名称 Name 类型 Type 说明 Description
responseType string 可选 optional 响应类型。这控制返回的项目的类型。 The type of response. This controls the type of item returned.
headers object 可选 optional 与请求一起发送的其他 HTTP 标头(如果有)。 Additional HTTP headers to send with the request, if any.
overrideMimeType string 可选 optional 覆盖服务器返回的 MIME 类型。 Overrides the MIME type returned by the server.
返回: Returns:
加载时将解析为请求的数据的承诺。 Returns undefined if a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle 为 true,并且该请求没有足够高的优先级。 is true and the request does not have high enough priority.
继承自: Inherited From:
示例: Example:
resource.options()
  .then(function(headers) {
      // use the data
  }).catch(function(error) {
      // an error occurred
  });
另见: See:

patch(data, options)Promise.<any>|undefined

将数据异步修补到给定资源。返回一个承诺,该承诺将在加载后解决结果,或者如果资源加载失败则拒绝。数据使用 XMLHttpRequest 加载,这意味着为了向另一个源发出请求,服务器必须启用跨源资源共享 (CORS) 标头。 Asynchronously patches data to the given resource. Returns a promise that will resolve to the result once loaded, or reject if the resource failed to load. The data is loaded using XMLHttpRequest, which means that in order to make requests to another origin, the server must have Cross-Origin Resource Sharing (CORS) headers enabled.
名称 Name 类型 Type 说明 Description
data object 随资源发布的数据。 Data that is posted with the resource.
options object 可选 optional 具有以下属性的对象: Object with the following properties:
名称 Name 类型 Type 说明 Description
responseType string 可选 optional 响应类型。这控制返回的项目的类型。 The type of response. This controls the type of item returned.
headers object 可选 optional 与请求一起发送的其他 HTTP 标头(如果有)。 Additional HTTP headers to send with the request, if any.
overrideMimeType string 可选 optional 覆盖服务器返回的 MIME 类型。 Overrides the MIME type returned by the server.
返回: Returns:
加载时将解析为请求的数据的承诺。 Returns undefined if a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle 为 true,并且该请求没有足够高的优先级。 is true and the request does not have high enough priority.
继承自: Inherited From:
示例: Example:
resource.patch(data)
  .then(function(result) {
      // use the result
  }).catch(function(error) {
      // an error occurred
  });
另见: See:

post(data, options)Promise.<any>|undefined

将数据异步发布到给定资源。返回一个承诺,该承诺将在加载后解决结果,或者如果资源加载失败则拒绝。数据使用 XMLHttpRequest 加载,这意味着为了向另一个源发出请求,服务器必须启用跨源资源共享 (CORS) 标头。 Asynchronously posts data to the given resource. Returns a promise that will resolve to the result once loaded, or reject if the resource failed to load. The data is loaded using XMLHttpRequest, which means that in order to make requests to another origin, the server must have Cross-Origin Resource Sharing (CORS) headers enabled.
名称 Name 类型 Type 说明 Description
data object 随资源发布的数据。 Data that is posted with the resource.
options object 可选 optional 具有以下属性的对象: Object with the following properties:
名称 Name 类型 Type 说明 Description
data object 可选 optional 随资源发布的数据。 Data that is posted with the resource.
responseType string 可选 optional 响应类型。这控制返回的项目的类型。 The type of response. This controls the type of item returned.
headers object 可选 optional 与请求一起发送的其他 HTTP 标头(如果有)。 Additional HTTP headers to send with the request, if any.
overrideMimeType string 可选 optional 覆盖服务器返回的 MIME 类型。 Overrides the MIME type returned by the server.
返回: Returns:
加载时将解析为请求的数据的承诺。 Returns undefined if a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle 为 true,并且该请求没有足够高的优先级。 is true and the request does not have high enough priority.
继承自: Inherited From:
示例: Example:
resource.post(data)
  .then(function(result) {
      // use the result
  }).catch(function(error) {
      // an error occurred
  });
另见: See:

put(data, options)Promise.<any>|undefined

异步将数据放入给定资源。返回一个承诺,该承诺将在加载后解决结果,或者如果资源加载失败则拒绝。数据使用 XMLHttpRequest 加载,这意味着为了向另一个源发出请求,服务器必须启用跨源资源共享 (CORS) 标头。 Asynchronously puts data to the given resource. Returns a promise that will resolve to the result once loaded, or reject if the resource failed to load. The data is loaded using XMLHttpRequest, which means that in order to make requests to another origin, the server must have Cross-Origin Resource Sharing (CORS) headers enabled.
名称 Name 类型 Type 说明 Description
data object 随资源发布的数据。 Data that is posted with the resource.
options object 可选 optional 具有以下属性的对象: Object with the following properties:
名称 Name 类型 Type 说明 Description
responseType string 可选 optional 响应类型。这控制返回的项目的类型。 The type of response. This controls the type of item returned.
headers object 可选 optional 与请求一起发送的其他 HTTP 标头(如果有)。 Additional HTTP headers to send with the request, if any.
overrideMimeType string 可选 optional 覆盖服务器返回的 MIME 类型。 Overrides the MIME type returned by the server.
返回: Returns:
加载时将解析为请求的数据的承诺。 Returns undefined if a promise that will resolve to the requested data when loaded. Returns undefined if request.throttle 为 true,并且该请求没有足够高的优先级。 is true and the request does not have high enough priority.
继承自: Inherited From:
示例: Example:
resource.put(data)
  .then(function(result) {
      // use the result
  }).catch(function(error) {
      // an error occurred
  });
另见: See:

setQueryParameters(params, useAsDefault)

组合指定的对象和现有的查询参数。这允许您一次添加多个参数,而不是一次将一个参数添加到 queryParameters 属性。如果已经设置了一个值,它将被新值替换。 Combines the specified object and the existing query parameters. This allows you to add many parameters at once, as opposed to adding them one at a time to the queryParameters property. If a value is already set, it will be replaced with the new value.
名称 Name 类型 Type 默认值 Default 说明 Description
params object 查询参数 The query parameters
useAsDefault boolean false 可选 optional 如果为 true,则参数将用作默认值,因此只有在未定义时才会设置它们。 If true the params will be used as the default values, so they will only be set if they are undefined.
继承自: Inherited From:

setTemplateValues(template, useAsDefault)

组合指定的对象和现有模板值。这允许您一次添加多个值,而不是一次将它们添加到 templateValues 属性中。如果已经设置了一个值,它将成为一个数组,并附加新值。 Combines the specified object and the existing template values. This allows you to add many values at once, as opposed to adding them one at a time to the templateValues property. If a value is already set, it will become an array and the new value will be appended.
名称 Name 类型 Type 默认值 Default 说明 Description
template object 模板值 The template values
useAsDefault boolean false 可选 optional 如果为 true,这些值将用作默认值,因此只有在未定义时才会设置它们。 If true the values will be used as the default values, so they will only be set if they are undefined.
继承自: Inherited From:

toString()string

重写 Object#toString 以便隐式字符串转换给出此资源表示的完整 URL。 Override Object#toString so that implicit string conversion gives the complete URL represented by this Resource.
返回: Returns:
该资源表示的 URL The URL represented by this Resource
继承自: Inherited From:
需要帮助吗?获得答案的最快方法是从社区和团队那里获得答案 Need help? The fastest way to get answers is from the community and team on the Cesium Forum.