예제 #1
0
파일: Tile.cs 프로젝트: pheijmans-zz/GAPP
 /// <summary>Initializes a new instance of the Tile class.</summary>
 /// <param name="zoom">The zoom level for the tile.</param>
 /// <param name="x">The tile index along the X axis.</param>
 /// <param name="y">The tile index along the Y axis.</param>
 public Tile(MapControlFactory mapControlFactory, int zoom, int x, int y)
 {
     _mapControlFactory = mapControlFactory;
     _tileX             = x;
     _tileY             = y;
     _zoom = zoom;
     this.LoadTile();
 }
예제 #2
0
        /// <summary>Initializes a new instance of the MapOffset class.</summary>
        /// <param name="property">The property this MapOffset represents.</param>
        /// <param name="offsetChanged">Called when the Offset changes.</param>
        public MapOffset(MapControlFactory mapControlFactory, PropertyInfo property, EventHandler offsetChanged)
        {
            System.Diagnostics.Debug.Assert(property != null, "property cannot be null");
            System.Diagnostics.Debug.Assert(offsetChanged != null, "offsetChanged cannot be null");

            _mapControlFactory           = mapControlFactory;
            _mapSize                     = mapControlFactory.TileGenerator.TileSize;
            _offsetChanged               = offsetChanged;
            this.Property                = property;
            this.Frames                  = 24;
            CompositionTarget.Rendering += this.OnRendering; // Used for manual animation
        }
예제 #3
0
 public MapCanvas()
 {
     _mapControlFactory = UIControls.Maps.Control.MapControlFactoryToUse;
     if (_mapControlFactory != null)
     {
         _offsetX   = _mapControlFactory.GetMapOffset(_translate.GetType().GetProperty("X"), this.OnOffsetChanged);
         _offsetY   = _mapControlFactory.GetMapOffset(_translate.GetType().GetProperty("Y"), this.OnOffsetChanged);
         _tilePanel = _mapControlFactory.TilePanel;
         _tilePanel.RenderTransform = _translate;
     }
     this.Background = Brushes.Transparent; // Register all mouse clicks
     this.Children.Add(_cache);
     if (_mapControlFactory != null)
     {
         this.Children.Add(_tilePanel);
     }
     this.ClipToBounds        = true;
     this.Focusable           = true;
     this.FocusVisualStyle    = null;
     this.SnapsToDevicePixels = true;
 }
예제 #4
0
        public TileGenerator(MapControlFactory mapControlFactory)
        {
            _mapControlFactory = mapControlFactory;
            _maxZoom           = 18;
            _tileSize          = 256;

            try
            {
                string p = Core.Settings.Default.SettingsFolder;
                if (!System.IO.Directory.Exists(p))
                {
                    System.IO.Directory.CreateDirectory(p);
                }
                p = System.IO.Path.Combine(new string[] { p, "MapCache" });
                if (!System.IO.Directory.Exists(p))
                {
                    System.IO.Directory.CreateDirectory(p);
                }

                if (string.IsNullOrEmpty(_mapControlFactory.ID))
                {
                    p = System.IO.Path.Combine(new string[] { p, "MapCache" });
                }
                else
                {
                    p = System.IO.Path.Combine(new string[] { p, _mapControlFactory.ID });
                }
                if (!System.IO.Directory.Exists(p))
                {
                    System.IO.Directory.CreateDirectory(p);
                }
                CacheFolder = p;
            }
            catch
            {
            }
        }
예제 #5
0
 /// <summary>Initializes a new instance of the TilePanel class.</summary>
 public TilePanel(MapControlFactory mapControlFactory)
 {
     _mapControlFactory = mapControlFactory;
     // This stops the Images from being blurry
     RenderOptions.SetBitmapScalingMode(this, BitmapScalingMode.NearestNeighbor);
 }
예제 #6
0
 public TileGeneratorOSM(MapControlFactory mapControlFactory)
     : base(mapControlFactory)
 {
     _maxZoom  = 18;
     _tileSize = 256;
 }