Skip to content

Commit

Permalink
Merge branch 'dui3/alpha' into dui3/ci/github-actions-test
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhathcock committed May 21, 2024
2 parents 4bae07d + bd17826 commit 3bc1bf8
Show file tree
Hide file tree
Showing 46 changed files with 780 additions and 937 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using Speckle.Autofac.DependencyInjection;
using Speckle.Connectors.ArcGIS.Bindings;
using Speckle.Connectors.ArcGis.Operations.Send;
using Speckle.Connectors.DUI.Bindings;
using Speckle.Connectors.ArcGIS.Utils;
using Speckle.Connectors.ArcGIS.Operations.Receive;
using Speckle.Connectors.DUI.Models.Card.SendFilter;
using Speckle.Connectors.DUI.WebView;
using Speckle.Connectors.Utils.Builders;
using Speckle.Autofac;
using Speckle.Connectors.ArcGIS.Filters;
using Speckle.Connectors.DUI;
using Speckle.Connectors.DUI.Models;
using Speckle.Connectors.Utils;
using Speckle.Core.Models.GraphTraversal;

// POC: This is a temp reference to root object senders to tweak CI failing after having generic interfaces into common project.
// This should go whenever it is aligned.

namespace Speckle.Connectors.ArcGIS.DependencyInjection;

public class ArcGISConnectorModule : ISpeckleModule
{
public void Load(SpeckleContainerBuilder builder)
{
builder.AddAutofac();
builder.AddConnectorUtils();
builder.AddDUI();
builder.AddDUIView();

builder.AddSingleton<DocumentModelStore, ArcGISDocumentStore>();

// Register bindings
builder.AddSingleton<IBinding, TestBinding>();
builder.AddSingleton<IBinding, ConfigBinding>("connectorName", "ArcGIS"); // POC: Easier like this for now, should be cleaned up later
builder.AddSingleton<IBinding, AccountBinding>();
builder.AddSingleton<IBinding, BasicConnectorBinding>();
builder.AddSingleton<IBasicConnectorBinding, BasicConnectorBinding>();
builder.AddSingleton<IBinding, ArcGISSelectionBinding>();
builder.AddSingleton<IBinding, ArcGISSendBinding>();
builder.AddSingleton<IBinding, ArcGISReceiveBinding>();

builder.AddTransient<ISendFilter, ArcGISSelectionFilter>();
builder.AddScoped<IHostObjectBuilder, HostObjectBuilder>();
builder.AddSingleton(DefaultTraversal.CreateTraversalFunc());

// register send operation and dependencies
builder.AddScoped<SendOperation>();
builder.AddScoped<RootObjectBuilder>();
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@

<ItemGroup>
<PackageReference Include="Esri.ArcGISPro.Extensions30" Version="3.2.0.49743" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
using System.Reflection;
using ArcGIS.Desktop.Framework;
using Autofac;
using Speckle.Autofac;
using Speckle.Autofac.DependencyInjection;
using Speckle.Autofac.Files;
using Speckle.Connectors.ArcGIS.HostApp;
using Speckle.Converters.Common.Objects;
using Speckle.Core.Kits;
using Speckle.Converters.Common.DependencyInjection;
using Module = ArcGIS.Desktop.Framework.Contracts.Module;

namespace Speckle.Connectors.ArcGIS;
Expand All @@ -24,19 +21,21 @@ internal sealed class SpeckleModule : Module
public static SpeckleModule Current =>
s_this ??= (SpeckleModule)FrameworkApplication.FindModule("ConnectorArcGIS_Module");

public AutofacContainer Container { get; }
public SpeckleContainer Container { get; }

public SpeckleModule()
{
AppDomain.CurrentDomain.AssemblyResolve += AssemblyResolver.OnAssemblyResolve<SpeckleModule>;

Container = new AutofacContainer(new StorageInfo());
Container.PreBuildEvent += Container_PreBuildEvent;
var builder = SpeckleContainerBuilder.CreateInstance();

// Register Settings
var arcgisSettings = new ArcGISSettings(HostApplications.ArcGIS, HostAppVersion.v3);

Container.LoadAutofacModules(arcgisSettings.Modules).AddSingletonInstance(arcgisSettings).Build();
Container = builder
.LoadAutofacModules(Assembly.GetExecutingAssembly(), arcgisSettings.Modules)
.AddSingleton(arcgisSettings)
.Build();
}

/// <summary>
Expand All @@ -49,11 +48,4 @@ protected override bool CanUnload()
//return false to ~cancel~ Application close
return true;
}

private static void Container_PreBuildEvent(object? sender, ContainerBuilder containerBuilder)
{
containerBuilder.RegisterRawConversions();
containerBuilder.InjectNamedTypes<IHostObjectToSpeckleConversion>();
containerBuilder.InjectNamedTypes<ISpeckleObjectToHostConversion>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace Speckle.Connectors.ArcGIS.Utils;

public class ArcGISDocumentStore : DocumentModelStore
{
public ArcGISDocumentStore(JsonSerializerSettings serializerOption, bool writeToFileOnChange)
: base(serializerOption, writeToFileOnChange)
public ArcGISDocumentStore(JsonSerializerSettings serializerOption)
: base(serializerOption, true)
{
ActiveMapViewChangedEvent.Subscribe(OnMapViewChanged);
ProjectSavingEvent.Subscribe(OnProjectSaving);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
<ProjectReference Include="..\..\..\Sdk\Speckle.Converters.Common\Speckle.Converters.Common.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="Speckle.AutoCAD.API" Version="2023.0.0" />
</ItemGroup>
<Import Project="..\Speckle.Connectors.AutocadShared\Speckle.Connectors.AutocadShared.projitems" Label="Shared" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
using Autodesk.AutoCAD.DatabaseServices;
using Speckle.Autofac;
using Speckle.Autofac.DependencyInjection;
using Speckle.Connectors.Autocad.Bindings;
using Speckle.Connectors.Autocad.Filters;
using Speckle.Connectors.Autocad.HostApp;
using Speckle.Connectors.Autocad.Interfaces;
using Speckle.Connectors.Autocad.Operations.Receive;
using Speckle.Connectors.Autocad.Operations.Send;
using Speckle.Connectors.Autocad.Plugin;
using Speckle.Connectors.DUI;
using Speckle.Connectors.DUI.Bindings;
using Speckle.Connectors.DUI.Models;
using Speckle.Connectors.DUI.Models.Card.SendFilter;
using Speckle.Connectors.DUI.WebView;
using Speckle.Connectors.Utils;
using Speckle.Connectors.Utils.Builders;
using Speckle.Connectors.Utils.Operations;
using Speckle.Converters.Autocad;
using Speckle.Converters.Common;
using Speckle.Core.Models.GraphTraversal;

namespace Speckle.Connectors.Autocad.DependencyInjection;

public class AutocadConnectorModule : ISpeckleModule
{
public void Load(SpeckleContainerBuilder builder)
{
builder.AddAutofac();
builder.AddConnectorUtils();
builder.AddDUI();
builder.AddDUIView();

// Register other connector specific types
builder.AddSingleton<IAutocadPlugin, AutocadPlugin>();
builder.AddTransient<TransactionContext>();
builder.AddSingleton(new AutocadDocumentManager()); // TODO: Dependent to TransactionContext, can be moved to AutocadContext
builder.AddSingleton<DocumentModelStore, AutocadDocumentStore>();
builder.AddSingleton<AutocadContext>();
builder.AddSingleton<AutocadLayerManager>();
builder.AddSingleton<AutocadIdleManager>();

// Operations
builder.AddScoped<SendOperation<(DBObject obj, string applicationId)>>();
builder.AddSingleton(DefaultTraversal.CreateTraversalFunc());

// Object Builders
builder.AddScoped<IHostObjectBuilder, HostObjectBuilder>();
builder.AddSingleton<IRootObjectBuilder<(DBObject obj, string applicationId)>, RootObjectBuilder>();

// Register bindings

builder.AddSingleton<IBinding, TestBinding>();
builder.AddSingleton<IBinding, ConfigBinding>("connectorName", "Autocad"); // POC: Easier like this for now, should be cleaned up later
builder.AddSingleton<IBinding, AccountBinding>();
builder.AddSingleton<IBinding, AutocadBasicConnectorBinding>();
builder.AddSingleton<IBasicConnectorBinding, AutocadBasicConnectorBinding>();
builder.AddSingleton<IBinding, AutocadSelectionBinding>();
builder.AddSingleton<IBinding, AutocadSendBinding>();
builder.AddSingleton<IBinding, AutocadReceiveBinding>();

builder.AddSingleton<IHostToSpeckleUnitConverter<UnitsValue>, AutocadToSpeckleUnitConverter>();

// register send filters
builder.AddTransient<ISendFilter, AutocadSelectionFilter>();
}
}
Loading

0 comments on commit 3bc1bf8

Please sign in to comment.