private AdminShellV20.SubmodelElement?CreatePropertySubmodelElement(PropertyWrapper wrapper)
        {
            var reference = wrapper.Element.DataType.GetClassReference();

            if (reference != null)
            {
                var cls = reference.Get(_context);
                return(cls != null?CreatePropertyCollection(cls, wrapper.Children) : null);
            }
            if (wrapper.Element.DataType is AggregateType aggregateType)
            {
                return(CreateAggregateCollection(wrapper, aggregateType));
            }
            if (wrapper.Element.DataType is LevelType levelType)
            {
                return(CreateLevelCollection(wrapper.Element, levelType));
            }
            return(CreateProperty(wrapper.Element));
        }
Beispiel #2
0
        private AdminShellV20.SubmodelElementCollection CreateAggregateCollection(
            PropertyWrapper wrapper, AggregateType aggregateType)
        {
            var collection = Iec61360Utils.CreateCollection(_env, wrapper.Element.GetIec61360Data(_all));

            if (wrapper.Children.Count == 1)
            {
                var child = wrapper.Children.First();
                if (child.IsSelected)
                {
                    for (int i = 0; i < Math.Max(1, aggregateType.MinimumElementCount); i++)
                    {
                        var element = CreateSubmodelElement(child);
                        if (element != null)
                        {
                            element.idShort += i;
                            collection.Add(element);
                        }
                    }
                }
            }

            return(collection);
        }