Beispiel #1
0
        public void LoadDefault()
        {
            UnitLength.Clear();
            UnitRank.Clear();

            SetDefaultValues();
        }
Beispiel #2
0
        static public string Description(this UnitLength me)
        {
            switch (me)
            {
            case UnitLength.m: return("meter: Standard unit of length, [m]");

            case UnitLength.dm: return("decimeter: 1 [m] = 10 [dm]");

            case UnitLength.cm: return("centimeter: 1 [m] = 100 [cm]");

            case UnitLength.mm: return("milimeter: 1 [m] = 1000 [mm]");

            case UnitLength.mile: return("mile: 1760 [yd] = 1 [mile]");

            case UnitLength.yd: return("(international) yard: 1250 [yd] = 1143 [m] (Int yard and pound agreemend 1959)");

            case UnitLength.ft: return("foot: 3 [ft] = 1 [yd]");

            case UnitLength.inch: return("inch:  36 [in] = 1 [yd]");
            }
            var msg = $"(UnitLength)0x{(ulong)me:x16}";

#if USE_LOG4NET
            log.Debug($"Lengths: type not recognised: '{msg}'");
#endif
            return($"Length: [{msg}]");
        }
Beispiel #3
0
        static public string ToString(this UnitLength me, bool append_brackets)
        {
            switch (me)
            {
            case UnitLength.m:   return((append_brackets) ? "[m]" : "m");

            case UnitLength.dm:   return((append_brackets) ? "[dm]" : "dm");

            case UnitLength.cm:   return((append_brackets) ? "[cm]" : "cm");

            case UnitLength.mm:   return((append_brackets) ? "[mm]" : "mm");

            case UnitLength.mile: return((append_brackets) ? "[mile]" : "mile");

            case UnitLength.yd: return((append_brackets) ? "[yd]" : "yd");

            case UnitLength.ft: return((append_brackets) ? "[ft]" : "ft");

            case UnitLength.inch: return((append_brackets) ? "[in]" : "in");
            }
            var msg = $"(UnitLength)0x{(ulong)me:x16}";

#if USE_LOG4NET
            log.Debug($"Lengths: type not recognised: '{msg}'");
#endif
            return((append_brackets) ? $"[{msg}]" : msg);
        }
Beispiel #4
0
        static public double Factor(this UnitLength me)
        {
            switch (me)
            {
            case UnitLength.m:   return(1.0);                                           //      meter [m],           1 m = Standard unit of length

            case UnitLength.dm:   return(10.0 * UnitLength.m.Factor());                 //  decimeter [dm/m],        1 m = 10 dm

            case UnitLength.cm:   return(100.0 * UnitLength.m.Factor());                // centimeter [cm/m],        1 m = 100 cm

            case UnitLength.mm:   return(1000.0 * UnitLength.m.Factor());               //  milimeter [mm/m],        1 m = 1000 mm

            // international yard and pound agreemend 1959.
            case UnitLength.mile: return(UnitLength.yd.Factor() / 1760.0);              //       mile [mile/yd], 1760 yd = 1 mile

            case UnitLength.yd: return((1250.0 / 1143.0) * UnitLength.m.Factor());      //       yard [yd/m],    1250 (international) yards = 1143 meters

            case UnitLength.ft: return(3.0 * UnitLength.yd.Factor());                   //       foot [ft/yd],      3 ft = 1 yd

            case UnitLength.inch: return(36.0 * UnitLength.yd.Factor());                //       inch [in/yd],     36 in = 1 yd
            }
#if USE_LOG4NET
            log.Debug($"Lengths: type not recognised: '(UnitLength)0x{(ulong)me:x16}'");
#endif
            return(0.0);
        }
        public double GetConvertedValLength(double value, string from, string to)
        {
            UnitsReflectionHelper <UnitLength> helper = new UnitsReflectionHelper <UnitLength>();
            UnitLength unitFrom = helper.GetUnit(from);
            UnitLength unitTo   = helper.GetUnit(to);

            return(new Length(value, unitFrom).GetConvertedVal(unitTo));
        }
Beispiel #6
0
        void SL_Zoom_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
        {
            double percentage = e.NewValue / SL_Main.Maximum;

            if (percentage == 0)
            {
                return;
            }
            double value = percentage * (MaxUnitLength);

            UnitLength         = value;
            CurrentDepth       = currentDepth;
            this.TBK_Zoom.Text = string.Format("刻度:{0}", UnitLength.ToString("0.00"));
            RepaintAll();
            this.ShowModifiablePoints();
        }
 public Chunk(char character, int length)
 {
     Character  = character;
     Length     = length;
     UnitLength = UnitLength.shortUnit;
 }
Beispiel #8
0
 public void Clear()
 {
     UnitLength.Clear();
     UnitRank.Clear();
 }
Beispiel #9
0
 public void DeletUnit(string currentUnitName)
 {
     UnitLength.Remove(currentUnitName);
     UnitRank.Remove(currentUnitName);
 }
Beispiel #10
0
 public void ZoomOut()
 {
     UnitLength *= 1 / zoomFactor;
     Drawing.RaiseStatusNotification(UnitLength.ToString());
 }
 public new MaximalHeight Convert(UnitLength to)
 {
     base.Convert(to);
     return(this);
 }
 public MaximalHeight(double val, UnitLength unit) : base(val, unit)
 {
 }
 public InitialHeight(double val, UnitLength unit) : base(val, unit)
 {
 }
 public Length Convert(UnitLength to)
 {
     base.Convert(to);
     return(this);
 }
 public Length(double val, UnitLength unit) : base(val, unit)
 {
     CheckValueWithException(CheckValueCompareWithZero.LargerOrEqualToZero, "The length or height must be larger or equal to zero");
 }
Beispiel #16
0
 static public Unit Base(this UnitLength me)
 {
     return(BASE);
 }