Last active
February 9, 2019 17:54
-
-
Save dkuida/1e7e108f5e116522d4a7603c25d35cc1 to your computer and use it in GitHub Desktop.
Revisions
-
dkuida revised this gist
Feb 9, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ public class MapSteps public ILayerManagement ParcelLayerManager { private get; set; } = new LayerManagement(ParcelLayer); private readonly IMap _activeMap; public MapSteps(CadasterModuleStore appStore, UINotifier notifier, IMap activeMap) { _notifier = notifier; _appStore = appStore; -
dkuida revised this gist
Feb 9, 2019 . 3 changed files with 5 additions and 42 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ namespace Example { public class ActiveMap : IMap { @@ -20,31 +20,11 @@ public IReadOnlyList<Layer> GetLayersAsFlattenedList() return QueuedTask.Run(() => { var selection = MapView.Active.Map.GetSelection(); selection .ForEachWithIndex((mapElement, index) => { // logic }); return (parcelGeometries, sideWalkGeometries); }); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ namespace Example { public class MapSteps { @@ -24,24 +24,7 @@ public MapSteps(UINotifier notifier, CadasterModuleStore appStore, IMap activeMa { switch (state.FlowCurrentStep) { // UI update logic } } catch (Exception e) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ using ArcGIS.Desktop.Framework.Dialogs; namespace Example { public interface UINotifier { -
dkuida revised this gist
Feb 8, 2019 . 1 changed file with 55 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,55 @@ namespace CadasterFlows.Vertices { public class ActiveMap : IMap { private readonly Map _map; public ActiveMap(Map map) { _map = map; } public IReadOnlyList<Layer> GetLayersAsFlattenedList() { return _map.GetLayersAsFlattenedList(); } public Task<(List<Geometry>, List<Geometry>)> GetSelectedGeometries() { return QueuedTask.Run(() => { List<Geometry> parcelGeometries = new List<Geometry>(); List<Geometry> sideWalkGeometries = new List<Geometry>(); var selection = MapView.Active.Map.GetSelection(); selection .ForEachWithIndex((mapElement, index) => { var featureLayer = mapElement.Key as FeatureLayer; var lyrDefn = featureLayer?.GetFeatureClass().GetDefinition(); string shapeField = lyrDefn?.GetShapeField(); var shapeIndex = lyrDefn.FindField(shapeField); QueryFilter filter = new QueryFilter {ObjectIDs = mapElement.Value}; var rowCursor = featureLayer?.Search(filter); while (rowCursor.MoveNext()) { var geometry = (Geometry) rowCursor.Current.GetOriginalValue(shapeIndex); if (featureLayer.Name == ParcelToolConfig.SideWalkLayer) { sideWalkGeometries.Add(geometry); } else { parcelGeometries.Add(geometry); } } }); return (parcelGeometries, sideWalkGeometries); }); } } } -
dkuida revised this gist
Feb 8, 2019 . 1 changed file with 17 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ using ArcGIS.Desktop.Framework.Dialogs; namespace CadasterFlows.Utils { public interface UINotifier { void Notify(string message); } public class MessageBoxNotifier : UINotifier { public void Notify(string message) { MessageBox.Show(message); } } } -
dkuida created this gist
Feb 8, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,54 @@ namespace CadasterFlows.Parcel { public class MapSteps { private readonly UINotifier _notifier; private readonly CadasterModuleStore _appStore; private const string ParcelLayerWorkspace = "temp_parcels"; private const string ParcelLayer = "Parcels"; public ILayerManagement ParcelWorkspaceLayerManager { private get; set; } = new LayerManagement(ParcelLayerWorkspace); public ILayerManagement ParcelLayerManager { private get; set; } = new LayerManagement(ParcelLayer); private readonly IMap _activeMap; public MapSteps(UINotifier notifier, CadasterModuleStore appStore, IMap activeMap) { _notifier = notifier; _appStore = appStore; _activeMap = activeMap; _appStore.ParcelProcessState.Subscribe(async state => { try { switch (state.FlowCurrentStep) { case FlowStep.NotStarted: await CleanWorkspace(); break; case FlowStep.SelectSource: await Start(); break; case FlowStep.EditParcel: await CreateParcel(); break; case FlowStep.SaveParcel: var success = await SaveParcel(); if (success) { _appStore.ParcelProcessState.Dispatch( new StopParcelProcessAction()); } break; } } catch (Exception e) { LoggerSingleton.Instance.Logger.Warn(e); } }); } } }