示例#1
0
        private void Init(int x)
        {
            //Width = 16;
            //Height = mCount * (Width + 5) - 5;
            //Y = (Application.Screen.Height - Height) / 2 + 10;

            Resize(16, mCount * (Width + 5) - 5);


            mPath = VGPath.OpenVGPath();

            mActivePaint = VG.vgCreatePaint();
            VG.vgSetParameterfv(mActivePaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, (new Color(0x2EBF0EFF)).Value);

            mDefaultPaint = VG.vgCreatePaint();
            VG.vgSetParameterfv(mDefaultPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, (new Color(0x3B3C3DFF)).Value);

            mText = new List <TextArea[]>();

            for (var i = 0; i < mCount; i++)
            {
                mText.Add(Text.Label(this, string.Format("{0}", i + 1), 17, -1, (i * (Width + 5)) - 3, 16, 16));
            }

            SetSpeed(0);
            mSensor.OnUpdate += sensor => SetSpeed((byte)sensor.Value);

            Move(x, (Application.Screen.Height - Height) / 2 + 10);
        }
示例#2
0
        private void Init(int x, int y)
        {
            InitBackground();

            Text.Label(this, "Напряжение\\nв сети", 14, 0, 0, Width, 14);

            mPaint = VG.vgCreatePaint();
            VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, (new Color(0xEDAB18ff)).Value);


            mRollArea = new TextArea(this, 0, 45, Width, 30)
            {
                Text = ""
            };
            mRollArea.SetAlign(Align.Center, new GfxPoint(0, 5));
            mRollArea.SetFont(Palette.White, 22);
            mRollArea.Text = string.Format("{0:0} В", mSensor.Value);

            mSensor.OnUpdate += sensor =>
            {
                mRollArea.Text = string.Format("{0:0} В", sensor.Value);
            };

            AddVGPath(new VGPath(mPath, null, new VGSolidColor(new Color(0x2c2d2eff))));

            Move(x, y);
        }
示例#3
0
        public ListItem(string aName, int x, int y, int width, int height, float round)
            : base(null, aName)
        {
            X = x;
            Y = y;

            Width  = width;
            Height = height;

            mRound = round;

            const int kSize = 20;
            const int kBias = 3;

            mText = new TextArea(this, "", null, 0, (Height - kSize) / 2 + kBias, Width, Height)
            {
                Text = "---", Size = kSize, Align = Align.Center
            };
            AddChild(mText);

            mPath  = VG.vgCreatePath(0, VGPathDatatype.VG_PATH_DATATYPE_S_16, 1, 0, 0, 0, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);
            mPaint = VG.vgCreatePaint();

            mCache = VG.vgCreateImage(PixelFormat, Width, Height, VGImageQuality.VG_IMAGE_QUALITY_NONANTIALIASED);

            mIsRealUpdate = true;
        }
示例#4
0
        public ProgressBar(IWidget parent, int x, int y, int width, int height, int round)
            : base(parent, x, y, width, height)
        {
            mRound = round;

            mPath = VG.vgCreatePath(0, VGPathDatatype.VG_PATH_DATATYPE_S_16, 1, 0, 0, 0, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);
            VGU.vguRoundRect(mPath, 0, 0, Width, Height, mRound, mRound);

            mPaint = VG.vgCreatePaint();

            Status = new TextArea(this, 0, 0, Width, Height);
            Status.SetAlign(Align.Center, new GfxPoint(0, 3));
            Status.OnTextChange += caller => Invalidate();

            Border     = new VGSolidColor(Palette.White);
            Background = new VGSolidColor(Palette.Black);
            var percent = new VGLinearGradient(0, 0, 0, Height);

            percent.AddColor(0, new Color(0xE9AE5DFF));
            //percent.AddColor(50, new Color(0xE08F1EFF));
            percent.AddColor(100, new Color(0xE08F1EFF));
            //percent.AddColor(0, new Color(0x00FF00FF));
            //percent.AddColor(100, new Color(0xFF0000FF));
            PercentLine = percent;
        }
示例#5
0
        private void Init(int x, int y)
        {
            InitBackground();

            mPaint = VG.vgCreatePaint();
            VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, Palette.Red.Value);

            mImageBg = new Image(this, 12, 40);
            mImageFg = new Image(this, 12, 40);
            Text.Label(this, mDescription, 16, 0, 0, Width, 16);
            Text.Label(this, mPhysical, 18, 0, Height - 50, Width, 18);

            mActiveArea = new TextArea(this, 0, (int)(Height * 0.4f), Width, 40);
            mActiveArea.SetAlign(Align.Center, new GfxPoint(0, 5));
            mActiveArea.SetFont(Palette.White, 45);

            AddVGPath(new VGPath(mPath, null, new VGSolidColor(new Color(0x2c2d2eff))));

            Format = "{0:0}";

            //MaxValue = 100;
            //SetValue(100);
            SetValue(0);

            mSensor.OnUpdate += sensor => SetValue(sensor.Value / 10.0f);

            Move(x, y);
        }
示例#6
0
文件: Table.cs 项目: Mokarski/Vagonka
        public Table(IWidget parent) : base(parent)
        {
            mPath  = VG.vgCreatePath(0, VGPathDatatype.VG_PATH_DATATYPE_S_16, 1, 0, 0, 0, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);
            mPaint = VG.vgCreatePaint();

            Name = string.Format("table{0}", mId++);
        }
示例#7
0
        public TextArea(IWidget parent, int x, int y, int width, int height)
            : base(parent, width, height)
        {
            // create a paint
            mPaint = VG.vgCreatePaint();
            Name   = string.Format("textArea{0}", _id++);

            Init(x, y);
        }
示例#8
0
文件: Color.cs 项目: Mokarski/Vagonka
        private void Initialize()
        {
            mPaint = VG.vgCreatePaint();
            VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_RADIAL_GRADIENT);

            VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR_RAMP_SPREAD_MODE,
                               (int)VGColorRampSpreadMode.VG_COLOR_RAMP_SPREAD_PAD);                                     // repeat type
            VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR_RAMP_PREMULTIPLIED, (int)VGboolean.VG_TRUE); //
            //VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR_RAMP_PREMULTIPLIED, (int)VGboolean.VG_FALSE); //
        }
示例#9
0
        public GraphicArea(IWidget parent, int width, int height)
            : base(parent, width, height)
        {
            //Width = width; // 460
            //Height = height; // 220

            mPath  = VG.vgCreatePath(0, VGPathDatatype.VG_PATH_DATATYPE_S_16, 1, 0, 0, 0, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);
            mPaint = VG.vgCreatePaint();

            mGrapihcs = new List <GraphicsData>();
        }
示例#10
0
        private void Init(int x, int y)
        {
            InitBackground();

            mImage = new Image(this, 10, 35);
            mImage.Load("./wvga.filter.raw");

            Text.Label(this, "Фильтр\\nв системе смазки", 14, 0, 0, Width, 14);

            mPaint = VG.vgCreatePaint();
            VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, (new Color(0xEDAB18ff)).Value);


            mRollArea = new TextArea(this, Width - 50, 45, 49, 30)
            {
                Text = ""
            };
            mRollArea.SetAlign(Align.Center, new GfxPoint(0, 5));
            mRollArea.SetFont(Palette.White, 16);

            const int kLimit = 10;

            mRollArea.Text = string.Format("{0}", "Отключен");
            VG.vgSetParameterfv(mFilterPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new Color(0x2EC90Eff).Value);

            mSensor.OnUpdate += sensor =>
            {
                if (mStatus.ValueAsInt == 0)
                {
                    mRollArea.Text = string.Format("{0}", "Отключен");
                    VG.vgSetParameterfv(mFilterPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new Color(0x2EC90Eff).Value);
                }
                else
                {
                    mRollArea.Text = string.Format("{0}", sensor.Value / 10.0f);
                    //mRollArea.Text = string.Format("{0}", sensor.Value > kLimit ? "Норма" : "Авария");
                    VG.vgSetParameterfv(mFilterPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4,
                                        sensor.Value > kLimit ? (new Color(0x2EC90Eff)).Value : (new Color(0xE3AB1Fff)).Value);
                }
            };

            AddVGPath(new VGPath(mPath, null, new VGSolidColor(new Color(0x2c2d2eff))));

            Move(x, y);

            mFilterPath = VGPath.OpenVGPath();
            VGU.vguRect(mFilterPath, mImage.ScreenPosition.X + 1, mImage.ScreenPosition.Y + 1, mImage.Width - 2, mImage.Height - 2);

            mFilterPaint = VG.vgCreatePaint();
            VG.vgSetParameterfv(mFilterPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, (new Color(0xEDAB18ff)).Value);
        }
示例#11
0
        public ItemBorder(string aName, int x, int y, int width, int height, float round, int paramWidth)
            : base(null, aName)
        {
            X = x;
            Y = y;

            Width  = width;
            Height = height;

            mRound      = round;
            mParamWidth = paramWidth;

            mPath  = VG.vgCreatePath(0, VGPathDatatype.VG_PATH_DATATYPE_S_16, 1, 0, 0, 0, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);
            mPaint = VG.vgCreatePaint();
        }
示例#12
0
        public Button(string aName, int x, int y, int width, int height, float round)
            : base(null, aName)
        {
            X = x;
            Y = y;

            Width  = width;
            Height = height;

            mRound = round;

            const float kColor = 252f / 256f;

            PressColor = new Color {
                R = kColor, G = kColor, B = kColor
            };

            mPath  = VG.vgCreatePath(0, VGPathDatatype.VG_PATH_DATATYPE_S_16, 1, 0, 0, 0, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);
            mPaint = VG.vgCreatePaint();
        }
示例#13
0
        private void Init(int x, int y)
        {
            InitBackground();

            mImage = new Image(this, 9, 25);
            mImage.Load("./wvga.roll_tangage.raw");

            Text.Label(this, "Тангаж", 14, 0, 0, Width, 14);
            Text.Label(this, "Крен", 14, 0, Height - 20, Width, 14);

            mPaint = VG.vgCreatePaint();
            VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, (new Color(0xEDAB18ff)).Value);

            mPitchArea = new TextArea(this, Width - 25, 80, 24, 30)
            {
                Text = ""
            };
            mPitchArea.SetAlign(Align.Right, new GfxPoint(0, 5));
            mPitchArea.SetFont(Palette.White, 16);
            mPitchArea.OnPaint += caller =>
            {
                ((TextArea)caller).Text = string.Format("{0} ⁰", Pitch);
            };


            mRollArea = new TextArea(this, Width - 25, 5, 24, 30)
            {
                Text = ""
            };
            mRollArea.SetAlign(Align.Right, new GfxPoint(0, 5));
            mRollArea.SetFont(Palette.White, 16);
            mRollArea.OnPaint += caller =>
            {
                ((TextArea)caller).Text = string.Format("{0} ⁰", Roll);
            };

            AddVGPath(new VGPath(mPath, null, new VGSolidColor(new Color(0x2c2d2eff))));

            Move(x, y);
        }
示例#14
0
        public SparcButton(string aName, int x, int y, int width, int height, float round, string url)
            : base(null, aName)
        {
            X = x;
            Y = y;

            Width  = width;
            Height = height;

            mRound = round;

            //const float kColor = 252f / 256f;
            //PressColor = new Color { R = kColor, G = kColor, B = kColor };

            mPath  = VG.vgCreatePath(0, VGPathDatatype.VG_PATH_DATATYPE_S_16, 1, 0, 0, 0, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);
            mPaint = VG.vgCreatePaint();

            mCache = VG.vgCreateImage(PixelFormat, Width + 2, Height + 2, VGImageQuality.VG_IMAGE_QUALITY_NONANTIALIASED);

            mIsRealUpdate = true;
            IsVisible     = true;
        }
示例#15
0
        private void Init(int x, int y)
        {
            InitBackground();

            Text.Label(this, mDescription, 14, 0, 0, Width, 14);
            //Text.Label(this, "100%", 14, 0, 0, Width, 14);
            //Text.Label(this, "0%", 14, 0, 0, Width, 14);

            mPaint = VG.vgCreatePaint();
            VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, (new Color(0xEDAB18ff)).Value);

            Format      = "{0:0}";
            mActiveArea = new TextArea(this, Width - 40, (int)(Height * 0.45f), 40, 30);//
            SetValue(0);

            mActiveArea.SetAlign(Align.Left, new GfxPoint(0, 5));
            mActiveArea.SetFont(Palette.White, 22);

            AddVGPath(new VGPath(mPath, null, new VGSolidColor(new Color(0x2c2d2eff))));

            {
                var i = VGPath.OpenVGPath();
                VGU.vguRect(i, 0, 0, 45, 59);
                var rv = new VGPath(i, new VGSolidColor(new Color(0x6d6e71ff)), new VGSolidColor(new Color(0x414041ff)))
                {
                    StrokeWidth = 1.0f
                };
                rv.Move(X + 12, Y + 32);
                AddVGPath(rv);
            }

            mSensor.OnUpdate += sensor => SetValue(sensor.Value / 10.0f);


            Move(x, y);
        }
示例#16
0
        public override void Update()
        {
            // render table
            {
                VG.vgSeti(VGParamType.VG_BLEND_MODE, (int)VGBlendMode.VG_BLEND_SRC_OVER);
                VG.vgSeti(VGParamType.VG_FILL_RULE, (int)VGFillRule.VG_NON_ZERO);
                VG.vgSetfv(VGParamType.VG_STROKE_DASH_PATTERN, 0, null);

                // create some paths
                var path0 = VG.vgCreatePath(0, VGPathDatatype.VG_PATH_DATATYPE_F, 1.0f, 0.0f, 0, 0, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);

                // create and set a paint for fill
                var fillPaint   = VG.vgCreatePaint();
                var strokePaint = VG.vgCreatePaint();

                // set model view matrix
                VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE);
                VG.vgLoadIdentity();

                #region draw border
                if (Border)
                {
                    VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, 5.0f);
                    VG.vgSeti(VGParamType.VG_STROKE_CAP_STYLE, (int)VGCapStyle.VG_CAP_BUTT);
                    VG.vgSeti(VGParamType.VG_STROKE_JOIN_STYLE, (int)VGJoinStyle.VG_JOIN_BEVEL);

                    VG.vgSetParameteri(strokePaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_COLOR);
                    const float kGreyColor = 192f / 256f;
                    VG.vgSetParameterfv(strokePaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new[] { kGreyColor, kGreyColor, kGreyColor, 1.0f });
                    VG.vgSetPaint(strokePaint, VGPaintMode.VG_STROKE_PATH);

                    var tableLenght = 0;
                    for (var i = 0; i < mLenghtX.Length; i++)
                    {
                        tableLenght += mLenghtX[i];
                    }


                    VGU.vguRect(path0, (mX - 2.5f), (mY - 2.5f), tableLenght + 5, GetLenght(mLenghtY.Length, mLenghtY) + 5.0f);
                    VG.vgDrawPath(path0, VGPaintMode.VG_STROKE_PATH);
                }
                #endregion

                #region fill cells
                if (CellFill)
                {
                    for (var i = 0; i < mLenghtX.Length; i++)
                    {
                        for (var j = 0; j < mLenghtY.Length; j++)
                        {
                            VG.vgSetParameteri(fillPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_COLOR);
                            VG.vgSetParameterfv(fillPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, CellColors[i, j].Value);
                            VG.vgSetPaint(fillPaint, VGPaintMode.VG_FILL_PATH);

                            VG.vgClearPath(path0, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);
                            VGU.vguRect(path0, mX + GetLenght(i, mLenghtX), mY + GetLenght(j, mLenghtY), mLenghtX[i], mLenghtY[j]);
                            VG.vgDrawPath(path0, VGPaintMode.VG_FILL_PATH);
                        }
                    }
                }
                #endregion

                #region draw cells borders
                if (CellBorder)
                {
                    VG.vgSetParameteri(strokePaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_COLOR);
                    VG.vgSetParameterfv(strokePaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new[] { 0.0f, 0.0f, 0.0f, 1.0f });
                    VG.vgSetPaint(strokePaint, VGPaintMode.VG_STROKE_PATH);

                    VG.vgClearPath(path0, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);

                    VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, 1.0f);
                    VG.vgSeti(VGParamType.VG_STROKE_CAP_STYLE, (int)VGCapStyle.VG_CAP_BUTT);
                    VG.vgSeti(VGParamType.VG_STROKE_JOIN_STYLE, (int)VGJoinStyle.VG_JOIN_BEVEL);


                    for (var i = 0; i < mLenghtX.Length; i++)
                    {
                        for (var j = 0; j < mLenghtY.Length; j++)
                        {
                            VGU.vguRect(path0, mX + GetLenght(i, mLenghtX), mY + GetLenght(j, mLenghtY), mLenghtX[i], mLenghtY[j]);
                        }
                    }

                    VG.vgDrawPath(path0, VGPaintMode.VG_STROKE_PATH);
                }
                #endregion

                VG.vgDestroyPath(path0);
                VG.vgDestroyPaint(strokePaint);
            }

            base.Update();
        }
示例#17
0
文件: Color.cs 项目: Mokarski/Vagonka
 public VGSolidColor(Color color)
 {
     mPaint = VG.vgCreatePaint();
     VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_COLOR);
     VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, color.Value);
 }
示例#18
0
        private void Init()
        {
            mTimer = new Timer(ProcessTimerEvent, null, Timeout.Infinite, Timeout.Infinite);

            mPath        = VG.vgCreatePath(0, VGPathDatatype.VG_PATH_DATATYPE_S_16, 1, 0, 0, 0, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);
            mFillPaint   = VG.vgCreatePaint();
            mStrokePaint = VG.vgCreatePaint();

            mGrapihcs = new List <GraphicsData>();

            var color = new VGSolidColor(new Color(0xD1D3D4FF));

            #region Lines & arrows
            {
                var path = VGPath.OpenVGPath();
                VG.vgLoadIdentity();

                const float kXBias = 3f;
                const float kYBias = 12f;

                VGU.vguLine(path, 0, 0, Width - 60, 0);          // OX
                //VGU.vguLine(path, 0, 0, 0, Height - 40); // OY
                VGU.vguLine(path, 0, 0, 0, Height - kYBias - 1); // OY



                var yArroyBias = Height - kYBias - 1;
                //var yArroyBias = Height - 40f;

                var pathData = new float[16];
                pathData[0] = -kXBias;
                pathData[1] = yArroyBias;          //0f;
                pathData[2] = 0f;
                pathData[3] = yArroyBias + kYBias; // kYBias;
                pathData[4] = kXBias;
                pathData[5] = yArroyBias;          //0f;
                VGU.vguPolygon(path, pathData, 3, VGboolean.VG_TRUE);

                var xArroyBias = Width - 60f;
                pathData[0] = xArroyBias;
                pathData[1] = -kXBias;
                pathData[2] = xArroyBias + kYBias;
                pathData[3] = 0f;
                pathData[4] = xArroyBias;
                pathData[5] = kXBias;
                VGU.vguPolygon(path, pathData, 3, VGboolean.VG_TRUE);

                var vgPath = new VGPath(path, color, color);
                vgPath.Move(35, 15);
                Arrows = vgPath;
            }

            #endregion

            #region Grid

            {
                var path = VGPath.OpenVGPath();
                VGU.vguLine(path, 0, 0, Width - 60, 0); // OX

                var vgPath = new VGPath(path, null, null);
                //vgPath.SetStroke(color);
                vgPath.SetStroke(color, new[] { 2.0f, 2.0f });
                vgPath.StrokeWidth = 0.5f;
                vgPath.Move(40, 20 + 180);

                Grid = vgPath;
            }

            #endregion

            #region childs
            mHLabels = new[]
            {
                new TextArea(this, 15, 0, 36, 18)
                {
                    Text = "1"
                },
                new TextArea(this, (int)(kOxWidht * 50 / 177), 0, 36, 18)
                {
                    Text = "50"
                },
                new TextArea(this, (int)(kOxWidht * 100 / 177), 0, 36, 18)
                {
                    Text = "100"
                },
                new TextArea(this, (int)(kOxWidht * 150 / 177), 0, 36, 18)
                {
                    Text = "150"
                }
            };

            var oyLabel = new TextArea(this, -10, Height, 60, 18)
            {
                Text = "P, бар"
            };
            mVRuntimeLabels = new[]
            {
                oyLabel,
                new TextArea(this, -10, 10, 36, 18)
                {
                    Text = "0"
                },

                new TextArea(this, -10, Height * 50 / kHeight, 36, 18)
                {
                    Text = "100"
                },
                new TextArea(this, -10, Height * 100 / kHeight, 36, 18)
                {
                    Text = "200"
                },
                new TextArea(this, -10, Height * 150 / kHeight, 36, 18)
                {
                    Text = "300"
                },
                new TextArea(this, -10, Height * 200 / kHeight, 36, 18)
                {
                    Text = "400"
                },
                new TextArea(this, -10, Height * 250 / kHeight, 36, 18)
                {
                    Text = "500"
                }
            };


            mVHistoryLabels = new[]
            {
                new TextArea(this, -15, Height * 10 / kHeight, 45, 18)
                {
                    Text = ""
                },
                new TextArea(this, -15, Height * 25 / kHeight, 45, 18)
                {
                    Text = ""
                },

                new TextArea(this, -15, Height * 60 / kHeight, 45, 18)
                {
                    Text = ""
                },
                new TextArea(this, -15, Height * 75 / kHeight, 45, 18)
                {
                    Text = ""
                },

                new TextArea(this, -15, Height * 110 / kHeight, 45, 18)
                {
                    Text = ""
                },
                new TextArea(this, -15, Height * 125 / kHeight, 45, 18)
                {
                    Text = ""
                },

                new TextArea(this, -15, Height * 160 / kHeight, 45, 18)
                {
                    Text = ""
                },
                new TextArea(this, -15, Height * 175 / kHeight, 45, 18)
                {
                    Text = ""
                },

                new TextArea(this, -15, Height * 210 / kHeight, 45, 18)
                {
                    Text = ""
                },
                new TextArea(this, -15, Height * 225 / kHeight, 45, 18)
                {
                    Text = ""
                }
            };

            foreach (var label in mHLabels)
            {
                label.SetFont(new Color(0xD1D3D4FF), 20);
                label.SetAlign(Align.Right);
            }


            foreach (var label in mVRuntimeLabels)
            {
                label.SetFont(new Color(0xD1D3D4FF), 20);
                label.SetAlign(Align.Right);
            }


            foreach (var label in mVHistoryLabels)
            {
                label.SetFont(new Color(0xD1D3D4FF), 20);
                label.SetAlign(Align.Right);
                label.Hide();
            }

            //mVRuntimeLabels[mVRuntimeLabels.Length - 2].SetFont(new Color(0x5EE82CFF), 20);// "180"

            var oxLabel = new TextArea(this, Width - 20, 0, 60, 18)
            {
                Text = "N"
            };
            oxLabel.SetFont(new Color(0xD1D3D4FF), 20);


            oyLabel.SetFont(new Color(0xD1D3D4FF), 20);
            oyLabel.SetAlign(Align.Left, new GfxPoint(0, 5));
            #endregion

            Move(170, 310);

            //ImageCacheBorder = 50; // work

            Type = VisializationType.Realtime;
        }
示例#19
0
        private void Init(int x, int y)
        {
            InitBackground();

            mPaint = VG.vgCreatePaint();
            VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, (new Color(0xEDAB18ff)).Value);

            AddVGPath(new VGPath(mPath, new VGSolidColor(new Color(0xD1D3D4FF)), new VGSolidColor(new Color(0x2c2d2eff)))
            {
                StrokeWidth = 0.5f
            });

            var       divideLines = VGPath.OpenVGPath();
            const int kBiasY      = 44;

            VGU.vguLine(divideLines, 0, 3 * kBiasY, Width - 30, 3 * kBiasY);
            VGU.vguLine(divideLines, 0, 2 * kBiasY, Width - 30, 2 * kBiasY);
            VGU.vguLine(divideLines, 0, kBiasY, Width - 30, kBiasY);
            VGU.vguLine(divideLines, 0, 0, Width - 30, 0);
            var lines = new VGPath(divideLines, new VGSolidColor(new Color(0xD1D3D4FF)), null)
            {
                StrokeWidth = 0.5f
            };

            lines.Move(15, kBiasY);
            AddVGPath(lines);

            const int kBiasX  = 47;
            const int kBiasX0 = 60;

            Text.Label(this, "T, ⁰C", 16, kBiasX0, kBiasY * 4, kBiasX, 18);
            Text.Label(this, "I, A", 16, kBiasX0 + kBiasX, kBiasY * 4, kBiasX, 18);
            Text.Label(this, "U, B", 16, kBiasX0 + 2 * kBiasX, kBiasY * 4, kBiasX, 18);
            Text.Label(this, "F, Гц", 16, kBiasX0 + 3 * kBiasX, kBiasY * 4, kBiasX, 18);
            Text.Label(this, "об/мин", 16, kBiasX0 + 4 * kBiasX, kBiasY * 4, kBiasX, 18);

            //Text.Label(this, "ПЧН #1\\nПЧН #2\\nПЧН #3\\nПЧН #4", 18, 15, 22, kBiasX0 - 15, kBiasY, Align.Left);

            mTable     = new Table(this);
            mTableLine = new TableLine(kBiasY / 2);
            mTableLine.AddColumn(kBiasX0 - 15, null, Align.Center, 17, Palette.White, new GfxPoint(0, 3));
            //mTableLine.Text[0].Text = "ПЧН #4";
            mTableLine.AddColumn(kBiasX, null, Align.Center, 17, Palette.White, new GfxPoint(0, 3));
            mTableLine.AddColumn(kBiasX, null, Align.Center, 17, Palette.White, new GfxPoint(0, 3));
            mTableLine.AddColumn(kBiasX, null, Align.Center, 17, Palette.White, new GfxPoint(0, 3));
            mTableLine.AddColumn(kBiasX, null, Align.Center, 17, Palette.White, new GfxPoint(0, 3));
            mTableLine.AddColumn(kBiasX, null, Align.Center, 17, Palette.White, new GfxPoint(0, 3));

            mTableStatusLine = new TableLine(kBiasY / 2);
            mTableStatusLine.AddColumn(kBiasX0 - 15, null, Align.Center, 16, new Color(0xD1D3D4FF), new GfxPoint(0, 5));
            mTableStatusLine.Text[0].Text = "статус:";
            mTableStatusLine.AddColumn(kBiasX * 5, null, Align.Center, 17, Palette.White, new GfxPoint(0, 3));

            mTable.AddLine(mTableStatusLine);
            mTable.AddLine(mTableLine);

            mTable.AddLine(new TableLine(mTableStatusLine));
            mTable.AddLine(new TableLine(mTableLine));

            mTable.AddLine(new TableLine(mTableStatusLine));
            mTable.AddLine(new TableLine(mTableLine));

            mTable.AddLine(new TableLine(mTableStatusLine));
            mTable.AddLine(new TableLine(mTableLine));

            //mTable.SetBorder(1, Palette.Lime); // for debug
            mTable.Move(15, 0);

            mTable.GetCellById(7, 0).Text = "Uz 2";
            mTable.GetCellById(5, 0).Text = "Uz 3";
            mTable.GetCellById(3, 0).Text = "Uz 4";
            mTable.GetCellById(1, 0).Text = "Uz 5";


            #region temperature
            mReciever.GetSignal("uz.2.temperature").OnUpdate += sensor => mTable.GetCellById(7, 1).Text = string.Format("{0}", sensor.Value);
            mReciever.GetSignal("uz.3.temperature").OnUpdate += sensor =>
            {
                mTable.GetCellById(5, 1).Text = string.Format("{0}", sensor.Value);
            };
            mReciever.GetSignal("uz.4.temperature").OnUpdate += sensor => mTable.GetCellById(3, 1).Text = string.Format("{0}", sensor.Value);
            mReciever.GetSignal("uz.5.temperature").OnUpdate += sensor => mTable.GetCellById(1, 1).Text = string.Format("{0}", sensor.Value);
            mTable.GetCellById(7, 1).Text = "-";
            mTable.GetCellById(5, 1).Text = "-";
            mTable.GetCellById(3, 1).Text = "-";
            mTable.GetCellById(1, 1).Text = "-";
            #endregion

            #region current
            mReciever.GetSignal("uz.2.current").OnUpdate += sensor => mTable.GetCellById(7, 2).Text = string.Format("{0}", sensor.Value);
            mReciever.GetSignal("uz.3.current").OnUpdate += sensor => mTable.GetCellById(5, 2).Text = string.Format("{0}", sensor.Value);
            mReciever.GetSignal("uz.4.current").OnUpdate += sensor => mTable.GetCellById(3, 2).Text = string.Format("{0}", sensor.Value);
            mReciever.GetSignal("uz.5.current").OnUpdate += sensor => mTable.GetCellById(1, 2).Text = string.Format("{0}", sensor.Value);
            mTable.GetCellById(7, 2).Text = "-";
            mTable.GetCellById(5, 2).Text = "-";
            mTable.GetCellById(3, 2).Text = "-";
            mTable.GetCellById(1, 2).Text = "-";
            #endregion

            #region voltage
            mReciever.GetSignal("uz.2.voltage").OnUpdate += sensor => mTable.GetCellById(7, 3).Text = string.Format("{0}", sensor.Value);
            mReciever.GetSignal("uz.3.voltage").OnUpdate += sensor => mTable.GetCellById(5, 3).Text = string.Format("{0}", sensor.Value);
            mReciever.GetSignal("uz.4.voltage").OnUpdate += sensor => mTable.GetCellById(3, 3).Text = string.Format("{0}", sensor.Value);
            mReciever.GetSignal("uz.5.voltage").OnUpdate += sensor => mTable.GetCellById(1, 3).Text = string.Format("{0}", sensor.Value);
            mTable.GetCellById(7, 3).Text = "-";
            mTable.GetCellById(5, 3).Text = "-";
            mTable.GetCellById(3, 3).Text = "-";
            mTable.GetCellById(1, 3).Text = "-";
            #endregion

            // TODO: привязать к реальным значениям
            #region freq
            mReciever.GetSignal("uz.2.frequency").OnUpdate += sensor => mTable.GetCellById(7, 4).Text = string.Format("{0:F2}", sensor.Value / 100);
            mReciever.GetSignal("uz.3.frequency").OnUpdate += sensor => mTable.GetCellById(5, 4).Text = string.Format("{0:F2}", sensor.Value / 100);
            mReciever.GetSignal("uz.4.frequency").OnUpdate += sensor => mTable.GetCellById(3, 4).Text = string.Format("{0:F2}", sensor.Value / 100);
            mReciever.GetSignal("uz.5.frequency").OnUpdate += sensor => mTable.GetCellById(1, 4).Text = string.Format("{0:F2}", sensor.Value / 100);
            mTable.GetCellById(7, 4).Text = "-";
            mTable.GetCellById(5, 4).Text = "-";
            mTable.GetCellById(3, 4).Text = "-";
            mTable.GetCellById(1, 4).Text = "-";
            #endregion

            #region rpm - энкодера нет физически
            //mReciever.GetSignal("uz.2.speed").OnUpdate += sensor => mTable.GetCellById(7, 5).Text = string.Format("{0}", sensor.Value);
            //mReciever.GetSignal("uz.3.speed").OnUpdate += sensor => mTable.GetCellById(5, 5).Text = string.Format("{0}", sensor.Value);
            //mReciever.GetSignal("uz.4.speed").OnUpdate += sensor => mTable.GetCellById(3, 5).Text = string.Format("{0}", sensor.Value);
            //mReciever.GetSignal("uz.5.speed").OnUpdate += sensor => mTable.GetCellById(1, 5).Text = string.Format("{0}", sensor.Value);
            mTable.GetCellById(7, 5).Text = "-";
            mTable.GetCellById(5, 5).Text = "-";
            mTable.GetCellById(3, 5).Text = "-";
            mTable.GetCellById(1, 5).Text = "-";
            #endregion

            // TODO: по значению
            #region status

            /*
             * mReciever.GetSignal("uz.2.error").OnUpdate += sensor => mTable.GetCellById(7, 5).Text = string.Format("0x{0:X4}", sensor.Value);
             * mReciever.GetSignal("uz.3.error").OnUpdate += sensor => mTable.GetCellById(5, 5).Text = string.Format("0x{0:X4}", sensor.Value);
             * mReciever.GetSignal("uz.4.error").OnUpdate += sensor => mTable.GetCellById(3, 5).Text = string.Format("0x{0:X4}", sensor.Value);
             * mReciever.GetSignal("uz.5.error").OnUpdate += sensor => mTable.GetCellById(1, 5).Text = string.Format("0x{0:X4}", sensor.Value);
             */

            mReciever.GetSignal("uz.2.error").OnUpdate += sensor =>
            {
                mTable.GetCellById(6, 1).SetFont(sensor.Value > 0
                                                                                                            ? Palette.Red
                                                                                                            : Palette.White);
                mTable.GetCellById(6, 1).Text = string.Format("{0}", sensor.Value);
            };
            mReciever.GetSignal("uz.3.error").OnUpdate += sensor =>
            {
                mTable.GetCellById(4, 1).SetFont(sensor.Value > 0
                                                                                                            ? Palette.Red
                                                                                                            : Palette.White);
                mTable.GetCellById(4, 1).Text = string.Format("{0}", sensor.Value);
            };
            mReciever.GetSignal("uz.4.error").OnUpdate += sensor =>
            {
                mTable.GetCellById(2, 1).SetFont(sensor.Value > 0
                                                                                                            ? Palette.Red
                                                                                                            : Palette.White);
                mTable.GetCellById(2, 1).Text = string.Format("{0}", sensor.Value);
            };
            mReciever.GetSignal("uz.5.error").OnUpdate += sensor =>
            {
                mTable.GetCellById(0, 1).SetFont(sensor.Value > 0
                                                                                                            ? Palette.Red
                                                                                                            : Palette.White);
                mTable.GetCellById(0, 1).Text = string.Format("{0}", sensor.Value);
            };

            mTable.GetCellById(6, 1).Text = "6:1";
            mTable.GetCellById(4, 1).Text = "4:1";
            mTable.GetCellById(2, 1).Text = "2:1";
            mTable.GetCellById(0, 1).Text = "0:1";
            #endregion

            //mReciever.GetSignal("").OnUpdate += sensor => mTable.GetCellById(0, 0).Text = string.Format("{0}", sensor.Value);


            Move(x, y);
        }
示例#20
0
        public VagonIcon(IWidget parent, ISignal pump, ISignal uz2, ISignal uz3, ISignal uz4, ISignal uz5, ISignal conveyor, int y)
            : base(parent)
        {
            mPump = pump;
            #region насосная станция
            mPump.OnUpdate += sensor =>
            {
                switch (sensor.ValueAsInt)
                {
                case 0:    // stop
                {
                    EngineNormal(0);
                }
                break;

                case 1:    // active
                {
                    EngineActive(0);
                }
                break;

                case 2:    // fault
                {
                    EngineFault(0);
                }
                break;
                }
            };
            #endregion

            mUz2 = uz2;
            #region ПЧН 1
            mUz2.OnUpdate += sensor =>
            {
                switch (sensor.ValueAsInt)
                {
                case 0:    // stop
                {
                    EngineNormal(1);
                }
                break;

                case 1:    // active
                {
                    EngineActive(1);
                }
                break;

                case 2:    // fault
                {
                    EngineFault(1);
                }
                break;
                }
            };
            #endregion

            mUz3 = uz3;
            #region ПЧН 2
            mUz3.OnUpdate += sensor =>
            {
                switch (sensor.ValueAsInt)
                {
                case 0:    // stop
                {
                    EngineNormal(2);
                }
                break;

                case 1:    // active
                {
                    EngineActive(2);
                }
                break;

                case 2:    // fault
                {
                    EngineFault(2);
                }
                break;
                }
            };
            #endregion

            mUz4 = uz4;
            #region ПЧН 3
            mUz4.OnUpdate += sensor =>
            {
                switch (sensor.ValueAsInt)
                {
                case 0:    // stop
                {
                    EngineNormal(3);
                }
                break;

                case 1:    // active
                {
                    EngineActive(3);
                }
                break;

                case 2:    // fault
                {
                    EngineFault(3);
                }
                break;
                }
            };
            #endregion

            mUz5 = uz5;
            #region ПЧН4
            mUz5.OnUpdate += sensor =>
            {
                switch (sensor.ValueAsInt)
                {
                case 0:    // stop
                {
                    EngineNormal(4);
                }
                break;

                case 1:    // active
                {
                    EngineActive(4);
                }
                break;

                case 2:    // fault
                {
                    EngineFault(4);
                }
                break;
                }
            };
            #endregion

            mConveyor = conveyor;
            #region конвейер
            mConveyor.OnUpdate += sensor =>
            {
                switch (sensor.ValueAsInt)
                {
                case 0:    // stop
                {
                    EngineNormal(5);
                }
                break;

                case 1:    // active
                {
                    EngineActive(5);
                }
                break;

                case 2:    // fault
                {
                    EngineFault(5);
                }
                break;
                }
            };
            #endregion

            mImage = new Image(this, 0, 0);
            const float kScale = 1.0f;
            mImage.Scale(kScale, kScale);
            mImage.Load("./wvga.vagon.raw");

            //Width = (int)(mImage.Width * kScale);
            //Height = (int)(mImage.Height * kScale);
            Resize((int)(mImage.Width * kScale), (int)(mImage.Height * kScale));
            Init(y);

            for (var i = 0; i < 6; i++)
            {
                mRects.Add(new Rect {
                    Path = VGPath.OpenVGPath(), Color = mDefaultColor
                });
            }

            var pos = ScreenPosition;

            VGU.vguRect(mRects[0].Path, pos.X + 145, pos.Y + mImage.Height - 30, 35, 20);
            VGU.vguRect(mRects[1].Path, pos.X + 75, pos.Y + mImage.Height - 35, 30, 25);
            VGU.vguRect(mRects[2].Path, pos.X + 185, pos.Y + mImage.Height - 35, 30, 25);
            VGU.vguRect(mRects[3].Path, pos.X + 75, pos.Y + 10, 30, 25);
            VGU.vguRect(mRects[4].Path, pos.X + 185, pos.Y + 10, 30, 25);
            VGU.vguRect(mRects[5].Path, pos.X + 10, pos.Y + mImage.Height / 2 - 20, mImage.Width - 20, 40);

            mPaint = VG.vgCreatePaint();
        }