/// <summary>
        /// Check all ifcElements associated with the pass ifcTypeObject for the passed property map key.
        /// If all found elements of the property are the same then we assume that the property applies to the type as well as all the elements
        /// </summary>
        /// <param name="valueName">property map key</param>
        /// <param name="ifcTypeObject">ifcTypeObject</param>
        /// <returns>property value</returns>
        private string GetObjPropByAssoc(string valueName, IIfcTypeObject ifcTypeObject)
        {
            string accCategoryString = string.Empty;
            var    ObjDefByType      = _helper.DefiningTypeObjectMap.Where(pair => (pair.Key.IfcTypeObject != null) && (pair.Key.IfcTypeObject == ifcTypeObject)).SelectMany(p => p.Value);
            var    assetTypes        = new List <string>();

            foreach (var item in ObjDefByType)
            {
                accCategoryString = _helper.GetCoBieProperty(valueName, item);
                assetTypes.Add(accCategoryString != null ? accCategoryString : string.Empty);
            }
            //assume every ifcElement hast to have the value and be set to the same value
            if (assetTypes.Count > 0)
            {
                var fat = assetTypes.First();
                if (assetTypes.All(at => at == fat))
                {
                    return(accCategoryString);
                }
            }
            return(null);
        }
        public AssetTypeInfoType(IIfcTypeObject ifcTypeObject, CoBieLiteHelper helper)
            : this()
        {
            externalEntityName = helper.ExternalEntityName(ifcTypeObject);
            externalID         = helper.ExternalEntityIdentity(ifcTypeObject);
            externalSystemName = helper.ExternalSystemName(ifcTypeObject);
            AssetTypeName      = ifcTypeObject.Name;
            AssetTypeCategory  = helper.GetClassification(ifcTypeObject);
            string accCategoryString = helper.GetCoBieProperty("AssetTypeAccountingCategory", ifcTypeObject);
            AssetPortabilitySimpleType accCategoryEnum;

            if (Enum.TryParse(accCategoryString, true, out accCategoryEnum))
            {
                AssetTypeAccountingCategory = accCategoryEnum;
            }
            else
            {
                CoBieLiteHelper.Logger.WarnFormat("AssetTypeAccountingCategory: An illegal value of [{0}] has been passed for the category of #{1}={2}. It has been replaced with a value of 'Item'", accCategoryString, ifcTypeObject.EntityLabel, ifcTypeObject.GetType().Name);
                AssetTypeAccountingCategory = AssetPortabilitySimpleType.Item;
            }
            if (string.IsNullOrWhiteSpace(AssetTypeCategory)) //try the asset assignment
            {
                IIfcAsset ifcAsset;
                if (helper.AssetAsignments.TryGetValue(ifcTypeObject, out ifcAsset))
                {
                    AssetTypeCategory = helper.GetCoBieAttribute <StringValueType>("AssetTypeAccountingCategory", ifcAsset).StringValue;
                }
            }
            AssetTypeDescription             = ifcTypeObject.Description;
            AssetTypeModelNumber             = helper.GetCoBieProperty("AssetTypeModelNumber", ifcTypeObject);
            AssetTypeReplacementCostValue    = helper.GetCoBieAttribute <DecimalValueType>("AssetTypeReplacementCostValue", ifcTypeObject);
            AssetTypeExpectedLifeValue       = helper.GetCoBieAttribute <IntegerValueType>("AssetTypeExpectedLifeValue", ifcTypeObject);
            AssetTypeNominalLength           = helper.GetCoBieAttribute <DecimalValueType>("AssetTypeNominalLength", ifcTypeObject);
            AssetTypeNominalWidth            = helper.GetCoBieAttribute <DecimalValueType>("AssetTypeNominalWidth", ifcTypeObject);
            AssetTypeNominalHeight           = helper.GetCoBieAttribute <DecimalValueType>("AssetTypeNominalHeight", ifcTypeObject);
            AssetTypeAccessibilityText       = helper.GetCoBieProperty("AssetTypeAccessibilityText", ifcTypeObject);
            AssetTypeColorCode               = helper.GetCoBieProperty("AssetTypeColorCode", ifcTypeObject);
            AssetTypeConstituentsDescription = helper.GetCoBieProperty("AssetTypeConstituentsDescription", ifcTypeObject);
            AssetTypeFeaturesDescription     = helper.GetCoBieProperty("AssetTypeFeaturesDescription", ifcTypeObject);
            AssetTypeGradeDescription        = helper.GetCoBieProperty("AssetTypeGradeDescription", ifcTypeObject);
            AssetTypeMaterialDescription     = helper.GetCoBieProperty("AssetTypeMaterialDescription", ifcTypeObject);
            AssetTypeShapeDescription        = helper.GetCoBieProperty("AssetTypeShapeDescription", ifcTypeObject);
            AssetTypeSizeDescription         = helper.GetCoBieProperty("AssetTypeSizeDescription", ifcTypeObject);
            AssetTypeSustainabilityPerformanceDescription = helper.GetCoBieProperty("AssetTypeSustainabilityPerformanceDescription", ifcTypeObject);

            //The Assets
            List <IIfcElement> allAssetsofThisType;

            if (helper.DefiningTypeObjectMap.TryGetValue(ifcTypeObject, out allAssetsofThisType)) //should always work
            {
                Assets = new AssetCollectionType {
                    Asset = new List <AssetInfoType>(allAssetsofThisType.Count)
                };
                foreach (IIfcElement t in allAssetsofThisType)
                {
                    Assets.Add(new AssetInfoType(t, helper));
                }
            }
            else
            {
                //just in case we have a problem
                CoBieLiteHelper.Logger.ErrorFormat("Asset Type: Failed to locate Asset Type #{0}={1}", ifcTypeObject.EntityLabel, ifcTypeObject.GetType().Name);
            }

            //Attributes
            var ifcAttributes = helper.GetAttributes(ifcTypeObject);

            if (ifcAttributes != null && ifcAttributes.Any())
            {
                AssetTypeAttributes = new AttributeCollectionType {
                    Attribute = ifcAttributes
                }
            }
            ;
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="helper"></param>
 /// <param name="typeObject"></param>
 /// <param name="typeName"></param>
 public XbimIfcProxyTypeObject(COBieExpressHelper helper, IIfcTypeObject typeObject, string typeName)
 {
     _ifcTypeObject = typeObject;
     _helper        = helper;
     _name          = typeName;
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="helper"></param>
 /// <param name="typeObject"></param>
 /// <param name="typeName"></param>
 public XbimIfcProxyTypeObject(CoBieLiteUkHelper helper, IIfcTypeObject typeObject, string typeName)
 {
     _ifcTypeObject = typeObject;
     _helper        = helper;
     _name          = typeName;
 }