Skip to content

Commit

Permalink
Merge pull request #304 from specklesystems/dev
Browse files Browse the repository at this point in the history
Update release/3.0.0 branch with changes from dev
  • Loading branch information
AlanRynne authored Oct 15, 2024
2 parents 94117e0 + da0a35a commit e908484
Show file tree
Hide file tree
Showing 243 changed files with 6,272 additions and 2,479 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
needs: build
env:
IS_TAG_BUILD: ${{ github.ref_type == 'tag' }}
IS_RELEASE_BRANCH: ${{ startsWith(github.ref_name, 'release/') || github.ref_name == 'main'}}
steps:
- name: 🔫 Trigger Build Installers
uses: ALEEF02/[email protected]
Expand All @@ -57,7 +58,7 @@ jobs:
workflow: Build Installers
repo: specklesystems/connector-installers
token: ${{ secrets.CONNECTORS_GH_TOKEN }}
inputs: '{ "run_id": "${{ github.run_id }}", "version": "${{ needs.build.outputs.version }}", "public_release": ${{ env.IS_TAG_BUILD }} }'
inputs: '{ "run_id": "${{ github.run_id }}", "version": "${{ needs.build.outputs.version }}", "public_release": ${{ env.IS_TAG_BUILD }}, "store_artifacts": ${{ env.IS_RELEASE_BRANCH }} }'
ref: main
wait-for-completion: true
wait-for-completion-interval: 10s
Expand Down
14 changes: 14 additions & 0 deletions Build/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@
"System.Threading.Tasks.Dataflow": "8.0.0"
}
},
"Microsoft.NETFramework.ReferenceAssemblies": {
"type": "Direct",
"requested": "[1.0.3, )",
"resolved": "1.0.3",
"contentHash": "vUc9Npcs14QsyOD01tnv/m8sQUnGTGOw1BCmKcv77LBJY7OxhJ+zJF7UD/sCL3lYNFuqmQEVlkfS4Quif6FyYg==",
"dependencies": {
"Microsoft.NETFramework.ReferenceAssemblies.net461": "1.0.3"
}
},
"Microsoft.SourceLink.GitHub": {
"type": "Direct",
"requested": "[8.0.0, )",
Expand Down Expand Up @@ -73,6 +82,11 @@
"resolved": "17.10.4",
"contentHash": "wyABaqY+IHCMMSTQmcc3Ca6vbmg5BaEPgicnEgpll+4xyWZWlkQqUwafweUd9VAhBb4jqplMl6voUHQ6yfdUcg=="
},
"Microsoft.NETFramework.ReferenceAssemblies.net461": {
"type": "Transitive",
"resolved": "1.0.3",
"contentHash": "AmOJZwCqnOCNp6PPcf9joyogScWLtwy0M1WkqfEQ0M9nYwyDD7EX9ZjscKS5iYnyvteX7kzSKFCKt9I9dXA6mA=="
},
"Microsoft.SourceLink.Common": {
"type": "Transitive",
"resolved": "8.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,19 @@ public async Task Receive(string modelCardId)
.ServiceProvider.GetRequiredService<ReceiveOperation>()
.Execute(
modelCard.GetReceiveInfo("ArcGIS"), // POC: get host app name from settings? same for GetSendInfo
cancellationToken,
(status, progress) =>
_operationProgressManager.SetModelProgress(
Parent,
modelCardId,
new ModelCardProgress(modelCardId, status, progress),
cancellationToken
)
_operationProgressManager.CreateOperationProgressEventHandler(Parent, modelCardId, cancellationToken),
cancellationToken
)
.ConfigureAwait(false);

modelCard.BakedObjectIds = receiveOperationResults.BakedObjectIds.ToList();
Commands.SetModelReceiveResult(
modelCardId,
receiveOperationResults.BakedObjectIds,
receiveOperationResults.ConversionResults
);
await Commands
.SetModelReceiveResult(
modelCardId,
receiveOperationResults.BakedObjectIds,
receiveOperationResults.ConversionResults
)
.ConfigureAwait(false);
}
catch (OperationCanceledException)
{
Expand All @@ -104,7 +100,7 @@ public async Task Receive(string modelCardId)
catch (Exception ex) when (!ex.IsFatal()) // UX reasons - we will report operation exceptions as model card error. We may change this later when we have more exception documentation
{
_logger.LogModelCardHandledError(ex);
Commands.SetModelError(modelCardId, ex);
await Commands.SetModelError(modelCardId, ex).ConfigureAwait(false);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
using ArcGIS.Desktop.Mapping;
using ArcGIS.Desktop.Mapping.Events;
using Speckle.Connectors.ArcGIS.Utils;
using Speckle.Connectors.DUI.Bindings;
using Speckle.Connectors.DUI.Bridge;

namespace Speckle.Connectors.ArcGIS.Bindings;

public class ArcGISSelectionBinding : ISelectionBinding
{
private readonly MapMembersUtils _mapMemberUtils;
public string Name => "selectionBinding";
public IBrowserBridge Parent { get; }

public ArcGISSelectionBinding(IBrowserBridge parent)
public ArcGISSelectionBinding(IBrowserBridge parent, MapMembersUtils mapMemberUtils)
{
_mapMemberUtils = mapMemberUtils;
Parent = parent;
var topLevelHandler = parent.TopLevelExceptionHandler;

Expand Down Expand Up @@ -52,14 +55,8 @@ public SelectionInfo GetSelection()
List<MapMember> allNestedMembers = new();
foreach (MapMember member in selectedMembers)
{
if (member is GroupLayer group)
{
GetLayersFromGroup(group, allNestedMembers);
}
else
{
allNestedMembers.Add(member);
}
var layerMapMembers = _mapMemberUtils.UnpackMapLayers(selectedMembers);
allNestedMembers.AddRange(layerMapMembers);
}

List<string> objectTypes = allNestedMembers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Speckle.Connectors.ArcGIS.Filters;
using Speckle.Connectors.ArcGIS.Utils;
using Speckle.Connectors.Common.Caching;
using Speckle.Connectors.Common.Cancellation;
using Speckle.Connectors.Common.Operations;
Expand Down Expand Up @@ -54,6 +55,7 @@ public sealed class ArcGISSendBinding : ISendBinding

private List<FeatureLayer> SubscribedLayers { get; set; } = new();
private List<StandaloneTable> SubscribedTables { get; set; } = new();
private readonly MapMembersUtils _mapMemberUtils;

public ArcGISSendBinding(
DocumentModelStore store,
Expand All @@ -64,7 +66,8 @@ public ArcGISSendBinding(
ISendConversionCache sendConversionCache,
IOperationProgressManager operationProgressManager,
ILogger<ArcGISSendBinding> logger,
IArcGISConversionSettingsFactory arcGisConversionSettingsFactory
IArcGISConversionSettingsFactory arcGisConversionSettingsFactory,
MapMembersUtils mapMemberUtils
)
{
_store = store;
Expand All @@ -76,6 +79,7 @@ IArcGISConversionSettingsFactory arcGisConversionSettingsFactory
_logger = logger;
_topLevelExceptionHandler = parent.TopLevelExceptionHandler;
_arcGISConversionSettingsFactory = arcGisConversionSettingsFactory;
_mapMemberUtils = mapMemberUtils;

Parent = parent;
Commands = new SendBindingUICommands(parent);
Expand All @@ -89,22 +93,32 @@ IArcGISConversionSettingsFactory arcGisConversionSettingsFactory
private void SubscribeToArcGISEvents()
{
LayersRemovedEvent.Subscribe(
a => _topLevelExceptionHandler.CatchUnhandled(() => GetIdsForLayersRemovedEvent(a)),
a =>
_topLevelExceptionHandler.FireAndForget(async () => await GetIdsForLayersRemovedEvent(a).ConfigureAwait(false)),
true
);

StandaloneTablesRemovedEvent.Subscribe(
a => _topLevelExceptionHandler.CatchUnhandled(() => GetIdsForStandaloneTablesRemovedEvent(a)),
a =>
_topLevelExceptionHandler.FireAndForget(
async () => await GetIdsForStandaloneTablesRemovedEvent(a).ConfigureAwait(false)
),
true
);

MapPropertyChangedEvent.Subscribe(
a => _topLevelExceptionHandler.CatchUnhandled(() => GetIdsForMapPropertyChangedEvent(a)),
a =>
_topLevelExceptionHandler.FireAndForget(
async () => await GetIdsForMapPropertyChangedEvent(a).ConfigureAwait(false)
),
true
); // Map units, CRS etc.

MapMemberPropertiesChangedEvent.Subscribe(
a => _topLevelExceptionHandler.CatchUnhandled(() => GetIdsForMapMemberPropertiesChangedEvent(a)),
a =>
_topLevelExceptionHandler.FireAndForget(
async () => await GetIdsForMapMemberPropertiesChangedEvent(a).ConfigureAwait(false)
),
true
); // e.g. Layer name

Expand Down Expand Up @@ -181,28 +195,31 @@ private void SubscribeToAnyDataSourceChange(Table layerTable)
{
RowCreatedEvent.Subscribe(
(args) =>
{
OnRowChanged(args);
},
Parent.TopLevelExceptionHandler.FireAndForget(async () =>
{
await OnRowChanged(args).ConfigureAwait(false);
}),
layerTable
);
RowChangedEvent.Subscribe(
(args) =>
{
OnRowChanged(args);
},
Parent.TopLevelExceptionHandler.FireAndForget(async () =>
{
await OnRowChanged(args).ConfigureAwait(false);
}),
layerTable
);
RowDeletedEvent.Subscribe(
(args) =>
{
OnRowChanged(args);
},
Parent.TopLevelExceptionHandler.FireAndForget(async () =>
{
await OnRowChanged(args).ConfigureAwait(false);
}),
layerTable
);
}

private void OnRowChanged(RowChangedEventArgs args)
private async Task OnRowChanged(RowChangedEventArgs args)
{
if (args == null || MapView.Active == null)
{
Expand Down Expand Up @@ -241,60 +258,38 @@ private void OnRowChanged(RowChangedEventArgs args)
}
}

RunExpirationChecks(false);
await RunExpirationChecks(false).ConfigureAwait(false);
}

private void GetIdsForLayersRemovedEvent(LayerEventsArgs args)
private async Task GetIdsForLayersRemovedEvent(LayerEventsArgs args)
{
foreach (Layer layer in args.Layers)
{
ChangedObjectIds[layer.URI] = 1;
}
RunExpirationChecks(true);
await RunExpirationChecks(true).ConfigureAwait(false);
}

private void GetIdsForStandaloneTablesRemovedEvent(StandaloneTableEventArgs args)
private async Task GetIdsForStandaloneTablesRemovedEvent(StandaloneTableEventArgs args)
{
foreach (StandaloneTable table in args.Tables)
{
ChangedObjectIds[table.URI] = 1;
}
RunExpirationChecks(true);
}

private void AddChangedNestedObjectIds(GroupLayer group)
{
ChangedObjectIds[group.URI] = 1;
foreach (var member in group.Layers)
{
if (member is GroupLayer subGroup)
{
AddChangedNestedObjectIds(subGroup);
}
else
{
ChangedObjectIds[member.URI] = 1;
}
}
await RunExpirationChecks(true).ConfigureAwait(false);
}

private void GetIdsForMapPropertyChangedEvent(MapPropertyChangedEventArgs args)
private async Task GetIdsForMapPropertyChangedEvent(MapPropertyChangedEventArgs args)
{
foreach (Map map in args.Maps)
{
foreach (MapMember member in map.Layers)
List<MapMember> allMapMembers = _mapMemberUtils.GetAllMapMembers(map);
foreach (MapMember member in allMapMembers)
{
if (member is GroupLayer group)
{
AddChangedNestedObjectIds(group);
}
else
{
ChangedObjectIds[member.URI] = 1;
}
ChangedObjectIds[member.URI] = 1;
}
}
RunExpirationChecks(false);
await RunExpirationChecks(false).ConfigureAwait(false);
}

private void GetIdsForLayersAddedEvent(LayerEventsArgs args)
Expand All @@ -316,7 +311,7 @@ private void GetIdsForStandaloneTablesAddedEvent(StandaloneTableEventArgs args)
}
}

private void GetIdsForMapMemberPropertiesChangedEvent(MapMemberPropertiesChangedEventArgs args)
private async Task GetIdsForMapMemberPropertiesChangedEvent(MapMemberPropertiesChangedEventArgs args)
{
// don't subscribe to all events (e.g. expanding group, changing visibility etc.)
bool validEvent = false;
Expand Down Expand Up @@ -344,7 +339,7 @@ private void GetIdsForMapMemberPropertiesChangedEvent(MapMemberPropertiesChanged
{
ChangedObjectIds[member.URI] = 1;
}
RunExpirationChecks(false);
await RunExpirationChecks(false).ConfigureAwait(false);
}
}

Expand Down Expand Up @@ -417,13 +412,7 @@ public async Task Send(string modelCardId)
.Execute(
mapMembers,
modelCard.GetSendInfo("ArcGIS"), // POC: get host app name from settings? same for GetReceiveInfo
(status, progress) =>
_operationProgressManager.SetModelProgress(
Parent,
modelCardId,
new ModelCardProgress(modelCardId, status, progress),
cancellationToken
),
_operationProgressManager.CreateOperationProgressEventHandler(Parent, modelCardId, cancellationToken),
cancellationToken
)
.ConfigureAwait(false);
Expand All @@ -432,7 +421,9 @@ public async Task Send(string modelCardId)
})
.ConfigureAwait(false);

Commands.SetModelSendResult(modelCardId, sendResult.RootObjId, sendResult.ConversionResults);
await Commands
.SetModelSendResult(modelCardId, sendResult.RootObjId, sendResult.ConversionResults)
.ConfigureAwait(false);
}
catch (OperationCanceledException)
{
Expand All @@ -444,7 +435,7 @@ public async Task Send(string modelCardId)
catch (Exception ex) when (!ex.IsFatal()) // UX reasons - we will report operation exceptions as model card error. We may change this later when we have more exception documentation
{
_logger.LogModelCardHandledError(ex);
Commands.SetModelError(modelCardId, ex);
await Commands.SetModelError(modelCardId, ex).ConfigureAwait(false);
}
}

Expand All @@ -453,7 +444,7 @@ public async Task Send(string modelCardId)
/// <summary>
/// Checks if any sender model cards contain any of the changed objects. If so, also updates the changed objects hashset for each model card - this last part is important for on send change detection.
/// </summary>
private void RunExpirationChecks(bool idsDeleted)
private async Task RunExpirationChecks(bool idsDeleted)
{
var senders = _store.GetSenders();
List<string> expiredSenderIds = new();
Expand All @@ -479,7 +470,7 @@ private void RunExpirationChecks(bool idsDeleted)
}
}

Commands.SetModelsExpired(expiredSenderIds);
await Commands.SetModelsExpired(expiredSenderIds).ConfigureAwait(false);
ChangedObjectIds = new();
}
}
Loading

0 comments on commit e908484

Please sign in to comment.