Ejemplo n.º 1
0
        public static Framework.Data.CompassDirection GetCompassDirectionFromAngle(int angle)
        {
            Framework.Data.CompassDirection result = Framework.Data.CompassDirection.N;
            double deg = angle;

            if (deg < 0)
            {
                deg += 360;
            }
            if (deg >= (360 - 22.5) || deg <= 22.5)
            {
                result = Framework.Data.CompassDirection.N;
            }
            else if (deg >= (45 - 22.5) && deg <= (45 + 22.5))
            {
                result = Framework.Data.CompassDirection.NE;
            }
            else if (deg >= (90 - 22.5) && deg <= (90 + 22.5))
            {
                result = Framework.Data.CompassDirection.E;
            }
            else if (deg >= (135 - 22.5) && deg <= (135 + 22.5))
            {
                result = Framework.Data.CompassDirection.SE;
            }
            else if (deg >= (180 - 22.5) && deg <= (180 + 22.5))
            {
                result = Framework.Data.CompassDirection.S;
            }
            else if (deg >= (225 - 22.5) && deg <= (225 + 22.5))
            {
                result = Framework.Data.CompassDirection.SW;
            }
            else if (deg >= (270 - 22.5) && deg <= (270 + 22.5))
            {
                result = Framework.Data.CompassDirection.W;
            }
            else if (deg >= (315 - 22.5) && deg <= (315 + 22.5))
            {
                result = Framework.Data.CompassDirection.NW;
            }
            return(result);
        }
Ejemplo n.º 2
0
        public string GetImagePath(Framework.Data.ImageSize imageSize, Framework.Data.CompassDirection compassDir)
        {
            string result;
            string fn = string.Format("{0}.gif", compassDir.ToString());

            result = Path.Combine(new string[] { _baseImagePath, imageSize.ToString(), "compass", fn });
            if (!File.Exists(result))
            {
                if (imageSize != Framework.Data.ImageSize.Default)
                {
                    result = Path.Combine(new string[] { _baseImagePath, imageSize.ToString(), "compass", fn });
                    if (!File.Exists(result))
                    {
                        result = null;
                    }
                }
                else
                {
                    result = null;
                }
            }
            return(result);
        }
Ejemplo n.º 3
0
        public string GetImagePath(Framework.Interfaces.ICore core, Framework.Data.ImageSize imageSize, Framework.Data.CompassDirection compassDir)
        {
            string result = null;

            foreach (Framework.Interfaces.IImageResource ir in _imageResourcePlugins)
            {
                result = ir.GetImagePath(imageSize, compassDir);
                if (!string.IsNullOrEmpty(result))
                {
                    break;
                }
            }
            if (result == null && imageSize != Framework.Data.ImageSize.Default)
            {
                result = GetImagePath(core, Framework.Data.ImageSize.Default, compassDir);
            }
            else if (string.IsNullOrEmpty(result))
            {
                //select default
                result = GetDefaultImagePath(imageSize);
            }
            return(result);
        }
Ejemplo n.º 4
0
 public string GetImagePath(Framework.Data.ImageSize imageSize, Framework.Data.CompassDirection compassDir)
 {
     return(null);
 }