Exemple #1
0
        public override bool Equals(object obj)
        {
            // Check for null
            if (obj == null)
            {
                return(false);
            }

            // Check for type
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }

            // Cast as IfcRoot
            IfcUnitAssignment root = (IfcUnitAssignment)obj;

            return(this == root);
        }
 public override void IfcParse(int propIndex, IPropertyValue value)
 {
     switch (propIndex)
     {
         case 0:
         case 1:
         case 2:
         case 3:
         case 4:
             base.IfcParse(propIndex, value);
             break;
         case 5:
             _longName = value.StringVal;
             break;
         case 6:
             _phase = value.StringVal;
             break;
         case 7:
             _representationContexts.Add((IfcRepresentationContext) value.EntityVal);
             break;
         case 8:
             _unitsInContext = (IfcUnitAssignment) value.EntityVal;
             break;
         default:
             this.HandleUnexpectedAttribute(propIndex, value); break;
     }
 }
 private void AddQuantityPSet(IfcElementQuantity pSet, IfcUnitAssignment modelUnits)
 {
     if (pSet == null)
         return;
     foreach (var item in pSet.Quantities.OfType<IfcPhysicalSimpleQuantity>())
         // currently only handles IfcPhysicalSimpleQuantity
     {
         var v = modelUnits.GetUnitFor(item);
         _quantities.Add(new PropertyItem
         {
             PropertySetName = pSet.Name,
             Name = item.Name,
             Value = item + " " + v.GetName()
         });
     }
 }
 public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
 {
     string str = value as string;
     if (str != null)
     {
         if (str == "SI")
         {
             IfcUnitAssignment ua = new IfcUnitAssignment();
             ua.Units.Add_Reversible(new IfcSIUnit
                                         {
                                             UnitType = IfcUnitEnum.LENGTHUNIT,
                                             Name = IfcSIUnitName.METRE,
                                             Prefix = IfcSIPrefix.MILLI
                                         });
             ua.Units.Add_Reversible(new IfcSIUnit
                                         {UnitType = IfcUnitEnum.AREAUNIT, Name = IfcSIUnitName.SQUARE_METRE});
             ua.Units.Add_Reversible(new IfcSIUnit
                                         {UnitType = IfcUnitEnum.VOLUMEUNIT, Name = IfcSIUnitName.CUBIC_METRE});
             ua.Units.Add_Reversible(new IfcSIUnit
                                         {UnitType = IfcUnitEnum.SOLIDANGLEUNIT, Name = IfcSIUnitName.STERADIAN});
             ua.Units.Add_Reversible(new IfcSIUnit
                                         {UnitType = IfcUnitEnum.PLANEANGLEUNIT, Name = IfcSIUnitName.RADIAN});
             ua.Units.Add_Reversible(new IfcSIUnit {UnitType = IfcUnitEnum.MASSUNIT, Name = IfcSIUnitName.GRAM});
             ua.Units.Add_Reversible(new IfcSIUnit {UnitType = IfcUnitEnum.TIMEUNIT, Name = IfcSIUnitName.SECOND});
             ua.Units.Add_Reversible(new IfcSIUnit
                                         {
                                             UnitType = IfcUnitEnum.THERMODYNAMICTEMPERATUREUNIT,
                                             Name = IfcSIUnitName.DEGREE_CELSIUS
                                         });
             ua.Units.Add_Reversible(new IfcSIUnit
                                         {
                                             UnitType = IfcUnitEnum.LUMINOUSINTENSITYUNIT,
                                             Name = IfcSIUnitName.LUMEN
                                         });
             return ua;
         }
     }
     return base.ConvertFrom(context, culture, value);
 }