Beispiel #1
0
        private void OperatorMode_SizeChanged(Object sender, EventArgs e)
        {
            int r           = (int)GraphicLidar.getDiameter(lidarAlert) / 2;
            int leftPadding = (lidarAlert.Size.Width - (int)GraphicLidar.getDiameter(lidarAlert)) / 2;
            int w           = (r * 2) / 7;
            int topPadding  = lidarAlert.Size.Height - r;
            int step        = r / 3;

            #region Laidar Output
            DistTopXLabel1.Location = new Point(leftPadding - 10, lidarAlert.Size.Height - 25);
            DistTopXLabel2.Location = new Point(leftPadding + w - 15, lidarAlert.Size.Height - 25);
            DistTopXLabel3.Location = new Point(leftPadding + w * 2 + 5, lidarAlert.Size.Height - 25);
            DistTopXLabel4.Location = new Point(leftPadding + w * 5 - 45, lidarAlert.Size.Height - 25);
            DistTopXLabel5.Location = new Point(leftPadding + w * 6 - 25, lidarAlert.Size.Height - 25);
            DistTopXLabel6.Location = new Point(leftPadding + w * 7 - 40, lidarAlert.Size.Height - 25);

            DistTopYLabel1.Location = new Point(leftPadding + 5, lidarAlert.Size.Height - step - 50);
            DistTopYLabel2.Location = new Point(leftPadding + 5, lidarAlert.Size.Height - step * 2 - 50);
            DistTopYLabel3.Location = new Point(lidarAlert.Size.Width / 2 - 30, topPadding - 45);
            #endregion

            #region Lidar Alert
            DistFrontXLabel1.Location = new Point(leftPadding - 10, lidarAlert.Size.Height - 25);
            DistFrontXLabel2.Location = new Point(leftPadding + w - 15, lidarAlert.Size.Height - 25);
            DistFrontXLabel3.Location = new Point(leftPadding + w * 2 + 5, lidarAlert.Size.Height - 25);
            DistFrontXLabel4.Location = new Point(leftPadding + w * 5 - 45, lidarAlert.Size.Height - 25);
            DistFrontXLabel5.Location = new Point(leftPadding + w * 6 - 25, lidarAlert.Size.Height - 25);
            DistFrontXLabel6.Location = new Point(leftPadding + w * 7 - 40, lidarAlert.Size.Height - 25);

            DistFrontYLabel1.Location = new Point(leftPadding + 5, lidarAlert.Size.Height - step - 50);
            DistFrontYLabel2.Location = new Point(leftPadding + 5, lidarAlert.Size.Height - step * 2 - 50);
            DistFrontYLabel3.Location = new Point(lidarAlert.Size.Width / 2 - 30, topPadding - 45);
            #endregion
        }
Beispiel #2
0
        // If grid is enable set on the labels the correct number
        // else hiding the libels
        private void DistLabelSetup()
        {
            if (config.getGridEnable())
            {
                float ratio = GraphicLidar.GetRatioHeightWidth(config);
                #region Laidar Output Label
                float maxDist   = (config.getSideLowAlert() * 10) / GraphicLidarOutput.Zoom;
                float distXStep = (maxDist / 1000) / 3;
                float distYStep = ((maxDist / ratio) / 1000) / 3;
                DistFrontYLabel1.Text      = (distYStep).ToString("0.00");
                DistFrontYLabel1.BackColor = Color.Transparent;
                DistFrontYLabel2.Text      = (distYStep * 2).ToString("0.00");
                DistFrontYLabel2.BackColor = Color.Transparent;
                DistFrontYLabel3.Text      = (distYStep * 3).ToString("0.00");
                DistFrontYLabel3.BackColor = Color.Transparent;

                DistFrontXLabel1.Text      = (-distXStep * 3).ToString("0.00");
                DistFrontXLabel1.BackColor = Color.Transparent;
                DistFrontXLabel2.Text      = (-distXStep * 2).ToString("0.00");
                DistFrontXLabel2.BackColor = Color.Transparent;
                DistFrontXLabel3.Text      = (-distXStep).ToString("0.00");
                DistFrontXLabel3.BackColor = Color.Transparent;
                DistFrontXLabel4.Text      = (distXStep).ToString("0.00");
                DistFrontXLabel4.BackColor = Color.Transparent;
                DistFrontXLabel5.Text      = (distXStep * 2).ToString("0.00");
                DistFrontXLabel5.BackColor = Color.Transparent;
                DistFrontXLabel6.Text      = (distXStep * 3).ToString("0.00");
                DistFrontXLabel6.BackColor = Color.Transparent;
                #endregion

                #region Lidar Alert Label
                float maxDisSide  = (config.getSideLowAlert() * 10) / GraphicLidarAlert.Zoom;
                float maxDisFront = (config.getFrontLowAlert() * 10) / GraphicLidarAlert.Zoom;
                distXStep = (maxDisSide / 1000) / 3;
                distYStep = (maxDisFront / 1000) / 3;
                if (maxDisSide / maxDisFront < ratio)
                {
                    float RatioFactor = (maxDisFront * ratio) / maxDisSide;
                    distXStep = ((maxDisSide * RatioFactor) / 1000) / 3;
                }
                else if (maxDisSide / maxDisFront > ratio)
                {
                    float RatioFactor = maxDisSide / (maxDisFront * ratio);
                    distYStep = ((maxDisFront * RatioFactor) / 100) / 3;
                }
                DistTopYLabel1.Text      = (distYStep).ToString("0.00");
                DistTopYLabel1.BackColor = Color.Transparent;
                DistTopYLabel2.Text      = (distYStep * 2).ToString("0.00");
                DistTopYLabel2.BackColor = Color.Transparent;
                DistTopYLabel3.Text      = (distYStep * 3).ToString("0.00");
                DistTopYLabel3.BackColor = Color.Transparent;

                DistTopXLabel1.Text      = (-distXStep * 3).ToString("0.00");
                DistTopXLabel1.BackColor = Color.Transparent;
                DistTopXLabel2.Text      = (-distXStep * 2).ToString("0.00");
                DistTopXLabel2.BackColor = Color.Transparent;
                DistTopXLabel3.Text      = (-distXStep).ToString("0.00");
                DistTopXLabel3.BackColor = Color.Transparent;
                DistTopXLabel4.Text      = (distXStep).ToString("0.00");
                DistTopXLabel4.BackColor = Color.Transparent;
                DistTopXLabel5.Text      = (distXStep * 2).ToString("0.00");
                DistTopXLabel5.BackColor = Color.Transparent;
                DistTopXLabel6.Text      = (distXStep * 3).ToString("0.00");
                DistTopXLabel6.BackColor = Color.Transparent;
                #endregion
            }
            else
            {
                #region Laidar Output Label
                DistFrontYLabel1.Visible = false;
                DistFrontYLabel2.Visible = false;
                DistFrontYLabel3.Visible = false;

                DistFrontXLabel1.Visible = false;
                DistFrontXLabel2.Visible = false;
                DistFrontXLabel3.Visible = false;
                DistFrontXLabel4.Visible = false;
                DistFrontXLabel5.Visible = false;
                DistFrontXLabel6.Visible = false;
                #endregion

                #region Lidar Alert Label
                DistTopYLabel1.Visible = false;
                DistTopYLabel2.Visible = false;
                DistTopYLabel3.Visible = false;

                DistTopXLabel1.Visible = false;
                DistTopXLabel2.Visible = false;
                DistTopXLabel3.Visible = false;
                DistTopXLabel4.Visible = false;
                DistTopXLabel5.Visible = false;
                DistTopXLabel6.Visible = false;
                #endregion
            }
        }