示例#1
0
        public ValidationResult Validate_SingleBodyRepresentation <T, U, V>(bool acceptSubTypes) where T : IfcRepresentationItem where U : IfcRepresentationItem where V : IfcRepresentationItem
        {
            ValidationResult      result = null;
            IfcRepresentationItem singleModelRepresenationItem = SingleBodyRepresentationItem(ref result);

            if (singleModelRepresenationItem == null)
            {
                return(result);
            }
            if (!(singleModelRepresenationItem is T || singleModelRepresenationItem is U || singleModelRepresenationItem is V))
            {
                return(new ValidationResult("Single Body representation item (" + singleModelRepresenationItem.StepClassName + ") is not " + typeof(T).Name + " or " + typeof(U).Name + " or " + typeof(V).Name));
            }
            if (!acceptSubTypes)
            {
                if (singleModelRepresenationItem.GetType().IsSubclassOf(typeof(T)))
                {
                    return(new ValidationResult("Single Body representation item (" + singleModelRepresenationItem.StepClassName + ") is subclass of " + typeof(T).Name));
                }
                if (singleModelRepresenationItem.GetType().IsSubclassOf(typeof(U)))
                {
                    return(new ValidationResult("Single Body representation item (" + singleModelRepresenationItem.StepClassName + ") is subclass of " + typeof(U).Name));
                }
                if (singleModelRepresenationItem.GetType().IsSubclassOf(typeof(V)))
                {
                    return(new ValidationResult("Single Body representation item (" + singleModelRepresenationItem.StepClassName + ") is subclass of " + typeof(V).Name));
                }
            }
            return(ValidationResult.Success);
        }