protected IfcNamedUnit(DatabaseIfc db, IfcNamedUnit u) : base(db, u) { if (u.mDimensions != null) { Dimensions = db.Factory.Duplicate(u.Dimensions) as IfcDimensionalExponents; } mUnitType = u.mUnitType; }
internal void Replace(IfcNamedUnit unit) { IfcNamedUnit existing = mUnits.OfType <IfcNamedUnit>().Where(x => x.UnitType == unit.UnitType).FirstOrDefault(); if (existing != null) { mUnits.Remove(existing); } Units.Add(unit); }
internal void Replace(IfcConversionBasedUnit cbu) { for (int icounter = 0; icounter < mUnits.Count; icounter++) { IfcNamedUnit u = mDatabase[mUnits[icounter]] as IfcNamedUnit; if (u != null && u.UnitType == cbu.UnitType) { mUnits[icounter] = cbu.mIndex; return; } } }
internal IfcNamedUnit Find(IfcUnitEnum unit) { foreach (IfcUnit u in Units) { IfcNamedUnit nu = u as IfcNamedUnit; if (nu != null && nu.UnitType == unit) { return(nu); } } return(null); }
internal void Replace(IfcNamedUnit unit) { for (int icounter = 0; icounter < mUnits.Count; icounter++) { IfcNamedUnit u = mUnits[icounter] as IfcNamedUnit; if (u != null && u.UnitType == unit.UnitType) { mUnits[icounter] = unit; return; } } Units.Add(unit); }
public IfcNamedUnit this[IfcUnitEnum unit] { get { foreach (IfcUnit u in Units) { IfcNamedUnit nu = u as IfcNamedUnit; if (nu != null && nu.UnitType == unit) { return(nu); } } return(null); } }
internal double ScaleSI(IfcUnitEnum unitType) { IfcNamedUnit namedUnit = this[unitType]; if (namedUnit != null) { IfcSIUnit siUnit = namedUnit as IfcSIUnit; if (siUnit != null) { return(siUnit.SIFactor); } IfcConversionBasedUnit conversionBasedUnit = namedUnit as IfcConversionBasedUnit; if (conversionBasedUnit != null) { return(conversionBasedUnit.SIFactor); } } return(1); }
internal double getScaleSI(IfcUnitEnum unitType) { foreach (IfcUnit u in Units) { IfcNamedUnit nu = u as IfcNamedUnit; if (nu != null && nu.UnitType == unitType) { IfcSIUnit si = nu as IfcSIUnit; if (si != null) { return(si.getSIFactor()); } IfcConversionBasedUnit cbu = nu as IfcConversionBasedUnit; if (cbu != null) { return(cbu.getSIFactor()); } } } return(1); }
protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options) { base.setJSON(obj, host, options); string str = MapProjection; if (!string.IsNullOrEmpty(str)) { obj["MapProjection"] = str; } str = MapZone; if (!string.IsNullOrEmpty(str)) { obj["MapZone"] = str; } IfcNamedUnit unit = MapUnit; if (unit != null) { obj["MapUnit"] = unit.getJson(this, options); } }
internal IfcQuantityArea(DatabaseIfc m, string name, string desc, IfcNamedUnit unit, double area, string formula) : base(m, name, desc, unit) { mAreaValue = area; mFormula = formula; }
protected static void parseFields(IfcNamedUnit u, List <string> arrFields, ref int ipos) { u.mDimensions = ParserSTEP.ParseLink(arrFields[ipos++]); u.mUnitType = (IfcUnitEnum)Enum.Parse(typeof(IfcUnitEnum), arrFields[ipos++].Replace(".", "")); }
protected IfcNamedUnit(IfcNamedUnit p) : base() { mDimensions = p.mDimensions; mUnitType = p.mUnitType; }
public IfcDerivedUnitElement(IfcNamedUnit u, int exponent) : base(u.mDatabase) { mUnit = u.mIndex; mExponent = exponent; }
internal IfcQuantityWeight(DatabaseIfc m, string name, string desc, IfcNamedUnit unit, double weight, string formula) : base(m, name, desc, unit) { mWeightValue = weight; mFormula = formula; }
internal void setStructuralUnits() { if (mStructuralSet) { return; } mStructuralSet = true; DatabaseIfc m = mDatabase; IfcNamedUnit fu = Find(IfcUnitEnum.FORCEUNIT); if (fu == null) { fu = new IfcSIUnit(m, IfcUnitEnum.FORCEUNIT, IfcSIPrefix.NONE, IfcSIUnitName.NEWTON); AddUnit(fu); } IfcSIUnit lengthSI = m.Factory.SILength, volumeSI = m.Factory.SIVolume; if (Find(IfcDerivedUnitEnum.TORQUEUNIT) == null) { AddUnit(new IfcDerivedUnit(new IfcDerivedUnitElement(fu, 1), new IfcDerivedUnitElement(lengthSI, 1), IfcDerivedUnitEnum.TORQUEUNIT)); } if (Find(IfcDerivedUnitEnum.LINEARFORCEUNIT) == null) { AddUnit(new IfcDerivedUnit(new IfcDerivedUnitElement(fu, 1), new IfcDerivedUnitElement(lengthSI, -1), IfcDerivedUnitEnum.LINEARFORCEUNIT)); } if (Find(IfcDerivedUnitEnum.LINEARMOMENTUNIT) == null) { AddUnit(new IfcDerivedUnit(new IfcDerivedUnitElement(fu, 1), IfcDerivedUnitEnum.LINEARMOMENTUNIT)); } if (Find(IfcDerivedUnitEnum.PLANARFORCEUNIT) == null) { AddUnit(new IfcDerivedUnit(new IfcDerivedUnitElement(fu, 1), new IfcDerivedUnitElement(lengthSI, -2), IfcDerivedUnitEnum.PLANARFORCEUNIT)); } if (Find(IfcDerivedUnitEnum.MODULUSOFELASTICITYUNIT) == null) { AddUnit(new IfcDerivedUnit(new IfcDerivedUnitElement(fu, 1), new IfcDerivedUnitElement(lengthSI, -2), IfcDerivedUnitEnum.MODULUSOFELASTICITYUNIT)); } IfcNamedUnit time = Find(IfcUnitEnum.TIMEUNIT); if (time == null || Math.Abs(time.getSIFactor() - 1) < mDatabase.Tolerance) { time = new IfcSIUnit(mDatabase, IfcUnitEnum.TIMEUNIT, IfcSIPrefix.NONE, IfcSIUnitName.SECOND); } if (Find(IfcDerivedUnitEnum.ACCELERATIONUNIT) == null) { AddUnit(new IfcDerivedUnit(new IfcDerivedUnitElement(lengthSI, 1), new IfcDerivedUnitElement(time, -2), IfcDerivedUnitEnum.ACCELERATIONUNIT)); } if (Find(IfcUnitEnum.PRESSUREUNIT) == null) { AddUnit(new IfcSIUnit(m, IfcUnitEnum.PRESSUREUNIT, IfcSIPrefix.NONE, IfcSIUnitName.PASCAL)); } if (Find(IfcDerivedUnitEnum.SECTIONMODULUSUNIT) == null) { AddUnit(new IfcDerivedUnit(new IfcDerivedUnitElement(lengthSI, 3), IfcDerivedUnitEnum.SECTIONMODULUSUNIT)); } if (Find(IfcDerivedUnitEnum.MOMENTOFINERTIAUNIT) == null) { AddUnit(new IfcDerivedUnit(new IfcDerivedUnitElement(lengthSI, 4), IfcDerivedUnitEnum.MOMENTOFINERTIAUNIT)); } IfcSIUnit massu = Find(IfcUnitEnum.MASSUNIT) as IfcSIUnit; if (massu == null) { massu = new IfcSIUnit(m, IfcUnitEnum.MASSUNIT, IfcSIPrefix.KILO, IfcSIUnitName.GRAM); AddUnit(massu); } if (Find(IfcDerivedUnitEnum.MASSDENSITYUNIT) == null) { AddUnit(new IfcDerivedUnit(new IfcDerivedUnitElement(massu, 1), new IfcDerivedUnitElement(volumeSI, -1), IfcDerivedUnitEnum.MASSDENSITYUNIT)); } IfcSIUnit kelvin = Find(IfcUnitEnum.THERMODYNAMICTEMPERATUREUNIT) as IfcSIUnit; if (kelvin == null) { kelvin = new IfcSIUnit(m, IfcUnitEnum.THERMODYNAMICTEMPERATUREUNIT, IfcSIPrefix.NONE, IfcSIUnitName.KELVIN); AddUnit(kelvin); } if (Find(IfcDerivedUnitEnum.THERMALEXPANSIONCOEFFICIENTUNIT) == null) { AddUnit(new IfcDerivedUnit(new IfcDerivedUnitElement(kelvin, -1), IfcDerivedUnitEnum.THERMALEXPANSIONCOEFFICIENTUNIT)); } if (Find(IfcDerivedUnitEnum.LINEARSTIFFNESSUNIT) == null) { AddUnit(new IfcDerivedUnit(new IfcDerivedUnitElement(fu, 1), new IfcDerivedUnitElement(lengthSI, -1), IfcDerivedUnitEnum.LINEARSTIFFNESSUNIT)); } IfcNamedUnit radians = Find(IfcUnitEnum.PLANEANGLEUNIT); if (radians == null || Math.Abs(radians.getSIFactor() - 1) < mDatabase.Tolerance) { radians = new IfcSIUnit(mDatabase, IfcUnitEnum.PLANEANGLEUNIT, IfcSIPrefix.NONE, IfcSIUnitName.RADIAN); } if (Find(IfcDerivedUnitEnum.ROTATIONALSTIFFNESSUNIT) == null) { AddUnit(new IfcDerivedUnit(new IfcDerivedUnitElement(fu, 1), new IfcDerivedUnitElement(lengthSI, 1), new IfcDerivedUnitElement(radians, -1), IfcDerivedUnitEnum.ROTATIONALSTIFFNESSUNIT)); } }
internal IfcQuantityTime(DatabaseIfc m, string name, string desc, IfcNamedUnit unit, int ifctimemeasure, string formula) : base(m, name, desc, unit) { mTimeValue = ifctimemeasure; mFormula = formula; }
internal IfcQuantityLength(DatabaseIfc m, string name, string desc, IfcNamedUnit unit, double length, string formula) : base(m, name, desc, unit) { mLengthValue = length; mFormula = formula; }
protected IfcNamedUnit(DatabaseIfc db, IfcNamedUnit u) : base(db,u) { if(u.mDimensions > 0) Dimensions = db.Factory.Duplicate(u.Dimensions) as IfcDimensionalExponents; mUnitType = u.mUnitType; }
internal IfcQuantityCount(DatabaseIfc m, string name, string desc, IfcNamedUnit unit, double count, string formula) : base(m, name, desc, unit) { mCountValue = count; mFormula = formula; }
internal IfcQuantityVolume(DatabaseIfc m, string name, string desc, IfcNamedUnit unit, double vol, string formula) : base(m, name, desc, unit) { mVolumeValue = vol; mFormula = formula; }
internal IfcPropertyBoundedValue(DatabaseIfc m, string name, string desc, IfcValue upper, IfcValue lower, IfcNamedUnit unit, IfcValue set) : base(m, name, desc) { mUpperBoundValue = upper; mLowerBoundValue = lower; mSetPointValue = set; if (unit != null) mUnit = unit.mIndex; }
internal IfcPropertyListValue(DatabaseIfc m, string name, string desc, IfcNamedUnit unit, List<IfcValue> values) : base(m, name, desc) { if (unit != null) mUnit = unit.mIndex; mNominalValue = values; }
protected IfcPhysicalSimpleQuantity(DatabaseIfc m, string name, string desc, IfcNamedUnit unit) : base(m, name, desc) { Unit = unit; }
protected static void parseFields(IfcNamedUnit u, List<string> arrFields, ref int ipos) { u.mDimensions = ParserSTEP.ParseLink(arrFields[ipos++]); u.mUnitType = (IfcUnitEnum)Enum.Parse(typeof(IfcUnitEnum), arrFields[ipos++].Replace(".", "")); }
internal IfcProjectedCRS(IfcProjectedCRS m) : base(m) { mName = m.mName; mMapZone = m.mMapZone; mMapUnit = m.mMapUnit; }