Skip to content

Instantly share code, notes, and snippets.

@dkuida
Last active February 9, 2019 17:54
Show Gist options
  • Select an option

  • Save dkuida/1e7e108f5e116522d4a7603c25d35cc1 to your computer and use it in GitHub Desktop.

Select an option

Save dkuida/1e7e108f5e116522d4a7603c25d35cc1 to your computer and use it in GitHub Desktop.
namespace Example
{
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(() =>
{
var selection = MapView.Active.Map.GetSelection();
selection
.ForEachWithIndex((mapElement, index) =>
{
// logic
});
return (parcelGeometries, sideWalkGeometries);
});
}
}
}
namespace Example
{
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(CadasterModuleStore appStore, UINotifier notifier, IMap activeMap)
{
_notifier = notifier;
_appStore = appStore;
_activeMap = activeMap;
_appStore.ParcelProcessState.Subscribe(async state =>
{
try
{
switch (state.FlowCurrentStep)
{
// UI update logic
}
}
catch (Exception e)
{
LoggerSingleton.Instance.Logger.Warn(e);
}
});
}
}
}
using ArcGIS.Desktop.Framework.Dialogs;
namespace Example
{
public interface UINotifier
{
void Notify(string message);
}
public class MessageBoxNotifier : UINotifier
{
public void Notify(string message)
{
MessageBox.Show(message);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment