Esempio n. 1
0
        public ScaleValue CheckScaleValueAndGetNearestValue(float delta)
        {
            ScaleValue scaleValue = new ScaleValue(this.Scale.ScaleX + delta, this.Scale.ScaleY + delta, 0.1, -99999999.0, 99999999.0);
            ScaleValue result;

            if (this.CheckScaleValue(scaleValue))
            {
                result = scaleValue;
            }
            else if (delta > 0f && this.CanZoom())
            {
                scaleValue.ScaleX = (scaleValue.ScaleY = 4f);
                result            = scaleValue;
            }
            else if (delta < 0f && this.CanDecreaseZoom())
            {
                scaleValue.ScaleX = (scaleValue.ScaleY = 0.1f);
                result            = scaleValue;
            }
            else
            {
                result = null;
            }
            return(result);
        }
        private void SetControl()
        {
            ScaleValue scaleValue = (ScaleValue)this._propertyItem.PropertyData.GetValue(this._propertyItem.Instance, null);

            if (this._propertyItem.InstanceCount > 1)
            {
                Func <ScaleValue, ScaleValue, bool> func  = (ScaleValue a, ScaleValue b) => Math.Round((double)a.ScaleX, 2) == Math.Round((double)b.ScaleX, 2);
                Func <ScaleValue, ScaleValue, bool> func2 = (ScaleValue a, ScaleValue b) => Math.Round((double)a.ScaleY, 2) == Math.Round((double)b.ScaleY, 2);
                if (base.IsWhip <ScaleValue>(func, ""))
                {
                    this.widget.SetWhipX(false);
                }
                else
                {
                    this.widget.SetX((double)scaleValue.ScaleX);
                }
                if (base.IsWhip <ScaleValue>(func2, ""))
                {
                    this.widget.SetWhipY(false);
                }
                else
                {
                    this.widget.SetY((double)scaleValue.ScaleY);
                }
            }
            else
            {
                this.widget.SetValue(delegate
                {
                    this.widget.SetXValue((double)scaleValue.ScaleX);
                    this.widget.SetYValue((double)scaleValue.ScaleY);
                });
            }
        }
Esempio n. 3
0
        public ActionResult <ScaleSaveValueResponse> PostScaleSaveValue(ScaleSaveValueRequest scaleSaveValue)
        {
            //返回结果
            ScaleSaveValueResponse scaleSaveValuesResponse = new ScaleSaveValueResponse {
                TaskId = scaleSaveValue.TaskId, Msg = "Success to save value", Result = true
            };
            string            taskid            = scaleSaveValue.TaskId;
            ScaleValueRequest scaleValueRequest = scaleSaveValue.ScaleValue;
            TodoItem          todoItem          = _context.TodoItems.Find(taskid);
            List <ScaleValue> scaleValues       = _context.ScaleValues.Where(s => s.TaskId == taskid).ToList();
            ScaleValue        curScaleValue     = _context.ScaleValues.Find(scaleValueRequest.ScaleValueId);

            if (curScaleValue != null)
            {
                curScaleValue.DateTime     = scaleValueRequest.DateTime;
                curScaleValue.Name         = scaleValueRequest.Name;
                curScaleValue.ScaleValueId = scaleValueRequest.ScaleValueId;
                curScaleValue.TaskId       = scaleValueRequest.TaskId;
                curScaleValue.TodoItem     = todoItem;
                curScaleValue.Value        = scaleValueRequest.Value;
                if (scaleValues.TrueForAll(s => { return(s.Value != 0); }))
                {
                    todoItem.IsComplete = true;
                }
                _context.Entry(todoItem).State      = Microsoft.EntityFrameworkCore.EntityState.Modified;
                _context.Entry(curScaleValue).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
                _context.SaveChanges();
            }
            else
            {
                scaleSaveValuesResponse.Result = false;
                scaleSaveValuesResponse.Msg    = "Can not find ScaleValue";
            }
            return(scaleSaveValuesResponse);
        }
Esempio n. 4
0
        private void SetControl()
        {
            ScaleValue scaleValue = (ScaleValue)this._propertyItem.PropertyData.GetValue(this._propertyItem.Instance, (object[])null);

            if (this._propertyItem.InstanceCount > 1)
            {
                Func <ScaleValue, ScaleValue, bool> Func1 = (Func <ScaleValue, ScaleValue, bool>)((a, b) => Math.Round((double)a.ScaleX, 2) == Math.Round((double)b.ScaleX, 2));
                Func <ScaleValue, ScaleValue, bool> Func2 = (Func <ScaleValue, ScaleValue, bool>)((a, b) => Math.Round((double)a.ScaleY, 2) == Math.Round((double)b.ScaleY, 2));
                if (this.IsWhip <ScaleValue>(Func1, ""))
                {
                    this.widget.SetWhipX(false);
                }
                else
                {
                    this.widget.SetX((double)scaleValue.ScaleX * 100.0);
                }
                if (this.IsWhip <ScaleValue>(Func2, ""))
                {
                    this.widget.SetWhipY(false);
                }
                else
                {
                    this.widget.SetY((double)scaleValue.ScaleY * 100.0);
                }
            }
            else
            {
                this.widget.SetValue((double)scaleValue.ScaleX * 100.0, (double)scaleValue.ScaleY * 100.0, false);
            }
        }
Esempio n. 5
0
        private void SetControl()
        {
            ScaleValue scaleValue = (ScaleValue)this._propertyItem.PropertyData.GetValue(this._propertyItem.Instance, null);

            if (this._propertyItem.InstanceCount > 1)
            {
                Func <ScaleValue, ScaleValue, bool> func  = (ScaleValue a, ScaleValue b) => a.ScaleX == b.ScaleX;
                Func <ScaleValue, ScaleValue, bool> func2 = (ScaleValue a, ScaleValue b) => a.ScaleY == b.ScaleY;
                if (base.IsWhip <ScaleValue>(func, ""))
                {
                    this.widget.SetWhipX(false);
                }
                else
                {
                    this.widget.SetX((double)scaleValue.ScaleX);
                }
                if (base.IsWhip <ScaleValue>(func2, ""))
                {
                    this.widget.SetWhipY(false);
                }
                else
                {
                    this.widget.SetY((double)scaleValue.ScaleY);
                }
            }
            else
            {
                this.widget.SetValue((double)scaleValue.ScaleX, (double)scaleValue.ScaleY, false);
            }
        }
Esempio n. 6
0
 public virtual void SetScale(ScaleValue scale)
 {
     CocoStudioEngineAdapterPINVOKE.CSVisualObject_SetScale(this.swigCPtr, CSScale.getCPtr(new CSScale(scale.ScaleX, scale.ScaleY)));
     if (CocoStudioEngineAdapterPINVOKE.SWIGPendingException.Pending)
     {
         throw CocoStudioEngineAdapterPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 7
0
 public CSScale(ScaleValue scale)
     : this(CocoStudioEngineAdapterPINVOKE.new_CSScale__SWIG_1(CSScale.getCPtr(new CSScale(scale.ScaleX, scale.ScaleY))), true)
 {
     if (CocoStudioEngineAdapterPINVOKE.SWIGPendingException.Pending)
     {
         throw CocoStudioEngineAdapterPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 8
0
 public override void SetScale(ScaleValue scale)
 {
     CocoStudioEngineAdapterPINVOKE.CSCanvas_SetScale(this.swigCPtr, CSScale.getCPtr(new CSScale(scale.ScaleX, scale.ScaleY)));
     if (CocoStudioEngineAdapterPINVOKE.SWIGPendingException.Pending)
     {
         throw CocoStudioEngineAdapterPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 9
0
 public override void SetAnchorPoint(ScaleValue anchorPoint)
 {
     CocoStudioEngineAdapterPINVOKE.CSNode_SetAnchorPoint(this.swigCPtr, CSScale.getCPtr(new CSScale(anchorPoint.ScaleX, anchorPoint.ScaleY)));
     if (CocoStudioEngineAdapterPINVOKE.SWIGPendingException.Pending)
     {
         throw CocoStudioEngineAdapterPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 10
0
 public virtual void SetGroundColorVector(ScaleValue cVector)
 {
     CocoStudioEngineAdapterPINVOKE.CSPanel_SetGroundColorVector(this.swigCPtr, CSScale.getCPtr(new CSScale(cVector.ScaleX, cVector.ScaleY)));
     if (CocoStudioEngineAdapterPINVOKE.SWIGPendingException.Pending)
     {
         throw CocoStudioEngineAdapterPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 11
0
        private void HandleAnchorPoint(PointF point)
        {
            PointF pointF = this.TransformToSelf(point);
            float  x;
            float  num = x = pointF.X;
            float  y;
            float  num2 = y = pointF.Y;
            float  scaleX;
            float  num3 = scaleX = pointF.X / this.Size.X;
            float  scaleY;
            float  num4 = scaleY = pointF.Y / this.Size.Y;

            this.AdsorbAnchorPoint(ref num3, this.AnchorPoint.ScaleX, 0f, ref num, 0f);
            this.AdsorbAnchorPoint(ref num3, this.AnchorPoint.ScaleX, 0.5f, ref num, this.Size.X / 2f);
            this.AdsorbAnchorPoint(ref num3, this.AnchorPoint.ScaleX, 1f, ref num, this.Size.X);
            this.AdsorbAnchorPoint(ref num4, this.AnchorPoint.ScaleY, 0f, ref num2, 0f);
            this.AdsorbAnchorPoint(ref num4, this.AnchorPoint.ScaleY, 0.5f, ref num2, this.Size.Y / 2f);
            this.AdsorbAnchorPoint(ref num4, this.AnchorPoint.ScaleY, 1f, ref num2, this.Size.Y);
            bool flag  = false;
            bool flag2 = false;

            if ((num3 == 0f || num3 == 1f) && num4 >= -0.1f && num4 <= 1.1f)
            {
                flag = true;
            }
            else if (num3 == 0.5f && ((num4 >= -0.1f && num4 <= 0.1f) || (num4 >= 0.9f && num4 <= 1.1f)))
            {
                flag = true;
            }
            if (flag)
            {
                scaleX = num3;
                x      = num;
            }
            if ((num4 == 0f || num4 == 1f) && num3 >= -0.1f && num3 <= 1.1f)
            {
                flag2 = true;
            }
            else if (num4 == 0.5f && ((num3 >= -0.1f && num3 <= 0.1f) || (num3 >= 0.9f && num3 <= 1.1f)))
            {
                flag2 = true;
            }
            if (flag2)
            {
                scaleY = num4;
                y      = num2;
            }
            ScaleValue anchorPoint = new ScaleValue(scaleX, scaleY, 0.1, -99999999.0, 99999999.0);

            pointF           = new PointF(x, y);
            pointF           = this.CSCom.TransformPoint(pointF, this.CSCom.GetMatrixWithoutReCalculate());
            this.AnchorPoint = anchorPoint;
            this.Position    = pointF;
            if (this.SelectedObjects.Count <VisualObject>() == 1)
            {
                this.SelectedObjects.FirstOrDefault <VisualObject>().AnchorPoint = anchorPoint;
            }
        }
Esempio n. 12
0
        private void HandleAnchorPoint(PointF point)
        {
            PointF self = this.TransformToSelf(point);
            float  x1;
            float  x2 = x1 = self.X;
            float  y1;
            float  y2 = y1 = self.Y;
            float  newAnchorValue1;
            float  scaleX = newAnchorValue1 = self.X / this.Size.X;
            float  newAnchorValue2;
            float  scaleY = newAnchorValue2 = self.Y / this.Size.Y;

            this.AdsorbAnchorPoint(ref newAnchorValue1, this.AnchorPoint.ScaleX, 0.0f, ref x1, 0.0f);
            this.AdsorbAnchorPoint(ref newAnchorValue1, this.AnchorPoint.ScaleX, 0.5f, ref x1, this.Size.X / 2f);
            this.AdsorbAnchorPoint(ref newAnchorValue1, this.AnchorPoint.ScaleX, 1f, ref x1, this.Size.X);
            this.AdsorbAnchorPoint(ref newAnchorValue2, this.AnchorPoint.ScaleY, 0.0f, ref y1, 0.0f);
            this.AdsorbAnchorPoint(ref newAnchorValue2, this.AnchorPoint.ScaleY, 0.5f, ref y1, this.Size.Y / 2f);
            this.AdsorbAnchorPoint(ref newAnchorValue2, this.AnchorPoint.ScaleY, 1f, ref y1, this.Size.Y);
            bool flag1 = false;
            bool flag2 = false;

            if (((double)newAnchorValue1 == 0.0 || (double)newAnchorValue1 == 1.0) && ((double)newAnchorValue2 >= -0.100000001490116 && (double)newAnchorValue2 <= 1.10000002384186))
            {
                flag1 = true;
            }
            else if ((double)newAnchorValue1 == 0.5 && ((double)newAnchorValue2 >= -0.100000001490116 && (double)newAnchorValue2 <= 0.100000001490116 || (double)newAnchorValue2 >= 0.899999976158142 && (double)newAnchorValue2 <= 1.10000002384186))
            {
                flag1 = true;
            }
            if (flag1)
            {
                scaleX = newAnchorValue1;
                x2     = x1;
            }
            if (((double)newAnchorValue2 == 0.0 || (double)newAnchorValue2 == 1.0) && ((double)newAnchorValue1 >= -0.100000001490116 && (double)newAnchorValue1 <= 1.10000002384186))
            {
                flag2 = true;
            }
            else if ((double)newAnchorValue2 == 0.5 && ((double)newAnchorValue1 >= -0.100000001490116 && (double)newAnchorValue1 <= 0.100000001490116 || (double)newAnchorValue1 >= 0.899999976158142 && (double)newAnchorValue1 <= 1.10000002384186))
            {
                flag2 = true;
            }
            if (flag2)
            {
                scaleY = newAnchorValue2;
                y2     = y1;
            }
            ScaleValue scaleValue = new ScaleValue(scaleX, scaleY, 0.1, -99999999.0, 99999999.0);
            PointF     pointF     = this.CSCom.TransformPoint(new PointF(x2, y2), this.CSCom.GetMatrixWithoutReCalculate());

            this.AnchorPoint = scaleValue;
            this.Position    = pointF;
            if (this.SelectedObjects.Count <VisualObject>() != 1)
            {
                return;
            }
            this.SelectedObjects.FirstOrDefault <VisualObject>().AnchorPoint = scaleValue;
        }
Esempio n. 13
0
 /// <summary>
 /// Converts the options to JavaScript.
 /// </summary>
 public string ToJs()
 {
     return
         ("{ " +
          $"scaleType: {(int)ScaleType}, " +
          $"scaleValue: {ScaleValue.ToString(CultureInfo.InvariantCulture)}, " +
          $"rememberScale: {RememberScale.ToString().ToLowerInvariant()} " +
          "}");
 }
Esempio n. 14
0
        protected override void OnAttach()
        {
            ExtendMenu();
            BackColor = new ColorValue(0, 0, 0, .5f);

            Vec2 pos = new Vec2(Parent.MousePosition.X /*+ (Size.Value.X/2)*/, Parent.MousePosition.Y);

            Position = new ScaleValue(ScaleType.Screen, pos);

            base.OnAttach();
        }
Esempio n. 15
0
        void FinalizeExtending()
        {
            int n = 0;

            foreach (Control c in Controls)
            {
                c.Position = new ScaleValue(ScaleType.ScaleByResolution, new Vec2(0, (c.Size.Value.Y + 3) * n));
                n++;
            }

            Size = new ScaleValue(ScaleType.ScaleByResolution, new Vec2(Controls[0].Size.Value.X + 10, (Controls[0].Size.Value.Y * n) + (3 * (n - 1))));
        }
Esempio n. 16
0
        protected override void OnAttach()
        {
            ExtendMenu();

            Size      = new ScaleValue(ScaleType.Parent, new Vec2(0.05f, 0.2f));
            BackColor = new ColorValue(0, 0, 0, .5f);

            Vec2 pos = new Vec2(Parent.MousePosition.X + (Size.Value.X / 2), Parent.MousePosition.Y);

            Position = new ScaleValue(ScaleType.Parent, pos);

            base.OnAttach();
        }
Esempio n. 17
0
    protected override void OnTick(float delta)
    {
        base.OnTick(delta);

        if (NextUpdate != 0 && Time > NextUpdate)
        {
            SetShouldDetach();
        }

        if (entity != null)
        {
            Position = new ScaleValue(ScaleType.Screen, RendererWorld.Instance.DefaultCamera.ProjectToScreenCoordinates(entity.Position));
        }
    }
Esempio n. 18
0
 private void SetControl()
 {
     this.widget.SetValue((System.Action)(() =>
     {
         IColorValue instance             = this._propertyItem.Instance as IColorValue;
         System.Drawing.Color singleColor = instance.SingleColor;
         int comboBoxIndex = instance.ComboBoxIndex;
         System.Drawing.Color firstColor = instance.FirstColor;
         System.Drawing.Color endColor   = instance.EndColor;
         ScaleValue colorVector          = instance.ColorVector;
         float num = (float)this._propertyItem.Instance.GetType().GetProperty("ColorAngle").GetValue(this._propertyItem.Instance, (object[])null);
         this.widget.SetControl(this.ConvertColor(singleColor), comboBoxIndex, this.ConvertColor(firstColor), this.ConvertColor(endColor), (int)num);
         this.SetBgColor();
     }));
 }
Esempio n. 19
0
 private void SetControl()
 {
     this.widget.SetValue(delegate
     {
         IColorValue colorValue           = this._propertyItem.Instance as IColorValue;
         System.Drawing.Color singleColor = colorValue.SingleColor;
         int comboBoxIndex = colorValue.ComboBoxIndex;
         System.Drawing.Color firstColor = colorValue.FirstColor;
         System.Drawing.Color endColor   = colorValue.EndColor;
         ScaleValue colorVector          = colorValue.ColorVector;
         PropertyInfo property           = this._propertyItem.Instance.GetType().GetProperty("ColorAngle");
         float num = (float)property.GetValue(this._propertyItem.Instance, null);
         this.widget.SetControl(this.ConvertColor(singleColor), comboBoxIndex, this.ConvertColor(firstColor), this.ConvertColor(endColor), (int)num);
         this.SetBgColor();
     });
 }
Esempio n. 20
0
 private void widget_Pointy(object sender, PointEvent e)
 {
     this.UpDateData((System.Action)(() =>
     {
         foreach (object instance in this._propertyItem.InstanceList)
         {
             ScaleValue scaleValue = (ScaleValue)this._propertyItem.PropertyData.GetValue(instance, (object[])null);
             scaleValue.ScaleY     = (float)e.PointX;
             if (e.IsCheck)
             {
                 scaleValue.ScaleX = (float)e.PointX;
             }
             this._propertyItem.PropertyData.SetValue(instance, (object)scaleValue, (object[])null);
         }
     }));
 }
Esempio n. 21
0
 private void widget_Pointx(object sender, PointEvent e)
 {
     this.UpDateData(delegate
     {
         foreach (object current in this._propertyItem.InstanceList)
         {
             ScaleValue scaleValue = (ScaleValue)this._propertyItem.PropertyData.GetValue(current, null);
             scaleValue.ScaleX     = (float)e.PointX;
             if (e.IsCheck)
             {
                 scaleValue.ScaleY = (float)e.PointX;
             }
             this._propertyItem.SetValue(this._propertyItem.Instance, scaleValue, null);
         }
     });
 }
        /// <summary>
        /// Рисуем график гистограм.
        /// </summary>
        /// <param name="_initialeValue"></param>
        public void ChartDrawGistogram(InitialValue _initialeValue)
        {
            double invalue      = _initialeValue.Value;
            Point  coordinates  = new Point();
            double countElement = ElementsChart.Count;

            if (invalue > 1)
            {
                invalue = 1;
            }
            if (invalue < -1)
            {
                invalue = -1;
            }

            ScaleValue scaleValue = new ScaleValue(sizePanel.size.Width / SettingsCharts.maxCountValueCharts.Count, sizePanel.size.Height / diapason);

            coordinates.X       = X_Set(countElement, scaleValue.X_scale);
            sizeAllPoint.Height = Math.Abs(invalue) * scaleValue.Y_scale;

            if (invalue != 0)
            {
                if (invalue > 0)
                {
                    coordinates.Y = (1 - invalue) * scaleValue.Y_scale;
                }
                else
                {
                    coordinates.Y = sizePanel.size.Height / diapason;
                }
            }
            else
            {
                coordinates.Y = sizePanel.size.Height / diapason;
            }

            dispatcher.Invoke(() =>
            {
                ElementsChart.Add(GistogramGenerate(coordinates, brushAll, sizeAllPoint));
            }, DispatcherPriority.Background);

            initialDataList.Add(_initialeValue);

            // масштабируем по Х
            TrimmingData_X(ElementsChart, initialDataList, scaleValue, ref countElement);
        }
Esempio n. 23
0
 private void widget_Pointy(object sender, PointEvent e)
 {
     this.UpDateData((System.Action)(() =>
     {
         float num = (float)e.PointX / 100f;
         foreach (object instance in this._propertyItem.InstanceList)
         {
             ScaleValue scaleValue = (ScaleValue)this._propertyItem.PropertyData.GetValue(instance, (object[])null);
             if (e.IsCheck)
             {
                 scaleValue.ScaleX = scaleValue.ScaleX / scaleValue.ScaleY * num;
                 this.widget.SetX((double)scaleValue.ScaleX * 100.0);
             }
             scaleValue.ScaleY = num;
             this._propertyItem.PropertyData.SetValue(instance, (object)scaleValue, (object[])null);
         }
     }));
 }
        /// <summary>
        /// Рисуем график
        /// </summary>
        /// <param name="_initialeValue">входное значение [от 1 до -1]</param>
        public void ChartDraw(InitialValue _initialeValue)
        {
            double invalue = _initialeValue.Value;

            if (invalue > 1)
            {
                invalue = 1;
            }
            if (invalue < -1)
            {
                invalue = -1;
            }

            ScaleValue scaleValue = new ScaleValue(0, sizePanel.size.Height / diapason);

            Y          = (1 - invalue) * scaleValue.Y_scale;
            TrendValue = invalue;
        }
        public async Task <ActionResult <SetTerm> > PostScaleValues(int id, [FromBody] ScaleValue sv)
        {
            var scale = await _context.Scales.FindAsync(id);

            if (scale == null)
            {
                return(NotFound("scale not found"));
            }
            if (id != sv.ScaleId)
            {
                return(BadRequest());
            }
            sv.ScaleId = id;
            _context.ScaleValues.Add(sv);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetScaleValue", new { id = sv.ScaleId, rate = sv.Rate }, sv));
        }
Esempio n. 26
0
 private void widget_Pointx(object sender, PointEvent e)
 {
     this.UpDateData(delegate
     {
         float num = (float)e.PointX / 100f;
         foreach (object current in this._propertyItem.InstanceList)
         {
             ScaleValue scaleValue = (ScaleValue)this._propertyItem.PropertyData.GetValue(current, null);
             if (e.IsCheck)
             {
                 scaleValue.ScaleY = scaleValue.ScaleY / scaleValue.ScaleX * num;
                 this.widget.SetY((double)(scaleValue.ScaleY * 100f));
             }
             scaleValue.ScaleX = num;
             this._propertyItem.PropertyData.SetValue(current, scaleValue, null);
         }
     });
 }
Esempio n. 27
0
        public void SetRate(decimal rate)
        {
            decimal intPart           = decimal.Truncate(rate);
            int     intRate           = decimal.ToInt32(intPart); //速率的整数部分
            decimal decimalRate       = rate - intRate;           //速率的小数部分
            int     decimalRateLength = decimalRate.ToString().Length - 2;

            switch (decimalRateLength)
            {
            case 0:
            case 1:
                intRate    *= 10;
                intRate    += (int)(decimalRate * 10);
                m_RateScale = ScaleValue.Ten;
                break;

            case 2:
                intRate    *= 100;
                intRate    += (int)(decimalRate * 100);
                m_RateScale = ScaleValue.Hundred;
                break;

            case 3:
                intRate    *= 1000;
                intRate    += (int)(decimalRate * 1000);
                m_RateScale = ScaleValue.Thousand;
                break;

            case 4:
                intRate    *= 10000;
                intRate    += (int)(decimalRate * 10000);
                m_RateScale = ScaleValue.TenThousand;
                break;

            default:
                intRate    *= 10;
                intRate    += (int)(decimalRate * 10);
                m_RateScale = ScaleValue.Ten;
                break;
            }
            m_Rate[0] = (byte)(intRate & 0x000000FF);
            m_Rate[1] = (byte)(intRate >> 8 & 0x000000FF);
            m_Rate[2] = (byte)(intRate >> 16 & 0x000000FF);
        }
Esempio n. 28
0
        public void SetVolume(decimal vol)
        {
            decimal intPart          = decimal.Truncate(vol);
            int     intvol           = decimal.ToInt32(intPart); //速率的整数部分
            decimal decimalvol       = vol - intvol;             //速率的小数部分
            int     decimalvolLength = decimalvol.ToString().Length - 2;

            switch (decimalvolLength)
            {
            case 0:
            case 1:
                intvol       *= 10;
                intvol       += (int)(decimalvol * 10);
                m_VolumeScale = ScaleValue.Ten;
                break;

            case 2:
                intvol       *= 100;
                intvol       += (int)(decimalvol * 100);
                m_VolumeScale = ScaleValue.Hundred;
                break;

            case 3:
                intvol       *= 1000;
                intvol       += (int)(decimalvol * 1000);
                m_VolumeScale = ScaleValue.Thousand;
                break;

            case 4:
                intvol       *= 10000;
                intvol       += (int)(decimalvol * 10000);
                m_VolumeScale = ScaleValue.TenThousand;
                break;

            default:
                intvol       *= 10;
                intvol       += (int)(decimalvol * 10);
                m_VolumeScale = ScaleValue.Ten;
                break;
            }
            m_Volume[0] = (byte)(intvol & 0x000000FF);
            m_Volume[1] = (byte)(intvol >> 8 & 0x000000FF);
            m_Volume[2] = (byte)(intvol >> 16 & 0x000000FF);
        }
Esempio n. 29
0
        public ScaleValue CheckScaleValueAndGetNearestValue(float delta)
        {
            ScaleValue scale = new ScaleValue(this.Scale.ScaleX + delta, this.Scale.ScaleY + delta, 0.1, -99999999.0, 99999999.0);

            if (this.CheckScaleValue(scale))
            {
                return(scale);
            }
            if ((double)delta > 0.0 && this.CanZoom())
            {
                scale.ScaleX = scale.ScaleY = 4f;
                return(scale);
            }
            if ((double)delta >= 0.0 || !this.CanDecreaseZoom())
            {
                return((ScaleValue)null);
            }
            scale.ScaleX = scale.ScaleY = 0.1f;
            return(scale);
        }
Esempio n. 30
0
        //----------------------------------------------------------

        // обрезаем данные по Х с перемасшбированием по 2-м осям
        private void TrimmingData_X(CollectionGraphicElementsChart _chartElements, InitialDataChartList _initialDataChartList, Size _sizeChart, Action <Rectangle, double> _setBottomAction, ref ScaleValue _scaleValue, ref ExtremumValue _extremumValue, ref double _countElement)
        {
            if (_countElement > SettingsCharts.maxCountValueCharts.Count)
            {
                dispatcher.Invoke(() =>
                {
                    for (int i = 0; i < SettingsCharts.countDelete.Count; i++)
                    {
                        _chartElements.RemoveAt(0);
                    }
                });

                _initialDataChartList.RemoveRange(0, SettingsCharts.countDelete.Count);

                _countElement = _chartElements.Count;

                //_extremumValue.Min = _initialDataChartList.Min(x => x.Value);
                //_extremumValue.Max = _initialDataChartList.Max(x => x.Value);

                _extremumValue = new ExtremumValue(_initialDataChartList.Min(x => x.Value), _initialDataChartList.Max(x => x.Value));

                _scaleValue.Y_scale = Y_ScaleValueCalc(_extremumValue, _sizeChart);

                double     countElem = _countElement;
                double     y_scl     = _scaleValue.Y_scale;
                double     minVal    = _extremumValue.Min;
                ScaleValue scalval   = _scaleValue;
                dispatcher.Invoke(() =>
                {
                    for (int i = 0; i < countElem; i++)
                    {
                        _setBottomAction(_chartElements[i], Y_Set(_initialDataChartList[i], minVal, y_scl));
                        Canvas.SetLeft(_chartElements[i], X_Set(i, scalval.X_scale));
                    }
                }, DispatcherPriority.Background);
            }
        }