Exemplo n.º 1
0
        public static GraphicArea ClassicArea(IWidget parent)
        {
            var rv = new GraphicArea(parent, 460, 220)
            {
                Background = Palette.TextArea.Background
            };

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

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

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

                var yArroyBias = rv.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 = rv.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, new VGSolidColor(Palette.Black), new VGSolidColor(Palette.LightBlue));
                vgPath.Move(35, 15);
                rv.Arrows = vgPath;
            }
            #endregion

            #region Grid
            {
                var path = VGPath.OpenVGPath();

                for (var i = 1; i < 4; i++)
                {
                    VGU.vguLine(path, 0, i * 60, rv.Width - 60, i * 60);  // OX
                }
                for (var i = 1; i < 11; i++)
                {
                    VGU.vguLine(path, i * 40, 0, i * 40, rv.Height - 40); // OY
                }
                var vgPath = new VGPath(path, null, null);
                vgPath.SetStroke(new VGSolidColor(Palette.DarkSlateGray), new[] { 5.0f, 10.0f, 15.0f, 10.0f });
                vgPath.StrokeWidth = 0.5f;
                vgPath.Move(40, 20);

                rv.Grid = vgPath;
            }
            #endregion

            rv.Move(10, 10);
            return(rv);
        }
Exemplo n.º 2
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;
        }