public void AddInclude(string ifcEntityName, params int[] propertyIndices)
        {
            IfcType   ifcType = IfcInstances.IfcTypeLookup[ifcEntityName];
            IfcFilter flt     = new IfcFilter(ifcType, propertyIndices);

            Included.Add(flt);
        }
 public void AddExclude(IfcType ifcType)
 {
     if (!Excluded.Contains(ifcType))
     {
         IfcFilter flt = new IfcFilter(ifcType);
         Excluded.Add(flt);
     }
     foreach (IfcType subType in ifcType.IfcSubTypes)
     {
         AddExclude(subType);
     }
 }
 public void AddExclude(IfcType ifcType)
 {
     if (!Excluded.Contains(ifcType))
     {
         IfcFilter flt = new IfcFilter(ifcType);
         Excluded.Add(flt);
     }
     foreach (IfcType subType in ifcType.IfcSubTypes)
     {
         AddExclude(subType);
     }
 }
        private void AddEntity(IfcType ifcType, params int[] idx)
        {
            int[] includedProperties = idx;

            if (!Excluded.Contains(ifcType) && !_parseFilter.Contains(ifcType)
                && !typeof (ExpressType).IsAssignableFrom(ifcType.Type))
            {
                if (!ifcType.Type.IsAbstract)
                {
                    IfcType superType = ifcType;
                    while (superType != null)
                    {
                        if (Included.Contains(superType))
                        {
                            IfcFilter flt = Included[superType];
                            IfcFilter parseFilter = new IfcFilter(ifcType, flt.PropertyIndices);
                            _parseFilter.Add(parseFilter);
                            includedProperties = parseFilter.PropertyIndices;
                            break;
                        }
                        else
                            superType = superType.IfcSuperType;
                    }

                    if (superType == null)
                        _parseFilter.Add(new IfcFilter(ifcType, idx));
                }

                foreach (Type subType in ifcType.NonAbstractSubTypes)
                {
                    if (subType != ifcType.Type) AddEntity(IfcInstances.IfcEntities[subType]);
                }

                foreach (IfcMetaProperty prop in ifcType.IfcProperties.Values)
                {
                    if (includedProperties == null || includedProperties.Length == 0 ||
                        includedProperties.Contains(prop.IfcAttribute.Order - 1))
                    {
                        Type propType = prop.PropertyInfo.PropertyType;
                        if (typeof (ExpressEnumerable).IsAssignableFrom(propType)) //its a list
                        {
                            Type genType = GetGenericType(propType);
                            if (genType != null && IfcInstances.IfcEntities.Contains(genType))
                                AddEntity(IfcInstances.IfcEntities[genType]);
                            if (genType.IsInterface)
                            {
                                //get the types that are like this
                                foreach (IfcType ent in IfcInstances.IfcEntities)
                                {
                                    if (genType.IsAssignableFrom(ent.Type))
                                        AddEntity(ent);
                                }
                            }
                        }
                        else if (propType.IsInterface) //its a select type
                        {
                            //get the types that are like this
                            foreach (IfcType ent in IfcInstances.IfcEntities)
                            {
                                if (propType.IsAssignableFrom(ent.Type))
                                    AddEntity(ent);
                            }
                        }
                        else if (typeof (IPersistIfc).IsAssignableFrom(propType) &&
                                 IfcInstances.IfcEntities.Contains(propType)) //its a normal entity
                        {
                            IfcType ifcPropType = IfcInstances.IfcEntities[propType];
                            AddEntity(ifcPropType);
                        }
                    }
                }
            }
        }
 public void AddInclude(IfcFilter flt)
 {
     Included.Add(flt);
 }
 public void AddInclude(string ifcEntityName, params int[] propertyIndices)
 {
     IfcType ifcType = IfcInstances.IfcTypeLookup[ifcEntityName];
     IfcFilter flt = new IfcFilter(ifcType, propertyIndices);
     Included.Add(flt);
 }
        private void AddEntity(IfcType ifcType, params int[] idx)
        {
            int[] includedProperties = idx;

            if (!Excluded.Contains(ifcType) && !_parseFilter.Contains(ifcType) &&
                !typeof(ExpressType).IsAssignableFrom(ifcType.Type))
            {
                if (!ifcType.Type.IsAbstract)
                {
                    IfcType superType = ifcType;
                    while (superType != null)
                    {
                        if (Included.Contains(superType))
                        {
                            IfcFilter flt         = Included[superType];
                            IfcFilter parseFilter = new IfcFilter(ifcType, flt.PropertyIndices);
                            _parseFilter.Add(parseFilter);
                            includedProperties = parseFilter.PropertyIndices;
                            break;
                        }
                        else
                        {
                            superType = superType.IfcSuperType;
                        }
                    }

                    if (superType == null)
                    {
                        _parseFilter.Add(new IfcFilter(ifcType, idx));
                    }
                }

                foreach (Type subType in ifcType.NonAbstractSubTypes)
                {
                    if (subType != ifcType.Type)
                    {
                        AddEntity(IfcInstances.IfcEntities[subType]);
                    }
                }

                foreach (IfcMetaProperty prop in ifcType.IfcProperties.Values)
                {
                    if (includedProperties == null || includedProperties.Length == 0 ||
                        includedProperties.Contains(prop.IfcAttribute.Order - 1))
                    {
                        Type propType = prop.PropertyInfo.PropertyType;
                        if (typeof(ExpressEnumerable).IsAssignableFrom(propType))  //its a list
                        {
                            Type genType = GetGenericType(propType);
                            if (genType != null && IfcInstances.IfcEntities.Contains(genType))
                            {
                                AddEntity(IfcInstances.IfcEntities[genType]);
                            }
                            if (genType.IsInterface)
                            {
                                //get the types that are like this
                                foreach (IfcType ent in IfcInstances.IfcEntities)
                                {
                                    if (genType.IsAssignableFrom(ent.Type))
                                    {
                                        AddEntity(ent);
                                    }
                                }
                            }
                        }
                        else if (propType.IsInterface) //its a select type
                        {
                            //get the types that are like this
                            foreach (IfcType ent in IfcInstances.IfcEntities)
                            {
                                if (propType.IsAssignableFrom(ent.Type))
                                {
                                    AddEntity(ent);
                                }
                            }
                        }
                        else if (typeof(IPersistIfc).IsAssignableFrom(propType) &&
                                 IfcInstances.IfcEntities.Contains(propType)) //its a normal entity
                        {
                            IfcType ifcPropType = IfcInstances.IfcEntities[propType];
                            AddEntity(ifcPropType);
                        }
                    }
                }
            }
        }
 public void AddInclude(IfcFilter flt)
 {
     Included.Add(flt);
 }