function callIconBase(tipo_idtipo) { ruta = "template/assets/images/icon" var tipo_edificio_img = [ ruta + '/pdr.png', ruta + '/icon_pdr_superficie.png', ruta + '/icon_pdr_parkings_.png', ruta + '/icon_pdr_aeropuertos.png', ruta + '/icon_pdr_campings.png', ruta + '/icon_pdr_hoteles_.png', ruta + '/pdr.png', ruta + '/icon_pdr_restaurante.png', ruta + '/icon_pdr_supermarket.png', ruta + '/icon_pdr_taller.png', ruta + '/icon_pdr_gasolineras.png', ruta + '/icon_pdr_concesionario.png', ruta + '/icon_pdr_superficie.png' , ruta + '/pdr.png', ruta + '/icon_pdr_taxi.png', ruta + '/pdr.png']; return tipo_edificio_img[tipo_idtipo]; } function obtenerCapas(){ capasActivas = []; $('#capas-disponibles :checkbox:checked').each(function(){ capasActivas.push(parseInt($(this).attr('value'))); }); capasTotales = [] $('#capas-disponibles :checkbox').each(function(){ capasTotales.push($(this).attr('value')); dataLayer = new Object(); dataLayer.idCapa = parseInt($(this).attr('value')); dataLayer.markerList = []; dataLayers.push(dataLayer); }); for (var i = 0; i < dataLayers.length; i++) { dataLayers[i].markerList = getMarkerCapa(dataLayers[i].idCapa); } for (var i = 0; i < capasActivas.length; i++) { setMapOnAll(map , capasActivas[i]); } } function getMarkerCapa(idCapa) { var res = []; var marcadores = []; $.ajax({ url: './puntosPorCapa?idCapa='+idCapa, type: 'GET', async:false, contentType: 'application/json; charset=UTF-8', success: function (response) { res=JSON.parse(response); for (var i = 0; i < res.length; i++) { if(idCapa == 21){ var icon = { url: "./images/markers/icon_municipioGarveland.png" }; markerCapa = new MarkerWithLabel({ id: res[i].id, position: new google.maps.LatLng(res[i].position.lat, res[i].position.lng), icon: icon, labelContent: ('es' == 'es') ? res[i].nombre_es : res[i].nombre_pt, labelClass: "labels", labelInBackground: false }); }else{ var icon = { url: './images/markers/'+res[i].marker_icon, scaledSize: new google.maps.Size(40, 40) }; markerCapa = new google.maps.Marker({ id: res[i].id, position: new google.maps.LatLng(res[i].position.lat, res[i].position.lng), icon: icon }); } markerCapa.metadata = {id_punto: res[i].id}; if(!markersArray_PUNTOS.includes(markerCapa.metadata.id_punto)){ markersArray_PUNTOS.push(markerCapa); } markerCapa.addListener('click', function() { if(infow_share){ infow_share.close();} if( infoWindow ) { infoWindow.close(); } marcador= this; markerPUNTOEDIT = markerCapa; $.ajax({ url: './infoMarkerCapa?id='+this.id , type: 'GET', contentType: 'application/json; charset=UTF-8', success: function (respon) { infoWindow.setContent(createInfoMarkerCapa(respon)); infoWindow.idRuta= null; infoWindow.open(map,marcador); $("#ctr_p_"+respon.id).on("click", function() { $("#i_ctr_pt_id").val(respon.id); $("#i_ctr_tipo").val('2'); $("#modal_add_ctr").modal(); }); $("#btn_del_pt_"+respon.id).click(function(){ $.confirm({ icon: 'fas fa-exclamation-triangle', title: 'Confirmación', content:'¿Está seguro de que desea borrar este punto?', closeAnimation: 'top', buttons: { cancelar: function(cancelar){}, confirm: { text: 'Borrar', btnClass: 'btn-danger', action: function(){ deletePt(idCapa,respon); } } } }); }); $("#comments-pt-"+respon.id).click(function(){ openModalComments(respon.id,2); }); }, error: function (resp) { alert('Ha ocurrido un error en el servidor al enviar la petición ajax'); } }); }); marcadores.push(markerCapa); } }, error: function (resp) { alert('Ha ocurrido un error en el servidor al enviar la petición ajax'); } }); return marcadores; }