1var urlGeoServerINEGI = "https://mapas.inegi.org.mx/geoserver"; 2var urltemaorigen = window.location.href; ///LGT 3if (location.hostname.indexOf('desarrollowww') == !-1) 4 urlGeoServerINEGI = "https://desarrollomapas.inegi.org.mx/geoserver/"; 5//"http://10.1.8.15:8080/geoserver/";//"http://10.210.100.74:8080/geoserver"; // 6var idioma; 7var zoom = 5; 8var iMap = null; 9var olMap = null; 10var temaInicial = ""; 11var overlayPop; 12var var_JsonViviendas = ""; 13var checkedRadio; 14var zoomMapS = ""; 15var maplatitud = ""; 16var maplongitud = ""; 17var lyrMalla = null; 18var lyrVectorMalla = null; 19var clickCerrar = false; 20var escalaSeleccionada = ''; 21var clickCerrar = false; 22var TipoTema; 23var popover2 = null; 24var popover3 = null; 25var popover4 = null; 26var configpag = { 27 "estilotema": "4", 28 "totent": true, 29 "tema": 4, 30 "color": "#1BA9A8" 31}; 32var desgloseInd; 33var APIrespuesta; 34var periodo; 35var Decimales_Despliegue; 36var tema; 37var dominio = document.domain.split('.', 1); 38var fl_carga_componentMaps = false; 39var ordenCapas = []; 40var descargasTotales = []; 41var flagload = false; 42if (dominio[0] === "en") { idioma = "en"; } else { idioma = "es"; } 43$(window).resize(function () { 44 45 //setTimeout(function () { 46 resizeMap(); 47 //}, 1500); 48}); 49 50var totCvee = 0; 51function agregaTabIndexAriaLabelASecciones() { //para agregar el tabindex y Aria label a capas y mapa 52 53} 54 55function CargaMapasBase() { 56 57 $('<div>', { 58 'onclick': 'mapaBase(\'osm\')', 59 'Text': 'Open Street Map' 60 }).append( 61 $('<img>', { 62 'src': '/componentes/espaciov2/v2/images/mapa_OSM.png', 63 'style': 'width: 110px; cursor: pointer; display: table;' 64 })).append($('<span />', { 65 'id': 'tituloMapaOSM', 66 'html': 'Open Street Map', 67 })).appendTo('#MapasBase'); 68 $('<div>', { 69 'onclick': 'mapaBase(\'Google Satelite\')', 70 'Text': 'Sat\u00e9lite de Google' 71 }).append( 72 $('<img>', { 73 'src': '/componentes/espaciov2/v2/images/satelite.png', 74 'style': 'width: 110px; cursor: pointer; display: table;' 75 })).append($('<span />', { 76 'id': 'tituloMapaSG', 77 'html': 'Sat\u00e9lite de Google', 78 })).appendTo('#MapasBase'); 79 $('<div>', { 80 'onclick': 'mapaBase(\'Google Road Map\')', 81 'Text': 'Mapa de Google' 82 }).append( 83 $('<img>', { 84 'src': '/componentes/espaciov2/v2/images/mapa.png', 85 'style': 'width: 110px; cursor: pointer; display: table;' 86 })).append($('<span />', { 87 'id': 'tituloMapaRM', 88 'html': 'Mapa de Google', 89 })).appendTo('#MapasBase'); 90 91} 92 93var filejson = null; 94var imgOver = new Image(); 95function ElementMapa(zoom, lat, lon, tem, TipoTema, mapavInicial, escalas) { 96 tema = tem; 97 98 /** 99 Crea el div y los diov que van dentro delemento del mapa ocupa un id=mapa 100 **/ 101 var canvas3 = document.createElement("canvas"); 102 if ((tema === "0150007000000000") || (tema === "0160003000000000")) {//gnss y fisiongrafia 103 var ctx1 = canvas3.getContext("2d"); 104 if (tema === "0150007000000000") 105 imgOver.src = '/componentes/espaciov2/v2/images/overlay/Overlay_Fisiografia.png'; 106 if (tema === "0160003000000000") 107 imgOver.src = '/componentes/espaciov2/v2/images/overlay/Overlay_GNSS.png'; 108 imgOver.onload = function () { 109 //ctx1.clearRect(0, 0, canvas3.width, canvas3.height); 110 //ctx1.drawImage(imgOver, 0, 0, canvas3.width, canvas3.height); 111 ctx1.clearRect(0, 0, canvas3.width, canvas3.height); 112 ctx1.drawImage(imgOver, 0, 0, canvas3.width, canvas3.height); 113 } 114 } 115 $('<a>', { 116 'id': 'btndownload', 117 'style': 'display:none' 118 }).appendTo('body'); 119 120 121 122 $('<div>', { 123 'id': 'map2D' 124 }).append( 125 $('<div>', { 126 'id': 'MapasBase' 127 })).appendTo('#mapa'); 128 129 130 $('<div>', { 131 'id': 'divControlzoom', 132 'class': 'ol-unselectable ol-control' 133 }).append( 134 $('<div>', { 135 'class': 'zoom' 136 }).append( 137 $('<span>', { 138 'id': 'zoom', 139 'text': '5' 140 }))).appendTo('#map2D'); 141 142 $('<div>', {
143 'id': 'divPop', 144 'style': 'display:none' 145 }).appendTo(document.body); 146 147 $('<div>', { 148 'id': 'infowindow', 149 'class': 'ol-popup' 150 }).append( 151 $('<a>', { 152 'href': '#', 153 'id': 'infoCloser', 154 'style': 'font-size: 11px;', 155 'class': 'ol-popup-closer' 156 }), 157 $('<div>', { 158 'id': 'infoContent', 159 'style': '' 160 })).appendTo(document.body); 161 //bbutton hamburguesa 162 $('<div>', { 163 'id': 'layer-button-container' 164 }).append( 165 $('<a>', { 166 'id': 'layer-button', 167 //'href': '#', 168 'class': 'btn btn-primary btn-sm layer-button-responsivo tool-icon visible-xs inegi-menu' 169 })).appendTo('#map2D'); 170 //Agregar el div para ocultar el mapa 171 172 $('<div>', { 173 'id': 'OcultaPanel' 174 //'style':'display:none' 175 }).appendTo('#map2D'); 176 177 if (TipoTema === "E") { 178 $('<img>', { 179 'src': '/componentes/espaciov2/v2/images/loading.gif', 180 'style': 'margin-left: 50%; margin-top: 35%;' 181 }).appendTo('#OcultaPanel'); 182 } 183 184 $('#OcultaPanel').hide(); 185 //Infowindow de mallas 186 $('<div>', { 187 'id': 'popup', 188 'data-bs-toggle': 'popover' 189 }).appendTo('#map2D'); 190 191 //Infowindow de buscador 192 $('<div>', { 193 'id': 'popup2', 194 'data-bs-toggle': 'popover' 195 }).appendTo('#map2D'); 196 197 //Div que controla el clic en el mapa base 198 199 if (idioma === "es") { 200 201 $('<div>', { 202 'id': 'controlMapas', 203 'onclick': '$(\'#MapasBase\').slideToggle(1000)' 204 }).append( 205 $('<div>', { 206 'style': 'width: 110px;', 207 'class': 'ol-scale-line-inner' 208 }).append( 209 $('<span />', { 210 'id': 'tituloMapaBase', 211 'html': idioma != 'en' ? window.location.pathname.indexOf('topografia') !== -1 ? 'Mapa base<br />INEGI TopografÃa' : 'Mapa base<br />INEGI' : window.location.pathname.indexOf('topografia') !== -1 ? 'Base maps<br />INEGI TopografÃa' : 'Base maps<br />INEGI' 212 }))).appendTo('#map2D'); 213 } 214 else { 215 $('<div>', { 216 'id': 'controlMapas', 217 'onclick': '$(\'#MapasBase\').slideToggle(1000)' 218 }).append( 219 $('<div>', { 220 'style': 'width: 110px;height: 130%;', 221 'class': 'ol-scale-line-inner' 222 }).append( 223 $('<span />', { 224 'id': 'tituloMapaBase', 225 'html': window.location.pathname.indexOf('topografia') !== -1 ? 'Base maps<br />INEGI TopografÃa' : 'Base maps<br />INEGI' 226 }))).appendTo('#map2D'); 227 228 229 230 231 } 232 233 //Div que contiene los tipos de mapas base 234 235 if (idioma === "es") { 236 237 $('<div>', { 238 'onclick': 'mapaBase(\'inegitopo\')', 239 'Text': 'INEGI TopografÃa' 240 241 }).append( 242 $('<img>', { 243 'data-src': '/componentes/espaciov2/v2/images/mapa_topografia.png', 244 'class': 'lazyload', 245 'style': 'width: 110px; cursor: pointer; display: table;' 246 })).append($('<span />', { 247 'id': 'tituloMapaInegiT', 248 'html': 'INEGI TopografÃa' 249 })).appendTo('#MapasBase'); 250 $('<div>', { 251 'onclick': 'mapaBase(\'inegi\')', 252 'Text': 'INEGI' 253 }).append( 254 $('<img>', { 255 'src': '/componentes/espaciov2/v2/images/mapa_INEGI.png', 256 'style': 'width: 110px; cursor: pointer; display: table;' 257 })).append($('<span />', { 258 'id': 'tituloMapaInegi', 259 'html': 'INEGI', 260 })).appendTo('#MapasBase'); 261 262 $('<div>', { 263 'onclick': 'mapaBase(\'osm\')', 264 'Text': 'Open Street Map' 265 }).append( 266 $('<img>', { 267 'data-src': '/componentes/espaciov2/v2/images/mapa_OSM.png', 268 'class': 'lazyload', 269 'style': 'width: 110px; cursor: pointer; display: table;' 270 })).append($('<span />', { 271 'id': 'tituloMapaOSM', 272 'html': 'Open Street Map', 273 })).appendTo('#MapasBase'); 274 275 $('<div>', { 276 'onclick': 'mapaBase(\'Google Satelite\')', 277 'Text': 'Sat\u00e9lite de Google' 278 }).append( 279 $('<img>', { 280 'data-src': '/componentes/espaciov2/v2/images/satelite.png', 281 'class': 'lazyload', 282 'style': 'width: 110px; cursor: pointer; display: table;' 283 })).append($('<span />', { 284 'id': 'tituloMapaSG', 285 'html': 'Sat\u00e9lite de Google' 286 })).appendTo('#MapasBase'); 287 288 $('<div>', { 289 'onclick': 'mapaBase(\'Google Terrain & Roads\')', 290 'Text': 'INEGI' 291 }).append( 292 $('<img>', { 293 'data-src': '/componentes/espaciov2/v2/images/mapa_Terreno.png', 294 'class': 'lazyload', 295 'style': 'width: 110px; cursor: pointer; display: table;' 296 })).append($('<span />', { 297 'id': 'tituloMapaInegi', 298 'html': 'Terreno de Google' 299 })).appendTo('#MapasBase'); 300 301 } 302 else { 303 $('<div>', { 304 'onclick': 'mapaBase(\'inegitopo\')', 305 'Text': 'INEGI Topography' 306 307 }).append( 308 $('<img>', { 309 'data-src': '/componentes/espaciov2/v2/images/mapa_topografia.png', 310 'class': 'lazyload', 311 'style': 'width: 110px; cursor: pointer; display: table;' 312 })).append($('<span />', { 313 'id': 'tituloMapaInegiT', 314 'html': 'INEGI Topography' 315 })).appendTo('#MapasBase'); 316 $('<div>', { 317 'onclick': 'mapaBase(\'inegi\')', 318 'Text': 'INEGI' 319 }).append( 320 $('<img>', { 321 'src': '/componentes/espaciov2/v2/images/mapa_INEGI.png', 322 'style': 'width: 110px; cursor: pointer; display: table;' 323 })).append($('<span />', { 324 'id': 'tituloMapaInegi', 325 'html': 'INEGI', 326 })).appendTo('#MapasBase'); 327 328 $('<div>', { 329 'onclick': 'mapaBase(\'osm\')', 330 'Text': 'Open Street Map' 331 }).append( 332 $('<img>', { 333 'data-src': '/componentes/espaciov2/v2/images/mapa_OSM.png', 334 'class': 'lazyload', 335 'style': 'width: 110px; cursor: pointer; display: table;' 336 })).append($('<span />', { 337 'id': 'tituloMapaOSM', 338 'html': 'Open Street Map', 339 })).appendTo('#MapasBase'); 340 341 $('<div>', { 342 'onclick': 'mapaBase(\'Google Satelite\')', 343 'Text': 'Google Satellite' 344 }).append( 345 $('<img>', { 346 'data-src': '/componentes/espaciov2/v2/images/satelite.png', 347 'class': 'lazyload', 348 'style': 'width: 110px; cursor: pointer; display: table;' 349 })).append($('<span />', { 350 'id': 'tituloMapaSG', 351 'html': 'Google Satellite' 352 })).appendTo('#MapasBase'); 353 354 $('<div>', { 355 'onclick': 'mapaBase(\'Google Terrain & Roads\')', 356 'Text': 'INEGI' 357 }).append( 358 $('<img>', { 359 'data-src': '/componentes/espaciov2/v2/images/mapa_Terreno.png', 360 'class': 'lazyload', 361 'style': 'width: 110px; cursor: pointer; display: table;' 362 })).append($('<span />', { 363 'id': 'tituloMapaInegi', 364 'html': 'Google terrain' 365 })).appendTo('#MapasBase'); 366 367 368 369 } 370 371 372 /** 373 Crea los elemtos de la parte de las capas y buscador ocupa un id=panelizq 374 **/ 375 if (TipoTema !== "ET") { 376 377 if (TipoTema === "E") { 378 // if ((dominio[0] === "es") || (dominio[0] === "desarrollowww")){ 379 if (idioma === "es") { 380 $('<div>', { 381 'id': 'divSelect_Rep', 382 'style': 'padding-bottom: 10px; align-items: center;' 383 }).append( 384 $('<label>', { 385 'text': 'Mapa tem\u00e1tico', 386 'style': 'padding-right: 4px;', 387 'for': 'Select_Rep' 388 }), 389 $('<select>', { 390 'id': 'Select_Rep', 391 'onchange': ' { TipoVisual(this.selectedIndex); }', 392 // 'style': 'width:116px !important;',
393 'class': 'form-select' 394 395 }).append( 396 $('<option >', { 397 'value': '0', 398 'text': 'Pol\u00edgonos' 399 })).append( 400 $('<option >', { 401 'value': '1', 402 'text': 'Mapa de Calor' 403 })).append( 404 $('<option >', { 405 'value': '2', 406 'text': 'Mapa de Burbujas' 407 })) 408 ).appendTo('#panelizq'); 409 } 410 411 else { 412 413 console.log("Select ingles"); 414 415 $('<div>', { 416 // 'class': 'input-group', 417 'style': 'padding-bottom: 10px; align-items: center;' 418 }).append( 419 $('<label>', { 420 'text': 'Thematic map', 421 'style': 'padding-right: 4px;', 422 'info': 'Select_Rep' 423 }), 424 $('<select>', { 425 'id': 'Select_Rep', 426 'onchange': ' { TipoVisual(this.selectedIndex); }', 427 // 'style': 'width:116px !important;', 428 'class': 'form-select' 429 430 }).append( 431 $('<option >', { 432 'value': '0', 433 'text': 'Polygons' 434 })).append( 435 $('<option >', { 436 'value': '1', 437 'text': 'Heat map' 438 })).append( 439 $('<option >', { 440 'value': '2', 441 'text': 'Bubble map' 442 })) 443 ).appendTo('#panelizq'); 444 } 445 446 447 448 } 449 //console.log("prueba colapse"); 450 if ($(window).width() > 1200) { 451 // if (tem === "2542") { 452 // if (window.location.pathname.indexOf('50000') !== -1) { 453 $('#panelizq')[0].style.display = "block"; 454 455 // $('<div>', { 456 // 'id': 'iconPanelCapas', 457 // 'class': 'iconCapas', 458 // 'style': 'display:inline-flex;position: absolute; z-index: 999;top:260px;right:540px;', //modifique aqui 459 // 'data-bs-toggle': 'tooltip', 460 // 'data-bs-placement': 'bottom', 461 // 'data-bs-original-title': (idioma === 'es') ? 'Ver listado de capas y otras opciones' : 'See list of layers and other options' 462 // }).append( 463 // $('<button>', { 464 // 'id': 'collapse-tool-capas', 465 // 'style': 'position: absolute; z-index: 200;top:8px;left:5px;', 466 // 'class': 'btn fs-5 btn-light', 467 // 'aria-label': (idioma === 'es') ? 'Ver listado de capas y otras opciones' : 'See list of layers and other options' 468 // }).append( 469 // $('<span>', { 470 // 'class': 'inegi-nav-der', 471 // 'aria-hidden': 'true' 472 // }) 473 // ) 474 // ).appendTo('#map2D'); 475 476 477 478 divColaps2 = document.createElement("div"); 479 divColaps2.setAttribute("style", "display:inline-flex;position: absolute; z-index: 999;top:260px;right:540px;"); 480 divColaps2.setAttribute("class", "iconCapas"); 481 divColaps2.setAttribute("id", "iconPanelCapas"); 482 divColaps2.setAttribute("aria-label", "Ver listado de capas y otras opciones"); 483 divColaps2.setAttribute("data-bs-toggle", "tooltip"); 484 divColaps2.setAttribute("data-bs-placement", "bottom"); 485 486 if (idioma === "es") 487 divColaps2.setAttribute("data-bs-original-title", "Ver listado de capas y otras opciones"); 488 else 489 divColaps2.setAttribute("data-bs-original-title", "See list of layers and other options"); 490 491 492 btnColaps2 = document.createElement("button"); 493 btnColaps2.setAttribute("style", "display:none"); 494 btnColaps2.setAttribute("class", "btn fs-5 btn-light"); 495 btnColaps2.setAttribute("id", "collapse_tool_capas"); 496 btnColaps2.setAttribute("aria-label", "Ver listado de capas y otras opciones"); 497 btnColaps2.setAttribute("data-bs-toggle", "tooltip"); 498 btnColaps2.setAttribute("onclick", "ocultabtnColaps()"); 499 if (idioma === "es") 500 btnColaps2.setAttribute("data-bs-original-title", "Ver listado de capas y otras opciones"); 501 else 502 btnColaps2.setAttribute("data-bs-original-title", "See list of layers and other options"); 503 var spancolap2 = document.createElement("span"); 504 505 spancolap2.setAttribute("class", "inegi-nav-der"); 506 spancolap2.setAttribute("aria-hidden", "true"); 507 divColaps2.appendChild(btnColaps2); 508 btnColaps2.appendChild(spancolap2); 509 $('#map2D')[0].appendChild(btnColaps2); 510 511 512 513 514 515 516 /*// version de beta 517 $('#collapse-tool-capas').click(function () { 518 console.log("entra a colapse 2"); 519 $('#iconPanelCapas').hide(); 520 $('#panelizq').show(); 521 if ($(window).width() < 1200) { 522 //$('#panelizq')[0].style.display = "none"; 523 //$('#mapa').animate({ width: "100%" }, 500); 524 if ($('#collapse_tool_capasClose')) 525 $('#collapse_tool_capasClose')[0].style.display = "none"; 526 $('#panelizq')[0].style.display = "none"; 527 $('#mapa').css('width', "100%"); 528 //$(".iconCapasSelect").css("left", 216); 529 } 530 //else if ($(window).width() < 450) { 531 // $('#sidemenuCapas').animate({ width: "335px" }, 500) 532 // $(".iconCapasSelect").css("left", 308); 533 //} 534 else { 535 console.log("crea estilo"); 536 if($('#collapse_tool_capasClose')[0]) 537 $('#collapse_tool_capasClose')[0].style = "display:block;top:8x;z-index:200;left:5px;"; 538 $('#collapse-tool-capas').click(function () { 539 //$('#sidemenuCapas').animate({ width: "28%" }, 500); 540 $('#panelizq')[0].style.display = "block"; 541 $('#mapa').css('width', "72%"); 542 $(".iconCapasSelect").css("left", 400); 543 //$('#sidemenuCapas').animate({ width: "28%" }, 500); 544 //$('#mapa').animate({ width: "72%" }, 500); 545 //$(".iconCapasSelect").css("left", 400); 546 //if($('#collapse_tool_capasClose')[0]) 547 //$('#collapse_tool_capasClose')[0].style.display = "block"; 548 //$('#sidemenuCapas').animate({ width: "28%" }, 500); 549 //$('#panelizq')[0].style.display = "block"; 550 //$('#mapa').css('width', "72%"); 551 } 552 $('#disabledScreen').show(); 553 }); 554 555 $('#collapse-tool-capas').click(); 556 */ 557 558 559 $('#collapse-tool-capas').click(function () { 560 $('#iconPanelCapas').hide(); 561 $('#panelizq').show(); 562 if ($(window).width() <= 1200) { 563 if ($('#collapse_tool_capasClose')[0]) 564 $('#collapse_tool_capasClose')[0].style.display = "none"; 565 $('#panelizq')[0].style.display = "none"; 566 $('#mapa').css('width', "100%"); 567 568 } 569 570 else { 571 console.log("prueba 3"); 572 // if ($('#collapse_tool_capasClose')[0]) 573 // $('#collapse_tool_capasClose')[0].style = "display:block;position:absolute;top:8px;z-index:200;left:5px;"; 574 //$('#sidemenuCapas').animate({ width: "28%" }, 500); 575 $('#panelizq')[0].style.display = "block"; 576 $('#mapa').css('width', "72%"); 577 $(".iconCapasSelect").css("left", 400); 578 579 } 580 if (iMap)
581 iMap.getMap().updateSize(); 582 583 $('#disabledScreen').show(); 584 }); 585 586 $('#collapse-tool-capas').click(); 587 588 589 // } 590 } 591 592 593 divBuscador = document.createElement("Div"); 594 divBuscador.setAttribute("style", "padding-top:5px"); 595 divBuscador.setAttribute("class", "input-group mb-3"); 596 divBuscador.setAttribute("id", "divBuscador"); 597 inputBuscador = document.createElement("input"); 598 inputBuscador.setAttribute("style", "padding-top:5px;"); 599 inputBuscador.setAttribute("class", "form-control"); 600 inputBuscador.setAttribute("id", "text-search"); 601 inputBuscador.setAttribute("name", "textbuscador"); 602 inputBuscador.setAttribute("type", "text"); 603 inputBuscador.setAttribute("aria-labelledby", "textbuscador"); 604 inputBuscador.setAttribute("placeholder", "Ej.\"Colima\" o \"Popocat\u00e9petl\" o \"Avenida Vallarta #2750,Jalisco\""); 605 inputBuscador.setAttribute("onkeypress", "validaTecla(event);"); 606 btnElimnaBuscador = document.createElement("button"); 607 btnElimnaBuscador.setAttribute("style", "display:none"); 608 // btnElimnaBuscador.setAttribute("class", "btn fs-5 btn-light"); 609 //btnElimnaBuscador.setAttribute("class", "btn btn-secondary"); 610 btnElimnaBuscador.setAttribute("class", "btn btn-primary"); 611 btnElimnaBuscador.setAttribute("id", "removeResAPI"); 612 btnElimnaBuscador.setAttribute("name", "textbuscador"); 613 btnElimnaBuscador.setAttribute("type", "button"); 614 btnElimnaBuscador.setAttribute("arial-label", "Eliminar b\u00fasqueda"); 615 btnElimnaBuscador.setAttribute("onclick", "limpiarResAPIgeo()"); 616 spanBuscadorelimina = document.createElement("span"); 617 spanBuscadorelimina.setAttribute("class", "inegi-cerrar"); 618 spanBuscadorelimina.setAttribute("aria-hidden", "true"); 619 btnElimnaBuscador.appendChild(spanBuscadorelimina); 620 btnElimnaBuscador.setAttribute("data-bs-toggle", "tooltip"); 621 btnElimnaBuscador.setAttribute("data-bs-original-title", "Cerrar"); 622 divBuscador.appendChild(inputBuscador); 623 divBuscador.appendChild(btnElimnaBuscador); 624 btnFindBuscador = document.createElement("button"); 625 // btnFindBuscador.setAttribute("style", "display:none"); 626 // btnFindBuscador.setAttribute("class", "btn fs-5 btn-light"); 627 // btnFindBuscador.setAttribute("class", "btn btn-secondary"); 628 btnFindBuscador.setAttribute("class", "btn btn-primary"); 629 btnFindBuscador.setAttribute("id", "btnbuscar"); 630 btnFindBuscador.setAttribute("data-bs-toggle", "tooltip"); 631 btnFindBuscador.setAttribute("data-bs-original-title", "Buscar"); 632 btnFindBuscador.setAttribute("type", "button"); 633 btnFindBuscador.setAttribute("arial-label", "Buscar"); 634 btnFindBuscador.setAttribute("onclick", "buscar();"); 635 spanBuscadorFind = document.createElement("span"); 636 spanBuscadorFind.setAttribute("class", "inegi-buscar"); 637 spanBuscadorFind.setAttribute("aria-hidden", "true"); 638 btnFindBuscador.appendChild(spanBuscadorFind); 639 divBuscador.appendChild(btnFindBuscador); 640 // divBuscador.appendTo('#panelizq'); 641 642 $('#panelizq')[0].appendChild(divBuscador); 643 // $('<div>', { 644 // 'style': 'padding-top:5px', 645 // 'class': 'input-group mb-3' 646 // }).append( 647 // $('<input>', { 648 // 'id': 'text-search', 649 // 'type': 'text', 650 // 'name': 'textbuscador', 651 // 'class': 'form-control ', 652 // 'aria-labelledby': 'textbuscador', 653 // 'placeholder': 'Ej."Colima" o "Popocat\u00e9pet" o "Avenida Vallarta #2750,Jalisco"', 654 // 'onkeypress': 'validaTecla();', 655 // // 'style': 'width: 80%;margin-right: 5px;' 656 // })).append( 657 // $('<div>', { 658 //'class': 'btn-group fs-5', 659 // 'role':'group', 660 //'aria-label':'Buscador', 661 // 'style': 'display:flex;' 662 //}).append( 663 // $('<button>', { 664 // 'id': 'removeResAPI', 665 // 'type': 'button', 666 // 'class': 'btn fs-5 btn-light', 667 // 'onclick': 'limpiarResAPIgeo()', 668 // 'style': 'display:none', 669 // 'arial-label': 'Eliminar b\u00fasqueda', 670 // //'data-toggle': 'tooltip' 671 // }).append( 672 // $('<span />', { 673 // 'class': 'inegi-cerrar', 674 // 'aria-hidden': 'true' 675 // })), 676 // $('<button>', { 677 // 'id': 'btnbuscar',
678 // 'type': 'button', 679 // 'class': 'btn fs-5 btn-light', 680 // 'onclick': 'buscar();', 681 // 'arial-label': 'Buscar', 682 // 'data-bs-toggle': 'tooltip', 683 // 'data-bs-original-title': 'Buscar' 684 // }).append( 685 // $('<span />', { 686 // 'class': 'inegi-buscar', 687 // 'aria-hidden': 'true' 688 // }))), 689 // $('<button>', { 690 // 'id': 'collapse_tool_capasClose', 691 // 'type': 'button', 692 // 'class': 'btn fs-5 btn-light', 693 // 'style': 'top:8px;z-index:200;left:5px;', 694 // 'aria-label': 'Ocultar listado de capas y otras opciones', 695 // 'data-bs-toggle': 'tooltip', 696 // 'data-bs-original-title': (idioma === 'es') ? 'Ocultar listado de capas y otras opciones' : 'Hide list of layers and other options' 697 // }).append( 698 // $('<span />', { 699 // 'class': 'inegi-nav-izq', 700 // 'aria-hidden': 'true' 701 // }))), 702 // ).appendTo('#panelizq'); 703 704 console.log("crea boton colaplse"); 705 btnColaps = document.createElement("button"); 706 btnColaps.setAttribute("style", "top:8px;z-index:200;left:5px;position:absolute;"); 707 btnColaps.setAttribute("class", "btn fs-5 btn-light"); 708 btnColaps.setAttribute("id", "collapse_tool_capasClose"); 709 btnColaps.setAttribute("aria-label", "Ocultar listado de capas y otras opciones"); 710 btnColaps.setAttribute("data-bs-toggle", "tooltip"); 711 btnColaps.setAttribute("onclick", "ocultabtnColapsClose()"); 712 if (idioma === "es") 713 btnColaps.setAttribute("data-bs-original-title", "Ocultar listado de capas y otras opciones"); 714 else 715 btnColaps.setAttribute("data-bs-original-title", "Hide list of layers and other options"); 716 var spancolap = document.createElement("span"); 717 718 spancolap.setAttribute("class", "inegi-nav-izq"); 719 spancolap.setAttribute("aria-hidden", "true"); 720 btnColaps.appendChild(spancolap); 721 722 723 724 725 726 727 728 729 $('#map2D')[0].appendChild(btnColaps); 730 731 732 733 $('#collapse_tool_capasClose').click(function () { 734 $('#panelizq')[0].style.display = "none"; 735 $('#mapa')[0].setAttribute("style", "width:100%!important"); 736 $('#iconPanelCapas').show(500); 737 $('#panelizq').hide(500); 738 $('#disabledScreen').hide(); 739 iMap.getMap().updateSize(); 740 }); 741 742 /* 743 if ($(window).width() > 1200) { 744 // if (tem === "2542") { 745 // if (window.location.pathname.indexOf('50000') !== -1) { 746 // $('<div>', { 747 // 'position': 'absolute', 748 // 'style': 'float:left;margin-left:90%;margin-top:-35px' 749 //}). 750 // append( 751 // $('<button>', { 752 // 'id': 'collapse_tool_capasClose', 753 // 'class': "glyphicon glyphicon-menu-left btn btn-defmapa ", 754 // 'data-toggle': 'tooltip', 755 // 'data-placement': 'bottom', 756 // 'data-original-title': 'Ocultar listado de capas y otras opciones' 757 758 // })).appendTo('#panelizq'); 759 760 $('#collapse_tool_capasClose').click(function () { 761 console.log("entra a colapsar"); 762 $('#panelizq')[0].style.display = "none"; 763 $('#mapa')[0].setAttribute("style", "width:100%!important"); 764 $('#map2D').css({ 'height': '100%' }); 765 $('#iconPanelCapas').show(500); 766 //$('#panelizq').animate({ width: "10px" }, 500) 767 $('#panelizq').hide(500); 768 $('#disabledScreen').hide(); 769 // $('#collapse_tool_capasClose').setAttribute("class","inegi-nav-der"); 770 771 772 }); 773 //} 774 } 775 */ 776 777 $('<div>', { 778 'id': 'div_resultGeo', 779 'role': 'tabpanel', 780 'aria-labelledby': 'a_resultGeo', 781 //'style': 'overflow-y: auto;font-size: 14px' 782 'style': 'font-size: 14px;'//overflow-y: auto;max-height:200px' 783 }).append( 784 $('<div>', { 785 'id': 'resultAPI', 786 'class': 'absol notranslate', 787 }).append( 788 $('<div>', { 789 'id': 'panelResultAPI' 790 // 'class': 'panel-body submenu-nav', 791 })).append( 792 $('<div>', { 793 'id': 'imgCargandoResultApi', 794 'style': 'display:none', 795 }).append( 796 $('<center>', { 797 'id': 'centerload' 798 }).append( 799 $('<img>', { 800 'alt': 'En espera', 801 'src': '/componentes/espaciov2/v2/images/loading.gif'
802 803 })))).append( 804 $('<div>', { 805 'id': 'resultAPIEnt', 806 'class': 'resAPIent' 807 }))).appendTo('#panelizq'); 808 if (idioma === 'en') { 809 $('#removeResAPI').attr("title", "Delete"); 810 $('#btnbuscar').attr("title", "Search"); 811 $('#collapse_tool_capasClose').attr("title", "Hide list of layers and other options"); 812 $('#iconPanelCapas').attr("title", "See list of layers and other options"); 813 814 815 } 816 } 817 if ($('#collapse_tool_capasClose')) 818 ////Div para las capas y tablas seg�n sea el tema 819 //$('<div>', { 820 // 'id': 'layer1' 821 // // 'style': 'max-height:' + ($('#map2D').height() )+ 'px;overflow-y:auto' 822 //}).appendTo('#panelizq'); 823 824 825 //validación de mg nuevo se publica despues del 23-06-23 826 827 if (window.location.pathname !== '/temas/mg/') {//Si es MG no entra 828 $('<div>', { 829 'id': 'layer1' 830 }).appendTo('#panelizq'); 831 } 832 833 else { 834 fetch('/componentes/espaciov2/v2/json/MG_not_layer.json') 835 .then(response => response.json()) 836 .then(data => { filejson = data; }) 837 .catch(error => console.log(error), filejson = null); 838 839 addFiltros(); 840 //$('#divbuscador').css('display', 'none'); 841 $('#accordion').on('hidden.bs.collapse', toggleAccordion); 842 $('#accordion').on('shown.bs.collapse', toggleAccordion); 843 } 844 845 846 847 848 849 850 if (idioma === "en") { 851 $('#divimprimir').attr({ 'title': 'Download' }); 852 } 853 854 855 if (TipoTema === "ET") { 856 ElementsET(); 857 } 858 859 //if ((TipoTema !== "ET") || (TipoTema !== "E")) { 860 // $('<div>', { 861 // 'id': 'ID_DIV', 862 // 'style': 'display:none' 863 // }).appendTo(document.body); 864 // configura("#ID_DIV").init(); 865 //} 866 867 if ((TipoTema === "ET") || (TipoTema === "E")) { 868 $('<div>', { 869 'id': 'ID_DIV', 870 'style': 'display:none' 871 }).appendTo(document.body); 872 configura("#ID_DIV").init(); 873 } 874 OverlayMapa(TipoTema); 875 876 LoadMap(zoom, lat, lon, tema, TipoTema, mapavInicial, escalas); 877 878} 879 880 881//function validaTecla() { 882// $("#text-search").keyup(function () { 883// if ($("#text-search").val() === "") { 884// $("#removeResAPI").hide(); 885// //console.log("vacio"); 886// } 887// else { 888// tecla = (document.all) ? event.keyCode : event.which; 889// if (tecla === 13) { 890 891 892// event.cancelBubble = true; 893// event.returnValue = false; 894// buscar(); 895 896// // buscarAll(); 897// return false; 898// //mostrarResultadosPanel('AG'); 899 900// } 901// $("#removeResAPI").show(); 902// // console.log("keyup"); 903// } 904// }); 905 906//} 907 908function validaTecla(event) { 909 tecla = (document.all) ? event.keyCode : event.which; 910 if (tecla === 13) { 911 event.cancelBubble = true; 912 event.returnValue = false; 913 buscar(); 914 return false; 915 } 916 else if ((tecla == 8) && ($('#search-text').val().length < 2)) { 917 $("#removeResAPI").hide(); 918 } 919 else if (!$('#removeResAPI').is(':visible')) 920 $("#removeResAPI").show(); 921} 922 923function LoadMap(zoom, lat, lon, tema, TipoTema, mapavInicial, escalas) { 924 setTimeout(function () { 925 $(document).ready(function () { 926 //Eliminar un elelemento link de "Archivos para descarga " de cada tema que actualemnte estan en texto blanco para ocultarlo. 927 $("#archDescargaTitulo").remove(); 928 929 $.getScript("/componentes/productos/react/js/mapas.min.js?v=0.0.0"); 930 if (window.innerWidth <= 649) { 931 $('[data-toggle="tooltip"]').click(function () { 932 $('[data-toggle="tooltip"]').tooltip("hide"); 933 934 }); 935 } 936 var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')) 937 var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) { 938 return new bootstrap.Tooltip(tooltipTriggerEl) 939 }); 940 // console.log(tooltipList); 941 942 }); 943 $('.nav-link').each(function (i, obj) { 944 if (obj.id) { 945 if (obj.id !== "mapas") { 946 $(this).on("click", function () { 947 if (popover2 !== null) { 948 popover2.hide(); 949 } 950 if (popover3 !== null) { 951 popover3.hide(); 952 } 953 if (popover4 !== null) { 954 popover4.hide(); 955 } 956 }); 957 } 958 else { 959 $(this).on("click", function () { 960 if (popover2 !== null) { 961 popover2.show(); 962 } 963 if (popover3 !== null) { 964 popover3.show(); 965 } 966 if (popover4 !== null) { 967 popover4.show(); 968 } 969 }); 970 } 971 } 972 }); 973 }, 2000); 974 herramientas(); 975 urlsGS = new GeoServerURLsFactory(urlGeoServerINEGI); 976 iMap = new INEGIMap('map2D', lat, lon, zoom); 977 olMap = iMap.getMap(); 978 olView = iMap.getCurrentView(); 979 /****************************************************Agregar mapa WMS******************************************************************/ 980 var mdmINEGISource = new ol.source.TileWMS({ 981 preload: Infinity, 982 url: '/app/mapa/espacioydatos/servicios/cdteyd.ashx?https://gaiamapas.inegi.org.mx/mdmCache/service/wms?', 983 serverType: 'geoserver', 984 params: { 'LAYERS': 'MapaBaseTopograficov61_sinsombreado', 'TILED': 'true', 'FORMAT': 'image/jpeg', 'SRS': 'EPSG:3857', 'URLTEMAORIGEN': urltemaorigen } //LGT 985 , 986 tileLoadFunction: function (tile, src) { 987 index = src.indexOf("&WIDTH="); 988 var widthnopx = src.substring((index + 7), (index + 10)); 989 indexh = src.indexOf("&HEIGHT="); 990 var heightnox = src.substring((indexh + 8), (indexh + 11)); 991 src = src.replace('WIDTH=' + widthnopx, 'WIDTH=256'); 992 src = src.replace('HEIGHT=' + heightnox, 'HEIGHT=256'); 993 tile.getImage().src = src; 994 995 } 996 });
997 998 /*WMTS Topo*/ 999 const projection = new ol.proj.get(iMap.getCurrentProjection()); 1000 const projectionExtent = projection.getExtent(); 1001 const size = ol.extent.getWidth(projectionExtent) / 256; 1002 var resolutions = new Array(19); 1003 var matrixIds = new Array(19); 1004 for (var z = 0; z < 19; ++z) { 1005 resolutions[z] = size / Math.pow(2, z); 1006 matrixIds[z] = "EPSG:3857:" + z; 1007 } 1008 1009 var tileGrid = new ol.tilegrid.WMTS({ 1010 origin: ol.extent.getTopLeft(projection.getExtent()), 1011 resolutions: resolutions, 1012 matrixIds: matrixIds, 1013 extent: iMap.getMap().getView().calculateExtent(iMap.getMap().getSize()) 1014 }); 1015 1016 console.log(tema); 1017 1018 1019//function validacionTema() { 1020 1021// if( tema === '2620') 1022// return 'cnit_50k_mapa_base:cnit50k_1968_2018_sin_nombres' ; 1023// else 1024// return 'cnit_50k_mapa_base:cnit50k_1968_2018'; 1025 1026//} 1027 1028 1029//function validacionPrograma(){ 1030 1031 function validacion() { 1032 // if ((tema === "186" && location.pathname.indexOf('programas/topografia/50000/') > -1) || (tema === "193") || (tema === "194") || (tema === "197")) 1033 if ((tema === "186" ) || (tema === "193") || (tema === "194") || (tema === "197")) 1034 return 'cnit50k'; 1035 if (tema === '2620') 1036 return 'cnit_50k_mapa_base:cnit50k_1968_2018_sin_nombres'; 1037 else 1038 return 'cnit_50k_mapa_base:cnit50k_1968_2018'; 1039 1040} 1041 1042 1043 1044 1045 1046 var mdmINEGISourcetopo = new ol.source.WMTS({ 1047 url: '/app/mapa/espacioydatos/servicios/cdteyd.ashx?' + 'https://gaia.inegi.org.mx/geoserver/cnit_50k_mapa_base/gwc/service/wmts?', 1048 useInterimTilesOnError: false, 1049 layer: validacion(), 1050 // layer: tema === '2620' ? 'cnit_50k_mapa_base:cnit50k_1968_2018_sin_nombres' : 'cnit_50k_mapa_base:cnit50k_1968_2018', 1051 // layer: tema === '186' ? 'cnit50k' : 'cnit50k', 1052 matrixSet: 'EPSG:3857', 1053 format: 'image/png', 1054 version: '1.0.0', 1055 projection: projection, 1056 tileGrid: tileGrid, 1057 style: '', 1058 zoomOffset: 5, 1059 dimensions: { 1060 'threshold': 100 1061 } 1062 1063 }); 1064 1065 var mapaBaseTopo = new MapBase('inegitopo', 'mapa base topo', mdmINEGISourcetopo); 1066 iMap.addMapBase(mapaBaseTopo); 1067 1068 var mapaBaseINEGI = new MapBase('inegi', 'mapa base inegi gaia mapas', mdmINEGISource); 1069 iMap.addMapBase(mapaBaseINEGI); 1070 1071 var gmaps_roadmapNames = new ol.source.TileImage({ url: 'https://mt1.google.com/vt/lyrs=h&x={x}&y={y}&z={z}', crossOrigin: "Anonymous" }); 1072 var mb_gmaps_roadmapNames = new MapBase('Google Road Names', 'Google Road Names', gmaps_roadmapNames); 1073 iMap.addMapBase(mb_gmaps_roadmapNames); 1074 1075 var gmaps_satRoads = new ol.source.TileImage({ url: 'https://mt1.google.com/vt/lyrs=y&x={x}&y={y}&z={z}', crossOrigin: "Anonymous" }); 1076 var mb_gmaps_satRoads = new MapBase('Google Satellite & Roads', 'Google Satellite & Roads', gmaps_satRoads); 1077 iMap.addMapBase(mb_gmaps_satRoads); 1078 1079 1080 //var gmaps_sat = new ol.source.TileImage({ url: 'https://khms1.googleapis.com/kh?v=821&hl=es-419&x={x}&y={y}&z={z}', crossOrigin: "Anonymous" }); 1081 var gmaps_sat = new ol.source.TileImage({ url: 'https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}', crossOrigin: "Anonymous" }); 1082 var mb_gmaps_roadmap = new MapBase('Google Satelite', 'Google Satelite', gmaps_sat); 1083 iMap.addMapBase(mb_gmaps_roadmap);//sin etiquetas 1084 1085 1086 var gmaps_terrain = new ol.source.TileImage({ url: 'https://mt1.google.com/vt/lyrs=t&x={x}&y={y}&z={z}', crossOrigin: "Anonymous" }); 1087 var mb_gmaps_terrain = new MapBase('Google Terrain', 'Google Terrain', gmaps_terrain); 1088 iMap.addMapBase(mb_gmaps_terrain); 1089 1090 var gmaps_terrainR = new ol.source.TileImage({ url: 'https://mt1.google.com/vt/lyrs=p&x={x}&y={y}&z={z}', crossOrigin: "Anonymous" }); 1091 var mb_gmaps_terrainR = new MapBase('Google Terrain & Roads', 'Google Terrain & Roads', gmaps_terrainR); 1092 iMap.addMapBase(mb_gmaps_terrainR); 1093 1094 1095 var gmaps_roadmapNB = new ol.source.TileImage({ url: 'https://mt1.google.com/vt/lyrs=r&x={x}&y={y}&z={z}', crossOrigin: "Anonymous" }); 1096 var mb_gmaps_roadmapNB = new MapBase('Google Road without Building', 'Google Road without Building', gmaps_roadmapNB); 1097 iMap.addMapBase(mb_gmaps_roadmapNB); 1098 1099 var gmaps_roadmap = new ol.source.TileImage({ url: 'https://mt1.google.com/vt/lyrs=m&x={x}&y={y}&z={z}', crossOrigin: "Anonymous" }); 1100 var mb_gmaps_roadmapM = new MapBase('Google Road Map', 'Google Road Map', gmaps_roadmap); 1101 iMap.addMapBase(mb_gmaps_roadmapM); 1102 1103 var Geoserver = new ol.source.TileWMS({ 1104 preload: Infinity, 1105 url: '/app/mapa/espacioydatos/servicios/cdteyd.ashx?' + urlGeoServerINEGI + '/Sitio_Inegi/wms?', 1106 serverType: 'geoserver', 1107 params: { 'LAYERS': 'mapa_base', 'STYLE': '', 'TILED': 'true', 'FORMAT': 'image/png', 'TRANSPARENT': 'fal
1107se', 'BGCOLOR': '0x00BFFF', 'SRS': 'EPSG:4326' } 1108 , tileLoadFunction: function (tile, src) { 1109 index = src.indexOf("&WIDTH="); 1110 var widthnopx = src.substring((index + 7), (index + 10)); 1111 indexh = src.indexOf("&HEIGHT="); 1112 var heightnox = src.substring((indexh + 8), (indexh + 11)); 1113 src = src.replace('WIDTH=' + widthnopx, 'WIDTH=256'); 1114 src = src.replace('HEIGHT=' + heightnox, 'HEIGHT=256'); 1115 tile.getImage().src = src; 1116 } 1117 }); 1118 1119 var mapaBaseGeo = new MapBase('Geoserver', 'mapa base Geoserver', Geoserver); 1120 iMap.addMapBase(mapaBaseGeo); 1121 1122 flagload = true; 1123 1124 if (mapavInicial === '') 1125 mapaBase('inegi'); 1126 //iMap.setMapBase('inegi'); 1127 else 1128 mapaBase('' + mapavInicial + ''); 1129 //iMap.setMapBase('' + mapavInicial + ''); 1130 1131 1132 1133 //if (!$('#tools-container').is(':visible')) { 1134 gmaps_sat.on('tileloadend', function () { 1135 idioma != 'en' ? $("#tituloMapaBase").html("Mapa base <br/> Sat\u00e9lite de Google") : $("#tituloMapaBase").html("Base maps<br/> Sat\u00e9lite de Google"); 1136 1137 $("#divBusquedas, #spanConsultando, #btn_cancelConsulta, #infowindow, #divControlzoom, #tools-container").show(); 1138 }); 1139 gmaps_sat.on('tileloaderror', function () { 1140 iMap.setMapBase('inegi'); 1141 idioma != 'en' ? $("#tituloMapaBase").html("Mapa base <br/> INEGI") : $("#tituloMapaBase").html("Base maps <br/> INEGI"); 1142 1143 mdmINEGISource.on('tileloadend', function () { 1144 $("#divBusquedas, #spanConsultando, #btn_cancelConsulta, #infowindow, #divControlzoom, #tools-container").show(); 1145 }); 1146 mdmINEGISource.on('tileloaderror', function () { 1147 $("#divBusquedas, #spanConsultando, #btn_cancelConsulta, #infowindow, #divControlzoom, #tools-container").show(); 1148 }); 1149 }); 1150 gmaps_roadmap.on('tileloaderror', function () { 1151 iMap.setMapBase('inegi'); 1152 idioma != 'en' ? $("#tituloMapaBase").html("Mapa base <br/> INEGI") : $("#tituloMapaBase").html("Base maps<br/> INEGI"); 1153 }); 1154 1155 mdmINEGISource.on('tileloaderror', function () { 1156 //iMap.setMapBase('Google Satelite'); 1157 iMap.setMapBase('Geoserver'); 1158 1159 idioma != 'en' ? $("#tituloMapaBase").html("Mapa base <br/> Satélite de Google") : $("#tituloMapaBase").html("Base maps <br/> Satélite de Google") 1160 }); 1161 mdmINEGISourcetopo.on('tileloaderror', function () { 1162 iMap.setMapBase('Geoserver'); 1163 idioma != 'en' ? $("#tituloMapaBase").html("Mapa base <br/> Satélite de Google") : $("#tituloMapaBase").html("Base maps <br/> Satélite de Google") 1164 }); 1165 //} 1166 1167 1168 if (TipoTema === "E")//Caso especial para gnss carga de overlay con wms 1169 { 1170 //console.log("tema E"); 1171 // idiomaDominio = window.location.hostname.indexOf("en.") > -1 ? "en." : ""; 1172 direccionSegmentada = C_direccionServicio_V.split("://"); 1173 var tmpDireccionServicio = direccionSegmentada[0] + "://" + direccionSegmentada[1]; 1174 C_direccionServicio_V = tmpDireccionServicio; 1175 1176 temaInicial = tema; 1177 var versionApi = "/API.svc/NodosTemas/00/es/"; 1178 // if (dominio[0] === "en") { 1179 if (idioma === "en") { 1180 // console.log("entra"); 1181 versionApi = "/API.svc/NodosTemas/00/en/"; 1182 } 1183 else { console.log("no entra") } 1184 1185 1186 $.ajax({
1187 contentType: "application/json", 1188 dataType: "json", 1189 method: "GET", 1190 // url: C_direccionServicio_V + "_" + API_V + versionApi + tema + "/null/null/1/6/false/2/json/" + token, 1191 url: C_direccionServicio_V + "_v1_3" + versionApi + tema + "/null/null/1/6/false/2/151/json/97e14b4f-c4d7-468b-f353-38ffaddb3b7c", 1192 cache: false, 1193 success: function (TemaIndicador) { 1194 // console.log(TemaIndicador); 1195 //for (var i = 0; i < TemaIndicador.length; i++) { 1196 // if (TemaIndicador[i].tipoNodo === "TEMA") { 1197 // subtema = TemaIndicador[i].tema.; 1198 // } 1199 //} 1200 // if (tem.charAt(6) !== "0") //Es subsubtema 1201 if ((tem.charAt(6) !== "0") || ((tem.charAt(5) !== "0"))) { //18/04/17--Ajuste para que funcione el tema de recursos tomando en cuenta que el subtema sea 10 1202 SSubtemaIndicador(TemaIndicador); 1203 } 1204 else { //Es Subtema 1205 subtema = TemaIndicador; 1206 SubtemaIndicador(TemaIndicador); 1207 } 1208 }, 1209 complete: function () { 1210 ListaInd("layer1"); 1211 var_JsonViviendas = primeriden; 1212 VerIndicador(idname, primeriden, primdesglose); 1213 $('[data-toggle="tooltip"]').tooltip(); 1214 }, 1215 1216 async: true 1217 }); 1218 1219 1220 1221 //var div = document.createElement("button");//Div que contiene el boton de regresar a nivel municipal en los tem�ticos 1222 //div.setAttribute("id", "Div_Reg"); 1223 //div.setAttribute("class", "btn btn-primary"); 1224 //////div.setAttribute("style", "margin-bottom: 10px;margin-top:10px;margin-right:3px"); 1225 //// div.setAttribute("style", "background-color:white"); 1226 ////div.className = "ol-full-screen ol-unselectable ol-control"; 1227 1228 1229 1230 1231 //$('#map2D')[0].appendChild(div); 1232 //div1 = document.createElement("div");//Div que contiene la imagen de Ver M�s 1233 //div1.setAttribute("id", "Div_VMas"); 1234 ////div1.setAttribute("class", "btn btn-primary"); 1235 1236 //var img = document.createElement("img"); 1237 //if (idioma === "es") 1238 // img.setAttribute("src", "/componentes/espaciov2/Images/VMas.png"); 1239 //else 1240 // img.setAttribute("src", "/componentes/espaciov2/Images/VMas-en.png"); 1241 ////img.setAttribute("src", "/componentes/espaciov2/Images/VMas.png"); 1242 //img.setAttribute("id", "Img_VMas"); 1243 ////img.setAttribute("style", "cursor:pointer;border-radius:2px;"); 1244 //div1.setAttribute("onclick", "Genrahref()"); 1245 //div1.appendChild(img); 1246 1247 1248 //$('#map2D')[0].appendChild(div); 1249 //console.log("mapa"); 1250 //$('#map2D')[0].appendChild(div1); 1251 } 1252 else if (TipoTema !== "ET") { 1253 if (window.location.pathname !== '/temas/mg/') {//Si es MG no entra 1254 crearMenuCapas(); 1255 } 1256 else { 1257 menuCapas(); 1258 1259 } 1260 // crearMenuCapas(); 1261 1262 //if (tema === "196" || (tema === "195") || (tema === "204" )) 1263 //{ 1264 // /*LGTV---se agrega para la opción de descarga*/ 1265 // var divDescarga = document.createElement("button");//Botón para la Descarga 1266 // divDescarga.setAttribute("id", "Div_Descarga"); 1267 // divDescarga.setAttribute("data-bs-toggle", "tooltip"); 1268 // if (idioma === "es") 1269 // divDescarga.setAttribute("data-bs-original-title", "Descarga"); 1270 // else 1271 // divDescarga.setAttribute("data-bs-original-title", "Download"); 1272 1273 // var span = document.createElement("span"); 1274 // //img.setAttribute("src", "/componentes/espacio/Images/VMas.png"); 1275 // // divDescarga.setAttribute('class', "btn fs-5 btn-light tool-icon") 1276 // divDescarga.setAttribute('class', "btn fs-5 btn-light"); 1277 // // divDescarga.setAttribute("style", "display:flex;justify-content:center;position:absolute;top:1.4%;right:11%;"); 1278 // divDescarga.setAttribute("style", "position:absolute;top:1.6%;right:11%;"); 1279 // span.setAttribute("id", "Img_Descarga"); 1280 // span.setAttribute("class", "inegi-descarga"); 1281 // // span.setAttribute("style", "font-size: 17pt"); 1282 // span.setAttribute("onclick", "showPanelDescarga()"); 1283 // divDescarga.appendChild(span); 1284 // console.log("descarga"); 1285 // $('#map2D')[0].appendChild(divDescarga); 1286 1287 1288 // let navegador = navigator.userAgent; 1289 // if (navegador.match(/Android/i) || navegador.match(/webOS/i) || navegador.match(/iPhone/i) || navegador.match(/iPad/i) || navegador.match(/iPod/i) || navegador.match(/BlackBerry/i) || navegador.match(/Windows Phone/i)) { 1290 1291 // elemento = document.getElementById('Div_Descarga'); 1292 // elemento.style.display = 'none'; 1293 1294 // } 1295 1296 1297 1298 //} 1299 1300 1301 1302 } 1303 1304 barraEscalas(escalas); 1305 resizeMap();
1306 agregarOverlayPopUp(iMap); 1307 $("#layer-button").click(function (e) { 1308 $('#panelizq').addClass('panelactive'); 1309 $('#OcultaPanel').show(); 1310 }); 1311 $('#OcultaPanel').click(function (e) { 1312 $('#panelizq').removeClass('panelactive'); 1313 $('#layer-button').show(); 1314 $('#OcultaPanel').hide(); 1315 $('#panelizq')[0].style.display = "none"; 1316 1317 }); 1318 //$('#zoom').text('5'); 1319 1320 olView.on('propertychange', olViewPropertyChange); 1321 olMap.on('moveend', iMapMoveend); 1322 if (window.location.pathname === '/temas/mg/') 1323 inicializarHerramientas(iMap); 1324 1325 if ((window.location.pathname.indexOf('topografia') !== -1) || (window.location.pathname.indexOf('usyvia') !== -1) || (window.location.pathname.indexOf('geografia') !== -1)) 1326 $('#collapse_tool_capasClose')[0].click(); 1327 flagload = false; 1328 1329} 1330function iMapMoveend(e) { 1331 1332 $('#zoom').html(zoom); 1333 1334} 1335 1336function olViewPropertyChange(e) { 1337 switch (e.key) { 1338 case 'resolution': 1339 olViewResolutionChange(e); 1340 break; 1341 } 1342} 1343 1344function olViewResolutionChange(e) { 1345 var lyrs = olMap.getLayers(); 1346 var lyr = null; 1347 var lyrType = null; 1348 zoom = olView.getZoom(); 1349 //reglas de negocio para capas 1350 var zlyr = 0; 1351 var vlyr = false; 1352 //*************************** RECORRE LAS CAPAS CON EL CAMBIO DE ZOOM ***************************// 1353 if (typeof nodosCapas !== "undefined") { 1354 if (nodosCapas) { 1355 $.each(nodosCapas, function (idx, obj) { 1356 if (obj.capas) { 1357 $.each(obj.capas, function (idx, obj1) { 1358 if (obj1.zoomInicial <= zoom) { 1359 $('#checkcapa' + obj1.id_nodoCapa + ', #checkcapa' + obj1.id_nodoCapa + 'Active').removeClass('alert-zoom').addClass('cursor-pointer'); 1360 $('#spancapa' + obj1.id_nodoCapa + ', #spancapa' + obj1.id_nodoCapa + 'Active').removeClass('alert-zoom').addClass('cursor-pointer'); 1361 // get the current tooltip content 1362 var titleC = document.getElementById('capa' + obj1.id_nodoCapa).dataset.originalTitle; 1363 if ((titleC !== undefined) && (titleC !== "")) { 1364 var nTitleC = titleC.replace('Se necesita un nivel de zoom ' + obj1.zoomInicial + ' para visualizar la capa', ''); 1365 // set the tooltip content 1366 document.getElementById('capa' + obj1.id_nodoCapa).dataset.originalTitle = nTitleC; 1367 } 1368 //$('#capa' + obj1.id_nodoCapa).tooltip('disable'); 1369 $('#checkcapa' + obj1.id_nodoCapa + ', #checkcapa' + obj1.id_nodoCapa + 'Active').removeAttr('disabled'); 1370 } 1371 //else if ((obj1.zoomInicial >= zoom) && ($('#checkcapa' + obj1.id_nodoCapa).hasClass("cursor-pointer"))) { 1372 // $('#checkcapa' + obj1.id_nodoCapa + ', #checkcapa' + obj1.id_nodoCapa + 'Active').removeClass('cursor-pointer').addClass('alert-zoom'); 1373 // $('#spancapa' + obj1.id_nodoCapa + ', #spancapa' + obj1.id_nodoCapa + 'Active').removeClass('cursor-pointer').addClass('alert-zoom'); 1374 // // get the current tooltip content 1375 // var titleC = document.getElementById('capa' + obj1.id_nodoCapa).dataset.originalTitle; 1376 // var nTitleC = (idioma === "en") ? 'You need the zoom level ' + obj1.zoomInicial + ' to display the layer \n' + titleC : 'Se necesita un nivel de zoom ' + obj1.zoomInicial + ' para visualizar la capa \n' + titleC; 1377 // // set the tooltip content 1378 // document.getElementById('capa' + obj1.id_nodoCapa).dataset.originalTitle = nTitleC; 1379 // $('#capa' + obj1.id_nodoCapa).tooltip('enable'); 1380 // $('#checkcapa' + obj1.id_nodoCapa + ', #checkcapa' + obj1.id_nodoCapa + 'Active').prop('disabled', true); 1381 //} 1382 else if ((obj1.zoomInicial > zoom) && ($('#checkcapa' + obj1.id_nodoCapa).hasClass("cursor-pointer"))) { 1383 $('#checkcapa' + obj1.id_nodoCapa + ', #checkcapa' + obj1.id_nodoCapa + 'Active').removeClass('cursor-pointer').addClass('alert-zoom'); 1384 $('#spancapa' + obj1.id_nodoCapa + ', #spancapa' + obj1.id_nodoCapa + 'Active').removeClass('cursor-pointer').addClass('alert-zoom'); 1385 // get the current tooltip content 1386 var titleC = document.getElementById('capa' + obj1.id_nodoCapa).dataset.originalTitle; 1387 var nTitleC = (idioma === "en") ? 'You need the zoom level ' + obj1.zoomInicial + ' to display the layer \n' + titleC : 'Se necesita un nivel de zoom ' + obj1.zoomInicial + ' para visualizar la capa \n' + titleC; 1388 // set the tooltip content 1389 document.getElementById('capa' + obj1.id_nodoCapa).dataset.originalTitle = nTitleC; 1390 var obj = $('#capa' + obj1.id_nodoCapa); 1391 if (obj != null) 1392 $('#capa' + obj1.id_nodoCapa).tooltip('enable'); 1393 $('#checkcapa' + obj1.id_nodoCapa + ', #checkcapa' + obj1.id_nodoCapa + 'Active').prop('disabled', true); 1394 } 1395 }); 1396 } 1397 });// end foreach 1398 } 1399 } 1400 //zoom = olView.getZoom(); 1401 if (TipoTema === "E") { 1402 if (mapaCalor !== null && mapaCalor !== undefined) { 1403 DelTipoRep(); 1404 crearMapaCalor(); 1405 } 1406 } 1407} 1408 1409 1410function agregarOverlayPopUp(iMap) { 1411 var element = document.getElementById('popup'); 1412 overlayPop = new ol.Overlay({ 1413 element: element, 1414 stopEvent: false, 1415 offset: [0, -10] 1416 });
1417 1418 overlayPop1 = new ol.Overlay({ 1419 element: document.getElementById('popup2'), 1420 stopEvent: false, 1421 offset: [0, -10], 1422 autoPan: false, 1423 autoPanAnimation: { 1424 duration: 250 1425 } 1426 }); 1427 iMap.getMap().addOverlay(overlayPop1); 1428 iMap.getMap().addOverlay(overlayPop); 1429 1430 1431} 1432 1433function InitPagMapa(zoom, lat, lon, tema, TipoT, mapavInicial, escalas) { 1434 TipoTema = TipoT; 1435 ElementMapa(zoom, lat, lon, tema, TipoTema, mapavInicial, escalas); 1436 //$('[data-toggle="tooltip"]').tooltip(); 1437 $('<div>', { 1438 'id': 'divimprimir', 1439 'arial-label': 'Descargar PDF', 1440 'onclick': 'pdf(2)', 1441 'style': 'z-index:999;cursor:pointer;float: right;left: 92%;', 1442 'data-bs-toggle': 'tooltip', 1443 'data-bs-original-title': 'Descargar PDF' 1444 //'class':'btn fs-5 btn-light' 1445 1446 }).append( 1447 $('<img>', { 1448 // 'class': 'inegi-descarga', 1449 //'aria-hidden':'true' 1450 'class': 'imgFormato', 1451 'src': '/img/ico/ico_pdf.png' 1452 })).appendTo('#td_descargar'); 1453 if (idioma === 'en') { 1454 1455 $('#divimprimir').attr("title", "Download PDF"); 1456 1457 } 1458 //$('[data-toggle="tooltip"]').tooltip(); 1459 if (TipoTema === "E") { 1460 $('<div>', { 1461 'id': 'divjson', 1462 'arial-label': 'Descargar GeoJSON', 1463 'onclick': 'downloadGeoJSON()', 1464 'style': 'z-index:999;cursor:pointer;float: right;left: 92%;', 1465 'data-bs-toggle': 'tooltip', 1466 //'class':'btn fs-5 btn-light' 1467 }).append( 1468 $('<img>', { 1469 // 'class': 'inegi-descarga', 1470 // 'aria-hidden':'true' 1471 'class': 'imgFormato', 1472 'src': '/img/ico/ico_geoJSON.png' 1473 })).appendTo('#td_descargar'); 1474 if (idioma === 'en') { 1475 1476 $('#divjson').attr("title", "Download GeoJSON"); 1477 1478 } 1479 1480 1481 1482 } 1483} 1484 1485 1486function mapaBase(mapa) { 1487 1488 //CargaMapasBase(); 1489 1490 $('#tituloMapaBase').text(""); 1491 1492 if (idioma === "es") { 1493 if (mapa === 'inegi') 1494 $('#tituloMapaBase').html("Mapa base <br/> INEGI"); 1495 if (mapa === 'inegitopo') 1496 $('#tituloMapaBase').html("Mapa base <br/> INEGI TopografÃa"); 1497 if (mapa === 'Google Terrain & Roads') 1498 $('#tituloMapaBase').html("Mapa base <br/>Terreno de Google"); 1499 if (mapa === 'osm') 1500 $('#tituloMapaBase').html("Mapa base <br/>Open Street Map"); 1501 if (mapa === 'Google Satelite')//if (mapa === 'Google Satellite & Roads') 1502 $('#tituloMapaBase').html("Mapa base <br/>Sat\u00e9lite de Google"); 1503 if (mapa === 'Google Road Map') 1504 $('#tituloMapaBase').html("Mapa base <br/>Mapa de Google"); 1505 } 1506 else { 1507 if (mapa === 'inegi') 1508 $('#tituloMapaBase').html("Base maps <br/> INEGI"); 1509 if (mapa === 'inegitopo') 1510 $('#tituloMapaBase').html("Base maps <br/> INEGI Topography"); 1511 if (mapa === 'Google Terrain & Roads') 1512 $('#tituloMapaBase').html("Base maps <br/> Google terrain"); 1513 if (mapa === 'osm') 1514 $('#tituloMapaBase').html("Base maps <br/> Open Street Map"); 1515 if (mapa === 'Google Satelite') 1516 $('#tituloMapaBase').html("Base maps <br/> Google satellite"); 1517 if (mapa === 'Google Road Map') 1518 $('#tituloMapaBase').html("Base maps <br/> Google maps"); 1519 1520 } 1521 if (flagload === false) { 1522 $('#MapasBase').slideToggle(1000); 1523 1524 } 1525 iMap.setMapBase(mapa); 1526 1527} 1528 1529function barraEscalas(listaEscalas) { 1530 1531 1532 if (listaEscalas === '') { 1533 var tableE = document.createElement("table"); 1534 tableE.setAttribute("width", "100%"); //$("#pestana").width() - 250 +"px"); 1535 var trT = document.createElement("tr"); 1536 var tdT = document.createElement("td"); 1537 tdT.setAttribute("class", "td_escalas_tit"); 1538 var tdTd = document.createElement("td"); 1539 tdTd.setAttribute("id", "td_descargar"); 1540 trT.appendChild(tdT); 1541 //ahuste de mg 1542 if (window.location.pathname === '/temas/mg/') 1543 tdTd.setAttribute("style", "display:none"); 1544 trT.appendChild(tdTd); 1545 tableE.appendChild(trT); 1546 $(tableE).insertBefore("#map2D"); 1547 } 1548 else { 1549 var tableE = document.createElement("table"); 1550 tableE.setAttribute("width", "100%"); //$("#pestana").width() - 250 +"px"); 1551 var trT = document.createElement("tr"); 1552 var tdT = document.createElement("td"); 1553 tdT.setAttribute("class", "td_escalas_tit"); 1554 // if (listaEscalas.length==1) 1555 tdT.setAttribute("colspan", listaEscalas.length + 1); 1556 //else 1557 // tdT.setAttribute("colspan", listaEscalas.length ); 1558 var divtxt = document.createElement("div"); 1559 divtxt.setAttribute("style", "width:85%;display: inline-block;"); 1560 var txtmsj1; 1561 var txtmsj2; 1562 1563 if (window.location.host.substring(0, 3) === 'en.') { 1564 var textnodeT = document.createTextNode("Select the scale for downloading maps"); 1565 txtmsj1 = "Available maps for download"; 1566 txtmsj2 = "Most downloaded available maps"; 1567 } 1568 else { 1569 var textnodeT = document.createTextNode("Seleccione la escala para la descarga de mapas,el check para ver cartas con información"); 1570 txtmsj1 = "Cartas disponibles para descarga"; 1571 txtmsj2 = "Cartas disponibles más descargadas"; 1572 } 1573 tdT.appendChild(divtxt); 1574 1575 var divd = document.createElement("div"); 1576 divd.setAttribute("id", "td_descargar"); 1577 divd.setAttribute("style", "display: inline");
1578 //divtxt.appendChild(textnodeT); 1579 //tdT.appendChild(textnodeT); 1580 tdT.appendChild(divd); 1581 trT.appendChild(tdT); 1582 //var tdTd = document.createElement("td"); 1583 //tdTd.setAttribute("id", "td_descargar"); 1584 //trT.appendChild(tdTd); 1585 1586 1587 1588 tableE.appendChild(trT); 1589 var trE = document.createElement("tr"); 1590 var tdE = document.createElement("td"); 1591 tdE.setAttribute("class", "td_escalas_text"); 1592 1593 if (window.location.host.substring(0, 3) === 'en.') { 1594 var textnode = document.createTextNode("Scales: "); 1595 var check = document.createElement("INPUT"); 1596 check.setAttribute("type", "checkbox"); 1597 check.setAttribute("id", "checkbox"); 1598 check.setAttribute("class", "form-check-input"); 1599 } else { 1600 // var textnode = document.createTextNode("Escalas: "); 1601 var textnode = document.createTextNode("Escala: "); 1602 var check = document.createElement("INPUT"); 1603 check.setAttribute("type", "checkbox"); 1604 check.setAttribute("id", "checkbox"); 1605 check.setAttribute("class", "form-check-input"); 1606 } 1607 tdE.appendChild(textnode); 1608 //tdE.appendChild(check); 1609 trE.appendChild(tdE); 1610 for (var e = 0; e < listaEscalas.length; e++) { 1611 1612 var tdE = document.createElement("td"); 1613 tdE.setAttribute("class", "td_escalas"); 1614 var idTd = listaEscalas[e].replace(":", "_").replace(" ", "").replace(" ", ""); 1615 tdE.setAttribute("id", "td" + idTd); 1616 // if (listaEscalas.length === 1) 1617 // tdE.setAttribute("colspan", listaEscalas.length + 1); 1618 1619 var textnode = document.createTextNode(listaEscalas[e]); 1620 tdE.appendChild(textnode); 1621 1622 tdE.onclick = function (escala) { 1623 // console.log(escala); 1624 return function () { 1625 //iniciaMalla('1:1 000 000','1M',false); 1626 iniciaMalla(escala, escala.substring(2, 4).trim() + 'M', false); 1627 }; 1628 }(listaEscalas[e]); 1629 trE.appendChild(tdE); 1630 } 1631 tableE.appendChild(trE); 1632 $(tableE).insertBefore("#map2D"); 1633 1634 //Mensaje para las mallas 1635 $('<div>', { 1636 'id': 'divmensajemalla', 1637 'style': 'width:15px; height:15px;background-color:rgba(101,172,155,0.2);margin-top:5px;display: -webkit-inline-box;' 1638 }).appendTo('#mapa'); 1639 $('<div>', { 1640 'id': 'divTextmalla', 1641 'style': 'padding-left:5px;display: -webkit-inline-box;' 1642 }). 1643 appendTo('#mapa'); 1644 $('#divTextmalla')[0].innerText = txtmsj1; 1645 $('<br>').appendTo('#mapa'); 1646 $('<div>', { 1647 'id': 'divmensajemallamas', 1648 'style': 'width:15px; height:15px;background-color:rgba(211, 239, 199, 0.8);margin-top:5px;display: -webkit-inline-box;' 1649 }).appendTo('#mapa'); 1650 $('<div>', { 1651 'id': 'divTextmallamas', 1652 'style': 'padding-left:5px;display: -webkit-inline-box;' 1653 }). 1654 appendTo('#mapa'); 1655 $('#divTextmallamas')[0].innerText = txtmsj2; 1656 1657 } 1658} 1659 1660function iniciaMalla(escala, titulo, filtros) { 1661 1662 escalaSeleccionada = escala; 1663 limpiarResAPIgeo(); 1664 1665 closePopUp2(); 1666 closePopUp(); 1667 clickCerrar = false; 1668 var ws = 'Sitio_Inegi' 1669 var lyrname = null; 1670 1671 switch (escala) { 1672 case '1:1 000 000': 1673 lyrname = 'Div_1M_geog'; 1674 break; 1675 case '1:1000 000': 1676 lyrname = 'Div_1M_geog'; 1677 escala = '1:1 000 000' 1678 break; 1679 case '1:250 000': 1680 lyrname = 'Div_250K_geog'; 1681 break; 1682 1683 case '1:50 000': 1684 lyrname = 'Div_50K_geog'; 1685 break; 1686 1687 case '1:20 000': 1688 lyrname = 'Div_20K_geog'; 1689 break; 1690 1691 case '1:10 000': 1692 lyrname = 'div10k'; 1693 break; 1694 } 1695 1696 if (lyrname === null) 1697 return; 1698 1699 if (lyrVectorMalla !== null) { 1700 var srcLyr = lyrVectorMalla.getSource(); 1701 srcLyr.clear(true); 1702 //lyrVectorMalla = null; descomentar cuando se replique contenido.js 1703 } 1704 1705 1706 var idTd = titulo.replace(":", "_").replace(" ", "").replace(" ", ""); 1707 var mallaID = ["1_10000", "1_20000", "1_50000", "1_250000", "1_1000000"]; 1708 //var checkCartas = document.getElementById('checkbox').checked; 1709 1710 if (lyrMalla === null) { 1711 if (tema === "2542") { 1712 // if (window.location.pathname.indexOf('50000') !== -1) { 1713 if (lyrname === "Div_50K_geog") { 1714 1715 lyrMalla = iMap.addGSWMSTiledLyr(urlsGS.getURL_WMS(), ws, lyrname, 'lyrMalla', 0, true, 'topo50kgris'); 1716 } 1717 } 1718 else 1719 1720 lyrMalla = iMap.addGSWMSTiledLyr(urlsGS.getURL_WMS(), ws, lyrname, 'lyrMalla', 0, true); 1721 $('#OcultaPanel').empty(); 1722 //console.log("iniciaMalla"); 1723 //if (checkCartas) { 1724 let textPanel = idioma == 'en' ? "consulting the information. please wait..." : "Consultando la información. Por favor espera..." 1725 $("#OcultaPanel").append('<div style="margin-top: 35%;"><span style="margin-left: 27%; color:white; font-size:14px;" for="name">' + textPanel + '</span></div>'); 1726 $('<img>', { 1727 'src': '/componentes/espaciov2/v2/images/loading.gif', 1728 'style': 'margin-left: 50%;' 1729 }).appendTo('#OcultaPanel'); 1730 $('#OcultaPanel').show(); 1731 // console.log("cartas"); 1732 buscarCartas('', tema, escala) 1733 //} 1734 $('#td' + escala.replace(":", "_").replace(" ", "").replace(" ", "")).addClass("td_escalas_selected"); 1735 // capasActivas(id, 'MAPA'); 1736 } 1737 else { 1738 if ((lyrMalla !== null) && ($('#td' + escala.replace(":", "_").replace(" ", "").replace(" ", ""))[0].className === "td_escalas td_escalas_selected")) {
1739 iMap.removeLayer('lyrMalla'); 1740 removeCartasLayer() 1741 $('#OcultaPanel').hide(); 1742 1743 lyrMalla = null; 1744 $('#td' + escala.replace(":", "_").replace(" ", "").replace(" ", "")).removeClass("td_escalas_selected"); 1745 1746 } 1747 else { 1748 for (var i = 0; i < mallaID.length; i++) 1749 $('#td' + mallaID[i] + '').removeClass("td_escalas_selected"); 1750 iMap.removeLayer('lyrMalla'); 1751 removeCartasLayer() 1752 $('#OcultaPanel').hide(); 1753 lyrMalla = null; 1754 1755 if (tema === "2542") { 1756 // if (window.location.pathname.indexOf('50000') !== -1) { 1757 if (lyrname === "Div_50K_geog") { 1758 1759 lyrMalla = iMap.addGSWMSTiledLyr(urlsGS.getURL_WMS(), ws, lyrname, 'lyrMalla', 0, true, 'topo50kgris'); 1760 } 1761 } 1762 else 1763 lyrMalla = iMap.addGSWMSTiledLyr(urlsGS.getURL_WMS(), ws, lyrname, 'lyrMalla', 0, true); 1764 //if (checkCartas) { 1765 $('#OcultaPanel').empty(); 1766 // console.log("iniciaMalla"); 1767 let textPanel = idioma == 'en' ? "Consulting the information. please wait..." : "Consultando la información. Por favor espera..." 1768 $("#OcultaPanel").append('<div style="margin-top: 35%;"><span style="margin-left: 27%; color:white; font-size:14px;" for="name">' + textPanel + '</span></div>'); 1769 $('<img>', { 1770 'src': '/componentes/espaciov2/v2/images/loading.gif', 1771 'style': 'margin-left: 50%;' 1772 }).appendTo('#OcultaPanel'); 1773 $('#OcultaPanel').show(); 1774 //console.log("cartas") 1775 buscarCartas('', tema, escala) 1776 //} 1777 $('#td' + escala.replace(":", "_").replace(" ", "").replace(" ", "")).addClass("td_escalas_selected"); 1778 1779 } 1780 } 1781} 1782//var lyrEstatal = null; 1783//var lyrVectorEstatal = null; 1784var popbuss = false; 1785function hIMapSingleClick(evt) { 1786 let textoTooltip = idioma == "en" ? "Close" : "Cerrar"; 1787 ltlng = ol.proj.transform(evt.coordinate, 'EPSG:3857', 'EPSG:4326'); 1788 popbuss = false; 1789 1790 if (arraycliccapas.length > 0) { 1791 arraycliccapas.forEach(function (element) { 1792 flagDescarga = false; 1793 var viewResolution = olView.getResolution(); 1794 1795 1796 var url = eval(element[0] + '.getSource().getGetFeatureInfoUrl(evt.coordinate, viewResolution, \'EPSG:3857\', { \'INFO_FORMAT\': \'application/json\' });'); 1797 var data; 1798 if (url) { 1799 $.post(url, { dataType: 'json' }, function (data) { 1800 // data = JSON.parse(data); 1801 try { 1802 1803 data = JSON.parse(data); 1804 } 1805 catch (E) { 1806 data = data; 1807 1808 } 1809 if (data) { 1810 if (data.crs !== null) { 1811 jsoninfo = data; // JSON.parse(data.obj); 1812 var cve; 1813 var ftr = jsoninfo.features[0]; 1814 var fjson = new ol.format.GeoJSON(); 1815 var olftr = fjson.readFeature(ftr); 1816 1817 if (eval('vector' + element[0]) === null) { 1818 1819 eval('vector' + element[0] + ' = new ol.layer.Vector({ inegilyrType: ol.INEGILayerType.vectorLayer, name: \'' + element[0] + '\' ,visible: true,zoomInicial: 0,source: new ol.source.Vector(), style: function (ftr, resolution) {var style = new ol.style.Style({ fill: new ol.style.Fill({color: \'rgba(255, 0,0 , 0.35)\'}),stroke: new ol.style.Stroke({color: \'#FF0000\',width: 1})});return style;}});'); 1820 INEGIMapSingleton.getMap().addLayer(eval('vector' + element[0])); 1821 } 1822 1823 var srcLyr = eval('vector' + element[0] + '.getSource()'); 1824 1825 srcLyr.clear(true); 1826 srcLyr.addFeature(olftr); 1827 1828 // cve = ftr.properties.CVE_ENT; 1829 eval('cve=ftr.properties.' + element[2]); 1830 overlayPop.setPosition(undefined); 1831 overlayPop.setPosition(evt.coordinate);
1832 olView.setCenter(evt.coordinate); 1833 1834 1835 1836 $.ajax({ 1837 method: "GET", 1838 async: false, 1839 cache: false, 1840 beforeSend: function () { 1841 iMap.getMap().removeEventListener('singleclick'); 1842 iMap.getMap().un('singleclick'); 1843 /*var valor = buscadorMapas.Componentes({ 1844 contenedor: 'resultBusqueda',//contenedor para el resultado completo 1845 tema: tema, 1846 escala: '', 1847 ag: cve, 1848 buscador: false, 1849 filters: false 1850 }).obtenInfoCuadrante('divPop');//contenedor para el resumen*/ 1851 // console.log(escalaSeleccionada) 1852 BibliotecaDigitalServicios.ComponenteMapasReact.obtenerCartaCuadrante({ 1853 idContenedor: 'resultBusqueda', 1854 idPopup: 'divPop', 1855 descEscala: escalaSeleccionada, 1856 idAgeo: '', 1857 idTema: tema, 1858 idClaveCarta: 'F13' 1859 }); 1860 }, 1861 success: function (data) { 1862 //PopupMallas(cve); 1863 }, 1864 error: function (xhr) { // if error occured 1865 console.log(xhr); 1866 }, 1867 complete: function (xhr, status) { 1868 1869 PopupMallas(cve); 1870 1871 } 1872 }); 1873 1874 } 1875 } 1876 1877 else { 1878 console.log("Error consulta Desc Capa "); 1879 } 1880 }); 1881 } 1882 1883 }); 1884 } 1885 if (lyrMalla !== null) { 1886 flagDescarga = false; 1887 1888 var viewResolution = olView.getResolution(); 1889 var url = lyrMalla.getSource().getGetFeatureInfoUrl( 1890 evt.coordinate, viewResolution, 'EPSG:3857', 1891 { 'INFO_FORMAT': 'application/json' }); 1892 //var data; 1893 if (url) { 1894 // $.post("http://10.1.8.15:8081/geoserver/wms?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetFeatureInfo&FORMAT=image%2Fpng&TRANSPARENT=true&QUERY_LAYERS=Sitio_Inegi%3ADiv_1M_geog&LAYERS=Sitio_Inegi%3ADiv_1M_geog&TILED=true&INFO_FORMAT=application%2Fjson&I=38&J=156&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-12523442.714243278%2C2504688.542848654%2C-11271098.44281895%2C3757032.814272982", { dataType: 'json' }, function (data) { console.log(data) }); 1895 //$.post(url, { dataType: 'json' }, function (data) { 1896 // data = JSON.parse(data.responseText); 1897 //}); 1898 1899 $.post(url, { dataType: 'json' }, function (data) { 1900 //console.log(JSON.parse(data)); 1901 // console.log(JSON.parse(data.responseText)); 1902 1903 try { 1904 1905 data = JSON.parse(data); 1906 } 1907 catch (E) { 1908 data = data; 1909 //console.log(data); 1910 } 1911 if (data) { 1912 if (data.crs !== null) { 1913 jsoninfo = data; // JSON.parse(data.obj); 1914 var idCarta; 1915 var ftr = jsoninfo.features[0]; 1916 var fjson = new ol.format.GeoJSON(); 1917 var olftr = fjson.readFeature(ftr); 1918 if (lyrVectorMalla === null) { 1919 1920 lyrVectorMalla = new ol.layer.Vector({ 1921 inegilyrType: ol.INEGILayerType.vectorLayer, 1922 name: 'lyrInfoMalla', 1923 visible: true, 1924 zoomInicial: 0, 1925 source: new ol.source.Vector(), 1926 style: function (ftr, resolution) { 1927 1928 var props = ftr.getProperties(); 1929 var idCarta = ''; 1930 1931 if (props.CLAVE1M) 1932 idCarta = props.CLAVE1M; 1933 else if (props.CLAVE250K) 1934 idCarta = props.CLAVE250K; 1935 else if (props.CLAVE50K) 1936 idCarta = props.CLAVE50K; 1937 else if (props.CLAVE20K) 1938 idCarta = props.CLAVE20K; 1939 else if (props) 1940 idCarta = props.clave10k; 1941 1942 1943 var style = new ol.style.Style({ 1944 1945 fill: new ol.style.Fill({ 1946 color: 'rgba(255, 0,0 ,
19460.35)' 1947 }), 1948 stroke: new ol.style.Stroke({ 1949 color: '#FF0000', 1950 width: 1 1951 }) 1952 1953 1954 }); 1955 1956 return style; 1957 }, 1958 zIndex: 100 1959 }); 1960 INEGIMapSingleton.getMap().addLayer(lyrVectorMalla); 1961 } 1962 1963 var srcLyr = lyrVectorMalla.getSource(); 1964 srcLyr.clear(true); 1965 srcLyr.addFeature(olftr); 1966 1967 1968 if (ftr.properties.CLAVE1M) 1969 idCarta = ftr.properties.CLAVE1M; 1970 1971 else if (ftr.properties.CLAVE250K) { 1972 //console.log(ftr.properties.CLAVE250K); 1973 idCarta = ftr.properties.CLAVE250K.substring(0, 3) + '-' + ftr.properties.CLAVE250K.substring(3, ftr.properties.CLAVE250K.length); 1974 1975 // idCarta = ftr.properties.CLAVE250K; 1976 } 1977 else if (ftr.properties.CLAVE50K) 1978 idCarta = ftr.properties.CLAVE50K; 1979 else if (ftr.properties.CLAVE20K) 1980 idCarta = ftr.properties.CLAVE20K; 1981 else if (ftr.properties.clave10k) 1982 idCarta = ftr.properties.clave10k; 1983 // console.log(idCarta); 1984 overlayPop.setPosition(undefined); 1985 overlayPop.setPosition(evt.coordinate); 1986 olView.setCenter(evt.coordinate); 1987 1988 if (tema === '2542') { 1989 // if (window.location.pathname.indexOf('50000') !== -1) { 1990 1991 $.ajax({
1992 method: "GET", 1993 async: false, 1994 cache: false, 1995 beforeSend: function () { 1996 iMap.getMap().removeEventListener('singleclick'); 1997 iMap.getMap().un('singleclick'); 1998 /*var valor = buscadorMapas.Componentes({ 1999 contenedor: 'resultBusqueda',//contenedor para el resultado completo 2000 clave: idCarta, 2001 vTopografia: true, 2002 viewCuadrante: 2, 2003 numRes: 10 2004 2005 }).obtenInfoCuadrante('divPop');//contenedor para el resumen*/ 2006 // console.log(escalaSeleccionada) 2007 BibliotecaDigitalServicios.ComponenteMapasReact.obtenerCartaCuadrante({ idContenedor: "resultBusqueda", idClaveCarta: idCarta, idPopup: "divPop", descEscala: escalaSeleccionada, idAgeo: "01", idTema: tema }); 2008 }, 2009 success: function (data) { 2010 2011 }, 2012 error: function (xhr) { // if error occured 2013 console.log(xhr); 2014 }, 2015 complete: function (xhr, status) { 2016 if (popover2 !== null) { 2017 popover2.hide(); 2018 popover2 = null; 2019 } 2020 PopupMallas(idCarta); 2021 2022 } 2023 }); 2024 2025 } 2026 2027 else { 2028 2029 $.ajax({
2030 method: "GET", 2031 async: false, 2032 cache: false, 2033 beforeSend: function () { 2034 iMap.getMap().removeEventListener('singleclick'); 2035 iMap.getMap().un('singleclick'); 2036 /*var valor = buscadorMapas.Componentes({ 2037 contenedor: 'resultBusqueda',//contenedor para el resultado completo 2038 tema: tema, 2039 escala: escalaSeleccionada, 2040 clave: idCarta, 2041 buscador: true, 2042 filters: false 2043 }).obtenInfoCuadrante('divPop');//contenedor para el resumen*/ 2044 BibliotecaDigitalServicios.ComponenteMapasReact.obtenerCartaCuadrante({ 2045 idContenedor: "resultBusqueda", 2046 idPopup: 'divPop', 2047 descEscala: escalaSeleccionada, 2048 idTema: tema, 2049 idClaveCarta: idCarta 2050 }); 2051 2052 2053 }, 2054 success: function (data) { 2055 console.log('success'); 2056 }, 2057 error: function (xhr) { // if error occured 2058 console.log(xhr); 2059 }, 2060 complete: function (xhr, status) { 2061 PopupMallas(idCarta); 2062 2063 } 2064 }); 2065 } 2066 } 2067 } 2068 2069 else { 2070 console.log("Error consulta Desc Capa "); 2071 } 2072 }); 2073 } 2074 } 2075 2076 var mapy = iMap.getMap(); 2077 var lyrBusquedas = iMap.getLayer('lyrBusquedas'); 2078 if (lyrBusquedas) { 2079 var srclyr = lyrBusquedas.getSource(); 2080 var ftrs = srclyr.getFeatures(); 2081 2082 for (var i = 0; i < ftrs.length; i++) { 2083 var ftr = ftrs[i]; 2084 var props = ftr.getProperties(); 2085 if (props.data) { 2086 if (props.data === null) 2087 srclyr.removeFeature(ftr); 2088 } else { 2089 srclyr.removeFeature(ftr); 2090 } 2091 } 2092 2093 } 2094 closePopUp(); 2095 closePopUp2(); 2096 var layerjsonInd = iMap.getLayer('layerjsonInd'); 2097 mapy.forEachFeatureAtPixel(evt.pixel, function (feature, layer) { 2098 var srclayer = null; 2099 var ftrs = null; 2100 var wktParser = new ol.format.WKT(); 2101 var geom = null; 2102 2103 if ((lyrBusquedas !== null) || (layerjsonInd !== null)) { 2104 2105 2106 2107 if (layer.get('name') === 'lyrBusquedas') { 2108 // if (ltlng) 2109 2110 srclayer = layer.getSource(); 2111 if (feature) { 2112 //if (popover2 !== null) { 2113 // popover2.hide(); 2114 // popover2 = null; 2115 //} 2116 var data = feature.get('data'); 2117 2118 var extent = feature.getGeometry().getExtent(); 2119 2120 var X = extent[0] + (extent[2] - extent[0]) / 2; 2121 var Y = extent[1] + (extent[3] - extent[1]) / 2; 2122 2123 if (data) 2124 if (data.polig) 2125 if (data.polig !== '') { 2126 try { 2127 var re = /0 0/g; 2128 data.polig = data.polig.replace(re, ''); 2129 geom = wktParser.readGeometry(data.polig); 2130 geom.transform('EPSG:4326', 'EPSG:3857'); 2131 2132 var olftr = new ol.Feature({ 2133 geometry: geom, 2134 labelPoint: data.nombre, 2135 name: data.nombre 2136 }); 2137 2138 olftr.set('data', null); 2139 srclayer.addFeature(olftr); 2140 2141 var extent = geom.getExtent(); 2142 var mapy = iMap.getMap(); 2143 mapy.getView().fit(extent, { 2144 maxZoom: 16, 2145 size: mapy.getSize() 2146 }); 2147 2148 2149 } 2150 catch (ex) { 2151 var mapy = iMap.getMap(); 2152 zoom = olView.getZoom(); 2153 if (zoom <= 12) { 2154 olView.animate({ 2155 center: [X, Y], 2156 zoom: 15, 2157 duration: 2000 2158 }); 2159 } else { 2160 olMap.getView().fit(extent, { 2161 maxZoom: 15, 2162 size: olMap.getSize() 2163 }); 2164 } 2165 2166 //var extent = feature.getGeometry().getExtent(); 2167 2168 //mapy.getView().fit(extent, { 2169 // maxZoom: 16, 2170 // size: mapy.getSize() 2171 //}); 2172 // "POINT (-102.73621818038211 21.841729013298615)" 2173 2174 } 2175 2176 $(".popover-content").css({ "min-width": "250px" }); 2177 olMap.updateSize(); 2178 infoLyrBusquedas.setPosition(undefined); 2179 infoLyrBusquedas.setPosition([X, Y]); 2180 var element = document.getElementById('popup2'); 2181 $(".popover-content").css({ "min-width": "250px" }); 2182 popover2 = popover2 != null ? closePopUp() : null; 2183 popover2 = new bootstrap.Popover(element, { 2184 html: true, 2185 animation: false, 2186 placement: 'top', 2187 content: function () { 2188 return descripGloboInfoAPIGeo(data); 2189 }, 2190 title: '<button type="button" data-dismiss="modal" class="close buttonCloseTooltip" id="btncloseBA"><span class="closedbtn inegi-cerrar buttonCloseSpan" id="cerrarInfoW" onclick="closePopUp2()" ></span></button>', 2191 sanitize: false 2192 2193 2194 }); 2195 popover2.show(); 2196 ///data-original-title="Cerrar" 2197 /*$(element).popover({ 2198 'title': '<span style="font-size:20px;float: right;" class="closedbtn inegi-cerrar" data-bs-toggle="tooltip" data-bs-placement="bottom" id= "modal" onclick="closePopUp2()" ></span>', 2199 'placement': 'top', 2200 'html': true, 2201 'animation': false, 2202 'content': function () { 2203 return descripGloboInfoAPIGeo(data)//data.ubicacion; 2204 } 2205 }); 2206 $(element).popover('show');*/ 2207 //if ((data.grupo === "Entidad") || (data.grupo === "Municipio") || (data.grupo === "Localidad")) 2208 // crearGraficasEnFicha(); 2209 // $('[data-toggle="tooltip"]').tooltip(); 2210 } 2211 2212 popbuss = true; 2213 2214 } 2215 } 2216 if ((layer.get('name') === 'layerjsonInd') && (popbuss === false)) { 2217 //console.log("temas Es"); 2218 //if (popover3 !== null) { 2219 // popover3.hide(); 2220 // popover3 = null; 2221 //} 2222 if (feature) { 2223 extent; 2224 srclayer = layer.getSource(); 2225 extent = feature.getGeometry().getExtent(); 2226 X = extent[0] + (extent[2] - extent[0]) / 2; 2227 Y = extent[1] + (extent[3] - extent[1]) / 2; 2228 var entidadID = feature.get('CVE_ENT'); 2229 2230 if (TipoTema === "E") { 2231 if (ng === "" && JsonEnt === "") { 2232 2233 JsonEnt = entidadID; 2234 var radiosViv = document.getElementsByName("Indicadores"); 2235 for (var i = 0; i < radiosViv.length; i++) { 2236 if (radiosViv[i].checked) { 2237 for (var l = 0; l < temasjson.length; l++) { 2238 2239 if (parseInt(radiosViv[i].id) === temasjson[l].Id) { 2240 if (temasjson[l].Desglose === 3) { 2241 desgloseInd = 3; 2242 var_JsonTema = radiosViv[i].id; 2243 TipoRep(idT, indicadorf, entidadID); 2244 2245 mapy = iMap.getMap(); 2246 mapy.getView().fit(extent, { 2247 maxZoom: 7, 2248 size: mapy.getSize() 2249 }); 2250 //break; 2251 } 2252 else { //desglose 2
2253 desgloseInd = 2; 2254 JsonEnt = ""; 2255 $(".popover-content").css({ "min-width": "250px" }); 2256 closePopUp(); 2257 overlayPop.setPosition(undefined); 2258 overlayPop.setPosition([X, Y]); 2259 element = document.getElementById('popup'); 2260 $(".popover-content").css({ "min-width": "250px" }); 2261 popover3 = null; 2262 let textval = idioma == "en" ? "Value" : "Valor"; 2263 // html = '<b>' + feature.get("NOM_ENT") + '</b> <br> ' + textval + ': ' + VecEstrato["elementos"][i]["valor"] + ''; 2264 2265 $.each(VecEstrato["elementos"], function (idx, obj1) { 2266 if (feature.get("NOM_ENT") === VecEstrato["elementos"][idx]["nombre"]) 2267 html = '<b>' + feature.get("NOM_ENT") + '</b> <br>' + textval + ': ' + VecEstrato["elementos"][idx]["valor"] + ''; 2268 2269 }); 2270 2271 2272 //html = '<b>' + feature.get("NOM_ENT") + '</b> <br> Valor: ' + VecEstrato["elementos"][i]["valor"] + ''; 2273 popover3 = popover3 != null ? closePopUp() : null; 2274 popover3 = new bootstrap.Popover(element, { 2275 container: 'body', 2276 content: html, 2277 html: true, 2278 title: '<button type="button" data- dismiss="modal" class= "close buttonCloseTooltip" id = "btncloseBA" onclick = "closePopUp()" > <span class="closedbtn inegi-cerrar buttonCloseSpan" data-bs-toggle="tooltip" data-bs-placement="bottom" id="cerrarInfoW" ></span></button >', 2279 //title: '<button type="button" data-dismiss="modal" class="close" id="btncloseBA"><span style= "font-size:20px;float: right;" title="cerrar" class="closedbtn inegi-cerrar" data-bs-toggle="tooltip" data-bs-placement="bottom" id="cerrarInfoW" onclick="closePopUp()" ></span></button>', 2280 sanitize: false, 2281 placement: 'top', 2282 animation: false, 2283 sanitizeFn: function (content) { return content; } 2284 2285 }); 2286 2287 2288 //if (popover2 != null) { 2289 // popover2.show(); 2290 //} else { 2291 popover3.show(); 2292 //} 2293 2294 2295 2296 //$(element).popover({ 2297 // 'title': '<button type="button" data-dismiss="modal" class="close" id="btncloseBA"><span style= "font-size:20px;float: right;" title="cerrar" class="closedbtn inegi-cerrar" data-bs-toggle="tooltip" data-bs-placement="bottom" id="cerrarInfoW" onclick="closePopUp()" ></span></button>', 2298 // 'placement': 'top', 2299 // 'html': true, 2300 // 'animation': false, 2301 // 'content': html 2302 //}); 2303 //$(element).popover('show'); 2304 $("#cerrarInfoW").tooltip(); 2305 2306 2307 } 2308 2309 } 2310 2311 } 2312 break; 2313 } 2314 2315 } 2316 2317 2318 } 2319 else { 2320 2321 console.log("pintaEstrato"); 2322 radiosViv = document.getElementsByName("Indicadores"); 2323 var flagViv = false; 2324 for (var x = 0; x < radiosViv.length; x++) { 2325 if (radiosViv[x].checked) { 2326 for (var l = 0; l < temasjson.length; l++) { 2327 var id = temasjson[l].Id; 2328 if ((parseInt(radiosViv[x].id) === id) && (flagViv === false)) { 2329 2330 if (temasjson[l].Desglose === 3) { 2331 2332 cont = 0; 2333 color = ""; 2334 valor = 0; 2335 var myHTML; 2336 for (var i = 0; i < VecEstrato["elementos"].length; i++) { 2337 if (VecEstrato["elementos"][i]["id"].toString().length === 1) 2338 cvegeo = "00" + VecEstrato["elementos"][i]["id"]; 2339 else 2340 cvegeo = "0" + VecEstrato["elementos"][i]["id"]; 2341 //console.log(feature.get("CVE_MUN")); 2342 if (feature.get("CVE_MUN") === cvegeo) { 2343 valor = VecEstrato["elementos"][i]["valor"]; 2344 color = VecEstrato["elementos"][i]["color"]; 2345 valor = valor.replace(/,/g, ''); 2346 valor = valor.replace('.00', ''); 2347 2348 $(".popover-content").css({ "min-width": "250px" }); 2349 closePopUp(); 2350 overlayPop.setPosition(undefined); 2351 overlayPop.setPosition([X, Y]); 2352 var element = document.getElementById('popup'); 2353 $(".popover-content").css({ "min-width": "250px" }); 2354 popover2 = null; 2355 let textval = idioma == "en" ? "Value" : "Valor"; 2356 html = '<b>' + feature.get("NOM_MUN") + '</b> <br>
2356 ' + textval + ': ' + VecEstrato["elementos"][i]["valor"] + ''; 2357 //$(element).popover({ 2358 // 'title': '<button type="button" data-dismiss="modal" class="close" id="btncloseBA"><span style= "font-size:20px;float: right;" title="cerrar" class="closedbtn inegi-cerrar" data-bs-toggle="tooltip" data-bs-placement="bottom" id="cerrarInfoW" onclick="closePopUp()" ></span></button>', 2359 // 'placement': 'top', 2360 // 'html': true, 2361 // 'animation': false, 2362 // 'content': html 2363 //}); 2364 //$(element).popover('show'); 2365 popover2 = popover2 != null ? closePopUp() : null; 2366 popover2 = new bootstrap.Popover(element, { 2367 container: 'body', 2368 content: html, 2369 html: true, 2370 title: '<button type="button" data- dismiss="modal" class= "close buttonCloseTooltip" id = "btncloseBA" onclick = "closePopUp()" > <span class="closedbtn inegi-cerrar buttonCloseSpan" data-bs-toggle="tooltip" data-bs-placement="bottom" id="cerrarInfoW" ></span></button >', 2371 //title: '<button type="button" data-dismiss="modal" class="close" id="btncloseBA"><span style= "font-size:20px;float: right;" title="cerrar" class="closedbtn inegi-cerrar" data-bs-toggle="tooltip" data-bs-placement="bottom" id="cerrarInfoW" onclick="closePopUp()" ></span></button>', 2372 sanitize: false, 2373 placement: 'top', 2374 animation: false, 2375 sanitizeFn: function (content) { return content; } 2376 2377 }); 2378 2379 popover2.show(); 2380 2381 2382 2383 2384 $("#cerrarInfoW").tooltip(); 2385 flagViv = true; 2386 break; 2387 } 2388 } 2389 } 2390 else { //desglose 2 2391 2392 $(".popover-content").css({ "min-width": "250px" }); 2393 closePopUp(); 2394 overlayPop.setPosition(undefined); 2395 overlayPop.setPosition([X, Y]); 2396 element = document.getElementById('popup'); 2397 $(".popover-content").css({ "min-width": "250px" }); 2398 let textval = idioma == "en" ? "Value" : "Valor"; 2399 // html = '<b>' + feature.get("NOM_ENT") + '</b> <br> ' + textval + ': ' + VecEstrato["elementos"][i]["valor"] + ''; 2400 2401 $.each(VecEstrato["elementos"], function (idx, obj1) { 2402 if (feature.get("NOM_ENT") === VecEstrato["elementos"][idx]["nombre"]) 2403 html = '<b>
2403' + feature.get("NOM_ENT") + '</b> <br>' + textval + ': ' + VecEstrato["elementos"][idx]["valor"] + ''; 2404 2405 }); 2406 2407 let textoTooltip = idioma == "en" ? "Close" : "Cerrar"; 2408 2409 //$(element).popover({ 2410 // 'title': '<button type="button" data-dismiss="modal" class="close" id="btncloseBA"><span style= "font-size:20px;float: right;" title="cerrar" class="closedbtn inegi-cerrar" data-bs-toggle="tooltip" data-bs-placement="bottom" id="cerrarInfoW" onclick="closePopUp()" ></span></button>', 2411 // 'placement': 'top', 2412 // 'html': true, 2413 // 'animation': false, 2414 // 'content': html 2415 //}); 2416 //$(element).popover('show'); 2417 2418 popover2 = popover2 != null ? closePopUp() : null; 2419 popover2 = new bootstrap.Popover(element, { 2420 container: 'body', 2421 content: html, 2422 html: true, 2423 title: '<button type="button" data- dismiss="modal" class= "close buttonCloseTooltip" id = "btncloseBA" onclick = "closePopUp()" > <span class="closedbtn inegi-cerrar buttonCloseSpan" data-bs-toggle="tooltip" data-bs-placement="bottom" id="cerrarInfoW" ></span></button >', 2424 //title: '<button type="button" data-dismiss="modal" class="close" id="btncloseBA"><span style= "font-size:20px;float: right;" title="cerrar" class="closedbtn inegi-cerrar" data-bs-toggle="tooltip" data-bs-placement="bottom" id="cerrarInfoW" onclick="closePopUp()" ></span></button>', 2425 sanitize: false, 2426 placement: 'top', 2427 animation: false, 2428 sanitizeFn: function (content) { return content; } 2429 2430 }); 2431 2432 popover2.show(); 2433 $("#cerrarInfoW").tooltip(); 2434 2435 2436 } 2437 2438 } 2439 2440 } 2441 break; 2442 } 2443 2444 } 2445 2446 2447 2448 2449 2450 } 2451 } 2452 else { 2453 IndicadorTematico(indicadorf, entidadID); 2454 } 2455 2456 //if (ng === "" && JsonEnt === "") { 2457 // var entidadID = feature.get('CVE_ENT'); 2458 // JsonEnt = entidadID; 2459 // if (TipoTema === "E") { 2460 // var radiosViv = document.getElementsByName("Indicadores"); 2461 // for (var i = 0; i < radiosViv.length; i++) { 2462 // if (radiosViv[i].checked) { 2463 2464 // var_JsonTema = radiosViv[i].id; 2465 // TipoRep(idT, indicadorf, entidadID); 2466 // } 2467 2468 // } 2469 // mapy = iMap.getMap(); 2470 // mapy.getView().fit(extent, { 2471 // maxZoom: 7, 2472 // size: mapy.getSize() 2473 // }); 2474 // } 2475 // else { 2476 2477 // IndicadorTematico(indicadorf, entidadID); 2478 // } 2479 2480 //} 2481 //else { 2482 // if (TipoTema === "E") { 2483 2484 2485 // cont = 0; 2486 // color = ""; 2487 // valor = 0; 2488 // var myHTML; 2489 // for (var i = 0; i < VecEstrato["elementos"].length; i++) { 2490 // if (VecEstrato["elementos"][i]["id"].length === 1) 2491 // cvegeo = "0" + VecEstrato["elementos"][i]["id"]; 2492 // else 2493 // cvegeo = VecEstrato["elementos"][i]["id"]; 2494 2495 // if (feature.get("CVE_MUN") === cvegeo) { 2496 // valor = VecEstrato["elementos"][i]["valor"]; 2497 // color = VecEstrato["elementos"][i]["color"]; 2498 // valor = valor.replace(/,/g, ''); 2499 // valor = valor.replace('.00', ''); 2500 2501 // $(".popover-content").css({ "min-width": "250px" }); 2502 // closePopUp(); 2503 // overlayPop.setPosition(undefined); 2504 // overlayPop.setPosition([X, Y]); 2505 // var element = document.getElementById('popup'); 2506 // $(".popover-content").css({ "min-width": "250px" }); 2507 2508 // html = '<b>' + feature.get("NOM_MUN") + '</b> <br> Valor: ' + VecEstrato["elementos"][i]["valor"] + ''; 2509 // $(element).popover({ 2510 // 'title': '<button type="button" data-dismiss="modal" class="close" id="bt
2510ncloseBA"><span style= "font-size:20px;float: right;" title="cerrar" class="closedbtn inegi-cerrar" data-toggle="tooltip" data-placement="bottom" id="cerrarInfoW" onclick="closePopUp()" ></span></button>', 2511 // 'placement': 'top', 2512 // 'html': true, 2513 // 'animation': false, 2514 // 'content': html 2515 // }); 2516 // $(element).popover('show'); 2517 // $("#cerrarInfoW").tooltip(); 2518 // break; 2519 // } 2520 // } 2521 // // return layer; 2522 // } 2523 // else { 2524 // entidadID = feature.get('CVE_ENT'); 2525 // IndicadorTematico(indicadorf, entidadID); 2526 // } 2527 2528 //} 2529 2530 } 2531 } 2532 2533 } 2534 }, { 2535 layerFilter: function (layer) { 2536 if (layer.get('name') === 'lyrBusquedas') 2537 return layer.get('name') === 'lyrBusquedas'; 2538 if (layer.get('name') === 'layerjsonInd') 2539 return layer.get('name') === 'layerjsonInd'; 2540 } 2541 }); 2542 2543} 2544 2545function PopupMallas(idCarta) { 2546 closePopUp(); 2547 closePopUp2(); 2548 if (document.getElementById("resultBusqueda").style.display === 'none') 2549 document.getElementById("resultBusqueda").style.display = 'block'; 2550 $('.popover-content').css({ "min-width": "200px !important" }); 2551 $(".popover").css({ "min-width": "200px !important" }); 2552 $('.popover').css('width', "200px"); 2553 //alert(document.getElementById('divPop').innerHTML); 2554 2555 setTimeout(function () { 2556 var element = document.getElementById('popup'); 2557 /*$(element).popover({ 2558 'title': '<button type="button" data-dismiss="modal" class="close" id="btncloseBA" onclick="closePopUp()"><span style= "font-size:20px;float:right;" class="closedbtn inegi-cerrar" data-toggle="tooltip" data-placement="bottom" id="cerrarInfoW" ></span></button>', 2559 'placement': 'top', 2560 'html': true, 2561 'animation': true, 2562 'content': function () { return document.getElementById('divPop').innerHTML; } 2563 2564 }); 2565 $(element).popover('show');*/ 2566 popover4 = popover4 != null ? closePopUp() : null; 2567 popover4 = null; 2568 popover4 = new bootstrap.Popover(element, { 2569 container: 'body', 2570 content: document.getElementById('divPop').innerHTML + " ", 2571 html: true, 2572 title: '<button type="button" data-dismiss="modal" class="close buttonCloseTooltip" id="btncloseBA" onclick="closePopUp()"><span class="closedbtn inegi-cerrar buttonCloseSpan" data-bs-toggle="tooltip" data-bs-placement="bottom" id="cerrarInfoW" ></span></button>', 2573 sanitize: false, 2574 placement: 'top', 2575 animation: false, 2576 sanitizeFn: function (content) { return content; } 2577 2578 }); 2579 2580 popover4.show(); 2581 $("#cerrarInfoW").tooltip(); 2582 let valor = $('.popover-content').text(); 2583 2584 divPopCarta = document.getElementById("divPop"); 2585 resultCarta = document.getElementById("resultBusqueda"); 2586 if (valor.includes('No existen')) { 2587 2588 removebusqueda(); 2589 } else { 2590 addbusqueda(); 2591 } 2592 2593 if (divPopCarta.innerHTML == "No existen mapas relacionados a esta carta ") 2594 resultCarta.style.display = "none"; 2595 2596 }, 3500); 2597 2598} 2599 2600function closePopUp() { 2601 // clickCerrar = true; 2602 //popbuss = false; 2603 const popoverTriggerList = document.querySelectorAll('[data-bs-toggle="popover"]') 2604 const popoverList = [...popoverTriggerList].map(popoverTriggerEl => new bootstrap.Popover(popoverTriggerEl)) 2605 var element = document.getElementById('popup'); 2606 if (popover2 !== null) { 2607 popover2.hide(); 2608 popover2 = null; 2609 //$('.popover').popover('dispose'); 2610 //$('.popover').remove(); 2611 } 2612 if (popover3 !== null) { 2613 popover3.hide(); 2614 popover3 = null; 2615 //$('.popover').popover('dispose'); 2616 //$('.popover').remove(); 2617 } 2618 if (popover4 !== null) { 2619 popover4.hide(); 2620 popover4 = null; 2621 //$('.popover').popover('dispose'); 2622 //$('.popover').remove(); 2623 } 2624 arraycliccapas.forEach(function (element) { 2625 eval('if(' + element[0] + '!=null) setTimeout(function () {iMap.getMap().addEventListener(\'singleclick\', hIMapSingleClick);}, 500);'); 2626 });
2627 2628 //if (tema === "0150001000000000") { 2629 // if (lyrEstatal !== null) { 2630 2631 // } 2632 //} 2633 if (lyrMalla !== null) { 2634 setTimeout(function () { 2635 //iMap.getMap().on('singleclick', hIMapSingleClick); 2636 iMap.getMap().addEventListener('singleclick', hIMapSingleClick); 2637 }, 500); 2638 } 2639} 2640 2641function irLatLngZoom(lat, lng, zoom) { 2642 if ((lat !== '') && (lng !== '')) { 2643 var latilong = [parseFloat(lng), parseFloat(lat)]; 2644 var ltlngE = ol.proj.transform(latilong, 'EPSG:4326', 'EPSG:3857'); 2645 olView.setCenter(ltlngE); 2646 } 2647 if (zoom !== '') 2648 olView.setZoom(zoom); 2649} 2650 2651function resizeMap() { 2652 //$('#panelizq').addClass('panelactive'); 2653 //$('#OcultaPanel').show(); 2654 2655 // if (tema === "2542") { 2656 // if (window.location.pathname.indexOf('50000') !== -1) { 2657 if ($(window).width() < 1200) { 2658 2659 //$('#div_resultGeo')[0].setAttribute("style", "overflow-y:hidden"); 2660 //$('#layer1')[0].setAttribute("style", "overflow-y:hidden"); 2661 $('#panelizq')[0].style.display = "none"; 2662 $('#panelizq').css('width', ""); 2663 //console.log("entra"); 2664 if ($('#collapse_tool_capasClose')[0]) 2665 $('#collapse_tool_capasClose')[0].setAttribute('style', 'display:none'); 2666 2667 if ($('#collapse-tool-capas')[0]) 2668 $('#collapse-tool-capas')[0].setAttribute('style', 'display:none;'); 2669 //$('#mapa').animate({ width: "100%" }, 500); 2670 $('#mapa').css('width', "100%"); 2671 } 2672 2673 else { 2674 //$('#div_resultGeo')[0].setAttribute("style", "overflow-y:auto"); 2675 //$('#layer1')[0].setAttribute("style", "overflow-y:auto"); 2676 // $('#panelizq')[0].style.display = "none"; 2677 //$('#panelizq').animate({ width: "28%" }, 500); 2678 $('#panelizq')[0].style.display = "block"; 2679 $('#panelizq').css('width', "28%"); 2680 if ($('#collapse_tool_capasClose')[0]) 2681 // $('#collapse_tool_capasClose')[0].setAttribute('style', 'display:block'); 2682 $('#collapse_tool_capasClose')[0].setAttribute('style', 'display:block;z-index:200;top:8px;left:5px;position:absolute;'); 2683 // console.log("prueba 4"); 2684 if ($('#collapse-tool-capas')[0]) 2685 $('#collapse-tool-capas')[0].setAttribute('style', 'display:block;z-index:200;top:8px;left:5px;position:absolute;'); 2686 2687 // $('#mapa').animate({ width: "72%" }, 500);ocultabtnColaps 2688 $('#mapa').css('width', "72%"); 2689 $('#collapse-tool-capas').click(); 2690 } 2691 2692 2693 // } 2694 setTimeout(function () { iMap.getMap().updateSize(); }, 100); 2695 2696} 2697 2698function ocultabtnColaps() { 2699 console.log("entra oculta2"); 2700 $('#collapse_tool_capas')[0].setAttribute('style', 'display:none'); 2701 $('#collapse_tool_capasClose')[0].setAttribute('style', 'display:block;z-index:200;top:8px;left:5px;position:absolute;'); 2702 $('#panelizq')[0].style.display = "block"; 2703 $('#mapa').css('width', "72%"); 2704 $(".iconCapasSelect").css("left", 400); 2705 if (iMap)
2706 iMap.getMap().updateSize(); 2707 $('#disabledScreen').show(); 2708 2709} 2710 2711function ocultabtnColapsClose() { 2712 console.log("entraoculta1"); 2713 $('#collapse_tool_capasClose')[0].setAttribute('style', 'display:none'); 2714 $('#collapse_tool_capas')[0].setAttribute('style', 'display:block;z-index:200;top:8px;left:5px;position:absolute;'); 2715 $('#panelizq')[0].style.display = "none"; 2716 2717} 2718 2719 2720function OverlayMapa(TipoTema) { 2721 2722 if ((TipoTema === "G")) { 2723 $('<div>', { 2724 'id': 'divOverlay', 2725 'style': 'height:auto !important' 2726 }).append( 2727 $('<div>', { 2728 'style': 'display:none;z-index:200;top: 2px;right:1px;position:absolute', 2729 'id': 'collapse_overlay', 2730 'aria-label': 'Ocultar overlay', 2731 'data-bs-toggle': 'tooltip', 2732 'onclick': 'ocultabtnColapsOVerlay()', 2733 'data-bs-original-title': 'Ocultar overlay', 2734 'class': "ol-unselectable ol-control" 2735 }).append( 2736 $('<span>', { 2737 'class': 'inegi-nav-izq' 2738 }))).appendTo('#map2D'); 2739 2740 if (typeof ImgOverlay !== 'undefined') { 2741 2742 2743 2744 ImgOverlay.map(map => { 2745 $('<div>', { 2746 'id': 'div' + map.nombre, 2747 'style': 'display:none' 2748 }).append( 2749 $('<img>', { 2750 'id': 'img' + map.img, 2751 'src': '/componentes/espaciov2/v2/images/overlay/' + map.img + '.png' 2752 })).appendTo('#divOverlay'); 2753 }); 2754 2755 2756 2757 /* $.each(ImgOverlay, function (idx, obj) { 2758 $('<div>', { 2759 'id': 'div' + obj.nombre, 2760 'style': 'display:none', 2761 }).append( 2762 $('<img>', { 2763 'id': 'img' + obj.img, 2764 'src': '/componentes/espaciov2/v2/images/overlay/' + obj.img + '.png' 2765 })).appendTo('#divOverlay'); 2766 });*/ 2767 } 2768 2769 $('<div>', { 2770 'style': 'display:none;z-index:200;top:68%; left:12px;;position:absolute', 2771 'id': 'descollapse_overlay', 2772 'aria-label': 'Ver overlay', 2773 'data-bs-toggle': 'tooltip', 2774 'onclick': 'desocultabtnColapsOVerlay()', 2775 'data-bs-original-title': 'Ver overlay', 2776 'class': "ol-unselectable ol-control" 2777 }).append( 2778 $('<span>', { 2779 'class': 'inegi-nav-der' 2780 })).appendTo('#map2D'); 2781 2782 2783 } 2784 else if ((TipoTema === "ET")) { 2785 $('<div>', { 2786 'id': 'divOverlay' 2787 }).appendTo('#map2D'); 2788 } 2789 else { 2790 $('<div>', { 2791 'id': 'divOverlay' 2792 }).appendTo('#mapa'); 2793 $('#divOverlay')[0].style.position = "inherit"; 2794 } 2795} 2796function desocultabtnColapsOVerlay() { 2797 $('#descollapse_overlay').css('display', 'none'); 2798 $('#divOverlay').toggle(500); 2799} 2800 2801function ocultabtnColapsOVerlay() { 2802 $('#descollapse_overlay').css('display', 'block'); 2803 $('#divOverlay').toggle(500); 2804 2805} 2806//window.html2canvas = html2canvas; 2807function pdf(desc) { 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 try { 2886 2887 2888 2889 2890 source = $('#divOverlay')[0]; 2891 try { 2892 var canvas = null; 2893 2894 olMap.once('postcompose', function (event) { 2895 2896 canvas = event.context.canvas; 2897 if (navigator.msSaveBlob) { 2898 // navigator.msSaveBlob(canvas.msToBlob(), 'map.png'); 2899 try { 2900 2901 var title = document.getElementsByClassName('tituImprimir'); 2902 var obtitle = title[0]; 2903 var doc = new jsPDF() 2904 var imgT; 2905 var imgHeightT; 2906 var imgT; 2907 2908 var canvas2 = document.createElement("canvas"); 2909 var ctx = canvas2.getContext("2d"); 2910 var texto = obtitle.innerText; 2911 var imgLogo = new Image(); 2912 imgLogo.src = '/componentes/espaciov2/v2/images/logoInegi.png'; 2913 imgLogo.style.visibility = "hidden"; 2914 imgLogo.onload = function () { 2915 //logo 2916 ctx.clearRect(0, 0, canvas2.width, canvas2.height); 2917 ctx.drawImage(imgLogo, 0, 0, 314, 200);
2918 doc.addImage(imgLogo, 'PNG', 0, 0); 2919 //t�tulo 2920 if (obtitle !== '') { 2921 var color = window.getComputedStyle(obtitle).getPropertyValue("color"); 2922 var coord = color.replace("rgb(", "").replace(")", ""); 2923 var arrcoor = coord.split(',', 3); 2924 doc.setTextColor(arrcoor[0], arrcoor[1], arrcoor[2]); 2925 doc.text(5, 30, texto); 2926 2927 } 2928 } 2929 //specialElementHandlers = { 2930 // // element with id of "bypass" - jQuery style selector 2931 // '#divOverlay': function (element, renderer) { 2932 // // true = "handled elsewhere, bypass text extraction" 2933 // return true 2934 // } 2935 //}; 2936 //margins = { 2937 // top: 80, 2938 // bottom: 80, 2939 // left: 80, 2940 // right: 80, 2941 // width: 600 2942 //}; 2943 2944 var imgData = canvas.toDataURL("image/jpeg", 1.0); 2945 var imgWidth = 210; 2946 var imgHeight = canvas.height * imgWidth / canvas.width; 2947 html2canvas(source, { 2948 onrendered: function (canvas) { 2949 var img = canvas.toDataURL("image/png"); 2950 doc.addImage(imgData, 'JPEG', 5, 35); 2951 //doc.fromHTML( 2952 // source//, // HTML string or DOM elem ref. 2953 // //margins.left, // x coord 2954 // //margins.top, { // y coord 2955 // // 'width': margins, // max width of content on PDF 2956 // // 'elementHandlers': specialElementHandlers 2957 // //} 2958 //); 2959 if (img !== "data:,") { 2960 if ((tema === "0150007000000000") || (tema === "0160003000000000")) {//gnss y fisiongrafia 2961 doc.addImage(imgOver, 'PNG', 5, (imgHeight + 45)); 2962 2963 } 2964 else 2965 doc.addImage(img, 'JPEG', 30, (imgHeight + 25)); 2966 } 2967 2968 doc.save('Temas.pdf'); 2969 } 2970 2971 }); 2972 } 2973 catch (e) { 2974 console.log(e); 2975 } 2976 2977 } 2978 else { 2979 try { 2980 2981 var title = document.getElementsByClassName('tituImprimir'); 2982 var obtitle = title[0] == undefined ? "" : title[0]; 2983 var doc = new jsPDF(); 2984 var imgT; 2985 var imgHeightT; 2986 var imgT; 2987 2988 var canvas2 = document.createElement("canvas"); 2989 var ctx = canvas2.getContext("2d"); 2990 var texto = obtitle.innerText; 2991 var imgLogo = new Image(); 2992 imgLogo.src = '/componentes/espaciov2/v2/images/logoInegi.png'; 2993 imgLogo.style.visibility = "hidden"; 2994 imgLogo.onload = function () { 2995 //logo 2996 ctx.clearRect(0, 0, canvas2.width, canvas2.height); 2997 ctx.drawImage(imgLogo, 0, 0, 314, 200); 2998 doc.addImage(imgLogo, 'PNG', 0, 0); 2999 //t�tulo 3000 3001 if (obtitle !== '') { 3002 var color = window.getComputedStyle(obtitle).getPropertyValue("color"); 3003 var coord = color.replace("rgb(", "").replace(")", ""); 3004 var arrcoor = coord.split(',', 3); 3005 doc.setTextColor(arrcoor[0], arrcoor[1], arrcoor[2]); 3006 doc.text(5, 30, texto); 3007 } 3008 3009 } 3010 specialElementHandlers = { 3011 // element with id of "bypass" - jQuery style selector 3012 '#divOverlay': function (element, renderer) { 3013 // true = "handled elsewhere, bypass text extraction" 3014 return true 3015 } 3016 }; 3017 margins = { 3018 top: 80, 3019 bottom: 80, 3020 left: 80, 3021 right: 80, 3022 width: 600 3023 }; 3024 3025 var imgData = canvas.toDataURL("image/jpeg", 1.0); 3026 var imgWidth = 210; 3027 var imgHeight = canvas.height * imgWidth / canvas.width; 3028 html2canvas(source, { 3029 onrendered: function (canvas) { 3030 var img = canvas.toDataURL("image/png"); 3031 // doc.addImage(imgT, 'JPEG', 0, 0); 3032 doc.addImage(imgData, 'JPEG', 5, 35); 3033 //doc.fromHTML( 3034 // source//, // HTML string or DOM elem ref. 3035 // //margins.left, // x coord 3036 // //margins.top, { // y coord 3037 // // 'width': margins, // max width of content on PDF 3038 // // 'elementHandlers': specialElementHandlers 3039 // //} 3040 //); 3041 if (img !== "data:,") { 3042 3043 if ((tema === "0150007000000000") || (tema === "0160003000000000")) {//gnss y fisiongrafia 3044 3045 doc.addImage(imgOver, 'PNG', 5, (imgHeight + 45)); 3046 } 3047 else 3048 doc.addImage(img, 'JPEG', 30, (imgHeight + 25)); 3049 } 3050 3051 doc.save('Temas.pdf'); 3052 } 3053 3054 }); 3055 3056 } 3057 catch (e) { 3058 console.log(e); 3059 } 3060 } 3061 3062 3063 3064 3065 ////Nueva forma de impresi�n 3066 //var doc = new jsPDF('p', 'mm', 'a4'); 3067 //if (TipoTema === "G") { 3068 // //var canvas2 = document.createElement("canvas"); 3069 // //var ctx = canvas2.getContext("2d"); 3070 // //var imgLogo = new Image(); 3071 // //imgLogo.src = '/componentes/espacio/v2/images/logoInegi.png'; 3072 // //imgLogo.style.visibility = "hidden"; 3073 // //imgLogo.onload = function () { 3074 // // ctx.clearRect(0, 0, canvas2.width, canvas2.height); 3075 // // ctx.drawImage(imgLogo, 0, 0, 314, 200);
3076 // // doc.addImage(imgLogo, 'PNG', 5, 0); 3077 // //} 3078 // html2canvas($('.enc_log'), { 3079 // onrendered: function (canvas) { 3080 // var img = canvas.toDataURL("image/png"); 3081 // doc.addImage(img, 'JPEG', 10, 10); 3082 // html2canvas($('#presenta'), { 3083 // onrendered: function (canvas) { 3084 // var img = canvas.toDataURL("image/png"); 3085 // doc.addImage(img, 'JPEG', 0, 30); 3086 // $('#divOverlay')[0].style.display = "none"; 3087 // html2canvas($('#map2D'), { 3088 // onrendered: function (canvas) { 3089 // var img = canvas.toDataURL("image/png"); 3090 // doc.addImage(img, 'JPEG', 2, 70); 3091 // doc.addPage(); 3092 // if ($('#divOverlay')[0].innerHTML !== "") { 3093 // $('#divOverlay')[0].style.display = "block"; 3094 // doc.setFont('Times', 'Roman'); 3095 // doc.setFontSize(10); 3096 // doc.text(5, 10, 'Overlay del mapa'); 3097 // html2canvas($('#divOverlay'), { 3098 // onrendered: function (canvas) { 3099 // var img = canvas.toDataURL("image/png"); 3100 // doc.addImage(img, 'JPEG', 5, 15); 3101 // doc.setFont('Times', 'Roman'); 3102 // doc.setFontSize(10); 3103 // doc.text(5, 100, 'Capas del mapa'); 3104 // html2canvas($('#grupo_capa1'), { 3105 // onrendered: function (canvas) { 3106 // var img = canvas.toDataURL("image/png"); 3107 // doc.addImage(img, 'JPEG', 5, 100); 3108 // doc.save('Temas.pdf'); 3109 // } 3110 3111 // }); 3112 // } 3113 3114 // }); 3115 // } 3116 // else { 3117 // doc.setFont('Times', 'Roman'); 3118 // doc.setFontSize(10); 3119 // doc.text(5, 10, 'Capas del mapa'); 3120 // html2canvas($('#grupo_capa1'), { 3121 // onrendered: function (canvas) { 3122 // var img = canvas.toDataURL("image/png"); 3123 // doc.addImage(img, 'JPEG', 5, 15); 3124 // doc.save('Temas.pdf'); 3125 // } 3126 3127 // }); 3128 // } 3129 // // doc.text(5, 5, 'Leyendas del mapa'); 3130 3131 3132 3133 // } 3134 3135 // }); 3136 // } 3137 // }); 3138 3139 // } 3140 3141 //}); 3142 3143 3144 3145 3146 3147 3148 3149 3150 //} 3151 //else { 3152 // //var canvas2 = document.createElement("canvas"); 3153 // //var ctx = canvas2.getContext("2d"); 3154 // //// var texto = obtitle.innerText; 3155 // //var imgLogo = new Image(); 3156 // //imgLogo.src = '/componentes/espacio/v2/images/logoInegi.png'; 3157 // //imgLogo.style.visibility = "hidden"; 3158 // //imgLogo.onload = function () { 3159 // // //logo 3160 // // ctx.clearRect(0, 0, canvas2.width, canvas2.height); 3161 // // ctx.drawImage(imgLogo, 0, 0, 314, 200);
3162 // // doc.addImage(imgLogo, 'PNG', 0, 0); 3163 // //} 3164 // html2canvas($('.enc_log'), { 3165 // onrendered: function (canvas) { 3166 // var img = canvas.toDataURL("image/png"); 3167 // doc.addImage(img, 'JPEG', 10, 10); 3168 // html2canvas($('#presenta'), { 3169 // onrendered: function (canvas) { 3170 // var img = canvas.toDataURL("image/png"); 3171 // doc.addImage(img, 'JPEG', 0, 30); 3172 3173 // } 3174 3175 // }); 3176 3177 3178 // html2canvas($('#mapa'), { 3179 // onrendered: function (canvas) { 3180 // var img = canvas.toDataURL("image/png"); 3181 // doc.addImage(img, 'JPEG', 30, 60); 3182 // doc.save('Temas.pdf'); 3183 // } 3184 3185 // }); 3186 // } 3187 // }); 3188 3189 //} 3190 3191 }); 3192 3193 if (canvas === null) { 3194 console.log('not canvas potscompose'); 3195 3196 3197 3198 olMap.once('postrender', function (event) { 3199 canvas = event.context.canvas; 3200 3201 3202 if (navigator.msSaveBlob) { 3203 // navigator.msSaveBlob(canvas.msToBlob(), 'map.png'); 3204 try { 3205 3206 var title = document.getElementsByClassName('tituImprimir'); 3207 var obtitle = title[0]; 3208 var doc = new jsPDF(); 3209 var imgT; 3210 var imgHeightT; 3211 var imgT; 3212 3213 var canvas2 = document.createElement("canvas"); 3214 var ctx = canvas2.getContext("2d"); 3215 var texto = obtitle.innerText; 3216 var imgLogo = new Image(); 3217 imgLogo.src = '/componentes/espaciov2/v2/images/logoInegi.png'; 3218 imgLogo.style.visibility = "hidden"; 3219 imgLogo.onload = function () { 3220 //logo 3221 ctx.clearRect(0, 0, canvas2.width, canvas2.height); 3222 ctx.drawImage(imgLogo, 0, 0, 314, 200); 3223 doc.addImage(imgLogo, 'PNG', 0, 0); 3224 //t�tulo 3225 3226 var color = window.getComputedStyle(obtitle).getPropertyValue("color"); 3227 var coord = color.replace("rgb(", "").replace(")", ""); 3228 var arrcoor = coord.split(',', 3); 3229 doc.setTextColor(arrcoor[0], arrcoor[1], arrcoor[2]); 3230 doc.text(5, 30, texto); 3231 3232 3233 } 3234 3235 var imgData = canvas.toDataURL("image/jpeg", 1.0); 3236 var imgWidth = 210; 3237 var imgHeight = canvas.height * imgWidth / canvas.width; 3238 html2canvas(source, { 3239 onrendered: function (canvas) { 3240 var img = canvas.toDataURL("image/png"); 3241 doc.addImage(imgData, 'JPEG', 5, 35); 3242 3243 if (img !== "data:,") { 3244 if ((tema === "0150007000000000") || (tema === "0160003000000000")) {//gnss y fisiongrafia 3245 doc.addImage(imgOver, 'PNG', 5, (imgHeight + 45)); 3246 3247 } 3248 else 3249 doc.addImage(img, 'JPEG', 30, (imgHeight + 25)); 3250 } 3251 3252 doc.save('Temas.pdf'); 3253 } 3254 3255 }); 3256 } 3257 catch (e) { 3258 console.log(e); 3259 } 3260 3261 } 3262 else { 3263 try { 3264 3265 var title = document.getElementsByClassName('tituImprimir'); 3266 var obtitle = title[0]; 3267 var doc = new jsPDF(); 3268 var imgT; 3269 var imgHeightT; 3270 var imgT; 3271 3272 var canvas2 = document.createElement("canvas"); 3273 var ctx = canvas2.getContext("2d"); 3274 var texto = obtitle.innerText; 3275 var imgLogo = new Image(); 3276 imgLogo.src = '/componentes/espaciov2/v2/images/logoInegi.png'; 3277 imgLogo.style.visibility = "hidden"; 3278 imgLogo.onload = function () { 3279 //logo 3280 ctx.clearRect(0, 0, canvas2.width, canvas2.height); 3281 ctx.drawImage(imgLogo, 0, 0, 314, 200);
3282 doc.addImage(imgLogo, 'PNG', 0, 0); 3283 //t�tulo 3284 3285 var color = window.getComputedStyle(obtitle).getPropertyValue("color"); 3286 var coord = color.replace("rgb(", "").replace(")", ""); 3287 var arrcoor = coord.split(',', 3); 3288 doc.setTextColor(arrcoor[0], arrcoor[1], arrcoor[2]); 3289 doc.text(5, 30, texto); 3290 3291 3292 } 3293 specialElementHandlers = { 3294 // element with id of "bypass" - jQuery style selector 3295 '#divOverlay': function (element, renderer) { 3296 // true = "handled elsewhere, bypass text extraction" 3297 return true 3298 } 3299 }; 3300 margins = { 3301 top: 80, 3302 bottom: 80, 3303 left: 80, 3304 right: 80, 3305 width: 600 3306 }; 3307 3308 var imgData = canvas.toDataURL("image/jpeg", 1.0); 3309 var imgWidth = 210; 3310 var imgHeight = canvas.height * imgWidth / canvas.width; 3311 html2canvas(source, { 3312 onrendered: function (canvas) { 3313 var img = canvas.toDataURL("image/png"); 3314 // doc.addImage(imgT, 'JPEG', 0, 0); 3315 doc.addImage(imgData, 'JPEG', 5, 35); 3316 //doc.fromHTML( 3317 // source//, // HTML string or DOM elem ref. 3318 // //margins.left, // x coord 3319 // //margins.top, { // y coord 3320 // // 'width': margins, // max width of content on PDF 3321 // // 'elementHandlers': specialElementHandlers 3322 // //} 3323 //); 3324 if (img !== "data:,") { 3325 3326 if ((tema === "0150007000000000") || (tema === "0160003000000000")) {//gnss y fisiongrafia 3327 3328 doc.addImage(imgOver, 'PNG', 5, (imgHeight + 45)); 3329 } 3330 else 3331 doc.addImage(img, 'JPEG', 30, (imgHeight + 25)); 3332 } 3333 3334 doc.save('Temas.pdf'); 3335 } 3336 3337 }); 3338 3339 } 3340 catch (e) { 3341 console.log(e); 3342 } 3343 } 3344 3345 }); 3346 } 3347 3348 olMap.renderSync(); 3349 } 3350 3351 catch (e) { 3352 console.log(e); 3353 } 3354 // } 3355 } 3356 catch (e) { 3357 console.log(e); 3358 } 3359 3360 3361 3362} 3363var respuestaComponente; 3364function RespComponente(Respuesta) { 3365 if (Respuesta.ediciones != null) { 3366 respuestaComponente = Respuesta; 3367 filtrarResultadosConsulta(escalaSeleccionada, respuestaComponente); 3368 descargasTotales = []; 3369 PintarCartasTotalDescargas(respuestaComponente); 3370 } else { 3371 if (!Respuesta.success) { 3372 console.log("error al mostrar la información"); 3373 } 3374 } 3375} 3376function PagIndicador(Indicador) { 3377 // window.open('/app/indicadores/?ind=' + Indicador + '', Indicador, "directories=no, location=no, menubar=no, scrollbars=yes, statusbar=no, tittlebar=no"); 3378 window.open('/app/indicadores/?ind=' + Indicador + '&vind=metadato', Indicador, "directories=no, location=no, menubar=no, scrollbars=yes, statusbar=no, tittlebar=no"); 3379 3380} 3381var inicializocomponente = false; 3382function inicializarComponente(tema, escala) { 3383 if (!inicializocomponente) { 3384 BibliotecaDigitalServicios.ComponenteMapasReact.inicializar({ 3385 idContenedor: 'resultBusqueda', 3386 conBuscador: false,
3387 conFiltros: false, 3388 idTema: tema, 3389 callback: RespComponente 3390 }); 3391 inicializocomponente = true; 3392 } 3393 setTimeout(function () { 3394 if (document.getElementById('bcm_resultados_resultBusqueda') != null) { 3395 removebusqueda(); 3396 BibliotecaDigitalServicios.ComponenteMapasReact.obtenerDatosCartas({ 3397 idContenedor: "resultBusqueda", 3398 descEscala: escala, 3399 idAgeo: '', 3400 idTema: tema, 3401 callback: RespComponente 3402 }) 3403 3404 } 3405 }, 500); 3406} 3407 3408function buscarCartas(ag, tema, escala) { 3409 inicializarComponente(tema, escala); 3410 /*setTimeout(function () { 3411 buscadorMapas.cartasInfo({ 3412 contenedor: 'resultBusqueda', 3413 ag: ag, //01 3414 tema: tema, //186 3415 escala: escala, //1:50 000 3416 callback: function (respuesta) { 3417 console.log('--- Respuesta API ---'); 3418 console.log(respuesta); 3419 if ((lyrMalla !== null) && ($('#td' + escala.replace(":", "_").replace(" ", "").replace(" ", ""))[0].className === "td_escalas td_escalas_selected")) { 3420 filtrarResultadosConsulta(escala, respuesta) 3421 } 3422 } 3423 }); 3424 }, 500); */ 3425 //if(inicializocomponente){ 3426 /*buscadorMapas.Componentes({ 3427 contenedor: 'resultBusqueda',//contenedor para el resultado completo 3428 tema: tema, 3429 escala: escala, 3430 clave: '', 3431 buscador: false, 3432 filters: false 3433 }).inicializar()*/ 3434 //while(document.getElementById('bcm_resultados_resultBusqueda')==null){ 3435 3436 //} 3437 3438 //} 3439 //if ((lyrMalla !== null) && ($('#td' + escala.replace(":", "_").replace(" ", "").replace(" ", ""))[0].className === "td_escalas td_escalas_selected")) { 3440 3441 //} 3442 // } 3443 //document.getElementById('resultBusqueda').remove(); 3444} 3445 3446function removebusqueda() { 3447 var x = document.getElementById("resultBusqueda"); 3448 if (x.style.display === "block") { 3449 x.style.display = "none"; 3450 } else { 3451 x.style.display = "none"; 3452 } 3453} 3454 3455function addbusqueda() { 3456 var x = document.getElementById("resultBusqueda"); 3457 if (x.style.display === "none") { 3458 x.style.display = "block"; 3459 } else { 3460 x.style.display = "block"; 3461 } 3462} 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472function filtrarResultadosConsulta(escala, resp) { 3473 console.log("filtroResultadosEscalas"); 3474 //pintarCartaMapa(); 3475 var cartasEdiciones = []; 3476 var cartas = []; 3477 if (resp != null) { 3478 if (resp.ediciones != null) { 3479 resp.ediciones.forEach(element => element.claves.forEach(val => cartas.push(val.clave))) 3480 //resp.ediciones[0].claves.forEach(val => cartas.push(val.clave)) 3481 cartasEdiciones.forEach(element => cartas.push(element.clave.substring(0, 3))) 3482 removeCartasLayer(); 3483 var cadena = ''; 3484 for (var i = 0; i < cartas.length; i++) { 3485 if (cartas[i].includes(',')) { 3486 let car = cartas[i].split(','); 3487 cartas.push.apply(cartas, car); 3488 } 3489 } 3490 for (var i = 0; i < cartas.length; i++) { 3491 if (cartas[i].includes(',')) { 3492 cartas.splice(i, 1, '') 3493 } 3494 } 3495 if (escala === '1:250 000') { 3496 console.log("entre aqui"); 3497 for (var i = 0; i < cartas.length; i++) { 3498 if (cartas[i].length < 6) { 3499 if (cartas[i].includes('-')) { 3500 cartas[i] = cartas[i].replace('-', '0').trim(); 3501 } 3502 } else { 3503 if (cartas[i].includes('-')) { 3504 cartas[i] = cartas[i].replace('-', '').trim(); 3505 } 3506 } 3507 } 3508 for (var i = 0; i < cartas.length; i++) { 3509 if (cartas[i].length < 5) { 3510 cartas[i] = cartas[i].substring(0, 3) + '0' + cartas[i].substring(cartas[i].length - 1, cartas[i].length) 3511 3512 } 3513 } 3514 3515 } 3516 let cartasUnicaspintadas = []; 3517 cartasUnicas = cartas.filter((c, index) => { 3518 return cartas.indexOf(c) === index; 3519 }); 3520 3521 if (cartasUnicas.length > 200) { 3522 while (cartasUnicas.length > 0) { 3523 console.log("cartasUnicas" + cartasUnicas.length); 3524 cadena = cadena.slice(1); 3525 cadena = cadena.slice(1); 3526 cadena = cadena.substring(0, cadena.length - 1); 3527 //console.log(cadena); 3528 paintLayerCartas(escala, cadena); 3529 cadena = ''; 3530 if (cartasUnicas.length > 200) { 3531 for (var i = 0; i < 100; i++) { 3532 const found = cartasUnicaspintadas.find(element => element == cartasUnicas[i]); 3533 if (found == undefined) 3534 cadena = cadena + ",'" + cartasUnicas[i] + "'"; 3535 cartasUnicaspintadas.push(cartasUnicas[i]); 3536 } 3537 for (var i = 0; i < 100; i++) { 3538 /* var i = cartasUnicas.indexOf(cartasUnicas[i]); 3539 cartasUnicas.splice(i, 1);*/ 3540 cartasUnicas.shift(); 3541 } 3542 3543 } else { 3544 for (var i = 0; i < cartasUnicas.length; i++) { 3545 const found = cartasUnicaspintadas.find(element => element == cartasUnicas[i]); 3546 if (found == undefined) 3547 cadena = cadena + ",'" + cartasUnicas[i] + "'"; 3548 cartasUnicaspintadas.push(cartasUnicas[i]); 3549 } 3550 for (var i = 0; i < cartasUnicas.length; i++) { 3551 /* var i = cartasUnicas.indexOf(cartasUnicas[i]); 3552 cartasUnicas.splice(i, 1);*/ 3553 cartasUnicas.shift(); 3554 } 3555 //cartasUnicas.forEach(element => cadena = cadena + ",'" + element + "'"); 3556 3557 } 3558 3559 } 3560 } else { 3561 cartasUnicas.forEach(element => cadena = cadena + ",'" + element.trim() + "'"); 3562 console.log("cartasUnicas" + cartasUnicas); 3563 cadena = cadena.slice(1); 3564 cadena = cadena.slice(1); 3565 cadena = cadena.substring(0, cadena.length - 1); 3566 console.log(cadena); 3567 paintLayerCartas(escala, cadena) 3568 } 3569 } 3570 } else { 3571 $('#OcultaPanel').hide(); 3572 } 3573 3574 3575} 3576
3577function pintarCartaMapa() { 3578 var lyr = new ol.layer.Tile({ 3579 inegilyrType: ol.INEGILayerType.INEGIGeoServerWMSTiled, 3580 name: 'Sitio_Inegi:Div_1M_geog', 3581 visible: true, 3582 zoomInicial: 5, 3583 source: new ol.source.TileWMS({ 3584 preload: Infinity, 3585 crossOrigin: 'anonymous', 3586 url: urlGeoServerINEGI + '/wms?', 3587 //params: { 'LAYERS': lyrs, 'TILED': 'true', 'STYLES': stylename, 'SLD': undefined } 3588 params: { 3589 'LAYERS': 'Sitio_Inegi:Div_1M_geog' 3590 } 3591 }) 3592 }); 3593 lyr.set('name', 'CartasLayer'); 3594 INEGIMapSingleton.getMap().addLayer(lyr); 3595} 3596 3597function paintLayerCartas(escala, carta, metodo) { 3598 var colorPintar; 3599 var layer; 3600 var clave; 3601 switch (escala) { 3602 case '1:50 000': 3603 layer = 'Sitio_Inegi:Div_50K_geog'; 3604 clave = 'CLAVE50K' 3605 break; 3606 case '1:1 000 000': 3607 layer = 'Sitio_Inegi:Div_1M_geog'; 3608 clave = 'CLAVE1M' 3609 break; 3610 case '1:1000 000': 3611 layer = 'Sitio_Inegi:Div_1M_geog'; 3612 clave = 'CLAVE1M' 3613 escala = '1:1 000 000' 3614 break; 3615 case '1:250 000': 3616 layer = 'Sitio_Inegi:Div_250K_geog'; 3617 clave = 'CLAVE250K' 3618 break; 3619 case '1:20 000': 3620 layer = 'Sitio_Inegi:Div_20K_geog'; 3621 clave = 'CLAVE20K' 3622 break; 3623 case '1:10 000': 3624 layer = 'Sitio_Inegi:div10k'; 3625 clave = 'clave10k' 3626 break; 3627 default: 3628 layer = 'Sitio_Inegi:Div_1M_geog'; 3629 clave = 'CLAVE1M' 3630 } 3631 3632 3633 3634 var filter = clave + " IN ('" + carta + "')" + '';
3635 let colorfill = ""; 3636 if (metodo === undefined) { 3637 colorPintar = '#FFFFFF'; 3638 colorfill = 'rgba(101,172,155,0.5)'; 3639 } else { 3640 colorPintar = '#C9F9C9'; 3641 colorfill = 'rgba(211, 239, 199, 0.8)'; 3642 } 3643 3644 var vector = new ol.layer.Vector({ 3645 source: new ol.source.Vector({ 3646 format: new ol.format.GeoJSON(), 3647 url: function (extent) { 3648 return urlGeoServerINEGI + '/ows?' + 3649 'service=WFS&' + 3650 'version=1.0.0&request=GetFeature&typename=' + layer + '&' + 3651 'outputFormat=application/json&CQL_Filter=' + filter; 3652 }, 3653 name: 'CartasLayer', 3654 }), 3655 style: new ol.style.Style({ 3656 3657 fill: new ol.style.Fill({ 3658 //color: 'rgba(255, 0,0 , 0.35)' 3659 color: colorfill 3660 }), 3661 stroke: new ol.style.Stroke({ 3662 color: colorPintar, 3663 width: 1 3664 }) 3665 }), 3666 3667 }); 3668 3669 3670 if (vector != undefined) { 3671 vector.set('name', 'CartasLayer'); 3672 INEGIMapSingleton.getMap().addLayer(vector); 3673 } 3674 $('#OcultaPanel').hide(); 3675} 3676function removeCartasLayer() { 3677 INEGIMapSingleton.getMap().getLayers().forEach(layer => { 3678 if (layer != undefined) { 3679 if (layer.get('name') === 'CartasLayer') { 3680 INEGIMapSingleton.getMap().removeLayer(layer); 3681 removeCartasLayer(); 3682 } 3683 } 3684 }); 3685} 3686 3687function PintarCartasTotalDescargas(cartas) { 3688 console.log(escalaSeleccionada) 3689 $.each(cartas.descarga[0].lista, function (idx, obj) { 3690 descargasTotales.push({ clave: obj.clave, total: obj.descarga, escala: escalaSeleccionada }); 3691 }); 3692 descargasTotales = descargasTotales.sort((x, y) => x.total - y.total); 3693 descargasTotales = descargasTotales.reverse((x, y) => x.total - y.total); 3694 let Elementos = []; 3695 switch (escalaSeleccionada) { 3696 case '1:1 000 000': 3697 Elementos = descargasTotales.slice(0, 3); 3698 break; 3699 case '1:1000 000': 3700 Elementos = descargasTotales.slice(0, 3); 3701 escalaSeleccionada = '1:1 000 000'; 3702 break; 3703 case '1:50 000': 3704 Elementos = descargasTotales.slice(0, 20); 3705 break; 3706 case '1:250 000': 3707 Elementos = descargasTotales.slice(0, 10); 3708 break; 3709 case '1:20 000': 3710 Elementos = descargasTotales.slice(0, 50); 3711 break; 3712 case '1:10 000': 3713 Elementos = descargasTotales.slice(0, 50); 3714 break; 3715 default: 3716 3717 3718 3719 } 3720 if (escalaSeleccionada === '1:250 000') { 3721 console.log("entre aqui"); 3722 for (var i = 0; i < Elementos.length; i++) { 3723 if (Elementos[i].clave.length < 6) { 3724 if (Elementos[i].clave.includes('-')) { 3725 Elementos[i].clave = Elementos[i].clave.replace('-', '0').trim(); 3726 } 3727 } else { 3728 if (Elementos[i].clave.includes('-')) { 3729 Elementos[i].clave = Elementos[i].clave.replace('-', '').trim(); 3730 } 3731 } 3732 } 3733 } 3734 $.each(Elementos, function (idx, obj) { 3735 paintLayerCartas(obj.escala, obj.clave, "TotalDescargas"); 3736 }); 3737 console.log("Elementos" + Elementos); 3738 3739} 3740 3741/*//Ajustes de MG descarga no va en la ublicación del 23-06-23*/ 3742 3743 3744 3745//******************** SELECCIONAR ÃREA GEOGRÃFICA *********************// 3746function menuAreaGeo(cve_ent, cve_mun) { 3747 var parametros = { 3748 metodo: 'ComponenteMenuAreaGeo',//nombre del método 3749 cve_ent: cve_ent,//nombre de los parametros que necesita el método 3750 cve_mun: cve_mun 3751 }; 3752 $.post("/app/mapa/espacioydatos/servicios/Descarga.ashx", parametros, function (data) { 3753 if (data.code === 200) { 3754 if (data.obj !== null) { 3755 $.ajax({
3756 async: false, 3757 beforeSend: function (objeto) { 3758 resMenuAreaGeo(data.obj, false); 3759 }, 3760 complete: function (objeto, exito) { 3761 if ((cve_ent != null) && (cve_mun != null)) { 3762 $('#divAreaGeo-' + cve_ent + cve_mun).toggle('slow'); 3763 $('#imgColapsar-' + cve_ent + cve_mun).toggleClass('inegi-mas-ca').toggleClass('inegi-menos-c'); 3764 3765 } 3766 else if (cve_ent != null) { 3767 $('#divAreaGeo-' + cve_ent).toggle('slow'); 3768 $('#imgColapsar-' + cve_ent).toggleClass('inegi-mas-ca').toggleClass('inegi-menos-c'); 3769 3770 } 3771 }, 3772 type: "GET" 3773 }); 3774 } 3775 } 3776 else { 3777 appInsights.trackException({ exception: "Error consulta menu area geográfica Compoentne: " }, { name: "servicios/Menu.ashx", ip: ipClient }); 3778 console.log("Error consulta menu area geográfica Componente: "); 3779 } 3780 //$('[data-toggle="tooltip"]').tooltip(); 3781 }); 3782} 3783 3784 3785function checkElementsTodoelPais() { 3786 let id = '00'; 3787 var miCheckbox = document.getElementById('ChBoxAreaGeo-' + id); 3788 if ($("#ChBoxAreaGeo-" + id)[0].checked === true) { 3789 $("#tableAreaGeoSelectD tr").detach(); 3790 //$("#ChBoxAreaGeo-00").addClass('parentPartialSelect'); 3791 for (let i = 0; i <= 32; i++) { 3792 if (i < 10) { 3793 id = '0' + i; 3794 } else { 3795 id = i; 3796 } 3797 $("#ChBoxAreaGeo-" + id)[0].checked = true; 3798 } 3799 limpiarAreaGeo(); 3800 $("#ChBoxAreaGeo-" + id)[0].checked = true; 3801 } 3802 else { 3803 UncheckElementsTodoelPais(id); 3804 $("#ChBoxAreaGeo-" + id)[0].checked = false; 3805 //console.log('nochec'); 3806 //for (let i = 0; i <= 32; i++) { 3807 // if (i < 10) { 3808 // id = '0' + i; 3809 // } else { 3810 // id = i; 3811 // } 3812 // if ($("#ChBoxAreaGeo-" + id)[0].checked === true) 3813 // $("#ChBoxAreaGeo-" + id)[0].checked = false; 3814 //} 3815 } 3816 3817} 3818 3819function resMenuAreaGeo(listaGeo, checkPadre) { 3820 if (listaGeo) { 3821 for (var l = 0; l < listaGeo.length; l++) { 3822 var idAreaGeo = listaGeo[l][0]; 3823 3824 var desAreaGeo = (listaGeo[l][1].trim() === "Todos") ? 'Estados Unidos Mexicanos' : listaGeo[l][1].trim(); 3825 var padreAreaGeo = listaGeo[l][2]; 3826 if (idAreaGeo != null) { 3827 var tbGeo = document.createElement("div"); 3828 tbGeo.setAttribute("class", "colorHover"); 3829 //tbGeo.setAttribute("style", "display: inherit"); 3830 /* tbGeo.setAttribute("style", "display:inline-block;");*/ 3831 //tbGeo.setAttribute("style", "list-style: none"); 3832 var imgColapsar = document.createElement("span"); 3833 if ((idAreaGeo.length < 3) && (idAreaGeo != "00")) { 3834 3835 imgColapsar.setAttribute("class", "inegi-mas-ca"); 3836 imgColapsar.setAttribute("style", "top:0px !important"); 3837 imgColapsar.setAttribute("id", "imgColapsarD-" + idAreaGeo); 3838 3839 imgColapsar.onclick = function (id) { 3840 return function () { 3841 divLoadNodeE = $('#divAreaGeoD-' + id)[0]; 3842 if ((divLoadNodeE.innerHTML === "")) { 3843 var mun = null; 3844 if (id.length > 2) 3845 mun = id.substring(2, id.length); 3846 menuAreaGeo(id.substring(0, 2), mun); 3847 $('#divAreaGeoD-' + id).toggle('slow'); 3848 $('#imgColapsarD-' + id).toggleClass('inegi-mas-ca').toggleClass('inegi-menos-c'); 3849 } 3850 else { 3851 /*if ($('#li_busqATUS').hasClass('active')) { 3852 $('#divAreaGeoA-' + id).toggle('slow'); 3853 $('#imgColapsarA-' + id).toggleClass('glyphicon-plus').toggleClass('glyphicon-minus'); 3854 } 3855 else {*/ 3856 3857 $('#divAreaGeoD-' + id).toggle('slow'); 3858 $('#imgColapsarD-' + id).toggleClass('inegi-mas-ca').toggleClass('inegi-menos-c'); 3859 //} 3860 } 3861 }; 3862 }(idAreaGeo); 3863 } 3864 //var tdActImg = document.createElement("span"); 3865 //tdActImg.setAttribute("style", "margin-right:3px"); 3866 var tdActDes = document.createElement("div"); 3867 tdActDes.setAttribute("class", "cortarTextoD"); 3868 tdActDes.appendChild(document.createTextNode(desAreaGeo)); 3869 tdActDes.setAttribute('data-bs-toggle', 'tooltip'); 3870 tdActDes.setAttribute('data-bs-placement', 'top'); 3871 tdActDes.setAttribute('title', desAreaGeo); 3872 tdActDes.setAttribute("width", "100%"); 3873 /* if ($('#li_busqATUS').hasClass('active')) 3874 tdActDes.setAttribute("id", "tdGeoAes_" + idAreaGeo); 3875 else*/ 3876 tdActDes.setAttribute("id", "tdGeoDes_" + idAreaGeo); 3877 //tdActDes.setAttribute("title", desAreaGeo); 3878 //tdActDes.setAttribute("data-toggle", "tooltip"); 3879 //tdActDes.setAttribute("data-placement", "bottom"); 3880 var checkAct = document.createElement('input'); 3881 //checkAct.setAttribute("style", "vertical-align:middle"); 3882 checkAct.type = "checkbox"; 3883 checkAct.style = "margin-right:4px;margin-left:3px"; 3884 checkAct.value = idAreaGeo; 3885 /*if ($('#li_busqATUS').hasClass('active')) 3886 checkAct.id = "ChBoxAreaGeoA-" + idAreaGeo; 3887 else*/ 3888 checkAct.id = "ChBoxAreaGeo-" + idAreaGeo; 3889 var rescheckenBusquedaAv = checkBusquedaAvAreaGeo(idAreaGeo); 3890 var classPartial = checkParcialPadreAvAreaGeo(idAreaGeo); 3891 if ((classPartial) && (!rescheckenBusquedaAv)) 3892 checkAct.className = "parentPartialSelect"; 3893 /*if ($('#li_busqATUS').hasClass('active')) { 3894 if (($("#ChBoxAreaGeoA" + padreAreaGeo).is(":checked")) || (rescheckenBusquedaAv)) 3895 checkAct.checked = "true";//rescheckenBusquedaAv; 3896 } 3897 else {*/ 3898 if (($("#ChBoxAreaGeo" + padreAreaGeo).is(":checked")) || (rescheckenBusquedaAv)) 3899 checkAct.checked = "true";//rescheckenBusquedaAv; 3900 //} 3901 checkAct.onclick = function (idAreaGeo, desAreaGeo) { 3902 return function () { 3903 seleccionAreaGeografica(idAreaGeo, desAreaGeo, 0); 3904 }; 3905 }(idAreaGeo, desAreaGeo); 3906 var divContent = document.createElement("div"); 3907 divContent.setAttribute("class", "divLeft"); 3908 divContent.appendChild(imgColapsar); 3909 divContent.appendChild(checkAct); 3910 //divContent.appendChild(tdActImg); 3911 tbGeo.appendChild(divContent); 3912 tbGeo.appendChild(tdActDes); 3913 var idPadre = padreAreaGeo; 3914 var idDivPadre; 3915 /*if ($('#li_busqATUS').hasClass('active')) 3916 idDivPadre = $("#divAreaGeoA" + padreAreaGeo)[0]; 3917 else*/ 3918 idDivPadre = $("#divAreaGeoD" + padreAreaGeo)[0]; 3919 idDivPadre.appendChild(tbGeo); 3920 if (idAreaGeo.length < 7) { 3921 var divActHijos = document.createElement("ul"); 3922 /* if ($('#li_busqATUS').hasClass('active')) 3923 divActHijos.setAttribute("id", "divAreaGeoA-" + idAreaGeo); 3924 else*/ 3925 divActHijos.setAttribute("id", "divAreaGeoD-" + idAreaGeo); 3926 // divActHijos.setAttribute("style", "margin-left:5px;display:none"); 3927 divActHijos.setAttribute("style", "margin-left:5px;display:none"); 3928 idDivPadre.appendChild(divActHijos); 3929 } 3930 } 3931 } 3932 } 3933} 3934var conag = 0; 3935function seleccionAreaGeografica(idAgeo, descAgeo, checkedT) { 3936 var idChecked; 3937 idChecked = document.getElementById("ChBoxAreaGeo-" + idAgeo); 3938 var table; 3939 table = document.getElementById("tableAreaGeoSelectD"); 3940 $("#tableAreaGeoSelectD")[0].setAttribute("style", "display:none"); 3941 var seleccionar = false; 3942 3943 if (idChecked == null) 3944 seleccionar = true; 3945 else if (idChecked.checked) 3946 seleccionar = true; 3947 else if (checkedT == 1) { 3948 seleccionar = true; 3949 $('#btnconsultar').removeAttr('disabled'); 3950 document.getElementById("ChBoxAreaGeo-" + idAgeo).checked = true; 3951 3952 3953 $("#ChBoxAreaGeo-" + idAgeo.substring(0, 2)).addClass('parentPartialSelect'); 3954 3955 3956 } 3957 if (!idChecked.checked && idAgeo.length === 2 && idAgeo != '00' && conag > 1) { 3958 $("#ChBoxAreaGeo-00")[0].checked = false; 3959 $("#ChBoxAreaGeo-00").addClass('parentPartialSelect'); 3960 } 3961 else if (!idChecked.checked && idAgeo.length === 2 && idAgeo != '00' && conag === 1) { 3962 $("#ChBoxAreaGeo-00")[0].checked = false; 3963 $("#ChBoxAreaGeo-00").removeClass('parentPartialSelect'); 3964 } 3965 3966 if (checkedT == 2) { 3967 seleccionar = false; 3968 if ($("#ChBoxAreaGeo-" + idAgeo)[0]) 3969 $("#ChBoxAreaGeo-" + idAgeo)[0].checked = false; 3970 if ($("#ChBoxAreaGeo-" + idAgeo.substring(0, 2))) 3971 $("#ChBoxAreaGeo-" + idAgeo.substring(0, 2)).removeClass('parentPartialSelect'); 3972 3973 eval(' cve' + idAgeo.substring(0, 2) + ' = 0;'); 3974 3975 3976 } 3977 if (seleccionar) { 3978 if (idAgeo == 0) { 3979 checkElementsTodoelPais(); 3980 } 3981 else if ($('#ChBoxAreaGeo-00').is(':checked')) { 3982 seleccionAreaGeografica('00', 'Estados Unidos Mexicanos', 2); 3983 3984 } 3985 if ($("#ChBoxAreaGeo-" + idAgeo)[0]) { 3986 $("#ChBoxAreaGeo-" + idAgeo)[0].className = ""; 3987 if ($("#ChBoxAreaGeo-" + idAgeo)[0].checked) { 3988 conag++; 3989 if (conag === 31) { 3990 $("#ChBoxAreaGeo-00")[0].checked = true; 3991 $("#ChBoxAreaGeo-00").removeClass('parentPartialSelect'); 3992 $("#tableAreaGeoSelectD tr").detach(); 3993 conag = 0; 3994 idAgeo = '00'; 3995 } 3996 3997 } 3998 3999 } 4000 else 4001 4002 selecParcialPadresAvAreaGeo(idAgeo); 4003 //$("#tableAreaGeoSelectD").show(); 4004 //console.log(idAgeo+'d'); 4005 if (idAgeo !== "00") { 4006 4007 var row = table.insertRow(table.rows.length); 4008 row.id = "tr_D" + idAgeo; 4009 var cell1 = row.insertCell(0); 4010 var cell2 = row.insertCell(1); 4011 var cell3 = row.insertCell(2); 4012 cell1.innerHTML = idAgeo; 4013 cell1.className = "oculta"; 4014 cell2.innerHTML = "<div class='cortarTextoParamB' id='td" + idAgeo + "' title='" + descAgeo + "' data-toggle='tooltip'>" + descAgeo + "</div>"; 4015 cell3.innerHTML = '<span class="glyphicon glyphicon-remove icon_off" name="removeMenu" style="float: right" onclick="seleccionAreaGeografica(\'' + idAgeo + '\', \'' + descAgeo + '\', 2)" ></span>'; 4016 } 4017 if (idAgeo.length < 3) { 4018 if (idAgeo !== "00") { 4019 if (document.getElementById("ChBoxAreaGeo-00")) 4020 $("#ChBoxAreaGeo-00").addClass('parentPartialSelect'); 4021 } 4022 $('#btnconsultar').removeAttr('disabled'); 4023 verificarHijosAreaGeo(idAgeo, idAgeo, true); 4024 eliminarHijosSelecAVGeo(idAgeo); 4025 } 4026 else if (idAgeo.length < 6) { 4027 verificarHijosAreaGeoM(idAgeo, idAgeo, true); 4028 $("#ChBoxAreaGeo-00").addClass('parentPartialSelect'); 4029 if (document.getElementById("ChBoxAreaGeo-" + idAgeo.substring(0, 2))) 4030 eliminarHijosSelecAVGeo(idAgeo); 4031 //if(typeof(cve01)) 4032 if (eval('typeof cve' + idAgeo.substring(0, 2) + '===\'undefined\'')) { 4033 eval(' cve' + idAgeo.substring(0, 2) + ' = 1;'); 4034 4035 } 4036 else 4037 eval(' cve' + idAgeo.substring(0, 2) + '= cve' + idAgeo.substring(0, 2) + '+ 1;'); 4038 4039 } 4040 verificaHermanosAreaGeo(idAgeo, true); 4041 } 4042 else { 4043 if (idAgeo == 0) { 4044 checkElementsTodoelPais(); 4045 } 4046 else { 4047 var rowD = document.getElementById("tr_D" + idAgeo); 4048 if (rowD) 4049 rowD.parentNode.removeChild(rowD); 4050 if (idAgeo.length < 3) { 4051 verificarHijosAreaGeo(idAgeo, idAgeo, false); 4052 conag = 0; 4053 for (var i = 1; i < 32; i++) { 4054 if (i === 1) 4055 $("#tableAreaGeoSelectD tr").detach(); 4056 if (i <= 9) { 4057 if ($("#ChBoxAreaGeo-0" + i + "")) { 4058 if ($("#ChBoxAreaGeo-0" + i + "")[0].checked) { 4059 //conag++; 4060 checkid = '0' + i; 4061 if ($("#ChBoxAreaGeo-" + checkid)[0]) { 4062 conag++; 4063 var row = $("#tableAreaGeoSelectD")[0].insertRow($("#tableAreaGeoSelectD")[0].rows.length); 4064 row.id = "tr_D" + checkid; 4065 var cell0 = row.insertCell(0); 4066 cell0.innerHTML = checkid; 4067 cell0.className = "oculta"; 4068 row.insertCell(1).innerHTML = "<div class='cortarTextoParamB' id='td" + checkid + "' title='" + $("#tdGeoDes_" + checkid)[0].innerHTML + "' data-toggle='tooltip'>" + $("#tdGeoDes_" + checkid)[0].innerHTML + "</div>"; 4069 row.insertCell(2).innerHTML = '<span class="glyphicon glyphicon-remove icon_off" name="removeMenu" style="float: right" onclick="seleccionAreaGeografica(\'' + checkid + '\', \'\', 2)" ></span>'; 4070 //cntHijos++; 4071 $("#tableAreaGeoSelectD")[0].setAttribute("style", "display:none"); 4072 } 4073 } 4074 } 4075 } 4076 else { 4077 if ($("#ChBoxAreaGeo-" + i + "")) { 4078 if ($("#ChBoxAreaGeo-" + i + "")[0].checked) { 4079 4080 checkid = i; 4081 if ($("#ChBoxAreaGeo-" + checkid)[0]) { 4082 conag++; 4083 var row = $("#tableAreaGeoSelectD")[0].insertRow($("#tableAreaGeoSelectD")[0].rows.length); 4084 row.id = "tr_D" + checkid; 4085 var cell0 = row.insertCell(0); 4086 cell0.innerHTML = checkid; 4087 cell0.className = "oculta"; 4088 row.insertCell(1).innerHTML = "<div class='cortarTextoParamB' id='td" + checkid + "' title='" + $("#tdGeoDes_" + checkid)[0].innerHTML + "' data-toggle='tooltip'>" + $("#tdGeoDes_" + checkid)[0].innerHTML + "</div>"; 4089 row.insertCell(2).innerHTML = '<span class="glyphicon glyphicon-remove icon_off" name="removeMenu" style="float: right" onclick="seleccionAreaGeografica(\'' + checkid + '\', \'\', 2
4089)" ></span>'; 4090 //cntHijos++; 4091 $("#tableAreaGeoSelectD")[0].setAttribute("style", "display:none"); 4092 } 4093 } 4094 } 4095 } 4096 4097 4098 4099 if (!$("#ChBoxAreaGeo-00").hasClass('parentPartialSelect')) { 4100 if (!idChecked.checked && idAgeo.length === 2 && idAgeo != '00' && conag > 1) { 4101 $("#ChBoxAreaGeo-00")[0].checked = false; 4102 $("#ChBoxAreaGeo-00").addClass('parentPartialSelect'); 4103 } 4104 } 4105 4106 } 4107 4108 } 4109 else if (idAgeo.length < 7) { 4110 verificarHijosAreaGeoM(idAgeo, idAgeo, false); 4111 verificarPadreAreaGeo(idAgeo); 4112 $("#ChBoxAreaGeo-00").removeClass('parentPartialSelect'); 4113 } 4114 if ($("#tableAreaGeoSelectD")[0].rows.length < 2) 4115 $("#tableAreaGeoSelectD").hide(); 4116 } 4117 } 4118 4119 //else if (idChecked.checked && idAgeo.length === 2 && idAgeo != '00' && conag > 0){ 4120 // $("#ChBoxAreaGeo-00").removeClass('parentPartialSelect'); 4121 //} 4122 mostrarDivParametros(); 4123 //$('[data-toggle="tooltip"]').tooltip(); 4124} 4125 4126function UncheckElementsTodoelPais(ag) { 4127 if (ag === "00") { 4128 let id = '00'; 4129 $("#ChBoxAreaGeo-00").removeClass('parentPartialSelect'); 4130 //var miCheckbox = document.getElementById('ChBoxAreaGeo-' + id); 4131 //if ($('#ChBoxAreaGeo-' + id).is(':checked')) { 4132 // console.log("Checkbox seleccionado"); 4133 //} 4134 //$('input[type=checkbox]:checked').each(function () { 4135 // if ($(this).prop("id") == "ChBoxAreaGeo-00") { 4136 // console.log("ChBoxAreaGeo " + $(this).prop("id") + " (" + $(this).val() + ") Seleccionado"); 4137 // } 4138 4139 4140 //}); 4141 4142 //if ($("#divAreaGeoA-" + id)[0].checked = false) { 4143 for (let i = 0; i <= 32; i++) { 4144 if (i < 10) { 4145 id = '0' + i; 4146 } else { 4147 id = i; 4148 } 4149 //if (id !== 12 && id != 27 && id !== "00" && id !== 31) { 4150 $("#ChBoxAreaGeo-" + id)[0].checked = false; 4151 //} 4152 } 4153 4154 } 4155 //else { 4156 // if (!$('#divAreaGeoA-' + ag).is(':checked')) { 4157 // $("#ChBoxAreaGeoA-00")[0].checked = false; 4158 // } 4159 // if (ag.length > 2) {//28022 4160 // $("#ChBoxAreaGeoA-" + ag.substring(0, 2) + "")[0].checked = false; 4161 // } 4162 4163 4164 //} 4165} 4166 4167function verificarHijosAreaGeo(idAgeoPadre, idAgeo, check) { 4168 var checkHijo = null; 4169 /*if ($('#li_busqATUS').hasClass('active')) { 4170 if ($("#divAreaGeoA-" + idAgeoPadre)[0]) 4171 if ($("#divAreaGeoA-" + idAgeoPadre)[0].innerHTML != "") { 4172 4173 $("#divAreaGeoA-" + idAgeoPadre + " ul").each(function (index) { 4174 var id = $(this).attr('id'); 4175 checkid = id.replace('divAreaGeoA-', ''); 4176 checkHijo = $("#ChBoxAreaGeoA-" + checkid)[0]; 4177 if (checkHijo) { 4178 if (checkHijo.checked) { 4179 var rowD = $("#tr_D" + checkid)[0]; 4180 if (rowD) 4181 rowD.parentNode.removeChild(rowD); 4182 } 4183 checkHijo.checked = check; 4184 4185 if (idAgeo.length < 6) 4186 if ($("#divAreaGeoA-" + checkid)[0].innerHTML != "") 4187 verificarHijosAreaGeoM(checkid, checkid, check); 4188 } 4189 4190 }); 4191 // agatus = idAgeoPadre; 4192 } 4193 } 4194 else {*/ 4195 if ($("#divAreaGeoD-" + idAgeoPadre)[0]) 4196 if ($("#divAreaGeoD-" + idAgeoPadre)[0].innerHTML != "") { 4197 checkHijo = ""; 4198 $("#divAreaGeoD-" + idAgeoPadre + " ul").each(function (index) { 4199 var id = $(this).attr('id'); 4200 var checkid = id.replace('divAreaGeoD-', ''); 4201 checkHijo = $("#ChBoxAreaGeo-" + checkid)[0]; 4202 if (checkHijo) { 4203 if (checkHijo.checked) { 4204 var rowD = $("#tr_D" + checkid)[0]; 4205 if (rowD) 4206 rowD.parentNode.removeChild(rowD); 4207 } 4208 checkHijo.checked = check; 4209 if (idAgeo.length < 6) 4210 if ($("#divAreaGeoD-" + checkid)[0].innerHTML != "") 4211 verificarHijosAreaGeoM(checkid, checkid, check); 4212 } 4213 4214 }); 4215 } 4216 // } 4217 4218} 4219 4220function verificarHijosAreaGeoM(idAgeoPadre, idAgeo, check) { 4221 var checkHijo = ""; 4222 4223 if ($("#divAreaGeoD-" + idAgeoPadre)[0]) 4224 if ($("#divAreaGeoD-" + idAgeoPadre)[0].innerHTML != "") { 4225 4226 $("#divAreaGeoD-" + idAgeoPadre + " input").each(function (index) { 4227 var id = $(this).attr('id'); 4228 var checkid = id.replace('ChBoxAreaGeo-', ''); 4229 checkHijo = $("#ChBoxAreaGeo-" + checkid)[0]; 4230 if (checkHijo) { 4231 if (checkHijo.checked) { 4232 $("#ChBoxAreaGeo-00").addClass('parentPartialSelect'); 4233 4234 var rowD = $("#tr_D" + checkid)[0]; 4235 if (rowD) 4236 rowD.parentNode.removeChild(rowD); 4237 } 4238 checkHijo.checked = check; 4239 } 4240 4241 }); 4242 } 4243 //} 4244} 4245 4246function verificaHermanosAreaGeo(idAgeo, check) { 4247 //console.log(idAgeo + "verificaHermanosAreaGeo"); 4248 4249 if ($("#ChBoxAreaGeo-" + idAgeo)[0]) { 4250 var idAgeoPadre = idAgeo.substring(0, 2); 4251 if (idAgeo.length == 9) 4252 idAgeoPadre.substring(0, 5);
4253 if (idAgeo.length > 2) { 4254 var checkPadre = true; 4255 var checkHijo = ""; 4256 $("#divAreaGeoD-" + idAgeoPadre + " ul").each(function (index) { 4257 var id = $(this).attr('id'); 4258 var checkid = id.replace('divAreaGeoD-', ''); 4259 checkHijo = $("#ChBoxAreaGeo-" + checkid)[0]; 4260 if (checkHijo) 4261 if (!checkHijo.checked) 4262 checkPadre = false; 4263 4264 }); 4265 if (checkPadre) { 4266 $("#divAreaGeoD-" + idAgeoPadre + " ul").each(function (index) { 4267 var id = $(this).attr('id'); 4268 var checkid = id.replace('divAreaGeoD-', ''); 4269 checkHijo = $("#ChBoxAreaGeo-" + checkid)[0]; 4270 if (checkHijo) 4271 if (checkHijo.checked) { 4272 var rowD = $("#tr_D" + checkid)[0]; 4273 if (rowD) 4274 rowD.parentNode.removeChild(rowD); 4275 } 4276 4277 }); 4278 if (idAgeoPadre !== "00") { 4279 var table = $("#tableAreaGeoSelectD")[0]; 4280 $("#tableAreaGeoSelectD")[0].setAttribute("style", "display:none"); 4281 var row = table.insertRow(table.rows.length); 4282 row.id = "tr_D" + idAgeoPadre; 4283 var cell1 = row.insertCell(0); 4284 cell1.className = "oculta"; 4285 var cell2 = row.insertCell(1); 4286 cell1.innerHTML = idAgeoPadre; 4287 cell2.innerHTML = "<div class='cortarTextoParamB' id='td" + idAgeoPadre + "' title='" + $("#tdGeoDes_" + idAgeoPadre)[0].innerHTML + "' data-toggle='tooltip'>" + $("#tdGeoDes_" + idAgeoPadre)[0].innerHTML + "</div>"; 4288 var cell3 = row.insertCell(2); 4289 cell3.innerHTML = '<span class="glyphicon glyphicon-remove icon_off" name="removeMenu" style="float: right" onclick="seleccionAreaGeografica(\'' + idAgeoPadre + '\', \'' + '' + '\', 2)" ></span>'; 4290 } 4291 $("#ChBoxAreaGeo-" + idAgeoPadre)[0].className = ""; 4292 $("#ChBoxAreaGeo-" + idAgeoPadre)[0].checked = check; 4293 //alter('dd'); 4294 $("#ChBoxAreaGeo-00").addClass("parentPartialSelect"); 4295 } 4296 else { 4297 4298 $("#ChBoxAreaGeo-" + idAgeoPadre).addClass('parentPartialSelect'); 4299 4300 } 4301 verificaHermanosAreaGeo(idAgeoPadre, check); 4302 } 4303 } 4304 //} 4305 mostrarDivParametros(); 4306} 4307 4308function verificarPadreAreaGeo(idAgeo) { 4309 var idAgeoPadre = $("#divAreaGeoD-" + idAgeo).parent().attr("id"); 4310 idAgeoPadre = idAgeoPadre.replace("divAreaGeoD-", ""); 4311 var cntHijos = 0; 4312 if ($("#ChBoxAreaGeo-" + idAgeoPadre)[0]) { 4313 if ($("#ChBoxAreaGeo-" + idAgeoPadre)[0].checked) { 4314 4315 $("#divAreaGeoD-" + idAgeoPadre + " ul").each(function (index) { 4316 var id = $(this).attr('id'); 4317 var checkid = id.replace('divAreaGeoD-', ''); 4318 if (idAgeo != checkid) { 4319 if ($("#ChBoxAreaGeo-" + checkid)[0]) { 4320 var row = $("#tableAreaGeoSelectD")[0].insertRow($("#tableAreaGeoSelectD")[0].rows.length); 4321 row.id = "tr_D" + checkid; 4322 var cell0 = row.insertCell(0); 4323 cell0.innerHTML = checkid; 4324 cell0.className = "oculta"; 4325 row.insertCell(1).innerHTML = "<div class='cortarTextoParamB' id='td" + checkid + "' title='" + $("#tdGeoDes_" + checkid)[0].innerHTML + "' data-toggle='tooltip'>" + $("#tdGeoDes_" + checkid)[0].innerHTML + "</div>"; 4326 row.insertCell(2).innerHTML = '<span class="glyphicon glyphicon-remove icon_off" name="removeMenu" style="float: right" onclick="seleccionAreaGeografica(\'' + checkid + '\', \'\', 2)" ></span>'; 4327 cntHijos++; 4328 $("#tableAreaGeoSelectD")[0].setAttribute("style", "display:none"); 4329 } 4330 } 4331 }); 4332 if (cntHijos > 0) 4333 $("#ChBoxAreaGeo-" + idAgeoPadre).addClass("parentPartialSelect"); 4334 4335 $("#ChBoxAreaGeo-" + idAgeoPadre)[0].checked = false; 4336 var rowD = $("#tr_D" + idAgeoPadre)[0]; 4337 if (rowD) 4338 rowD.parentNode.removeChild(rowD); 4339 4340 } 4341 else { 4342 $("#divAreaGeoD-" + idAgeoPadre + " ul").each(function (index) { 4343 var id = $(this).attr('id'); 4344 var checkid = id.replace('divAreaGeoD-', ''); 4345 if (idAgeo != checkid) { 4346 if ($("#ChBoxAreaGeo-" + checkid)[0]) 4347 if ($("#ChBoxAreaGeo-" + checkid)[0].checked) 4348 cntHijos++; 4349 } 4350 }); 4351 if (cntHijos < 1) 4352 $("#ChBoxAreaGeo-" + idAgeoPadre).removeClass("parentPartialSelect"); 4353 } 4354 } 4355 if (idAgeoPadre.length > 2) 4356 verificarPadreAreaGeo(idAgeoPadre); 4357 mostrarDivParametros(); 4358} 4359 4360function checkBusquedaAvAreaGeo(idAgeo) { 4361 var cveSelec = false; 4362 for (var d = 0; d < ($('#tableAreaGeoSelectD')[0]).rows.length; d++) { 4363 if ($('#tableAreaGeoSelectD')[0].rows[d].cells[0].innerHTML == idAgeo) { 4364 cveSelec = true; 4365 break; 4366 } 4367 } 4368 return cveSelec; 4369} 4370 4371function eliminarHijosSelecAVGeo(idAgeo) { 4372 for (var d = 0; d < ($('#tableAreaGeoSelectD')[0]).rows.length; d++) {
4373 var idAgeoS = ($('#tableAreaGeoSelectD')[0]).rows[d].cells[0].innerHTML; 4374 if (idAgeo.length < idAgeoS.length) 4375 if (idAgeoS.substring(0, idAgeo.length) == idAgeo) { 4376 var rowD = document.getElementById("tr_D" + idAgeoS); 4377 if (rowD) 4378 rowD.parentNode.removeChild(rowD); 4379 } 4380 } 4381} 4382 4383function selecParcialPadresAvAreaGeo(idAgeo) { 4384 for (var id = idAgeo.length - 1; id > 1; id--) { 4385 var idAgeoPadre = idAgeo.substring(0, id); 4386 if ($("#ChBoxAreaGeo-" + idAgeoPadre)[0]) { 4387 $("#ChBoxAreaGeo-" + idAgeoPadre).addClass("parentPartialSelect"); 4388 } 4389 } 4390} 4391 4392function checkParcialPadreAvAreaGeo(idAgeo) { 4393 var hijoSelect = false; 4394 for (var d = 0; d < ($('#tableAreaGeoSelectD')[0]).rows.length; d++) { 4395 var idAgeoS = ($('#tableAreaGeoSelectD')[0]).rows[d].cells[0].innerHTML; 4396 if (idAgeoS.length > idAgeo.length) 4397 if (idAgeoS.substring(0, idAgeo.length) == idAgeo) { 4398 hijoSelect = true; 4399 break; 4400 } 4401 } 4402 return hijoSelect; 4403} 4404 4405 4406 4407 4408 4409/*******************************************************************/ 4410 4411 4412 4413 4414 4415 4416function mostrarDivParametros() { 4417 if ($('#tableCriteriosBusqueda').find("span[name=removeMenu]").length) { 4418 $("#divParametros").show(); 4419 $("#searchbutton").prop("disabled", false); 4420 } 4421 else { 4422 $("#divParametros").hide(); 4423 $("#searchbutton").prop("disabled", true); 4424 } 4425} 4426 4427function menuEdicon() { 4428 var parametros = { 4429 metodo: 'ComponenteEdicion'//nombre del método 4430 }; 4431 $.post("/app/mapa/espacioydatos/servicios/Descarga.ashx", parametros, function (data) { 4432 if (data.code === 200) { 4433 if (data.obj !== null) { 4434 $.ajax({
4435 async: false, 4436 complete: function (obj, exito) { 4437 4438 resMenuEdicion(data.obj); 4439 }, 4440 type: "GET" 4441 }); 4442 } 4443 } 4444 else { 4445 appInsights.trackException({ exception: "Error consulta menú edición componentne: " }, { name: "servicios/Descarga.ashx", ip: ipClient }); 4446 console.log("Error consulta menú edicóon componente: "); 4447 } 4448 //$('[data-toggle="tooltip"]').tooltip(); 4449 }); 4450} 4451 4452function resMenuEdicion(obj) { 4453 if (obj) { 4454 for (var l = 0; l < obj.length; l++) { 4455 4456 if (obj !== null) { 4457 var desEdicion = obj[l][0]; 4458 obj[l][0] = obj[l][0].trim(); 4459 //var idche = obj[l][0]; 4460 //var idver = obj[l][1].trim(); 4461 //if (obj[l][1].trim() !== "") 4462 // obj[l][0] = obj[l][0] + '' + obj[l][1]; 4463 4464 4465 //if (obj[l][1].trim() !== "") 4466 //desEdicion += ' vers. ' + obj[l][1]; 4467 var tbGeo = document.createElement("li"); 4468 tbGeo.setAttribute("class", "colorHover"); 4469 4470 var tdActImg = document.createElement("span"); 4471 tdActImg.setAttribute("style", "margin-right:3px"); 4472 tdActImg.setAttribute('data-bs-toggle', 'tooltip'); 4473 tdActImg.setAttribute('data-bs-placement', 'top'); 4474 tdActImg.setAttribute('title', desEdicion); 4475 var tdActDes = document.createElement("div"); 4476 tdActDes.setAttribute('data-bs-toggle', 'tooltip'); 4477 tdActDes.setAttribute('data-bs-placement', 'top'); 4478 tdActDes.setAttribute('title', desEdicion); 4479 tdActDes.setAttribute("class", "cortarTextoD"); 4480 tdActDes.appendChild(document.createTextNode(desEdicion)); 4481 tdActDes.setAttribute("width", "100%"); 4482 4483 tdActDes.setAttribute("id", "tdEdi_" + obj[l][1].trim()); 4484 var checkAct = document.createElement('input'); 4485 checkAct.setAttribute("style", "vertical-align:top;margin-right:3px;"); 4486 checkAct.type = "checkbox"; 4487 checkAct.name = "checkboxEdi"; 4488 checkAct.value = obj[l][1].trim(); 4489 checkAct.id = "ChBoxEdicion-" + obj[l][1].trim(); 4490 4491 // checkAct.click = "checkver('ChBoxEdicion-" + obj[l][1].trim() + "')"; 4492 4493 4494 var divContent = document.createElement("div"); 4495 divContent.setAttribute("class", "divLeft"); 4496 4497 divContent.appendChild(checkAct); 4498 divContent.appendChild(tdActImg); 4499 tbGeo.appendChild(divContent); 4500 tbGeo.appendChild(tdActDes); 4501 var idDivPadre; 4502 idDivPadre = $("#ulollapseEd")[0]; 4503 idDivPadre.appendChild(tbGeo); 4504 $('#ChBoxEdicion-' + obj[l][1].trim() + '').click(function () { 4505 if (this.checked) 4506 $('#btnconsultar').removeAttr('disabled'); 4507 }); 4508 } 4509 } 4510 } 4511 4512 4513} 4514 4515 4516function addFiltros() { 4517 4518 $('<div>', { 4519 'id': 'divfiltro', 4520 'class': 'col-sm-12', 4521 'style': 'padding-top: 5px;padding-left: 0px;padding-right:0px' 4522 }).appendTo('#panelizq'); 4523 4524 $('<fieldset>', { 4525 'id': 'divcomfiltro', 4526 'class': 'compMapas' 4527 }).appendTo('#divfiltro'); 4528 4529 $('<legend>', { 4530 'class': 'compMapas' 4531 //'text': ' Filtros ' 4532 }).appendTo('#divcomfiltro'); 4533 4534 $('<div>', { 4535 'class': 'accordion', 4536 'id': 'accordion' 4537 }).appendTo('#divcomfiltro'); 4538 4539 //ag 4540 $('<div>', { 4541 'class': 'accordion-item sd_item_accordion', 4542 'id': 'divListaAg' 4543 }).append($('<h2>', { 4544 'class': 'accordion-header', 4545 'id': 'Ag-heading1' 4546 }).append($('<button>', { 4547 'class': 'accordion-button collapsed', 4548 'data-bs-toggle': "collapse", 4549 'data-bs-target': "#divAgeoCollapse", 4550 'aria-expanded': 'true', 4551 'aria-controls': "divAgeoCollapse", 4552 'text': idioma !== 'en' ? 'Ãrea geográfica' : 'Geographical area' 4553 }
4553))).append( 4554 $('<div>', { 4555 'id': 'divAgeoCollapse', 4556 'class': 'accordion-collapse collapse', 4557 'role': 'region', 4558 'aria-labelledby': 'Ag-heading1', 4559 'data-bs-parent': '#accordion', 4560 'style': 'height: 200px!important;max-height:200px;overflow-y: auto;overflow-x: hidden;' 4561 }).append($('<div>', { 4562 'class': 'accordion-body' 4563 }).append($('<div>', { 4564 'id': 'divAreaGeoD-1' 4565 }) 4566 ))).appendTo('#accordion'); 4567 4568 //ver 4569 $('<div>', { 4570 'class': 'accordion-item sd_item_accordion', 4571 'id': 'divListaEd' 4572 }).append($('<h2>', { 4573 'class': 'accordion-header', 4574 'id': 'Ver-heading1' 4575 }).append($('<button>', { 4576 'class': 'accordion-button collapsed', 4577 'data-bs-toggle': "collapse", 4578 'data-bs-target': "#divVerCollapse", 4579 'aria-expanded': 'true', 4580 'aria-controls': "divVerCollapse", 4581 'text': idioma !== 'en' ? 'Versión' : 'Version' 4582 }))).append( 4583 $('<div>', { 4584 'class': 'accordion-collapse collapse', 4585 'id': 'divVerCollapse', 4586 'role': 'region', 4587 'aria-labelledby': 'Ver-heading1', 4588 'style': 'height: 200px!important;max-height:200px;overflow-y: auto;', 4589 'data-bs-parent': '#accordion' 4590 }).append($('<div>', { 4591 'class': 'accordion-body' 4592 }).append($('<ul>', { 4593 'id': 'ulollapseEd', 4594 'style': 'padding-left:0px;font-size:13px' 4595 }))) 4596 ).appendTo('#accordion'); 4597 //capa 4598 $('<div>', { 4599 'class': 'accordion-item sd_item_accordion', 4600 'id': 'divListaCapa' 4601 }).append($('<h2>', { 4602 'class': 'accordion-header', 4603 'id': 'Capa-heading1' 4604 }).append($('<button>', { 4605 'class': 'accordion-button collapsed', 4606 'data-bs-toggle': "collapse", 4607 'data-bs-target': "#layer1", 4608 'aria-expanded': 'true', 4609 'aria-controls': "layer1", 4610 'text': idioma !== 'en' ? 'Capas' : 'Layers' 4611 }))).append( 4612 $('<div>', { 4613 'class': 'accordion-collapse collapse', 4614 'style': 'height: 200px!important;max-height:200px;overflow-y: auto;', 4615 'id': 'layer1', 4616 'role': 'region', 4617 'aria-labelledby': 'Capa-heading1', 4618 'data-bs-parent': '#accordion' 4619 }) 4620 4621 ).appendTo('#accordion'); 4622 4623 4624 4625 4626 4627 $('<div>', { 4628 'class': 'campoobliga', 4629 'id': 'spanalert' 4630 4631 }).appendTo('#divcomfiltro'); 4632 4633 $('<button>', { 4634 'class': 'btn btn-primary', 4635 'id': 'btnconsultar', 4636 'aria-label': 'Consultar', 4637 'onclick': 'consultarinfo();', 4638 'text': idioma !== 'en' ? 'Consultar' : 'View', 4639 'style': 'float: right;' 4640 //'disabled':'true' 4641 }).appendTo('#divcomfiltro'); 4642 $('<table>', { 4643 //'style': 'display:none', 4644 'id': 'tableAreaGeoSelectD' 4645 }).appendTo('#divcomfiltro'); 4646 4647 //if (window.location.pathname !== '/temas/mg/') 4648 $('#panelizq')[0].style.overflow = "auto"; 4649 //else 4650 // $('#panelizq')[0].style.overflow = "hidden"; 4651 4652 4653 //Tabla para los resultados 4654 $('<div>', { 4655 'style': 'padding-top:5px!important;' 4656 //'class': "table-responsive" 4657 }).append( 4658 $('<table>', 4659 { 4660 'id': 'tableres', 4661 'style': 'display:none', 4662 'class': 'table sd_table' 4663 })).appendTo('#divCont'); 4664 $('#tableres').append( 4665 $('<thead >') 4666 .append($('<tr>') 4667 .append($('<td scope="col">').append(idioma !== 'en' ? 'Ãrea geográfica' : 'Geographical area')) 4668 //.append($('<td class="td-header">').append("Edición")) 4669 .append($('<td scope="col">').append(idioma !== 'en' ? 'Versión' : 'Version')) 4670 .append($('<td scope="col">').append(idioma !== 'en' ? 'Capa' : 'Layer')) 4671 .append($('<td scope="col">').append((idioma !== 'en' ? 'Tipo de archivo' : 'File types'))))); 4672 4673 4674 //Modal para avisar que faltan campos de ser llenados 4675 4676 4677 4678 4679 //$('<button>', { 4680 // 'id': 'btnload', 4681 // 'data-target': '#myModal', 4682 // "data-toggle": "modal", 4683 // 'style': 'display: none;' 4684 //}).appendTo('#divCont'); 4685 4686 4687 4688 4689 //$('<div>', { 4690 // 'class': "modal fade",
4691 // 'id': "myModal", 4692 // 'role': "dialog" 4693 //}) 4694 // .appendTo('#divCont'); 4695 4696 //$('<div>', { 4697 // 'id': 'popalert' 4698 4699 //}).append( 4700 // $('<div>', { 4701 // 'class': 'content-popup' 4702 // }).append( 4703 // $('<button>', { 4704 // 'data-dismiss': 'modal', 4705 // 'class': 'close' 4706 // }).append($('<span>', 4707 // { 4708 // "style": "font-size: 20px; float: right;", 4709 // "class": "closedbtn inegi-cerrar", 4710 // "data-toggle": "tooltip", 4711 // "data-placement": "bottom", 4712 // "data-dismiss": "modal", 4713 // "data-original-title": "", 4714 // "title": "" 4715 // }) 4716 // ) 4717 4718 // ), 4719 // $('<div>', { 4720 // 'id': 'contenidomodal' 4721 // }).append($('<h2>', { 4722 // 'text': 'Falta de seleccionar algún campo para la descarga', 4723 // 'class': 'mgeo_pre tituImprimir titPresIne1' 4724 // }), 4725 // $('<img>', { 4726 // 'src': '/componentes/espaciov2/v2/images/CapturaFiltro.JPG' 4727 // }) 4728 // ) 4729 4730 //).appendTo('#myModal'); 4731 4732 menuEdicon(); 4733 menuAreaGeo('', ''); 4734 4735 4736 4737} 4738 4739$(document).ready(function () { 4740 $('#open').on('click', function () { 4741 $('#popup').fadeIn('slow'); 4742 $('.popup-overlay').fadeIn('slow'); 4743 $('.popup-overlay').height($(window).height()); 4744 return false; 4745 }); 4746 4747 $('#close').on('click', function () { 4748 $('#popup').fadeOut('slow'); 4749 $('.popup-overlay').fadeOut('slow'); 4750 return false; 4751 }); 4752 4753 //$('.nav-link').each(function (i, obj) { 4754 // if (obj.id) { 4755 4756 4757 // if (obj.id !== "mapas") { 4758 // console.log(obj.id + "no"); 4759 // if (popover2 !== null) { 4760 // popover2.hide(); 4761 // } 4762 // if (popover3 !== null) { 4763 // popover3.hide(); 4764 // } 4765 // if (popover4 !== null) { 4766 // popover4.hide(); 4767 // } 4768 // } 4769 // else { 4770 // console.log(obj.id + "ma"); 4771 // if (popover2 !== null) { 4772 // popover2.show(); 4773 // } 4774 // if (popover3 !== null) { 4775 // popover3.show(); 4776 // } 4777 // if (popover4 !== null) { 4778 // popover4.show(); 4779 // } 4780 // } 4781 // } 4782 //}); 4783}); 4784 4785 4786function toggleAccordion(e) { 4787 var inputG = 0; 4788 var panelH = 0; 4789 $("#panelizq").each(function () { 4790 panelH = panelH + $(this)[0].offsetHeight; 4791 }); 4792 $("#panelizq .input-group-sm").each(function () { 4793 inputG = inputG + $(this)[0].clientHeight; 4794 }); 4795 var menos = $('#panelizq').height() + panelH + inputG; 4796 $("#accordion .collapsible-area").css('max-height', ($(window).height() - menos)); 4797 $(e.target) 4798 .prev('.panel-heading') 4799 .find("i.indicator") 4800 .toggleClass('glyphicon-chevron-down glyphicon-chevron-up'); 4801} 4802 4803 4804function menuCapas() { 4805 nododsCapas = null; 4806 var parametros = { 4807 metodo: 'ComponenteCapas'//nombre del método 4808 }; 4809 $.post("/app/mapa/espacioydatos/servicios/Descarga.ashx", parametros, function (data) { 4810 if (data.code === 200) { 4811 if (data.obj !== null) { 4812 $.ajax({
4813 async: false, 4814 complete: function (obj, exito) { 4815 //console.log(data.obj); 4816 resMenuCapas(data.obj); 4817 }, 4818 type: "GET" 4819 }); 4820 } 4821 } 4822 else { 4823 appInsights.trackException({ exception: "Error consulta menú edición componentne: " }, { name: "servicios/Descarga.ashx", ip: ipClient }); 4824 console.log("Error consulta menú edicóon componente: "); 4825 } 4826 // $('[data-toggle="tooltip"]').tooltip(); 4827 }); 4828} 4829 4830function resMenuCapas(objres) { 4831 4832 $.each(objres, function (ind, objrescapa) { 4833 4834 if (objrescapa[0] !== null) { 4835 if (ind === 0) { 4836 nodosCapas = '[{' + 4837 '"nombre": " Organización territorial geoestadÃstica",' + 4838 '"nombre_en": " Organización territorial geoestadÃstica",' + 4839 '"id_nodo": "1_1",' + 4840 '"tiene_hijos": true,' + 4841 '"id_nodo_padre": 1,' +// Marco Geoestad\u00edstico 4842 '"collapsed": false,' + 4843 '"capas": [' + 4844 ' {' + 4845 '"nombre_es": "' + objrescapa[0] + '",' + 4846 '"nombre_en": "' + objrescapa[0] + '",' + 4847 '"ws_geoserver": "Sitio_Inegi",' + 4848 '"capa_geoserver": "' + objrescapa[1] + '",' + 4849 '"visible": true,' + 4850 // '"visible": ' + (objrescapa[3] === "1")? true : false +',' + 4851 4852 '"zoomInicial": 5,' + 4853 '"Descripcion_capa": "",' + 4854 '"estilo": "' + objrescapa[2] + '",' + 4855 '"id_nodoCapa": "1_1_' + objrescapa[3] + '",' + 4856 '"id_descarga": "",' + 4857 '"imagen": "' + objrescapa[4] + '",' + 4858 '"id_CapaFusion": ""' + 4859 '}]' + 4860 '}]'; 4861 4862 } 4863 else { 4864 if (objrescapa[1].trim() !== "") { 4865 //if (objrescapa[3] === "3")//Localidades 4866 //{ 4867 // obj = JSON.parse(nodosCapas); 4868 // obj[0]['capas'].push( 4869 // { 4870 // "nombre_es": objrescapa[0] + "", 4871 // "nombre_en": objrescapa[0] + "", 4872 // "ws_geoserver": "Sitio_Inegi", 4873 // "capa_geoserver": objrescapa[1] + "", 4874 // "visible": false, 4875 // "zoomInicial": 5, 4876 // "Descripcion_capa": "", 4877 // "estilo": 'mg_loc_poligapunto', 4878 // "id_nodoCapa": "1_1_25", 4879 // "id_descarga": "", 4880 // "imagen": objrescapa[4], 4881 // "id_CapaFusion": "" 4882 // } 4883 // ); 4884 // nodosCapas = JSON.stringify(obj); 4885 //} 4886 4887 /*var jsonStr = '{"theTeam":[{"teamId":"1","status":"pending"},{"teamId":"2","status":"member"},{"teamId":"3","status":"member"}]}';*/ 4888 4889 var obj = JSON.parse(nodosCapas); 4890 obj[0]['capas'].push( 4891 { 4892 "nombre_es": objrescapa[0] + "", 4893 "nombre_en": objrescapa[0] + "", 4894 "ws_geoserver": "Sitio_Inegi", 4895 "capa_geoserver": objrescapa[1] + "", 4896 "visible": false, 4897 "zoomInicial": 5, 4898 "Descripcion_capa": "", 4899 "estilo": objrescapa[2], 4900 "id_nodoCapa": "1_1_" + objrescapa[3], 4901 "id_descarga": "", 4902 "imagen": objrescapa[4], 4903 "id_CapaFusion": "" 4904 } 4905 4906 ); 4907 //console.log(objrescapa[3]); 4908 nodosCapas = JSON.stringify(obj); 4909 4910 } 4911 } 4912 4913 } 4914 4915 4916 });
4917 nodosCapas = JSON.parse(nodosCapas); 4918 4919 crearMenuCapas(); 4920} 4921 4922var edicion = ""; 4923var version = ""; 4924var ag = ""; 4925var liscapa = ""; 4926 4927 4928var veccarpeta = [ 4929 { IDE: 'ENT', DESCRIPCION: 'AGEE' }, 4930 { IDE: 'MUN', DESCRIPCION: 'AGEM' }, 4931 { IDE: 'AR', DESCRIPCION: 'AGEB rural' }, 4932 { IDE: 'A', DESCRIPCION: 'AGEB urbano' }, 4933 { IDE: 'LPR', DESCRIPCION: 'Localidad rural puntual' }, 4934 { IDE: 'L', DESCRIPCION: 'Localidad amanzanada urbana y rural' }, 4935 { IDE: 'M', DESCRIPCION: 'Manzana geoestadÃstica' }, 4936 { IDE: 'FM', DESCRIPCION: 'Frente de manzana' }, 4937 { IDE: 'E', DESCRIPCION: 'Vialidad' }, 4938 { IDE: 'TI', DESCRIPCION: 'Elemento insular geoestadÃstico' }, 4939 { IDE: 'SIA', DESCRIPCION: 'Servicio de información complementaria tipo área' }, 4940 { IDE: 'SIL', DESCRIPCION: 'Servicio de información complementaria tipo lÃnea' }, 4941 { IDE: 'SIP', DESCRIPCION: 'Servicio de información complementaria tipo punto' }, 4942 { IDE: 'PE', DESCRIPCION: 'PolÃgono externo' }, 4943 { IDE: 'PEM', DESCRIPCION: 'PolÃgono externo de manzana' }, 4944 { IDE: 'CD', DESCRIPCION: 'CaserÃo disperso' }, 4945 { IDE: 'LCU', DESCRIPCION: 'Localidad urbana' }, 4946 { IDE: 'CDU', DESCRIPCION: 'CaserÃo Disperso Urbano' }, 4947 { IDE: 'CDR', DESCRIPCION: 'CaserÃo Disperso Rural' }, 4948 { IDE: 'EVU', DESCRIPCION: 'Eje de Vialidad Urbano' }, 4949 { IDE: 'EVR', DESCRIPCION: 'Eje de Vialidad Rural' }, 4950 { IDE: 'SIAU', DESCRIPCION: 'Servicio de área urbano' }, 4951 { IDE: 'SIAR', DESCRIPCION: 'Servicio de área rural' }, 4952 { IDE: 'SIPU', DESCRIPCION: 'Servicio de Punto Urbano' }, 4953 { IDE: 'SIPR', DESCRIPCION: 'Servicio de Punto Rural' }, 4954 { IDE: 'SILU', DESCRIPCION: 'Servicio de LÃnea Urbano' }, 4955 { IDE: 'SILR', DESCRIPCION: 'Servicio de LÃnea Rural' }, 4956 { IDE: 'SIA', DESCRIPCION: 'Ãreas verdes / parques' } 4957]; 4958var flagnoexiste = false; 4959function consultarinfo() { 4960 $('#btnconsultar')[0].disabled = true; 4961 $('#spanalert')[0].innerHTML = ""; 4962 flagshp = false; 4963 var contag = 0; 4964 var contedi = 0; 4965 var contcapa = 0; 4966 var radio = ""; 4967 ordenCapas = []; 4968 filastabla = []; 4969 $("#tableres").find("tr:gt(0)").remove(); 4970 4971 if (($('#divListaAg')[0].style.display === "block") || ($('#divListaAg')[0].style.display === '')) { 4972 //Descarga nacional 4973 if ($("#tableAreaGeoSelectD tr").length === 0 && ($('#ChBoxAreaGeo-00')[0].checked === true)) { 4974 contag++; 4975 $(".liMenuCapas input").each(function (obc, objcapa) { 4976 if ($(objcapa).is(":checked")) { 4977 contcapa++; 4978 var nomcapa = ""; 4979 4980 $("input[name=checkboxEdi]").each(async (ed, objed) => { 4981 if (ed !== 0) { 4982 await sleep(ed * 4300); 4983 } 4984 if ($(objed).is(":checked")) { 4985 // console.log($(objcapa)[0].id.replace('checkcapa', '').substring(4, 2)); 4986 contedi++; 4987 var ediciones = $(objed).val().split('_'); 4988 descversion = $("#tdEdi_" + $(objed).val() + "")[0].innerText.split(' '); 4989 var descver = ""; 4990 for (var i = 1; i < descversion.length; i++) 4991 descver += " " + descversion[i]; 4992 4993 edicion = ediciones[0].trim(); 4994 version = ediciones[1]; 4995 //console.log(edicion); 4996 //console.log(version); 4997 if (ed !== 0) { 4998 await sleep(ed * 300); 4999 } 5000 5001 5002 5003 $.each(veccarpeta, function (ind, elem) { 5004 if ($('#divcapa' + $(objcapa)[0].id.replace('checkcapa', '') + '')[0].innerText === elem.DESCRIPCION) { 5005 nomcarpeta = "" + elem.IDE + ""; 5006 nomcapa = $('#divcapa' + $(objcapa)[0].id.replace('checkcapa', '') + '')[0].innerText;// "AGEE"; 5007 $("#tableres")[0].setAttribute("style", ""); 5008 $('#tableres').append($('<tr>') 5009 .append($('<td>').append("Estados Unidos Mexicanos")) 5010 .append($('<td>').append(edicion + " " + descver)) 5011 .append($('<td>').append(nomcapa)) 5012 .append($('<td>').append($("<a>", { 5013 "href": "https://www.inegi.org.mx/contenidos/descargadenue/MGdescarga/
5013MGN" + edicion.trim() + "_" + version.trim() + "/" + edicion.trim() + "_" + version.trim() + "_00_" + nomcarpeta + ".zip" 5014 }).append($("<img>", { 5015 "class": "imgFormato", 5016 "src": "/img/ico/ico_shp.png" 5017 5018 }))) 5019 )); 5020 5021 flagshp = true; 5022 $('#btnconsultar')[0].disabled = false; 5023 } 5024 5025 }); 5026 5027 5028 5029 5030 5031 } 5032 }); 5033 } 5034 5035 }); 5036 } 5037 else { 5038 var conom = 0; 5039 $("#tableAreaGeoSelectD tr").each(function (ag, obj) { 5040 contag++; 5041 var aux = 0; 5042 $(".liMenuCapas input").each(function (obc, objcapa) { 5043 if ($(objcapa).is(":checked")) { 5044 contcapa++; 5045 var nomcapa = ""; 5046 5047 $("input[name=checkboxEdi]").each(async (ed, objed) => { 5048 5049 if (ed !== 0) { 5050 await sleep(ed * 300); 5051 } 5052 if ($(objed).is(":checked")) { 5053 contnotlayer = 0; 5054 contedi++; 5055 var ediciones = $(objed).val().split('_'); 5056 descversion = $("#tdEdi_" + $(objed).val() + "")[0].innerText.split(' '); 5057 var descver = ""; 5058 for (var i = 1; i < descversion.length; i++) 5059 descver += " " + descversion[i]; 5060 edicion = ediciones[0].trim(); 5061 version = ediciones[1]; 5062 conom = 0; 5063 $.each(veccarpeta, function (ind, elem) { 5064 if ($('#divcapa' + $(objcapa)[0].id.replace('checkcapa', '') + '')[0].innerText === elem.DESCRIPCION) { 5065 if (conom === 0) { 5066 nomcarpeta = "" + elem.IDE + ""; 5067 } 5068 } 5069 5070 }); 5071 5072 5073 5074 nomcapa = $('#divcapa' + $(objcapa)[0].id.replace('checkcapa', '') + '')[0].innerText;// "AGEE"; 5075 //Esto es para validar cuando no haya información de los pregenerados 5076 5077 conom++; 5078 contnotlayer = 0; 5079 5080 if (obj.id.replace('tr_D', '').length === 5) { 5081 5082 parametros = { 5083 metodo: 'ComponenteRegistro',//nombre del método 5084 Ag: '' + $(obj)[0].id.replace('tr_D', '') + '',//1_1_1 5085 capa: '' + $(objcapa)[0].id.replace('checkcapa', '').substring(4) + '', 5086 edicion: '' + edicion + '', 5087 version: '' + version + '', 5088 radio: '' + radio + '' 5089 5090 }; 5091 $.ajax({
5092 type: 'POST', //Tipo de peticiòn, 5093 async: false, 5094 url: '/app/mapa/espacioydatos/servicios/Descarga.ashx', // Url y metodo que se invoca 5095 data: parametros, 5096 success: function (data) { //Procesar el valor del método invocado 5097 5098 if (data.code === 200) { 5099 $("#tableres")[0].setAttribute("style", ""); 5100 $('#tableres').append($('<tr>') 5101 .append($('<td>').append("" + $('#td' + ($(obj)[0].id.replace('tr_D', '')))[0].innerText)) 5102 .append($('<td>').append(descversion[0] + " " + descver)) 5103 // .append($('<td>').append(descversion[1])) 5104 .append($('<td>').append(nomcapa)) 5105 .append($('<td>').append($("<a>", { 5106 "id": "a" + data.obj + "", 5107 "style": "cursor: pointer;"// color:#337ab7;" 5108 }).append($("<img>", { 5109 "id": "img" + data.obj + "", 5110 "src": "/img/cargando.gif", 5111 "class": "imgFormato" 5112 5113 }))) 5114 )); 5115 5116 } 5117 descargaMG(data.obj); 5118 5119 }, 5120 beforeSend: function () { 5121 5122 }, 5123 complete: function () { }, 5124 error: function (e) { 5125 console.log("error consulta menuActEconomicaD"); 5126 } 5127 }); 5128 5129 //$.each(filejson, function (idx, elemento) { 5130 // flagnoexiste = false; 5131 // id = obj.id.replace('tr_D', '').substring(0, 2); 5132 // if (id === elemento.cve) { 5133 // contag++; 5134 // $.each(elemento.ediciones, function (idx, elementocapa) { 5135 // contnotlayer++; 5136 // if (elementocapa.edicion === descversion[0].trim() && (elementocapa.version === version.trim())) { 5137 // contnotlayer++; 5138 // contedi++; 5139 // // $.each(elemento.ediciones, function (idx, elementoedicion) { 5140 // $.each(elementocapa.capas, function (idx, elementoecapas) { 5141 // if ($(objcapa)[0].id.replace('checkcapa', '') === elementoecapas.capaId) { 5142 // contnotlayer++; 5143 // contcapa++; 5144 // flagnoexiste = true; 5145 // $("#tableres")[0].setAttribute("style", ""); 5146 // $('#tableres').append($('<tr>') 5147 // .append($('<td>').append("" + $('#td' + ($(obj)[0].id.replace('tr_D', '')))[0].innerText)) 5148 // .append($('<td>').append(descversion[0] + " " + descver)) 5149 // .append($('<td>').append(nomcapa)) 5150 // .append($('<td>').append($("<a>", { 5151 // // "href": "#", 5152 // "text": "No hay información disponible" 5153 // }) 5154 // //.append($("<img>", { 5155 // //"class": "imgFormato", 5156 // //"src": "/img/ico/ico_shp.png" 5157 // //})) 5158 // ) 5159 // )); 5160 // $('#btnconsultar')[0].disabled = false; 5161 // } 5162 5163 // }); 5164 // } 5165 5166 5167 // }); 5168 5169 // } 5170 // if (idx === filejson.length - 1) { 5171 // if (flagnoexiste === false) { 5172 // parametros = { 5173 // metodo: 'ComponenteRegistro',//nombre del método 5174 // Ag: '' + $(obj)[0].id.replace('tr_D', '') + '',//1_1_1 5175 // capa: '' + $(objcapa)[0].id.replace('checkcapa', '').substring(4) + '', 5176 // edicion: '' + edicion + '', 5177 // version: '' + version + '', 5178 // radio: '' + radio + '' 5179 5180 // }; 5181 // $.ajax({
5182 // type: 'POST', //Tipo de peticiòn, 5183 // async: false, 5184 // url: '/app/mapa/espacioydatos/servicios/Descarga.ashx', // Url y metodo que se invoca 5185 // data: parametros, 5186 // success: function (data) { //Procesar el valor del método invocado 5187 5188 // if (data.code === 200) { 5189 // $("#tableres")[0].setAttribute("style", ""); 5190 // $('#tableres').append($('<tr>') 5191 // .append($('<td>').append("" + $('#td' + ($(obj)[0].id.replace('tr_D', '')))[0].innerText)) 5192 // .append($('<td>').append(descversion[0] + " " + descver)) 5193 // // .append($('<td>').append(descversion[1])) 5194 // .append($('<td>').append(nomcapa)) 5195 // .append($('<td>').append($("<a>", { 5196 // "id": "a" + data.obj + "", 5197 // "style": "cursor: pointer; color:#337ab7;" 5198 // }).append($("<img>", { 5199 // "id": "img" + data.obj + "", 5200 // "src": "/img/cargando.gif", 5201 // "class": "imgFormato" 5202 5203 // }))) 5204 // )); 5205 5206 // } 5207 // descargaMG(data.obj); 5208 5209 // }, 5210 // beforeSend: function () { 5211 5212 // }, 5213 // complete: function () { }, 5214 // error: function (e) { 5215 // console.log("error consulta menuActEconomicaD"); 5216 // } 5217 // }); 5218 // } 5219 5220 // } 5221 5222 //}); 5223 5224 5225 } 5226 5227 else { 5228 5229 $.each(filejson, function (idx, elemento) { 5230 // contnotlayer = 0; 5231 if (obj.id.replace('tr_D', '') === elemento.cve) { 5232 contag++; 5233 contnotlayer++; 5234 $.each(elemento.ediciones, function (idx, elementoedicion) { 5235 if (elementoedicion.edicion === descversion[0].trim() && (elementoedicion.version === version.trim())) { 5236 contnotlayer++; 5237 contedi++; 5238 // $.each(elemento.ediciones, function (idx, elementoedicion) { 5239 $.each(elementoedicion.capas, function (idx, elementoecapas) { 5240 if ($(objcapa)[0].id.replace('checkcapa', '') === elementoecapas.capaId) { 5241 5242 contnotlayer++; 5243 contcapa++; 5244 $("#tableres")[0].setAttribute("style", ""); 5245 $('#tableres').append($('<tr>') 5246 .append($('<td>').append("" + $('#td' + ($(obj)[0].id.replace('tr_D', '')))[0].innerText)) 5247 .append($('<td>').append(descversion[0] + " " + descver)) 5248 .append($('<td>').append(nomcapa)) 5249 .append($('<td>').append($("<a>", { 5250 // "href": "#", 5251 "text": "No hay información disponible" 5252 }) 5253 //.append($("<img>", { 5254 //"class": "imgFormato", 5255 //"src": "/img/ico/ico_shp.png" 5256 //})) 5257 ) 5258 )); 5259 $('#btnconsultar')[0].disabled = false; 5260 } 5261 }); 5262 5263 //}); 5264 5265 } 5266 }); 5267 5268 } 5269 }); 5270 //en caso que no entre al json 5271 //console.log(contnotlayer); 5272 if (contnotlayer < 3) { 5273 5274 $("#tableres")[0].setAttribute("style", ""); 5275 $('#tableres').append($('<tr>') 5276 .append($('<td>').append("" + $('#td' + ($(obj)[0].id.replace('tr_D', '')))[0].innerText)) 5277 .append($('<td>').append(descversion[0] + " " + descver)) 5278 .append($('<td>').append(nomcapa)) 5279 .append($('<td>').append($("<a>", { 5280 "href": "https://www.inegi.org.mx/contenidos/descargadenue/MGdescarga/
5280MGN" + descversion[0].trim() + "_" + version.trim() + "/" + obj.id.replace('tr_D', '') + "/" + descversion[0].trim() + "_" + version.trim() + "_" + obj.id.replace('tr_D', '') + "_" + nomcarpeta + ".zip" 5281 }).append($("<img>", { 5282 "class": "imgFormato", 5283 "src": "/img/ico/ico_shp.png" 5284 }))) 5285 )); 5286 $('#btnconsultar')[0].disabled = false; 5287 5288 } 5289 } 5290 5291 5292 } 5293 }); 5294 } 5295 5296 }); 5297 }); 5298 } 5299 //console.log(contcapa); 5300 setTimeout(function () { 5301 if (contcapa === 0 || contedi === 0 || contag === 0) { 5302 $('#spanalert')[0].innerHTML = idioma !== 'en' ? "Por favor selecciona al menos un elemento en cada filtro." : 'Please select at least one item in each filter'; 5303 //$('#divAgeoCollapse').removeClass('in'); 5304 //$('#collapseA2').removeClass('in'); 5305 //$('#layer1').removeClass('in'); 5306 5307 if (contag === 0) 5308 if (!$('#divAgeoCollapse').hasClass('in')) 5309 $('#divAgeoCollapse')[0].click(); 5310 5311 5312 else if (contedi === 0) 5313 if (!$('#collapseA2').hasClass('in')) 5314 $('#divEdCollapse')[0].click(); 5315 else if (contcapa === 0) 5316 if (!$('#layer1').hasClass('in')) 5317 $('#divListaCapa')[0].click(); 5318 5319 5320 } 5321 5322 }, 4000); 5323 5324 5325 } 5326 else { 5327 busqHerramientas(); 5328 } 5329 5330 5331} 5332function sleep(ms) { 5333 return new Promise(resolve => setTimeout(resolve, ms)); 5334} 5335var flagdescarga = 0; 5336function descargaMG(idfr) { 5337 flagdescarga++; 5338 //var parametros = { 5339 // metodo: 'LeerDescargaComponente', //nombre del método 5340 //divAgeoCollapseurl: '4' 5341 //}; 5342 var ifrm = document.createElement("iframe"); 5343 ifrm.setAttribute("id", "ifrm" + idfr + ""); 5344 ifrm.setAttribute("onload", "frameLoaded(" + idfr + ")"); 5345 if (window.location.host.indexOf('desarrollo') != -1) 5346 ifrm.setAttribute("src", "/descargaCapasv2/?ID_DESCARGAMG=" + idfr + ""); 5347 else 5348 ifrm.setAttribute("src", "https://www.inegi.org.mx/descargaCapasv2/?ID_DESCARGAMG=" + idfr + ""); 5349 ifrm.setAttribute("style", "display:none"); 5350 //ifrm.style.width = "640px"; 5351 //ifrm.style.height = "480px"; 5352 document.body.appendChild(ifrm); 5353 doc = ifrm.contentDocument; 5354 a = doc; 5355 5356 //var $iframe = $("ifrm" + idfr + ""); 5357 //setTimeout(function () { 5358 //$iframe.each(function () { 5359 5360 // ruta = $(this).contents().find("a").attr("onclick").split(");"); 5361 // ruta = ruta[0].replace('window.open("', ""); 5362 // ruta = ruta[0].replace('"', ""); 5363 // console.log(ruta); 5364 // eval('var ruta' + idfr + '="' + ruta + '"'); 5365 // //$('#img' + idfr + '')[0].setAttribute("src", "/img/ico/ico_shp.png"); 5366 // //console.log("iFrame cargado. Puedes llamar otra función ahora"); 5367 // //$('#a' + idfr + '')[0].setAttribute("href", ruta); 5368 5369 // // window.open("https://www.inegi.org.mx/contenidos/descargadenue/DescargaCapas/8359503174777626389.zip"); registerDescargaAppInsights() 5370 //}); 5371 //}, 100); 5372 5373 5374 5375 //$.post("/servicios/Descarga.ashx", parametros, function (data) { 5376 // if (data.code === 200) { 5377 // if (data.obj !== null) { 5378 // $.ajax({
5379 // async: false, 5380 // complete: function (obj, exito) { 5381 // console.log(data.obj); 5382 // console.log('descarg'); 5383 // }, 5384 // type: "GET" 5385 // }); 5386 // } 5387 // } 5388 // else { 5389 // appInsights.trackException({ exception: "Error consulta menú edición componentne: " }, { name: "servicios/Descarga.ashx", ip: ipClient }); 5390 // console.log("Error consulta menú edicóon componente: "); 5391 // } 5392 // $('[data-toggle="tooltip"]').tooltip(); 5393 //}); 5394} 5395var flagshp = false; 5396 5397function frameLoaded(idfra) { 5398 flagdescarga-- 5399 if (flagshp === false) 5400 flagshp = true; 5401 var iframe = $("#ifrm" + idfra + ""); 5402 // console.log(iframe); 5403 var ruta; 5404 5405 5406 5407 if ($("#ifrm" + idfra + "").contents().find("#form1")[0].action.indexOf('no_hay_informacion') !== -1) { 5408 5409 $('#a' + idfra + '')[0].innerHTML = "No hay información disponible"; 5410 } 5411 else if ($("#ifrm" + idfra + "").contents().find("#form1")[0].action.indexOf('ok') !== -1) { 5412 5413 iframe.each(function () { 5414 5415 $('#a' + idfra + '')[0].setAttribute("onclick", $(this).contents().find("a").attr("onclick").replace('registerDescargaAppInsights()', '')); 5416 // window.open("https://www.inegi.org.mx/contenidos/descargadenue/DescargaCapas/8359503174777626389.zip"); registerDescargaAppInsights() 5417 }); 5418 5419 $('#img' + idfra + '')[0].setAttribute("src", "/img/ico/ico_shp.png"); 5420 } 5421 else { 5422 5423 $('#a' + idfra + '')[0].innerHTML = "Intentar más tarde"; 5424 } 5425 if (flagshp === true) { 5426 //$('#btnload')[0].click(); 5427 flagshp = "truef"; 5428 } 5429 //console.log("iFrame cargado. Puedes llamar otra función ahora"); 5430 //$('#a' + idfra + '')[0].setAttribute("href", eval('ruta' + idfra + '')); 5431 if (flagdescarga === 0) 5432 $('#btnconsultar')[0].disabled = false; 5433 5434} 5435 5436function limpiarAreaGeo() { 5437 var tDENUEA = document.getElementById('tableAreaGeoSelectD'); 5438 for (var a = tDENUEA.rows.length - 1; a >= 0; a--) { 5439 var idAreaGeoT = tDENUEA.rows[a].cells[0].innerHTML; 5440 var nombreAreaGeoT = tDENUEA.rows[a].cells[1].innerHTML; 5441 seleccionAreaGeografica(idAreaGeoT, nombreAreaGeoT, 2); 5442 } 5443 5444} 5445 5446//#region herramientas 5447var hRectangle; 5448var hPolygon; 5449var hCircle; 5450var radioDistancia = 0; 5451function herramientas() { 5452 agregarHerramientas(); 5453} 5454 5455function inicializarHerramientas(iMap) { 5456 5457 hRectangle = new rectangleTool({ olMap: iMap.getMap() }); 5458 hPolygon = new polygonTool({ olMap: iMap.getMap() }); 5459 hCircle = new circleTool({ olMap: iMap.getMap() }); 5460 hAgregarEventosMapa(iMap); 5461} 5462 5463function initializeRectangle() { 5464 $('#spanalert')[0].innerHTML = ""; 5465 $('#btnconsultar')[0].disabled = false; 5466 if ($("#bbtnRectangle").hasClass("active")) { 5467 $('#polygoneTab').removeClass("active"); 5468 hRectangle.deactivate(); 5469 limpiaRectangulo(); 5470 flagTool = false; 5471 } 5472 else { 5473 limpiaRectangulo(); 5474 limpiaPoligono(); 5475 limpiaCirculo(); 5476 5477 $('#rect_a, #rect_p').css('display', 'none'); 5478 $('#circleTabHeader .tab-display').hide(); 5479 $('#polygoneTabHeader .tab-display').hide(); 5480 5481 $('#rectangleTabHeader .tab-display').click().show(); 5482 5483 $("#rectangleTabHeader").click(function (e) { 5484 5485 $('#polygoneTab').removeClass("active"); 5486 $('#circleTab').removeClass("active"); 5487 $('#rectangleTab').removeClass("active"); 5488 5489 $('#polygoneTabHeaderL').removeClass("active"); 5490 $('#circleTabHeaderL').removeClass("active"); 5491 $('#rectangleTabHeaderL').removeClass("active"); 5492 5493 $('#rectangleTab').addClass("active"); 5494 $('#rectangleTabHeaderL').addClass("active"); 5495 //$('#rectangleTabHeaderL').show(); 5496 5497 5498 //$('#polygoneTabHeader').hide(); 5499 //$('#circleTabHeader').hide(); 5500 //$('#rectangleTabHeader').hide(); 5501 5502 //$('#rectangleTab').addClass("active"); 5503 //$('#rectangleTabHeaderL').addClass("active"); 5504 //$('#rectangleTabHeader').show(); 5505 5506 5507 }); 5508 5509
5510 //$('#btnRectangle').removeClass('rectangle-icon').addClass('rectangle-on-icon'); 5511 5512 $('#bbtnRectangle').addClass('active');//.addClass('rectangle-on-icon'); 5513 5514 $('#polygoneTab').removeClass("active"); 5515 $('#circleTab').removeClass("active"); 5516 $('#rectangleTab').removeClass("active"); 5517 $('#rectangleTab').addClass("active"); 5518 5519 $('#circleTabHeaderL').hide(); 5520 $('#polygoneTabHeaderL').hide(); 5521 $('#rectangleTabHeaderL').addClass("active"); 5522 $('#rectangleTabHeaderL').show(); 5523 5524 5525 hPolygon.deactivate(); 5526 hCircle.deactivate(); 5527 hRectangle.activate(); 5528 flagTool = true; 5529 $('#divListaAg')[0].setAttribute("style", "display:none"); 5530 5531 } 5532} 5533 5534function rectangleTool(options) { 5535 5536 var isActive = false; 5537 var source = new ol.source.Vector(); 5538 5539 var defaults = { 5540 style: new ol.style.Style({ 5541 fill: new ol.style.Fill({ 5542 color: 'rgba(0, 0,255 , 0.4)' 5543 }), 5544 stroke: new ol.style.Stroke({ 5545 color: '#0000FF', 5546 width: 2 5547 }), 5548 image: new ol.style.Circle({ 5549 radius: 6, 5550 stroke: new ol.style.Stroke({ 5551 color: 'white', 5552 width: 2 5553 }), 5554 fill: new ol.style.Fill({ 5555 color: 'rgba(0, 0,255 , 0.4)' 5556 }) 5557 }) 5558 }) 5559 }; 5560 5561 var vectorLayer = new ol.layer.Vector({ 5562 source: source, 5563 style: (options.style) ? options.style : defaults.style 5564 }); 5565 5566 vectorLayer.set('LAYER_NAME', 'RECTANGLE_TOOL_VECTOR_LAYER'); 5567 options.olMap.addLayer(vectorLayer); 5568 vectorLayer.setZIndex(1000); 5569 options.olMap.set('rectangletooldrawend', -1, false); 5570 5571 var key = null; 5572 var pointerMoveHandler = function (evt) { 5573 this.getTargetElement().style.cursor = 'crosshair'; 5574 }; 5575 5576 var draw = new ol.interaction.Draw({ 5577 source: source, 5578 style: (options.style) ? options.style : defaults.style, 5579 type: 'Circle', 5580 geometryFunction: ol.interaction.Draw.createBox() 5581 }); 5582 5583 draw.on('drawstart', function (event) { 5584 5585 }); 5586 5587 draw.on('drawend', function (evt) { 5588 ol.Observable.unByKey(key); 5589 options.olMap.getTargetElement().style.cursor = 'default'; 5590 options.olMap.set('rectangletooldrawend', evt); 5591 }); 5592 5593 this.activate = function () { 5594 options.olMap.removeInteraction(draw); 5595 options.olMap.addInteraction(draw); 5596 key = options.olMap.on('pointermove', pointerMoveHandler); 5597 isActive = true; 5598 } 5599 5600 this.deactivate = function () { 5601 options.olMap.removeInteraction(draw); 5602 isActive = false; 5603 } 5604 5605 this.clear = function () { 5606 source.clear(); 5607 } 5608 5609 this.isActive = function () { return isActive; } 5610 5611 this.getWKTGeometry = function () { 5612 var geometry = null; 5613 var features = source.getFeatures(); 5614 if (features.length > 0) { 5615 var format = new ol.format.WKT(); 5616 geometry = format.writeGeometry(features[0].getGeometry()); 5617 } 5618 return geometry; 5619 } 5620 5621 this.getGeometry = function () { 5622 var geometry = null; 5623 var features = source.getFeatures(); 5624 if (features.length > 0) { 5625 geometry = features[0].getGeometry(); 5626 } 5627 return geometry; 5628 } 5629 5630 this.getArea = function () { 5631 var area = null; 5632 var features = source.getFeatures(); 5633 if (features.length > 0) { 5634 area = features[0].getGeometry().getArea(); 5635 } 5636 return area; 5637 } 5638 5639 this.getPerimeter = function () { 5640 var perimeter = null; 5641 var features = source.getFeatures(); 5642 if (features.length > 0) { 5643 var coordinates = features[0].getGeometry().getCoordinates()[0]; 5644 perimeter = new ol.geom.LineString(coordinates).getLength() 5645 } 5646 return perimeter; 5647 } 5648} 5649 5650function hRectangleToolDrawEnd() { 5651 hRectangle.deactivate(); 5652 showToolsTabs(); 5653 setTimeout(function () { 5654 $('#rect_a').css('display', ''); 5655 $('#rect_p').css('display', ''); 5656 $("#selec_rp").val(hRectangle.getPerimeter().toFixed(0) + ' m'); 5657 $("#selec_ra").val(hRectangle.getArea().toFixed(3) + ' m²'); 5658 });
5659} 5660 5661function initializePoly() { 5662 $('#btnconsultar')[0].disabled = false; 5663 $('#spanalert')[0].innerHTML = ""; 5664 contadorVertices = 0; 5665 if ($("#bbtnPolygon").hasClass("active")) { 5666 hPolygon.deactivate(); 5667 limpiaPoligono(); 5668 flagTool = false; 5669 } else { 5670 limpiaRectangulo(); 5671 limpiaPoligono(); 5672 limpiaCirculo(); 5673 5674 $('#poli_a, #poli_p').css('display', 'none'); 5675 $('#polygoneTab').removeClass("actrectangleTabHeaderive"); 5676 $('#circleTab').removeClass("active"); 5677 $('#rectangleTab').removeClass("active"); 5678 5679 // $('#btnPolygon').removeClass('polygon-icon').addClass('polygon-on-icon'); 5680 $('#bbtnPolygon').addClass('active'); 5681 5682 $('#polygoneTab').addClass("active"); 5683 $('#circleTabHeader .tab-display').hide(); 5684 5685 $('#polygoneTabHeader .tab-display').click().show(); 5686 5687 $("#polygoneTabHeader").click(function (e) { 5688 5689 5690 $('#polygoneTab').removeClass("active"); 5691 $('#circleTab').removeClass("active"); 5692 $('#rectangleTab').removeClass("active"); 5693 5694 $('#polygoneTabHeaderL').removeClass("active"); 5695 $('#circleTabHeaderL').removeClass("active"); 5696 $('#rectangleTabHeaderL').removeClass("active"); 5697 5698 $('#polygoneTab').addClass("active"); 5699 $('#polygoneTabHeaderL').addClass("active"); 5700 5701 5702 }); 5703 5704 5705 $('#btnPolygon').removeClass('polygone-icon').addClass('polygone-on-icon'); 5706 5707 $('#polygoneTab').removeClass("active"); 5708 $('#circleTab').removeClass("active"); 5709 $('#rectangleTab').removeClass("active"); 5710 $('#polygoneTab').addClass("active"); 5711 5712 $('#circleTabHeaderL').hide(); 5713 $('#polygoneTabHeaderL').addClass("active"); 5714 $('#polygoneTabHeaderL').show(); 5715 $('#rectangleTabHeaderL').hide(); 5716 5717 5718 hRectangle.deactivate(); 5719 hCircle.deactivate(); 5720 hPolygon.activate(); 5721 5722 5723 5724 5725 5726 5727 flagTool = true; 5728 5729 5730 5731 5732 5733 $('#divListaAg')[0].setAttribute("style", "display:none"); 5734 5735 } 5736} 5737 5738function polygonTool(options) { 5739 var isActive = false; 5740 var source = new ol.source.Vector(); 5741 5742 var defaults = { 5743 style: new ol.style.Style({ 5744 fill: new ol.style.Fill({ 5745 color: 'rgba(0, 0,255 , 0.4)' 5746 }), 5747 stroke: new ol.style.Stroke({ 5748 color: '#0000FF', 5749 width: 2 5750 }), 5751 image: new ol.style.Circle({ 5752 radius: 6, 5753 stroke: new ol.style.Stroke({ 5754 color: 'white', 5755 width: 2 5756 }), 5757 fill: new ol.style.Fill({ 5758 color: 'rgba(0, 0,255 , 0.4)' 5759 }) 5760 }) 5761 }) 5762 }; 5763 5764 var vectorLayer = new ol.layer.Vector({ 5765 source: source, 5766 style: (options.style) ? options.style : defaults.style 5767 }); 5768 5769 vectorLayer.set('LAYER_NAME', 'POLYGON_TOOL_VECTOR_LAYER'); 5770 options.olMap.addLayer(vectorLayer); 5771 vectorLayer.setZIndex(1000); 5772 options.olMap.set('polygontooldrawend', -1, false); 5773 5774 var key = null; 5775 var pointerMoveHandler = function (evt) { 5776 this.getTargetElement().style.cursor = 'crosshair'; 5777 }; 5778 5779 var draw = new ol.interaction.Draw({ 5780 source: source, 5781 style: (options.style) ? options.style : defaults.style, 5782 type: 'Polygon' 5783 }); 5784 5785 draw.on('drawstart', function (event) { 5786 5787 }); 5788 5789 draw.on('drawend', function (evt) { 5790 ol.Observable.unByKey(key); 5791 setTimeout(function () { options.olMap.set('polygontooldrawend', evt); }, 50); 5792 options.olMap.getTargetElement().style.cursor = 'default'; 5793 }); 5794 5795 this.activate = function () { 5796 options.olMap.removeInteraction(draw); 5797 options.olMap.addInteraction(draw); 5798 key = options.olMap.on('pointermove', pointerMoveHandler); 5799 isActive = true; 5800 } 5801 5802 this.deactivate = function () { 5803 options.olMap.removeInteraction(draw); 5804 isActive = false; 5805 } 5806 5807 this.clear = function () { 5808 source.clear(); 5809 } 5810 5811 this.getArea = function () { 5812 var area = null; 5813 var features = source.getFeatures(); 5814 if (features.length > 0) { 5815 area = features[0].getGeometry().getArea(); 5816 } 5817 return area; 5818 } 5819 5820 this.getPerimeter = function () { 5821 var perimeter = null; 5822 var features = source.getFeatures(); 5823 if (features.length > 0) { 5824 var coordinates = features[0].getGeometry().getCoordinates()[0]; 5825 perimeter = new ol.geom.LineString(coordinates).getLength() 5826 } 5827 return perimeter; 5828 } 5829 5830 this.isActive = function () { return isActive; } 5831 5832 this.getWKTGeometry = function () { 5833 var geometry = null; 5834 var features = source.getFeatures(); 5835 if (features.length > 0) { 5836 var format = new ol.format.WKT(); 5837 geometry = format.writeGeometry(features[0].getGeometry()); 5838 } 5839 return geometry; 5840 } 5841 5842 this.getGeometry = function () { 5843 var geometry = null; 5844 var features = source.getFeatures(); 5845 if (features.length > 0) { 5846 geometry = features[0].getGeometry(); 5847 } 5848 return geometry; 5849 } 5850 5851 this.getFeature = function () { 5852 var feature = null; 5853 var features = source.getFeatures(); 5854 if (features.length > 0) { 5855 feature = features[0]; 5856 } 5857 return feature; 5858 } 5859} 5860 5861function hPolygonToolDrawEnd() { 5862 hPolygon.deactivate(); 5863 showToolsTabs(); 5864 setTimeout(function () { 5865 $('#poli_a').css('display', ''); 5866 $('#poli_p').css('display', ''); 5867 $("#selec_pp").val(hPolygon.getPerimeter().toFixed(0) + ' m'); 5868 $("#selec_pa").val(hPolygon.getArea().toFixed(3) + ' m²'); 5869 // $('#poli_a,#poli_p').css('display', 'table'); 5870 $('#poli_a,#poli_p').css('display', ''); 5871 }) 5872 5873} 5874 5875function puntoCentro() { 5876 $('#spanalert')[0].innerHTML = ""; 5877 $('#btnconsultar')[0].disabled = false; 5878 if ($('#btnCircle').hasClass('circle-on-icon')) { 5879 limpiaCirculo(); 5880 $('#circleTab').removeClass("active"); 5881 flagTool = false; 5882 } 5883 else { 5884 $('#circle-size, #circle_a, #circle_p').css('display', 'none'); 5885 $('#polygoneTab').removeClass("active"); 5886 $('#circleTab').removeClass("active"); 5887 $('#rectangleTab').removeClass("active"); 5888 limpiaRectangulo(); 5889 limpiaPoligono(); 5890 limpiaCirculo(); 5891 // $("#btnCircle").removeClass('circle-icon').addClass('circle-on-icon') 5892 $("#bbtnCircle").addClass('active'); 5893 $('#circleTab').addClass("active"); 5894 5895 5896 hRectangle.deactivate(); 5897 hPolygon.deactivate(); 5898 5899 hCircle.activate(); 5900 flagTool = true; 5901 $('#divListaAg')[0].setAttribute("style", "display:none"); 5902 creaCirculo(); 5903 5904 5905 } 5906} 5907 5908function creaCirculo() { 5909 5910 $('#circleTabHeader .tab-display').click().show(); 5911 5912 $("#circleTabHeader").click(function (e) { 5913 5914 $('#polygoneTab').removeClass("active"); 5915 $('#circleTab').removeClass("active"); 5916 $('#rectangleTab').removeClass("active"); 5917 5918 5919 $('#polygoneTabHeader').hide(); 5920 $('#circleTabHeader').hide(); 5921 $('#rectangleTabHeader').hide(); 5922 5923 $('#polygoneTabHeaderL').removeClass("active"); 5924 $('#circleTabHeaderL').removeClass("active"); 5925 $('#rectangleTabHeaderL').removeClass("active"); 5926 //$('#ruleTabHeader').removeClass("active"); 5927 5928 $('#circleTab').addClass("active"); 5929 $('#circleTabHeaderL').addClass("active"); 5930 $('#circleTabHeader').show(); 5931 5932 });
5933 5934 //$("#polygoneTabHeader").click(function (e) { 5935 5936 5937 // $('#polygoneTab').removeClass("active"); 5938 // $('#circleTab').removeClass("active"); 5939 // $('#rectangleTab').removeClass("active"); 5940 5941 // $('#polygoneTabHeaderL').removeClass("active"); 5942 // $('#circleTabHeaderL').removeClass("active"); 5943 // $('#rectangleTabHeaderL').removeClass("active"); 5944 5945 // $('#circleTab').addClass("active"); 5946 // $('#circleTabHeaderL').addClass("active"); 5947 5948 5949 //}); 5950 5951 5952 //$('#btnCircle').removeClass('circle-icon').addClass('circle-on-icon'); 5953 $('#bbtnCircle').addClass('active'); 5954 5955 $('#polygoneTab').removeClass("active"); 5956 $('#circleTab').removeClass("active"); 5957 $('#rectangleTab').removeClass("active"); 5958 $('#circleTab').addClass("active"); 5959 5960 $('#circleTabHeaderL').addClass("active"); 5961 $('#polygoneTabHeaderL').hide(); 5962 $('#circleTabHeaderL').show(); 5963 $('#rectangleTabHeaderL').hide(); 5964 5965 5966 //hRectangle.deactivate(); 5967 //hCircle.activate(); 5968 //hPolygon.deactivate(); 5969} 5970 5971function hCirceToolDrawEnd() { 5972 hCircle.deactivate(); 5973 showToolsTabs(); 5974 setTimeout(function () { 5975 $("#selec_p").val(hCircle.getPerimeter().toFixed(3) + ' m'); 5976 $("#selec_a").val(hCircle.getArea().toFixed(3) + ' m²'); 5977 $('#txtMts').val(radioDistancia.toFixed(0) + ' m');//(hCircle.getRadius().toFixed(0) + ' m'); 5978 $('#circle-size, #circle_a, #circle_p').css('display', '');//table 5979 }); 5980} 5981 5982function circleTool(options) { 5983 var isActive = false; 5984 var source = new ol.source.Vector(); 5985 5986 var defaults = { 5987 style: new ol.style.Style({ 5988 fill: new ol.style.Fill({ 5989 color: 'rgba(0, 0,255 , 0.4)' 5990 }), 5991 stroke: new ol.style.Stroke({ 5992 color: '#0000FF', 5993 width: 2 5994 }), 5995 image: new ol.style.Circle({ 5996 radius: 6, 5997 stroke: new ol.style.Stroke({ 5998 color: 'white', 5999 width: 2 6000 }), 6001 fill: new ol.style.Fill({ 6002 color: 'rgba(0, 0,255 , 0.4)' 6003 }) 6004 }), 6005 zIndex: 300 6006 }) 6007 }; 6008 6009 var vectorLayer = new ol.layer.Vector({ 6010 source: source, 6011 style: (options.style) ? options.style : defaults.style 6012 }); 6013 6014 vectorLayer.set('LAYER_NAME', 'CIRCLE_TOOL_VECTOR_LAYER'); 6015 vectorLayer.setZIndex(1000); 6016 options.olMap.addLayer(vectorLayer); 6017 6018 options.olMap.set('circletooldrawend', -1, false); 6019 6020 var key = null; 6021 var pointerMoveHandler = function (evt) { 6022 this.getTargetElement().style.cursor = 'crosshair'; 6023 }; 6024 6025 var draw = new ol.interaction.Draw({ 6026 source: source, 6027 style: (options.style) ? options.style : defaults.style, 6028 type: 'Circle' 6029 }); 6030 6031 draw.on('drawstart', function (event) { 6032 6033 }); 6034 6035 draw.on('drawend', function (evt) { 6036 ol.Observable.unByKey(key); 6037 setTimeout(function () { options.olMap.set('circletooldrawend', evt); }, 50); 6038 var llCircle = evt.feature.values_.geometry.flatCoordinates; 6039 var ltlngCentro = ol.proj.transform([llCircle[0], llCircle[1]], 'EPSG:3857', 'EPSG:4326'); 6040 var ltlngLimit = ol.proj.transform([llCircle[2], llCircle[3]], 'EPSG:3857', 'EPSG:4326'); 6041 radioDistancia = getDistanceLatLonRadius(ltlngCentro[1], ltlngLimit[1], ltlngCentro[0], ltlngLimit[0]); 6042 //console.log(ltlngCentro + '____' + ltlngLimit + ' radio: ' + radioDistancia); 6043 options.olMap.getTargetElement().style.cursor = 'default'; 6044 }); 6045 6046 function getDistanceLatLonRadius(lat2, lat1, lon2, lon1) { 6047 var R = 6371; 6048 var dLat = (lat2 - lat1) * (Math.PI / 180); 6049 var dLon = (lon2 - lon1) * (Math.PI / 180); 6050 var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + 6051 Math.cos(lat1 * (Math.PI / 180)) * Math.cos(lat2 * (Math.PI / 180)) * 6052 Math.sin(dLon / 2) * Math.sin(dLon / 2); 6053 var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); 6054 var d = R * c; 6055 return d * 1000; 6056 } 6057 6058 var modify = new ol.interaction.Modify({ source: source }); 6059 modify.on('modifyend', function (evt) { 6060 ol.Observable.unByKey(key); 6061 setTimeout(function () { options.olMap.set('circletooldrawend', evt); }, 50); 6062 var llCircle = evt.features.array_["0"].values_.geometry.flatCoordinates//evt.feature.values_.geometry.flatCoordinates; 6063 var ltlngCentro = ol.proj.transform([llCircle[0], llCircle[1]], 'EPSG:3857', 'EPSG:4326'); 6064 var ltlngLimit = ol.proj.transform([llCircle[2], llCircle[3]], 'EPSG:3857', 'EPSG:4326'); 6065 radioDistancia = getDistanceLatLonRadius(ltlngCentro[1], ltlngLimit[1], ltlngCentro[0], ltlngLimit[0]); 6066 console.log('modify: ' + ltlngCentro + '____' + ltlngLimit + ' radio: ' + radioDistancia); 6067 options.olMap.getTargetElement().style.cursor = 'default'; 6068 });
6069 options.olMap.addInteraction(modify); 6070 6071 this.activate = function () { 6072 options.olMap.removeInteraction(draw); 6073 options.olMap.addInteraction(draw); 6074 key = options.olMap.on('pointermove', pointerMoveHandler); 6075 isActive = true; 6076 } 6077 6078 this.deactivate = function () { 6079 options.olMap.removeInteraction(draw); 6080 isActive = false; 6081 } 6082 6083 this.clear = function () { 6084 source.clear(); 6085 } 6086 6087 this.getRadius = function () { 6088 var radius = null; 6089 var features = source.getFeatures(); 6090 if (features.length > 0) { 6091 radius = features[0].getGeometry().getRadius(); 6092 } 6093 return radius; 6094 } 6095 6096 this.getArea = function () { 6097 var radius = null; 6098 var area = null; 6099 var features = source.getFeatures(); 6100 if (features.length > 0) { 6101 radius = features[0].getGeometry().getRadius(); 6102 area = Math.PI * Math.pow(parseFloat(radius), 2); 6103 } 6104 return area; 6105 } 6106 6107 this.getPerimeter = function () { 6108 var radius = null; 6109 var perimeter = null; 6110 var features = source.getFeatures(); 6111 if (features.length > 0) { 6112 radius = features[0].getGeometry().getRadius(); 6113 perimeter = 2 * Math.PI * parseFloat(radius); 6114 } 6115 return perimeter; 6116 } 6117 6118 this.isActive = function () { return isActive; } 6119 6120 this.getCenter4326 = function () { 6121 var center = null; 6122 var features = source.getFeatures(); 6123 if (features.length > 0) { 6124 center = ol.proj.transform(features[0].getGeometry().getCenter(), 'EPSG:3857', 'EPSG:4326') 6125 } 6126 return center; 6127 } 6128 6129 this.newCircle = function (lat, Lng, mtsRadio) { 6130 var centerLongitudeLatitude = ol.proj.fromLonLat([parseFloat(Lng), parseFloat(lat)]); 6131 var gxy = new ol.geom.Circle(centerLongitudeLatitude, parseFloat(mtsRadio)); 6132 var olftr2 = new ol.Feature(gxy); 6133 source.addFeature(olftr2); 6134 var vectorHerramientasHistorial = new ol.layer.Vector({ 6135 source: source, 6136 style: [ 6137 new ol.style.Style({ 6138 stroke: new ol.style.Stroke({ 6139 color: '#0000FF', 6140 width: 2 6141 }), 6142 fill: new ol.style.Fill({ 6143 color: 'rgba(0, 0, 255, 0.4)' 6144 }), 6145 zIndex: 300 6146 }) 6147 ] 6148 }); 6149 options.olMap.addLayer(vectorHerramientasHistorial); 6150 radioDistancia = parseFloat(mtsRadio); 6151 } 6152} 6153 6154function hAgregarEventosMapa(iMap) { 6155 6156 iMap.getMap().on('change:rectangletooldrawend', hRectangleToolDrawEnd); 6157 iMap.getMap().on('change:polygontooldrawend', hPolygonToolDrawEnd); 6158 iMap.getMap().on('change:circletooldrawend', hCirceToolDrawEnd); 6159} 6160 6161function agregarHerramientas() { 6162 6163 $('<div>', { 6164 'id': 'tools-container', 6165 'class': 'tools-container' 6166 }).append( 6167 $('<div>', { 6168 'id': 'tool-buttons', 6169 'class': 'btn-group fs-5', 6170 'role': 'group' 6171 }), 6172 $('<div>', { 6173 'id': 'tool-buttonsLeft', 6174 'class': 'btn-group fs-5', 6175 'role': 'group', 6176 'style': 'display:none;top: 7px;' 6177 }) 6178 //).insertBefore('#map2D'); 6179 ).appendTo('#map2D'); 6180 6181 if (window.location.pathname === '/temas/mg/') { 6182 6183 //cambios de mg descarga s publica despues del 23-06-23 6184 $('<button>', { 6185 'class': 'btn fs-5 btn-light', 6186 'aria-label': 'Colapsar' 6187 }).append( 6188 $('<span/>', { 6189 'id': 'collapse-tool-button', 6190 'class': 'inegi-nav-der', 6191 'data-toggle': "tooltip", 6192 'data-placement': "top", 6193 'data-container': "body", 6194 'aria-hidden': "true", 6195 'title': idioma !== 'en' ? "Colapsar" : "Collapse", 6196 'onclick': 'collapsetoolbutton()', 6197 'type': "button" 6198 })).appendTo('#tool-buttons'); 6199 $('<button>', { 6200 'class': 'btn fs-5 btn-light', 6201 'aria-label': 'Expandir' 6202 }).append( 6203 $('<span/>', { 6204 'id': 'collapse-tool-buttonLeft', 6205 'class': 'inegi-nav-izq', 6206 'data-toggle': "tooltip", 6207 'data-placement': "top", 6208 'data-container': "body", 6209 'title': idioma !== 'en' ? "Expandir" : "Expand", 6210 'onclick': 'collapsetoolbutton()', 6211 'type': "button" 6212 })).appendTo('#tool-buttonsLeft'); 6213 $('<button>', { 6214 'class': 'btn fs-5 btn-light', 6215 'aria-label': idioma !== 'en' ? 'Agregar rectángulo' : 'Draw a rectangle to query', 6216 'id': 'bbtnRectangle', 6217 6218 }).append( 6219 $('<span/>', { 6220 'id': 'btnRectangle', 6221 'class': 'inegi-rectangulo', 6222 //'class': 'inegi-limpiar',
6223 'data-toggle': "tooltip", 6224 'data-placement': "top", 6225 'data-container': "body", 6226 'onclick': 'initializeRectangle()', 6227 //'runat': "server", 6228 'type': 'button', 6229 'title': idioma !== 'en' ? 'Agregar rectángulo' : 'Draw a rectangle to query', 6230 })).appendTo('#tool-buttons'); 6231 $('<button>', { 6232 'class': 'btn fs-5 btn-light', 6233 'aria-label': idioma !== 'en' ? 'Agregar polÃgono' : 'Draw a polygon to query', 6234 'id': 'bbtnPolygon', 6235 'style': navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) 6236 || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i) ? 'display:none' : 'display:block' 6237 }).append( 6238 $('<span/>', { 6239 'id': 'btnPolygon', 6240 'class': 'inegi-poligono ', 6241 //'class': 'inegi-limpiar', 6242 'data-toggle': "tooltip", 6243 'data-placement': "top", 6244 'data-container': "body", 6245 'onclick': 'initializePoly()', 6246 //'runat': "server", 6247 'type': 'button', 6248 'title': idioma !== 'en' ? 'Agregar polÃgono' : 'Draw a polygon to query', 6249 })).appendTo('#tool-buttons'); 6250 $('<button>', { 6251 'class': 'btn fs-5 btn-light', 6252 'aria-label': idioma !== 'en' ? "Agregar cÃrculo" : 'Draw a circle to query', 6253 'id': 'bbtnCircle', 6254 }).append( 6255 $('<span/>', { 6256 'id': 'btnCircle', 6257 'class': 'inegi-circulo', 6258 //'class': 'inegi-limpiar', 6259 'data-toggle': "tooltip", 6260 'data-placement': "top", 6261 'data-container': "body", 6262 'onclick': 'puntoCentro()', 6263 //'runat': "server", 6264 'type': 'button', 6265 'title': idioma !== 'en' ? "Agregar cÃrculo" : 'Draw a circle to query', 6266 })).appendTo('#tool-buttons'); 6267 $('<button>', { 6268 'class': 'btn fs-5 btn-light', 6269 'aria-label': 'Limpiar mapa' 6270 }).append( 6271 $('<span/>', { 6272 'id': 'btnClean', 6273 'class': 'inegi-limpiar', 6274 'data-toggle': "tooltip", 6275 'data-placement': "top", 6276 'data-container': "body", 6277 'onclick': 'limpiarHerramientas()', 6278 'type': 'button', 6279 'title': idioma !== 'en' ? "Limpiar mapa" : "Clear map" 6280 })).appendTo('#tool-buttons'); 6281 } 6282 6283 // if (tema === "196" || (tema === "195") || (tema === "204" && location.pathname.indexOf('programas/usyv/') === -1)) 6284 if ((tema === "196") || (tema === "195")) 6285{ 6286 console.log("boton descarga"); 6287 //Button de descarga 6288 $('<button>', { 6289 'class': 'btn fs-5 btn-light',
6290 'aria-label': idioma !== 'en' ? 'Descargar' : 'Download', 6291 'id': 'Div_Descarga', 6292 'style': (navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i)) ? 'display = none ' : '' 6293 }).append( 6294 $('<span/>', { 6295 'id': 'btnDescargar', 6296 'class': 'inegi-descarga', 6297 'data-toggle': "tooltip", 6298 'data-placement': "top", 6299 'data-container': "body", 6300 'onclick': 'showPanelDescarga()', 6301 'type': 'button', 6302 'title': idioma !== 'en' ? 'Descargar' : 'Download' 6303 })).appendTo('#tool-buttons'); 6304 } 6305 if (TipoTema === "E") { 6306 $('<button>', { 6307 'class': 'btn fs-5 btn-light',//'btn fs-5 btn-light', 6308 'aria-label': idioma !== 'en' ? 'Ver Más' : 'Ver Más', 6309 'id': 'Div_Reg' 6310 6311 }).append( 6312 $('<span/>', { 6313 'id': '', 6314 'class': '', 6315 'data-toggle': "tooltip", 6316 'data-placement': "top", 6317 'data-container': "body", 6318 //'onclick': 'showPanelDescarga()', 6319 'type': 'button', 6320 'title': idioma !== 'en' ? 'Ver Más' : 'See more' 6321 })).appendTo('#tool-buttons'); 6322 6323 6324 $('<button>', { 6325 'class': "btn fs-5 btn-light",//'btn fs-5 btn-light', 6326 'aria-label': idioma !== 'en' ? 'Ver Más' : 'Ver Más', 6327 'id': 'Div_VMas', 6328 'onclick': 'Genrahref()' 6329 6330 }).append( 6331 $('<img/>', { 6332 'id': 'Img_VMas', 6333 'src': idioma === "es" ? "/componentes/espaciov2/Images/VMas.png" : "/componentes/espaciov2/Images/VMas-en.png", 6334 'data-toggle': "tooltip", 6335 'data-placement': "top", 6336 'data-container': "body", 6337 //'onclick': 'showPanelDescarga()', 6338 'type': 'button', 6339 'title': idioma !== 'en' ? 'Ver Más' : 'Ver Más' 6340 })).appendTo('#tool-buttons'); 6341 } 6342 6343 ////Button fullscreen 6344 $('<button/> ', { 6345 'class': 'btn fs-5 btn-light ol-full-screen', 6346 'id': 'buttonfullscreen', 6347 'onclick': 'setMapToFullScreen();' 6348 }).append( 6349 $('<span/>', { 6350 'id': 'imgexpandir', 6351 'class': 'inegi-expandir', 6352 'data-toggle': "tooltip", 6353 'data-placement': "top", 6354 'data-container': "body", 6355 'type': 'button', 6356 'title': idioma !== 'en' ? 'Pantalla completa' : 'Full screen' 6357 })).appendTo('#tool-buttons'); 6358 6359 if (window.location.pathname === '/temas/mg/') { 6360 agregartabHerramientas(); 6361 if (navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) 6362 || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i)) collapsetoolbutton(); 6363 6364 } 6365 ////$(".ol-full-screen-false").addClass('btn fs-5 btn-light'); 6366 //$(".ol-full-screen-false")[0].setAttribute('id', 'btnoculta'); 6367 //$(".ol-full-screen-false")[0].setAttribute('style', 'display:none'); 6368 //setTimeout(function () { 6369 6370 // $(".ol-full-screen").removeClass('ol-unselectable ol-control1'); 6371 // //$('.ol-full-screen').attr("", ""); 6372 // //$('.ol-full-screen').attr("", ""); 6373 // //$('.ol-full-screen').attr("", ""); 6374 // //$('.ol-full-screen').attr("title", ""); 6375 // //$('.ol-full-screen').attr("", ""); 6376 6377 // //$(".ol-full-screen-false").html('<span class="inegi-expandir" data-toggle="tooltip" data-placement="top" data-container="body" data-original-title="Pantalla completa"></span>'); 6378 // //$(".ol-full-screen-false")[0].style = "border:none!important;background-color: #f4f7f8;"; 6379 6380 // $(".btn fs-5 btn-light, .ol-full-screen")[0].addEventListener("mouseover", function () { 6381 // $(".btn fs-5 btn-light, .ol-full-screen")[0].style = "outline:none;border:none!important;background-color:rgb(195 198 198);"; 6382 // });
6383 // $(".btn fs-5 btn-light, .ol-full-screen")[0].addEventListener("mouseout", function () { 6384 // $(".btn fs-5 btn-light, .ol-full-screen")[0].style = "outline:none;border:none!important;background-color: #f4f7f8;"; 6385 // }); 6386 // $(".ol-full-screen-false")[0].addEventListener("mouseover", function () { 6387 // $(".ol-full-screen-false")[0].style = "outline:none;border:none!important;background-color:rgb(195 198 198);"; 6388 // }); 6389 // $(".ol-full-screen-false")[0].addEventListener("mouseout", function () { 6390 // $(".ol-full-screen-false")[0].style = "outline:none;border:none!important;background-color: #f4f7f8;"; 6391 // }); 6392 6393 6394 //}, 100); 6395 6396 6397} 6398var full = false; 6399function setMapToFullScreen() { 6400 if (full === false) { 6401 full = true; 6402 //if your map element id is other than 'map' change it here 6403 var elem = document.getElementById('map2D'); 6404 if (elem.requestFullscreen) { 6405 elem.requestFullscreen(); 6406 } 6407 else if (elem.msRequestFullscreen) { 6408 6409 elem.msRequestFullscreen(); 6410 } 6411 else if (elem.mozRequestFullScreen) { 6412 6413 elem.mozRequestFullScreen(); 6414 6415 } 6416 else if (elem.webkitRequestFullscreen) { 6417 6418 elem.webkitRequestFullscreen(); 6419 6420 } 6421 } 6422 else { 6423 closeFullscreen(); 6424 } 6425 6426 //resizeMap(); 6427} 6428 6429function closeFullscreen() { 6430 6431 if (document.exitFullscreen) { 6432 document.exitFullscreen(); 6433 } else if (document.webkitExitFullscreen) { /* Safari */ 6434 document.webkitExitFullscreen(); 6435 } else if (document.msExitFullscreen) { /* IE11 */ 6436 document.msExitFullscreen(); 6437 } 6438 full = false; 6439} 6440function agregartabHerramientas() { 6441 $('<div>', { 6442 'id': 'tabToolsInfo' 6443 }).insertBefore('#tools-container'); 6444 6445 $('<ul>', { 6446 'class': 'nav nav-tabs' 6447 }).append( 6448 $('<li>', { 6449 'id': 'polygoneTabHeader', 6450 'class': 'nav-item', 6451 'role': 'presentation' 6452 }).append( 6453 $('<a>', { 6454 'id': 'polygoneTabHeaderL', 6455 'class': 'nav-link ', 6456 'text': 'PolÃgono' 6457 })), 6458 $('<li>', { 6459 'id': 'circleTabHeader', 6460 'class': 'nav-item', 6461 'role': 'presentation' 6462 }).append( 6463 $('<a>', { 6464 'id': 'circleTabHeaderL', 6465 'class': 'nav-link ', 6466 'text': 'CÃrculo' 6467 })), 6468 $('<li>', { 6469 'id': 'rectangleTabHeader', 6470 'class': 'nav-item', 6471 'role': 'presentation' 6472 }).append( 6473 $('<a>', { 6474 'id': 'rectangleTabHeaderL', 6475 'class': 'nav-link ', 6476 'text': 'Rectángulo' 6477 }))//, 6478 6479 //$('<li>', { 6480 // 'id': 'ruleTabHeader', 6481 // 'class': 'tabToolsHeader', 6482 // 'role': 'presentation' 6483 //}).append( 6484 // $('<a>', { 6485 // 'class': 'tab-display', 6486 // 'text': 'Distancia', 6487 // 'style': 'display:none' 6488 // })) 6489 6490 ).appendTo('#tabToolsInfo'); 6491 $('<div>', { 6492 'class': 'tab-content' 6493 }).append( 6494 $('<div>', { 6495 'id': 'polygoneTab', 6496 'class': 'tab-pane' 6497 }).append(//tab poligono 6498 $('<div>', { 6499 'id': 'poli_p', 6500 'style': 'display: none', 6501 'class': 'mb-3 row' 6502 }).append( 6503 $('<label>', { 6504 'class': "col-sm-4 col-form-label" 6505 }).append('PerÃmetro:'), 6506 $('<div>', { 6507 'class': "col-sm-8" 6508 }).append( 6509 $('<input/>', { 6510 'id': 'selec_pp', 6511 'type': 'text', 6512 'class': 'form-control', 6513 'readonly': "readonly" 6514 }))), 6515 $('<div>', { 6516 'id': 'poli_a', 6517 'style': 'display: none', 6518 'class': 'mb-3 row' 6519 }).append( 6520 $('<label>', { 6521 'style': 'padding-right: 37px;', 6522 'class': "col-sm-4 col-form-label" 6523 }).append('Ãrea:'), 6524 $('<div>', { 6525 'class': "col-sm-8" 6526 }).append( 6527 $('<input>', { 6528 'id': 'selec_pa', 6529 'type': "text", 6530 'readonly': 'readonly', 6531 'class': 'form-control' 6532 })))), 6533 $('<div>', { 6534 'id': 'circleTab', 6535 'class': 'tab-pane' 6536 }).append(//tab circulo 6537 $('<div>', { 6538 'id': 'circle_p', 6539 'class': 'mb-3 row' 6540 }).append( 6541 $('<label>', { 6542 'class': "col-sm-4 col-form-label" 6543 }).append('PerÃmetro:'), 6544 $('<div>', { 6545 'class': "col-sm-8" 6546 }).append( 6547 $('<input/>', { 6548 'id': 'selec_p', 6549 'type': 'text', 6550 'class': 'form-control txtMts', 6551 'readonly': "readonly" 6552 }))), 6553 $('<div>', { 6554 'id': 'circle_a', 6555 'class': 'mb-3 row' 6556 }).append( 6557 $('<label>', { 6558 'class': "col-sm-4 col-form-label", 6559 'style': 'padding-right: 37px;', 6560 }).append('Ãrea:'), 6561 $('<div>', { 6562 'class': "col-sm-8" 6563 }).append( 6564 $('<input/>', { 6565 'id': 'selec_a', 6566 'type': 'text', 6567 'class': 'form-control txtMts', 6568 'readonly': "readonly" 6569 }))), 6570 $('<div>', { 6571 'id': 'circle-size', 6572 'class': 'mb-3 row' 6573 }).append( 6574 $('<label>', { 6575 'class': "col-sm-4 col-form-label", 6576 'style': 'padding-right: 37px;', 6577 }).append('Radio:'), 6578 $('<div>', { 6579 'class': "col-sm-8" 6580 }).append( 6581 $('<input/>', { 6582 'id': 'txtMts', 6583 'type': 'text', 6584 'class': 'form-control', 6585 'disabled': "disabled" 6586 })))), 6587 $('<div>', { 6588 'id': 'rectangleTab', 6589 'class': 'tab-pane' 6590 }).append(//tab rectangulo 6591 $('<div>', { 6592 'id': 'rect_p', 6593 'class': 'mb-3 row', 6594 'style': "display: none" 6595 }).append( 6596 $('<label>', { 6597 'class': "col-sm-4 col-form-label" 6598 }).append('PerÃmetro:'), 6599 $('<div>', { 6600 'class': "col-sm-8" 6601 }).append( 6602 $('<input/>', { 6603 'id': 'selec_rp', 6604 'type': 'text', 6605 'class': 'form-control' 6606 }))), 6607 $('<div>', { 6608 'id': 'rect_a', 6609 'class': 'mb-3 row', 6610 'style': "display: none" 6611 }).append( 6612 $('<label>', { 6613 'class': "col-sm-4 col-form-label", 6614 'style': 'padding-right: 37px;' 6615 }).append('Ãrea:'), 6616 $('<div>', { 6617 'class': "col-sm-8" 6618 }).append( 6619 $('<input/>', { 6620 'id': 'selec_ra', 6621 'type': 'text', 6622 'class': 'form-control', 6623 'readonly': "readonly" 6624 })))) 6625 ).appendTo('#tabToolsInfo'); 6626} 6627 6628function hideToolsTabs() { 6629 6630 $(document).ready(function () {
6631 $('#tabToolsInfo').slideUp(400, function () { 6632 //var maxhe = $(window).height() - ($("#totalHead")[0].offsetHeight) - 180; 6633 $('#tdTabBE').css('margin-top', '12px'); 6634 //$("#divbusq").css('max-height', maxhe); 6635 }); 6636 }); 6637} 6638 6639function showToolsTabs() { 6640 $(document).ready(function () { 6641 $('#tabToolsInfo').slideDown(400, function () { 6642 if ($('#tdTabBE').is(':visible')) { 6643 var maxhe = $(window).height() - 195 - $('#tabToolsInfo').outerHeight(true); 6644 $('#tdTabBE').css('margin-top', '192px'); 6645 //$("#divbusq").css('max-height', maxhe); 6646 } 6647 }); 6648 }); 6649} 6650 6651function limpiaPoligono() { 6652 6653 if (idioma === 'en') 6654 document.getElementById("polygoneTabHeaderL").textContent = 'Polygon'; 6655 else 6656 document.getElementById("polygoneTabHeaderL").textContent = 'PolÃgono'; 6657 $('#polygoneTabHeader .tab-display').hide(); 6658 if ($('#ruleTabHeader').is(':visible')) 6659 $('#ruleTabHeader .tab-display').click().show(); 6660 else 6661 hideToolsTabs(); 6662 //$('#btnPolygon').removeClass('polygon-on-icon').addClass('polygon-icon'); 6663 $('#bbtnPolygon').removeClass('active');//.addClass('polygon-icon'); 6664 6665 limpiarHerramientas(); 6666 $("#selec_pp").val(''); 6667 $("#selec_pa").val(''); 6668} 6669 6670function limpiaCirculo() { 6671 $('#circleTabHeader .tab-display').hide(); 6672 // $('#MallasHeader .tab-display').hide(); 6673 if ($('#ruleTabHeader').is(':visible')) 6674 $('#ruleTabHeader .tab-display').click().show(); 6675 else 6676 hideToolsTabs(); 6677 //$('#btnCircle').removeClass('circle-on-icon').addClass('circle-icon'); 6678 $('#bbtnCircle').removeClass('active');//.addClass('circle-icon'); 6679 6680 //drawingManager.setDrawingMode(null); 6681 hCircle.clear(); 6682 hCircle.deactivate(); 6683 6684 limpiarHerramientas(); 6685 6686 $('#selec_p').val(''); 6687 $('#selec_a').val(''); 6688 $("#txtMts").val(''); 6689} 6690 6691function limpiaRectangulo() { 6692 $('#rectangleTabHeader .tab-display').hide(); 6693 if ($('#ruleTabHeader').is(':visible')) 6694 $('#ruleTabHeader .tab-display').click().show(); 6695 else 6696 hideToolsTabs(); 6697 $('#bbtnRectangle').removeClass('active');//.addClass('rectangle-icon'); 6698 6699 limpiarHerramientas(); 6700 $("#selec_rp").val(''); 6701 $("#selec_ra").val(''); 6702} 6703 6704function limpiarHerramientas() { 6705 if (hRectangle !== null) 6706 hRectangle.clear(); 6707 if (hPolygon !== null) 6708 hPolygon.clear(); 6709 if (hCircle !== null) 6710 hCircle.clear(); 6711 flagTool = false; 6712 $('#divListaAg')[0].setAttribute("style", "display:block"); 6713 hideToolsTabs(); 6714 //$('#btnPolygon').removeClass('polygon-on-icon').addClass('polygon-icon'); 6715 //$('#btnRectangle').removeClass('rectangle-on-icon').addClass('rectangle-icon'); 6716 //$('#btnCircle').removeClass('circle-on-icon').addClass('circle-icon'); 6717 $('#bbtnPolygon').removeClass('active');//.addClass('polygon-icon'); 6718 $('#bbtnRectangle').removeClass('active');//.addClass('rectangle-icon'); 6719 $('#bbtnCircle').removeClass('active');//.addClass('circle-icon'); 6720 6721 //se agrega la función de limpiar las búsquedas 6722 limpiarResAPIgeo(); 6723 closePopUp2(); 6724 closePopUp(); 6725 clickCerrar = false; 6726 6727} 6728 6729function limpiar() { 6730 $('#polygoneTab').removeClass("active"); 6731 $('#circleTab').removeClass("active"); 6732 $('#rectangleTab').removeClass("active"); 6733 6734 limpiarHerramientas(); 6735 limpiaPoligono(); 6736 limpiaCirculo(); 6737 limpiaRectangulo(); 6738} 6739 6740function ConvertGeometry(geometry) { 6741 var coordenadas3857 = geometry.getCoordinates(); 6742 var coordenadas4326 = ""; 6743 6744 for (var i = 0; i < coordenadas3857[0].length; i++) { 6745 6746 coordenadas4326 += (ol.proj.transform(coordenadas3857[0][i], 'EPSG:3857', 'EPSG:4326')).toString() + ";"; 6747 } 6748 coordenadas4326 = coordenadas4326.substring(0, coordenadas4326.length - 1); 6749 return coordenadas4326; 6750} 6751 6752function ConvertGeometryVector(geometry) { 6753 var coordenadas3857 = geometry.getCoordinates();
6754 for (var i = 0; i < coordenadas3857[0].length; i++) { 6755 var coordenadas4326 = (ol.proj.transform(coordenadas3857[0][i], 'EPSG:3857', 'EPSG:4326')).toString(); 6756 CoordenadasXy[i] = coordenadas4326.split(','); 6757 } 6758 return CoordenadasXy; 6759} 6760//**********************************CONSULTAR LAS HERRAMIENTAS**********************************/ 6761function busqHerramientas(tipoBusq) { 6762 manzana = false; 6763 //console.log(tipoBusq); 6764 mtsBusqueda = ''; 6765 6766 6767 6768 if ($("#bbtnCircle").hasClass("active")) { 6769 mtsBusqueda = radioDistancia; //hCircle.getRadius(); 6770 var center = hCircle.getCenter4326(); 6771 coordFigBusqueda = center[0] + ',' + center[1]; 6772 // $('#circle-size, #circle_a, #circle_p').css('display', 'table'); 6773 6774 $('#circle-size, #circle_a, #circle_p').css('display', ''); 6775 } else if ($("#bbtnRectangle").hasClass("active")) { 6776 coordFigBusqueda = ConvertGeometry(hRectangle.getGeometry()); 6777 coordFigBusqueda = coordFigBusqueda.replace(/,/g, ' '); 6778 coordFigBusqueda = coordFigBusqueda.replace(/;/g, ','); 6779 6780 } 6781 else if ($("#bbtnPolygon").hasClass("active")) { 6782 coordFigBusqueda = ConvertGeometry(hPolygon.getGeometry()); 6783 CoordenadasXy = new Array(); 6784 CoordenadasXy = ConvertGeometryVector(hPolygon.getGeometry()); 6785 coordFigBusqueda = coordFigBusqueda.replace(/,/g, ' '); 6786 coordFigBusqueda = coordFigBusqueda.replace(/;/g, ','); 6787 6788 } 6789 6790 var pInvalido = validaHerramientas(); 6791 var vacio = ""; 6792 if (pInvalido) { 6793 var contcapa = 0; 6794 var contedi = 0; 6795 6796 $.ajax({
6797 async: false, 6798 success: function (obj, exito) { 6799 $(".liMenuCapas input").each(function (obc, objcapa) { 6800 6801 $("input[name=checkboxEdi]").each(async (ed, objed) => { 6802 //if (ed !== 0) { 6803 await sleep(ed * 300); 6804 6805 if ($(objcapa).is(":checked")) { 6806 contcapa++; 6807 var nomcapa = ""; 6808 6809 await sleep(ed * 300); 6810 if ($(objed).is(":checked")) { 6811 6812 contedi++; 6813 var ediciones = $(objed).val().split('_'); 6814 // descversion = $("#tdEdi_" + $(objed).val() + "")[0].innerText.split('vers.'); 6815 descversion = $("#tdEdi_" + $(objed).val() + "")[0].innerText.split(' '); 6816 var descver = ""; 6817 for (var i = 1; i < descversion.length; i++) 6818 descver += " " + descversion[i]; 6819 6820 edicion = ediciones[0]; 6821 version = ediciones[1]; 6822 nomcapa = $('#divcapa' + $(objcapa)[0].id.replace('checkcapa', '') + '')[0].innerText; 6823 6824 var parametros = { 6825 metodo: 'ComponenteRegistro',//nombre del método 6826 Ag: '' + coordFigBusqueda + '',//1_1_1 6827 capa: '' + $(objcapa)[0].id.replace('checkcapa', '').substring(4) + '', 6828 edicion: '' + edicion + '', 6829 version: '' + version + '', 6830 radio: '' + radioDistancia.toFixed(0) + '' 6831 6832 }; 6833 ordenCapas.push({ "parametros": parametros, "nombre_capa": nomcapa, "edicion": edicion, "obj": $(objed).val() }); 6834 callComponenteRegistro(parametros, edicion, nomcapa, $(objed).val()); 6835 } 6836 6837 } 6838 //} 6839 6840 }); 6841 6842 6843 }); 6844 }, 6845 complete: function (obj, exito) { 6846 //setTimeout(function () { 6847 //$(ordenCapas).each(function (obj, objcapaOrden) { 6848 // callComponenteRegistro(objcapaOrden.parametros, objcapaOrden.edicion, objcapaOrden.nombre_capa, objcapaOrden.obj); 6849 //}); 6850 //}, 6000); 6851 6852 setTimeout(function () { 6853 6854 if (contcapa === 0 || contedi === 0) { 6855 $('#spanalert')[0].innerHTML = "Por favor selecciona al menos un elemento en cada filtro."; 6856 6857 if (conag === 0) 6858 if (!$('#divAgeoCollapse').hasClass('in')) 6859 $('#divAgeoCollapse')[0].click(); 6860 else if (contedi === 0) 6861 if (!$('#collapseA2').hasClass('in')) 6862 $('#divEdCollapse')[0].click(); 6863 else if (contcapa === 0) 6864 if (!$('#layer1').hasClass('in')) 6865 $('#divListaCapa')[0].click(); 6866 6867 6868 } 6869 else { 6870 $('#spanalert')[0].innerHTML = ""; 6871 } 6872 6873 6874 }, 6000); 6875 } 6876 }); 6877 6878 6879 6880 6881 6882 6883 6884 } 6885 else { 6886 6887 limpiar(); 6888 } 6889} 6890var tabla = ""; 6891var filastabla = []; 6892var contadorFilas = 0; 6893 6894function armarTabla() { 6895 var arrayTablaOrden = []; 6896 $(ordenCapas).each(function (obj, objcapaOrden) { 6897 $(filastabla).each(function (obj2, objfilaOrden) { 6898 if (objcapaOrden.nombre_capa == objfilaOrden.nombre_capa && objcapaOrden.obj == objfilaOrden.edicion) { 6899 arrayTablaOrden.push(objfilaOrden); 6900 } 6901 }); 6902 });
6903 //console.log(arrayTablaOrden); 6904 6905 $(arrayTablaOrden).each(function (obj, objcapaOrden) { 6906 $('#tableres').append(objcapaOrden.fila); 6907 descargaMG(objcapaOrden.obj); 6908 }); 6909 contadorFilas = 0; 6910} 6911 6912function callComponenteRegistro(parametros, edicion, nomcapa, nameobj) { 6913 $.post("/app/mapa/espacioydatos/servicios/Descarga.ashx", parametros, function (data) { 6914 6915 descversion = $("#tdEdi_" + nameobj + "")[0].innerText.split(' '); 6916 var descver = ""; 6917 6918 for (var i = 1; i < descversion.length; i++) 6919 descver += " " + descversion[i]; 6920 6921 if (data.code === 200) { 6922 $("#tableres")[0].setAttribute("style", ""); 6923 /* $('#tableres').append($('<tr>') 6924 .append($('<td>').append("Marco GeostadÃstico de figura trazada en el mapa")) 6925 .append($('<td>').append(edicion)) 6926 //.append($('<td>').append(descversion[1])) 6927 .append($('<td>').append(nomcapa)) 6928 .append($('<td>').append($("<a>", { 6929 "id": "a" + data.obj + "", 6930 "style": "cursor: pointer; color:#337ab7;" 6931 }).append($("<img>", { 6932 "id": "img" + data.obj + "", 6933 "src": "/img/cargando.gif", 6934 "class": "imgFormato" 6935 6936 }))) 6937 ));*/ 6938 tabla += "<tr><td>Marco GeostadÃstico de figura trazada en el mapa</td>"; 6939 tabla += "<td>" + edicion + " " + descver + "</td>"; 6940 //tabla+="<td>"+descversion[1]+"</td>"; 6941 tabla += "<td>" + nomcapa + "</td>"; 6942 tabla += "<td><a id=\"a" + data.obj + "\"\"style=\"cursor=pointer; color=#337ab7\">"; 6943 tabla += "<img id=\"img" + data.obj + "\"src=\"/img/cargando.gif\" class=\"imgFormato\"/></a></td></tr>"; 6944 filastabla.push({ "fila": tabla, "obj": data.obj, "nombre_capa": nomcapa, "edicion": nameobj }); 6945 contadorFilas = contadorFilas + 1; 6946 tabla = ""; 6947 //descargaMG(data.obj); 6948 if (filastabla.length >= ordenCapas.length) { 6949 armarTabla(); 6950 } 6951 6952 } 6953 6954 else { 6955 appInsights.trackException({ exception: "Error consulta menú edición componentne: " }, { name: "servicios/Descarga.ashx", ip: ipClient }); 6956 console.log("Error consulta menú edicóon componente: "); 6957 } 6958 //$('[data-toggle="tooltip"]').tooltip(); 6959 }); 6960} 6961 6962function validaHerramientas() { 6963 var pvalido = true; 6964 6965 if ($("#btnPolygon").hasClass("polygon-on-icon")) { 6966 6967 //Turf unkinkPolygon regresa el número de elementos polÃgono que pueden formarse a partir de las +ecciones de 6968 //un solo polÃgono 6969 6970 //var format = new ol.format.GeoJSON(); 6971 //var turfPoly = format.writeFeatureObject(hPolygon.getFeature()); 6972 //var result = turf.unkinkPolygon(turfPoly); 6973 //pInvalido = (result.features.length == 1) ? true : false; 6974 6975 var pInvalido = interseccionPolygon(); 6976 if (pInvalido) { 6977 pvalido = false; 6978 if (idioma === "en") 6979 alert("Invalid polygon"); 6980 else 6981 alert("PolÃgono inválido"); 6982 } 6983 else { 6984 coordFigBusqueda = validaPolygon(); 6985 $('#poli_a').css('display', ''); 6986 $('#poli_p').css('display', ''); 6987 $("#selec_pp").val(hPolygon.getPerimeter().toFixed(0) + ' m'); 6988 $("#selec_pa").val(hPolygon.getArea().toFixed(3) + ' m²'); 6989 } 6990 } 6991 else if ($("#bbtnRectangle").hasClass("active")) { 6992 var rInvalido = validaRectangulo(coordFigBusqueda); 6993 if (!rInvalido) { 6994 pvalido = false; 6995 if (idioma === "en") 6996 alert("Invalid rectangle"); 6997 else 6998 alert("Réctangulo inválido"); 6999 } else { 7000 $('#rect_a').css('display', ''); 7001 $('#rect_p').css('display', ''); 7002 $("#selec_rp").val(hRectangle.getPerimeter().toFixed(0) + ' m'); 7003 $("#selec_ra").val(hRectangle.getArea().toFixed(3) + ' m²'); 7004 } 7005 7006 } 7007 else { 7008 if (hCircle.getPerimeter() !== null) 7009 $("#selec_p").val(hCircle.getPerimeter().toFixed(3) + ' m'); 7010 if (hCircle.getArea() !== null) 7011 $("#selec_a").val(hCircle.getArea().toFixed(3) + ' m²'); 7012 if (radioDistancia !== null) 7013 $('#txtMts').val(radioDistancia.toFixed(0) + ' m')//(hCircle.getRadius().toFixed(0) + ' m'); 7014 } 7015 return pvalido; 7016} 7017 7018function interseccionPolygon() { 7019 7020 var n_total = CoordenadasXy.length - 2; 7021 var interseccion = false; 7022 var Temp = ""; 7023 var n_inters = n_total; 7024 if (CoordenadasXy.length < 180) { 7025 for (var i = 0; i < n_total && interseccion == false; i++) { 7026 var Ax = parseFloat(CoordenadasXy[i][0]); 7027 var Ay = parseFloat(CoordenadasXy[i][1]); 7028 var Bx = parseFloat(CoordenadasXy[i + 1][0]); 7029 var By = parseFloat(CoordenadasXy[i + 1][1]); 7030 7031 for (var j = i + 2; (j <= n_total) && (interseccion == false); j++) { 7032 var Cx = parseFloat(CoordenadasXy[j][0]); 7033 var Cy = parseFloat(CoordenadasXy[j][1]); 7034 var Dx = ""; 7035 var Dy = ""; 7036 7037 if ((j == n_total) && (i == 0)) { 7038 break; 7039 } 7040 7041 if ((j == n_total) && (i != 0)) { 7042 Dx = parseFloat(CoordenadasXy[0][0]); 7043 Dy = parseFloat(CoordenadasXy[0][1]); 7044 } 7045 else { 7046 Dx = parseFloat(CoordenadasXy[j + 1][0]); 7047 Dy = parseFloat(CoordenadasXy[j + 1][1]); 7048 } 7049 7050 //Obtiene el punto de intersección de las 2 lÃneas 7051 var R1 = (By - Ay) / (Bx - Ax); 7052 var R2 = (Dy - Cy) / (Dx - Cx); 7053 var Ix = ((Ax * R1) - (Cx * R2) + Cy - Ay) / (R1 - R2); 7054 var Iy = R1 * (Ix - Ax) + Ay; 7055 7056 //Ordena las coordenadas antes de validar la intersección 7057 if (Ax > Bx) { 7058 Temp = Ax; 7059 Ax = Bx; 7060 Bx = Temp; 7061 } 7062 if (Ay > By) { 7063 Temp = Ay; 7064 Ay = By; 7065 By = Temp; 7066 } 7067 if (Cx > Dx) { 7068 Temp = Cx; 7069 Cx = Dx; 7070 Dx = Temp; 7071 } 7072 if (Cy > Dy) { 7073 Temp = Cy; 7074 Cy = Dy; 7075 Dy = Temp; 7076 } 7077 7078 //Valida si el punto de intersección forma parte de los 2 segmentos de lÃnea 7079 //if ((Ix > Ax && Ix < Bx) && (Iy > Ay && Iy < By) && (Ix > Cx && Ix < Dx) && (Iy > Cy && Iy < Dy)) { 7080 // interseccion = true; 7081 //} 7082 if (!interseccion) { 7083 //Obtiene el punto de intersección de las 2 lÃneas invertidas 7084 var Axi = parseFloat(CoordenadasXy[j][0]), Bxi = parseFloat(CoordenadasXy[j + 1][0]), Cxi = parseFloat(CoordenadasXy[i][0]), Dxi = parseFloat(CoordenadasXy[i + 1][0]); 7085 var Ayi = parseFloat(CoordenadasXy[j][1]), Byi = parseFloat(CoordenadasXy[j + 1][1]), Cyi = parseFloat(CoordenadasXy[i][1]), Dyi = parseFloat(CoordenadasXy[i + 1][1]); 7086 7087 var R1i = (Byi - Ayi) / (Bxi - Axi); 7088 var R2i = (Dyi - Cyi) / (Dxi - Cxi); 7089 var Ixi = ((Axi * R1i) - (Cxi * R2i) + Cyi - Ayi) / (R1i - R2i); 7090 var Iyi = R1i * (Ixi - Axi) + Ayi; 7091 //Ordena las coordenadas antes de validar la intersección de las lineas invertidas 7092 if (Axi > Bxi) { 7093 Temp = Axi; 7094 Axi = Bxi; 7095 Bxi = Temp; 7096 } 7097 if (Ayi > Byi) { 7098 Temp = Ayi; 7099 Ayi = Byi;
7100 Byi = Temp; 7101 } 7102 if (Cxi > Dxi) { 7103 Temp = Cxi; 7104 Cxi = Dxi; 7105 Dxi = Temp; 7106 } 7107 if (Cyi > Dyi) { 7108 Temp = Cyi; 7109 Cyi = Dyi; 7110 Dyi = Temp; 7111 } 7112 //Valida si el punto de intersección forma parte de los 2 segmentos de lÃnea 7113 if ((Ixi > Axi && Ixi < Bxi) && (Iyi > Ayi && Iyi < Byi) && (Ixi > Cxi && Ixi < Dxi) && (Iyi > Cyi && Iyi < Dyi)) { 7114 interseccion = true; 7115 } 7116 } 7117 } 7118 } 7119 } else { 7120 interseccion = true; 7121 } 7122 return interseccion; 7123} 7124 7125function validaRectangulo(coordenadas) { 7126 let coordenadasmal = "-99.45596480363021 17.48532804738548,-99.4552781581224 17.48532804738548,-99.4552781581224 17.48532804738548,-99.45596480363021 17.48532804738548,-99.45596480363021 17.48532804738548";
7127 let coordenadasbien = "-102.2856330871582 21.90036172332566,-102.24306106567384 21.90036172332566,-102.24306106567384 21.915491878247906,-102.2856330871582 21.915491878247906,-102.2856330871582 21.90036172332566"; 7128 // coordenadas = coordenadasmal; 7129 let arraycoordenadas = coordenadas.split(","); 7130 let coord, coords, coordenadax, coordenaday, coordsenadax, coordsenaday; 7131 let regresar = true; 7132 for (let i = 0; i <= arraycoordenadas.length - 1; i++) { 7133 coord = arraycoordenadas[i].split(" ") 7134 coordenadax = coord[0]; 7135 coordenaday = coord[1]; 7136 for (let j = i + 1; j <= arraycoordenadas.length - 2; j++) { 7137 coords = arraycoordenadas[j].split(" ") 7138 coordsenadax = coords[0]; 7139 coordsenaday = coords[1]; 7140 if (coordenadax == coordsenadax && coordenaday == coordsenaday) { 7141 console.log("se repiten coordenadas x y") 7142 regresar = false; 7143 break; 7144 } 7145 } 7146 if (!regresar) 7147 break; 7148 } 7149 return regresar; 7150} 7151 7152function validaPolygon() { 7153 var sentido = 0; 7154 var coordFig = ""; 7155 var coordsLength = CoordenadasXy.length - 2; 7156 for (var cntCoor = 0; cntCoor < coordsLength; cntCoor++) { 7157 var Ax = parseFloat(CoordenadasXy[cntCoor][0]); 7158 var Ay = parseFloat(CoordenadasXy[cntCoor][1]); 7159 var Bx = parseFloat(CoordenadasXy[cntCoor + 1][0]); 7160 var By = parseFloat(CoordenadasXy[cntCoor + 1][1]); 7161 var Cx = parseFloat(CoordenadasXy[cntCoor + 2][0]); 7162 var Cy = parseFloat(CoordenadasXy[cntCoor + 2][1]); 7163 7164 var St = ((Ax - Bx) * (Cy - By)) - ((Ay - By) * (Cx - Bx)); // s > 0 sentido correcto 7165 7166 7167 if (St > 0) 7168 sentido = sentido + 1; 7169 else 7170 sentido = sentido - 1; 7171 7172 } 7173 if (sentido >= 0) { 7174 //alert("Sentido opuesto"); 7175 for (var p = CoordenadasXy.length - 1; p >= 0; p--) { 7176 coordFig += CoordenadasXy[p][0] + " " + CoordenadasXy[p][1]; 7177 if (p != 0) 7178 coordFig += ","; 7179 } 7180 } 7181 else { 7182 for (var p = 0; p < CoordenadasXy.length; p++) { 7183 coordFig += CoordenadasXy[p][0] + " " + CoordenadasXy[p][1]; 7184 if (p < coordsLength + 1) 7185 coordFig += ","; 7186 } 7187 } 7188 return coordFig; 7189} 7190 7191function collapsetoolbutton() { 7192 //if (($(window).width() <= 975)) { 7193 // $("#btnDescargaMap, #btnManzana, #btnInteres, #btnCircleDis, #btnClean, #btnCircle").fadeToggle(2000);//$('#tool-buttons').animate({ right: -252 }); 7194 $('#tool-buttons').animate({ right: 0 }); 7195 //} 7196 //else { 7197 if ($('#tool-buttons').is(':visible')) { 7198 // $('#tool-buttons').hide('slide', { direction: 'right' }, 1000); 7199 $('#tool-buttons').hide()//'slide', { direction: 'right' }, 1000); 7200 // $("#tool-buttonsLeft").show(1000); 7201 $("#tool-buttonsLeft").show(); 7202 } 7203 else { 7204 $("#tool-buttonsLeft").hide(); 7205 $('#tool-buttons').show(); 7206 } 7207 //} 7208 console.log('collapsar'); 7209} 7210//#endregion herramientas 7211 7212//notlayer = [ 7213// { 7214// cve: '01', 7215// capas: [ 7216// { 7217// capa: '1_1_10' 7218// } 7219// ], 7220// ediciones: [ 7221// { 7222// edicion:'2023', 7223// version:'1' 7224// }, 7225// { 7226// edicion: '2022', 7227// version: '2' 7228// }, 7229// { 7230// edicion: '2022', 7231// version: '1' 7232// }, 7233// { 7234// edicion: '2021', 7235// version: '1' 7236// }, 7237// { 7238// edicion: '2020', 7239// version: '1' 7240// }, 7241// { 7242// edicion: '2019', 7243// version: '1' 7244// }, 7245// { 7246// edicion: '2018', 7247// version: '3' 7248// } 7249// ] 7250 7251// }, 7252// { 7253// cve: '02', 7254// capas: [ 7255// { 7256// capa: '1_1_15' 7257// } 7258// ], 7259// ediciones: [ 7260// { 7261// edicion: '2018', 7262// version: '3' 7263// } 7264// ] 7265 7266// }, 7267// { 7268// cve: '05', 7269// capas: [ 7270// { 7271// capa: '1_1_10' 7272// } 7273// ], 7274// ediciones: [ 7275// { 7276// edicion: '2023', 7277// version: '1' 7278// }, 7279// { 7280// edicion: '2022', 7281// version: '2' 7282// }, 7283// { 7284// edicion: '2022', 7285// version: '1' 7286// }, 7287// { 7288// edicion: '2021', 7289// version: '1' 7290// }, 7291// { 7292// edicion: '2020', 7293// version: '1' 7294// }, 7295// { 7296// edicion: '2019', 7297// version: '1' 7298// }, 7299// { 7300// edicion: '2018', 7301// version: '3' 7302// } 7303// ] 7304 7305// }, 7306// { 7307// cve: '07', 7308// capas: [ 7309// { 7310// capa: '1_1_10' 7311// } 7312 7313// ], 7314// ediciones: [ 7315// { 7316// edicion: '2023', 7317// version: '1' 7318// }, 7319// { 7320// edicion: '2022', 7321// version: '2' 7322// }, 7323// { 7324// edicion: '2022', 7325// version: '1' 7326// }, 7327// { 7328// edicion: '2021', 7329// version: '1' 7330// }, 7331// { 7332// edicion: '2020', 7333// version: '1' 7334// }, 7335// { 7336// edicion: '2019', 7337// version: '1' 7338// }, 7339// { 7340// edicion: '2018', 7341// version: '3' 7342// } 7343// ] 7344 7345// }, 7346// { 7347// cve: '08', 7348// capas: [ 7349// { 7350// capa: '1_1_10' 7351// } 7352// ], 7353// ediciones: [ 7354// { 7355// edicion: '2023', 7356// version: '1' 7357// }, 7358// { 7359// edicion: '2022', 7360// version: '2' 7361// }, 7362// { 7363// edicion: '2022', 7364// version: '1' 7365// }, 7366// { 7367// edicion: '2021', 7368// version: '1' 7369// }, 7370// { 7371// edicion: '2020', 7372// version: '1' 7373// }, 7374// { 7375// edicion: '2019', 7376// version: '1' 7377// }, 7378// { 7379// edicion: '2018', 7380// version: '3' 7381// } 7382// ] 7383 7384// }, 7385// { 7386// cve: '09',
7387// capas: [ 7388// { 7389// capa: '1_1_10' 7390// }, 7391// { 7392// capa: '1_1_15' 7393// } 7394// ], 7395// ediciones: [ 7396// { 7397// edicion: '2023', 7398// version: '1' 7399// }, 7400// { 7401// edicion: '2022', 7402// version: '2' 7403// }, 7404// { 7405// edicion: '2022', 7406// version: '1' 7407// }, 7408// { 7409// edicion: '2021', 7410// version: '1' 7411// }, 7412// { 7413// edicion: '2020', 7414// version: '1' 7415// }, 7416// { 7417// edicion: '2019', 7418// version: '1' 7419// }, 7420// { 7421// edicion: '2018', 7422// version: '3' 7423// } 7424// ] 7425 7426// }, 7427// { 7428// cve: '10', 7429// capas: [ 7430// { 7431// capa: '1_1_10' 7432// }, 7433// { 7434// capa: '1_1_15' 7435// } 7436// ], 7437// ediciones: [ 7438// { 7439// edicion: '2023', 7440// version: '1' 7441// }, 7442// { 7443// edicion: '2022', 7444// version: '2' 7445// }, 7446// { 7447// edicion: '2022', 7448// version: '1' 7449// }, 7450// { 7451// edicion: '2021', 7452// version: '1' 7453// }, 7454// { 7455// edicion: '2020', 7456// version: '1' 7457// }, 7458// { 7459// edicion: '2019', 7460// version: '1' 7461// }, 7462// { 7463// edicion: '2018', 7464// version: '3' 7465// } 7466// ] 7467 7468// }, 7469// { 7470// cve: '11', 7471// capas: [ 7472// { 7473// capa: '1_1_10' 7474// } 7475// ], 7476// ediciones: [ 7477// { 7478// edicion: '2023', 7479// version: '1' 7480// }, 7481// { 7482// edicion: '2022', 7483// version: '2' 7484// }, 7485// { 7486// edicion: '2022', 7487// version: '1' 7488// }, 7489// { 7490// edicion: '2021', 7491// version: '1' 7492// }, 7493// { 7494// edicion: '2020', 7495// version: '1' 7496// }, 7497// { 7498// edicion: '2019', 7499// version: '1' 7500// }, 7501// { 7502// edicion: '2018', 7503// version: '3' 7504// } 7505// ] 7506 7507// }, 7508// { 7509// cve: '13', 7510// capas: [ 7511// { 7512// capa: '1_1_10' 7513// } 7514// ], 7515// ediciones: [ 7516// { 7517// edicion: '2023', 7518// version: '1' 7519// }, 7520// { 7521// edicion: '2022', 7522// version: '2' 7523// }, 7524// { 7525// edicion: '2022', 7526// version: '1' 7527// }, 7528// { 7529// edicion: '2021', 7530// version: '1' 7531// }, 7532// { 7533// edicion: '2020', 7534// version: '1' 7535// }, 7536// { 7537// edicion: '2019', 7538// version: '1' 7539// }, 7540// { 7541// edicion: '2018', 7542// version: '3' 7543// } 7544// ] 7545 7546// }, 7547// { 7548// cve: '15', 7549// capas: [ 7550// { 7551// capa: '1_1_10' 7552// } 7553// ], 7554// ediciones: [ 7555// { 7556// edicion: '2023', 7557// version: '1' 7558// }, 7559// { 7560// edicion: '2022', 7561// version: '2' 7562// }, 7563// { 7564// edicion: '2022', 7565// version: '1' 7566// }, 7567// { 7568// edicion: '2021', 7569// version: '1' 7570// }, 7571// { 7572// edicion: '2020', 7573// version: '1' 7574// }, 7575// { 7576// edicion: '2019', 7577// version: '1' 7578// }, 7579// { 7580// edicion: '2018', 7581// version: '3' 7582// } 7583// ] 7584 7585// }, 7586// { 7587// cve: '16', 7588// capas: [ 7589// { 7590// capa: '1_1_10' 7591// } 7592// ], 7593// ediciones: [ 7594// { 7595// edicion: '2023', 7596// version: '1' 7597// }, 7598// { 7599// edicion: '2022', 7600// version: '2' 7601// }, 7602// { 7603// edicion: '2022', 7604// version: '1' 7605// }, 7606// { 7607// edicion: '2021', 7608// version: '1' 7609// }, 7610// { 7611// edicion: '2020', 7612// version: '1' 7613// }, 7614// { 7615// edicion: '2019', 7616// version: '1' 7617// }, 7618// { 7619// edicion: '2018', 7620// version: '3' 7621// } 7622// ] 7623 7624// }, 7625// { 7626// cve: '17', 7627// capas: [ 7628// { 7629// capa: '1_1_10' 7630// } 7631// ], 7632// ediciones: [ 7633// { 7634// edicion: '2023', 7635// version: '1' 7636// }, 7637// { 7638// edicion: '2022', 7639// version: '2' 7640// }, 7641// { 7642// edicion: '2022', 7643// version: '1' 7644// }, 7645// { 7646// edicion: '2021', 7647// version: '1' 7648// }, 7649// { 7650// edicion: '2020', 7651// version: '1' 7652// }, 7653// { 7654// edicion: '2019', 7655// version: '1' 7656// }, 7657// { 7658// edicion: '2018', 7659// version: '3' 7660// } 7661// ] 7662 7663// }, 7664// { 7665// cve: '19',
7666// capas: [ 7667// { 7668// capa: '1_1_10' 7669// } 7670// ], 7671// ediciones: [ 7672// { 7673// edicion: '2023', 7674// version: '1' 7675// }, 7676// { 7677// edicion: '2022', 7678// version: '2' 7679// }, 7680// { 7681// edicion: '2022', 7682// version: '1' 7683// }, 7684// { 7685// edicion: '2021', 7686// version: '1' 7687// }, 7688// { 7689// edicion: '2020', 7690// version: '1' 7691// }, 7692// { 7693// edicion: '2019', 7694// version: '1' 7695// }, 7696// { 7697// edicion: '2018', 7698// version: '3' 7699// } 7700// ] 7701 7702// }, 7703// { 7704// cve: '21', 7705// capas: [ 7706// { 7707// capa: '1_1_10' 7708// } 7709// ], 7710// ediciones: [ 7711// { 7712// edicion: '2023', 7713// version: '1' 7714// }, 7715// { 7716// edicion: '2022', 7717// version: '2' 7718// }, 7719// { 7720// edicion: '2022', 7721// version: '1' 7722// }, 7723// { 7724// edicion: '2021', 7725// version: '1' 7726// }, 7727// { 7728// edicion: '2020', 7729// version: '1' 7730// }, 7731// { 7732// edicion: '2019', 7733// version: '1' 7734// }, 7735// { 7736// edicion: '2018', 7737// version: '3' 7738// } 7739// ] 7740 7741// }, 7742// { 7743// cve: '22', 7744// capas: [ 7745// { 7746// capa: '1_1_10' 7747// } 7748// ], 7749// ediciones: [ 7750// { 7751// edicion: '2023', 7752// version: '1' 7753// }, 7754// { 7755// edicion: '2022', 7756// version: '2' 7757// }, 7758// { 7759// edicion: '2022', 7760// version: '1' 7761// }, 7762// { 7763// edicion: '2021', 7764// version: '1' 7765// }, 7766// { 7767// edicion: '2020', 7768// version: '1' 7769// }, 7770// { 7771// edicion: '2019', 7772// version: '1' 7773// }, 7774// { 7775// edicion: '2018', 7776// version: '3' 7777// } 7778// ] 7779 7780// }, 7781// { 7782// cve: '24', 7783// capas: [ 7784// { 7785// capa: '1_1_10' 7786// } 7787// ], 7788// ediciones: [ 7789// { 7790// edicion: '2023', 7791// version: '1' 7792// }, 7793// { 7794// edicion: '2022', 7795// version: '2' 7796// }, 7797// { 7798// edicion: '2022', 7799// version: '1' 7800// }, 7801// { 7802// edicion: '2021', 7803// version: '1' 7804// }, 7805// { 7806// edicion: '2020', 7807// version: '1' 7808// }, 7809// { 7810// edicion: '2019', 7811// version: '1' 7812// }, 7813// { 7814// edicion: '2018', 7815// version: '3' 7816// } 7817// ] 7818 7819// }, 7820// { 7821// cve: '27', 7822// capas: [ 7823// { 7824// capa: '1_1_10' 7825// } 7826// ], 7827// ediciones: [ 7828// { 7829// edicion: '2023', 7830// version: '1' 7831// }, 7832// { 7833// edicion: '2022', 7834// version: '2' 7835// }, 7836// { 7837// edicion: '2022', 7838// version: '1' 7839// }, 7840// { 7841// edicion: '2021', 7842// version: '1' 7843// }, 7844// { 7845// edicion: '2020', 7846// version: '1' 7847// }, 7848// { 7849// edicion: '2019', 7850// version: '1' 7851// }, 7852// { 7853// edicion: '2018', 7854// version: '3' 7855// } 7856// ] 7857 7858// }, 7859// { 7860// cve: '28', 7861// capas: [ 7862// { 7863// capa: '1_1_10' 7864// } 7865// ], 7866// ediciones: [ 7867// { 7868// edicion: '2023', 7869// version: '1' 7870// }, 7871// { 7872// edicion: '2022', 7873// version: '2' 7874// }, 7875// { 7876// edicion: '2022', 7877// version: '1' 7878// }, 7879// { 7880// edicion: '2021', 7881// version: '1' 7882// }, 7883// { 7884// edicion: '2020', 7885// version: '1' 7886// }, 7887// { 7888// edicion: '2019', 7889// version: '1' 7890// }, 7891// { 7892// edicion: '2018', 7893// version: '3' 7894// } 7895// ] 7896 7897// }, 7898// { 7899// cve: '29', 7900// capas: [ 7901// { 7902// capa: '1_1_10' 7903// } 7904// ], 7905// ediciones: [ 7906// { 7907// edicion: '2023', 7908// version: '1' 7909// }, 7910// { 7911// edicion: '2022', 7912// version: '2' 7913// }, 7914// { 7915// edicion: '2022', 7916// version: '1' 7917// }, 7918// { 7919// edicion: '2021', 7920// version: '1' 7921// }, 7922// { 7923// edicion: '2020', 7924// version: '1' 7925// }, 7926// { 7927// edicion: '2019', 7928// version: '1' 7929// }, 7930// { 7931// edicion: '2018', 7932// version: '3' 7933// } 7934// ] 7935 7936// }, 7937// { 7938// cve: '32', 7939// capas: [ 7940// { 7941// capa: '1_1_10' 7942// } 7943// ], 7944// ediciones: [ 7945// { 7946// edicion: '2023', 7947// version: '1' 7948// }, 7949// { 7950// edicion: '2022', 7951// version: '2' 7952// }, 7953// { 7954// edicion: '2022', 7955// version: '1' 7956// }, 7957// { 7958// edicion: '2021', 7959// version: '1' 7960// }, 7961// { 7962// edicion: '2020', 7963// version: '1' 7964// }, 7965// { 7966// edicion: '2019', 7967// version: '1' 7968// }, 7969// { 7970// edicion: '2018', 7971// version: '3' 7972// } 7973// ] 7974 7975// } 7976 7977//];
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.