-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 60499e3
Showing
524 changed files
with
36,133 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"version": 1, | ||
"isRoot": true, | ||
"tools": { | ||
"csharpier": { | ||
"version": "0.28.2", | ||
"commands": [ | ||
"dotnet-csharpier" | ||
] | ||
} | ||
} | ||
} |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
printWidth: 120 | ||
useTabs: false | ||
tabWidth: 2 | ||
preprocessorSymbolSets: | ||
- "" | ||
- "DEBUG" | ||
- "DEBUG,CODE_STYLE" |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Set the default behavior, in case people don't have core.autocrlf set. | ||
* text=auto | ||
|
||
# need original files to be windows | ||
*.txt text eol=crlf |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
**/bin/* | ||
**/obj/* | ||
_ReSharper.SharpCompress/ | ||
bin/ | ||
*.suo | ||
*.user | ||
TestArchives/Scratch/ | ||
TestArchives/Scratch2/ | ||
TestResults/ | ||
*.nupkg | ||
packages/*/ | ||
project.lock.json | ||
tests/TestArchives/Scratch | ||
.vs | ||
tools | ||
.vscode | ||
.idea/ | ||
|
||
.DS_Store | ||
*.snupkg | ||
coverage.xml |
82 changes: 82 additions & 0 deletions
82
Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Bindings/ArcGISReceiveBinding.cs
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
using Speckle.Autofac.DependencyInjection; | ||
using Speckle.Connectors.DUI.Bindings; | ||
using Speckle.Connectors.DUI.Bridge; | ||
using Speckle.Connectors.DUI.Models; | ||
using Speckle.Connectors.DUI.Models.Card; | ||
using Speckle.Connectors.Utils; | ||
using Speckle.Connectors.Utils.Cancellation; | ||
using Speckle.Connectors.Utils.Operations; | ||
|
||
namespace Speckle.Connectors.ArcGIS.Bindings; | ||
|
||
public sealed class ArcGISReceiveBinding : IReceiveBinding | ||
{ | ||
public string Name { get; } = "receiveBinding"; | ||
private readonly CancellationManager _cancellationManager; | ||
private readonly DocumentModelStore _store; | ||
private readonly IUnitOfWorkFactory _unitOfWorkFactory; | ||
|
||
public ReceiveBindingUICommands Commands { get; } | ||
public IBridge Parent { get; } | ||
|
||
public ArcGISReceiveBinding( | ||
DocumentModelStore store, | ||
IBridge parent, | ||
CancellationManager cancellationManager, | ||
IUnitOfWorkFactory unitOfWorkFactory | ||
) | ||
{ | ||
_store = store; | ||
_cancellationManager = cancellationManager; | ||
Parent = parent; | ||
Commands = new ReceiveBindingUICommands(parent); | ||
_unitOfWorkFactory = unitOfWorkFactory; | ||
} | ||
|
||
public async Task Receive(string modelCardId) | ||
{ | ||
try | ||
{ | ||
// Get receiver card | ||
if (_store.GetModelById(modelCardId) is not ReceiverModelCard modelCard) | ||
{ | ||
// Handle as GLOBAL ERROR at BrowserBridge | ||
throw new InvalidOperationException("No download model card was found."); | ||
} | ||
|
||
// Init cancellation token source -> Manager also cancel it if exist before | ||
CancellationTokenSource cts = _cancellationManager.InitCancellationTokenSource(modelCardId); | ||
|
||
using IUnitOfWork<ReceiveOperation> unitOfWork = _unitOfWorkFactory.Resolve<ReceiveOperation>(); | ||
|
||
// Receive host objects | ||
var receiveOperationResults = await unitOfWork.Service | ||
.Execute( | ||
modelCard.AccountId.NotNull(), // POC: I hear -you are saying why we're passing them separately. Not sure pass the DUI3-> Connectors.DUI project dependency to the SDK-> Connector.Utils | ||
modelCard.ProjectId.NotNull(), | ||
modelCard.ProjectName.NotNull(), | ||
modelCard.ModelName.NotNull(), | ||
modelCard.SelectedVersionId.NotNull(), | ||
cts.Token, | ||
(status, progress) => | ||
Commands.SetModelProgress(modelCardId, new ModelCardProgress(modelCardId, status, progress), cts) | ||
) | ||
.ConfigureAwait(false); | ||
|
||
modelCard.BakedObjectIds = receiveOperationResults.BakedObjectIds.ToList(); | ||
Commands.SetModelReceiveResult( | ||
modelCardId, | ||
receiveOperationResults.BakedObjectIds, | ||
receiveOperationResults.ConversionResults | ||
); | ||
} | ||
// Catch here specific exceptions if they related to model card. | ||
catch (OperationCanceledException) | ||
{ | ||
// SWALLOW -> UI handles it immediately, so we do not need to handle anything | ||
return; | ||
} | ||
} | ||
|
||
public void CancelReceive(string modelCardId) => _cancellationManager.CancelOperation(modelCardId); | ||
} |
44 changes: 44 additions & 0 deletions
44
Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Bindings/ArcGISSelectionBinding.cs
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using Speckle.Connectors.DUI.Bindings; | ||
using Speckle.Connectors.DUI.Bridge; | ||
using ArcGIS.Desktop.Mapping.Events; | ||
using ArcGIS.Desktop.Mapping; | ||
|
||
namespace Speckle.Connectors.ArcGIS.Bindings; | ||
|
||
public class ArcGISSelectionBinding : ISelectionBinding | ||
{ | ||
public string Name => "selectionBinding"; | ||
public IBridge Parent { get; } | ||
|
||
public ArcGISSelectionBinding(IBridge parent, ITopLevelExceptionHandler topLevelHandler) | ||
{ | ||
Parent = parent; | ||
|
||
// example: https://github.com/Esri/arcgis-pro-sdk-community-samples/blob/master/Map-Authoring/QueryBuilderControl/DefinitionQueryDockPaneViewModel.cs | ||
// MapViewEventArgs args = new(MapView.Active); | ||
TOCSelectionChangedEvent.Subscribe(_ => topLevelHandler.CatchUnhandled(OnSelectionChanged), true); | ||
} | ||
|
||
private void OnSelectionChanged() | ||
{ | ||
SelectionInfo selInfo = GetSelection(); | ||
Parent.Send(SelectionBindingEvents.SET_SELECTION, selInfo); | ||
} | ||
|
||
public SelectionInfo GetSelection() | ||
{ | ||
MapView mapView = MapView.Active; | ||
List<MapMember> selectedMembers = new(); | ||
selectedMembers.AddRange(mapView.GetSelectedLayers()); | ||
selectedMembers.AddRange(mapView.GetSelectedStandaloneTables()); | ||
|
||
List<string> objectTypes = selectedMembers | ||
.Select(o => o.GetType().ToString().Split(".").Last()) | ||
.Distinct() | ||
.ToList(); | ||
return new SelectionInfo( | ||
selectedMembers.Select(x => x.URI).ToList(), | ||
$"{selectedMembers.Count} layers ({string.Join(", ", objectTypes)})" | ||
); | ||
} | ||
} |
Oops, something went wrong.