Exemplo n.º 1
0
        /// <summary>
        /// Will read Configuration file if passed, or default COBieAttributesFilters.config
        /// </summary>
        /// <param name="configFileName">Full path/name for config file</param>
        /// <param name="import"></param>
        private void FiltersHelperInit(string configFileName = null, ImportSet import = ImportSet.All)
        {
            //set default
            var sourceFile = configFileName ?? RoleFilter.Unknown.ToResourceName();
            var config     = GetConfig(sourceFile);

            //IfcProduct and IfcTypeObject filters
            if (import == ImportSet.All || import == ImportSet.IfcFilters)
            {
                IfcProductFilter    = new ObjectFilter(config.GetSection("IfcElementInclusion"));
                IfcTypeObjectFilter = new ObjectFilter(config.GetSection("IfcTypeInclusion"));
                IfcTypeObjectFilter.FillPreDefinedTypes(config.GetSection("IfcPreDefinedTypeFilter"));
                IfcAssemblyFilter = new ObjectFilter(config.GetSection("IfcAssemblyInclusion"));
            }

            //Property name filters
            if (import == ImportSet.All || import == ImportSet.PropertyFilters)
            {
                ZoneFilter      = new PropertyFilter(config.GetSection("ZoneFilter"));
                TypeFilter      = new PropertyFilter(config.GetSection("TypeFilter"));
                SpaceFilter     = new PropertyFilter(config.GetSection("SpaceFilter"));
                FloorFilter     = new PropertyFilter(config.GetSection("FloorFilter"));
                FacilityFilter  = new PropertyFilter(config.GetSection("FacilityFilter"));
                SpareFilter     = new PropertyFilter(config.GetSection("SpareFilter"));
                ComponentFilter = new PropertyFilter(config.GetSection("ComponentFilter"));
                CommonFilter    = new PropertyFilter(config.GetSection("CommonFilter"));
            }
            // API restructure:
            // a call to File.Delete(config.FilePath); has been removed
            // it is strange for the configuration reading routine to delete a configuration file
        }
Exemplo n.º 2
0
 /// <summary>
 /// Merge PropertyFilter
 /// </summary>
 /// <param name="mergeFilter">PropertyFilter to merge</param>
 public void Merge(PropertyFilter mergeFilter)
 {
     EqualTo             = EqualTo.Concat(mergeFilter.EqualTo.Where(s => !EqualTo.Contains(s))).ToList();
     StartWith           = StartWith.Concat(mergeFilter.StartWith.Where(s => !StartWith.Contains(s))).ToList();
     Contain             = Contain.Concat(mergeFilter.Contain.Where(s => !Contain.Contains(s))).ToList();
     PropertySetsEqualTo = PropertySetsEqualTo.Concat(mergeFilter.PropertySetsEqualTo.Where(s => !PropertySetsEqualTo.Contains(s))).ToList();
 }
Exemplo n.º 3
0
 /// <summary>
 /// Copy values from passed PropertyFilter
 /// </summary>
 /// <param name="copyFilter">PropertyFilter to copy</param>
 public void Copy(PropertyFilter copyFilter)
 {
     EqualTo.Clear();
     EqualTo = EqualTo.Concat(copyFilter.EqualTo).ToList();
     StartWith.Clear();
     StartWith = StartWith.Concat(copyFilter.StartWith).ToList();
     Contain.Clear();
     Contain = Contain.Concat(copyFilter.Contain).ToList();
     PropertySetsEqualTo.Clear();
     PropertySetsEqualTo = PropertySetsEqualTo.Concat(copyFilter.PropertySetsEqualTo).ToList();
 }
Exemplo n.º 4
0
        /// <summary>
        /// Empty constructor for Serialize
        /// </summary>
        public OutputFilters(ILogger logger)
        {
            _log = logger;
            //will flip filter result from true to false
            FlipResult = false;

            //object filters
            IfcProductFilter    = new ObjectFilter();
            IfcTypeObjectFilter = new ObjectFilter();
            IfcAssemblyFilter   = new ObjectFilter();

            //Property name filters
            ZoneFilter      = new PropertyFilter();
            TypeFilter      = new PropertyFilter();
            SpaceFilter     = new PropertyFilter();
            FloorFilter     = new PropertyFilter();
            FacilityFilter  = new PropertyFilter();
            SpareFilter     = new PropertyFilter();
            ComponentFilter = new PropertyFilter();
            CommonFilter    = new PropertyFilter();

            //role storage
            RolesFilterHolder = new Dictionary <RoleFilter, OutputFilters>();
        }