/// <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(IfcPixelTextureClause clause)
        {
            var retVal = false;

            try
            {
                switch (clause)
                {
                case IfcPixelTextureClause.MinPixelInS:
                    retVal = Width >= 1;
                    break;

                case IfcPixelTextureClause.MinPixelInT:
                    retVal = Height >= 1;
                    break;

                case IfcPixelTextureClause.NumberOfColours:
                    retVal = ((1 <= ColourComponents) && (ColourComponents <= 4));
                    break;

                case IfcPixelTextureClause.SizeOfPixelList:
                    retVal = Functions.SIZEOF(Pixel) == (Width * Height);
                    break;

                case IfcPixelTextureClause.PixelAsByteAndSameLength:
                    retVal = Functions.SIZEOF(Pixel.Where(temp => (Functions.BLENGTH(temp) % 8 == 0) && (Functions.BLENGTH(temp) == Functions.BLENGTH(Pixel.ItemAt(0))))) == Functions.SIZEOF(Pixel);
                    break;
                }
            } catch (Exception ex) {
                var log = Validation.ValidationLogging.CreateLogger <Xbim.Ifc4.PresentationAppearanceResource.IfcPixelTexture>();
                log?.LogError(string.Format("Exception thrown evaluating where-clause 'IfcPixelTexture.{0}' for #{1}.", clause, EntityLabel), ex);
            }
            return(retVal);
        }
Example #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(IfcPixelTextureClause clause)
        {
            var retVal = false;

            try
            {
                switch (clause)
                {
                case IfcPixelTextureClause.WR21:
                    retVal = Width >= 1;
                    break;

                case IfcPixelTextureClause.WR22:
                    retVal = Height >= 1;
                    break;

                case IfcPixelTextureClause.WR23:
                    retVal = ((1 <= ColourComponents) && (ColourComponents <= 4));
                    break;

                case IfcPixelTextureClause.WR24:
                    retVal = Functions.SIZEOF(Pixel) == (Width * Height);
                    break;
                }
            } catch (Exception ex) {
                var log = Validation.ValidationLogging.CreateLogger <Xbim.Ifc2x3.PresentationAppearanceResource.IfcPixelTexture>();
                log?.LogError(string.Format("Exception thrown evaluating where-clause 'IfcPixelTexture.{0}' for #{1}.", clause, EntityLabel), ex);
            }
            return(retVal);
        }