Example #1
0
        public override tiles_output getTile(int zoomLevel, int column, int row)
        {
            tiles_output result = null;

            int currentZoomLevel = zoomLevel;

            try
            {
                maxzoom_output value   = getMaxZoom();
                int            maxZoom = value.value;

                if (zoomLevel > maxZoom)
                {
                    currentZoomLevel = maxZoom;
                }
            }
            catch (Exception)
            {
            }


            tiles til = db.Query <tiles>("SELECT * FROM tiles WHERE zoom_level = ? AND tile_column = ? AND tile_row = ?", currentZoomLevel, column, row).FirstOrDefault();

            if (til != null)
            {
                string data = ConstantMbTilePlugin.Base64EncodeByte(til.tile_data);
                result = new tiles_output(data);
            }
            return(result);
        }
 public maxzoom_output getMaxZoom()
 {
     maxzoom_output result = null;
     tiles zoom_max = db.Query<tiles>("SELECT * FROM tiles ORDER BY zoom_level DESC LIMIT 1").FirstOrDefault();
     if (zoom_max != null)
     {
         result = new maxzoom_output(zoom_max.zoom_level);
     }
     return result;
 }
Example #3
0
        public override maxzoom_output getMaxZoom()
        {
            maxzoom_output result   = null;
            tiles          zoom_max = db.Query <tiles>("SELECT * FROM tiles ORDER BY zoom_level DESC LIMIT 1").FirstOrDefault();

            if (zoom_max != null)
            {
                result = new maxzoom_output(zoom_max.zoom_level);
            }
            return(result);
        }
Example #4
0
        public override tiles_output getTile(int zoomLevel, int column, int row)
        {
            tiles_output result           = null;
            int          currentZoomLevel = zoomLevel;

            try
            {
                maxzoom_output max = getMaxZoom();
                if (max != null)
                {
                    int maxZoom = max.value;

                    if (zoomLevel > maxZoom)
                    {
                        currentZoomLevel = maxZoom;
                    }
                }
            }
            catch (Exception)
            {
            }

            try
            {
                JObject metadata = getMetadataObject();
                if (metadata != null)
                {
                    string name    = (string)metadata.GetValue(ConstantMbTilePlugin.KEY_NAME);
                    string version = (string)metadata.GetValue(ConstantMbTilePlugin.KEY_VERSION);
                    string format  = (string)metadata.GetValue(ConstantMbTilePlugin.KEY_FORMAT);
                    if (name != null && version != null && format != null)
                    {
                        /// get path of tiles
                        string tileFile = this.mapDirectory + "\\" + version + "\\" + name + "\\" +
                                          currentZoomLevel.ToString() + "\\" + column.ToString() + "\\" + row.ToString() + "." + format;
                        /// encode raw
                        string raw = readText(tileFile);
                        if (raw != null)
                        {
                            string data = ConstantMbTilePlugin.Base64Encode(raw);
                            result = new tiles_output(data);
                        }
                    }
                }
            }
            catch (Exception)
            {
            }

            return(result);
        }
        public maxzoom_output getMaxZoom()
        {
            maxzoom_output result = null;
            try
            {
                List<int> zoomLevels = getZoomLevels();

                if (zoomLevels.Count > 0)
                {
                    result = new maxzoom_output(zoomLevels.ElementAt(zoomLevels.Count - 1));
                }
            }
            catch (Exception)
            {
                // Add log
            }
            return result;
        }
Example #6
0
        public override maxzoom_output getMaxZoom()
        {
            maxzoom_output result = null;

            try
            {
                List <int> zoomLevels = getZoomLevels();

                if (zoomLevels.Count > 0)
                {
                    result = new maxzoom_output(zoomLevels.ElementAt(zoomLevels.Count - 1));
                }
            }
            catch (Exception)
            {
                // Add log
            }
            return(result);
        }