Exemple #1
0
        /// <summary>
        ///  Light up an round area
        /// </summary>
        /// <param name="lng"></param>
        /// <param name="lat"></param>
        /// <param name="r"></param>
        public void LightArea(float lng, float lat, float r)
        {
            int x, y;

            GetMapCoord(lng, lat, out x, out y);

            float w = (((r + MathEx.PIf) / (2 * MathEx.PIf)) * Width - ((0 + MathEx.PIf) / (2 * MathEx.PIf)) * Width);

            int bound = (int)Math.Floor(w);

            float[][] weights = null;
            int       size    = bound + 1;

            if (size < gaussFilter.Length)
            {
                if (gaussFilter[size] == null)
                {
                    gaussFilter[size] = new Filter2DResult(size, size * 0.75f);// new GuassBlurFilter(size, 0.75f, 10, 10);
                }
                weights = gaussFilter[size].Filter;
            }

            for (int i = -bound; i <= bound; i++)
            {
                for (int j = -bound; j <= bound; j++)
                {
                    targetValue[i + y][j + x] = Math.Min(targetValue[i + y][j + x] + (int)((weights[Math.Abs(i)][Math.Abs(j)]) * 0xff), 0xff);
                    cooldown[i + y][j + x]    = StdTargetValue;
                }
            }
        }
Exemple #2
0
        /// <summary>
        ///  Light up an round area
        /// </summary>
        /// <param name="lng"></param>
        /// <param name="lat"></param>
        /// <param name="r"></param>
        public void LightArea(float lng, float lat, float r)
        {
            int x, y;
            GetMapCoord(lng, lat, out x, out y);

            float w = (((r + MathEx.PIf) / (2 * MathEx.PIf)) * Width - ((0 + MathEx.PIf) / (2 * MathEx.PIf)) * Width);

            int bound = (int)Math.Floor(w);

            float[][] weights = null;
            int size = bound + 1;

            if (size < gaussFilter.Length)
            {
                if (gaussFilter[size] == null)
                    gaussFilter[size] = new Filter2DResult(size, size * 0.75f);// new GuassBlurFilter(size, 0.75f, 10, 10);
                weights = gaussFilter[size].Filter;
               

            }

            for (int i = -bound; i <= bound; i++)
            {
                for (int j = -bound; j <= bound; j++)
                {

                    targetValue[i + y][j + x] = Math.Min(targetValue[i + y][j + x] + (int)((weights[Math.Abs(i)][Math.Abs(j)]) * 0xff), 0xff);
                    cooldown[i + y][j + x] = StdTargetValue;
                   
                }
            }
        }