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. Unix编程艺术札记版本

    这本书是一位面试官告诉我,.非常感谢他的忠告.面试的说明.我写后认为,足.一方面是面试的技巧.另一方面就是学习的方法. 阅读这本书非常享受,加上之前的积累,一些疑惑,另一些基础的不足,在这本书里找 ...

  2. uva133 The Dole Queue ( 约瑟夫环的模拟)

    题目链接: 啊哈哈,选我选我 思路是: 相当于模拟约瑟夫环,仅仅只是是从顺逆时针同一时候进行的,然后就是顺逆时针走能够编写一个函数,仅仅只是是走的方向的标志变量相反..还有就是为了(pos+flag+ ...

  3. SNMP WINDOWS系统的命令行工具下载

    SNMP windows系统的命令行工具snmputil.exe下载链接:请点击

  4. 【新秀疯狂UML系列】——面向对象的技术

    从软质工作开始,我们来到与面向对象的接触,接下来的学习材料似乎已经提到了面向对象,在与她的朋友去一个.所以,我们必须知道她多一点点. 一.何为面向对象? 面向对象(Object Oriented).是 ...

  5. crm操作观点

    using System;     using Microsoft.Xrm.Sdk;     using Microsoft.Crm.Sdk.Messages; /// <summary> ...

  6. Eclipse4.4设备egit插件提交本地项目代码到远程仓库

    一.设备egit 打开Eclipse的Marketplace.在搜索框中输入egit就可以,能够看到Eclipse4.4已经默认安装了egit,当然假设有新版本号的egit公布的话,也能够在下图上点击 ...

  7. Oracle listener lsnrctl

    lsnrctl(Listener Control)是一家SQL*Net具,用于控制数据库listener,此工具提供了控制命令listener开端.停止,查看listener状态,更改listener ...

  8. XUtils骨架HttpUtils采用Get总是返回请求解决问题的相同信息

    如需转载请注明出处:http://blog.csdn.net/itas109 版本号:Xutils 2014年11月11日 下载地址:https://github.com/wyouflf/xUtils ...

  9. HTTP响应代码

    HTTP响应代码 1xx - 消息通知 这些状态代码表示临时响应.client在收到常规响应.应准备接收一个或多个 1xx 应. · 100 - Continue 初始的请求已经接受,客户应当继续发送 ...

  10. ProducerConsumerDemo

    package algorithm; public class ProducerConsumer { public static void main(String[] args) { SyncStac ...