예제 #1
0
        public static AssetPropertyGraph ConstructPropertyGraph(AssetPropertyGraphContainer container, [NotNull] AssetItem assetItem, ILogger logger)
        {
            var assetType = assetItem.Asset.GetType();

            while (assetType != null)
            {
                var typeToTest = assetType.IsGenericType ? assetType.GetGenericTypeDefinition() : assetType;
                if (NodeGraphTypes.TryGetValue(typeToTest, out Type propertyGraphType))
                {
                    return((AssetPropertyGraph)Activator.CreateInstance(propertyGraphType, container, assetItem, logger));
                }
                assetType = assetType.BaseType;
            }
            throw new InvalidOperationException("No AssetPropertyGraph type matching the given asset type has been found");
        }
예제 #2
0
        protected AssetCompositeHierarchyPropertyGraph([NotNull] AssetPropertyGraphContainer container, [NotNull] AssetItem assetItem, ILogger logger)
            : base(container, assetItem, logger)
        {
            HierarchyNode = RootNode[nameof(AssetCompositeHierarchy <TAssetPartDesign, TAssetPart> .Hierarchy)].Target;
            var rootPartsNode = HierarchyNode[nameof(AssetCompositeHierarchyData <TAssetPartDesign, TAssetPart> .RootParts)].Target;

            rootPartsNode.ItemChanged += RootPartsChanged;
            foreach (var childPartNode in Asset.Hierarchy.Parts.Values.SelectMany(x => RetrieveChildPartNodes(x.Part)))
            {
                RegisterChildPartNode(childPartNode);
            }
            var partsNode = HierarchyNode[nameof(AssetCompositeHierarchyData <IAssetPartDesign <IIdentifiable>, IIdentifiable> .Parts)].Target;

            partsNode.ItemChanged += PartsChanged;

            foreach (var part in Asset.Hierarchy.Parts.Values)
            {
                LinkToOwnerPart(Container.NodeContainer.GetNode(part.Part), part);
            }
        }
예제 #3
0
 public AssetCompositePropertyGraph([NotNull] AssetPropertyGraphContainer container, [NotNull] AssetItem assetItem, ILogger logger)
     : base(container, assetItem, logger)
 {
 }