void GetUnit(XmlNode node) { String unitStr = GetAttr(node, "unit", "millimeter"); switch (unitStr) { default: case "millimeter": m_unit = eUnit.Millimeter; m_scaleFactor = 1.0f; break; case "inch": m_unit = eUnit.Inch; m_scaleFactor = 25.4f; break; case "meter": m_unit = eUnit.Meter; m_scaleFactor = 1000.0f; break; case "micron": m_unit = eUnit.Micron; m_scaleFactor = 1.0f / 1000.0f; break; case "feet": m_unit = eUnit.Feet; m_scaleFactor = 12.0f * 2.54f; break; } }
private static void CheckUnitEqualityAndThrowException(eUnit UnitA, eUnit UnitB) { if (UnitA != UnitB) { throw new UnitIncorrectException(); } }
public static ConfigFile Load(string filename) { var result = new ConfigFile(); var list = result.SizeList; using (var sr = new System.IO.StreamReader(filename)) { while (!sr.EndOfStream) { string line = sr.ReadLine(); if (line.Trim().StartsWith("#")) { continue; } string[] parts = line.Split(separator, StringSplitOptions.RemoveEmptyEntries); if (parts.Length < 4) { continue; } float w = float.Parse(parts[0]); float h = float.Parse(parts[1]); eUnit u = (eUnit)Enum.Parse(typeof(eUnit), parts[2]); string n = parts[3]; var item = new CanvasSize() { name = n, width = w, height = h, unit = u }; list.Add(item); } } return(result); }
public static eUnit Get(eUnitOperator TheOperation, eUnit A, eUnit B) { if (TheOperation == eUnitOperator.Division) { return(DivisionLUT[(int)A, (int)B]); } else { return(MultiplicationLUT[(int)A, (int)B]); } }
public Distance(double value, eUnit unit) { if (unit == eUnit.Kilometres) { Kilometres = value; } else if (unit == eUnit.Metres) { Metres = value; } else { Miles = value; } }
/// <summary> /// Sets pressure value. /// </summary> /// <param name="value">Pressure value.</param> /// <param name="unit">Pressure unit.</param> public void Set(double value, eUnit unit) { Unit = unit; if (value <= 0) { throw new ArgumentException("Pressure value cannot be less or equal 0.", "value"); } if (unit == eUnit.hPa) { QNH = (int)value; } else { mmHq = value; } }
public Unit GetUnit(eUnit unit) { return(m_listunits[(int)unit]); }
/// <summary>Initializes a new instance of the <see cref="WDItemEntity"/> class.</summary> /// <param name="path">The path.</param> /// <param name="file">The file.</param> /// <param name="size">The size.</param> /// <param name="unit">The unit.</param> public WDItemEntity(string file, int size, eUnit unit) { File = file; Size = size; Unit = unit; }
public CNumberWithUnit(double TheValue, eUnit TheUnit) { Value = Value; Unit = TheUnit; }