|
|
@@ -1,18 +1,25 @@
|
|
|
-using OneOf;
|
|
|
-using SharpGLTF.Memory;
|
|
|
-using SharpGLTF.Validation;
|
|
|
-using System;
|
|
|
+using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Globalization;
|
|
|
+using System.Linq;
|
|
|
+using System.Reflection;
|
|
|
|
|
|
-namespace SharpGLTF.Schema2
|
|
|
+using OneOf;
|
|
|
+
|
|
|
+namespace SharpGLTF.Schema2.Tiles3D
|
|
|
{
|
|
|
- public static class ExtStructuralMetadataRoot
|
|
|
+ using Collections;
|
|
|
+ using Memory;
|
|
|
+ using Validation;
|
|
|
+
|
|
|
+ using METADATAORURI = OneOf<StructuralMetadataSchema, Uri>;
|
|
|
+
|
|
|
+ partial class Tiles3DExtensions
|
|
|
{
|
|
|
public static void SetPropertyAttribute(
|
|
|
this ModelRoot modelRoot,
|
|
|
PropertyAttribute propertyAttribute,
|
|
|
- OneOf<StructuralMetadataSchema, Uri> schema)
|
|
|
+ METADATAORURI schema)
|
|
|
{
|
|
|
SetPropertyAttributes(modelRoot, new List<PropertyAttribute>() { propertyAttribute }, schema);
|
|
|
}
|
|
|
@@ -20,12 +27,13 @@ namespace SharpGLTF.Schema2
|
|
|
public static void SetPropertyAttributes(
|
|
|
this ModelRoot modelRoot,
|
|
|
List<PropertyAttribute> propertyAttributes,
|
|
|
-OneOf<StructuralMetadataSchema, Uri> schema)
|
|
|
+METADATAORURI schema)
|
|
|
{
|
|
|
if (propertyAttributes == null || propertyAttributes.Count == 0) { modelRoot.RemoveExtensions<EXTStructuralMetadataRoot>(); return; }
|
|
|
|
|
|
var ext = modelRoot.UseExtension<EXTStructuralMetadataRoot>();
|
|
|
- ext.PropertyAttributes = propertyAttributes;
|
|
|
+ // ext.PropertyAttributes = propertyAttributes;
|
|
|
+ throw new NotImplementedException();
|
|
|
ext.AddSchema(schema);
|
|
|
}
|
|
|
|
|
|
@@ -33,7 +41,7 @@ OneOf<StructuralMetadataSchema, Uri> schema)
|
|
|
public static void SetPropertyTexture(
|
|
|
this ModelRoot modelRoot,
|
|
|
PropertyTexture propertyTexture,
|
|
|
- OneOf<StructuralMetadataSchema, Uri> schema)
|
|
|
+ METADATAORURI schema)
|
|
|
{
|
|
|
SetPropertyTextures(modelRoot, new List<PropertyTexture>() { propertyTexture }, schema);
|
|
|
}
|
|
|
@@ -42,19 +50,20 @@ OneOf<StructuralMetadataSchema, Uri> schema)
|
|
|
public static void SetPropertyTextures(
|
|
|
this ModelRoot modelRoot,
|
|
|
List<PropertyTexture> propertyTextures,
|
|
|
- OneOf<StructuralMetadataSchema, Uri> schema)
|
|
|
+ METADATAORURI schema)
|
|
|
{
|
|
|
if (propertyTextures == null || propertyTextures.Count == 0) { modelRoot.RemoveExtensions<EXTStructuralMetadataRoot>(); return; }
|
|
|
|
|
|
var ext = modelRoot.UseExtension<EXTStructuralMetadataRoot>();
|
|
|
- ext.PropertyTextures = propertyTextures;
|
|
|
+ // ext.PropertyTextures = propertyTextures;
|
|
|
+ throw new NotImplementedException();
|
|
|
ext.AddSchema(schema);
|
|
|
}
|
|
|
|
|
|
public static void SetPropertyTable(
|
|
|
this ModelRoot modelRoot,
|
|
|
PropertyTable propertyTable,
|
|
|
- OneOf<StructuralMetadataSchema, Uri> schema)
|
|
|
+ METADATAORURI schema)
|
|
|
{
|
|
|
SetPropertyTables(modelRoot, new List<PropertyTable>() { propertyTable }, schema);
|
|
|
}
|
|
|
@@ -62,12 +71,13 @@ OneOf<StructuralMetadataSchema, Uri> schema)
|
|
|
public static void SetPropertyTables(
|
|
|
this ModelRoot modelRoot,
|
|
|
List<PropertyTable> propertyTables,
|
|
|
- OneOf<StructuralMetadataSchema, Uri> schema)
|
|
|
+ METADATAORURI schema)
|
|
|
{
|
|
|
if (propertyTables == null || propertyTables.Count == 0) { modelRoot.RemoveExtensions<EXTStructuralMetadataRoot>(); return; }
|
|
|
|
|
|
var ext = modelRoot.UseExtension<EXTStructuralMetadataRoot>();
|
|
|
- ext.PropertyTables = propertyTables;
|
|
|
+ // ext.PropertyTables = propertyTables;
|
|
|
+ throw new NotImplementedException();
|
|
|
ext.AddSchema(schema);
|
|
|
}
|
|
|
|
|
|
@@ -130,61 +140,77 @@ OneOf<StructuralMetadataSchema, Uri> schema)
|
|
|
|
|
|
public partial class EXTStructuralMetadataRoot
|
|
|
{
|
|
|
- private ModelRoot modelRoot;
|
|
|
+ #region lifecycle
|
|
|
|
|
|
internal EXTStructuralMetadataRoot(ModelRoot modelRoot)
|
|
|
{
|
|
|
this.modelRoot = modelRoot;
|
|
|
- _propertyTables = new List<PropertyTable>();
|
|
|
- _propertyAttributes = new List<PropertyAttribute>();
|
|
|
- _propertyTextures = new List<PropertyTexture>();
|
|
|
+ _propertyTables = new ChildrenList<PropertyTable, EXTStructuralMetadataRoot>(this);
|
|
|
+ _propertyAttributes = new ChildrenList<PropertyAttribute, EXTStructuralMetadataRoot>(this);
|
|
|
+ _propertyTextures = new ChildrenList<PropertyTexture, EXTStructuralMetadataRoot>(this);
|
|
|
}
|
|
|
|
|
|
- internal void AddSchema(OneOf<StructuralMetadataSchema, Uri> schema)
|
|
|
+ protected override IEnumerable<ExtraProperties> GetLogicalChildren()
|
|
|
{
|
|
|
- schema.Switch(
|
|
|
- StructuralMetadataSchema => _schema = StructuralMetadataSchema,
|
|
|
- Uri => this.SchemaUri = Uri.ToString()
|
|
|
- );
|
|
|
- }
|
|
|
+ var items = base.GetLogicalChildren()
|
|
|
+ .Concat(_propertyTables)
|
|
|
+ .Concat(_propertyAttributes)
|
|
|
+ .Concat(_propertyTextures);
|
|
|
|
|
|
- internal List<PropertyTable> PropertyTables
|
|
|
- {
|
|
|
- get { return _propertyTables; }
|
|
|
- set { _propertyTables = value; }
|
|
|
+ if (Schema != null) items = items.Append(Schema);
|
|
|
+
|
|
|
+ return items;
|
|
|
}
|
|
|
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region data
|
|
|
+
|
|
|
+ private ModelRoot modelRoot;
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region properties
|
|
|
+
|
|
|
internal string SchemaUri
|
|
|
{
|
|
|
- get { return _schemaUri; }
|
|
|
+ get => _schemaUri;
|
|
|
set { _schemaUri = value; }
|
|
|
}
|
|
|
|
|
|
- internal List<PropertyAttribute> PropertyAttributes
|
|
|
- {
|
|
|
- get { return _propertyAttributes; }
|
|
|
- set { _propertyAttributes = value; }
|
|
|
- }
|
|
|
-
|
|
|
internal StructuralMetadataSchema Schema
|
|
|
{
|
|
|
- get { return _schema; }
|
|
|
- set { _schema = value; }
|
|
|
+ get => _schema;
|
|
|
+ set { GetChildSetter(this).SetListProperty(ref _schema, value); }
|
|
|
}
|
|
|
|
|
|
- internal List<PropertyTexture> PropertyTextures
|
|
|
+ internal IReadOnlyList<PropertyTable> PropertyTables => _propertyTables;
|
|
|
+ internal IReadOnlyList<PropertyAttribute> PropertyAttributes => _propertyAttributes;
|
|
|
+ internal IReadOnlyList<PropertyTexture> PropertyTextures => _propertyTextures;
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region API
|
|
|
+
|
|
|
+ internal void AddSchema(METADATAORURI schema)
|
|
|
{
|
|
|
- get { return _propertyTextures; }
|
|
|
- set { _propertyTextures = value; }
|
|
|
+ schema.Switch(
|
|
|
+ StructuralMetadataSchema => _schema = StructuralMetadataSchema,
|
|
|
+ Uri => this.SchemaUri = Uri.ToString()
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region validation
|
|
|
+
|
|
|
protected override void OnValidateReferences(ValidationContext validate)
|
|
|
{
|
|
|
foreach (var propertyTexture in PropertyTextures)
|
|
|
{
|
|
|
foreach (var propertyTextureProperty in propertyTexture.Properties)
|
|
|
{
|
|
|
- var textureId = propertyTextureProperty.Value._LogicalTextureIndex;
|
|
|
+ var textureId = propertyTextureProperty.Value.LogicalTextureIndex;
|
|
|
validate.IsNullOrIndex(nameof(propertyTexture), textureId, modelRoot.LogicalTextures);
|
|
|
}
|
|
|
}
|
|
|
@@ -260,7 +286,7 @@ OneOf<StructuralMetadataSchema, Uri> schema)
|
|
|
{
|
|
|
var texCoord = propertyTextureProperty.Value.TextureCoordinate;
|
|
|
var channels = propertyTextureProperty.Value.Channels;
|
|
|
- var index = propertyTextureProperty.Value._LogicalTextureIndex;
|
|
|
+ var index = propertyTextureProperty.Value.LogicalTextureIndex;
|
|
|
Guard.MustBeGreaterThanOrEqualTo(texCoord, 0, nameof(texCoord));
|
|
|
Guard.IsTrue(channels.Count > 0, nameof(channels), "Channels must be defined");
|
|
|
Guard.IsTrue(index >= 0, nameof(index), "Index must be defined");
|
|
|
@@ -280,322 +306,422 @@ OneOf<StructuralMetadataSchema, Uri> schema)
|
|
|
|
|
|
base.OnValidateContent(result);
|
|
|
}
|
|
|
+
|
|
|
+ #endregion
|
|
|
}
|
|
|
|
|
|
- public partial class PropertyTexture
|
|
|
+ public partial class PropertyTexture : IChildOfList<EXTStructuralMetadataRoot>
|
|
|
{
|
|
|
+ #region lifecycle
|
|
|
public PropertyTexture()
|
|
|
{
|
|
|
- _properties = new Dictionary<string, PropertyTextureProperty>();
|
|
|
+ _properties = new ChildrenDictionary<PropertyTextureProperty, PropertyTexture>(this);
|
|
|
}
|
|
|
|
|
|
- public string Class
|
|
|
+ protected override IEnumerable<ExtraProperties> GetLogicalChildren()
|
|
|
{
|
|
|
- get { return _class; }
|
|
|
- set { _class = value; }
|
|
|
+ return base.GetLogicalChildren()
|
|
|
+ .Concat(_properties.Values);
|
|
|
}
|
|
|
|
|
|
- public Dictionary<string, PropertyTextureProperty> Properties
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region child properties
|
|
|
+
|
|
|
+ public int LogicalIndex { get; private set; } = -1;
|
|
|
+
|
|
|
+ public EXTStructuralMetadataRoot LogicalParent { get; private set; }
|
|
|
+
|
|
|
+ void IChildOfList<EXTStructuralMetadataRoot>.SetLogicalParent(EXTStructuralMetadataRoot parent, int index)
|
|
|
+ {
|
|
|
+ LogicalParent = parent;
|
|
|
+ LogicalIndex = index;
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region properties
|
|
|
+
|
|
|
+ public string ClassName
|
|
|
{
|
|
|
- get { return _properties; }
|
|
|
- set { _properties = value; }
|
|
|
+ get => _class;
|
|
|
+ set => _class = value;
|
|
|
}
|
|
|
+
|
|
|
+ public IReadOnlyDictionary<string, PropertyTextureProperty> Properties => _properties;
|
|
|
+
|
|
|
+ #endregion
|
|
|
}
|
|
|
|
|
|
- public partial class PropertyTextureProperty
|
|
|
+ public partial class PropertyTextureProperty : IChildOfDictionary<PropertyTexture>
|
|
|
{
|
|
|
+ #region lifecycle
|
|
|
public PropertyTextureProperty()
|
|
|
{
|
|
|
_channels = new List<int>();
|
|
|
}
|
|
|
|
|
|
- public List<int> Channels
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region child properties
|
|
|
+
|
|
|
+ public string LogicalKey { get; private set; }
|
|
|
+
|
|
|
+ public PropertyTexture LogicalParent { get; private set; }
|
|
|
+
|
|
|
+ void IChildOfDictionary<PropertyTexture>.SetLogicalParent(PropertyTexture parent, string key)
|
|
|
{
|
|
|
- get { return _channels; }
|
|
|
- set { _channels = value; }
|
|
|
+ LogicalParent = parent;
|
|
|
+ LogicalKey = key;
|
|
|
}
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region data
|
|
|
+
|
|
|
+ public List<int> Channels => _channels;
|
|
|
+
|
|
|
+ #endregion
|
|
|
}
|
|
|
|
|
|
- public partial class PropertyAttribute
|
|
|
+ public partial class PropertyAttribute : IChildOfList<EXTStructuralMetadataRoot>
|
|
|
{
|
|
|
+ #region lifecycle
|
|
|
public PropertyAttribute()
|
|
|
{
|
|
|
- _properties = new Dictionary<string, PropertyAttributeProperty>();
|
|
|
+ _properties = new ChildrenDictionary<PropertyAttributeProperty, PropertyAttribute>(this);
|
|
|
}
|
|
|
- public string Class
|
|
|
+
|
|
|
+ protected override IEnumerable<ExtraProperties> GetLogicalChildren()
|
|
|
{
|
|
|
- get { return _class; }
|
|
|
- set
|
|
|
- {
|
|
|
- _class = value;
|
|
|
- }
|
|
|
+ return base.GetLogicalChildren()
|
|
|
+ .Concat(_properties.Values);
|
|
|
}
|
|
|
|
|
|
- public Dictionary<string, PropertyAttributeProperty> Properties
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region child properties
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Gets the zero-based index of this <see cref="MeshExtInstanceFeatureID"/> at <see cref="MeshExtInstanceFeatures.FeatureIds"/>.
|
|
|
+ /// </summary>
|
|
|
+ public int LogicalIndex { get; private set; } = -1;
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Gets the <see cref="MeshExtInstanceFeatures"/> instance that owns this <see cref="MeshExtInstanceFeatureID"/> instance.
|
|
|
+ /// </summary>
|
|
|
+ public EXTStructuralMetadataRoot LogicalParent { get; private set; }
|
|
|
+
|
|
|
+ void IChildOfList<EXTStructuralMetadataRoot>.SetLogicalParent(EXTStructuralMetadataRoot parent, int index)
|
|
|
{
|
|
|
- get { return _properties; }
|
|
|
- set
|
|
|
- {
|
|
|
- _properties = value;
|
|
|
- }
|
|
|
+ LogicalParent = parent;
|
|
|
+ LogicalIndex = index;
|
|
|
}
|
|
|
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region properties
|
|
|
+ public string Class
|
|
|
+ {
|
|
|
+ get => _class;
|
|
|
+ set => _class = value;
|
|
|
+ }
|
|
|
+
|
|
|
+ public IReadOnlyDictionary<string, PropertyAttributeProperty> Properties => _properties;
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- public partial class PropertyAttributeProperty
|
|
|
+ public partial class PropertyAttributeProperty : IChildOfDictionary<PropertyAttribute>
|
|
|
{
|
|
|
+ #region child properties
|
|
|
+
|
|
|
+ public string LogicalKey { get; private set; }
|
|
|
+
|
|
|
+ public PropertyAttribute LogicalParent { get; private set; }
|
|
|
+
|
|
|
+ void IChildOfDictionary<PropertyAttribute>.SetLogicalParent(PropertyAttribute parent, string key)
|
|
|
+ {
|
|
|
+ LogicalParent = parent;
|
|
|
+ LogicalKey = key;
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region properties
|
|
|
+
|
|
|
public string Attribute
|
|
|
{
|
|
|
- get { return _attribute; }
|
|
|
- set
|
|
|
- {
|
|
|
- _attribute = value;
|
|
|
- }
|
|
|
+ get => _attribute;
|
|
|
+ set => _attribute = value;
|
|
|
}
|
|
|
+
|
|
|
+ #endregion
|
|
|
}
|
|
|
|
|
|
- public partial class StructuralMetadataSchema
|
|
|
+ public partial class StructuralMetadataSchema : IChildOfList<EXTStructuralMetadataRoot>
|
|
|
{
|
|
|
+ #region lifecycle
|
|
|
public StructuralMetadataSchema()
|
|
|
{
|
|
|
- _classes = new Dictionary<string, StructuralMetadataClass>();
|
|
|
- _enums = new Dictionary<string, StructuralMetadataEnum>();
|
|
|
+ _classes = new ChildrenDictionary<StructuralMetadataClass, StructuralMetadataSchema>(this);
|
|
|
+ _enums = new ChildrenDictionary<StructuralMetadataEnum, StructuralMetadataSchema>(this);
|
|
|
}
|
|
|
|
|
|
- public Dictionary<string, StructuralMetadataClass> Classes
|
|
|
+ protected override IEnumerable<ExtraProperties> GetLogicalChildren()
|
|
|
{
|
|
|
- get { return _classes; }
|
|
|
- set
|
|
|
- {
|
|
|
- _classes = value;
|
|
|
- }
|
|
|
+ return base.GetLogicalChildren()
|
|
|
+ .Concat(_classes.Values)
|
|
|
+ .Concat(_enums.Values);
|
|
|
}
|
|
|
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region child properties
|
|
|
+
|
|
|
+ public int LogicalIndex { get; private set; } = -1;
|
|
|
+
|
|
|
+ public EXTStructuralMetadataRoot LogicalParent { get; private set; }
|
|
|
+
|
|
|
+ void IChildOfList<EXTStructuralMetadataRoot>.SetLogicalParent(EXTStructuralMetadataRoot parent, int index)
|
|
|
+ {
|
|
|
+ LogicalParent = parent;
|
|
|
+ LogicalIndex = index;
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region properties
|
|
|
+
|
|
|
+ public IReadOnlyDictionary<string, StructuralMetadataClass> Classes => _classes;
|
|
|
+ public IReadOnlyDictionary<string, StructuralMetadataEnum> Enums => _enums;
|
|
|
+
|
|
|
public string Id
|
|
|
{
|
|
|
- get { return _id; }
|
|
|
- set
|
|
|
- {
|
|
|
- _id = value;
|
|
|
- }
|
|
|
+ get => _id;
|
|
|
+ set => _id = value;
|
|
|
}
|
|
|
|
|
|
public string Version
|
|
|
{
|
|
|
- get { return _version; }
|
|
|
- set
|
|
|
- {
|
|
|
- _version = value;
|
|
|
- }
|
|
|
+ get => _version;
|
|
|
+ set => _version = value;
|
|
|
}
|
|
|
|
|
|
public string Name
|
|
|
{
|
|
|
- get { return _name; }
|
|
|
- set
|
|
|
- {
|
|
|
- _name = value;
|
|
|
- }
|
|
|
+ get => _name;
|
|
|
+ set => _name = value;
|
|
|
}
|
|
|
|
|
|
public string Description
|
|
|
{
|
|
|
- get { return _description; }
|
|
|
- set
|
|
|
- {
|
|
|
- _description = value;
|
|
|
- }
|
|
|
- }
|
|
|
+ get => _description;
|
|
|
+ set => _description = value;
|
|
|
+ }
|
|
|
|
|
|
- public Dictionary<string, StructuralMetadataEnum> Enums
|
|
|
- {
|
|
|
- get { return _enums; }
|
|
|
- set
|
|
|
- {
|
|
|
- _enums = value;
|
|
|
- }
|
|
|
- }
|
|
|
+ #endregion
|
|
|
}
|
|
|
|
|
|
- public partial class StructuralMetadataEnum
|
|
|
+ public partial class StructuralMetadataEnum : IChildOfDictionary<StructuralMetadataSchema>
|
|
|
{
|
|
|
+ #region lifecycle
|
|
|
public StructuralMetadataEnum()
|
|
|
{
|
|
|
_values = new List<EnumValue>();
|
|
|
}
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region child properties
|
|
|
+
|
|
|
+ public string LogicalKey { get; private set; }
|
|
|
+
|
|
|
+ public StructuralMetadataSchema LogicalParent { get; private set; }
|
|
|
+
|
|
|
+ void IChildOfDictionary<StructuralMetadataSchema>.SetLogicalParent(StructuralMetadataSchema parent, string key)
|
|
|
+ {
|
|
|
+ LogicalParent = parent;
|
|
|
+ LogicalKey = key;
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region properties
|
|
|
+
|
|
|
public string Name
|
|
|
{
|
|
|
- get { return _name; }
|
|
|
- set
|
|
|
- {
|
|
|
- _name = value;
|
|
|
- }
|
|
|
+ get => _name;
|
|
|
+ set => _name = value;
|
|
|
}
|
|
|
public string Description
|
|
|
{
|
|
|
- get { return _description; }
|
|
|
- set
|
|
|
- {
|
|
|
- _description = value;
|
|
|
- }
|
|
|
+ get => _description;
|
|
|
+ set => _description = value;
|
|
|
}
|
|
|
public List<EnumValue> Values
|
|
|
{
|
|
|
- get { return _values; }
|
|
|
- set
|
|
|
- {
|
|
|
- _values = value;
|
|
|
- }
|
|
|
+ get => _values;
|
|
|
+ set => _values = value;
|
|
|
}
|
|
|
+
|
|
|
+ #endregion
|
|
|
}
|
|
|
|
|
|
public partial class EnumValue
|
|
|
{
|
|
|
+ public string Description
|
|
|
+ {
|
|
|
+ get => _description;
|
|
|
+ set => _description = value;
|
|
|
+ }
|
|
|
public string Name
|
|
|
{
|
|
|
- get { return _name; }
|
|
|
- set
|
|
|
- {
|
|
|
- _name = value;
|
|
|
- }
|
|
|
+ get => _name;
|
|
|
+ set => _name = value;
|
|
|
}
|
|
|
public int Value
|
|
|
{
|
|
|
- get { return _value; }
|
|
|
- set
|
|
|
- {
|
|
|
- _value = value;
|
|
|
- }
|
|
|
+ get => _value;
|
|
|
+ set => _value = value;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public partial class StructuralMetadataClass
|
|
|
+ public partial class StructuralMetadataClass : IChildOfDictionary<StructuralMetadataSchema>
|
|
|
{
|
|
|
+ #region lifecycle
|
|
|
+
|
|
|
public StructuralMetadataClass()
|
|
|
{
|
|
|
- _properties = new Dictionary<string, ClassProperty>();
|
|
|
+ _properties = new ChildrenDictionary<ClassProperty, StructuralMetadataClass>(this);
|
|
|
}
|
|
|
|
|
|
- public Dictionary<string, ClassProperty> Properties
|
|
|
+ protected override IEnumerable<ExtraProperties> GetLogicalChildren()
|
|
|
{
|
|
|
- get { return _properties; }
|
|
|
- set
|
|
|
- {
|
|
|
- _properties = value;
|
|
|
- }
|
|
|
+ return base.GetLogicalChildren()
|
|
|
+ .Concat(_properties.Values);
|
|
|
}
|
|
|
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region child properties
|
|
|
+
|
|
|
+ public string LogicalKey { get; private set; }
|
|
|
+
|
|
|
+ public StructuralMetadataSchema LogicalParent { get; private set; }
|
|
|
+
|
|
|
+ void IChildOfDictionary<StructuralMetadataSchema>.SetLogicalParent(StructuralMetadataSchema parent, string key)
|
|
|
+ {
|
|
|
+ LogicalParent = parent;
|
|
|
+ LogicalKey = key;
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region properties
|
|
|
+
|
|
|
+ public IReadOnlyDictionary<string, ClassProperty> Properties => _properties;
|
|
|
+
|
|
|
public string Name
|
|
|
{
|
|
|
- get { return _name; }
|
|
|
- set
|
|
|
- {
|
|
|
- if (value == null) { _name = null; return; }
|
|
|
- _name = value;
|
|
|
- }
|
|
|
+ get => _name;
|
|
|
+ set => _name = value;
|
|
|
}
|
|
|
|
|
|
public string Description
|
|
|
{
|
|
|
- get { return _description; }
|
|
|
- set
|
|
|
- {
|
|
|
- _description = value;
|
|
|
- }
|
|
|
+ get => _description;
|
|
|
+ set => _description = value;
|
|
|
}
|
|
|
|
|
|
+ #endregion
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- public partial class ClassProperty
|
|
|
+ public partial class ClassProperty : IChildOfDictionary<StructuralMetadataClass>
|
|
|
{
|
|
|
+ #region child properties
|
|
|
+
|
|
|
+ public string LogicalKey { get; private set; }
|
|
|
+
|
|
|
+ public StructuralMetadataClass LogicalParent { get; private set; }
|
|
|
+
|
|
|
+ void IChildOfDictionary<StructuralMetadataClass>.SetLogicalParent(StructuralMetadataClass parent, string key)
|
|
|
+ {
|
|
|
+ LogicalParent = parent;
|
|
|
+ LogicalKey = key;
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region properties
|
|
|
public string Name
|
|
|
{
|
|
|
- get { return _name; }
|
|
|
- set
|
|
|
- {
|
|
|
- _name = value;
|
|
|
- }
|
|
|
+ get => _name;
|
|
|
+ set => _name = value;
|
|
|
}
|
|
|
|
|
|
public string Description
|
|
|
{
|
|
|
- get { return _description; }
|
|
|
- set
|
|
|
- {
|
|
|
- _description = value;
|
|
|
- }
|
|
|
+ get => _description;
|
|
|
+ set => _description = value;
|
|
|
}
|
|
|
|
|
|
public ElementType Type
|
|
|
{
|
|
|
- get { return _type; }
|
|
|
- set
|
|
|
- {
|
|
|
- _type = value;
|
|
|
- }
|
|
|
+ get => _type;
|
|
|
+ set => _type = value;
|
|
|
}
|
|
|
|
|
|
public string EnumType
|
|
|
{
|
|
|
- get { return _enumType; }
|
|
|
- set
|
|
|
- {
|
|
|
- _enumType = value;
|
|
|
- }
|
|
|
+ get => _enumType;
|
|
|
+ set => _enumType = value;
|
|
|
}
|
|
|
|
|
|
public DataType? ComponentType
|
|
|
{
|
|
|
- get { return _componentType; }
|
|
|
- set
|
|
|
- {
|
|
|
- _componentType = value;
|
|
|
- }
|
|
|
+ get => _componentType;
|
|
|
+ set => _componentType = value;
|
|
|
}
|
|
|
|
|
|
public bool? Required
|
|
|
{
|
|
|
- get { return _required; }
|
|
|
- set
|
|
|
- {
|
|
|
- _required = value;
|
|
|
- }
|
|
|
+ get => _required;
|
|
|
+ set => _required = value;
|
|
|
}
|
|
|
|
|
|
public bool? Normalized
|
|
|
{
|
|
|
- get { return _normalized; }
|
|
|
- set
|
|
|
- {
|
|
|
- _normalized = value;
|
|
|
- }
|
|
|
+ get => _normalized;
|
|
|
+ set => _normalized = value;
|
|
|
}
|
|
|
|
|
|
public bool? Array
|
|
|
{
|
|
|
- get { return _array; }
|
|
|
- set
|
|
|
- {
|
|
|
- _array = value;
|
|
|
- }
|
|
|
-
|
|
|
+ get => _array;
|
|
|
+ set => _array = value;
|
|
|
}
|
|
|
|
|
|
public int? Count
|
|
|
{
|
|
|
- get { return _count; }
|
|
|
- set
|
|
|
- {
|
|
|
- _count = value;
|
|
|
- }
|
|
|
+ get => _count;
|
|
|
+ set => _count = value;
|
|
|
}
|
|
|
+
|
|
|
+ #endregion
|
|
|
}
|
|
|
|
|
|
- public partial class PropertyTable
|
|
|
+ /// <remarks>
|
|
|
+ /// Represents a Propery table of <see cref="EXTStructuralMetadataRoot"/>
|
|
|
+ /// </remarks>
|
|
|
+ public partial class PropertyTable : IChildOfList<EXTStructuralMetadataRoot>
|
|
|
{
|
|
|
+ #region lifecycle
|
|
|
public PropertyTable()
|
|
|
{
|
|
|
- _properties = new Dictionary<string, PropertyTableProperty>();
|
|
|
+ _properties = new ChildrenDictionary<PropertyTableProperty, PropertyTable>(this);
|
|
|
}
|
|
|
public PropertyTable(string Class, int Count, string Name = "") : this()
|
|
|
{
|
|
|
@@ -604,68 +730,94 @@ OneOf<StructuralMetadataSchema, Uri> schema)
|
|
|
_name = Name;
|
|
|
}
|
|
|
|
|
|
- public string Name
|
|
|
+ protected override IEnumerable<ExtraProperties> GetLogicalChildren()
|
|
|
{
|
|
|
- get { return _name; }
|
|
|
- set
|
|
|
- {
|
|
|
- _name = value;
|
|
|
- }
|
|
|
+ return base.GetLogicalChildren()
|
|
|
+ .Concat(_properties.Values);
|
|
|
}
|
|
|
|
|
|
- public string Class
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region child properties
|
|
|
+
|
|
|
+ public int LogicalIndex { get; private set; } = -1;
|
|
|
+ public EXTStructuralMetadataRoot LogicalParent { get; private set; }
|
|
|
+
|
|
|
+ void IChildOfList<EXTStructuralMetadataRoot>.SetLogicalParent(EXTStructuralMetadataRoot parent, int index)
|
|
|
{
|
|
|
- get { return _class; }
|
|
|
- set
|
|
|
- {
|
|
|
- _class = value;
|
|
|
- }
|
|
|
+ LogicalParent = parent;
|
|
|
+ LogicalIndex = index;
|
|
|
}
|
|
|
|
|
|
- public int Count
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region properties
|
|
|
+
|
|
|
+ public IReadOnlyDictionary<string, PropertyTableProperty> Properties => _properties;
|
|
|
+
|
|
|
+ public string Name
|
|
|
{
|
|
|
- get { return _count; }
|
|
|
- set
|
|
|
- {
|
|
|
- _count = value;
|
|
|
- }
|
|
|
+ get => _name;
|
|
|
+ set => _name = value;
|
|
|
}
|
|
|
|
|
|
- public Dictionary<string, PropertyTableProperty> Properties
|
|
|
+ public string Class
|
|
|
{
|
|
|
- get { return _properties; }
|
|
|
- set
|
|
|
- {
|
|
|
- _properties = value;
|
|
|
- }
|
|
|
+ get => _class;
|
|
|
+ set => _class = value;
|
|
|
}
|
|
|
+
|
|
|
+ public int Count
|
|
|
+ {
|
|
|
+ get => _count;
|
|
|
+ set => _count = value;
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
}
|
|
|
|
|
|
- public partial class PropertyTableProperty
|
|
|
+ /// <remarks>
|
|
|
+ /// Represents a Property of <see cref="PropertyTable"/>
|
|
|
+ /// </remarks>
|
|
|
+ public partial class PropertyTableProperty : IChildOfDictionary<PropertyTable>
|
|
|
{
|
|
|
+ #region child properties
|
|
|
+
|
|
|
+ public string LogicalKey { get; private set; }
|
|
|
+
|
|
|
+ public PropertyTable LogicalParent { get; private set; }
|
|
|
+
|
|
|
+ void IChildOfDictionary<PropertyTable>.SetLogicalParent(PropertyTable parent, string key)
|
|
|
+ {
|
|
|
+ LogicalParent = parent;
|
|
|
+ LogicalKey = key;
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region properties
|
|
|
+ /// <summary>
|
|
|
+ /// this is an index to a BufferView
|
|
|
+ /// </summary>
|
|
|
public int Values
|
|
|
{
|
|
|
- get { return _values; }
|
|
|
- set { _values = value; }
|
|
|
+ get => _values;
|
|
|
+ set => _values = value;
|
|
|
}
|
|
|
|
|
|
public int? ArrayOffsets
|
|
|
{
|
|
|
- get { return _arrayOffsets; }
|
|
|
- set
|
|
|
- {
|
|
|
- _arrayOffsets = value;
|
|
|
- }
|
|
|
+ get => _arrayOffsets;
|
|
|
+ set => _arrayOffsets = value;
|
|
|
}
|
|
|
|
|
|
public int? StringOffsets
|
|
|
{
|
|
|
- get { return _stringOffsets; }
|
|
|
- set
|
|
|
- {
|
|
|
- _stringOffsets = value;
|
|
|
- }
|
|
|
+ get => _stringOffsets;
|
|
|
+ set => _stringOffsets = value;
|
|
|
}
|
|
|
+
|
|
|
+ #endregion
|
|
|
}
|
|
|
}
|
|
|
|