Esempio n. 1
0
        public static WebApiService CreateWebApiService(csWebApi api, string name, Layer layer, Guid id, string folder = "",
            string relativeFolder = "")
        {

            var res = new WebApiService
            {
                IsLocal = true,
                Name = layer.Title,
                Id = id,
                IsFileBased = false,
                StaticService = true,
                AutoStart = false,
                HasSensorData = false,
                Mode = Mode.client,
                RelativeFolder = relativeFolder,
                api = api
            };
            res.csLayer = layer;
            res.Init(Mode.client, AppState.DataServer);
            res.Folder = folder;
            res.InitPoiService();

            res.Settings.OpenTab = false;
            res.Settings.Icon = "layer.png";
            AppState.DataServer.Services.Add(res);
            return res;
        }
Esempio n. 2
0
File: Api.cs Progetto: TNOCS/csTouch
 static csWebApi()
 {
     _instance = new csWebApi();
 }
Esempio n. 3
0
 public static void SyncPoi(global::DataServer.PoI p, Layer l, Feature f, csWebApi api)
 {
     if (!p.Data.ContainsKey("cs") || p.Data["cs"] == null)
     {
         p.Data["cs"] = f;
     }
     var posChanged = Observable.FromEventPattern<PositionEventArgs>(ev => p.PositionChanged += ev,
         ev => p.PositionChanged -= ev);
     posChanged.Throttle(TimeSpan.FromSeconds(1)).Subscribe(k =>
     {
         var coords = f.Geometry.Coordinates as JArray;
         if (coords != null && ((double)coords[0] != p.Position.Longitude || (double)coords[1] != p.Position.Latitude))
         {
             ((JArray)f.Geometry.Coordinates)[0] = p.Position.Longitude;
             ((JArray)f.Geometry.Coordinates)[1] = p.Position.Latitude;
             //var c = ((JArray) f.Geometry.Coordinates).Select(x => (double) x).ToList();
             //c[0] = p.Position.Longitude;
             //c[1] = p.Position.Latitude;
             //f.Geometry.Coordinates = c;
             var t = api.features.UpdateFeatureAsync(f, l.Id, f.Id);
         }
     });
 }