예제 #1
0
        /// <summary>
        /// Tests the express where-clause specified in param 'clause'
        /// </summary>
        /// <param name="clause">The express clause to test</param>
        /// <returns>true if the clause is satisfied.</returns>
        public bool ValidateClause(IfcTaskClause clause)
        {
            var retVal = false;

            try
            {
                switch (clause)
                {
                case IfcTaskClause.WR1:
                    retVal = Functions.SIZEOF(this /* as IfcObjectDefinition*/.Decomposes.Where(temp => !(Functions.TYPEOF(temp).Contains("IFC2X3.IFCRELNESTS")))) == 0;
                    break;

                case IfcTaskClause.WR2:
                    retVal = Functions.SIZEOF(this /* as IfcObjectDefinition*/.IsDecomposedBy.Where(temp => !(Functions.TYPEOF(temp).Contains("IFC2X3.IFCRELNESTS")))) == 0;
                    break;

                case IfcTaskClause.WR3:
                    retVal = Functions.EXISTS(this /* as IfcRoot*/.Name);
                    break;
                }
            } catch (Exception ex) {
                var log = Validation.ValidationLogging.CreateLogger <Xbim.Ifc2x3.ProcessExtension.IfcTask>();
                log?.LogError(string.Format("Exception thrown evaluating where-clause 'IfcTask.{0}' for #{1}.", clause, EntityLabel), ex);
            }
            return(retVal);
        }
예제 #2
0
        /// <summary>
        /// Tests the express where-clause specified in param 'clause'
        /// </summary>
        /// <param name="clause">The express clause to test</param>
        /// <returns>true if the clause is satisfied.</returns>
        public bool ValidateClause(IfcTaskClause clause)
        {
            var retVal = false;

            try
            {
                switch (clause)
                {
                case IfcTaskClause.HasName:
                    retVal = Functions.EXISTS(this /* as IfcRoot*/.Name);
                    break;

                case IfcTaskClause.CorrectPredefinedType:
                    retVal = !(Functions.EXISTS(PredefinedType)) || (PredefinedType != IfcTaskTypeEnum.USERDEFINED) || ((PredefinedType == IfcTaskTypeEnum.USERDEFINED) && Functions.EXISTS(this /* as IfcObject*/.ObjectType));
                    break;
                }
            } catch (Exception ex) {
                var log = Validation.ValidationLogging.CreateLogger <Xbim.Ifc4.ProcessExtension.IfcTask>();
                log?.LogError(string.Format("Exception thrown evaluating where-clause 'IfcTask.{0}' for #{1}.", clause, EntityLabel), ex);
            }
            return(retVal);
        }