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 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); }