From b43b96bc6d77f7dbec42e2be9cd132244d0bcb4d Mon Sep 17 00:00:00 2001
From: Edmar Moretti
Os símbolos utilizados podem ser customizados alterando-se as classes do Mapfile
" + + "Veja o exemplo utilizado no tema _lmapadecluster.map
"; return ins; }, @@ -454,8 +455,90 @@ i3GEO.pluginI3geo = marker = new google.maps.Marker({ 'position' : latLng, icon : { - url : i3GEO.configura.locaplic + "/imagens/google/symbol_blank.png", - scaledSize : new google.maps.Size(20, 20) + url : markercluster_config.ponto.url, + scaledSize : new google.maps.Size(markercluster_config.ponto.width, markercluster_config.ponto.height) + } + }); + marcas.push(marker); + } + markercluster = new MarkerClusterer(i3GeoMap, marcas, { + "gridSize" : parseInt(camada.plugini3geo.parametros.gridSize, 10), + "visible" : true, + "opacity" : camada.transparency, + "name" : camada.name, + "styles" : markercluster_config.estilos + }); + i3GEO.janela.fechaAguarde("aguardePlugin"); + i3GEO.eventos.cliquePerm.ativo = false; + + markercluster.ligaCamada = function() { + i3GEO.pluginI3geo.OBJETOS[camada.name].ready_ = true; + i3GEO.pluginI3geo.OBJETOS[camada.name].redraw(); + i3GEO.eventos.cliquePerm.ativo = false; + }; + markercluster.desLigaCamada = function() { + i3GEO.pluginI3geo.OBJETOS[camada.name].resetViewport(true); + i3GEO.pluginI3geo.OBJETOS[camada.name].ready_ = false; + i3GEO.eventos.cliquePerm.ativo = true; + }; + markercluster.removeCamada = function() { + i3GEO.pluginI3geo.OBJETOS[camada.name].clearMarkers(); + i3GEO.eventos.cliquePerm.ativo = true; + }; + markercluster.atualizaCamada = function() { + i3GEO.pluginI3geo.OBJETOS[camada.name].ready_ = true; + i3GEO.pluginI3geo.OBJETOS[camada.name].redraw(); + i3GEO.eventos.cliquePerm.ativo = false; + }; + i3GEO.pluginI3geo.OBJETOS[camada.name] = markercluster; + markercluster_dados = null; + }; + //se o script nao existir carrega o codigo e os dados + //caso contrario, carrega apenas os dados no script + if (!$i(nomeScript)) { + carregaJs = "sim"; + } + else{ + nomeScript = ""; + } + p += + "?carregajs=" + carregaJs + "&layer=" + camada.name + "&coluna=" + camada.plugini3geo.parametros.coluna + + "&g_sid=" + i3GEO.configura.sid + + "&tipoEstilos=" + camada.plugini3geo.parametros.tipoEstilos + + "&nomevariavel=markercluster_dados&nomevariavelConfig=markercluster_config"; + i3GEO.util.scriptTag(p, criaLayer, nomeScript); + } + }, + openlayers : { + aplicaPropriedades : function(camada) { + camada.sel = "nao"; + camada.download = "nao"; + camada.AGUARDALEGENDA = false; + camada.temporizador = ""; + camada.copia = false; + camada.procurar = false; + camada.toponimia = false; + camada.etiquetas = false; + camada.tabela = false; + camada.grafico = false; + camada.destacar = false; + camada.wms = false; + camada.classe = "NAO"; + return camada; + }, + inicia : function(camada) { + var nomeScript = "markercluster_script", p = i3GEO.configura.locaplic + "/ferramentas/markercluster/openlayers_js.php", carregaJs = "nao", criaLayer; + criaLayer = function() { + var markercluster, marcas, latLng, marker, n, i; + n = markercluster_dados.length; + marcas = []; + for (i = 0; i < n; i++) { + latLng = new google.maps.LatLng(markercluster_dados[i].lat, markercluster_dados[i].lng); + marker = new google.maps.Marker({ + 'position' : latLng, + icon : { + url : markercluster_config.ponto.url, + scaledSize : new google.maps.Size(markercluster_config.ponto.width, markercluster_config.ponto.height) } }); marcas.push(marker); diff --git a/ferramentas/markercluster/funcoes.php b/ferramentas/markercluster/funcoes.php index da79545..050e380 100644 --- a/ferramentas/markercluster/funcoes.php +++ b/ferramentas/markercluster/funcoes.php @@ -70,23 +70,25 @@ function markerclusterMapfile(){ } function markerclusterEstilos($map_file,$layer,$tipoEstilos){ if($tipoEstilos == "default"){ - $tipoEstilos = '{"estilos":[{url : i3GEO.configura.locaplic + "/imagens/google/m1",height : 53,width : 53},{url : i3GEO.configura.locaplic + "/imagens/google/m2",height : 56,width : 56},{url : i3GEO.configura.locaplic + "/imagens/google/m3",height : 66,width : 66},{url : i3GEO.configura.locaplic + "/imagens/google/m4",height : 78,width : 78},{url : i3GEO.configura.locaplic + "/imagens/google/m5",height : 90,width : 90}]}'; + $tipoEstilos = '{"ponto":{url : i3GEO.configura.locaplic + "/imagens/google/symbol_blank.png",height : 20,width : 20},"estilos":[{url : i3GEO.configura.locaplic + "/imagens/google/m1.png",height : 53,width : 53},{url : i3GEO.configura.locaplic + "/imagens/google/m2.png",height : 56,width : 56},{url : i3GEO.configura.locaplic + "/imagens/google/m3.png",height : 66,width : 66},{url : i3GEO.configura.locaplic + "/imagens/google/m4.png",height : 78,width : 78},{url : i3GEO.configura.locaplic + "/imagens/google/m5.png",height : 90,width : 90}]}'; } else{ - $gradiente = array(); + $tipoEstilos = array(); $mapa = ms_newMapObj($map_file); $l = $mapa->getlayerbyname($layer); - $nc = $l->numclasses; - for ($c = 0;$c < $nc;$c++){ + $nc = $l->numclasses; + // a primeira classe e o ponto que nao entra no cluster + for ($c = 1;$c < $nc;$c++){ $classe = $l->getclass($c); $estilo = $classe->getstyle(0); - $nome = $classe->name; - $cor = $estilo->color; - $scor = "rgb(".$cor->red.",".$cor->green.",".$cor->blue.")"; - $gradiente[$nome] = $scor; - } - //echo $map_file;exit; - $gradiente = json_encode(array("gradient"=>$gradiente)); + $tipoEstilos[] = array("url"=>$estilo->symbol,"height"=>$estilo->size,"width"=>$estilo->size); + } + $classe = $l->getclass(0); + $estilo = $classe->getstyle(0); + $tipoEstilos = json_encode(array( + "ponto"=>array("url"=>$estilo->symbol,"height"=>$estilo->size,"width"=>$estilo->size), + "estilos"=>$tipoEstilos + )); } return $tipoEstilos; } diff --git a/ferramentas/markercluster/openlayers_js.php b/ferramentas/markercluster/openlayers_js.php index 024cc17..a0a1b65 100755 --- a/ferramentas/markercluster/openlayers_js.php +++ b/ferramentas/markercluster/openlayers_js.php @@ -48,8 +48,10 @@ if($map_file == ""){ } } $resultado = markerclusterDados($map_file); +$tipoEstilos = markerclusterEstilos($map_file,$layer,$tipoEstilos); echo $nomevariavel.' = ['.implode(",",$resultado).'];'; +echo $nomevariavelConfig.' = '.$tipoEstilos.';'; if($carregajs === "sim"){ include_once($dir."/../../pacotes/markercluster/openlayers/AnimatedCluster.js"); diff --git a/init/index.php b/init/index.php index 8ddb5c7..87a14ea 100755 --- a/init/index.php +++ b/init/index.php @@ -111,7 +111,6 @@ a { margin: 0px auto; text-decoration: none; } - @@ -130,28 +129,24 @@ a { ?> + +Tweets @i3Geo + | Tweets @i3Geo |