Merge pull request #185 from specklesystems/claire/cnx-849
feat(objects): cnx 849 finalized DataObjects
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Speckle.Objects.BuiltElements;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.GridLine")]
|
||||
public class GridLine : Base, IDisplayValue<List<Base>>
|
||||
{
|
||||
public required ICurve baseLine { get; set; }
|
||||
public string label { get; set; }
|
||||
public string units { get; set; }
|
||||
|
||||
[DetachProperty]
|
||||
public List<Base> displayValue { get; set; }
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.DirectShape")]
|
||||
public class DirectShape : Base, IDisplayValue<List<Base>>
|
||||
{
|
||||
public required string name { get; set; }
|
||||
public RevitCategory category { get; set; }
|
||||
public Base? parameters { get; set; }
|
||||
public string elementId { get; set; }
|
||||
|
||||
[DetachProperty]
|
||||
public List<Base> baseGeometries { get; set; } = new();
|
||||
|
||||
public string units { get; set; }
|
||||
|
||||
[DetachProperty]
|
||||
public List<Base> displayValue { get; set; }
|
||||
|
||||
public bool IsValidObject(Base @base)
|
||||
{
|
||||
return @base is Point || @base is ICurve || @base is Mesh || @base is Brep;
|
||||
}
|
||||
}
|
||||
@@ -1,180 +0,0 @@
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
//This is an enum so that we can easily create a dropdown in GH for schema builder
|
||||
//NOTE: if edited the list in Objects.Converter.Revit.Categories should be updated too
|
||||
public enum RevitCategory
|
||||
{
|
||||
AbutmentFoundations = 0,
|
||||
AbutmentPiles = 1,
|
||||
AbutmentWalls = 2,
|
||||
DuctTerminal = 4,
|
||||
BridgeAbutments = 3,
|
||||
Alignments = 5,
|
||||
StructConnectionAnchors = 6,
|
||||
ApproachSlabs = 7,
|
||||
BridgeArches = 8,
|
||||
AudioVisualDevices = 9,
|
||||
StairsRailingBaluster = 10,
|
||||
BridgeBearings = 11,
|
||||
StructConnectionBolts = 12,
|
||||
BridgeCables = 13,
|
||||
BridgeDecks = 14,
|
||||
BridgeFraming = 15,
|
||||
CableTrayFitting = 16,
|
||||
CableTrayRun = 17,
|
||||
CableTray = 18,
|
||||
Casework = 19,
|
||||
Ceilings = 20,
|
||||
Columns = 21,
|
||||
CommunicationDevices = 22,
|
||||
ConduitFitting = 23,
|
||||
Conduit = 24,
|
||||
Coordination_Model = 25,
|
||||
BridgeFramingCrossBracing = 26,
|
||||
CurtainWallPanels = 27,
|
||||
CurtaSystem = 28,
|
||||
CurtainWallMullions = 29,
|
||||
DataDevices = 30,
|
||||
BridgeFramingDiaphragms = 31,
|
||||
Doors = 32,
|
||||
DuctAccessory = 33,
|
||||
DuctFitting = 34,
|
||||
PlaceHolderDucts = 35,
|
||||
DuctSystem = 36,
|
||||
DuctCurves = 37,
|
||||
ElectricalEquipment = 38,
|
||||
ElectricalFixtures = 39,
|
||||
Entourage = 40,
|
||||
ExpansionJoints = 41,
|
||||
FireAlarmDevices = 42,
|
||||
FireProtection = 43,
|
||||
Floors = 44,
|
||||
FoodServiceEquipment = 45,
|
||||
Furniture = 46,
|
||||
FurnitureSystems = 47,
|
||||
GenericAnnotation = 48,
|
||||
GenericModel = 49,
|
||||
BridgeGirders = 50,
|
||||
Hardscape = 51,
|
||||
LightingDevices = 52,
|
||||
LightingFixtures = 53,
|
||||
Lines = 54,
|
||||
Mass = 55,
|
||||
MechanicalEquipment = 56,
|
||||
MedicalEquipment = 57,
|
||||
NurseCallDevices = 58,
|
||||
Parking = 59,
|
||||
Parts = 60,
|
||||
PierCaps = 61,
|
||||
PierColumns = 62,
|
||||
BridgeFoundations = 63,
|
||||
PierPiles = 64,
|
||||
BridgeTowers = 65,
|
||||
PierWalls = 66,
|
||||
BridgePiers = 67,
|
||||
PipeAccessory = 68,
|
||||
PipeFitting = 69,
|
||||
PlaceHolderPipes = 70,
|
||||
PipeSegments = 71,
|
||||
PipeCurves = 72,
|
||||
PipingSystem = 73,
|
||||
Planting = 74,
|
||||
StructConnectionPlates = 75,
|
||||
PlumbingFixtures = 76,
|
||||
StructConnectionProfiles = 77,
|
||||
StairsRailing = 78,
|
||||
Ramps = 79,
|
||||
Roads = 80,
|
||||
Roofs = 81,
|
||||
SecurityDevices = 82,
|
||||
StructConnectionShearStuds = 83,
|
||||
Signage = 84,
|
||||
Site = 85,
|
||||
SpecialityEquipment = 86,
|
||||
Sprinklers = 87,
|
||||
Stairs = 88,
|
||||
StructuralFramingSystem = 89,
|
||||
StructuralColumns = 90,
|
||||
StructConnections = 91,
|
||||
FabricAreas = 92,
|
||||
StructuralFoundation = 93,
|
||||
StructuralFraming = 94,
|
||||
Rebar = 95,
|
||||
Coupler = 96,
|
||||
StructuralStiffener = 97,
|
||||
StructuralTendons = 98,
|
||||
StructuralTruss = 99,
|
||||
TemporaryStructure = 100,
|
||||
Topography = 101,
|
||||
BridgeFramingTrusses = 102,
|
||||
VerticalCirculation = 103,
|
||||
VibrationDampers = 104,
|
||||
VibrationIsolators = 105,
|
||||
VibrationManagement = 106,
|
||||
Walls = 107,
|
||||
StructConnectionWelds = 108,
|
||||
Windows = 109,
|
||||
Railings = 110,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// FamilyDocuments can only be assigned these categories
|
||||
/// This is a subset of the list above which was manually retrieved from Revit's UI
|
||||
/// </summary>
|
||||
public enum RevitFamilyCategory
|
||||
{
|
||||
AudioVisualDevices = 9,
|
||||
CableTrayFitting = 16,
|
||||
Casework = 19,
|
||||
Columns = 21,
|
||||
CommunicationDevices = 22,
|
||||
ConduitFitting = 23,
|
||||
DataDevices = 30,
|
||||
Doors = 32,
|
||||
DuctAccessory = 33,
|
||||
DuctFitting = 34,
|
||||
ElectricalEquipment = 38,
|
||||
ElectricalFixtures = 39,
|
||||
Entourage = 40,
|
||||
FireAlarmDevices = 42,
|
||||
FireProtection = 43,
|
||||
FoodServiceEquipment = 45,
|
||||
Furniture = 46,
|
||||
FurnitureSystems = 47,
|
||||
GenericModel = 49,
|
||||
Hardscape = 51,
|
||||
LightingDevices = 52,
|
||||
LightingFixtures = 53,
|
||||
Mass = 55,
|
||||
MechanicalEquipment = 56,
|
||||
MedicalEquipment = 57,
|
||||
NurseCallDevices = 58,
|
||||
Parking = 59,
|
||||
PipeAccessory = 68,
|
||||
PipeFitting = 69,
|
||||
Planting = 74,
|
||||
PlumbingFixtures = 76,
|
||||
Roads = 80,
|
||||
SecurityDevices = 82,
|
||||
Signage = 84,
|
||||
Site = 85,
|
||||
SpecialityEquipment = 86,
|
||||
Sprinklers = 87,
|
||||
StructuralFramingSystem = 89,
|
||||
StructuralColumns = 90,
|
||||
StructConnections = 91,
|
||||
StructuralFoundation = 93,
|
||||
StructuralFraming = 94,
|
||||
StructuralStiffener = 97,
|
||||
TemporaryStructure = 100,
|
||||
VerticalCirculation = 103,
|
||||
Windows = 109,
|
||||
Railings = 110,
|
||||
}
|
||||
|
||||
public enum LocationLine
|
||||
{
|
||||
Centerline,
|
||||
Exterior,
|
||||
Interior,
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Speckle.Objects.Data;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a ArcGIS.Core.CoreObjectsBase object in ArcGIS
|
||||
/// </summary>
|
||||
[SpeckleType("Objects.Data.ArcgisObject")]
|
||||
public class ArcgisObject : Base, IGisObject
|
||||
{
|
||||
public required string name { get; set; }
|
||||
public required string type { get; set; }
|
||||
|
||||
[DetachProperty]
|
||||
public required List<Base> displayValue { get; set; }
|
||||
|
||||
public required Dictionary<string, object?> properties { get; set; }
|
||||
|
||||
public required string units { get; set; }
|
||||
|
||||
IReadOnlyList<Base> IDisplayValue<IReadOnlyList<Base>>.displayValue => displayValue;
|
||||
}
|
||||
@@ -5,8 +5,8 @@ namespace Speckle.Objects.Data;
|
||||
/// <summary>
|
||||
/// Represents an Autodesk.Civil.DatabaseServices.Entity object in Civil3d
|
||||
/// </summary>
|
||||
[SpeckleType("Objects.Data.CivilObject")]
|
||||
public class CivilObject : Base, ICivilObject
|
||||
[SpeckleType("Objects.Data.Civil3dObject")]
|
||||
public class Civil3dObject : Base, ICivilObject
|
||||
{
|
||||
public required string name { get; set; }
|
||||
public required string type { get; set; }
|
||||
@@ -20,13 +20,16 @@ public class CivilObject : Base, ICivilObject
|
||||
/// Children objects, eg profiles, this civil entity may contain.
|
||||
/// </summary>
|
||||
[DetachProperty]
|
||||
public required List<CivilObject> elements { get; set; }
|
||||
public required List<Base> elements { get; set; }
|
||||
|
||||
[DetachProperty]
|
||||
public required List<Base> displayValue { get; set; }
|
||||
|
||||
public required Dictionary<string, object?> properties { get; set; }
|
||||
|
||||
public required string units { get; set; }
|
||||
|
||||
IReadOnlyList<ICivilObject> ICivilObject.elements => elements;
|
||||
IReadOnlyList<Base> ICivilObject.elements => elements;
|
||||
|
||||
IReadOnlyList<Base> IDataObject.displayValue => displayValue;
|
||||
IReadOnlyList<Base> IDisplayValue<IReadOnlyList<Base>>.displayValue => displayValue;
|
||||
}
|
||||
@@ -10,5 +10,7 @@ public class DataObject : Base, IDataObject
|
||||
[DetachProperty]
|
||||
public required List<Base> displayValue { get; set; }
|
||||
|
||||
IReadOnlyList<Base> IDataObject.displayValue => displayValue;
|
||||
public required Dictionary<string, object?> properties { get; set; }
|
||||
|
||||
IReadOnlyList<Base> IDisplayValue<IReadOnlyList<Base>>.displayValue => displayValue;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Speckle.Objects.Data;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a wrapper object in ETABS
|
||||
/// </summary>
|
||||
[SpeckleType("Objects.Data.EtabsObject")]
|
||||
public class EtabsObject : Base, ICsiObject
|
||||
{
|
||||
public required string name { get; set; }
|
||||
public required string type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Children objects, eg joints, this etabs object may contain.
|
||||
/// </summary>
|
||||
[DetachProperty]
|
||||
public required List<EtabsObject> elements { get; set; }
|
||||
|
||||
[DetachProperty]
|
||||
public required List<Base> displayValue { get; set; }
|
||||
|
||||
public required Dictionary<string, object?> properties { get; set; }
|
||||
|
||||
public required string units { get; set; }
|
||||
|
||||
IReadOnlyList<ICsiObject> ICsiObject.elements => elements;
|
||||
|
||||
IReadOnlyList<Base> IDisplayValue<IReadOnlyList<Base>>.displayValue => displayValue;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Speckle.Objects.Data;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a "first selectable ancestor" Navisworks.ModelItem object in Navisworks
|
||||
/// </summary>
|
||||
[SpeckleType("Objects.Data.NavisworksObject")]
|
||||
public class NavisworksObject : Base, INavisworksObject
|
||||
{
|
||||
public required string name { get; set; }
|
||||
|
||||
[DetachProperty]
|
||||
public required List<Base> displayValue { get; set; }
|
||||
|
||||
public required Dictionary<string, object?> properties { get; set; }
|
||||
|
||||
public required string units { get; set; }
|
||||
|
||||
IReadOnlyList<Base> IDisplayValue<IReadOnlyList<Base>>.displayValue => displayValue;
|
||||
}
|
||||
@@ -25,11 +25,14 @@ public class RevitObject : Base, IRevitObject
|
||||
[DetachProperty]
|
||||
public required List<RevitObject> elements { get; set; }
|
||||
|
||||
[DetachProperty]
|
||||
public required List<Mesh> displayValue { get; set; }
|
||||
|
||||
public required Dictionary<string, object?> properties { get; set; }
|
||||
|
||||
public required string units { get; set; }
|
||||
|
||||
IReadOnlyList<IRevitObject> IRevitObject.elements => elements;
|
||||
|
||||
IReadOnlyList<Base> IDataObject.displayValue => displayValue;
|
||||
IReadOnlyList<Base> IDisplayValue<IReadOnlyList<Base>>.displayValue => displayValue;
|
||||
}
|
||||
|
||||
@@ -17,11 +17,14 @@ public class TeklaObject : Base, ITeklaObject
|
||||
[DetachProperty]
|
||||
public required List<TeklaObject> elements { get; set; }
|
||||
|
||||
[DetachProperty]
|
||||
public required List<Base> displayValue { get; set; }
|
||||
|
||||
public required Dictionary<string, object?> properties { get; set; }
|
||||
|
||||
public required string units { get; set; }
|
||||
|
||||
IReadOnlyList<ITeklaObject> ITeklaObject.elements => elements;
|
||||
|
||||
IReadOnlyList<Base> IDataObject.displayValue => displayValue;
|
||||
IReadOnlyList<Base> IDisplayValue<IReadOnlyList<Base>>.displayValue => displayValue;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace Speckle.Objects.Deprecated;
|
||||
[DeprecatedSpeckleType("Objects.Other.BlockInstance")]
|
||||
[DeprecatedSpeckleType("Objects.Other.Revit.RevitInstance")]
|
||||
[DeprecatedSpeckleType("Objects.BuiltElements.View")]
|
||||
[DeprecatedSpeckleType("Objects.BuiltElements.GridLine")]
|
||||
[DeprecatedSpeckleType("Objects.Other.BlockDefinition")]
|
||||
[DeprecatedSpeckleType("Objects.Other.DisplayStyle")]
|
||||
[DeprecatedSpeckleType("Objects.Other.Material")]
|
||||
@@ -13,4 +14,5 @@ namespace Speckle.Objects.Deprecated;
|
||||
[DeprecatedSpeckleType("Objects.Other.Revit.RevitMaterial")]
|
||||
[DeprecatedSpeckleType("Objects.BuiltElements.Revit.Parameter")]
|
||||
[DeprecatedSpeckleType("Objects.BuiltElements.Revit.Curve.ModelCurve")]
|
||||
[DeprecatedSpeckleType("Objects.BuiltElements.Revit.DirectShape")]
|
||||
public class LegacyV2 : Base { }
|
||||
|
||||
@@ -83,6 +83,29 @@ public interface ITransformable : ISpeckleObject
|
||||
bool TransformTo(Transform transform, out ITransformable transformed);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Specifies displayable <see cref="Base"/> simple geometries to be used as a fallback
|
||||
/// if a displayable form cannot be converted.
|
||||
/// </summary>
|
||||
/// <example>
|
||||
/// <see cref="Base"/> objects that represent conceptual / abstract / mathematically derived geometry
|
||||
/// can use <see cref="displayValue"/> to be used in case the object lacks a natively displayable form.
|
||||
/// (e.g <see cref="Spiral"/>)
|
||||
/// </example>
|
||||
/// <typeparam name="T">
|
||||
/// Type of display value.
|
||||
/// Expected to be either a <see cref="Base"/> type or a <see cref="List{T}"/> of <see cref="Base"/>s,
|
||||
/// Should be constrained to types of <see cref="Point"/>, <see cref="Line"/>, <see cref="Mesh"/> or <see cref="Polyline"/>.
|
||||
/// </typeparam>
|
||||
public interface IDisplayValue<out T> : ISpeckleObject
|
||||
{
|
||||
/// <summary>
|
||||
/// <see cref="displayValue"/> <see cref="Base"/>(s) will be used to display this <see cref="Base"/>
|
||||
/// if a native displayable object cannot be converted.
|
||||
/// </summary>
|
||||
T displayValue { get; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GIS
|
||||
@@ -96,36 +119,19 @@ public interface IGisFeature : ISpeckleObject
|
||||
#region Data objects
|
||||
|
||||
/// <summary>
|
||||
/// Specifies displayable <see cref="Base"/> value(s) to be used as a fallback
|
||||
/// if a displayable form cannot be converted.
|
||||
/// Specifies properties on objects to be used for data-based workflows
|
||||
/// </summary>
|
||||
/// <example>
|
||||
/// <see cref="Base"/> objects that represent conceptual / abstract / mathematically derived geometry
|
||||
/// can use <see cref="displayValue"/> to be used in case the object lacks a natively displayable form.
|
||||
/// (e.g <see cref="Spiral"/>)
|
||||
/// </example>
|
||||
/// <typeparam name="T">
|
||||
/// Type of display value.
|
||||
/// Expected to be either a <see cref="Base"/> type or a <see cref="List{T}"/> of <see cref="Base"/>s,
|
||||
/// most likely <see cref="Mesh"/> or <see cref="Polyline"/>.
|
||||
/// </typeparam>
|
||||
public interface IDisplayValue<out T> : ISpeckleObject
|
||||
public interface IProperties : ISpeckleObject
|
||||
{
|
||||
/// <summary>
|
||||
/// <see cref="displayValue"/> <see cref="Base"/>(s) will be used to display this <see cref="Base"/>
|
||||
/// if a native displayable object cannot be converted.
|
||||
/// </summary>
|
||||
T displayValue { get; }
|
||||
Dictionary<string, object?> properties { get; }
|
||||
}
|
||||
|
||||
public interface IDataObject : ISpeckleObject
|
||||
public interface IDataObject : ISpeckleObject, IProperties, IDisplayValue<IReadOnlyList<Base>>
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of the object, primarily used to decorate the object for consumption in frontend and other apps
|
||||
/// </summary>
|
||||
string name { get; }
|
||||
|
||||
[DetachProperty]
|
||||
IReadOnlyList<Base> displayValue { get; }
|
||||
|
||||
// POC: we should add "properties" field here once we formalize the struct
|
||||
}
|
||||
|
||||
public interface IRevitObject : IDataObject
|
||||
@@ -138,7 +144,6 @@ public interface IRevitObject : IDataObject
|
||||
|
||||
Base? location { get; }
|
||||
|
||||
[DetachProperty]
|
||||
IReadOnlyList<IRevitObject> elements { get; }
|
||||
}
|
||||
|
||||
@@ -148,15 +153,29 @@ public interface ICivilObject : IDataObject
|
||||
|
||||
List<ICurve>? baseCurves { get; }
|
||||
|
||||
[DetachProperty]
|
||||
IReadOnlyList<ICivilObject> elements { get; }
|
||||
IReadOnlyList<Base> elements { get; }
|
||||
}
|
||||
|
||||
public interface ITeklaObject : IDataObject
|
||||
{
|
||||
string type { get; }
|
||||
|
||||
[DetachProperty]
|
||||
IReadOnlyList<ITeklaObject> elements { get; }
|
||||
}
|
||||
|
||||
public interface ICsiObject : IDataObject
|
||||
{
|
||||
string type { get; }
|
||||
|
||||
IReadOnlyList<ICsiObject> elements { get; }
|
||||
}
|
||||
|
||||
public interface IGisObject : IDataObject
|
||||
{
|
||||
string type { get; }
|
||||
}
|
||||
|
||||
public interface INavisworksObject : IDataObject { }
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Collections;
|
||||
using NUnit.Framework;
|
||||
using Speckle.Objects.BuiltElements.Revit;
|
||||
using Speckle.Objects.Data;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Common;
|
||||
using Speckle.Sdk.Models;
|
||||
@@ -14,10 +14,9 @@ public class ShallowCopyTests
|
||||
public void CanShallowCopy_Wall()
|
||||
{
|
||||
const string UNITS = Units.Meters;
|
||||
var ds = new DirectShape()
|
||||
var ds = new DataObject()
|
||||
{
|
||||
name = "directShape",
|
||||
units = UNITS,
|
||||
displayValue = new List<Base>
|
||||
{
|
||||
new Mesh
|
||||
@@ -33,6 +32,7 @@ public class ShallowCopyTests
|
||||
units = UNITS,
|
||||
},
|
||||
},
|
||||
properties = new Dictionary<string, object?>(),
|
||||
};
|
||||
|
||||
var shallow = ds.ShallowCopy();
|
||||
|
||||
@@ -5,7 +5,7 @@ using NUnit.Framework;
|
||||
using Shouldly;
|
||||
using Speckle.Newtonsoft.Json;
|
||||
using Speckle.Newtonsoft.Json.Linq;
|
||||
using Speckle.Objects.BuiltElements;
|
||||
using Speckle.Objects.Data;
|
||||
using Speckle.Sdk.Common;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
@@ -41,7 +41,7 @@ public class SerializationTests
|
||||
public void Setup()
|
||||
{
|
||||
TypeLoader.Reset();
|
||||
TypeLoader.Initialize(typeof(Base).Assembly, typeof(GridLine).Assembly, _assembly);
|
||||
TypeLoader.Initialize(typeof(Base).Assembly, typeof(DataObject).Assembly, _assembly);
|
||||
}
|
||||
|
||||
private async Task<string> ReadJson(string fullName)
|
||||
|
||||
Reference in New Issue
Block a user