require(["esri/layers/TiledMapServiceLayer"], function () {





    dojo.declare("com.StrongIt.Map.Layers.LayerTianditu", esri.layers.TiledMapServiceLayer, {

        _mapStyle: "",

        constructor: function (mapStyle, startLevel, endLevel) {

            this._mapStyle = mapStyle;

            this.spatialReference = new esri.SpatialReference({

                wkid: 4326

            });

            this.initialExtent = new esri.geometry.Extent(73.5, 4, 135, 53.5, this.spatialReference);

            this.fullExtent = new esri.geometry.Extent(-180.0, -90.0, 180.0, 90.0, this.spatialReference);

            this.tileInfo = new esri.layers.TileInfo({

                "dpi": "90.71428571427429",

                "format": "image/png",

                "compressionQuality": 0,

                "rows": 256,

                "cols": 256,

                "compressionQuality": 0,

                "origin": {

                    "x": -180,

                    "y": 90

                },

                "spatialReference": {

                    "wkid": 4326

                },

                "lods": this._getLods(startLevel, endLevel)

            });





            this.loaded = true;

            this.onLoad(this);

        },





        getTileUrl: function (level, row, col) {

                var serviceNum = col % 8;

                var mapInfo = this._getMapInfo();

                return "http://t"

                    + serviceNum

                    + ".tianditu.com/DataServer?

T=" + mapInfo.mapName + "&" +

                    "X=" + col + "&" +

                    "Y=" + row + "&" +

                    "L=" + level;

        },





        _getLods: function (startLevel, endLevel) {

            var lods = [];





            var minScale = 590995186.1175;

            var maxResolution = 1.40625;

            

            var tempScale = minScale;

            var tempResolution = maxResolution;

            for (var i = 0; i <= endLevel; i++) {

                

                var lod = {

                    "level": i,

                    "resolution": tempResolution,

                    "scale": tempScale

                }

                if (i >= startLevel) {

                    lods.push(lod);

                }





                tempScale = tempScale / 2;

                tempResolution = tempResolution / 2;

            }





            return lods;

        },





        _getMapInfo: function () {

            var result = {

                mapName: "",

                layerId: "",

                tileMatrixSetId: ""

            };

            if(this._mapStyle == "ImageBaseMap") {

                // 获取影像(底图)

                result.mapName = "img_c";

                result.layerId = "img";

                result.tileMatrixSetId = "c";

            } else if(this._mapStyle == "ImageCNNote") {

                // 获取影像(中文注记)

                result.mapName = "cia_c";

                result.layerId = "cia";

                result.tileMatrixSetId = "c";

            } else if(this._mapStyle == "ImageENNote") {

                // 获取影像(英文注记)

                result.mapName = "eia_c";

                result.layerId = "eia";

                result.tileMatrixSetId = "c";

            } else if(this._mapStyle == "TerrainBaseMap") {

                // 获取地形图(底图)

                result.mapName = "ter_c";

                result.layerId = "ter";

                result.tileMatrixSetId = "c";

            } else if(this._mapStyle == "TerrainCNNote") {

                // 获取地形图(中文注记)

                result.mapName = "cta_c";

                result.layerId = "cta";

                result.tileMatrixSetId = "c";

            } else if(this._mapStyle == "TerrainENNote") {

                // 获取地形图(英文注记)

            } else if(this._mapStyle == "VectorBaseMap") {

                // 获取地图(底图)

                result.mapName = "vec_c";

                result.layerId = "vec";

                result.tileMatrixSetId = "c";

            } else if(this._mapStyle == "VectorCNNote") {

                // 获取地图(中文注记)

                result.mapName = "cva_c";

                result.layerId = "cva";

                result.tileMatrixSetId = "c";

            } else if(this._mapStyle == "VectorENNote") {

                // 获取地图(英文注记)

                result.mapName = "eva_c";

                result.layerId = "eva";

                result.tileMatrixSetId = "c";

            }





            return result;

        }

    });





});

版权声明:本文博主原创文章。博客,未经同意不得转载。

重写ArcGIS的TiledMapServiceLayer呼叫世界地图图块的更多相关文章

  1. 重写ArcGIS的TiledMapServiceLayer调用天地图瓦片

    require(["esri/layers/TiledMapServiceLayer"], function () { dojo.declare("com.StrongI ...

  2. Windows phone 8 学习笔记(5) 图块与通知(转)

    基于metro风格的Windows phone 8 应用提到了图块的概念,它就是指启动菜单中的快速启动图标.一般一个应用必须有一个默认图块,还可以有若干个次要图块.另外,通知与图块的关系比较密切,我们 ...

  3. C#实现在CAD图纸中插入另一个DWG图块的代码

    C#实现在CAD图纸中插入另一个DWG图块的代码 PromptPointResult ppr = ed.GetPoint("请选择插入点:"); Point3d pt = ppr. ...

  4. Windows phone 8 学习笔记(5) 图块与通知

    原文:Windows phone 8 学习笔记(5) 图块与通知 基于metro风格的Windows phone 8 应用提到了图块的概念,它就是指启动菜单中的快速启动图标.一般一个应用必须有一个默认 ...

  5. Tiled Editor 图块的两种导入方式

    一.图块集图块的导入. 打开或者创建地图后,新建 新图块. 弹出新图块面板 图块类型选择 "基于图块集图块",一定要选择"嵌入地图",否则需要另存为其他类型的文 ...

  6. 小记——关于Tilemap图块索引编码

    图集 地图 TileMap 导出的 .Tmx 文件记录了地图所有信息,其中编辑好的图块信息会存放在每个图层的 Data 节点下.以下是一个 10x10 的图层,可以看到,Data 节点记录了每个图块对 ...

  7. 梦想CAD控件图块COM接口知识点

    梦想CAD控件图块COM接口知识点 图块是将多个实体组合成一个整体,并给这个整体命名保存,在以后的图形编辑中图块就被视为一个实体.一个图块包括可见的实体如线.圆.圆弧以及可见或不可见的属性数据.图块的 ...

  8. CAD插入图块前修改图块文字

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 3 ...

  9. CAD插入非等比例的图块

    主要用到函数说明: _DMxDrawX::InsertBlock 向控件数据库中插入一个图块,不用它插入匿名块.详细说明如下: 参数 说明 BSTR pszDwgFileName 图块定义的dwg 文 ...

随机推荐

  1. 在borland c++ builder 中使用 google test (gtest)

    google test version: 1.6 c++ builder version: xe6 1 download google test 1.6 2 unzip the zip file. T ...

  2. openGL研究钞四 : 关于颜色, 尺寸, 虚线, 多边形逆转, 空洞, 使用位图

    转载请保留源,,,,hushuai1992http://blog.csdn.net/u013642494/article/category/2675731 额. 这个标题我都不知道该怎么起了. 假设没 ...

  3. 经excel要将数据库(ORACLE)要插入数据

    大家都知道PL/SQL可以excel数据复制.我们也可以通过相同excel将数据插入到数据库. 下面我们就来简单的样品,并与主题演示 首先,我们创建了一个表test CREATE TABLE test ...

  4. How to install PL/SQL developer on linux (转)

    PL/SQL developer 在linux上的安装方法工欲善其事必先利其器,PL/SQL和toad对于ORACLE从业人员来说都是很重要的工具,但这些工具都没有linux的发行版,如果要在linu ...

  5. 《TCP/IP详细解释》札记(23章)-TCP该保活定时器

    可能有这样的备用现实TCP连接:流通过. 也就是说.假设TCP连接的两方都没有向对方发送数据.则在两个TCP模块之间不交换不论什么信息,这意味着我们能够启动一个客户与server建立连接,然后长时间不 ...

  6. 开源通讯组件ec

    跨平台开源通讯组件elastic communication elastic communication是基于c#开发支持.net和mono的通讯组件(简称EC),EC的主要目的简化mono和.net ...

  7. 文件搜索神器everything 你不知道的技巧总结

    everything这个软件用了很久,总结了一些大家可能没注意到的技巧,分享给大家 1.指定文件目录搜索示例: TDDOWNLOAD\ abc        在所有TDDOWNLOAD文件夹下搜索包含 ...

  8. 学习swift语言的快速入门教程推荐

    随着苹果产品越来越火爆,苹果新推出的swift必定将在很大程度上代替oc语言.学好swift语言,对于IOS工程师来讲,已经是一门必备技能. 有一些比较好的英文版教程,值得学习. 1. Swift T ...

  9. 算法 《霍纳的方法java实践》

    [历史背景] 霍纳的方法是中国南宋时期的数学家秦九韶表述求解一元高次多项式的值的算法--正负开方术. 它也能够配合牛顿法用来求解一元高次多项式的根.在西方被称作霍纳算法(Horner algorith ...

  10. combobox自己主动提示组件加入无选中项清空功能

    这个标题非常绕口,只是这也是想了半天的成果,对不起体育老师了. 标题想表达的是:之前讲过的用combobox实现自己主动提示组件.只是如今规定该组件不能够保存data中不存在的数据. 最初的想法是通过 ...