# 界面引用

<script src="/GisTwin.main.js"></script>

# 创建 DOM

<div id="CloudPlayer"></div>

# 初始化示例

var gisTwin = new GisTwin({
  ElementID: "CloudPlayer", //初始化div对象id
  CloudUrl: "localhost:8990", //云渲染url,如果不是云渲染方案可以不用填写
  MessageUrl: "localhost:8443", //通讯地址
  bitrateStart: 300000, //云渲染比特率初始值(可选)
  bitrateMax: 500000 //云渲染比特率最大值(可选)
});

# 调用示例

//请求摄像机信息
gisTwin.UEAPI("GisPawn", "GetCameraInfo", jsondata, (e) => {
  console.log(e);
});

# 消息通用格式

let jsondata = {
  center_coord: [103.956291, 1.406699], //中心点的坐标 lng, lat
  arm_distance: 3000, //镜头离中心点的距离(单位:米)
  arm_distance_max: 9000, //镜头离中心点的最远距离(单位:米), 依项目而定
  arm_distance_min: 150, //镜头离中心点的最近距离(单位:米), 依项目而定
  pitch: 30, //镜头俯仰角(0~89)
  pitch_max: 89, //镜头俯仰角最大值, 依项目而定
  pitch_min: 10, //镜头俯仰角最小值, 依项目而定
  yaw: 0 //镜头偏航角(0正北, 0~359)
};

# 完整代码

<!DOCTYPE html>
<html>
  <head>
    <script src="GisTwin.main.js"></script>
  </head>

  <body>
    <div id="CloudPlayer"></div>
    <button onclick="doAPI()">获取点位信息</button>
    <script>
      var gisTwin = new GisTwin({
        ElementID: "CloudPlayer",
        CloudUrl: "localhost:8990",
        MessageUrl: "localhost:8443"
      });

      function doAPI() {
        let jsondata = {
          center_coord: [103.956291, 1.406699],
          arm_distance: 3000,
          arm_distance_max: 9000,
          arm_distance_min: 150,
          pitch: 30,
          pitch_max: 89,
          pitch_min: 10,
          yaw: 0
        };
        gisTwin.UEAPI("GisPawn", "GetCameraInfo", jsondata, (e) => {
          console.log(e);
        });
      }
    </script>
  </body>
</html>