Example #1
0
        internal double ScaleSI(IfcDerivedUnitEnum unitType)
        {
            IfcDerivedUnit derivedUnit = this[unitType];

            if (derivedUnit != null)
            {
                return(derivedUnit.SIFactor);
            }
            return(1);
        }
Example #2
0
 internal double ScaleSI(IfcDerivedUnitEnum unitType)
 {
     foreach (IfcDerivedUnit derivedUnit in Units.OfType <IfcDerivedUnit>())
     {
         if (derivedUnit.UnitType == unitType)
         {
             return(derivedUnit.SIFactor);
         }
     }
     return(1);
 }
Example #3
0
 internal double getScaleSI(IfcDerivedUnitEnum unitType)
 {
     foreach (IfcUnit u in Units)
     {
         IfcDerivedUnit du = u as IfcDerivedUnit;
         if (du != null)
         {
         }
     }
     return(1);
 }
Example #4
0
 internal IfcDerivedUnit Find(IfcDerivedUnitEnum unit)
 {
     foreach (IfcUnit u in Units)
     {
         IfcDerivedUnit du = u as IfcDerivedUnit;
         if (du != null && du.UnitType == unit)
         {
             return(du);
         }
     }
     return(null);
 }
Example #5
0
 public IfcDerivedUnit this[IfcDerivedUnitEnum unit]
 {
     get
     {
         foreach (IfcUnit u in Units)
         {
             IfcDerivedUnit du = u as IfcDerivedUnit;
             if (du != null && du.UnitType == unit)
             {
                 return(du);
             }
         }
         return(null);
     }
 }
Example #6
0
        public virtual void IfcParse(int propIndex, IPropertyValue value)
        {
            switch (propIndex)
            {
            case 0:
                ((IXbimNoNotifyCollection)_elements).Add((IfcDerivedUnitElement)value.EntityVal);
                break;

            case 1:
                _unitType = (IfcDerivedUnitEnum)Enum.Parse(typeof(IfcDerivedUnitEnum), value.EnumVal.ToUpper());
                break;

            case 2:
                _userDefinedType = value.StringVal;
                break;

            default:
                this.HandleUnexpectedAttribute(propIndex, value); break;
            }
        }
Example #7
0
        public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex)
        {
            switch (propIndex)
            {
            case 0:
                _elements.InternalAdd((IfcDerivedUnitElement)value.EntityVal);
                return;

            case 1:
                _unitType = (IfcDerivedUnitEnum)System.Enum.Parse(typeof(IfcDerivedUnitEnum), value.EnumVal, true);
                return;

            case 2:
                _userDefinedType = value.StringVal;
                return;

            default:
                throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper()));
            }
        }
Example #8
0
        internal double getScaleSI(IfcDerivedUnitEnum unitType)
        {
            List<IfcUnit> units = Units;
            foreach (IfcUnit u in units)
            {
                IfcDerivedUnit du = u as IfcDerivedUnit;
                if (du != null)
                {

                }
            }
            return 1;
        }
Example #9
0
        static bool getDerivedUnitRepStr(IIfcUnit unitDef, out IfcDerivedUnitEnum unitType, out string unitRepStr)
        {
            // Initialize the static Dicts, if it is still empty upon the first use. These Dicts do not need to be reset
            setupUnitRep();

            unitType = IfcDerivedUnitEnum.USERDEFINED;   // initial value
            IIfcDerivedUnit derivedUnit = unitDef as IIfcDerivedUnit;

            unitType = derivedUnit.UnitType;

            unitRepStr = string.Empty;
            IList <string> positiveExpUnits = new List <string>();
            IList <string> negativeExpUnits = new List <string>();

            foreach (IIfcDerivedUnitElement dUnitElem in derivedUnit.Elements)
            {
                IfcUnitEnum elemUnitType;
                string      elemUnitRepStr = string.Empty;
                int         exponent       = (int)dUnitElem.Exponent;
                if (getNamedUnitRepStr(dUnitElem.Unit, out elemUnitType, out elemUnitRepStr))
                {
                    if (exponent >= 0)
                    {
                        if (exponent > 1)
                        {
                            elemUnitRepStr = elemUnitRepStr + "^" + exponent.ToString();
                        }
                        //elemUnitRepStr = elemUnitRepStr + unicodeSuperScript(exponent);
                        positiveExpUnits.Add(elemUnitRepStr);
                    }
                    else
                    {
                        if (exponent < -1)
                        {
                            elemUnitRepStr = elemUnitRepStr + "^" + Math.Abs(exponent).ToString();
                        }
                        //elemUnitRepStr = elemUnitRepStr + unicodeSuperScript(Math.Abs(exponent));
                        negativeExpUnits.Add(elemUnitRepStr);
                    }
                }
            }

            if (positiveExpUnits.Count > 0)
            {
                foreach (string elemUnit in positiveExpUnits)
                {
                    BIMRLCommon.appendToString(elemUnit, ".", ref unitRepStr);
                    //BAIFCCommon.appendToString(elemUnit, "\u22C5", ref negUnitRepStr);
                }
            }
            else
            {
                if (negativeExpUnits.Count > 0)
                {
                    unitRepStr = "1";
                }
            }

            string negUnitRepStr = string.Empty;

            if (negativeExpUnits.Count > 0)
            {
                foreach (string elemUnit in negativeExpUnits)
                {
                    BIMRLCommon.appendToString(elemUnit, "ยท", ref negUnitRepStr);
                    //BAIFCCommon.appendToString(elemUnit, "\u22C5", ref negUnitRepStr);
                }
            }
            if (!string.IsNullOrEmpty(negUnitRepStr))
            {
                unitRepStr += "/" + negUnitRepStr;
            }

            if (!string.IsNullOrEmpty(unitRepStr))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #10
0
		internal IfcDerivedUnit(IfcDerivedUnitElement element, IfcDerivedUnitEnum type) : base(element.mDatabase) { mElements.Add(element.mIndex); mUnitType = type;  }
Example #11
0
		//internal string UserDefinedType { get { } }

		internal IfcDerivedUnit(IfcDerivedUnit v) : base() { mElements = new List<int>(v.mElements.ToArray()); mUnitType = v.mUnitType; mUserDefinedType = v.mUserDefinedType; }
Example #12
0
 public IfcDerivedUnit(List <IfcDerivedUnitElement> elements, IfcDerivedUnitEnum unitType, IfcLabel userDefinedType) : base()
 {
     Elements        = elements;
     UnitType        = unitType;
     UserDefinedType = userDefinedType;
 }
Example #13
0
 public IfcDerivedUnit(IfcDerivedUnitElement[] __Elements, IfcDerivedUnitEnum __UnitType, IfcLabel?__UserDefinedType)
 {
     this.Elements        = new HashSet <IfcDerivedUnitElement>(__Elements);
     this.UnitType        = __UnitType;
     this.UserDefinedType = __UserDefinedType;
 }
Example #14
0
        }                                                                                                                                                  // derived


        /// <summary>
        /// Construct a IfcDerivedUnit with all required attributes.
        /// </summary>
        public IfcDerivedUnit(List <IfcDerivedUnitElement> elements, IfcDerivedUnitEnum unitType) : base()
        {
            Elements = elements;
            UnitType = unitType;
        }
Example #15
0
		internal IfcDerivedUnit(DatabaseIfc db, IfcDerivedUnit u) : base(db) { Elements = u.Elements.ConvertAll(x=>db.Factory.Duplicate(x) as IfcDerivedUnitElement); mUnitType = u.mUnitType; mUserDefinedType = u.mUserDefinedType; }
Example #16
0
 internal IfcDerivedUnit Find(IfcDerivedUnitEnum unit)
 {
     List<IfcUnit> units = Units;
     foreach (IfcUnit u in units)
     {
         IfcDerivedUnit du = u as IfcDerivedUnit;
         if (du != null && du.UnitType == unit)
             return du;
     }
     return null;
 }
Example #17
0
		internal IfcDerivedUnit(IfcDerivedUnitElement due1, IfcDerivedUnitElement due2, IfcDerivedUnitElement due3, IfcDerivedUnitEnum type) : base(due1.mDatabase) { mElements.Add(due1.mIndex); mElements.Add(due2.mIndex); mElements.Add(due3.mIndex); mUnitType = type;  }
Example #18
0
		internal IfcDerivedUnit(List<IfcDerivedUnitElement> elements, IfcDerivedUnitEnum type) : base(elements[0].mDatabase) { mElements = elements.ConvertAll(x => x.mIndex); mUnitType = type; }