private void CreateLayer([NotNull] WorkEnvironmentBase environment, [NotNull] string name) { // todo daro: inline LayerDocument layerTemplate = environment.GetLayerDocument(); LayerUtils.ApplyRenderer(AddLayer(name), layerTemplate); }
public string ShowWorklist([NotNull] WorkEnvironmentBase environment, [NotNull] string path) { Assert.ArgumentNotNull(environment, nameof(environment)); Assert.ArgumentNotNullOrEmpty(path, nameof(path)); IWorkList worklist; string name = WorkListUtils.GetName(path).ToLower(); if (_registry.Exists(name)) { worklist = _registry.Get(name); } else { var factory = new XmlBasedWorkListFactory(path, name); if (_registry.TryAdd(factory)) { _msg.Debug($"Add work list {name} from file {path}"); } worklist = _registry.Get(name); } Assert.NotNull(worklist); if (!_viewsByWorklistName.ContainsKey(worklist.Name)) { var item = ProjectItemUtils.Get <WorklistItem>(Path.GetFileName(path)); if (item == null) { Assert.True(ProjectItemUtils.TryAdd(path, out item), $"Cannot add item {path}"); Assert.NotNull(item); } _viewsByWorklistName.Add(worklist.Name, new WorkListObserver(worklist, item)); Uri uri = WorkListUtils.GetDatasource(GetProject().HomeFolderPath, name, environment.FileSuffix); FeatureLayer layer = AddLayer(uri, name, item.Name); // use item name as layer name (and as view display name as well) LayerUtils.ApplyRenderer(layer, environment.GetLayerDocument()); } return(Assert.NotNullOrEmpty(worklist.Name)); }
public async Task CreateWorkListAsync([NotNull] WorkEnvironmentBase environment, [NotNull] string name) { Assert.ArgumentNotNull(environment, nameof(environment)); Assert.ArgumentNotNullOrEmpty(name, nameof(name)); Assert.False(_registry.Exists(name), $"work list {name} already exists"); Uri uri = WorkListUtils.GetDatasource(GetProject().HomeFolderPath, name, environment.FileSuffix); IWorkList worklist = await environment.CreateWorkListAsync(uri.LocalPath, name); if (worklist == null) { return; } // after creation go to nearest item worklist.GoNearest(MapView.Active.Extent); // Commit writes work list definition to disk. // Necessary for adding project item. worklist.Commit(); // wiring work list events, etc. is done in OnDrawComplete // register work list before creating the layer _registry.TryAdd(worklist); Assert.True(ProjectItemUtils.TryAdd(uri.LocalPath, out WorklistItem item), $"cannot add item {worklist.Name}"); if (!_viewsByWorklistName.ContainsKey(worklist.Name)) { _viewsByWorklistName.Add(worklist.Name, new WorkListObserver(worklist, item)); } FeatureLayer layer = AddLayer(uri, name, worklist.DisplayName); LayerUtils.ApplyRenderer(layer, environment.GetLayerDocument()); }