12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- using Blue;
- using Newtonsoft.Json.Linq;
- using Newtonsoft.Json;
- /// <summary>
- /// 获取点云文件(json、bytes)的Url下载地址命令
- /// </summary>
- public class PointFileGetUrlCommand : ICommand
- {
- private string methodName = "/project/pointcloud";
- private int sceneID;
- private PointFileType fileType;
- /// <summary>
- /// 获取点云文件(json、bytes)的Url下载地址命令
- /// </summary>
- /// <param name="sceneId">场景ID</param>
- /// <param name="fileType">文件类型</param>
- public PointFileGetUrlCommand(int sceneId, PointFileType fileType)
- {
- this.sceneID = sceneId;
- this.fileType = fileType;
- }
- public void OnExcute()
- {
- this.GetService<IPointService>().GetPointFileDownloadUrl(methodName, sceneID.ToString(), fileType, GetPointFileUrlSuccess);
- }
- private void GetPointFileUrlSuccess(string message)
- {
- if (!string.IsNullOrWhiteSpace(message))
- {
- JObject jobject = JObject.Parse(message);
- if (jobject["code"].ToString() == "200")
- {
- message = jobject["data"].ToString();
- if (!string.IsNullOrWhiteSpace(message))
- {
- PointFileData PointFile = JsonConvert.DeserializeObject<PointFileData>(message);
- this.GetService<IPointService>().DownloadPointFile(PointFile.url, fileType);
- }
- }
- }
- }
- }
|