Exemplo n.º 1
0
        public static float GetAngleDistance(MeasurementFlags flags)
        {
            if ((flags & MeasurementFlags.Blueprint) != 0)
                return 10f;

            return 15f;
        }
Exemplo n.º 2
0
        protected MeasurementFlags GetMeasurementFlags(IMeasurement measurement)
        {
            MeasurementStateFlags tslFlags = measurement.StateFlags;    // Time-series Library Measurement State Flags
            MeasurementFlags      ecaflags = MeasurementFlags.Normal;   // openECA Measurement Flags

            MeasurementStateFlags badValueFlags =
                MeasurementStateFlags.BadData |
                MeasurementStateFlags.SuspectData |
                MeasurementStateFlags.ReceivedAsBad |
                MeasurementStateFlags.DiscardedValue |
                MeasurementStateFlags.MeasurementError;

            if ((tslFlags & badValueFlags) != MeasurementStateFlags.Normal)
            {
                ecaflags |= MeasurementFlags.BadValue;
            }

            MeasurementStateFlags badTimeFlags =
                MeasurementStateFlags.BadTime |
                MeasurementStateFlags.SuspectTime |
                MeasurementStateFlags.LateTimeAlarm |
                MeasurementStateFlags.FutureTimeAlarm;

            if ((tslFlags & badTimeFlags) != MeasurementStateFlags.Normal)
            {
                ecaflags |= MeasurementFlags.BadTime;
            }

            MeasurementStateFlags calculatedValueFlags =
                MeasurementStateFlags.CalculatedValue |
                MeasurementStateFlags.UpSampled |
                MeasurementStateFlags.DownSampled;

            if ((tslFlags & calculatedValueFlags) != MeasurementStateFlags.Normal)
            {
                ecaflags |= MeasurementFlags.CalculatedValue;
            }

            MeasurementStateFlags unreasonableValueFlags =
                MeasurementStateFlags.OverRangeError |
                MeasurementStateFlags.UnderRangeError |
                MeasurementStateFlags.AlarmHigh |
                MeasurementStateFlags.AlarmLow |
                MeasurementStateFlags.WarningHigh |
                MeasurementStateFlags.WarningLow |
                MeasurementStateFlags.FlatlineAlarm |
                MeasurementStateFlags.ComparisonAlarm |
                MeasurementStateFlags.ROCAlarm |
                MeasurementStateFlags.CalculationError |
                MeasurementStateFlags.CalculationWarning |
                MeasurementStateFlags.SystemError |
                MeasurementStateFlags.SystemWarning;

            if ((tslFlags & unreasonableValueFlags) != MeasurementStateFlags.Normal)
            {
                ecaflags |= MeasurementFlags.UnreasonableValue;
            }

            return(ecaflags);
        }
 public DistanceMeasurement(float length, Vector3 position, bool isStraight, Vector3 startPosition, Vector3 endPosition, MeasurementFlags flags)
     : base(position, flags)
 {
     Length = length;
     IsStraight = isStraight;
     StartPosition = startPosition;
     EndPosition = endPosition;
 }
Exemplo n.º 4
0
 public DistanceMeasurement(float length, Vector3 position, bool isStraight, Vector3 startPosition,
                            Vector3 endPosition, MeasurementFlags flags)
     : base(position, flags)
 {
     Length        = length;
     IsStraight    = isStraight;
     StartPosition = startPosition;
     EndPosition   = endPosition;
 }
Exemplo n.º 5
0
        public static float GetAngleDistance(MeasurementFlags flags)
        {
            if ((flags & MeasurementFlags.Blueprint) != 0)
            {
                return(10f);
            }

            return(15f);
        }
Exemplo n.º 6
0
        public void MeasurementFlagsTest()
        {
            Measurement      target   = new Measurement(10, "ft");
            MeasurementFlags expected = MeasurementFlags.UseMaxBound;
            MeasurementFlags actual   = default(MeasurementFlags);

            target.Flags = expected;
            actual       = target.Flags;
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 7
0
        public static Color GetAngleColor(MeasurementFlags flags)
        {
            if ((flags & MeasurementFlags.Blueprint) != 0) {
                return Settings.BlueprintColor;
            }

            if ((flags & MeasurementFlags.Secondary) != 0) {
                return Settings.SecondaryColor;
            }

            return Settings.PrimaryColor;
        }
Exemplo n.º 8
0
        public static Color GetAngleColor(MeasurementFlags flags)
        {
            if ((flags & MeasurementFlags.Blueprint) != 0)
            {
                return(Settings.BlueprintColor);
            }

            if ((flags & MeasurementFlags.Secondary) != 0)
            {
                return(Settings.SecondaryColor);
            }

            return(Settings.PrimaryColor);
        }
Exemplo n.º 9
0
        protected MeasurementFlags GetMeasurementFlags(IMeasurement measurement)
        {
            MeasurementStateFlags tslFlags = measurement.StateFlags;    // Time-series Library Measurement State Flags
            MeasurementFlags      ecaflags = MeasurementFlags.Normal;   // openECA Measurement Flags

            if (tslFlags.HasFlag(MeasurementStateFlags.BadData) ||
                tslFlags.HasFlag(MeasurementStateFlags.SuspectData) ||
                tslFlags.HasFlag(MeasurementStateFlags.ReceivedAsBad) ||
                tslFlags.HasFlag(MeasurementStateFlags.DiscardedValue) ||
                tslFlags.HasFlag(MeasurementStateFlags.MeasurementError))
            {
                ecaflags |= MeasurementFlags.BadValue;
            }

            if (tslFlags.HasFlag(MeasurementStateFlags.BadTime) ||
                tslFlags.HasFlag(MeasurementStateFlags.SuspectTime) ||
                tslFlags.HasFlag(MeasurementStateFlags.LateTimeAlarm) ||
                tslFlags.HasFlag(MeasurementStateFlags.FutureTimeAlarm))
            {
                ecaflags |= MeasurementFlags.BadTime;
            }

            if (tslFlags.HasFlag(MeasurementStateFlags.CalcuatedValue) ||
                tslFlags.HasFlag(MeasurementStateFlags.UpSampled) ||
                tslFlags.HasFlag(MeasurementStateFlags.DownSampled))
            {
                ecaflags |= MeasurementFlags.CalculatedValue;
            }

            if (tslFlags.HasFlag(MeasurementStateFlags.OverRangeError) ||
                tslFlags.HasFlag(MeasurementStateFlags.UnderRangeError) ||
                tslFlags.HasFlag(MeasurementStateFlags.AlarmHigh) ||
                tslFlags.HasFlag(MeasurementStateFlags.AlarmLow) ||
                tslFlags.HasFlag(MeasurementStateFlags.WarningHigh) ||
                tslFlags.HasFlag(MeasurementStateFlags.WarningLow) ||
                tslFlags.HasFlag(MeasurementStateFlags.FlatlineAlarm) ||
                tslFlags.HasFlag(MeasurementStateFlags.ComparisonAlarm) ||
                tslFlags.HasFlag(MeasurementStateFlags.ROCAlarm) ||
                tslFlags.HasFlag(MeasurementStateFlags.CalculationError) ||
                tslFlags.HasFlag(MeasurementStateFlags.CalculationWarning) ||
                tslFlags.HasFlag(MeasurementStateFlags.SystemError) ||
                tslFlags.HasFlag(MeasurementStateFlags.SystemWarning))
            {
                ecaflags |= MeasurementFlags.UnreasonableValue;
            }

            return(ecaflags);
        }
Exemplo n.º 10
0
//#if !NETSTANDARD1_4
        public Measurement(double value, Unit unit, Result conversionResult = Result.NoError)
//#else
//        public Measurement(double value, Unit unit, Result conversionResult = null)
//#endif
        {
            // Reference the unit converter that created us.
            _uc               = new UnitConverter();
            _flags            = MeasurementFlags.None;
            _unit             = unit;
            _conversionResult = Result.NoError;
            _value            = value;
            _conversionResult = conversionResult;

            _maxbound      = 0;
            _minbound      = 0;
            _standardValue = 0;
            // _standardUnit = null;
            _symbol = null;
            //OnValueChanged = null;
            //OnUnitChanged = null;
        }
Exemplo n.º 11
0
        protected MeasurementStateFlags GetMeasurementStateFlags(MeasurementFlags ecaFlags)
        {
            MeasurementStateFlags tslFlags = MeasurementStateFlags.Normal;

            if (ecaFlags.HasFlag(MeasurementFlags.BadValue))
            {
                tslFlags |= MeasurementStateFlags.BadData;
            }

            if (ecaFlags.HasFlag(MeasurementFlags.BadTime))
            {
                tslFlags |= MeasurementStateFlags.BadTime;
            }

            if (ecaFlags.HasFlag(MeasurementFlags.CalculatedValue))
            {
                tslFlags |= MeasurementStateFlags.CalculatedValue;
            }

            if (ecaFlags.HasFlag(MeasurementFlags.UnreasonableValue))
            {
                tslFlags |= MeasurementStateFlags.OverRangeError | MeasurementStateFlags.UnderRangeError;
            }

            if (ecaFlags.HasFlag(MeasurementFlags.UserDefinedFlag1))
            {
                tslFlags |= MeasurementStateFlags.UserDefinedFlag1;
            }

            if (ecaFlags.HasFlag(MeasurementFlags.UserDefinedFlag2))
            {
                tslFlags |= MeasurementStateFlags.UserDefinedFlag2;
            }

            return(tslFlags);
        }
Exemplo n.º 12
0
        //public event EventHandler OnValueChanged;
        //public event EventHandler OnUnitChanged;
        #endregion
        #region "Constructors"
        public Measurement(string unitSymbol)
        {
            // Reference the unit converter that created us.
            _uc            = new UnitConverter();
            _flags         = MeasurementFlags.None;
            _maxbound      = 0;
            _minbound      = 0;
            _standardValue = 0;
            _symbol        = null;

            if (string.IsNullOrWhiteSpace(unitSymbol))
            {
                // System.Diagnostics.Debug.Print("First IF Statement")
                _unit             = null;
                _conversionResult = Result.BadUnit;
            }
            else
            {
                // System.Diagnostics.Debug.Print("First ELSE Statement")
                _unit             = _uc.GetUnitBySymbol(unitSymbol);
                _conversionResult = Result.NoError;

                if (_unit.Symbols.Contains(new Symbol {
                    Value = unitSymbol
                }))
                {
                    _symbol = unitSymbol;
                }
                else
                {
                    _symbol = _unit.DefaultSymbol;
                }
            }

            _value = 0;
        }
Exemplo n.º 13
0
 protected Measurement(Vector3 position, MeasurementFlags flags)
 {
     Position = position;
     Flags    = flags;
 }
 public AngleMeasurement(float size, Vector3 position, Vector3 normal, MeasurementFlags flags)
     : base(position, flags)
 {
     AngleSize = size;
     AngleNormal = normal;
 }
Exemplo n.º 15
0
 protected Measurement(Vector3 position, MeasurementFlags flags)
 {
     Position = position;
     Flags = flags;
 }
Exemplo n.º 16
0
 public AngleMeasurement(float size, Vector3 position, Vector3 normal, MeasurementFlags flags)
     : base(position, flags)
 {
     AngleSize   = size;
     AngleNormal = normal;
 }