2021-03-25 16:22:09 +08:00
|
|
|
|
using Assets.Scripts.Apis;
|
|
|
|
|
|
using Assets.Scripts.Apis.Models;
|
2021-03-28 18:17:15 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Linq;
|
2021-03-25 16:22:09 +08:00
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
2021-03-29 20:32:30 +08:00
|
|
|
|
using UnityEngine.Networking;
|
2021-03-30 17:15:16 +08:00
|
|
|
|
using Assets.Scenes.Ride.Scripts.Model;
|
2021-03-31 20:46:57 +08:00
|
|
|
|
using Assets.Scenes.Ride.Scripts.Model.CyclingModels;
|
2021-04-02 19:17:23 +08:00
|
|
|
|
using Assets.Scenes.Ride.Scripts;
|
|
|
|
|
|
using Mapbox.Unity.Map;
|
|
|
|
|
|
using UnityEngine;
|
2021-03-25 16:22:09 +08:00
|
|
|
|
|
2021-04-02 19:17:23 +08:00
|
|
|
|
public class CyclingController : DeviceServiceMonoBase
|
2021-03-25 16:22:09 +08:00
|
|
|
|
{
|
2021-04-02 19:17:23 +08:00
|
|
|
|
|
|
|
|
|
|
public AbstractMap map;
|
|
|
|
|
|
public GameObject player;
|
|
|
|
|
|
public GameObject UIObject;
|
2021-04-15 10:13:01 +08:00
|
|
|
|
public SelectParamModel selectParamModel;
|
2021-04-02 19:17:23 +08:00
|
|
|
|
|
2021-03-31 20:46:57 +08:00
|
|
|
|
#region 参数
|
2021-03-25 16:22:09 +08:00
|
|
|
|
private MapDataModel mapData;//当前路书数据
|
|
|
|
|
|
private double[] coordiantes;//当前地图中心
|
|
|
|
|
|
private int currentUserId;//当前选中的用户id
|
2021-04-15 10:13:01 +08:00
|
|
|
|
public bool isStart;//当前游戏是否开始
|
2021-03-28 18:17:15 +08:00
|
|
|
|
private DateTime startTime;//开始时间
|
2021-04-15 10:13:01 +08:00
|
|
|
|
|
|
|
|
|
|
public CyclingModel cyclingModel;//当前骑行模式
|
2021-03-31 20:46:57 +08:00
|
|
|
|
public BaseCycling cyclingController { get; set; }
|
2021-04-02 19:17:23 +08:00
|
|
|
|
private int RouteId;
|
2021-03-31 20:46:57 +08:00
|
|
|
|
private MapApi mapApi;
|
2021-04-02 19:17:23 +08:00
|
|
|
|
private Route mapRoute;
|
2021-03-31 20:46:57 +08:00
|
|
|
|
#endregion
|
2021-03-25 16:22:09 +08:00
|
|
|
|
|
|
|
|
|
|
void Awake()
|
|
|
|
|
|
{
|
2021-03-30 17:15:16 +08:00
|
|
|
|
cyclingModel = CyclingModel.Single;
|
2021-04-15 10:13:01 +08:00
|
|
|
|
InitParam();
|
2021-03-25 16:22:09 +08:00
|
|
|
|
//获取路书信息
|
2021-04-01 14:09:23 +08:00
|
|
|
|
mapApi = new MapApi();
|
2021-04-12 17:35:56 +08:00
|
|
|
|
RouteId = App.RouteIdParam > 0? App.RouteIdParam : 376;
|
2021-04-01 14:09:23 +08:00
|
|
|
|
//var result = GetTestData();
|
2021-04-12 17:35:56 +08:00
|
|
|
|
MapDataModel result = mapApi.GetData(RouteId);
|
|
|
|
|
|
|
|
|
|
|
|
#if !UNITY_EDITOR
|
2021-04-02 19:17:23 +08:00
|
|
|
|
var antConnected = CheckAnt();//初始化ant+设备
|
2021-04-12 17:35:56 +08:00
|
|
|
|
#endif
|
2021-04-02 19:17:23 +08:00
|
|
|
|
//if (!antConnected)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// throw new Exception("请先连接设备");
|
|
|
|
|
|
//}
|
2021-03-29 20:32:30 +08:00
|
|
|
|
//StartCoroutine(requset());
|
2021-03-31 20:46:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
2021-04-02 19:17:23 +08:00
|
|
|
|
var param = mapApi.GetById(RouteId);
|
|
|
|
|
|
mapRoute = GetNewInstace(RouteId);//获取一个路书所有的数据
|
2021-04-12 17:35:56 +08:00
|
|
|
|
MapUDPService.Init();
|
2021-04-02 19:17:23 +08:00
|
|
|
|
switch (cyclingModel)
|
|
|
|
|
|
{
|
|
|
|
|
|
case CyclingModel.Single:
|
|
|
|
|
|
cyclingController = new SingleModel(mapRoute);
|
|
|
|
|
|
//cyclingModel.OpenCyclingWindow();
|
|
|
|
|
|
break;
|
2021-04-15 10:13:01 +08:00
|
|
|
|
//case CyclingModel.Online:
|
|
|
|
|
|
// CyclingModel = new OnlineModel(Route, param);
|
|
|
|
|
|
// cyclingModel.OpenCyclingWindow();
|
|
|
|
|
|
// break;
|
|
|
|
|
|
//case CyclingModel.Review:
|
|
|
|
|
|
// if (selectParamModel.RankingsId.Count == 0)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// //TODO:弹窗请选择跟随骑行的人
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// CyclingModel = new ReviewModel(Route, param);
|
|
|
|
|
|
//cyclingModel.OpenCyclingWindow();
|
|
|
|
|
|
// break;
|
2021-04-02 19:17:23 +08:00
|
|
|
|
//case Model.CyclingModel.Competition:
|
|
|
|
|
|
// CyclingModel = new CompetitionModel(Route, param);
|
|
|
|
|
|
// //cyclingModel.OpenCyclingWindow();
|
|
|
|
|
|
// break;
|
|
|
|
|
|
//case Model.CyclingModel.GlobalCycling:
|
|
|
|
|
|
// CyclingModel = new GlobalCyclingModel(Route, param);
|
|
|
|
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
//default:
|
|
|
|
|
|
// break;
|
|
|
|
|
|
}
|
2021-03-29 20:32:30 +08:00
|
|
|
|
|
2021-04-07 17:22:45 +08:00
|
|
|
|
if (result != null )//&& mapRoute != null)
|
2021-03-25 16:22:09 +08:00
|
|
|
|
{
|
|
|
|
|
|
mapData = result;
|
2021-04-01 11:01:29 +08:00
|
|
|
|
coordiantes = result.List[0].Point;//TODO计算当前用户所处的位置
|
2021-04-02 19:17:23 +08:00
|
|
|
|
Init();
|
2021-03-25 16:22:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new System.Exception("fail to get route data");
|
|
|
|
|
|
}
|
2021-03-30 17:15:16 +08:00
|
|
|
|
}
|
2021-04-15 10:13:01 +08:00
|
|
|
|
|
|
|
|
|
|
private void InitParam()
|
|
|
|
|
|
{
|
|
|
|
|
|
selectParamModel = new SelectParamModel();
|
|
|
|
|
|
selectParamModel.RouteId = App.RouteIdParam;
|
|
|
|
|
|
selectParamModel.RankingsId = new List<string>();
|
|
|
|
|
|
}
|
2021-04-02 19:17:23 +08:00
|
|
|
|
private void Init()
|
|
|
|
|
|
{
|
|
|
|
|
|
//加载人物和地图以及UI界面
|
|
|
|
|
|
map.gameObject.SetActive(true);
|
2021-04-15 10:13:01 +08:00
|
|
|
|
//player.SetActive(true);
|
2021-04-02 19:17:23 +08:00
|
|
|
|
UIObject.SetActive(true);
|
|
|
|
|
|
}
|
2021-03-29 20:32:30 +08:00
|
|
|
|
|
2021-03-30 17:15:16 +08:00
|
|
|
|
private void Update()
|
|
|
|
|
|
{
|
2021-03-25 16:22:09 +08:00
|
|
|
|
}
|
2021-03-30 17:15:16 +08:00
|
|
|
|
|
2021-04-07 17:22:45 +08:00
|
|
|
|
|
2021-04-02 19:17:23 +08:00
|
|
|
|
#region 数据处理
|
2021-03-31 20:46:57 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 当前骑行数据的记录器
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private RecorderDataModel recorderData
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return cyclingController?.recorderData;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-04-02 19:17:23 +08:00
|
|
|
|
public Route GetRoute()
|
|
|
|
|
|
{
|
|
|
|
|
|
return mapRoute;
|
|
|
|
|
|
}
|
2021-03-31 20:46:57 +08:00
|
|
|
|
|
|
|
|
|
|
public MapDataModel GetMapData()
|
|
|
|
|
|
{
|
|
|
|
|
|
return mapData;
|
|
|
|
|
|
}
|
|
|
|
|
|
public double[] GetCenterCoordinate()
|
|
|
|
|
|
{
|
|
|
|
|
|
return coordiantes;
|
|
|
|
|
|
}
|
|
|
|
|
|
public Route GetNewInstace(int id)
|
|
|
|
|
|
{
|
|
|
|
|
|
var routeInstance = mapApi.GetById(id);
|
|
|
|
|
|
if (routeInstance == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
var jsonData = mapApi.GetData(RouteId);
|
|
|
|
|
|
return new Route(jsonData, routeInstance.data);
|
|
|
|
|
|
}
|
2021-03-25 16:22:09 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取模拟的骑行记录
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public MapDataModel GetTestData()
|
|
|
|
|
|
{
|
2021-04-07 17:22:45 +08:00
|
|
|
|
string json = "{'Type':'LineString','TotalDistance':19.17906,'List':[{'Point':[26.092100000000002,119.33686000000002],'Elevation':7.6198},{'Point':[26.09211,119.33749000000002],'Elevation':7.5859},{'Point':[26.092170000000003,119.33840000000001],'Elevation':7.421},{'Point':[26.092260000000003,119.33921000000001],'Elevation':7.3133},{'Point':[26.092270002098761,119.33999000005943],'Elevation':7.2394},{'Point':[26.092280000000002,119.34077],'Elevation':7.2701},{'Point':[26.092240000956789,119.34129500009136],'Elevation':7.3416},{'Point':[26.092200000000002,119.34182000000001],'Elevation':7.4177},{'Point':[26.092083338752424,119.34270666844074],'Elevation':7.5033},{'Point':[26.09196667208499,119.34359333511317],'Elevation':7.2596},{'Point':[26.09185,119.34448],'Elevation':6.8727},{'Point':[26.091680000000004,119.34505000000001],'Elevation':6.4546},{'Point':[26.091536672044878,119.34593333550309],'Elevation':6.0312},{'Point':[26.091393338710645,119.34681666884185],'Elevation':5.751},{'Point':[26.091250000000002,119.3477],'Elevation':5.6373},{'Point':[26.091230000000003,119.34794000000001],'Elevation':5.6052},{'Point':[26.091225001411136,119.3485800001182],'Elevation':5.5997},{'Point':[26.091220000000003,119.34922000000002],'Elevation':5.6907},{'Point':[26.091330000000003,119.34997000000001],'Elevation':6.0231},{'Point':[26.091440000000002,119.35021],'Elevation':6.4916},{'Point':[26.09157,119.35095000000001],'Elevation':7.0092},{'Point':[26.091600000000003,119.3516],'Elevation':7.3641},{'Point':[26.091767507390937,119.35244499640774],'Elevation':7.4909},{'Point':[26.091935009859512,119.353289995235],'Elevation':6.9736},{'Point':[26.092102507405667,119.35413499648182],'Elevation':6.7797},{'Point':[26.092270000000003,119.35498000000001],'Elevation':6.5711},{'Point':[26.092405001867032,119.35571999903352],'Elevation':6.4206},{'Point':[26.092540000000003,119.35646000000001],'Elevation':6.3653},{'Point':[26.09269,119.35732000000002],'Elevation':7.251},{'Point':[26.092710000000004,119.35761000000001],'Elevation':8.2263},{'Point':[26.092703339253426,119.35853666675888],'Elevation':9.8464},{'Point':[26.092696672586847,119.35946333341218],'Elevation':11.8545},{'Point':[26.09269,119.36039000000001],'Elevation':13.6159},{'Point':[26.092665001414368,119.36103000007358],'Elevation':15.1102},{'Point':[26.092640000000003,119.36167],'Elevation':16.3984},{'Point':[26.0925,119.36225],'Elevation':17.1179},{'Point':[26.092270000000003,119.36289000000001],'Elevation':17.3805},{'Point':[26.092200000000002,119.36334000000001],'Elevation':17.3022},{'Point':[26.092180000000003,119.36363000000001],'Elevation':17.2282},{'Point':[26.092190000000002,119.36396],'Elevation':17.2224},{'Point':[26.092290000000002,119.36435000000002],'Elevation':17.1729},{'Point':[26.092100000000002,119.36453000000002],'Elevation':17.1065},{'Point':[26.092000000000002,119.36473000000001],'Elevation':17.0503},{'Point':[26.091910000000002,119.36502000000002],'Elevation':17.1392},{'Point':[26.09193,119.36525],'Elevation':17.2636},{'Point':[26.092150000000004,119.36569000000001],'Elevation':17.4486},{'Point':[26.09233,119.36581000000001],'Elevation':17.7034},{'Point':[26.092540000000003,119.36588],'Elevation':18.1077},{'Point':[26.092750000000002,119.36589000000001],'Elevation':18.5083},{'Point':[26.092950000000002,119.36582000000001],'Elevation':18.892},{'Point':[26.093110000000003,119.36572000000001],'Elevation':19.2643},{'Point':[26.09335,119.36544],'Elevation':19.6256},{'Point':[26.094033333311039,119.36542333352864],'Elevation':20.1707},{'Point':[26.094716666620165,119.36540666686258],'Elevation':21.2487},{'Point':[26.0954,119.36539],'Elevation':22.396},{'Point':[26.09605,119.36548],'Elevation':23.9715},{'Point':[26.09615,119.36567000000001],'Elevation':25.3392},{'Point':[26.096753333417059,119.36562333380944],'Elevation':26.626},{'Point':[26.097356666819095,119.36557666713746],'Elevation':28.1709},{'Point':[26.09796,119.36553],'Elevation':30.077},{'Point':[26.098260000000003,119.36556000000002],'Elevation':32.1094},{'Point':[26.09888000013564,119.36572999910875],'E
|
2021-03-31 20:46:57 +08:00
|
|
|
|
//string json = "{'Type':'LineString','TotalDistance':22.201689999999992,'List':[{'Point':[32.060793,118.808228],'Elevation':14.5598},{'Point':[32.061604,118.808548],'Elevation':14.3954},{'Point':[32.063085,118.809059],'Elevation':14.0074},{'Point':[32.064306,118.80951],'Elevation':14.2812},{'Point':[32.065217,118.809841],'Elevation':14.701},{'Point':[32.066188,118.810121],'Elevation':15.2048},{'Point':[32.066558,118.810492],'Elevation':15.4843},{'Point':[32.067079,118.810983],'Elevation':15.5637},{'Point':[32.06756,118.811344],'Elevation':15.507},{'Point':[32.067931,118.811574],'Elevation':15.469},{'Point':[32.068451,118.811845],'Elevation':15.5912},{'Point':[32.068852,118.812085],'Elevation':15.6546},{'Point':[32.069433,118.812766],'Elevation':15.8589},{'Point':[32.070115,118.813588],'Elevation':16.2968},{'Point':[32.070646,118.814229],'Elevation':16.9136},{'Point':[32.071368,118.815101],'Elevation':17.4104},{'Point':[32.07228,118.816213],'Elevation':17.7138},{'Point':[32.072561,118.816554],'Elevation':17.9888},{'Point':[32.072821,118.816885],'Elevation':18.502},{'Point':[32.073483,118.817706],'Elevation':19.5909},{'Point':[32.073844,118.818147],'Elevation':20.596},{'Point':[32.074305,118.818729],'Elevation':21.2868},{'Point':[32.074786,118.81927],'Elevation':21.6856},{'Point':[32.074987,118.81951],'Elevation':22.0494},{'Point':[32.075448,118.819991],'Elevation':22.3838},{'Point':[32.075909,118.820492],'Elevation':22.6512},{'Point':[32.076069,118.820662],'Elevation':22.8796},{'Point':[32.07637,118.821003],'Elevation':23.0857},{'Point':[32.07659,118.821133],'Elevation':23.2517},{'Point':[32.076831,118.821384],'Elevation':23.532},{'Point':[32.077212,118.822025],'Elevation':24.0643},{'Point':[32.077494,118.822867],'Elevation':24.8455},{'Point':[32.077645,118.823438],'Elevation':25.8294},{'Point':[32.077756,118.823879],'Elevation':26.909},{'Point':[32.077896,118.82422],'Elevation':28.0635},{'Point':[32.078037,118.82448],'Elevation':29.1886},{'Point':[32.078267,118.824781],'Elevation':30.2586},{'Point':[32.078418,118.824941],'Elevation':31.1856},{'Point':[32.078728,118.825232],'Elevation':31.9239},{'Point':[32.078969,118.825332],'Elevation':32.549},{'Point':[32.079169,118.825322],'Elevation':33.0782},{'Point':[32.079498,118.825202],'Elevation':33.544},{'Point':[32.079958,118.825021],'Elevation':33.9813},{'Point':[32.080328,118.824941],'Elevation':34.3312},{'Point':[32.081018,118.824861],'Elevation':34.4341},{'Point':[32.081618,118.824811],'Elevation':34.2067},{'Point':[32.081948,118.824811],'Elevation':33.8412},{'Point':[32.082178,118.824841],'Elevation':33.428},{'Point':[32.082369,118.824911],'Elevation':33.0365},{'Point':[32.082579,118.825051],'Elevation':32.6545},{'Point':[32.082769,118.825191],'Elevation':32.2689},{'Point':[32.08304,118.825442],'Elevation':31.9885},{'Point':[32.08319,118.825652],'Elevation':31.8223},{'Point':[32.083331,118.825893],'Elevation':31.7163},{'Point':[32.083742,118.826624],'Elevation':31.7409},{'Point':[32.083973,118.826975],'Elevation':31.8967},{'Point':[32.084113,118.827135],'Elevation':32.0943},{'Point':[32.084354,118.827376],'Elevation':32.289},{'Point':[32.084504,118.827496],'Elevation':32.4791},{'Point':[32.084884,118.827727],'Elevation':32.7283},{'Point':[32.085155,118.827887],'Elevation':32.9179},{'Point':[32.085435,118.828047],'Elevation':32.9931},{'Point':[32.085675,118.828198],'Elevation':32.9919},{'Point':[32.085976,118.828348],'Elevation':32.8424},{'Point':[32.086397,118.829079],'Elevation':32.7725},{'Point':[32.086608,118.82946],'Elevation':32.6947},{'Point':[32.086819,118.829821],'Elevation':32.5996},{'Point':[32.086969,118.830122],'Elevation':32.5681},{'Point':[32.08711,118.830472],'Elevation':32.4398},{'Point':[32.087201,118.830753],'Elevation':32.2517},{'Point':[32.087271,118.831033],'Elevation':32.042},{'Point':[32.087402,118.831615],'Elevation':31.912},{'Point':[32.087463,118.831905],'Elevation':31.9259},{'Point':[32.087503,118.832196],'Elevation':32.0906},{'Point':[32.087554,118.832547],'Elevation':32.2625},{'Point':[32.087584,118.832757],'Elevation':32.4019},{'Po
|
2021-04-07 17:22:45 +08:00
|
|
|
|
//string json = @"{'Type':'LineString','TotalDistance':3.4100999999999995,'List':[{'Point':[31.351249,119.021848],'Elevation':28.3692},{'Point':[31.35127,119.021529],'Elevation':28.4163},{'Point':[31.351322,119.020791],'Elevation':29.5811},{'Point':[31.351364,119.019914],'Elevation':31.2764},{'Point':[31.351458,119.018399],'Elevation':32.102},{'Point':[31.351501,119.017512],'Elevation':32.5486},{'Point':[31.351512,119.017203],'Elevation':33.0451},{'Point':[31.351522,119.016914],'Elevation':33.5963},{'Point':[31.351564,119.016386],'Elevation':34.58},{'Point':[31.351606,119.015788],'Elevation':36.0089},{'Point':[31.351626,119.015539],'Elevation':37.4491},{'Point':[31.351647,119.01529],'Elevation':38.8925},{'Point':[31.351187,119.01521],'Elevation':39.5386},{'Point':[31.350858,119.01514],'Elevation':39.7551},{'Point':[31.350438,119.015051],'Elevation':40.1219},{'Point':[31.350199,119.014891],'Elevation':40.7157},{'Point':[31.350019,119.014742],'Elevation':41.4673},{'Point':[31.34974,119.014622],'Elevation':42.0818},{'Point':[31.34951,119.014553],'Elevation':42.4744},{'Point':[31.349201,119.014363],'Elevation':42.707},{'Point':[31.349051,119.014164],'Elevation':42.9748},{'Point':[31.348563,119.013506],'Elevation':43.4829},{'Point':[31.348384,119.013287],'Elevation':43.7515},{'Point':[31.348095,119.013078],'Elevation':43.711},{'Point':[31.347905,119.012988],'Elevation':43.6298},{'Point':[31.347596,119.012789],'Elevation':43.5441},{'Point':[31.347416,119.012639],'Elevation':43.5661},{'Point':[31.347257,119.01249],'Elevation':43.7661},{'Point':[31.347017,119.012271],'Elevation':44.173},{'Point':[31.346778,119.012071],'Elevation':44.6846},{'Point':[31.346569,119.011932],'Elevation':45.0536},{'Point':[31.346349,119.011862],'Elevation':45.1835},{'Point':[31.346169,119.011822],'Elevation':45.1202},{'Point':[31.34597,119.011573],'Elevation':44.9227},{'Point':[31.345872,119.010926],'Elevation':44.769},{'Point':[31.345823,119.010517],'Elevation':44.825},{'Point':[31.345724,119.010198],'Elevation':45.0025},{'Point':[31.345595,119.009999],'Elevation':45.0965},{'Point':[31.345306,119.00966],'Elevation':44.9105},{'Point':[31.345056,119.009421],'Elevation':44.6363},{'Point':[31.344847,119.009281],'Elevation':44.3001},{'Point':[31.344627,119.009122],'Elevation':43.9679},{'Point':[31.344468,119.008983],'Elevation':43.7442},{'Point':[31.344199,119.008694],'Elevation':43.6926},{'Point':[31.34396,119.008345],'Elevation':43.9002},{'Point':[31.343711,119.007976],'Elevation':44.3907},{'Point':[31.343333,119.007488],'Elevation':45.4845},{'Point':[31.343173,119.007289],'Elevation':46.704},{'Point':[31.342834,119.007109],'Elevation':47.9561},{'Point':[31.342485,119.00698],'Elevation':48.9071},{'Point':[31.342285,119.00687],'Elevation':49.4839},{'Point':[31.342155,119.006721],'Elevation':49.8479},{'Point':[31.342026,119.006472],'Elevation':50.1356},{'Point':[31.342057,119.006253],'Elevation':50.7142},{'Point':[31.342257,119.006223],'Elevation':51.7425},{'Point':[31.342547,119.006332],'Elevation':53.1767},{'Point':[31.342737,119.006213],'Elevation':54.8684},{'Point':[31.342818,119.005894],'Elevation':56.8442},{'Point':[31.342909,119.005625],'Elevation':58.8701},{'Point':[31.342989,119.005415],'Elevation':60.9597},{'Point':[31.343199,119.005276],'Elevation':63.4359},{'Point':[31.34363,119.005166],'Elevation':66.2565},{'Point':[31.34396,119.005087],'Elevation':69.0464},{'Point':[31.34469,119.004897],'Elevation':72.3644},{'Point':[31.34492,119.004817],'Elevation':75.7088},{'Point':[31.345151,119.004578],'Elevation':79.2975},{'Point':[31.345452,119.004329],'Elevation':83.0134},{'Point':[31.345722,119.00413],'Elevation':87.0387},{'Point':[31.345882,119.00397],'Elevation':90.9773},{'Point':[31.346003,119.003701],'Elevation':94.1804},{'Point':[31.346134,119.003492],'Elevation':96.7123},{'Point':[31.346334,119.003412],'Elevation':99.1538},{'Point':[31.346604,119.003522],'Elevation':102.4359},{'Point':[31.346853,119.003552],'Elevation':106.1954},{'Point':[31.347143,119.003502],'Elevation':110.2601},{'Point':[31.347344,119.003432],'Elevation':114.1717},{
|
2021-03-25 16:22:09 +08:00
|
|
|
|
return Newtonsoft.Json.JsonConvert.DeserializeObject<MapDataModel>(json);
|
|
|
|
|
|
}
|
2021-03-28 18:17:15 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 海拔图数据
|
|
|
|
|
|
/// </summary>
|
2021-04-07 17:22:45 +08:00
|
|
|
|
public float[] GetRealTimeLineChartData(int index)
|
2021-03-28 18:17:15 +08:00
|
|
|
|
{
|
2021-03-29 20:32:30 +08:00
|
|
|
|
List<float> dist = new List<float>();
|
|
|
|
|
|
var list = mapData.List.Select(c => (float) c.Elevation ).ToArray();
|
|
|
|
|
|
var count = list.Count();
|
|
|
|
|
|
for (int i = 0; i < count; i++)
|
|
|
|
|
|
{
|
2021-04-07 17:22:45 +08:00
|
|
|
|
if (i > index)
|
2021-03-29 20:32:30 +08:00
|
|
|
|
{
|
|
|
|
|
|
dist.Add(list[i]);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return dist.ToArray();
|
2021-03-28 18:17:15 +08:00
|
|
|
|
}
|
2021-04-07 17:22:45 +08:00
|
|
|
|
|
|
|
|
|
|
public float[] GetLineChartData()
|
|
|
|
|
|
{
|
|
|
|
|
|
var list = mapData.List.Select(c => (float)c.Elevation).ToArray();
|
|
|
|
|
|
return list;
|
|
|
|
|
|
}
|
2021-03-31 20:46:57 +08:00
|
|
|
|
#endregion
|
2021-04-02 19:17:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
2021-03-25 16:22:09 +08:00
|
|
|
|
}
|