Beispiel #1
0
        public TileGenerator(MapControlFactory mapControlFactory)
        {
            _mapControlFactory = mapControlFactory;
            _maxZoom = 18;
            _tileSize = 256;

            try
            {
                string p = mapControlFactory.Core.PluginDataPath;
                if (!System.IO.Directory.Exists(p))
                {
                    System.IO.Directory.CreateDirectory(p);
                }
                if (string.IsNullOrEmpty(_mapControlFactory.ID))
                {
                    p = System.IO.Path.Combine(new string[] { p, "OSMOnlineCache" });
                }
                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
            {
            }

        }
Beispiel #2
0
        public TileGenerator(MapControlFactory mapControlFactory)
        {
            _mapControlFactory = mapControlFactory;
            _maxZoom           = 18;
            _tileSize          = 256;

            try
            {
                string p = mapControlFactory.Core.PluginDataPath;
                if (!System.IO.Directory.Exists(p))
                {
                    System.IO.Directory.CreateDirectory(p);
                }
                if (string.IsNullOrEmpty(_mapControlFactory.ID))
                {
                    p = System.IO.Path.Combine(new string[] { p, "OSMOnlineCache" });
                }
                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
            {
            }
        }
Beispiel #3
0
 /// <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();
 }
Beispiel #4
0
 /// <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();
 }
Beispiel #5
0
        public MapForm(Framework.Interfaces.ICore core, string title)
        {
            InitializeComponent();

            STR_TITLE = title;
            _core = core;
            _core.ActiveGeocacheChanged += new Framework.EventArguments.GeocacheEventHandler(_core_ActiveGeocacheChanged);
            _core.SelectedLanguageChanged += new EventHandler(_core_SelectedLanguageChanged);
            _core.Geocaches.SelectedChanged += new Framework.EventArguments.GeocacheEventHandler(Geocaches_SelectedChanged);
            _core.Geocaches.ListSelectionChanged += new EventHandler(Geocaches_ListSelectionChanged);
            _core.Geocaches.DataChanged += new Framework.EventArguments.GeocacheEventHandler(Geocaches_DataChanged);
            _core.Geocaches.GeocacheAdded += new Framework.EventArguments.GeocacheEventHandler(Geocaches_GeocacheAdded);
            _core.Geocaches.GeocacheRemoved += new Framework.EventArguments.GeocacheEventHandler(Geocaches_GeocacheRemoved);
            _core.Geocaches.ListDataChanged += new EventHandler(Geocaches_ListDataChanged);
            _core.GPSLocation.Updated += new Framework.EventArguments.GPSLocationEventHandler(GPSLocation_Updated);
            _core.Waypoints.DataChanged += new Framework.EventArguments.WaypointEventHandler(Waypoints_DataChanged);
            _core.Waypoints.ListDataChanged += new EventHandler(Waypoints_ListDataChanged);

            _core_SelectedLanguageChanged(this, EventArgs.Empty);
            this.mapContainerControl1.tileCanvas.ZoomChanged += new EventHandler<EventArgs>(tileCanvas_ZoomChanged);
            this.mapContainerControl1.GeocacheClick += new Framework.EventArguments.GeocacheEventHandler(mapContainerControl1_GeocacheClick);

            /*
            if (Properties.Settings.Default.WindowPos != null && !Properties.Settings.Default.WindowPos.IsEmpty)
            {
                this.Bounds = Properties.Settings.Default.WindowPos;
                this.StartPosition = FormStartPosition.Manual;
            }
            */
            _mapControlFactory = MapControl.MapCanvas.MapControlFactoryToUse;
            if (_mapControlFactory != null)
            {
                if (Properties.Settings.Default.SpecifiedWindowPos != null)
                {
                    for (int i = 0; i < Properties.Settings.Default.SpecifiedWindowPos.Count; i++)
                    {
                        if (Properties.Settings.Default.SpecifiedWindowPos[i].StartsWith(string.Concat(_mapControlFactory.ID, "|")))
                        {
                            try
                            {
                                string[] parts = Properties.Settings.Default.SpecifiedWindowPos[i].Split(new char[] { '|' });
                                this.Bounds = new Rectangle(int.Parse(parts[1]), int.Parse(parts[2]), int.Parse(parts[3]), int.Parse(parts[4]));
                                this.StartPosition = FormStartPosition.Manual;
                                break;
                            }
                            catch
                            {
                            }
                        }
                    }
                }
                else
                {
                    Properties.Settings.Default.SpecifiedWindowPos = new System.Collections.Specialized.StringCollection();
                }
            }
        }
Beispiel #6
0
 /// <summary>Initializes a new instance of the SearchControl class.</summary>
 public SearchControl()
 {
     this.InitializeComponent();
     _mapControlFactory = MapControl.MapCanvas.MapControlFactoryToUse;
     if (_mapControlFactory != null)
     {
         _provider = _mapControlFactory.SearchProvider;
         _provider.SearchCompleted += this.OnSearchCompleted;
         _provider.SearchError += this.OnSearchError;
     }
 }
 /// <summary>Initializes a new instance of the SearchControl class.</summary>
 public SearchControl()
 {
     this.InitializeComponent();
     _mapControlFactory = MapControl.MapCanvas.MapControlFactoryToUse;
     if (_mapControlFactory != null)
     {
         _provider = _mapControlFactory.SearchProvider;
         _provider.SearchCompleted += this.OnSearchCompleted;
         _provider.SearchError     += this.OnSearchError;
     }
 }
Beispiel #8
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
        }
Beispiel #9
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
        }
Beispiel #10
0
        public MapForm(Framework.Interfaces.ICore core, string title)
        {
            InitializeComponent();

            STR_TITLE = title;
            _core     = core;
            _core.ActiveGeocacheChanged          += new Framework.EventArguments.GeocacheEventHandler(_core_ActiveGeocacheChanged);
            _core.SelectedLanguageChanged        += new EventHandler(_core_SelectedLanguageChanged);
            _core.Geocaches.SelectedChanged      += new Framework.EventArguments.GeocacheEventHandler(Geocaches_SelectedChanged);
            _core.Geocaches.ListSelectionChanged += new EventHandler(Geocaches_ListSelectionChanged);
            _core.Geocaches.DataChanged          += new Framework.EventArguments.GeocacheEventHandler(Geocaches_DataChanged);
            _core.Geocaches.GeocacheAdded        += new Framework.EventArguments.GeocacheEventHandler(Geocaches_GeocacheAdded);
            _core.Geocaches.GeocacheRemoved      += new Framework.EventArguments.GeocacheEventHandler(Geocaches_GeocacheRemoved);
            _core.Geocaches.ListDataChanged      += new EventHandler(Geocaches_ListDataChanged);
            _core.GPSLocation.Updated            += new Framework.EventArguments.GPSLocationEventHandler(GPSLocation_Updated);
            _core.Waypoints.DataChanged          += new Framework.EventArguments.WaypointEventHandler(Waypoints_DataChanged);
            _core.Waypoints.ListDataChanged      += new EventHandler(Waypoints_ListDataChanged);

            _core_SelectedLanguageChanged(this, EventArgs.Empty);
            this.mapContainerControl1.tileCanvas.ZoomChanged += new EventHandler <EventArgs>(tileCanvas_ZoomChanged);
            this.mapContainerControl1.GeocacheClick          += new Framework.EventArguments.GeocacheEventHandler(mapContainerControl1_GeocacheClick);

            /*
             * if (PluginSettings.Instance.WindowPos != null && !PluginSettings.Instance.WindowPos.IsEmpty)
             * {
             *  this.Bounds = PluginSettings.Instance.WindowPos;
             *  this.StartPosition = FormStartPosition.Manual;
             * }
             */
            _mapControlFactory = MapControl.MapCanvas.MapControlFactoryToUse;
            if (_mapControlFactory != null)
            {
                for (int i = 0; i < PluginSettings.Instance.SpecifiedWindowPos.Count; i++)
                {
                    if (PluginSettings.Instance.SpecifiedWindowPos[i].StartsWith(string.Concat(_mapControlFactory.ID, "|")))
                    {
                        try
                        {
                            string[] parts = PluginSettings.Instance.SpecifiedWindowPos[i].Split(new char[] { '|' });
                            this.Bounds        = new Rectangle(int.Parse(parts[1]), int.Parse(parts[2]), int.Parse(parts[3]), int.Parse(parts[4]));
                            this.StartPosition = FormStartPosition.Manual;
                            break;
                        }
                        catch
                        {
                        }
                    }
                }
            }
        }
        public MapContainerControl()
        {
            _mapControlFactory = MapControl.MapCanvas.MapControlFactoryToUse;

            if (_mapControlFactory != null)
            {
                _mapControlFactory.TileGenerator.DownloadCountChanged += this.OnDownloadCountChanged;
                _mapControlFactory.TileGenerator.DownloadError += this.OnDownloadError;
            }
            this.InitializeComponent();
            CommandManager.AddPreviewExecutedHandler(this, this.PreviewExecuteCommand); // We're going to do some effects when zooming.
            if (_mapControlFactory != null && _mapControlFactory.ID == "GoogleCache")
            {
                creditsinfo.Visibility = System.Windows.Visibility.Hidden;
            }
        }
        public MapContainerControl()
        {
            _mapControlFactory = MapControl.MapCanvas.MapControlFactoryToUse;

            if (_mapControlFactory != null)
            {
                _mapControlFactory.TileGenerator.DownloadCountChanged += this.OnDownloadCountChanged;
                _mapControlFactory.TileGenerator.DownloadError        += this.OnDownloadError;
            }
            this.InitializeComponent();
            CommandManager.AddPreviewExecutedHandler(this, this.PreviewExecuteCommand); // We're going to do some effects when zooming.
            if (_mapControlFactory != null && _mapControlFactory.ID == "GoogleCache")
            {
                creditsinfo.Visibility = System.Windows.Visibility.Hidden;
            }
        }
Beispiel #13
0
 public MapCanvas()
 {
     _mapControlFactory = 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;
 }
Beispiel #14
0
 public MapCanvas()
 {
     _mapControlFactory = 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;
 }
Beispiel #15
0
 public TileGeneratorOSM(MapControlFactory mapControlFactory)
     : base(mapControlFactory)
 {
     _maxZoom  = 18;
     _tileSize = 256;
 }
Beispiel #16
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);
 }
Beispiel #17
0
 public TileGeneratorGoogle(MapControlFactory mapControlFactory)
     : base(mapControlFactory)
 {
     _maxZoom = 18;
     _tileSize = 256;
 }
Beispiel #18
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);
 }