public XbimCoBieValueHelper(DecimalValueType decimalValue, IfcSIUnitName defaultSiUnitName, IfcSIPrefix?defaultSiPrefix = null) { //set regardless SiPrefix = defaultSiPrefix; SiUnitName = defaultSiUnitName; if (decimalValue == null || !decimalValue.DecimalValueSpecified) { IsNull = true; Value = null; } else { IsNull = false; Value = decimalValue.DecimalValue; if (!string.IsNullOrWhiteSpace(decimalValue.UnitName)) { //acording the COBie standard units should start with the SI prefix and end with the unit name var trimmedName = decimalValue.UnitName.Trim(); foreach (IfcSIUnitName unit in Enum.GetValues(typeof(IfcSIUnitName))) { if (trimmedName.EndsWith(unit.ToString(), true, CultureInfo.InvariantCulture)) { SiUnitName = unit; break; } } foreach (IfcSIPrefix prefix in Enum.GetValues(typeof(IfcSIPrefix))) { if (trimmedName.StartsWith(prefix.ToString(), true, CultureInfo.InvariantCulture)) { defaultSiPrefix = prefix; break; } } } } }
public virtual TResult Visit(DecimalValueType valueType, TEnvironment environment) { return(default(TResult)); }
//[System.Xml.Serialization.XmlIgnoreAttribute()] //private IfcBuildingStorey _ifcBuildingStorey; public FloorType(IfcBuildingStorey ifcBuildingStorey, CoBieLiteHelper helper) : this() { // _ifcBuildingStorey = ifcBuildingStorey; externalEntityName = helper.ExternalEntityName(ifcBuildingStorey); externalID = helper.ExternalEntityIdentity(ifcBuildingStorey); externalSystemName = helper.ExternalSystemName(ifcBuildingStorey); FloorName = ifcBuildingStorey.Name; FloorCategory = helper.GetClassification(ifcBuildingStorey); FloorDescription = ifcBuildingStorey.Description; //set the fall backs if (ifcBuildingStorey.Elevation.HasValue) { FloorElevationValue = new DecimalValueType { DecimalValue = ifcBuildingStorey.Elevation.Value, DecimalValueSpecified = true }; //TODO: work out if the units can change //FloorElevationValue.UnitName = } FloorHeightValue = helper.GetCoBieAttribute <DecimalValueType>("FloorHeightValue", ifcBuildingStorey); //var heightProperty = ifcBuildingStorey.GetTotalHeightProperty(); //if (heightProperty != null) //{ // FloorHeightValue = new DecimalValueType // { // DecimalValue = heightProperty.LengthValue, // DecimalValueSpecified = true, // UnitName = heightProperty.Unit.GetName() // }; //} var spaces = ifcBuildingStorey.GetSpaces(); var ifcSpaces = spaces as IList <IfcSpace> ?? spaces.ToList(); if (ifcSpaces.Any()) { Spaces = new SpaceCollectionType { Space = new List <SpaceType>(ifcSpaces.Count) }; for (var i = 0; i < ifcSpaces.Count; i++) { Spaces.Add(new SpaceType(ifcSpaces[i], helper)); } } //Attributes var ifcAttributes = helper.GetAttributes(ifcBuildingStorey); if (ifcAttributes != null && ifcAttributes.Any()) { FloorAttributes = new AttributeCollectionType { Attribute = ifcAttributes } } ; //TODO: //Space Issues //Space Documents }