protected async Task Load(RecordSet layer) { (long, Pipeline)result = await LoadAsync(layer); Pipeline pipeline = result.Item2; PointViewIterator views = pipeline.Views; if (views != null) { PointView view = views != null ? views.Next : null; if (view != null) { features = BakedPointCloud.Initialize(view.GetBpcData()); view.Dispose(); } views.Dispose(); } pipeline.Dispose(); }
protected Task <int> Load(RecordSet layer) { Task <int> t1 = new Task <int>(() => { List <object> pipe = new List <object>(); string ex = Path.GetExtension(layer.Source).ToLower(); if (ex == ".xyz") { pipe.Add(new { type = "readers.text", filename = layer.Source, }); } else { pipe.Add(layer.Source); } if (layer.Properties.Filter != null) { foreach (Dictionary <string, object> item in layer.Properties.Filter) { pipe.Add(item); } } if (layer.ContainsKey("Crs") && layer.Crs != null && layer.Crs != "") { string crs; AppState.instance.mapProj.ExportToProj4(out crs); pipe.Add(new { type = "filters.reprojection", in_srs = layer.Crs, out_srs = crs }); } if (layer.Properties.ColorInterp != null) { Dictionary <string, object> ci = new Dictionary <string, object>(layer.Properties.ColorInterp); ci.Add("type", "filters.colorinterp"); pipe.Add(ci); } pipe.Add(new { type = "filters.projpipeline", coord_op = "+proj=axisswap +order=1,3,2" }); string json = JsonConvert.SerializeObject(new { pipeline = pipe.ToArray() }); Pipeline pipeline = new Pipeline(json); if (pipeline.Valid == false) { throw new System.NotSupportedException("Layer : " + layer.Id + " - PDAL Pipeline is not valid - check Layer configuration"); } long pointCount = pipeline.Execute(); PointViewIterator views = pipeline.Views; if (views != null) { PointView view = views != null ? views.Next : null; if (view != null) { features = BakedPointCloud.Initialize(view.GetBpcData()); view.Dispose(); } views.Dispose(); } pipeline.Dispose(); return(1); }); t1.Start(TaskScheduler.FromCurrentSynchronizationContext()); return(t1); }