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. POJ3623:Best Cow Line, Gold(后缀数组)

    Description FJ is about to take his N (1 ≤ N ≤ 30,000) cows to the annual"Farmer of the Year&qu ...

  2. Linux下一个patch补丁命令

    此命令用于为特定软件包打补丁,他使用diff命令对源文件进行操作. 基本命令语法: patch [-R] {-p(n)} [--dry-run] < patch_file_name p:为pat ...

  3. CF(427D-Match &amp; Catch)后缀数组应用

    题意:给两个字符串,求一个最短的子串.使得这个子串在两个字符串中出现的次数都等于1.出现的定义为:能够重叠的出现. 解法:后缀数组的应用.从小枚举长度.假设一个长度len合法的话:则一定存在这个样的s ...

  4. 发展,需求驱动 &#183; 一间 所见即所得

    从需求不是一句空话.同样是在发展过程中真正的. 需求驱动,与极限编程的一些想法和测试驱动开发基本重合. 鉴于该网站的发展是一个比较流行的方向,我会从网站开始,阐述自己的"需求驱动的发展&qu ...

  5. window下自己主动备份数据库成dmp格式的bat写法

    复制以下的命令到一个txt文本文档,然后改动相应的參数为自己须要的參数,一切完毕之后,将文件保存为bat格式. 这样每次须要备份的时候仅仅须要双击一下这个bat文件.其它的都不用你了,你仅仅须要静静的 ...

  6. 全栈JavaScript之路(十七)HTML5 新增字符集属性

    HTML5 添加�了几个文档字符集属性. document.charset : 表示文档的实际使用的字符集. document.defaultCharset: 表示默认的字符集,跟浏览器以及操作系统设 ...

  7. hadoop得知;block数据块;mapreduce实现样例;UnsupportedClassVersionError变态;该项目的源代码相关联

    对于开源的东西.特别是刚出来不久.我认为最好的学习方法是能够看到源代码,doc,样品测试 为了方便查看源代码,导入与项目相关的源代码 watermark/2/text/aHR0cDovL2Jsb2cu ...

  8. iOS如何添加照片模拟器(附带诉讼)

    刚開始做图片选择时,使用了最笨的办法给iphone模拟器添加照片. 方法一:首先打开safari.然后找到图片.点击图片,保存到本地(iphone): 方法二:拖动本地计算机的随意一张照片到iphon ...

  9. Mysql 5.6 新特性

    随笔,真的随笔,以后理解得更深了再修改.   Index Condition Pushdown 更多的让存储引擎去处理Where语句中的条款,避免返回无关字段数据等:   Multi-Range Re ...

  10. Android有关JNI 学习(两)为JNI方法名称,数据类型和方法签名的一些知识

    我们知道,使用javah产生c/c++当在头文件,将java定义 native 功能,以产生相应jni层功能,如下面: /* * Class: com_lms_jni_JniTest * Method ...