當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript tms_tile_source.TMSTileSource類代碼示例

本文整理匯總了TypeScript中@bokehjs/models/tiles/tms_tile_source.TMSTileSource的典型用法代碼示例。如果您正苦於以下問題:TypeScript TMSTileSource類的具體用法?TypeScript TMSTileSource怎麽用?TypeScript TMSTileSource使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了TMSTileSource類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: TMSTileSource

    it.skip("should get tile urls by geographic extent", () => {
      const tile_options = {
        url: 'http://c.tile.openstreetmap.org/{Z}/{X}/{Y}.png',
      }

      const source = new TMSTileSource(tile_options)

      const extent: Extent = [-90.283741, 29.890626, -89.912952, 30.057766]
      const level = 11

      const expected_tiles = [
        'http://c.tile.openstreetmap.org/11/510/1201.png',
        'http://c.tile.openstreetmap.org/11/511/1201.png',
        'http://c.tile.openstreetmap.org/11/512/1201.png',
        'http://c.tile.openstreetmap.org/11/510/1202.png',
        'http://c.tile.openstreetmap.org/11/511/1202.png',
        'http://c.tile.openstreetmap.org/11/512/1202.png',
      ]

      const tiles = source.get_tiles_by_extent(extent, level)
      for (const [x, y, z] of tiles) {
        const url = source.get_image_url(x, y, z)
        expect(expected_tiles).to.contain(url)
      }
    })
開發者ID:digitalsatori,項目名稱:Bokeh,代碼行數:25,代碼來源:tile_renderer.ts

示例2: it

 it("should account of x_origin_offset and y_origin_offset", () => {
   const tile_options = {
     x_origin_offset: 0,
     y_origin_offset: 0,
   }
   const offset_source = new TMSTileSource(tile_options)
   const bounds = offset_source.get_tile_meter_bounds(0, 0, 16)
   expect(bounds).to.include(0)
 })
開發者ID:digitalsatori,項目名稱:Bokeh,代碼行數:9,代碼來源:tile_renderer.ts

示例3: describe

  describe("tms tile source", () => {
    const url = 'http://c.tiles.mapbox.com/v3/examples.map-szwdot65/{Z}/{X}/{Y}.png'
    const source = new TMSTileSource({url})

    it("should get tiles for extent correctly", () => {
      T.expect_mercator_tile_counts(source)
    })

    it("should successfully set x_origin_offset and y_origin_offset", () => {
      const tile_options = {
        x_origin_offset: 0,
        y_origin_offset: 0,
      }
      const offset_source = new TMSTileSource(tile_options)
      expect(offset_source.x_origin_offset).to.be.equal(0)
      expect(offset_source.y_origin_offset).to.be.equal(0)
    })

    it("should account of x_origin_offset and y_origin_offset", () => {
      const tile_options = {
        x_origin_offset: 0,
        y_origin_offset: 0,
      }
      const offset_source = new TMSTileSource(tile_options)
      const bounds = offset_source.get_tile_meter_bounds(0, 0, 16)
      expect(bounds).to.include(0)
    })

    it("should calculate resolution", () => {
      expect(source.get_resolution(1)).to.be.closeTo(78271.517, tol)
      expect(source.get_resolution(12)).to.be.closeTo(38.2185, tol)
    })
  })
開發者ID:digitalsatori,項目名稱:Bokeh,代碼行數:33,代碼來源:tile_renderer.ts


注:本文中的@bokehjs/models/tiles/tms_tile_source.TMSTileSource類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。