Documentation ¶
Index ¶
- Variables
- func GenericBoundsFromTiles(t TileMapper, a Tile, b Tile, rightbottom LatLon) (LatLon, LatLon)
- func GenericTilesFromBounds(t TileMapper, a LatLon, b LatLon, maxWidth uint, maxHeight uint, tileSize uint, ...) (Tile, Tile)
- func SwapIfNeeded(a Tile, b Tile) (Tile, Tile)
- type AdvancedTileProvider
- type CompositingTileProvider
- type FallbackTileCache
- type FallbackTileProvider
- type LatLon
- type OSMTileMapper
- type OSMTileProvider
- type StreamingTileCache
- type StreamingTileProvider
- type TestTileProvider
- type Tile
- type TileCache
- type TileImage
- type TileMapper
- type TileProvider
- type TileRenderModel
Constants ¶
This section is empty.
Variables ¶
var OSM = OSMTileMapper{256}
Functions ¶
func GenericBoundsFromTiles ¶
GenericBoundsFromTiles returns the lat/lon pairs that encompass a set of tiles
func GenericTilesFromBounds ¶
func GenericTilesFromBounds(t TileMapper, a LatLon, b LatLon, maxWidth uint, maxHeight uint, tileSize uint, maxZoomLevel uint) (Tile, Tile)
A generic, mechanical method for determining a proper zoom level and set of tiles for a given image dimension and coordinate range by iteration, such that the image resulting from rendering the given tiles and cutting to the specified lat and lon will be smaller in both dimensions than the maxWidth and maxHeight given
Types ¶
type AdvancedTileProvider ¶
type AdvancedTileProvider interface { TileProvider RenderTileRange(a Tile, b Tile) []TileImage }
type CompositingTileProvider ¶
type CompositingTileProvider struct {
// contains filtered or unexported fields
}
func NewCompositingTileProvider ¶
func NewCompositingTileProvider(providers ...TileProvider) *CompositingTileProvider
func (*CompositingTileProvider) RenderTile ¶
func (c *CompositingTileProvider) RenderTile(t Tile) image.Image
type FallbackTileCache ¶
type FallbackTileCache struct { TileCache // contains filtered or unexported fields }
FallbackTileCache provides a fixed size LRU cache, similar to TileCache, but takes two TileProviders, a primary and a fallback. The fallback should be one that renders instantly. The primary can be a slower render that takes as long as needed. RenderTileRange renders exclusively from cached images from the primary tile provider and fills uncached spaces with fallback renderings that are never cached. A separate goroutine renders the primary tiles into the cache from a queue.
func NewFallbackTileCache ¶
func NewFallbackTileCache(provider TileProvider, fallbackProvider TileProvider, maxItems uint) *FallbackTileCache
func (*FallbackTileCache) GoRender ¶
func (c *FallbackTileCache) GoRender()
GoRender is called by NewFallbackTileCache and renders tiles from the request queue and stores them in the cache
func (*FallbackTileCache) RenderTile ¶
func (c *FallbackTileCache) RenderTile(t Tile) image.Image
RenderTile returns an image from Cache, or if not found requests it from the TileProvider and returns it
func (*FallbackTileCache) RenderTileRange ¶
func (c *FallbackTileCache) RenderTileRange(a Tile, b Tile) []TileImage
Renders all tiles in the requested range and returns them This returns TileImages instead of merely images because the items are returned in an indeterminate order use the Tile to determine their position. a and b should be on the same zoom level
func (*FallbackTileCache) UsedFallback ¶
func (c *FallbackTileCache) UsedFallback() bool
type FallbackTileProvider ¶
type FallbackTileProvider interface { AdvancedTileProvider UsedFallback() bool }
type OSMTileMapper ¶
type OSMTileMapper struct {
TileSize uint
}
func (OSMTileMapper) BoundsFromTiles ¶
func (o OSMTileMapper) BoundsFromTiles(a Tile, b Tile) (LatLon, LatLon)
func (OSMTileMapper) LatLon ¶
func (o OSMTileMapper) LatLon(t Tile) LatLon
Calculates the lat/lon of the upper-left point of the given OSM Tile
func (OSMTileMapper) Tile ¶
func (o OSMTileMapper) Tile(l LatLon, zoomLevel uint) Tile
Calculates the appropriate OSM Tile position that, at the given zoomLevel, contains the given lat/lon.
func (OSMTileMapper) TilesFromBounds ¶
type OSMTileProvider ¶
type OSMTileProvider struct { ServerURL string // contains filtered or unexported fields }
func NewOSMTileProvider ¶
func NewOSMTileProvider(ServerURL string) *OSMTileProvider
func (*OSMTileProvider) RenderTile ¶
func (o *OSMTileProvider) RenderTile(t Tile) image.Image
type StreamingTileCache ¶
type StreamingTileCache struct {
TileCache
}
StreamingTileCache just wraps the TileCache and implements the StreamingTileProvider interface, which return a channel and sends Tiles down it as they are rendered instead of waiting for a complete tile set.
func NewStreamingTileCache ¶
func NewStreamingTileCache(provider TileProvider, maxItems uint) *StreamingTileCache
func (*StreamingTileCache) StreamTileRange ¶
func (c *StreamingTileCache) StreamTileRange(a Tile, b Tile) chan TileImage
Renders all tiles in the requested range and returns them This returns TileImages instead of merely images because the items are returned in an indeterminate order use the Tile to determine their position. a and b should be on the same zoom level
type StreamingTileProvider ¶
type StreamingTileProvider interface { TileProvider StreamTileRange(a Tile, b Tile) chan TileImage }
type TestTileProvider ¶
func NewTestTileProvider ¶
func NewTestTileProvider(width, height int) *TestTileProvider
func (*TestTileProvider) RenderTile ¶
func (p *TestTileProvider) RenderTile(t Tile) image.Image
type TileCache ¶
type TileCache struct {
// contains filtered or unexported fields
}
TileCache provides a fixed size LRU cache for Tiles that calls a supplied TileProvider when necessary, and handles maintaining the cache, freshening accessed tiles and expiring the Least Recently Used tiles as necessary.
func NewTileCache ¶
func NewTileCache(provider TileProvider, maxItems uint) *TileCache
func (*TileCache) RenderTile ¶
RenderTile returns an image from Cache, or if not found requests it from the TileProvider and returns it
func (*TileCache) RenderTileRange ¶
Renders all tiles in the requested range and returns them This returns TileImages instead of merely images because the items are returned in an indeterminate order use the Tile to determine their position. a and b should be on the same zoom level
type TileImage ¶
TileImage is a simple struct returned by Advanced and Streaming Tile Providers that wraps a Tile and an Image together since these methods return more than one tile. The populated flag allows identification of zero value structs.
type TileMapper ¶
type TileProvider ¶
type TileRenderModel ¶
type TileRenderModel struct { rv.EmptyRenderModel RequestRender chan interface{} Rendering bool NeedsRender bool Img image.Image // contains filtered or unexported fields }
func NewTileRenderModel ¶
func NewTileRenderModel(mapper TileMapper, provider TileProvider, leftTop LatLon, bottomRight LatLon) *TileRenderModel
func (*TileRenderModel) GoRender ¶
func (m *TileRenderModel) GoRender()
func (*TileRenderModel) InnerRender ¶
func (m *TileRenderModel) InnerRender()
func (*TileRenderModel) Render ¶
func (m *TileRenderModel) Render() image.Image
func (*TileRenderModel) Start ¶
func (m *TileRenderModel) Start()