Пример #1
0
        public RequirementView(IfcSimplePropertyTemplate property, RequirementSetView requirementSet, bool addSelf = false)
        {
            PropertyTemplate = property;
            Parent           = requirementSet;

            if (addSelf)
            {
                Parent.Requirements.Add(this);
            }

            lang = Language.Lang;
            Language.PropertyChanged += (_, p) =>
            {
                if (p.PropertyName != nameof(Language.Lang))
                {
                    return;
                }
                lang = Language.Lang;
            };
        }
Пример #2
0
        private static RequirementSetView GetOrCreate(IfcSimplePropertyTemplate property, Dictionary <int, RequirementSetView> map)
        {
            // enumerate inverse property. This is potentially expensive
            var pset = property.PartOfPsetTemplate.FirstOrDefault();

            if (pset == null)
            {
                return(null);
            }

            if (map.TryGetValue(pset.EntityLabel, out RequirementSetView view))
            {
                return(view);
            }

            view = new RequirementSetView(pset);
            view.Requirements.Clear();
            map.Add(pset.EntityLabel, view);
            return(view);
        }