Esempio n. 1
0
        internal UnitOfMeasure ClonePowerProduct(UnitOfMeasure uom1, UnitOfMeasure uom2)
        {
            bool          invert = false;
            UnitOfMeasure one    = MeasurementSystem.GetSystem().GetOne();

            // check if quotient
            if (GetMeasurementType().Equals(MeasurementType.QUOTIENT))
            {
                if (uom2.Equals(one))
                {
                    string msg = String.Format(MeasurementSystem.GetMessage("incompatible.units"), this, one);
                    throw new Exception(msg);
                }
                invert = true;
            }
            else
            {
                if (uom1.Equals(one) || uom2.Equals(one))
                {
                    string msg = String.Format(MeasurementSystem.GetMessage("incompatible.units"), this, one);
                    throw new Exception(msg);
                }
            }

            UnitOfMeasure newUOM = uom1.MultiplyOrDivide(uom2, invert);

            newUOM.UOMType = UOMType;

            return(newUOM);
        }
Esempio n. 2
0
        public static MeasurementsUnit GetSystemUnits(MeasurementSystem measureSys, int unitOrdinal)
        {
            MeasurementsUnit measurementsUnit;

            //if (measureSys == null)
            //{
            //  if (unitOrdinal < 0 || unitOrdinal >= (int)englishUnits.Length)
            //  {
            //      throw new InconsistencyException("Oops");
            //  }
            //  measurementsUnit = englishUnits[unitOrdinal];
            //}
            //else
            {
                if (measureSys != MeasurementSystem.Metric)
                {
                    throw new InconsistencyException("Oops");
                }
                if (unitOrdinal < 0 || unitOrdinal >= (int)metricUnits.Length)
                {
                    throw new InconsistencyException("Oops");
                }
                measurementsUnit = metricUnits[unitOrdinal];
            }
            return(measurementsUnit);
        }
Esempio n. 3
0
        /// <summary>Define a conversion with the specified scaling factor, abscissa unit of
        /// measure and scaling factor.</summary>
        ///
        /// <param name="scalingFactor">Factor</param>
        /// <param name="abscissaUnit">UnitOfMeasure</param>
        /// <param name="offset">Offset</param>
        ///
        public void SetConversion(double scalingFactor, UnitOfMeasure abscissaUnit, double offset)
        {
            if (abscissaUnit == null)
            {
                throw new Exception(MeasurementSystem.GetMessage("unit.cannot.be.null"));
            }

            // self conversion is special
            if (this.Equals(abscissaUnit))
            {
                if (scalingFactor.CompareTo(1) != 0 || offset.CompareTo(0) != 0)
                {
                    throw new Exception(MeasurementSystem.GetMessage("conversion.not.allowed"));
                }
            }

            // unit has been previously cached, so first remove it, then cache again
            MeasurementSystem.GetSystem().UnregisterUnit(this);
            SetBaseSymbol(null);

            ScalingFactor = scalingFactor;
            AbscissaUnit  = abscissaUnit;
            Offset        = offset;

            // re-cache
            MeasurementSystem.GetSystem().RegisterUnit(this);


            // remove from conversion registry
            if (ConversionRegistry.ContainsKey(abscissaUnit))
            {
                ConversionRegistry.Remove(abscissaUnit);
            }
        }
Esempio n. 4
0
        public void TestSystemFilterAsLeaf()
        {
            // Setup
            var sys = new MeasurementSystem {
                Key    = "test",
                Parent = MeasurementCorpus.FindSystem("siCommon")
            };

            MeasurementCorpus.AllSystems.Add(sys);

            // Test
            Assert.IsTrue(MeasurementCorpus.SystemFilter(sys));
            MeasurementCorpus.Options.IgnoredSystemsForUnits.Add(sys);
            Assert.IsFalse(MeasurementCorpus.SystemFilter(sys));
            MeasurementCorpus.Options.IgnoredSystemsForUnits.Clear();
            Assert.IsTrue(MeasurementCorpus.SystemFilter(sys));

            MeasurementCorpus.Options.IgnoredSystemsForUnits.Add(sys.Parent);
            Assert.IsTrue(MeasurementCorpus.SystemFilter(sys));
            Assert.IsFalse(MeasurementCorpus.SystemFilter(sys.Parent));
            Assert.IsFalse(MeasurementCorpus.SystemFilter(sys.Parent.Parent));
            MeasurementCorpus.Options.AllowedSystemsForUnits.Add(sys.Parent.Parent);
            Assert.IsTrue(MeasurementCorpus.SystemFilter(sys.Parent.Parent));
            Assert.IsTrue(MeasurementCorpus.SystemFilter(sys.Parent.Parent.Parent));

            // Cleanup
            MeasurementCorpus.AllSystems.Remove(sys);
        }
Esempio n. 5
0
        public void TestSystemComparer()
        {
            var sys1 = new MeasurementSystem {
                Key = "test1"
            };
            var sys2 = new MeasurementSystem {
                Key = "test1"
            };

            Assert.AreEqual(0, MeasurementSystemComparer.Comparer.Compare(null, null));
            Assert.AreEqual(1, MeasurementSystemComparer.Comparer.Compare(sys1, null));
            Assert.AreEqual(-1, MeasurementSystemComparer.Comparer.Compare(null, sys2));
            Assert.AreEqual(0, MeasurementSystemComparer.Comparer.Compare(sys1, sys2));

            sys1.Key = "test0";
            Assert.AreEqual(1, MeasurementSystemComparer.Comparer.Compare(sys1, sys2));
            sys1.Key = "test1";

            sys1.Parent = MeasurementCorpus.FindSystem("siCommon");
            Assert.AreEqual(-1, MeasurementSystemComparer.Comparer.Compare(sys1, sys2));
            sys2.Parent = MeasurementCorpus.FindSystem("siCommon");
            Assert.AreEqual(0, MeasurementSystemComparer.Comparer.Compare(sys1, sys2));
            sys1.Parent = MeasurementCorpus.FindSystem("si");
            Assert.AreEqual(1, MeasurementSystemComparer.Comparer.Compare(sys1, sys2));
        }
Esempio n. 6
0
 private static double ConvertToUnit(double length, MeasurementSystem measurementSystem)
 {
     if (measurementSystem == MeasurementSystem.Imperial)
     {
         return(length * 3.28084d);
     }
     return(length);
 }
Esempio n. 7
0
 private void CheckOffset(UnitOfMeasure other)
 {
     if (other.Offset.CompareTo(0) != 0)
     {
         string msg = String.Format(MeasurementSystem.GetMessage("offset.not.supported"), other.ToString());
         throw new Exception(msg);
     }
 }
Esempio n. 8
0
        /// <summary>Raise this quantity to the specified power</summary>
        ///
        /// <param name="exponent">Exponent</param>
        ///
        /// <returns>new Quantity</returns>
        ///
        public Quantity Power(int exponent)
        {
            double        amount = Math.Pow(Amount, exponent);
            UnitOfMeasure newUOM = MeasurementSystem.GetSystem().CreatePowerUOM(UOM, exponent);

            Quantity quantity = new Quantity(amount, newUOM);

            return(quantity);
        }
Esempio n. 9
0
 public AppUser(string email, string hashedPassword, string salt, double height, GenderType gender, MeasurementSystem measurementSystemPreference)
 {
     Email          = email;
     HashedPassword = hashedPassword;
     Salt           = salt;
     Gender         = gender;
     Height         = height;
     MeasurementSystemPreference = measurementSystemPreference;
 }
Esempio n. 10
0
        public SmtPackageCode(double length, double width, MeasurementSystem measurementSystem = MeasurementSystem.Metric)
        {
            Check.InRange(length, 0.25, 7.4, nameof(length));
            Check.InRange(width, 0.125, 5.1, nameof(width));

            _length            = length;
            _width             = width;
            _measurementSystem = measurementSystem;
        }
Esempio n. 11
0
 private QuantitativeLab(
     double result,
     QuantitativeLabType type,
     MeasurementSystem measurementSystem = MeasurementSystem.TraditionalUs) : this()
 {
     Result            = result;
     Type              = type;
     MeasurementSystem = measurementSystem;
 }
Esempio n. 12
0
 /// <summary>Create an amount of a quantity that adheres to precision and rounding
 /// settings from a string</summary>
 ///
 /// <param name="value">Text value of amount</param>
 ///
 /// <returns>Amount</returns>
 ///
 public static double CreateAmount(string value)
 {
     // use string constructor for exact precision with rounding mode in math
     // context
     if (value == null)
     {
         throw new Exception(MeasurementSystem.GetMessage("amount.cannot.be.null"));
     }
     return(System.Convert.ToDouble(value));
 }
Esempio n. 13
0
        /// <summary>Reduce the number of bytes to its highest measureable unit.</summary>
        /// <param name="type">The system of measurement to use.</param>
        /// <param name="abbreviate">Whether or not to abbreviate the unit name.</param>
        /// <param name="precision">The number of digits after the decimal point to show.</param>
        /// <returns>A formatted string containing the number of bytes and unit name.</returns>
        public string Units(MeasurementSystem type, bool abbreviate, int precision)
        {
            string temp = "n/a";

            try {
                temp = units(NumBytes, type, abbreviate, precision);
            } catch (ArithmeticException) {}

            return(temp);
        }
        public void LoadUserData(User_Data ud)
        {
            User.Height = ud.Height;
            String unit = ud.Unit;

            if (unit.Equals("me"))
            {
                unit = "metrical";
            }
            Preference.MeasurementSystem = MeasurementSystem.GetMeasurementSystem(unit);
        }
Esempio n. 15
0
        protected override double ConvertToPrimitive(MeasurementSystem targetSystem)
        {
            switch (targetSystem)
            {
            case MeasurementSystem.InternationalSystemOfUnits:
                return(InnerValue);

            default:
                throw new MeasureSystemException(Exceptions.NotSupported_MeasurementSystem);
            }
        }
 private static void CheckRemoveParent(ref List <MeasurementSystem> toRemove, MeasurementSystem parent)
 {
     if (parent != null)
     {
         if (!Options.AllowedSystemsForUnits.Contains(parent))
         {
             toRemove.Add(parent);
             CheckRemoveParent(ref toRemove, parent.Parent);
         }
     }
 }
Esempio n. 17
0
        /// <summary>
        /// Gets the quantifier name for the specified targetMeasurementSystem.
        /// </summary>
        /// <param name="targetMeasurementSystem">Target measurement system.</param>
        /// <param name="isAbbreviation">If set to <c>true</c> is abbreviation.</param>
        public override string this [MeasurementSystem targetMeasurementSystem, bool isAbbreviation] {
            get {
                switch (targetMeasurementSystem)
                {
                case MeasurementSystem.InternationalSystemOfUnits:
                    return(isAbbreviation ? ISOUQuantifiers.A_Mass : ISOUQuantifiers.F_Mass);

                default:
                    throw new ArgumentOutOfRangeException("targetMeasurementSystem", Exceptions.NotSupported_MeasurementSystem);
                }
            }
        }
 public static double ConvertWeight(double value, MeasurementSystem source, MeasurementSystem destination)
 {
     if (source == destination)
     {
         return(value);
     }
     if (source == MeasurementSystem.Imperial)
     {
         return(value * _kilogramsInOnePound); // convert to metric
     }
     return(value / _kilogramsInOnePound);     // convert to imperial
 }
 public static double ConvertLength(double value, MeasurementSystem source, MeasurementSystem destination)
 {
     if (source == destination)
     {
         return(value);
     }
     if (source == MeasurementSystem.Imperial)
     {
         return(value * _centimetersInOneInch); // convert to metric
     }
     return(value / _centimetersInOneInch);     // convert to imperial
 }
Esempio n. 20
0
            // add a UOM and exponent pair to the map of reduced Terms
            private void AddTerm(UnitOfMeasure uom, bool invert)
            {
                int unitPower = 1;
                int power     = 0;

                if (!invert)
                {
                    // get existing power
                    if (!Terms.ContainsKey(uom))
                    {
                        // add first time
                        power = unitPower;
                    }
                    else
                    {
                        // increment existing power
                        if (!uom.Equals(MeasurementSystem.GetSystem().GetOne()))
                        {
                            power = Terms[uom] + unitPower;
                        }
                    }
                }
                else
                {
                    // denominator with negative powers
                    if (!Terms.ContainsKey(uom))
                    {
                        // add first time
                        power = -unitPower;
                    }
                    else
                    {
                        // decrement existing power
                        if (!uom.Equals(MeasurementSystem.GetSystem().GetOne()))
                        {
                            power = Terms[uom] - unitPower;
                        }
                    }
                }

                if (power == 0)
                {
                    Terms.Remove(uom);
                }
                else
                {
                    if (!uom.Equals(MeasurementSystem.GetSystem().GetOne()))
                    {
                        Terms[uom] = power;
                    }
                }
            }
Esempio n. 21
0
        private static void CheckTypes(UnitOfMeasure uom1, UnitOfMeasure uom2)
        {
            UnitType thisType   = uom1.UOMType;
            UnitType targetType = uom2.UOMType;

            if (thisType != UnitType.UNCLASSIFIED && targetType != UnitType.UNCLASSIFIED && !thisType.Equals(UnitType.UNITY) &&
                !targetType.Equals(UnitType.UNITY) && !thisType.Equals(targetType))
            {
                string msg = String.Format(MeasurementSystem.GetMessage("must.be.same.as"), uom1, uom1.UOMType,
                                           uom2, uom2.UOMType);
                throw new Exception(msg);
            }
        }
Esempio n. 22
0
 public MeasurementSystemDTO(MeasurementSystem measurementSystemPreference)
 {
     MeasurementSystemName = measurementSystemPreference.ToString();;
     if (measurementSystemPreference == MeasurementSystem.Imperial)
     {
         LengthUnit = "in";
         WeightUnit = "lb";
     }
     else
     {
         LengthUnit = "cm";
         WeightUnit = "kg";
     }
 }
Esempio n. 23
0
 public string this[MeasurementSystem key]
 {
     get {
         switch ( key ) {
         case MeasurementSystem.Metric:
             return MeasurementMetricName;
         case MeasurementSystem.Us:
             return MeasurementUsName;
         case MeasurementSystem.Uk:
             return MeasurementUkName;
         }
         return null;
     }
 }
 private void ParseSystems(Dictionary <string, object> systemsJson)
 {
     foreach (KeyValuePair <string, object> systemKeyValuePair in systemsJson)
     {
         var systemJson = (Dictionary <string, object>)systemKeyValuePair.Value;
         var system     = new MeasurementSystem {
             Key          = systemKeyValuePair.Key,
             Name         = Parse <string>(systemJson, "name"),
             IsHistorical = Parse <bool>(systemJson, "historical"),
             Inherits     = Parse <string>(systemJson, "inherits")
         };
         MeasurementCorpus.AllSystems.Add(system);
     }
 }
Esempio n. 25
0
        /// <summary>
        /// Prompt user for height and weight.  Boolean returns if input was valid or not.
        /// </summary>
        /// <param name="theBmi">A new Bmi object</param>
        /// <returns>True if valid input, false if invalid input</returns>
        private static bool InputBmiFactors(out Bmi theBmi)
        {
            bool              returnValue = true;
            double            h = 0, w = 0;
            MeasurementSystem sys = MeasurementSystem.Imperial;

            WriteLine("Measurements can be either Imperial (pounds and inches) or Metric (kilograms and meters).");
            WriteLine("Do you wish to enter Imperial or Metric?");
            switch (ReadLine().ToUpper())
            {
            case "IMPERIAL":
                sys = MeasurementSystem.Imperial;
                break;

            case "METRIC":
                sys = MeasurementSystem.Metric;
                break;

            default:
                returnValue = false;
                break;
            }

            //Get height
            if (returnValue)
            {
                Write("Please enter your height:  ");
                returnValue = double.TryParse(ReadLine(), out h);
            }

            //Get width
            if (returnValue)
            {
                Write("Please enter your weight:  ");
                returnValue = double.TryParse(ReadLine(), out w);
            }

            if (!returnValue)
            {
                WriteLine("Invalid input.");
            }

            theBmi        = new Bmi();
            theBmi.Height = h;
            theBmi.Weight = w;
            theBmi.MeasureTypePreference = sys;

            return(returnValue);
        }
Esempio n. 26
0
        /// <summary>Invert a unit of measure to create a new one</summary>
        ///
        /// <returns> UnitOfMeasure</returns>
        ///
        public UnitOfMeasure Invert()
        {
            UnitOfMeasure inverted = null;

            if (Exponent2.HasValue && Exponent2.Value < 0)
            {
                inverted = GetDivisor().Divide(GetDividend());
            }
            else
            {
                inverted = MeasurementSystem.GetSystem().GetOne().Divide(this);
            }

            return(inverted);
        }
Esempio n. 27
0
        public static MeasurementSystem GetUnitsSystem(MeasurementsUnit units)
        {
            MeasurementSystem measurementSystem = MeasurementSystem.English;

            MeasurementsUnit[] measurementsUnits = metricUnits;
            for (int i = 0; i < (int)measurementsUnits.Length; i++)
            {
                if (measurementsUnits[i] == units)
                {
                    measurementSystem = MeasurementSystem.Metric;
                    break;
                }
            }
            return(measurementSystem);
        }
Esempio n. 28
0
        protected override void ConvertFromPrimitive(double sourceValue, MeasurementSystem sourceSystem)
        {
            if (sourceValue < 0)
            {
                throw new MeasureException(string.Format(Exceptions.NegativeValuesNotAllowed, MeasuresName.Mass));
            }
            switch (sourceSystem)
            {
            case MeasurementSystem.InternationalSystemOfUnits:
                InnerValue = sourceValue;
                break;

            default:
                throw new MeasureSystemException(Exceptions.NotSupported_MeasurementSystem);
            }
        }
Esempio n. 29
0
        /// <summary>Set the dividend and divisor</summary>
        ///
        /// <param name="dividend">Dividend</param>
        /// <param name="divisor">Divisor</param>
        public void SetQuotientUnits(UnitOfMeasure dividend, UnitOfMeasure divisor)
        {
            if (dividend == null)
            {
                string msg = String.Format(MeasurementSystem.GetMessage("dividend.cannot.be.null"), Symbol);
                throw new Exception(msg);
            }

            if (divisor == null)
            {
                string msg = String.Format(MeasurementSystem.GetMessage("divisor.cannot.be.null"), Symbol);
                throw new Exception(msg);
            }

            SetPowerProduct(dividend, 1, divisor, -1);
        }
Esempio n. 30
0
        /// <summary>Set the multiplier and multiplicand</summary>
        ///
        /// <param name="multiplier">Multiplier</param>
        /// <param name="multiplicand">Multiplicand</param>
        public void SetProductUnits(UnitOfMeasure multiplier, UnitOfMeasure multiplicand)
        {
            if (multiplier == null)
            {
                string msg = String.Format(MeasurementSystem.GetMessage("multiplier.cannot.be.null"), Symbol);
                throw new Exception(msg);
            }

            if (multiplicand == null)
            {
                string msg = String.Format(MeasurementSystem.GetMessage("multiplicand.cannot.be.null"), Symbol);
                throw new Exception(msg);
            }

            SetPowerProduct(multiplier, 1, multiplicand, 1);
        }
        public Shewhart()
        {
            InitializeComponent();

            System.Windows.Forms.Application.EnableVisualStyles();

            // Create a Windows Forms checkbox control and assign
            // it as the WindowsFormsHost element's child.

            var measSys = new MeasurementSystem();
            measSys.SetPreambula(SiPreambuledUnitType.Hz, SiPreambula.Giga);

            _graphPlotControl = new GraphPlotControl(CoordinateSystemType.Users);

            var measurement = new ShewharMeasurement
            {
                Foundry = 0,
                Process = 0,
                TestName = "CMIM",
                TrendManager = new TrendManager(TrendsFactory.GetAllTrends())
            };

            var shewhartChart = new ShewhartControlChart(measurement.TrendManager);

            shewhartChart.Abscisses[0].Title = "Number";
            shewhartChart.Ordinates[0].Title = "Value";

            _graphPlotControl.Plot.CoordinateSystem = shewhartChart;

            _graphPlotControl.Plot.Legend.Visible = false;
            _graphPlotControl.BorderStyle = BorderStyle.None;
            _graphPlotControl.MeasurementSystem = measSys;
            _graphPlotControl.Plot.CoordinateSystem.SweepValueQuantityType = PhysicalQuantityType.Frequencies;
            _graphPlotControl.Plot.Data = MakeData(measurement);

              //  _graphPlotControl.Tag = megaMeasurement;

            graphicsHost.Child = _graphPlotControl;

            // Cause the OnFlowDirectionChange delegate to be called.
            graphicsHost.FlowDirection = System.Windows.FlowDirection.LeftToRight;

            // Cause the OnClipChange delegate to be called.
            graphicsHost.Clip = new RectangleGeometry();
        }
Esempio n. 32
0
		public MeasurementUnit (MeasurementSystem msys, string unit, string abbr)
		{

			this.MeasurementSystem = msys;
			this.UnitName = unit;
			this.UnitAbbreviation = abbr;

			this.SaveUnit = new Command<MeasurementUnit> ((uom) => {
				//Save the preferences to the model.
				if(this.Id == 0) {
					//we need to insert
				}
				else {
					//we need to update
				}
			});

		}
        public Histogram()
        {
            InitializeComponent();

            System.Windows.Forms.Application.EnableVisualStyles();

            // Create a Windows Forms checkbox control and assign
            // it as the WindowsFormsHost element's child.

            var measSys = new MeasurementSystem();
            measSys.SetPreambula(SiPreambuledUnitType.Hz, SiPreambula.Giga);

            _integralPlotControl = new IntegralGraphControl();
            _integralPlotControl.Data = MakeData();

            var graphPlotControl = (GraphPlotControl)_integralPlotControl.Graphs[0];
            graphPlotControl.BorderStyle = BorderStyle.None;
            graphPlotControl.MeasurementSystem = measSys;
            graphPlotControl.Plot.CoordinateSystem.SweepValueQuantityType = PhysicalQuantityType.Frequencies;
            graphPlotControl.GraphTitle = "Histogram";

            var ftMeas = new FtMeasurement
            {
                Foundry = 0,
                Process = 0,
                Wafer = "C2",
                ElementType = "Transistor",
                ElementSubTypes = new List<string> { "T240" },
            };

            var megaMeas = new MegaMeasurement();

            megaMeas.Add(ftMeas);

            graphPlotControl.Tag = megaMeas;

            graphicsHost.Child = _integralPlotControl;

            // Cause the OnFlowDirectionChange delegate to be called.
            graphicsHost.FlowDirection = System.Windows.FlowDirection.LeftToRight;

            // Cause the OnClipChange delegate to be called.
            graphicsHost.Clip = new RectangleGeometry();
        }
        public Measurement()
        {
            InitializeComponent();

            System.Windows.Forms.Application.EnableVisualStyles();

            var measuremForm = new MeasurementToDBFormXML();
            var measSys = new MeasurementSystem();

            measSys.SetPreambula(SiPreambuledUnitType.Hz, SiPreambula.Giga);

            measuremForm.MeasurementSystem = measSys;

            measureHost.Child = measuremForm;

            // Cause the OnFlowDirectionChange delegate to be called.
            measureHost.FlowDirection = System.Windows.FlowDirection.LeftToRight;

            // Cause the OnClipChange delegate to be called.
            measureHost.Clip = new RectangleGeometry();
        }
        public PageAddStatistics()
        {
            InitializeComponent();

            var statisticsPage = new AddMeasurementPageXML();

            var measSys = new MeasurementSystem();
            measSys.SetPreambula(SiPreambuledUnitType.Hz, SiPreambula.Giga);

            var data = new AddMeasurementPageXMLData() {MeasurementSystem = measSys};

            statisticsPage.SetData(data);

            AddStatisticsHost.Child = statisticsPage;

            // Cause the OnFlowDirectionChange delegate to be called.
            AddStatisticsHost.FlowDirection = System.Windows.FlowDirection.LeftToRight;

            // Cause the OnClipChange delegate to be called.
            AddStatisticsHost.Clip = new RectangleGeometry();
        }
        private void SplitTraces_Click(object sender, RoutedEventArgs e)
        {
            Measurements.Visibility = SplitTraces.Visibility = System.Windows.Visibility.Collapsed;
            JoinTraces.Visibility = System.Windows.Visibility.Visible;

            _integralPlotControl.Data.ComplexFunctions[1].GraphIndex = 1;
            _integralPlotControl.Data.ComplexFunctions[0].Visible = true;
            _integralPlotControl.Data.ComplexFunctions[1].Visible = true;

            _integralPlotControl.UpdateAllGraphs();

            var measSys = new MeasurementSystem();
            measSys.SetPreambula(SiPreambuledUnitType.Hz, SiPreambula.Giga);
            var graphPlotControl = (GraphPlotControl)_integralPlotControl.Graphs[0];
            graphPlotControl.Plot.CoordinateSystem = new WaferDiagram();
            graphPlotControl.Plot.Legend.Visible = false;
            graphPlotControl.BorderStyle = BorderStyle.None;
            graphPlotControl.MeasurementSystem = measSys;
            graphPlotControl.Plot.CoordinateSystem.SweepValueQuantityType = PhysicalQuantityType.Frequencies;
            graphPlotControl.GraphTitle = "Wafer 1";
            graphPlotControl.UpdateData();

            graphPlotControl = (GraphPlotControl)_integralPlotControl.Graphs[1];
            graphPlotControl.Plot.CoordinateSystem = new WaferDiagram();
            graphPlotControl.Plot.Legend.Visible = false;
            graphPlotControl.BorderStyle = BorderStyle.None;
            graphPlotControl.MeasurementSystem = measSys;
            graphPlotControl.Plot.CoordinateSystem.SweepValueQuantityType = PhysicalQuantityType.Scalar;
            graphPlotControl.GraphTitle = "Wafer 2";
            graphPlotControl.UpdateData();
        }
        public Page2()
        {
            InitializeComponent();

            System.Windows.Forms.Application.EnableVisualStyles();

            // Create a Windows Forms checkbox control and assign
            // it as the WindowsFormsHost element's child.

            var measSys = new MeasurementSystem();
            measSys.SetPreambula(SiPreambuledUnitType.Hz, SiPreambula.Giga);

            _integralPlotControl = new IntegralGraphControl();
            _integralPlotControl.Data = MakeData();

            var graphPlotControl = (GraphPlotControl)_integralPlotControl.Graphs[0];
            graphPlotControl.Plot.CoordinateSystem = new WaferDiagram();
            graphPlotControl.Plot.Legend.Visible = false;
            graphPlotControl.BorderStyle = BorderStyle.None;
            graphPlotControl.MeasurementSystem = measSys;
            graphPlotControl.Plot.CoordinateSystem.SweepValueQuantityType = PhysicalQuantityType.Frequencies;
            graphPlotControl.GraphTitle = "Wafer";

            var sMeas = new SMeasurement
                            {
                                Foundry = 0,
                                Process = 0,
                                Wafer = "C2",
                                ElementType = "Transistor",
                                ElementSubTypes = new List<string> {"T240"},
                                Frequency = 10000000000,
                                TransformMode = ComplexToComplexTransformMode.Magnitude,
                                IsDB = true
                            };

            var ftMeas = new FtMeasurement
            {
                Foundry = 0,
                Process = 0,
                Wafer = "C2",
                ElementType = "Transistor",
                ElementSubTypes = new List<string> { "T240" },
            };

            var megaMeas = new MegaMeasurement();

            megaMeas.Add(ftMeas);
            megaMeas.Add(sMeas);

            graphPlotControl.Tag = megaMeas;

            graphicsHost.Child = _integralPlotControl;

            // Cause the OnFlowDirectionChange delegate to be called.
            graphicsHost.FlowDirection = System.Windows.FlowDirection.LeftToRight;

            // Cause the OnClipChange delegate to be called.
            graphicsHost.Clip = new RectangleGeometry();

            _filterPage = new GraphicFilterPage();
            var wafer = graphPlotControl.Plot.CoordinateSystem as WaferDiagram;
            var data = new GraphicFilterPage.Data { GraphPlot = graphPlotControl, FilterCriteria = wafer.FilterCriteria };
            _filterPage.MeasurementSystem = graphPlotControl.MeasurementSystem;

            _filterPage.SetData(data);       // Передаем данные в диалог настроек.

            filterPageHost.Child = _filterPage;

            UpdateRadioButtons();
        }
Esempio n. 38
0
        public static MeasurementsUnit GetSystemUnits(MeasurementSystem measureSys, int unitOrdinal)
        {
            MeasurementsUnit measurementsUnit;

            //if (measureSys == null)
            //{
            //  if (unitOrdinal < 0 || unitOrdinal >= (int)englishUnits.Length)
            //  {
            //      throw new InconsistencyException("Oops");
            //  }
            //  measurementsUnit = englishUnits[unitOrdinal];
            //}
            //else
            {
                if (measureSys != MeasurementSystem.Metric)
                {
                    throw new InconsistencyException("Oops");
                }
                if (unitOrdinal < 0 || unitOrdinal >= (int)metricUnits.Length)
                {
                    throw new InconsistencyException("Oops");
                }
                measurementsUnit = metricUnits[unitOrdinal];
            }
            return measurementsUnit;
        }
Esempio n. 39
0
        public Unit Create(string name, string abbreviation, string description, Dimension dimension, MeasurementSystem measurementSystem)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(name));
            Contract.Requires(!string.IsNullOrWhiteSpace(abbreviation));
            Contract.Requires(dimension != null);

            Contract.Ensures(Contract.Result<Unit>() != null && Contract.Result<Unit>().Id >= 0);

            Unit u = new Unit()
            {
                Name = name,
                Abbreviation = abbreviation,
                Description = description,
                Dimension = dimension,
                MeasurementSystem = measurementSystem,
            };

            using (IUnitOfWork uow = this.GetUnitOfWork())
            {
                IRepository<Unit> repo = uow.GetRepository<Unit>();
                repo.Put(u);
                uow.Commit();
            }
            return (u);
        }