当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript tms_tile_source.TMSTileSource类代码示例

本文整理汇总了TypeScript中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:jsignell,项目名称: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:jsignell,项目名称: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:jsignell,项目名称:bokeh,代码行数:33,代码来源:tile_renderer.ts


注:本文中的models/tiles/tms_tile_source.TMSTileSource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。