Пример #1
0
        /// <summary>
        /// Runs caching
        /// </summary>
        private void btnRunCaching_Click(object sender, EventArgs e)
        {
            string filename = Application.StartupPath + @"\TilesPrefetcher.exe";

            if (!File.Exists(filename))
            {
                MessageBox.Show("File is missing: " + filename);
            }
            else
            {
                AxMapWinGIS.AxMap map = mapWin.GetOCX as AxMapWinGIS.AxMap;
                Extents           ext = map.GeographicExtents;
                if (ext == null)
                {
                    MessageBox.Show("Geographic extents of the map aren't set.");
                }
                else
                {
                    double xMin, xMax, yMin, yMax, zMin, zMax;
                    ext.GetBounds(out xMin, out yMin, out zMin, out xMax, out yMax, out zMax);
                    String s = String.Format("{0} {1} {2} {3} {4} {5}", yMin, yMax, xMin, xMax, tiles.ProviderId, tiles.DiskCacheFilename);
                    Debug.Print(s);

                    ProcessStartInfo startInfo = new ProcessStartInfo();
                    startInfo.FileName  = filename;
                    startInfo.Arguments = s;
                    Process.Start(startInfo);
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Moves the envelope by the specified offset
        /// </summary>
        /// <param name="dx">The x offset.</param>
        /// <param name="dy">The y offset.</param>
        /// <returns>A new envelope</returns>
        public IEnvelope Move(double dx, double dy)
        {
            double xMin, xMax, yMin, yMax, zMin, zMax;

            _extents.GetBounds(out xMin, out yMin, out zMin, out xMax, out yMax, out zMax);
            return(new Envelope(xMin + dx, xMax + dx, yMin + dy, yMax + dy));
        }
Пример #3
0
        /// <summary>
        /// Updates number of tiles that already present in the database
        /// </summary>
        private void UpdateTileCount()
        {
            if (extents != null)
            {
                int provider = this.SelectedProvider;

                if (!this.MoveFirst())
                {
                    return;
                }

                do
                {
                    int     zoom = this.GetRowZoom();
                    Extents ext  = this.tiles.GetTilesIndices(this.extents, zoom, provider);

                    if (ext != null)
                    {
                        double xMin, xMax, yMin, yMax, zMin, zMax;
                        ext.GetBounds(out xMin, out yMin, out zMin, out xMax, out yMax, out zMax);
                        int count = tiles.get_DiskCacheCount(this.SelectedProvider, zoom, (int)xMin, (int)xMax, (int)yMin, (int)yMax);
                        this.SetRowCount(count);
                    }
                    else
                    {
                        this.SetRowCount(0);
                    }
                } while (this.MoveToNextRow());
            }
        }
Пример #4
0
 /// <summary>
 /// Creates a new instance of ChooseExtents form
 /// </summary>
 public ChooseExtents(Extents ext)
 {
     InitializeComponent();
     if (ext != null)
     {
         double xMin, xMax, yMin, yMax, zMin, zMax;
         ext.GetBounds(out xMin, out yMin, out zMin, out xMax, out yMax, out zMax);
         txtMinLat.Text = yMin.ToString();
         txtMaxLat.Text = yMax.ToString();
         txtMinLng.Text = xMin.ToString();
         txtMaxLng.Text = xMax.ToString();
     }
 }
Пример #5
0
        /// <summary>
        /// Displayes extents at the textbox
        /// </summary>
        /// <param name="ext"></param>
        private void SetExtents(Extents ext)
        {
            if (ext != null)
            {
                double xMin, xMax, yMin, yMax, zMin, zMax;
                ext.GetBounds(out xMin, out yMin, out zMin, out xMax, out yMax, out zMax);

                this.txtExtents.Text = string.Format("Lat: {0} to {1}; Lng: {2} to {3}",
                                                     yMin.ToString("0.000"),
                                                     yMax.ToString("0.000"),
                                                     xMin.ToString("0.000"),
                                                     xMax.ToString("0.000"));
                this.extents = ext;
            }
        }
Пример #6
0
        /// <summary>
        /// Fill listview with available scale for the provider
        /// </summary>
        private void FillListView()
        {
            this.listView1.Items.Clear();

            int provider = this.SelectedProvider;

            if (provider != -1)
            {
                int index   = tiles.Providers.get_IndexByProviderId(provider);
                int minZoom = tiles.Providers.get_minZoom(index);
                int maxZoom = tiles.Providers.get_maxZoom(index);

                if (this.extents != null)
                {
                    int number = 0;
                    for (int zoom = (int)minZoom; zoom <= maxZoom; zoom++)
                    {
                        Extents ext = tiles.GetTilesIndices(this.extents, zoom, provider);
                        if (ext != null)
                        {
                            double xMin, xMax, yMin, yMax, zMin, zMax;
                            ext.GetBounds(out xMin, out yMin, out zMin, out xMax, out yMax, out zMax);

                            int count = (int)((xMax - xMin + 1) * (yMax - yMin + 1));

                            if (count > 1)
                            {
                                ListViewItem item = this.listView1.Items.Add("");
                                item.Checked = false;
                                item.SubItems.Add(zoom.ToString());
                                item.SubItems.Add(count.ToString());
                                item.SubItems.Add("");      // number of tiles already in the database
                                item.SubItems.Add((count * 0.02).ToString("0.00"));
                                item.SubItems.Add("");
                            }
                            number = count;
                        }
                    }
                }
            }
        }