# ShadowRateAnalysis

#### new Cesium.ShadowRateAnalysis(viewer, options)
MapGIS/Analysis/ShadowRateAnalysis.js 109

阴影率分析

Name | Type | Description
--- | --- | ---
`viewer` | Object | 场景视图
`options` | Object | 附加选项
Name | Type | Default | Description
--- | --- | --- | ---
`pointsArray` | Array.<Cartesian3> |  | optional 点序列,世界坐标Cartesian3数组，可直接使用交互绘制的回调结果,必选
`startTime` | JulianDate |  | optional 时间段开始时间,必选
`endTime` | JulianDate |  | optional 时间段结束时间,必选
`multiplier` | Number | `14400` | optional 时间倍率，用于控制时间流逝速度；数值越小得到的分析结果越精确，消耗时间越长，反之同理
`spacing` | Number | `4` | optional 配置绘制点的间隔，单位米
`pointSize` | Number | `5` | optional 配置绘制顶点的大小，单位像素
`colorScheme` | Array |  | optional 颜色表,默认色表：http://192.168.82.91:8200/NoneSpatialData/image/阴影率分析色表.png ，将阴影率与点元颜色映射，传入方式举例： colorScheme=[ {color:'rgba(0, 255, 0, 1)',rate:0}, {color:'rgba(255, 255, 0, 1)',rate:0.5}, {color:'rgba(255, 0, 0, 1)',rate:1} ]
`minHeight` | Number | `1` | optional 插值点最小高度，单位米
`maxHeight` | Number | `10` | optional 插值点最大高度，单位米

Author:
  - 夏琨

##### Example:

    // 阴影率分析类依赖场景的shdows，必须设置开启。
    viewer.shadows = true;

    // 新建阴影率分析类
    var startTimeDate = new Date('2024/4/01 05:00:00');
    var endTimeDate = new Date('2024/4/01 15:00:00');
    var ShadowRateAnalysis = new Cesium.ShadowRateAnalysis(viewer, {
              startTime: Cesium.JulianDate.fromDate(startTimeDate),
              endTime: Cesium.JulianDate.fromDate(endTimeDate),
              spacing: 5,
              pointSize: 10,
              minHeight: 10,
              maxHeight: 50,
       });

    // 加载模型数据：支持M3D、3DTiles、glb等。
    var entity = viewer.entities.add({
             name: 'build',
             position: Cesium.Cartesian3.fromDegrees(115.1771, 20.2834, 500),
             model: {
              uri: '../../SampleData/models/Building/build.glb',
              heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
              minimumPixelSize: 10,
              scale: 200
          }
       });
    viewer.camera.flyTo({
             destination: Cesium.Cartesian3.fromDegrees(115.1771, 20.2834, 1000), //经度，纬度，视角高度
             duration: 0
       });

    // 阴影率分析
    // 分析区域几何顶点，可直接使用交互绘制的回调结果
    var points=[
      {
          "x": -2545958.6505201817,
          "y": 5416460.046735503,
          "z": 2197304.570977404
      },
      {
          "x": -2546028.547171191,
          "y": 5416621.283669859,
          "z": 2196829.2727668337
      },
      {
          "x": -2546502.8935825536,
          "y": 5416402.67652554,
          "z": 2196818.5454125707
      },
      {
          "x": -2546411.1078572497,
          "y": 5416239.747866453,
          "z": 2197323.1835109163
      },
      {
          "x": -2545958.6505201817,
          "y": 5416460.046735503,
          "z": 2197304.570977404
      }
    ];
    ShadowRateAnalysis.pointsArray = points;
    ShadowRateAnalysis.shadowRate();

    // 播放日照效果
    // ShadowRateAnalysis.sunLightEffect();

### Members

#### colorScheme : Array
MapGIS/Analysis/ShadowRateAnalysis.js 225

颜色表

#### endTime : JulianDate
MapGIS/Analysis/ShadowRateAnalysis.js 185

时间段结束时间

#### maxHeight : Number
MapGIS/Analysis/ShadowRateAnalysis.js 265

绘制点最大高度

#### minHeight : Number
MapGIS/Analysis/ShadowRateAnalysis.js 251

绘制点最小高度

#### multiplier : Number
MapGIS/Analysis/ShadowRateAnalysis.js 199

时间倍率

#### pointsArray : Array
MapGIS/Analysis/ShadowRateAnalysis.js 159

点坐标数组

#### pointSize : Number
MapGIS/Analysis/ShadowRateAnalysis.js 238

绘制点大小

#### spacing : Number
MapGIS/Analysis/ShadowRateAnalysis.js 212

绘制点的间隔

#### startTime : JulianDate
MapGIS/Analysis/ShadowRateAnalysis.js 172

时间段开始时间

### Methods

#### clear()
MapGIS/Analysis/ShadowRateAnalysis.js 560

清空绘制结果

#### destroy()
MapGIS/Analysis/ShadowRateAnalysis.js 567

销毁

#### shadowRate()
MapGIS/Analysis/ShadowRateAnalysis.js 278

开始阴影率分析

#### sunLightEffect()
MapGIS/Analysis/ShadowRateAnalysis.js 334

开始播放日照效果