public SessionComponentDefinition(string id, string englishLabel, MeasurementTypes measurementType, Func <string, bool> elligibilityFilter, string renamingTemplate)
 {
     Id                 = id;
     _englishLabel      = englishLabel;
     MeasurementType    = measurementType;
     ElligibilityFilter = elligibilityFilter;
     _renamingTemplate  = renamingTemplate;
 }
Exemplo n.º 2
0
 public void addMeasurement(int chann, MeasurementTypes type)
 {
     measurements.Add(new Measurement(type, chann));
     if (measurements.Count > 5)
     {
         measurements.RemoveRange(0, 1);
     }
 }
Exemplo n.º 3
0
        public async Task HandleMeasuredChange(MeasurementTypes value)
        {
            FormModel.FormInputs.Measured = value;

            await HandleSubmitAsync().ConfigureAwait(false);

            _ = Task.CompletedTask;
        }
Exemplo n.º 4
0
 public void addMeasurement(int chann, MeasurementTypes type)
 {
     measurements.Add(new Measurement(type, chann));
     if (measurements.Count > maxMeasCount)
     {
         measurements.RemoveRange(0, 1);
     }
     if (type == MeasurementTypes.PHASE)
     {
         calcAllTimes = true;
     }
 }
Exemplo n.º 5
0
 public async void LoadTypesAsync(SynchronizationContext uiContext)
 {
     foreach (var type in await _simulator.GetMeasurementTypes())
     {
         uiContext.Send(x => {
             MeasurementTypes.Add(type);
             _typesLoaded = true;
             UpdateSimulationReady();
         }, null);
     }
     uiContext.Send(x => CurrentMeasurementType = MeasurementTypes.FirstOrDefault(), null);
 }
Exemplo n.º 6
0
 /// ------------------------------------------------------------------------------------
 public ComponentRole(Type relevantElementType, string id, string englishLabel,
                      MeasurementTypes measurementType, Func <string, bool> elligibilityFilter,
                      string renamingTemplate, Color color, Color textColor)
 {
     Id = id;
     RelevantElementType = relevantElementType;
     _englishLabel       = englishLabel;
     MeasurementType     = measurementType;
     _elligibilityFilter = elligibilityFilter;
     _renamingTemplate   = renamingTemplate;
     Color     = color;
     TextColor = textColor;
 }
        public MeasurementType LookupFromName(MeasurementType type)
        {
            if (type != null && type.Id == 0 && type.Name != null)
            {
                MeasurementTypes lookupType = (MeasurementTypes)Enum.Parse(typeof(MeasurementTypes), type.Name);

                type = new MeasurementType
                {
                    Id   = (int)lookupType,
                    Name = lookupType.ToString()
                };
            }

            return(type);
        }
Exemplo n.º 8
0
 public Measurement(MeasurementTypes type, double quantity)
 {
     this.measurementTypeM    = type;
     this.measurementQuantity = quantity;
 }
Exemplo n.º 9
0
        public static void UpdateMeasurement(int id, string name, string description, MeasurementTypes type)
        {
            try
            {
                using (RecipeBook_DataModelDataContext db = new RecipeBook_DataModelDataContext())
                {
                    var original = from mes in db.Measurements where mes.mes_ID == id select mes;
                    foreach (Measurement m in original)
                    {
                        m.mes_Name = name;
                        m.mes_Description = description;
                        m.mes_Type = (int)type;
                    }
                    db.SubmitChanges();
                }
            }
            catch (Exception)
            {

                throw;
            }
        }
Exemplo n.º 10
0
 public static void InsertMeasurement(string name, string description, MeasurementTypes type)
 {
     try
     {
         using (RecipeBook_DataModelDataContext db = new RecipeBook_DataModelDataContext())
         {
             Measurement m = new Measurement();
             m.mes_Name = name;
             m.mes_Description = description;
             m.mes_Type = (int)type;
             db.Measurements.InsertOnSubmit(m);
             db.SubmitChanges();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 11
0
 public Measurement(MeasurementTypes meas, int chan)
 {
     this.measType = meas;
     this.measChann = chan;
 }
Exemplo n.º 12
0
 public Measurement(MeasurementTypes meas, int chan)
 {
     this.measType  = meas;
     this.measChann = chan;
 }
Exemplo n.º 13
0
        //This is a simpler approach then the one used in the current GIS-Tool
        //But it's working ;)

        /// <summary>
        /// Calculate a conversion factor between the units
        /// (Original code by Paul Meems)
        /// </summary>
        /// <returns></returns>
        private static double CalcConversionFactor(UnitOfMeasure orgUnits, UnitOfMeasure calcUnits, MeasurementTypes measurementTypes)
        {
            try
            {
                // First we're going to determine the conversion factor from the orgUnits to meters
                // Second we're going to determine the conversion factor from the calcUnits to meters
                // Thirth the overall conversion factor is (conversion factor orgUnits) / (conversion factor calcUnits)

                Exception DecDegException = new Exception("Conversion To/From Decimal Degrees requires the use of 'FromDecimalDegrees' function or 'ToDecimalDegrees' function");
                double    cfMapUnits = 1, cfCalcUnits = 1;
                // Step 1: convert to mapUnits to meters:
                switch (orgUnits)
                {
                case UnitOfMeasure.Centimeters:
                    cfMapUnits = ConversionFactorsSQUnits.CentimetersToMeters;
                    break;

                case UnitOfMeasure.DecimalDegrees:
                    cfMapUnits = 1;     //no conversion
                    break;

                case UnitOfMeasure.Feet:
                    cfMapUnits = ConversionFactorsSQUnits.FeetToMeters;
                    break;

                case UnitOfMeasure.Inches:
                    cfMapUnits = ConversionFactorsSQUnits.InchesToMeters;
                    break;

                case UnitOfMeasure.Kilometers:
                    cfMapUnits = ConversionFactorsSQUnits.KilometersToMeters;
                    break;

                case UnitOfMeasure.Miles:
                    cfMapUnits = ConversionFactorsSQUnits.MilesToMeters;
                    break;

                case UnitOfMeasure.Millimeters:
                    cfMapUnits = ConversionFactorsSQUnits.MillimeterToMeters;
                    break;

                case UnitOfMeasure.Yards:
                    cfMapUnits = ConversionFactorsSQUnits.YardsToMeters;
                    break;

                case UnitOfMeasure.NauticalMiles:
                    cfMapUnits = ConversionFactorsSQUnits.NauticalMilesToMeters;
                    break;

                case UnitOfMeasure.Acres:
                    cfMapUnits = ConversionFactorsSQUnits.AcresToMeters;
                    // When using acres feet are more likely to be wanted for perimeter, thanks to Jack for pointing this out.
                    if (measurementTypes != MeasurementTypes.Area)
                    {
                        cfMapUnits = ConversionFactorsSQUnits.FeetToMeters;
                    }
                    break;

                case UnitOfMeasure.Hectares:
                    cfMapUnits = ConversionFactorsSQUnits.HectaresToMeters;
                    if (measurementTypes != MeasurementTypes.Area)
                    {
                        cfMapUnits = ConversionFactorsSQUnits.MetersToMeters;
                    }
                    break;

                default:
                    cfMapUnits = 1;
                    break;
                }
                if (measurementTypes == MeasurementTypes.Area && !(orgUnits == UnitOfMeasure.Acres || orgUnits == UnitOfMeasure.Hectares))
                {
                    cfMapUnits *= cfMapUnits; // Squared
                }
                // Step 2: convert to calcUnits to meters:
                switch (calcUnits)
                {
                case UnitOfMeasure.Centimeters:
                    cfCalcUnits = ConversionFactorsSQUnits.CentimetersToMeters;
                    break;

                case UnitOfMeasure.DecimalDegrees:
                    cfCalcUnits = 1;     //no conversion
                    break;

                case UnitOfMeasure.Feet:
                    cfCalcUnits = ConversionFactorsSQUnits.FeetToMeters;
                    break;

                case UnitOfMeasure.Inches:
                    cfCalcUnits = ConversionFactorsSQUnits.InchesToMeters;
                    break;

                case UnitOfMeasure.Kilometers:
                    cfCalcUnits = ConversionFactorsSQUnits.KilometersToMeters;
                    break;

                case UnitOfMeasure.Miles:
                    cfCalcUnits = ConversionFactorsSQUnits.MilesToMeters;
                    break;

                case UnitOfMeasure.NauticalMiles:
                    cfCalcUnits = ConversionFactorsSQUnits.NauticalMilesToMeters;
                    break;

                case UnitOfMeasure.Millimeters:
                    cfCalcUnits = ConversionFactorsSQUnits.MillimeterToMeters;
                    break;

                case UnitOfMeasure.Yards:
                    cfCalcUnits = ConversionFactorsSQUnits.YardsToMeters;
                    break;

                case UnitOfMeasure.Acres:
                    cfCalcUnits = ConversionFactorsSQUnits.AcresToMeters;
                    if (measurementTypes != MeasurementTypes.Area)
                    {
                        cfCalcUnits = ConversionFactorsSQUnits.FeetToMeters;
                    }
                    break;

                case UnitOfMeasure.Hectares:
                    cfCalcUnits = ConversionFactorsSQUnits.HectaresToMeters;
                    if (measurementTypes != MeasurementTypes.Area)
                    {
                        cfCalcUnits = ConversionFactorsSQUnits.MetersToMeters;
                    }
                    break;

                default:
                    cfCalcUnits = 1;
                    break;
                }
                if (measurementTypes == MeasurementTypes.Area && !(calcUnits == UnitOfMeasure.Acres || calcUnits == UnitOfMeasure.Hectares))
                {
                    cfCalcUnits *= cfCalcUnits; // Squared
                }
                return(cfMapUnits / cfCalcUnits);
            }
            catch (Exception ex)
            {
                throw new Exception("Error in convertUnits: \n" + ex.ToString());
            }
        }