Beispiel #1
0
        public PalletteVisual(Geometry.Rectangle r, int palleteNo)
        {
            _palleteNo     = palleteNo;
            _thisRectangle = r;
            var centreRect = r.SubRectangle(new Geometry.Rectangle(0f, 1f, 0.2f, 0.7f)); // centre
            var a          = centreRect.SliceVertical(0.05f, 0.95f).Split(staticTexts.Count, 2);

            a = new List <Geometry.Rectangle>
            {
                centreRect.SliceVertical(0.05f, 0.65f),
                centreRect.SliceVertical(0.65f, 0.95f)
            };
            a = new List <Geometry.Rectangle> {
            };
            a.AddRange(centreRect.SliceVertical(0.05f, 0.7f).Split(staticTexts.Count, 1));
            a.AddRange(centreRect.SliceVertical(0.7f, 0.95f).Split(staticTexts.Count, 1));


            _palleteBoxBg = new ModifiedLabel("bg");
            var c1 = Color.FromArgb(255, 255, 255, 15);


            _palleteBoxBg.BackColor = c1;
            _palleteBoxBg.Reorient(centreRect);
            _palleteBoxBg.Text = "";
            for (int i = 0; i < staticTexts.Count; i++)
            {
                var staticText = new ModifiedLabel($"{i}", emSize: 12f);
                staticText.BackColor = c1;
                staticText.Text      = staticTexts[i];
                staticText.Reorient(a[i]);
                staticText.TextAlign = ContentAlignment.MiddleLeft;
                _staticLabels.Add(staticText);

                var dynamicText = new ModifiedLabel($"{i}", emSize: 12f);
                dynamicText.BackColor = c1;
                dynamicText.Text      = "???";
                dynamicText.Reorient(a[i + staticTexts.Count]);
                dynamicText.Parent    = _palleteBoxBg;
                dynamicText.TextAlign = ContentAlignment.MiddleLeft;
                _dynamicLabels.Add(dynamicText);
            }

            _modifiedProgressBarDefined = new ModifiedProgressBar("h", "");
            _modifiedProgressBarDefined.Reorient(r.SubRectangle(new Geometry.Rectangle(0.02f, 0.99f, 0.7f, 0.75f)));

            _modifiedProgressBarFilled = new ModifiedProgressBar("h2", "");
            _modifiedProgressBarFilled.Reorient(r.SubRectangle(new Geometry.Rectangle(0.02f, 0.99f, 0.75f, 0.8f)));
        }
Beispiel #2
0
        public void resize(Geometry.Rectangle r)
        {
            //Geometry.Rectangle r = new Geometry.Rectangle(w, h, new Geometry.Point( x,y ));
            //var a = r.Split(1, 4,0.05f,0.05f);

            var centreRect = r.SubRectangle(new Geometry.Rectangle(0f, 1f, 0.2f, 0.7f)); // centre
            var a          = centreRect.SliceVertical(0.05f, 0.95f).Split(staticTexts.Count, 2);

            a = new List <Geometry.Rectangle>
            {
                centreRect.SliceVertical(0.05f, 0.65f),
                centreRect.SliceVertical(0.65f, 0.95f)
            };
            a = new List <Geometry.Rectangle> {
            };
            a.AddRange(centreRect.SliceVertical(0.05f, 0.7f).Split(staticTexts.Count, 1));
            a.AddRange(centreRect.SliceVertical(0.7f, 0.95f).Split(staticTexts.Count, 1));



            _palleteBoxBg.Reorient(centreRect);

            for (int i = 0; i < staticTexts.Count; i++)
            {
                _staticLabels[i].Reorient(a[i]);
                _dynamicLabels[i].Reorient(a[i + staticTexts.Count]);
            }

            _modifiedProgressBarDefined.Reorient(r.SubRectangle(new Geometry.Rectangle(0.02f, 0.99f, 0.7f, 0.75f)));
            _modifiedProgressBarFilled.Reorient(r.SubRectangle(new Geometry.Rectangle(0.02f, 0.99f, 0.75f, 0.8f)));
            _palleteName.Reorient(r.SubRectangle(new Geometry.Rectangle(0f, 1f, 0.1f, 0.201f)));
            _palleteButton.Reorient(r.SubRectangle(new Geometry.Rectangle(0.15f, 0.85f, 0.83f, 0.97f)));
            _plusButton.Reorient(r.SubRectangle(new Geometry.Rectangle(0.85f, 0.95f, 0.83f, 0.97f)));
            _minusButton.Reorient(r.SubRectangle(new Geometry.Rectangle(0.05f, 0.15f, 0.83f, 0.97f)));
        }
Beispiel #3
0
        public BoxVisuals(int x, int y, int w, int h, bool asVisual = false)
        {
            _asVisual = asVisual;
            _realSize = new Geometry.Rectangle(w, h, new Geometry.Point(x, y));
            if (asVisual)
            {
                _plotIndicator = new Indicator("plc", References.ProjectPath + "Images\\placeholder.jpg");
                _plotIndicator.PaintIndicator(Color.Chartreuse);
                Geometry.Rectangle r3 = _realSize.SliceVertical(0f, 1f);
                _plotIndicator.Reorient(r3);
            }
            else
            {
                // examples

                /*
                 * var sb = new SingleBox("111", "elma", "15", "152", "154",true,0);
                 * boxes.Add(sb);
                 * var sb2 = new SingleBox("111", "elma", "25", "252", "254",true,1);
                 * boxes.Add(sb2);
                 * var sb3 = new SingleBox("111", "elma3", "125", "152", "154",false,0);
                 * boxes.Add(sb3);
                 * var sb4 = new SingleBox("111", "elma1", "225", "252", "254",false,1);
                 * boxes.Add(sb4);
                 */

                // {BackColor = Color.Black};
                _beltIndicator = new Indicator("beltIndicator", References.ProjectPath + "Images\\belt.jpg");
                _beltIndicator.Reorient(_realSize.SubRectangle(_beltRect));
                for (int i = 0; i < 3; i++)
                {
                    //_palleteIndicators[i].BackColor = Color.Black;
                    _palleteIndicators[i].Reorient(_realSize.SubRectangle(_palleteRects[i]));
                    _robotIndicators[i].TextAlign = ContentAlignment.MiddleCenter;
                    _robotIndicators[i].Reorient(_realSize.SubRectangle(_palleteRects[i]).SubRectangle(new Geometry.Rectangle(0.3f, 0.7f, -0.15f, -0.05f)));
                    var j = i;
                    _robotIndicators[i].ClickAction = () =>
                    {
                        RobotOperation(j);
                    };
                }


                for (var j = 0; j < BeltCol; j++)
                {
                    for (var i = 0; i < BeltRow; i++)
                    {
                        var ml = new ModifiedLabel("aa", $"{i}, {j}", 8f)
                        {
                            ForeColor = Color.Black,
                            BackColor = Color.Goldenrod,
                            TextAlign = ContentAlignment.TopCenter
                        };
                        var otb = new Geometry.Rectangle((float)j / BeltCol,
                                                         (float)(j + 1) / BeltCol, (float)i / BeltRow, (float)
                                                         (i + 1) / BeltRow);
                        var tb = _realSize.SubRectangle(_beltRect.SubRectangle(otb)).SubRectangle(new Geometry.Rectangle(0.05f, 0.95f, 0.05f, 0.95f));
                        ml.Reorient(tb);
                        _beltBoxLabels.Add(ml);
                    }
                }

                for (var i = 0; i < RobotRow; i++)
                {
                    for (var j = 0; j < RobotCol; j++)
                    {
                        var index = 0;
                        foreach (var e in _palleteRects)
                        {
                            var ml = new ModifiedLabel("aa", $"{i}, {j}", 8f)
                            {
                                ForeColor = Color.Black,
                                BackColor = Color.Goldenrod,
                                TextAlign = ContentAlignment.TopCenter
                            };
                            var otb = new Geometry.Rectangle((float)j / RobotCol,
                                                             (float)(j + 1) / RobotCol, (float)i / RobotRow, (float)
                                                             (i + 1) / RobotRow);
                            var tb = _realSize.SubRectangle(e.SubRectangle(otb)).SubRectangle(new Geometry.Rectangle(0.05f, 0.95f, 0.05f, 0.95f));
                            ml.Reorient(tb);
                            _robotLabels[index].Add(ml);
                            index++;
                        }
                    }
                }
            }
            Refresh();
        }