Commit 824ec9093c5bb2ce935abd9cd5584f3d5494429d
1 parent
08fa6b85
Exists in
master
and in
7 other branches
-
Showing
1 changed file
with
183 additions
and
112 deletions
Show diff stats
classesjs/classe_plugini3geo.js
| 1 | /** | 1 | /** |
| 2 | * Title: PluginI3Geo | 2 | * Title: PluginI3Geo |
| 3 | - * | 3 | + * |
| 4 | * i3GEO.pluginI3geo | 4 | * i3GEO.pluginI3geo |
| 5 | - * | 5 | + * |
| 6 | * Implementa os plugins do i3Geo que adicionam camadas especiais ao mapa, normalmente dados vetoriais processados no navegador Web. | 6 | * Implementa os plugins do i3Geo que adicionam camadas especiais ao mapa, normalmente dados vetoriais processados no navegador Web. |
| 7 | - * | 7 | + * |
| 8 | * Arquivo: | 8 | * Arquivo: |
| 9 | - * | 9 | + * |
| 10 | * i3geo/classesjs/classe_plugini3geo.js | 10 | * i3geo/classesjs/classe_plugini3geo.js |
| 11 | - * | 11 | + * |
| 12 | * Licença: | 12 | * Licença: |
| 13 | - * | 13 | + * |
| 14 | * GPL2 | 14 | * GPL2 |
| 15 | - * | 15 | + * |
| 16 | * i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | 16 | * i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet |
| 17 | - * | 17 | + * |
| 18 | * Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | 18 | * Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com |
| 19 | - * | 19 | + * |
| 20 | * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo sob os termos da Licença | 20 | * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo sob os termos da Licença |
| 21 | * Pública Geral GNU conforme publicada pela Free Software Foundation; | 21 | * Pública Geral GNU conforme publicada pela Free Software Foundation; |
| 22 | - * | 22 | + * |
| 23 | * Este programa é distribuído na expectativa de que seja útil, porém, SEM NENHUMA GARANTIA; nem mesmo a | 23 | * Este programa é distribuído na expectativa de que seja útil, porém, SEM NENHUMA GARANTIA; nem mesmo a |
| 24 | * garantia implícita de COMERCIABILIDADE OU ADEQUACÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença | 24 | * garantia implícita de COMERCIABILIDADE OU ADEQUACÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença |
| 25 | * Pública Geral do GNU para mais detalhes. Você deve ter recebido uma cópia da Licença Pública Geral do | 25 | * Pública Geral do GNU para mais detalhes. Você deve ter recebido uma cópia da Licença Pública Geral do |
| @@ -34,7 +34,7 @@ i3GEO.pluginI3geo = | @@ -34,7 +34,7 @@ i3GEO.pluginI3geo = | ||
| 34 | OBJETOS : {}, | 34 | OBJETOS : {}, |
| 35 | /** | 35 | /** |
| 36 | * Lista de plugins | 36 | * Lista de plugins |
| 37 | - * | 37 | + * |
| 38 | * Utilizado no editor de mapfiles do sistema de administracao | 38 | * Utilizado no editor de mapfiles do sistema de administracao |
| 39 | */ | 39 | */ |
| 40 | PLUGINS : [ | 40 | PLUGINS : [ |
| @@ -51,11 +51,11 @@ i3GEO.pluginI3geo = | @@ -51,11 +51,11 @@ i3GEO.pluginI3geo = | ||
| 51 | ], | 51 | ], |
| 52 | /** | 52 | /** |
| 53 | * Inicia a execucao de um plugin | 53 | * Inicia a execucao de um plugin |
| 54 | - * | 54 | + * |
| 55 | * Camada e um objeto gerado pelo i3Geo quando uma camada e adicionada ao mapa O objeto i3GEO.arvoreDeCamadas.CAMADAS guarda todas | 55 | * Camada e um objeto gerado pelo i3Geo quando uma camada e adicionada ao mapa O objeto i3GEO.arvoreDeCamadas.CAMADAS guarda todas |
| 56 | * as camadas adicionadas ao mapa Ao adicionar uma camada pelo catalogo, o i3Geo verifica se a camada possui plugin e direciona para | 56 | * as camadas adicionadas ao mapa Ao adicionar uma camada pelo catalogo, o i3Geo verifica se a camada possui plugin e direciona para |
| 57 | * ca Os plugins sao definidos como metadados em cada mapfile de cada tema | 57 | * ca Os plugins sao definidos como metadados em cada mapfile de cada tema |
| 58 | - * | 58 | + * |
| 59 | * Veja em i3geo/classesphp/classe_mapa.php funcao parametrostemas | 59 | * Veja em i3geo/classesphp/classe_mapa.php funcao parametrostemas |
| 60 | */ | 60 | */ |
| 61 | inicia : function(camada) { | 61 | inicia : function(camada) { |
| @@ -116,7 +116,7 @@ i3GEO.pluginI3geo = | @@ -116,7 +116,7 @@ i3GEO.pluginI3geo = | ||
| 116 | }, | 116 | }, |
| 117 | /** | 117 | /** |
| 118 | * Aplica as propriedades em um objeto do tipo tema | 118 | * Aplica as propriedades em um objeto do tipo tema |
| 119 | - * | 119 | + * |
| 120 | * tema e fornecido por i3GEO.arvoreDeCamadas o ajuste das propriedades e necessario para que as propriedades aparecam de forma | 120 | * tema e fornecido por i3GEO.arvoreDeCamadas o ajuste das propriedades e necessario para que as propriedades aparecam de forma |
| 121 | * correta na arvore de camadas | 121 | * correta na arvore de camadas |
| 122 | */ | 122 | */ |
| @@ -128,29 +128,29 @@ i3GEO.pluginI3geo = | @@ -128,29 +128,29 @@ i3GEO.pluginI3geo = | ||
| 128 | }, | 128 | }, |
| 129 | /** | 129 | /** |
| 130 | * Function: heatmap | 130 | * Function: heatmap |
| 131 | - * | 131 | + * |
| 132 | * Mapa de calor | 132 | * Mapa de calor |
| 133 | - * | 133 | + * |
| 134 | * Gera um layer do tipo mapa de calor e adiciona ao mapa | 134 | * Gera um layer do tipo mapa de calor e adiciona ao mapa |
| 135 | - * | 135 | + * |
| 136 | * As dependências em javascript sao carregadas via script tag por meio de ferramentas/heatmap | 136 | * As dependências em javascript sao carregadas via script tag por meio de ferramentas/heatmap |
| 137 | - * | 137 | + * |
| 138 | * Esse programa também obtém os dados necessários ao plugin | 138 | * Esse programa também obtém os dados necessários ao plugin |
| 139 | - * | 139 | + * |
| 140 | * O layer existente no mapfile deve conter um metadata chamado PLUGINI3GEO | 140 | * O layer existente no mapfile deve conter um metadata chamado PLUGINI3GEO |
| 141 | - * | 141 | + * |
| 142 | * Esse matadado deve conter uma string que será transformada em um objeto javascript para uso no plugin | 142 | * Esse matadado deve conter uma string que será transformada em um objeto javascript para uso no plugin |
| 143 | - * | 143 | + * |
| 144 | * Exemplo: | 144 | * Exemplo: |
| 145 | - * | 145 | + * |
| 146 | * "PLUGINI3GEO" '{"plugin":"heatmap","parametros":{"tipoGradiente": "default","coluna":"teste","max":"10","radius":"15"}}' | 146 | * "PLUGINI3GEO" '{"plugin":"heatmap","parametros":{"tipoGradiente": "default","coluna":"teste","max":"10","radius":"15"}}' |
| 147 | - * | 147 | + * |
| 148 | * Coluna é a que contém os dados numéricos que definem a quantidade de uma medida em cada ponto e é | 148 | * Coluna é a que contém os dados numéricos que definem a quantidade de uma medida em cada ponto e é |
| 149 | * usada para gerar a representação. Se for vazia, considera-se o valor como 1 | 149 | * usada para gerar a representação. Se for vazia, considera-se o valor como 1 |
| 150 | - * | 150 | + * |
| 151 | * As cores das classes existentes no LAYER serão utilizadas para calcular as cores do mapa de calor. Se tipoGradiente for | 151 | * As cores das classes existentes no LAYER serão utilizadas para calcular as cores do mapa de calor. Se tipoGradiente for |
| 152 | * igual a "default" será utilizado o gradiente padrão. | 152 | * igual a "default" será utilizado o gradiente padrão. |
| 153 | - * | 153 | + * |
| 154 | */ | 154 | */ |
| 155 | heatmap : { | 155 | heatmap : { |
| 156 | linkAjuda : function() { | 156 | linkAjuda : function() { |
| @@ -209,7 +209,8 @@ i3GEO.pluginI3geo = | @@ -209,7 +209,8 @@ i3GEO.pluginI3geo = | ||
| 209 | return camada; | 209 | return camada; |
| 210 | }, | 210 | }, |
| 211 | inicia : function(camada) { | 211 | inicia : function(camada) { |
| 212 | - var nomeScript = "heatmap_script", p = i3GEO.configura.locaplic + "/ferramentas/heatmap/googlemaps_js.php", carregaJs = "nao", criaLayer; | 212 | + var nomeScript = "heatmap_script", p = i3GEO.configura.locaplic + "/ferramentas/heatmap/googlemaps_js.php", carregaJs = |
| 213 | + "nao", criaLayer; | ||
| 213 | criaLayer = function() { | 214 | criaLayer = function() { |
| 214 | var heatmap, pontos; | 215 | var heatmap, pontos; |
| 215 | 216 | ||
| @@ -249,12 +250,11 @@ i3GEO.pluginI3geo = | @@ -249,12 +250,11 @@ i3GEO.pluginI3geo = | ||
| 249 | i3GEO.pluginI3geo.OBJETOS[camada.name] = heatmap; | 250 | i3GEO.pluginI3geo.OBJETOS[camada.name] = heatmap; |
| 250 | heatmap_dados = null; | 251 | heatmap_dados = null; |
| 251 | }; | 252 | }; |
| 252 | - //se o script nao existir carrega o codigo e os dados | ||
| 253 | - //caso contrario, carrega apenas os dados no script | 253 | + // se o script nao existir carrega o codigo e os dados |
| 254 | + // caso contrario, carrega apenas os dados no script | ||
| 254 | if (!$i(nomeScript)) { | 255 | if (!$i(nomeScript)) { |
| 255 | carregaJs = "sim"; | 256 | carregaJs = "sim"; |
| 256 | - } | ||
| 257 | - else{ | 257 | + } else { |
| 258 | nomeScript = ""; | 258 | nomeScript = ""; |
| 259 | } | 259 | } |
| 260 | p += | 260 | p += |
| @@ -288,7 +288,8 @@ i3GEO.pluginI3geo = | @@ -288,7 +288,8 @@ i3GEO.pluginI3geo = | ||
| 288 | return camada; | 288 | return camada; |
| 289 | }, | 289 | }, |
| 290 | inicia : function(camada, objMapa) { | 290 | inicia : function(camada, objMapa) { |
| 291 | - var nomeScript = "heatmap_script", p = i3GEO.configura.locaplic + "/ferramentas/heatmap/openlayers_js.php", carregaJs = "nao", criaLayer; | 291 | + var nomeScript = "heatmap_script", p = i3GEO.configura.locaplic + "/ferramentas/heatmap/openlayers_js.php", carregaJs = |
| 292 | + "nao", criaLayer; | ||
| 292 | criaLayer = function() { | 293 | criaLayer = function() { |
| 293 | var heatmap, transformedTestData = { | 294 | var heatmap, transformedTestData = { |
| 294 | max : camada.plugini3geo.parametros.max, | 295 | max : camada.plugini3geo.parametros.max, |
| @@ -354,12 +355,11 @@ i3GEO.pluginI3geo = | @@ -354,12 +355,11 @@ i3GEO.pluginI3geo = | ||
| 354 | i3GEO.janela.fechaAguarde("aguardePlugin"); | 355 | i3GEO.janela.fechaAguarde("aguardePlugin"); |
| 355 | } | 356 | } |
| 356 | }; | 357 | }; |
| 357 | - //se o script nao existir carrega o codigo e os dados | ||
| 358 | - //caso contrario, carrega apenas os dados no script | 358 | + // se o script nao existir carrega o codigo e os dados |
| 359 | + // caso contrario, carrega apenas os dados no script | ||
| 359 | if (!$i(nomeScript)) { | 360 | if (!$i(nomeScript)) { |
| 360 | carregaJs = "sim"; | 361 | carregaJs = "sim"; |
| 361 | - } | ||
| 362 | - else{ | 362 | + } else { |
| 363 | nomeScript = ""; | 363 | nomeScript = ""; |
| 364 | } | 364 | } |
| 365 | if (!i3GEO.configura || !i3GEO.configura.sid) { | 365 | if (!i3GEO.configura || !i3GEO.configura.sid) { |
| @@ -380,33 +380,34 @@ i3GEO.pluginI3geo = | @@ -380,33 +380,34 @@ i3GEO.pluginI3geo = | ||
| 380 | }, | 380 | }, |
| 381 | /** | 381 | /** |
| 382 | * Function: markercluster | 382 | * Function: markercluster |
| 383 | - * | 383 | + * |
| 384 | * Markercluster | 384 | * Markercluster |
| 385 | - * | 385 | + * |
| 386 | * Gera um layer que agrupa pontos conforme a distância entre eles e insere um contador adiciona ao mapa | 386 | * Gera um layer que agrupa pontos conforme a distância entre eles e insere um contador adiciona ao mapa |
| 387 | - * | 387 | + * |
| 388 | * As dependências em javascript sao carregadas via script tag por meio de ferramentas/markercluster | 388 | * As dependências em javascript sao carregadas via script tag por meio de ferramentas/markercluster |
| 389 | - * | 389 | + * |
| 390 | * Esse programa também obtém os dados necessários ao plugin | 390 | * Esse programa também obtém os dados necessários ao plugin |
| 391 | - * | 391 | + * |
| 392 | * O layer existente no mapfile deve conter um metadata chamado PLUGINI3GEO | 392 | * O layer existente no mapfile deve conter um metadata chamado PLUGINI3GEO |
| 393 | - * | 393 | + * |
| 394 | * Esse matadado deve conter uma string que será transformada em um objeto javascript para uso no plugin | 394 | * Esse matadado deve conter uma string que será transformada em um objeto javascript para uso no plugin |
| 395 | - * | 395 | + * |
| 396 | * Exemplo: | 396 | * Exemplo: |
| 397 | - * | 397 | + * |
| 398 | * "PLUGINI3GEO" '{"plugin":"markercluster","parametros":{"coluna":"teste","gridSize":"50"}}' | 398 | * "PLUGINI3GEO" '{"plugin":"markercluster","parametros":{"coluna":"teste","gridSize":"50"}}' |
| 399 | - * | 399 | + * |
| 400 | * Coluna é a que contém os dados numéricos que definem a quantidade de uma medida em cada ponto e é | 400 | * Coluna é a que contém os dados numéricos que definem a quantidade de uma medida em cada ponto e é |
| 401 | * usada para gerar a representação. Se for vazia, considera-se o valor como 1 | 401 | * usada para gerar a representação. Se for vazia, considera-se o valor como 1 |
| 402 | - * | 402 | + * |
| 403 | */ | 403 | */ |
| 404 | markercluster : { | 404 | markercluster : { |
| 405 | linkAjuda : function() { | 405 | linkAjuda : function() { |
| 406 | return i3GEO.configura.locaplic + "/ajuda_usuario.php?idcategoria=3&idajuda=121"; | 406 | return i3GEO.configura.locaplic + "/ajuda_usuario.php?idcategoria=3&idajuda=121"; |
| 407 | }, | 407 | }, |
| 408 | formAdmin : function(config) { | 408 | formAdmin : function(config) { |
| 409 | - var parametros, ins = "", configDefault = '{"plugin":"markercluster","parametros":{"tipoEstilos": "default","gridSize":50}}'; | 409 | + var parametros, ins = "", configDefault = |
| 410 | + '{"plugin":"markercluster","parametros":{"tipoEstilos": "default","gridSize":50}}'; | ||
| 410 | if (config === "") { | 411 | if (config === "") { |
| 411 | config = configDefault; | 412 | config = configDefault; |
| 412 | } | 413 | } |
| @@ -416,12 +417,13 @@ i3GEO.pluginI3geo = | @@ -416,12 +417,13 @@ i3GEO.pluginI3geo = | ||
| 416 | } | 417 | } |
| 417 | parametros = config.parametros; | 418 | parametros = config.parametros; |
| 418 | ins += | 419 | ins += |
| 419 | - "" + "<p>Distância máxima entre ponto em pixels:" + "<br><input name='gridSize' type='text' value='" | ||
| 420 | - + parametros.gridSize + "' size='30'></p>" | ||
| 421 | - + "<p>Tipo de estilos (deixe vazio para utilizar as classes definidas no Layer ou escreva 'default' para usar o normal):" | ||
| 422 | - + "<br><input name='tipoEstilos' type='text' value='" | ||
| 423 | - + parametros.tipoEstilos | 420 | + "" |
| 421 | + + "<p>Distância máxima entre ponto em pixels:" | ||
| 422 | + + "<br><input name='gridSize' type='text' value='" | ||
| 423 | + + parametros.gridSize | ||
| 424 | + "' size='30'></p>" | 424 | + "' size='30'></p>" |
| 425 | + + "<p>Tipo de estilos (deixe vazio para utilizar as classes definidas no Layer ou escreva 'default' para usar o normal):" | ||
| 426 | + + "<br><input name='tipoEstilos' type='text' value='" + parametros.tipoEstilos + "' size='30'></p>" | ||
| 425 | + "<p>Os símbolos utilizados podem ser customizados alterando-se as classes do Mapfile</p>" | 427 | + "<p>Os símbolos utilizados podem ser customizados alterando-se as classes do Mapfile</p>" |
| 426 | + "<p>Veja o exemplo utilizado no tema _lmapadecluster.map</p>"; | 428 | + "<p>Veja o exemplo utilizado no tema _lmapadecluster.map</p>"; |
| 427 | 429 | ||
| @@ -445,7 +447,8 @@ i3GEO.pluginI3geo = | @@ -445,7 +447,8 @@ i3GEO.pluginI3geo = | ||
| 445 | return camada; | 447 | return camada; |
| 446 | }, | 448 | }, |
| 447 | inicia : function(camada) { | 449 | inicia : function(camada) { |
| 448 | - var nomeScript = "markercluster_script", p = i3GEO.configura.locaplic + "/ferramentas/markercluster/googlemaps_js.php", carregaJs = "nao", criaLayer; | 450 | + var nomeScript = "markercluster_script", p = i3GEO.configura.locaplic + "/ferramentas/markercluster/googlemaps_js.php", carregaJs = |
| 451 | + "nao", criaLayer; | ||
| 449 | criaLayer = function() { | 452 | criaLayer = function() { |
| 450 | var markercluster, marcas, latLng, marker, n, i; | 453 | var markercluster, marcas, latLng, marker, n, i; |
| 451 | n = markercluster_dados.length; | 454 | n = markercluster_dados.length; |
| @@ -493,19 +496,17 @@ i3GEO.pluginI3geo = | @@ -493,19 +496,17 @@ i3GEO.pluginI3geo = | ||
| 493 | i3GEO.pluginI3geo.OBJETOS[camada.name] = markercluster; | 496 | i3GEO.pluginI3geo.OBJETOS[camada.name] = markercluster; |
| 494 | markercluster_dados = null; | 497 | markercluster_dados = null; |
| 495 | }; | 498 | }; |
| 496 | - //se o script nao existir carrega o codigo e os dados | ||
| 497 | - //caso contrario, carrega apenas os dados no script | 499 | + // se o script nao existir carrega o codigo e os dados |
| 500 | + // caso contrario, carrega apenas os dados no script | ||
| 498 | if (!$i(nomeScript)) { | 501 | if (!$i(nomeScript)) { |
| 499 | carregaJs = "sim"; | 502 | carregaJs = "sim"; |
| 500 | - } | ||
| 501 | - else{ | 503 | + } else { |
| 502 | nomeScript = ""; | 504 | nomeScript = ""; |
| 503 | } | 505 | } |
| 504 | p += | 506 | p += |
| 505 | - "?carregajs=" + carregaJs + "&layer=" + camada.name + "&coluna=" + camada.plugini3geo.parametros.coluna | ||
| 506 | - + "&g_sid=" + i3GEO.configura.sid | ||
| 507 | - + "&tipoEstilos=" + camada.plugini3geo.parametros.tipoEstilos | ||
| 508 | - + "&nomevariavel=markercluster_dados&nomevariavelConfig=markercluster_config"; | 507 | + "?carregajs=" + carregaJs + "&layer=" + camada.name + "&g_sid=" + i3GEO.configura.sid + "&tipoEstilos=" |
| 508 | + + camada.plugini3geo.parametros.tipoEstilos | ||
| 509 | + + "&nomevariavel=markercluster_dados&nomevariavelConfig=markercluster_config"; | ||
| 509 | i3GEO.util.scriptTag(p, criaLayer, nomeScript); | 510 | i3GEO.util.scriptTag(p, criaLayer, nomeScript); |
| 510 | } | 511 | } |
| 511 | }, | 512 | }, |
| @@ -526,68 +527,138 @@ i3GEO.pluginI3geo = | @@ -526,68 +527,138 @@ i3GEO.pluginI3geo = | ||
| 526 | camada.classe = "NAO"; | 527 | camada.classe = "NAO"; |
| 527 | return camada; | 528 | return camada; |
| 528 | }, | 529 | }, |
| 529 | - inicia : function(camada) { | ||
| 530 | - var nomeScript = "markercluster_script", p = i3GEO.configura.locaplic + "/ferramentas/markercluster/openlayers_js.php", carregaJs = "nao", criaLayer; | ||
| 531 | - criaLayer = function() { | ||
| 532 | - var markercluster, marcas, latLng, marker, n, i; | ||
| 533 | - n = markercluster_dados.length; | ||
| 534 | - marcas = []; | ||
| 535 | - for (i = 0; i < n; i++) { | ||
| 536 | - latLng = new google.maps.LatLng(markercluster_dados[i].lat, markercluster_dados[i].lng); | ||
| 537 | - marker = new google.maps.Marker({ | ||
| 538 | - 'position' : latLng, | ||
| 539 | - icon : { | ||
| 540 | - url : markercluster_config.ponto.url, | ||
| 541 | - scaledSize : new google.maps.Size(markercluster_config.ponto.width, markercluster_config.ponto.height) | 530 | + inicia : function(camada, objMapa) { |
| 531 | + var nomeScript = "markercluster_script", p = i3GEO.configura.locaplic + "/ferramentas/markercluster/openlayers_js.php", carregaJs = | ||
| 532 | + "nao", criaLayer; | ||
| 533 | + criaLayer = | ||
| 534 | + function() { | ||
| 535 | + var logMax, logMin, classes, min, max, markercluster, marcas, lonlat, n, i, style, nestilos, intervalo, regra, regras = | ||
| 536 | + []; | ||
| 537 | + | ||
| 538 | + nestilos = markercluster_config.estilos.length; | ||
| 539 | + n = markercluster_dados.length; | ||
| 540 | + | ||
| 541 | + | ||
| 542 | + classes = Array(); | ||
| 543 | + logMax = Math.log(n) / Math.LN10; // max decimal logarithm (or base 10) | ||
| 544 | + logMin = Math.log(1) / Math.LN10; | ||
| 545 | + intervalo = (logMax - logMin) / nestilos; | ||
| 546 | + // we compute log bounds | ||
| 547 | + for (i = 0; i < nestilos; i++) { | ||
| 548 | + if (i == 0) { | ||
| 549 | + classes[i] = logMin; | ||
| 550 | + } else { | ||
| 551 | + classes[i] = classes[i - 1] + intervalo; | ||
| 542 | } | 552 | } |
| 553 | + } | ||
| 554 | + // we compute antilog | ||
| 555 | + classes = classes.map(function(x) { | ||
| 556 | + return Math.pow(10, x); | ||
| 543 | }); | 557 | }); |
| 544 | - marcas.push(marker); | ||
| 545 | - } | ||
| 546 | - markercluster = new MarkerClusterer(i3GeoMap, marcas, { | ||
| 547 | - "gridSize" : parseInt(camada.plugini3geo.parametros.gridSize, 10), | ||
| 548 | - "visible" : true, | ||
| 549 | - "opacity" : camada.transparency, | ||
| 550 | - "name" : camada.name, | ||
| 551 | - "styles" : markercluster_config.estilos | ||
| 552 | - }); | ||
| 553 | - i3GEO.janela.fechaAguarde("aguardePlugin"); | ||
| 554 | - i3GEO.eventos.cliquePerm.ativo = false; | 558 | + // and we finally add max value |
| 559 | + classes.push(n); | ||
| 555 | 560 | ||
| 556 | - markercluster.ligaCamada = function() { | ||
| 557 | - i3GEO.pluginI3geo.OBJETOS[camada.name].ready_ = true; | ||
| 558 | - i3GEO.pluginI3geo.OBJETOS[camada.name].redraw(); | ||
| 559 | - i3GEO.eventos.cliquePerm.ativo = false; | ||
| 560 | - }; | ||
| 561 | - markercluster.desLigaCamada = function() { | ||
| 562 | - i3GEO.pluginI3geo.OBJETOS[camada.name].resetViewport(true); | ||
| 563 | - i3GEO.pluginI3geo.OBJETOS[camada.name].ready_ = false; | ||
| 564 | - i3GEO.eventos.cliquePerm.ativo = true; | ||
| 565 | - }; | ||
| 566 | - markercluster.removeCamada = function() { | ||
| 567 | - i3GEO.pluginI3geo.OBJETOS[camada.name].clearMarkers(); | ||
| 568 | - i3GEO.eventos.cliquePerm.ativo = true; | ||
| 569 | - }; | ||
| 570 | - markercluster.atualizaCamada = function() { | ||
| 571 | - i3GEO.pluginI3geo.OBJETOS[camada.name].ready_ = true; | ||
| 572 | - i3GEO.pluginI3geo.OBJETOS[camada.name].redraw(); | 561 | + // ponto sozinho |
| 562 | + regra = new OpenLayers.Rule({ | ||
| 563 | + filter : new OpenLayers.Filter.Comparison({ | ||
| 564 | + type : OpenLayers.Filter.Comparison.LESS_THAN, | ||
| 565 | + property : "count", | ||
| 566 | + value : 2 | ||
| 567 | + }), | ||
| 568 | + symbolizer : { | ||
| 569 | + externalGraphic : markercluster_config.ponto.url, | ||
| 570 | + graphicWidth : markercluster_config.ponto.width, | ||
| 571 | + graphicHeight : markercluster_config.ponto.height | ||
| 572 | + } | ||
| 573 | + }); | ||
| 574 | + regras.push(regra); | ||
| 575 | + min = 2; | ||
| 576 | + for (i = 0; i < nestilos; i++) { | ||
| 577 | + max = classes[i + 1]; | ||
| 578 | + regra = new OpenLayers.Rule({ | ||
| 579 | + filter : new OpenLayers.Filter.Comparison({ | ||
| 580 | + type : OpenLayers.Filter.Comparison.BETWEEN, | ||
| 581 | + property : "count", | ||
| 582 | + lowerBoundary : min, | ||
| 583 | + upperBoundary : max | ||
| 584 | + }), | ||
| 585 | + symbolizer : { | ||
| 586 | + externalGraphic : markercluster_config.estilos[i].url, | ||
| 587 | + graphicWidth : markercluster_config.estilos[i].width, | ||
| 588 | + graphicHeight : markercluster_config.estilos[i].height, | ||
| 589 | + label : "${count}", | ||
| 590 | + labelOutlineWidth : 1, | ||
| 591 | + fontColor : "#000000", | ||
| 592 | + fontOpacity : 1, | ||
| 593 | + fontSize : "12px" | ||
| 594 | + } | ||
| 595 | + }); | ||
| 596 | + regras.push(regra); | ||
| 597 | + min = max; | ||
| 598 | + } | ||
| 599 | + | ||
| 600 | + // Create a Style that uses the three previous rules | ||
| 601 | + style = new OpenLayers.Style(null, { | ||
| 602 | + rules : regras | ||
| 603 | + }); | ||
| 604 | + | ||
| 605 | + markercluster = new OpenLayers.Layer.Vector(camada.name, { | ||
| 606 | + renderers : [ | ||
| 607 | + 'Canvas', | ||
| 608 | + 'SVG' | ||
| 609 | + ], | ||
| 610 | + strategies : [ | ||
| 611 | + new OpenLayers.Strategy.AnimatedCluster({ | ||
| 612 | + distance : parseInt(camada.plugini3geo.parametros.gridSize, 10) | ||
| 613 | + }) | ||
| 614 | + ], | ||
| 615 | + styleMap : new OpenLayers.StyleMap(style) | ||
| 616 | + }); | ||
| 617 | + // para uso com o mashup | ||
| 618 | + if (!objMapa) { | ||
| 619 | + objMapa = i3geoOL; | ||
| 620 | + } | ||
| 621 | + objMapa.addLayer(markercluster); | ||
| 622 | + | ||
| 623 | + marcas = []; | ||
| 624 | + for (i = 0; i < n; i++) { | ||
| 625 | + lonlat = new OpenLayers.LonLat(markercluster_dados[i].lng, markercluster_dados[i].lat); | ||
| 626 | + if (i3GEO.Interface.openlayers.googleLike === true) { | ||
| 627 | + lonlat.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913")); | ||
| 628 | + } | ||
| 629 | + marcas.push(new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(lonlat.lon, lonlat.lat))); | ||
| 630 | + } | ||
| 631 | + markercluster.addFeatures(marcas); | ||
| 632 | + | ||
| 633 | + i3GEO.janela.fechaAguarde("aguardePlugin"); | ||
| 573 | i3GEO.eventos.cliquePerm.ativo = false; | 634 | i3GEO.eventos.cliquePerm.ativo = false; |
| 635 | + | ||
| 636 | + markercluster.ligaCamada = function() { | ||
| 637 | + i3GEO.eventos.cliquePerm.ativo = false; | ||
| 638 | + }; | ||
| 639 | + markercluster.desLigaCamada = function() { | ||
| 640 | + i3GEO.eventos.cliquePerm.ativo = true; | ||
| 641 | + }; | ||
| 642 | + markercluster.removeCamada = function() { | ||
| 643 | + i3GEO.eventos.cliquePerm.ativo = true; | ||
| 644 | + }; | ||
| 645 | + markercluster.atualizaCamada = function() { | ||
| 646 | + i3GEO.eventos.cliquePerm.ativo = false; | ||
| 647 | + }; | ||
| 648 | + i3GEO.pluginI3geo.OBJETOS[camada.name] = markercluster; | ||
| 649 | + markercluster_dados = null; | ||
| 574 | }; | 650 | }; |
| 575 | - i3GEO.pluginI3geo.OBJETOS[camada.name] = markercluster; | ||
| 576 | - markercluster_dados = null; | ||
| 577 | - }; | ||
| 578 | - //se o script nao existir carrega o codigo e os dados | ||
| 579 | - //caso contrario, carrega apenas os dados no script | 651 | + // se o script nao existir carrega o codigo e os dados |
| 652 | + // caso contrario, carrega apenas os dados no script | ||
| 580 | if (!$i(nomeScript)) { | 653 | if (!$i(nomeScript)) { |
| 581 | carregaJs = "sim"; | 654 | carregaJs = "sim"; |
| 582 | - } | ||
| 583 | - else{ | 655 | + } else { |
| 584 | nomeScript = ""; | 656 | nomeScript = ""; |
| 585 | } | 657 | } |
| 586 | p += | 658 | p += |
| 587 | - "?carregajs=" + carregaJs + "&layer=" + camada.name + "&coluna=" + camada.plugini3geo.parametros.coluna | ||
| 588 | - + "&g_sid=" + i3GEO.configura.sid | ||
| 589 | - + "&tipoEstilos=" + camada.plugini3geo.parametros.tipoEstilos | ||
| 590 | - + "&nomevariavel=markercluster_dados&nomevariavelConfig=markercluster_config"; | 659 | + "?carregajs=" + carregaJs + "&layer=" + camada.name + "&g_sid=" + i3GEO.configura.sid + "&tipoEstilos=" |
| 660 | + + camada.plugini3geo.parametros.tipoEstilos | ||
| 661 | + + "&nomevariavel=markercluster_dados&nomevariavelConfig=markercluster_config"; | ||
| 591 | i3GEO.util.scriptTag(p, criaLayer, nomeScript); | 662 | i3GEO.util.scriptTag(p, criaLayer, nomeScript); |
| 592 | } | 663 | } |
| 593 | } | 664 | } |