zengh
2022-05-16 63ad2c3598400370dd7da5534659fd7e768a0a4a
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
/**
 * 市级图层按钮
 * @author liuyl 2016-3-8
 **/
define([
    "base/AppEvent",
    "dojo",
    "dojo/_base/declare",
    "dojo/_base/lang",
    "controls/toolbar/tools/BaseTool",
    "dojo/dom-style", "dojo/dom-attr",
    "utils/LayerUtil"
], function(
    AppEvent,
    dojo,
    declare,
    lang,
    BaseTool,
    domStyle, domAttr,
    LayerUtil
) {
    var RL = declare([BaseTool], {
        layers: {
            "沈阳市": [{
                'url': 'http://59.46.43.131/Sydlg/wmts',
                'type': 'tianditu',
                "layer": "SYDLG",
                'displaylevels': [17, 18, 19],
                "FORMAT": "image/tile",
                "TILEMATRIXSET": "Matrix_0"
            }, {
                'url': 'http://59.46.43.131/SydlgLabel/wmts',
                'type': 'tianditu',
                "layer": "SYDLGLabel",
                'displaylevels': [17, 18, 19],
                "FORMAT": "image/tile",
                "TILEMATRIXSET": "Matrix_0"
            }],
            "大连市": [{
                'url': 'http://tianditu.dl.gov.cn/servicemanager/tdtproxy/1061?service=WMTS',
                'type': 'tianditu',
                "layer": "DLMAP",
                'displaylevels': [17, 18, 19],
                "FORMAT": "image/png",
                "TILEMATRIXSET": "CustomCRS4326ScaleDLMAP"
            }, {
                'url': 'http://tianditu.dl.gov.cn/servicemanager/tdtproxy/1063?service=WMTS',
                'type': 'tianditu',
                "layer": "DLAnnoLayer",
                'displaylevels': [17, 18, 19],
                "FORMAT": "image/png",
                "TILEMATRIXSET": "CustomCRS4326ScaleDLAnnoLayer"
            }],
            "鞍山市": [{
                'url': 'http://services.anshanmap.gov.cn/ASDLG/wmts',
                'type': 'tianditu',
                "layer": "ASDLG",
                'displaylevels': [17, 18, 19],
                "FORMAT": "image/tile",
                "TILEMATRIXSET": "Matrix_0"
            }, {
                'url': 'http://services.anshanmap.gov.cn/ASDLGLabel/wmts',
                'type': 'tianditu',
                "layer": "ASDLGLabel",
                'displaylevels': [17, 18, 19],
                "FORMAT": "image/tile",
                "TILEMATRIXSET": "Matrix_0"
            }],
            //"抚顺市":[],
            "本溪市": [{
                'url': 'http://202.97.173.78:8719/newmap/ogc/tianditu/vecmap/wmts',
                'type': 'tianditu',
                "layer": "vecmap",
                'displaylevels': [17, 18, 19],
                "FORMAT": "image/png",
                "TILEMATRIXSET": "TileMatrixSet_0"
            }, {
                'url': 'http://202.97.173.78:8719/newmap/ogc/tianditu/vecAnno/wmts',
                'type': 'tianditu',
                "layer": "vecAnno",
                'displaylevels': [17, 18, 19],
                "FORMAT": "image/png",
                "TILEMATRIXSET": "TileMatrixSet_0"
            }],
            "丹东市": [{
                'url': 'http://60.21.132.250/WMTS/kvp/services/tdt_vec/MapServer/TDTWMTSServer?SERVICE=WMTS',
                'type': 'tianditu',
                "layer": "tdt_vec",
                'displaylevels': [17, 18, 19],
                "FORMAT": "image/mixed",
                "TILEMATRIXSET": "tdt_vec"
            }, {
                'url': 'http://60.21.132.250/WMTS/kvp/services/tdt_vec_zj/MapServer/TDTWMTSServer?SERVICE=WMTS',
                'type': 'tianditu',
                "layer": "tdt_vec_zj",
                'displaylevels': [17, 18, 19],
                "FORMAT": "image/mixed",
                "TILEMATRIXSET": "tdt_vec_zj"
            }],
            "锦州市": [{
                'url': 'http://60.21.221.227:8080/WMTS/kvp/services/TDTHXL18_L20/MapServer/TDTWMTSServer?SERVICE=WMTS',
                'type': 'tianditu',
                "layer": "TDTHXL18_L20",
                'displaylevels': [17, 18, 19],
                "FORMAT": "image/mixed",
                "TILEMATRIXSET": "TDTHXL18_L20"
            }, {
                'url': 'http://60.21.221.227:8080/WMTS/kvp/services/TDTZJL18_L20/MapServer/TDTWMTSServer?SERVICE=WMTS',
                'type': 'tianditu',
                "layer": "TDTZJL18_L20",
                'displaylevels': [17, 18, 19],
                "FORMAT": "image/mixed",
                "TILEMATRIXSET": "TDTZJL18_L20"
            }],
            //"营口市":[],
            //"辽阳市": [],//节点服务器无法访问
            "盘锦市": [{
                'url': 'http://218.61.30.156/WMTS/kvp/services/PJ_dlg/MapServer/TDTWMTSServer?SERVICE=WMTS',
                'type': 'tianditu',
                "layer": "PJ_dlg",
                'displaylevels': [17, 18, 19],
                "FORMAT": "image/mixed",
                "TILEMATRIXSET": "PJ_dlg"
            }, {
                'url': 'http://218.61.30.156/WMTS/kvp/services/PJ_dlgzj/MapServer/TDTWMTSServer?SERVICE=WMTS',
                'type': 'tianditu',
                "layer": "PJ_dlgzj",
                'displaylevels': [17, 18, 19],
                "FORMAT": "image/mixed",
                "TILEMATRIXSET": "PJ_dlgzj"
            }],
            //矢量注记服务瓦片损坏
            //            "铁岭市": [{
            //                'url': 'http://www.lnditu.gov.cn/WMTS/kvp/services/TlMap_VEC_201512/MapServer/TDTWMTSServer?SERVICE=WMTS',
            //                'type': 'tianditu',
            //                "layer": "TlMap_VEC_201512",
            //                'displaylevels': [17,18,19],
            //                "FORMAT":"image/mixed",
            //                "TILEMATRIXSET":"TlMap_VEC_201512"
            //            },{
            //                'url': 'http://www.lnditu.gov.cn/WMTS/kvp/services/TlMap_VEC_Anno_201512/MapServer/TDTWMTSServer?SERVICE=WMTS',
            //                'type': 'tianditu',
            //                "layer": "TlMap_VEC_Anno_201512",
            //                'displaylevels': [17,18,19],
            //                "FORMAT":"image/mixed",
            //                "TILEMATRIXSET":"TlMap_VEC_Anno_201512"
            //            }],
            "铁岭市": [{
                'url': 'http://61.161.226.70:6080/arcgis/rest/services/TL_VEC_2015/MapServer',
                'type': 'arcgis tiled',
                'displaylevels': [17, 18, 19]
            }],
            //"朝阳市":[],
            "葫芦岛市": [{
                'url': 'http://175.150.65.19/WMTS/kvp/services/HLD_SLDT/MapServer/TDTWMTSServer?SERVICE=WMTS',
                'type': 'tianditu',
                "layer": "HLD_SLDT",
                'displaylevels': [17, 18, 19],
                "FORMAT": "image/mixed",
                "TILEMATRIXSET": "HLD_SLDT"
            }, {
                'url': 'http://175.150.65.19/WMTS/kvp/services/HLD_SLZJ/MapServer/TDTWMTSServer?SERVICE=WMTS',
                'type': 'tianditu',
                "layer": "HLD_SLZJ",
                'displaylevels': [17, 18, 19],
                "FORMAT": "image/mixed",
                "TILEMATRIXSET": "HLD_SLZJ"
            }],
        },
        constructor: function(args) {
            this.tooltip = "市级服务";
            this.disableTooltip = "此地区或级别没有市级服务";
            this._normalIconClass = "tool-citylayer-normal";
            this._overIconClass = "tool-citylayer-over";
            this._selectedIconClass = "tool-citylayer-select";
            this._disableClass = "";
 
            this.layerObjIndex = {};
            this.curCity = "";
            AppEvent.addAppEventListener(AppEvent.MAP_DISTRICT_CHANGE, lang.hitch(this, function(evt) {
                if (this._activated) {
                    if (this.curCity != evt.NAME) {
                        this.hideCityLayers(this.curCity);
                        this.showCityLayers(evt.NAME);
                    }
                }
                this.curCity = evt.NAME;
            }));
            this.map.on("extent-change", lang.hitch(this, function(evt) {
                if (evt.levelChange) {
                    if (evt.lod.level >= 17 && this.layers[this.curCity]) {
                        this.enable();
                    } else {
                        this.deactivate();
                        this.disable();
                    }
                }
            }));
        },
        disable: function() {
            this.inherited(arguments);
            domAttr.set(this.domNode, "title", this.disableTooltip);
        },
        enable: function() {
            this.inherited(arguments);
            domAttr.set(this.domNode, "title", this.tooltip);
        },
        showCityLayers: function(name) {
            var lyrs = this.getCityLayers(name);
            for (var i = 0; i < lyrs.length; i++) {
                this.map.addLayer(lyrs[i]);
            }
        },
        hideCityLayers: function(name) {
            var lyrs = this.getCityLayers(name);
            for (var i = 0; i < lyrs.length; i++) {
                this.map.removeLayer(lyrs[i]);
            }
        },
        getCityLayers: function(key) {
            if (this.layerObjIndex[key]) {
                return this.layerObjIndex[key]
            } else if (this.layers[key]) {
                var layerObjs = LayerUtil.parseLayers(this.layers[key]);
                this.layerObjIndex[key] = layerObjs;
                return this.layerObjIndex[key]
            }
            return [];
        },
 
        activate: function(args) {
            if (this._activated) {
                return;
            }
            this.inherited(arguments);
            if (args != null && args == "self") {
                return;
            }
            this.showCityLayers(this.curCity);
        },
        postCreate: function() {
            this.inherited(arguments);
            domStyle.set(this.domNode, "position", "absolute");
            domStyle.set(this.domNode, "top", "130px");
            domStyle.set(this.domNode, "left", "20px");
            domStyle.set(this.domNode, "z-index", "30");
            domStyle.set(this.domNode, "border-radius", "3px");
            this.disable();
        },
        deactivate: function() {
            this.hideCityLayers(this.curCity);
            this.inherited(arguments);
            AppEvent.dispatchAppEvent(AppEvent.CLOSE_WIDGET, this.widgetId);
        }
    });
    return RL;
});