Exemplo n.º 1
0
        /// <summary>
        /// определение положения светодиода на экране
        /// </summary>
        /// <param name="radialLight"></param>
        /// <param name="center"></param>
        /// <param name="koef"></param>
        /// <returns></returns>
        private Point getLocationOfLabel(RadialLight radialLight, Point center, float koef)
        {
            //угл относительно оси Х
            double angle = (radialLight.AngleShift - (radialLight.Number - 1) * 30) * Math.PI / 180.0;
            //длина до точки
            float dist = koef * radialLight.Distance;

            return(new Point((int)(center.X + dist * Math.Cos(angle) - 6), (int)(center.Y - dist * Math.Sin(angle) - 8)));
        }
Exemplo n.º 2
0
        /// <summary>
        /// определение положения светодиода на экране
        /// </summary>
        /// <param name="radialLight"></param>
        /// <param name="center"></param>
        /// <param name="koefX"></param>
        /// <param name="koefY"></param>
        /// <returns></returns>
        private Point getLocationOfCheckBox(RadialLight radialLight, Point center, float koefX, float koefY)
        {
            //угл относительно оси Х
            double angle = (radialLight.AngleShift - (radialLight.Number - 1) * 30) * Math.PI / 180.0;;
            //длина до точки
            float distX = koefX * radialLight.Distance;
            float distY = koefY * radialLight.Distance;

            return(new Point((int)(center.X + distX * Math.Cos(angle) - 4), (int)(center.Y - distY * Math.Sin(angle) - 4)));
        }
Exemplo n.º 3
0
        /// <summary>
        /// К каким четвертям относится точка
        /// </summary>
        /// <param name="rl"></param>
        /// <returns></returns>
        private int[] ChetvertOfLight(RadialLight rl)
        {
            //угл относительно оси Х
            double angle = Math.Abs((rl.AngleShift - (rl.Number - 1) * 30));

            switch (angle)
            {
            case 0.0:
            case 360.0:
                return(new int[] { 1, 4 });

            case 90.0:
                return(new int[] { 3, 4 });

            case 180.0:
                return(new int[] { 2, 3 });

            case 270.0:
                return(new int[] { 1, 2 });
            }
            int[] ret = new int[1];
            if (angle > 0.0 && angle < 90.0)
            {
                ret[0] = 4;
            }
            else if (angle > 90.0 && angle < 180.0)
            {
                ret[0] = 3;
            }
            else if (angle > 180.0 && angle < 270.0)
            {
                ret[0] = 2;
            }
            else
            {
                ret[0] = 1;
            }
            return(ret);
        }