new Cesium.Resource(options)
        
      
    
      资源,包括位置和我们需要检索它或创建派生资源的任何其他参数。它还提供了重试请求的能力。
    
    | Name | Type | Description | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | String | Object | 具有以下属性的url或对象: 
 | 
示例:
      function refreshTokenRetryCallback(resource, error) {
  if (error.statusCode === 403) {
    // 403 status code means a new token should be generated
    return getNewAccessToken()
      .then(function(token) {
        resource.queryParameters.access_token = token;
        return true;
      })
      .otherwise(function() {
        return false;
      });
  }
  return false;
}
var resource = new Resource({
   url: 'http://server.com/path/to/resource.json',
   proxy: new DefaultProxy('/proxy/'),
   headers: {
     'X-My-Header': 'valueOfHeader'
   },
   queryParameters: {
     'access_token': '123-435-456-000'
   },
   retryCallback: refreshTokenRetryCallback,
   retryAttempts: 1
});成员变量
    初始化到当前浏览器位置的资源实例
  
  
    如果支持blobs,则返回true。
  
  
    资源的文件扩展名。
  
  
      hasHeaders : Boolean
      
    
  
    如果资源有请求头,则为true。这相当于检查headers属性是否有任何键。
  
  
      headers : Object
      
    
  
    将随请求一起发送的其他HTTP标头。
  
  
      isBlobUri : Boolean
      
    
  
    如果资源引用一个blob URI,则为true。
  
  
      isCrossOriginUrl : Boolean
      
    
  
    如果资源引用一个跨源URL,则为true。
  
  
      isDataUri : Boolean
      
    
  
    如果资源引用一个数据URI,则为true。
  
  
      proxy : DefaultProxy
      
    
  
    加载资源时使用的代理。
  
  
    附加到url的查询参数。
  
  
      request : Request
      
    
  
    将使用的Request对象。仅供内部使用。
  
  
      retryAttempts : Number
      
    
  
    在放弃之前应该调用retryCallback的次数。
  
  
      retryCallback : function
      
    
  
    函数在此资源的请求失败时调用。如果返回true或Promise解析为true,则将重试请求。
  
  
    用于替换url中的模板参数的键/值对。
  
  
      url : String
      
    
  
    替换模板值、附加查询字符串并通过代理编码(如果设置了)的资源url。
  
  内置方法
    从URL创建资源并对其调用delete()。
  
  | Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | String | Object | 具有以下属性的url或对象: 
 | 
返回值:
  
    将在加载完成时解析到请求数据的约定。如果
  request.throttle为true并且请求的优先级不够高,返回undefined。
  
    从URL创建资源并对其调用fetch()。
  
  | Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | String | Object | 具有以下属性的url或对象: 
 | 
返回值:
  
    将在加载完成时解析到请求数据的约定。如果
  request.throttle为true并且请求的优先级不够高,返回undefined。
  
    创建资源并对其调用fetchArrayBuffer()。
  
  | Name | Type | Description | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | String | Object | 具有以下属性的url或对象: 
 | 
返回值:
  
    将在加载完成时解析到请求数据的约定。如果
  request.throttle为true并且请求的优先级不够高,返回undefined。
  
    创建资源并对其调用fetchBlob()。
  
  | Name | Type | Description | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | String | Object | 具有以下属性的url或对象: 
 | 
返回值:
  
    将在加载完成时解析到请求数据的约定。如果
  request.throttle为true并且请求的优先级不够高,返回undefined。
  
      staticCesium.Resource.fetchImage(options) → Promise.<ImageBitmap>|Promise.<Image>|undefined
      
    
  
    创建资源并对其调用fetchImage()。
  
  | Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | String | Object | 具有以下属性的url或对象: 
 | 
返回值:
  
    将在加载完成时解析到请求数据的约定。如果
  request.throttle为true并且请求的优先级不够高,返回undefined。
  
    创建一个资源并在其上调用fetchJson()。
  
  | Name | Type | Description | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | String | Object | 具有以下属性的url或对象: 
 | 
返回值:
  
    将在加载完成时解析到请求数据的约定。如果
  request.throttle为true并且请求的优先级不够高,返回undefined。
  
    从URL创建资源并对其调用fetchJsonp()。
  
  | Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | String | Object | 具有以下属性的url或对象: 
 | 
返回值:
  
    将在加载完成时解析到请求数据的约定。如果
  request.throttle为true并且请求的优先级不够高,返回undefined。
  
    创建资源并对其调用fetchText()。
  
  | Name | Type | Description | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | String | Object | 具有以下属性的url或对象: 
 | 
返回值:
  
    将在加载完成时解析到请求数据的约定。如果
  request.throttle为true并且请求的优先级不够高,返回undefined。
  
    创建资源并对其调用fetchXML()。
  
  | Name | Type | Description | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | String | Object | 具有以下属性的url或对象: 
 | 
返回值:
  
    将在加载完成时解析到请求数据的约定。如果
  request.throttle为true并且请求的优先级不够高,返回undefined。
  
    从URL创建资源并对其调用head()。
  
  | Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | String | Object | 具有以下属性的url或对象: 
 | 
返回值:
  
    将在加载完成时解析到请求数据的约定。如果
  request.throttle为true并且请求的优先级不够高,返回undefined。
  
    从URL创建资源并对其调用options()。
  
  | Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | Object | 具有以下属性的url或对象: 
 | 
返回值:
  
    将在加载完成时解析到请求数据的约定。如果
  request.throttle为true并且请求的优先级不够高,返回undefined。
  
    从URL创建资源并对其调用patch()。
  
  | Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | Object | 具有以下属性的url或对象: 
 | 
返回值:
  
    将在加载完成时解析到请求数据的约定。如果
  request.throttle为true并且请求的优先级不够高,返回undefined。
  
    从URL创建资源并对其调用post()。
  
  | Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | Object | 具有以下属性的url或对象: 
 | 
返回值:
  
    将在加载完成时解析到请求数据的约定。如果
  request.throttle为true并且请求的优先级不够高,返回undefined。
  
    从URL创建资源并对其调用put()。
  
  | Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | Object | 具有以下属性的url或对象: 
 | 
返回值:
  
    将在加载完成时解析到请求数据的约定。如果
  request.throttle为true并且请求的优先级不够高,返回undefined。
  
      appendForwardSlash()
      
    
  
    向URL追加正斜杠(forward slash)。
  
  
      appendQueryParameters(params)
      
    
  
    组合指定的对象和现有的查询参数。这允许您一次添加多个参数,而不是一次向queryParameters属性添加一个参数。
  
  | Name | Type | Description | 
|---|---|---|
| params | Object | 查询参数。 | 
    复制资源实例。
  
  | Name | Type | Description | 
|---|---|---|
| result | Resource | optional 存储结果的对象。 | 
返回值:
  
    已修改的结果参数或新资源实例(如果未提供)。
  
  
    异步 deletes 给定的资源。
    返回一个约定,该约定将在加载后解析为结果,或者在资源加载失败时拒绝。
    使用XMLHttpRequest加载数据,这意味着为了向另一个源发出请求,服务器必须启用跨源资源共享(CORS)标头。
  
  | Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | Object | optional
          对象,具有以下属性: 
 | 
返回值:
  
    将在加载完成时解析到请求数据的约定。如果
  request.throttle为true并且请求的优先级不够高,返回undefined。
  示例:
    resource.delete()
  .then(function(body) {
      // use the data
  }).otherwise(function(error) {
      // an error occurred
  });参考:
    
  
    异步 loads 给定的资源。
    返回一个约定,该约定将在加载后解析为结果,或者在资源加载失败时拒绝。
    使用XMLHttpRequest加载数据,这意味着为了向另一个源发出请求,服务器必须启用跨源资源共享(CORS)标头。
    建议您使用更具体的函数,如:fetchJson,fetchBlob等等。
  
  | Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | Object | optional
          对象,具有以下属性: 
 | 
返回值:
  
    将在加载完成时解析到请求数据的约定。如果
  request.throttle为true并且请求的优先级不够高,返回undefined。
  示例:
    resource.fetch()
  .then(function(body) {
      // use the data
  }).otherwise(function(error) {
      // an error occurred
  });参考:
    
  
    以原始二进制数据的形式异步地加载给定的资源。
    返回一个约定,该约定将在加载后解析为结果,或者在资源加载失败时拒绝。
    使用XMLHttpRequest加载数据,这意味着为了向另一个源发出请求,服务器必须启用跨源资源共享(CORS)标头。
  
  返回值:
  
    将在加载完成时解析到请求数据的约定。如果
  request.throttle为true并且请求的优先级不够高,返回undefined。
  示例:
    // 异步加载单个URL
resource.fetchArrayBuffer().then(function(arrayBuffer) {
    // use the data
}).otherwise(function(error) {
    // an error occurred
});参考:
    
  
    以blob的形式异步地加载给定的资源。
    返回一个约定,该约定将在加载后解析为结果,或者在资源加载失败时拒绝。
    使用XMLHttpRequest加载数据,这意味着为了向另一个源发出请求,服务器必须启用跨源资源共享(CORS)标头。
  
  返回值:
  
    将在加载完成时解析到请求数据的约定。如果
  request.throttle为true并且请求的优先级不够高,返回undefined。
  示例:
    // 异步加载单个URL
resource.fetchBlob().then(function(blob) {
    // use the data
}).otherwise(function(error) {
    // an error occurred
});参考:
    
  
    异步加载给定的图像资源。
    返回一个约定,该约定将解析为ImageBitmap,如果
  preferImageBitmap为true,
    并且浏览器支持createImageBitmap或其他加载后的Image;如果图像加载失败则拒绝。
  | Name | Type | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | Object | optional
          对象,具有下列属性: 
 | 
返回值:
  
    将在加载完成时解析到请求数据的约定。如果
  request.throttle为true并且请求的优先级不够高,返回undefined。
  示例:
    // 异步加载单个图像
resource.fetchImage().then(function(image) {
    // use the loaded image
}).otherwise(function(error) {
    // an error occurred
});
// 并行加载多个图像
when.all([resource1.fetchImage(), resource2.fetchImage()]).then(function(images) {
    // images is an array containing all the loaded images
});参考:
    
  
    以JSON的形式异步地加载给定的资源。
    返回一个约定,该约定将在加载后解析为结果,或者在资源加载失败时拒绝。
    使用XMLHttpRequest加载数据,这意味着为了向另一个源发出请求,服务器必须启用跨源资源共享(CORS)标头。
    如果尚未指定,此函数将向请求头添加'Accept: application/json,*/*;q=0.01'。
  
  返回值:
  
    将在加载完成时解析到请求数据的约定。如果
  request.throttle为true并且请求的优先级不够高,返回undefined。
  示例:
    resource.fetchJson().then(function(jsonData) {
    // Do something with the JSON object
}).otherwise(function(error) {
    // an error occurred
});参考:
    
  
    使用JSONP请求资源。
  
  | Name | Type | Default | Description | 
|---|---|---|---|
| callbackParameterName | String | 'callback' | optional 服务器期望的回调参数名。 | 
返回值:
  
    将在加载完成时解析到请求数据的约定。如果
  request.throttle为true并且请求的优先级不够高,返回undefined。
  示例:
    // 异步加载数据
resource.fetchJsonp().then(function(data) {
    // use the loaded data
}).otherwise(function(error) {
    // an error occurred
});参考:
    
  
    以文本的形式异步地加载给定的资源。
    返回一个约定,该约定将在加载后解析为结果,或者在资源加载失败时拒绝。
    使用XMLHttpRequest加载数据,这意味着为了向另一个源发出请求,服务器必须启用跨源资源共享(CORS)标头。
  
  返回值:
  
    将在加载完成时解析到请求数据的约定。如果
  request.throttle为true并且请求的优先级不够高,返回undefined。
  示例:
    // 从URL加载文本,设置自定义标头
var 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
}).otherwise(function(error) {
    // an error occurred
});参考:
    
  
    以XML的形式异步加载给定的资源。
    返回一个约定,该约定将在加载后解析为结果,或者在资源加载失败时拒绝。
    使用XMLHttpRequest加载数据,这意味着为了向另一个源发出请求,服务器必须启用跨源资源共享(CORS)标头。
  
  返回值:
  
    将在加载完成时解析到请求数据的约定。如果
  request.throttle为true并且请求的优先级不够高,返回undefined。
  示例:
    // 从URL加载XML,设置自定义标头
Cesium.loadXML('http://someUrl.com/someXML.xml', {
  'X-Custom-Header' : 'some value'
}).then(function(document) {
    // Do something with the document
}).otherwise(function(error) {
    // an error occurred
});参考:
    
  
    返回资源的基本路径。
  
  | Name | Type | Default | Description | 
|---|---|---|---|
| includeQuery | Boolean | false | optional 是否包含查询字符串和uri片段 | 
返回值:
  
    资源的基本URI
  
  
    返回相对于当前实例的资源。除非在options中被覆盖,否则所有属性都保持与当前实例相同。
  
  | Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | Object | 对象,具有下列属性: 
 | 
返回值:
  
    从当前资源派生的资源。
  
  
    返回url,查询字符串可选,由代理处理。
  
  | Name | Type | Default | Description | 
|---|---|---|---|
| query | Boolean | false | optional 如果为true,则包含查询字符串。 | 
| proxy | Boolean | false | optional 如果为true,则定义代理对象处理url。 | 
返回值:
  
    包含所有请求分量的url。
  
  
    异步获取给定资源的headers。
    返回一个约定,该约定将在加载后解析为结果,或者在资源加载失败时拒绝。
    使用XMLHttpRequest加载数据,这意味着为了向另一个源发出请求,服务器必须启用跨源资源共享(CORS)标头。
  
  | Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | Object | optional
          对象,具有以下属性: 
 | 
返回值:
  
    将在加载完成时解析到请求数据的约定。如果
  request.throttle为true并且请求的优先级不够高,返回undefined。
  示例:
    resource.head()
  .then(function(headers) {
      // use the data
  }).otherwise(function(error) {
      // an error occurred
  });参考:
    
  
    异步获取给定资源的options。
    返回一个约定,该约定将在加载后解析为结果,或者在资源加载失败时拒绝。
    使用XMLHttpRequest加载数据,这意味着为了向另一个源发出请求,服务器必须启用跨源资源共享(CORS)标头。
  
  | Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | Object | optional
          对象,具有以下属性: 
 | 
返回值:
  
    将在加载完成时解析到请求数据的约定。如果
  request.throttle为true并且请求的优先级不够高,返回undefined。
  示例:
    resource.options()
  .then(function(headers) {
      // use the data
  }).otherwise(function(error) {
      // an error occurred
  });参考:
    
  
    将数据异步地 patches 到给定的资源。
    返回一个约定,该约定将在加载后解析为结果,或者在资源加载失败时拒绝。
    使用XMLHttpRequest加载数据,这意味着为了向另一个源发出请求,服务器必须启用跨源资源共享(CORS)标头。
  
  | Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| data | Object | 与资源一起发布的数据。 | ||||||||||||
| options | Object | optional
          对象,具有以下属性: 
 | 
返回值:
  
    将在加载完成时解析到请求数据的约定。如果
  request.throttle为true并且请求的优先级不够高,返回undefined。
  示例:
    resource.patch(data)
  .then(function(result) {
      // use the result
  }).otherwise(function(error) {
      // an error occurred
  });参考:
    
  
    异步地将数据 posts 到给定的资源。
    返回一个约定,该约定将在加载后解析为结果,或者在资源加载失败时拒绝。
    使用XMLHttpRequest加载数据,这意味着为了向另一个源发出请求,服务器必须启用跨源资源共享(CORS)标头。
  
  | Name | Type | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| data | Object | 与资源一起发布的数据。 | |||||||||||||||
| options | Object | optional
          对象,具有以下属性: 
 | 
返回值:
  
    将在加载完成时解析到请求数据的约定。如果
  request.throttle为true并且请求的优先级不够高,返回undefined。
  示例:
    resource.post(data)
  .then(function(result) {
      // use the result
  }).otherwise(function(error) {
      // an error occurred
  });参考:
    
  
    异步地将数据 put 到给定的资源。
    返回一个约定,该约定将在加载后解析为结果,或者在资源加载失败时拒绝。
    使用XMLHttpRequest加载数据,这意味着为了向另一个源发出请求,服务器必须启用跨源资源共享(CORS)标头。
  
  | Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| data | Object | 与资源一起发布的数据。 | ||||||||||||
| options | Object | optional
          对象,具有以下属性: 
 | 
返回值:
  
    将在加载完成时解析到请求数据的约定。如果
  request.throttle为true并且请求的优先级不够高,返回undefined。
  示例:
    resource.put(data)
  .then(function(result) {
      // use the result
  }).otherwise(function(error) {
      // an error occurred
  });参考:
    
  
      setQueryParameters(params, useAsDefault)
      
    
  
    组合指定的对象和现有的查询参数。这允许您一次添加多个参数,
    而不是一次向queryParameters属性添加一个参数。如果已经设置了值,则将用新值替换它。
  
  | Name | Type | Default | Description | 
|---|---|---|---|
| params | Object | 查询参数。 | |
| useAsDefault | Boolean | false | optional 如果为true,则参数将用作默认值,因此只有在参数未定义时才会设置它们。 | 
      setTemplateValues(template, useAsDefault)
      
    
  
    组合指定的对象和现有的模板值。这允许您一次添加多个值,而不是一次向templateValues属性添加一个值。
    如果已经设置了一个值,它将成为一个数组,并将追加新值。
  
  | Name | Type | Default | Description | 
|---|---|---|---|
| template | Object | 模板值。 | |
| useAsDefault | Boolean | false | optional 如果为true,则这些值将用作默认值,因此只有在它们未定义时才会设置它们。 | 
类型定义
    返回属性值的函数。
  
  | Name | Type | Description | 
|---|---|---|
| resource | Resource | optional 加载失败的资源。 | 
| error | Error | optional 加载资源期间发生的错误。 | 
返回值:
  
    如果为true或约定解析为true,则重试资源。否则将返回失败。
  
   
     
               
               
               
               
               
               
             
             
           
           
           
           
                     
                     
                     
                     
                     
                     
                     
                     
                 
                 
                 
                 
                     
                     
                     
                     
                     
                     
                     
                     
                     
                     
                 
                 
                 
                 
                 
                 
                 
                