const target = {
  adddate: '2017-8-14 17:51',
  adddept: '计控电仪部',
  addperson: '系统管理员',
  admin: 'admin',
  // billboard: { image: require('./../../assets/tileview/marker-video.png') },
  billboard: { image: 'data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAhCAYAAAC4JqlRAAAF6klEQVRYR72Xe1DUVRTHz\/0tu7i8dpFAQlTI1EFRlgY0pklgUpSwWNQU1MnFd2oGaWQKw2K+RkMpRZgR3QUTRkogQ5w0A1+Rj0KHFFyLhyi1jAssZOC+TnOXVoH9sQ+naf\/5zezv3nM+93vP60fAzp8MZUIEDCJAIkxbEbCKAGlOJIlNdpoDYuuGw9rDEQTIB0BADAhAdyICkIHPm4QB+QrOis9ttWsVIKcnx4\/D4cgMBowwOVMrO1tUTe3KtgZlu9dLI4Y7uzs5jxjvHdAPhiqRvNpxdZk1EIsA2X9liwjDqQQwCOmRrxb+dLY8o\/yRqkXlNtiwg6PDk8DowCfv5i2NGcZ3FFBpEAxJ65zWWVRjSADq3IBYCYhCpUJZlxOXU8PmmA0k\/sAi12nxoVEUghggeb1gfdZQSrAC7O\/YL2QIU4MAfm13lXV7pu+5o3uic7QmZ\/\/3M5NnamLS58ylDgxoiEx2T65i288KkKnKlAKSdO3fGnXquNTv7XVuchSfu4gXOj8kCgg0bfT40N8mAHp6rVbXSIAICxLzi2pP17rac\/L+a2lcZNRvm8F15goAmMQUr43ywbbMFNj1xy4JAUbWpVS37BTtvGXc4MXjOmzw8QWhA5cVplOn1aU2NbK9i3w\/UjNry+y5iPjNJz6bxVYBdrTsKANCYi\/nXf72jLTCCMgrnSxioof7WlJCv7fltjatwQhBJjo7OaSM8tdK6m\/z3fmPU2vTFtL\/tVqNu9Rf2tnfjpkC25o\/pTk8JnvWwePKeqWALuZXh4QxU1w8LAHo8loVmu1NjY65EyZyZnuMomsfO1eV0+fWutTXeXxHAYMQmeafNiAYzQDSGzIQACFr+v4i9QO18f5droSGMZMtA2jyWhX6C+0q\/rHAMBNol1ulEWD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wWI+vLNMkCIpUDIQPC5xRU3bbnz\/yQIqZEIWYSQAUcJAWw6n3jW7ug3gfwDPSVSQCSbL6cAAAAASUVORK5CYII=' },
  by1: '1',
  by2: '8000',
  by3: '',
  by4: '',
  by5: '',
  cameraip: '192.168.5.83',
  cameraposition: '底部',
  cameratype: '固定式',
  description: `'↵  <table border="1" width="100%">↵    <tr>↵      <td width="50%" align="right">视频ID</td>↵      <td>8</td>↵    </tr>↵    <tr>↵      <td width="50%" align="right">视频</td>↵      <td><a href="Webshell00:where='params.videomonitorinfoid'" style="font-size:16px;">视频链接</a>↵      </td>↵    </tr>↵    <tr>↵      <td width="50%" align="right">装备ID</td>↵      <td>1220</td>↵    </tr>↵    <tr>↵      <td width="50%" align="right">摄像机名称</td>↵      <td>二甲醚罐（一号）根部</td>↵    </tr>↵    <tr>↵      <td width="50%" align="right">摄像机IP</td>↵      <td>192.168.5.83</td>↵    </tr>↵    <tr>↵      <td width="50%" align="right">备注</td>↵      <td></td>↵    </tr>↵  </table>" `,
  equippositioninfoid: '1220',
  id: 'video_1',
  label: { text: '' },
  moddate: '2018/3/28 17:13:29',
  moddept: '',
  modperson: '',
  name: '二甲醚罐（一号）根部',
  password: 'a2106666',
  position: { x: '109.43176663859039', y: '34.497122878544914', z: '21.7595101563931' },
  remark: '',
  videomonitorinfoid: '8'
};

export const changeGoodView = (instance, data) => {
  let { x, y, z } = data.contingencyRo;
  instance.gis3DRenderer.flyTo({
    destination: Cesium.Cartesian3.fromDegrees(x, y, 90),
    orientation: {
      heading: Cesium.Math.toRadians(-2.5),
      pitch: Cesium.Math.toRadians(-88),
      roll: 0
    },
    pitchAdjustHeight: -90,
    maximumHeight: 5000,
    flyOverLongitude: 100
  });
};

export const initView = (instance, data, removeByMarkerId) => {
  if (data) {
    let { equipmentId } = data && data.contingencyRo;
    removeByMarkerId && removeByMarkerId(equipmentId);
  }
  instance.gis3DRenderer.flyTo({
    destination: Cesium.Cartesian3.fromDegrees(109.432085, 34.490333, 800),
    orientation: {
      heading: Cesium.Math.toRadians(-2.0),
      pitch: Cesium.Math.toRadians(-45.5),
      roll: 0
    }
  });
};

export const riskFlashing = (instance, data, addMarkerId, removeByMarkerId, createEquip) => {
  let { icon } = data;
  let { equipmentId } = data.bizobj;
  let markerObj = createEquip && createEquip(data.bizobj);
  markerObj.billboard.image = new Cesium.GIFPlugin({
    url: `/src/assets/tileview/${icon}.gif`
  });
  removeByMarkerId && removeByMarkerId(equipmentId);
  addMarkerId && addMarkerId(equipmentId, markerObj);
};
