1var arraycliccapas = new Array(); 2var cnt=-1; 3function crearMenuCapas() { 4 try { 5 var view; 6 $.each(nodosCapas, function (idx, obj) { 7 8 if (obj.oculto == true) 9 view = 'visibility: hidden;'; 10 else 11 view = 'visibility:visible;'; 12 if (!($('#grupo_capa' + obj.id_nodo_padre).length)) { 13 $('<ul>', { 14 'id': 'grupo_capa' + obj.id_nodo_padre, 15 'style': 'padding:0px; overflow:hidden;' + view+'' 16 17 }).appendTo('#layer' + obj.id_nodo_padre); 18 } 19 var nombreP = ((idioma === "en") && (obj.nombre_en != '')) ? obj.nombre_en : obj.nombre; 20 21 $('<li>', { 22 'id': 'capa' + obj.id_nodo, 23 'class': (obj.id_nodo === '5_1') ? 'displayNone' : '' 24 }).append( 25 $('<img>', { 26 'id': 'spanCollapseCapa' + obj.id_nodo, 27 'src': (obj.collapsed === true) ? '/componentes/espaciov2/v2/images/openfolder.png' : '/componentes/espaciov2/v2/images/closedfolder.png', 28 'onclick': 'show_hidden_lyrArbol("grupo_capa' + obj.id_nodo + '","' + obj.id_nodo+'")', 29 }), 30 $('<input>', { 31 'id': 'checkcapa' + obj.id_nodo, 32 'type': 'checkbox', 33 'class':'form-check-input', 34 // 'style': 'width:9%', 35 'onclick': 'selectParent("' + obj.id_nodo + '");verificarHermanosCapas("' + (obj.id_nodo.split("_", obj.id_nodo.split("_").length - 1)).join("_") + '")', 36 'style': (obj.id_nodo.substring(0, 1) === "7" || tema==='15' ) ? 'display:none' :'display:inline-block' 37 }), 38 $('<label>', { 39 'id': 'spancapa' + obj.id_nodo, 40 'class':'form-check-label', 41 'style':'display:inline;', 42 'onclick': (obj.id_nodo.substring(0, 1) === "7") ? '' : 'selectParent("' + obj.id_nodo + '");verificarHermanosCapas("' + (obj.id_nodo.split("_", obj.id_nodo.split("_").length - 1)).join("_") + '")', 43 'text': nombreP, 44 'for':'checkcapa' + obj.id_nodo, 45 }) 46 ).appendTo('#grupo_capa' + obj.id_nodo_padre); 47 48 49 $('<ul>', { 50 'id': 'grupo_capa' + obj.id_nodo, 51 'class': (obj.collapsed === true) ? 'layer_list' : 'layer_list', 52 }).appendTo('#grupo_capa' + obj.id_nodo_padre); 53 54 55 if (obj.capas) { 56 $.each(obj.capas, function (idx, obj1) { 57 var nombre = ((idioma === "en") && (obj1.nombre_en != '')) ? obj1.nombre_en : obj1.nombre_es; 58 var clase = (obj1.zoomInicial > 5) ? 'alert-zoom' : 'cursor-pointer'; 59 var title = (obj1.zoomInicial > 5) ? ((idioma === "en") ? 'You need the zoom level ' + obj1.zoomInicial + ' to display the layer \n' + nombre : 'Se necesita un nivel de zoom ' + obj1.zoomInicial + ' para visualizar la capa \n' + nombre) : nombre; 60 var metadatosClass = (obj1.Descripcion_capa != "") ? "glyphicon glyphicon-info-sign metadatos" : "oculta"; 61 var claseCortarText = obj1.id_nodoCapa.match(/_/gi).length;//var claseCortarText = (obj1.id_nodoCapa.replace(/_/g, "")).length - 1; 62 63 $('<li>', { 64 'id': 'capa' + obj1.id_nodoCapa, 65 //'class': 'liMenuCapas', 66 //'data-bs-toggle': 'tooltip', 67 //'data-bs-placement': 'top', 68 'class': 'liMenuCapas', 69 //function() { 70 // if (window.location.pathname === '/temas/mg/') 71 // if (obj1.id_nodoCapa === "1_1_25") 72 // return 'displayNone'; 73 // else 74 // return 'liMenuCapas'; 75 // else 76 // return 'liMenuCapas'; 77 //}, 78 //'title': title, 79 'style':'' 80 }).append( 81 82 $('<div>', { 83 'id': 'capa' + obj1.id_nodoCapa, 84 'class':"form-check", 85 //'style': window.location.pathname !== '/temas/mg/' ? 'display:inline-flex;' : 'display:block;' 86 'style': 'display:inline-flex;' 87 }).append( 88 89 $('<input />', { 90 'id': 'checkcapa' + obj1.id_nodoCapa, 91 'type': tema !== '15' ? 'checkbox' : 'radio', 92 'name': tema !== '15' ? '':'CEM', 93 'checked': obj1.visible, 94 'class':'form-check-input styleCheck', 95 'onclick': 96 function () { 97 var fn_click = 'on_off_lyrArbol('; 98 return fn_click + "'" + obj1.ws_geoserver + "', '" + obj1.capa_geoserver + "','" + obj1.id_nodoCapa + "','" + obj1.zoomInicial + "', '" + obj1.estilo + "');verificarHermanosCapas('" + obj.id_nodo + "')"; 99 } 100 }), 101 $('<span />', { 102 'id': 'imgcapa' + obj1.id_nodoCapa, 103 //'style': 'display:inline-flex; margin:0 2px 0 0; padding-left: 5px;' 104 'style': 'margin:0 2px 0 0;' 105 }).append($('<img />', { 106 'src': ((obj1.imagen != "") && (obj1.imagen != undefined)) ? '/componentes/espaciov2/v2/images/listaCapas/' + obj1.imagen : '', 107 'class': ((obj1.imagen != "") && (obj1.imagen != undefined)) ? '' : 'displayNone' 108 })), 109 // $('<span />', { 110 // 'id': 'spancapa' + obj1.id_nodoCapa, 111 // 'class': clase, 112 //'style': 'display:inline-flex' 113 //}).append( 114 $('<label />', { 115 'id': 'divcapa' + obj1.id_nodoCapa, 116 'data-bs-toggle': 'tooltip', 117 'data-bs-placement': 'top', 118 'title': title, 119 //'class': 'cortarTextoMenuCapas' + claseCortarText + ' form-check-label ' + clase, 120 'class': tema === '198' || tema === '263' ?'cortarTexto form-check-label':'
120cortarTexto2 form-check-label ' + clase, 121 'text': nombre 122 }) 123 //) 124 ) 125 ).appendTo('#grupo_capa' + obj.id_nodo); 126 127 if (obj1.zoomInicial > 5) 128 $('#checkcapa' + obj1.id_nodoCapa).prop('disabled', true); 129 if (obj1.visible) { 130 if (obj1.ws_geoserver == "WMS") { 131 iMap.addWMSMapServerGaiaTileLyr(obj1.capa_geoserver, obj1.estilo, obj1.id_nodoCapa, obj1.zoomInicial, true); 132 } 133 else 134 if (obj1.clic == true) { 135 cnt++; 136 eval('lyr' + obj1.capa_geoserver + '=null'); 137 eval('vectorlyr' + obj1.capa_geoserver + '=null'); 138 if (obj1.zIndex) 139 eval('lyr' + obj1.capa_geoserver + '=iMap.addGSWMSTiledLyr(urlsGS.getURL_WMS(), obj1.ws_geoserver, obj1.capa_geoserver, obj1.id_nodoCapa, obj1.zoomInicial, true, obj1.estilo,obj1.zIndex);'); 140 else 141 eval('lyr' + obj1.capa_geoserver + '=iMap.addGSWMSTiledLyr(urlsGS.getURL_WMS(), obj1.ws_geoserver, obj1.capa_geoserver, obj1.id_nodoCapa, obj1.zoomInicial, true, obj1.estilo,"");'); 142 // eval('lyr' + obj1.capa_geoserver + '=iMap.addGSWMSTiledLyr(urlsGS.getURL_WMS(), obj1.ws_geoserver, obj1.capa_geoserver, obj1.id_nodoCapa, obj1.zoomInicial, true, obj1.estilo);'); 143 144 arraycliccapas[cnt] = new Array(3); 145 arraycliccapas[cnt][0] = '' + 'lyr' + obj1.capa_geoserver + ''; 146 arraycliccapas[cnt][1] = obj1.id_nodoCapa; 147 arraycliccapas[cnt][2] = obj1.campo; 148 } 149 else 150 if (obj1.zIndex) 151 iMap.addGSWMSTiledLyr(urlsGS.getURL_WMS(), obj1.ws_geoserver, obj1.capa_geoserver, obj1.id_nodoCapa, obj1.zoomInicial, true, obj1.estilo, obj1.zIndex); 152 else 153 iMap.addGSWMSTiledLyr(urlsGS.getURL_WMS(), obj1.ws_geoserver, obj1.capa_geoserver, obj1.id_nodoCapa, obj1.zoomInicial, true, obj1.estilo,''); 154 // capasActivas(obj1.id_nodoCapa, /*obj.id_nodo_padre*/'MAPA'); 155 } 156 if (obj1.visible == true) { 157 158 if (typeof ImgOverlay !== "undefined") { 159 if (ImgOverlay) { 160 OnOffoverlay(obj1.id_nodoCapa, obj1.visible); 161 } 162 } 163 164 165 } 166 }); 167 verificarHermanosCapas(obj.id_nodo); 168 169 }//end if contains layer 170 });// end foreach 171 172 setTimeout(function () { 173 var placement = getPopoverPlacement(); 174 $('.metadatos').each(function () { 175 var popover_title = '<span>' + $(this).attr('popover-title') + '</span><button type="button" class="close close-popover" aria-label="Close"><span class="close-popover-icon" aria-hidden="true">�</span></button>'; 176 var popover_content = $(this).attr('popover-content'); 177 // $(this).popover({ animation: true, title: popover_title, content: popover_content, html: true, placement: placement, container: 'body' }); 178 }); 179 $('.metadatos').on('shown.bs.popover', function () { 180 $('.metadatos').not($(this)).popover('hide'); 181 }); 182 $(document).on('click', '.close-popover', function (e) { 183 $('.metadatos').popover('hide'); 184 }); 185 }, 7000); 186 $('[data-toggle="tooltip"]').tooltip(); 187 } 188 catch (e) { console.log('no capas'); } 189} 190 191function on_off_lyrArbol(ws, capa, id, zoomInicial, estilo) { 192 var lyrauxL = null; 193 var lyrauxLp = null; 194 var idclcic=-1; 195 arraycliccapas.forEach(function (element) { 196 if (element[1] == id) 197 idclcic++; 198 }); 199 var checked = $('#checkcapa' + id).is(':checked'); 200 var lyr = null; 201 lyr = iMap.getLayer(id); 202 //if (window.location.pathname !== '/temas/mg/') { 203 // if (id === '1_1_3') 204 // lyrauxL = iMap.getLayer('1_1_25'); 205 206 // else 207 // lyrauxL = null; 208 209 // if (id === '1_1_25') 210 // lyrauxLp = iMap.getLayer('1_1_3'); 211 // else 212 // lyrauxLp = null; 213 214 //} 215 if (lyr === null) { 216 217 if (ws == "WMS")
218 iMap.addWMSMapServerGaiaTileLyr(capa, estilo, id, zoomInicial, checked); 219 else { 220 221 if (tema === "15") { 222 iMap.getMap().getLayers().forEach(function (layer) { 223 if (layer !== undefined) { 224 var name = "" + layer.get('name') + ""; 225 if (name.indexOf('15_1') !== -1) 226 iMap.getMap().removeLayer(layer); 227 } 228 }); 229 } 230 231 232 $.each(nodosCapas, function (idx, obj) { 233 if (obj.capas) { 234 $.each(obj.capas, function (idx, obj1) { 235 if (obj1.id_nodoCapa == id) { 236 if ((obj1.clic == true) && (idclcic == -1)) { 237 cnt++; 238 eval('lyr' + obj1.capa_geoserver + '=null'); 239 eval('vectorlyr' + obj1.capa_geoserver + '=null'); 240 if (obj1.zIndex) 241 eval('lyr' + obj1.capa_geoserver + '=iMap.addGSWMSTiledLyr(urlsGS.getURL_WMS(), obj1.ws_geoserver, obj1.capa_geoserver, obj1.id_nodoCapa, obj1.zoomInicial, true, obj1.estilo,obj1.zIndex);'); 242 else 243 eval('lyr' + obj1.capa_geoserver + '=iMap.addGSWMSTiledLyr(urlsGS.getURL_WMS(), obj1.ws_geoserver, obj1.capa_geoserver, obj1.id_nodoCapa, obj1.zoomInicial, true, obj1.estilo,"");'); 244 arraycliccapas[cnt] = new Array(3); 245 arraycliccapas[cnt][0] = '' + 'lyr' + obj1.capa_geoserver + ''; 246 arraycliccapas[cnt][1] = obj1.id_nodoCapa; 247 arraycliccapas[cnt][2] = obj1.campo; 248 } 249 else { 250 //if (window.location.pathname !== '/temas/mg/') { 251 // if (id === '1_1_3')
252 // iMap.addGSWMSTiledLyr(urlsGS.getURL_WMS(), "Sitio_Inegi", "Localidades", "1_1_25", 10, checked, "mg_loc_poligapunto", "162"); 253 254 255 // if (id === '1_1_25') 256 // iMap.addGSWMSTiledLyr(urlsGS.getURL_WMS(), "Sitio_Inegi", "Localidades", "1_1_3", 10, checked, "mg_localidades", "162"); 257 //} 258 if (obj1.zIndex) 259 iMap.addGSWMSTiledLyr(urlsGS.getURL_WMS(), ws, capa, id, zoomInicial, checked, estilo, zIndex); 260 else 261 iMap.addGSWMSTiledLyr(urlsGS.getURL_WMS(), ws, capa, id, zoomInicial, checked, estilo,''); 262 } 263 264 } 265 266 }); 267 268 } 269 }); 270 271 272 273 } 274 // capasActivas(id, 'MAPA'); 275 } 276 else if (lyr !== null) { 277 lyr.set('visible', checked); 278 if (lyrauxL !== null) 279 lyrauxL.set('visible', checked); 280 if (lyrauxLp !== null) 281 lyrauxLp.set('visible', checked); 282 283 $('#checkcapa' + id).attr("value", checked); 284 //$('#checkcapa' + id).prop("checked", checked); 285 $('#checkcapa' + id + 'Active').attr('value', checked); 286 $('#checkcapa' + id + 'Active').prop('checked', checked); 287 } 288 289 if (typeof ImgOverlay !== "undefined") { 290 if (ImgOverlay) { 291 OnOffoverlay(id, checked); 292 // OnOffoverlay(obj1.id_nodoCapa, obj1.visible); 293 } 294 } 295 if ($('#btnconsultar')[0]) { 296 297 $('#btnconsultar')[0].disabled = false; 298 } 299} 300 301function show_hidden_lyrArbol(gruid_ul,id_ul) { 302 303 //$('#' + id_ul).prev('li').children(".glyphicon").toggleClass('glyphicon-plus').toggleClass('glyphicon-minus'); 304 //$('#IMG' + id_ul).toggleClass('glyphicon-plus').toggleClass('glyphicon-minus'); 305 306 //console.log("menuCapas.js") 307 308 try { 309 var ul = document.getElementById(gruid_ul); 310 var IMGul = document.getElementById("spanCollapseCapa" + id_ul); 311 if ((ul.style.display == "none")) { 312 IMGul.src = "/componentes/espaciov2/v2/Images/openfolder.png"; 313 // $('#' + gruid_ul + '').slideDown(); 314 $('#' + gruid_ul).slideToggle("slow"); 315 316 } 317 else if ((ul.style.display == "") || (ul.style.display == "block") || (ul.style.display == "inline-table") || (ul.style.display == "inline-block")) { 318 IMGul.src = "/componentes/espaciov2/v2/Images/closedfolder.png"; 319 $('#' + gruid_ul).slideToggle("slow"); 320 // $('#' + gruid_ul + '').slideUp(); 321 } 322 // $('#' + gruid_ul).slideToggle("slow"); 323 //$('#' + id_ul + '').toggle(1000); 324 } 325 catch (e) { 326 327 } 328 329 330} 331 332function selectParent(idParent) { 333 if (!$("#checkcapa" + idParent).prop("checked")) 334 $("#grupo_capa" + idParent + " li input").each(function () { 335 if ((this.checked)) { 336 $(this).prop('checked', false) 337 eval($(this).attr("onclick"));//$(this).click(); 338 } 339 }); 340 else 341 $("#grupo_capa" + idParent + " li input").each(function () { 342 var padreSelec = ($("#checkcapa" + idParent).hasClass("glyphicon glyphicon-ok opacity5") || $("#checkcapa" + idParent).prop("checked")); 343 if (((padreSelec) && (!(this.checked))) || ((this.checked) && (!(padreSelec)))) { 344 $(this).prop('checked', true) 345 eval($(this).attr("onclick"));//$(this).click(); 346 } 347 }); 348 $("#checkcapa" + idParent).removeClass('glyphicon glyphicon-ok opacity5'); 349} 350 351function verificarHermanosCapas(idParent) { 352 var cntCheck = 0, cntCapas = 0; 353 $("#grupo_capa" + idParent + " li input").each(function () { 354 if (this.checked) 355 cntCheck++; 356 cntCapas++; 357 });
358 //((cntCheck != cntCapas) && (cntCheck > 0)) ? $("#checkcapa" + idParent).addClass('glyphicon glyphicon-ok opacity5 glypc') : $("#checkcapa" + idParent).removeClass('glyphicon glyphicon-ok opacity5 glypc'); 359 ((cntCheck != cntCapas) && (cntCheck > 0)) ? $("#checkcapa" + idParent).addClass('glyphicon glyphicon-ok opacity5') : $("#checkcapa" + idParent).removeClass('glyphicon glyphicon-ok opacity5'); 360 (cntCheck === cntCapas) ? $("#checkcapa" + idParent).prop('checked', true) : $("#checkcapa" + idParent).prop('checked', false); 361 if ($("#checkcapa" + idParent.slice(0, - idParent.split("_").length + 1)).length) 362 verificarHermanosCapas(idParent.slice(0, - idParent.split("_").length + 1)); 363} 364 365function getPopoverPlacement() { 366 var width = window.innerWidth; 367 if (width < 768) return 'auto'; 368 return 'right'; 369} 370 371function OnOffoverlay(layerId, checkedLayer) 372{ 373 (checkedLayer === false) ? checkedLayer = 'none' : checkedLayer = 'block' ; 374 //$('#divOverlay')[0].style = "display:" + checkedLayer + ";height:150px !important"; 375 try { 376 if (ImgOverlay) { 377 if (ImgOverlay[0].img == "GNSS_milimetros") { 378 if ((layerId == "1_1_1")&&(checkedLayer == 'none') && (document.getElementById('checkcapa1_1_2').checked)) { 379 checkedLayerliMenuCapas = true; 380 } 381 if ((layerId == "1_1_2") && (checkedLayer == 'none') && (document.getElementById('checkcapa1_1_1').checked)) { 382 checkedLayer = true; 383 } 384 385 } 386 387 $.each(ImgOverlay, function (idx, obj) { 388 if (tema === "15") { 389 $('#div' + obj.nombre + '')[0].style = "display:none"; 390 if (checkedLayer === 'block') 391 (obj.id === layerId) ? $('#div' + obj.nombre + '')[0].style = "display:" + checkedLayer + ";margin-top: 10px;margin-bottom: 10px;" : '' 392 else 393 console.log('apagada'); 394 } 395 else { 396 if (idioma === "en") { 397 // if (location.pathname.indexOf('programas/usyv/') !== -1 || location.pathname.indexOf('programas/mg/') !== -1 || location.pathname.indexOf('programas/rnc/') !== -1) { 398 if (location.pathname.indexOf('programas/mg/') !== -1 ) { 399 if (obj.id === layerId) { 400 $('#div' + obj.nombre + '_en')[0].style = "display:" + checkedLayer; 401 $('#div' + obj.nombre + '')[0].style = "display:none"; 402 } 403 404 } 405 else { 406 407 (obj.id === layerId) ? $('#div' + obj.nombre + '')[0].style = "display:" + checkedLayer : ''; 408 } 409 } 410 else { 411 if (location.pathname.indexOf('programas/mg/') !== -1 ) { 412 //if (location.pathname.indexOf('programas/usyv/') !== -1 || location.pathname.indexOf('programas/mg/') !== -1 || location.pathname.indexOf('programas/rnc/') !== -1) { 413 414 415 if (obj.id === layerId) { 416 $('#div' + obj.nombre + '_en')[0].style = "display:none"; 417 $('#div' + obj.nombre + '')[0].style = "display:" + checkedLayer; 418 419 } 420 } 421 else { 422 423 (obj.id === layerId) ? $('#div' + obj.nombre + '')[0].style = "display:" + checkedLayer : ''; 424 425 } 426 } 427 } 428 429 430 }); 431 432 433 } 434 var contover = 0; 435 $.each(ImgOverlay, function (idx, obj) { 436 if ($('#div' + obj.nombre + '')[0].style.display === "block") { 437 contover++; 438 if (contover > 0) 439 $('#divOverlay')[0].style = "display:block;height:150px !important"; 440 else 441 $('#divOverlay')[0].style = "display:none;height:150px !important"; 442 } 443 }); 444 } 445 catch (e){ } 446}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.