Commit d4b1d361a94b9bc330f098348cedb3bc8343d505

Authored by Edmar Moretti
1 parent eb8ea972

Inclusao do calculo de heatmap na interface googlemaps

classesjs/classe_interface.js
... ... @@ -47,152 +47,152 @@ if (typeof (i3GEO) === 'undefined') {
47 47 i3GEO.Interface = {
48 48 /*
49 49 * Propriedade: TABLET
50   - *
  50 + *
51 51 * Quando true, são aplicadas configurações especiais
52 52 * para uso em tablets.
53   - *
  53 + *
54 54 * Altera o posicionamento da barra de botões e comportamento das
55 55 * guias. Veja o exemplo interface/openlayers_t.htm.
56   - *
  56 + *
57 57 * Type: {boolean}
58   - *
  58 + *
59 59 * Default: {false}
60 60 */
61 61 TABLET : false,
62 62 /*
63 63 * Propriedade: ALTTABLET
64   - *
  64 + *
65 65 * Nome do arquivo HTML com a interface alternativa utilizada quando o i3Geo
66 66 * detecta o uso de um dispositivo móvel
67   - *
  67 + *
68 68 * A detecção é aplicada automaticamente quando essa
69 69 * variável for definida
70   - *
  70 + *
71 71 * Para não aplicar a detecção, use
72 72 * i3GEO.Interface.ALTTABLET = ""
73   - *
  73 + *
74 74 * Type: {string}
75   - *
  75 + *
76 76 * Default: {""}
77 77 */
78 78 ALTTABLET : "",
79 79 /*
80 80 * Formato de geração da imagem.
81   - *
  81 + *
82 82 * Os formatos devem estar definidos no mapfile geral1windows.map e
83 83 * geral1.map. A definição dessa variável não
84 84 * afeta a interface padrão, que utiliza a definição
85 85 * que estiver ativa nos mapfiles de inicialização.
86   - *
  86 + *
87 87 * Tipo: {MAPSERVER OUTPUTFORMAT}
88   - *
  88 + *
89 89 * Default: {"AGG_Q"}
90 90 */
91 91 OUTPUTFORMAT : "AGG_Q",
92 92 /*
93 93 * Propriedade: BARRABOTOESTOP
94   - *
  94 + *
95 95 * Distancia da barra de botões em relação ao topo do
96 96 * mapa.
97   - *
  97 + *
98 98 * Tipo: {number}
99   - *
  99 + *
100 100 * Default: {12}
101 101 */
102 102 BARRABOTOESTOP : 12,
103 103 /*
104 104 * Propriedade: BARRABOTOESLEFT
105   - *
  105 + *
106 106 * Distancia da barra de botões em relação ao lado
107 107 * esquerdo do mapa.
108   - *
  108 + *
109 109 * Tipo: {number}
110   - *
  110 + *
111 111 * Default: {3}
112 112 */
113 113 BARRABOTOESLEFT : 3,
114 114 /*
115 115 * Propriedade: BARRADEZOOMTOP
116   - *
  116 + *
117 117 * Distancia da barra de zoom em relação ao topo do mapa.
118   - *
  118 + *
119 119 * Tipo: {number}
120   - *
  120 + *
121 121 * Default: {12}
122 122 */
123 123 BARRADEZOOMTOP : 20,
124 124 /*
125 125 * Propriedade: BARRADEZOOMLEFT
126   - *
  126 + *
127 127 * Distancia da barra de zoom em relação ao lado esquerdo do
128 128 * mapa.
129   - *
  129 + *
130 130 * Tipo: {number}
131   - *
  131 + *
132 132 * Default: {3}
133 133 */
134 134 BARRADEZOOMLEFT : 10,
135 135 /*
136 136 * Propriedade: ATUAL
137   - *
  137 + *
138 138 * Interface utilizada na criação e controle do mapa.
139   - *
  139 + *
140 140 * Veja como usar nos arquivos de apresentação do mapa
141 141 * existentes no diretório i3geo/interface
142   - *
  142 + *
143 143 * O i3Geo, além da interface própria, permite o uso de outras
144 144 * APIs para a construção do mapa, como Google Maps ou
145 145 * Openlayers. Essa propriedade define qual interface será usada.
146 146 * Não confundir com o nome do HTML que é utilizado para
147 147 * mostrar o mapa.
148   - *
  148 + *
149 149 * Para definir a interface, utilize
150   - *
  150 + *
151 151 * i3GEO.Interface.ATUAL = "<valor>"
152   - *
  152 + *
153 153 * Tipo: {string}
154   - *
  154 + *
155 155 * Valores: {openlayers|googlemaps|googleearth}
156   - *
  156 + *
157 157 * Default: {"openlayers"}
158 158 */
159 159 ATUAL : "openlayers",
160 160 /*
161 161 * Propriedade: IDCORPO
162   - *
  162 + *
163 163 * ID do elemento HTML que receber&aacute; o corpo do mapa
164   - *
  164 + *
165 165 * Tipo: {string}
166   - *
  166 + *
167 167 * Default: {"corpoMapa"}
168 168 */
169 169 IDCORPO : "corpoMapa",
170 170 /*
171 171 * Indica se o menu de contexto deve ser ativado
172   - *
  172 + *
173 173 * Tipo: {Boolean}
174   - *
  174 + *
175 175 * Default: {true}
176 176 */
177 177 ATIVAMENUCONTEXTO : false,
178 178 /*
179 179 * Variavel: IDMAPA
180   - *
  180 + *
181 181 * ID do elemento HTML criado para conter o mapa
182   - *
  182 + *
183 183 * Esse elemento normalmente &eacute; criado dentro de IDCORPO dependendo da
184 184 * interface
185 185 */
186 186 IDMAPA : "",
187 187 /*
188 188 * Indica o status atual do mapa.
189   - *
  189 + *
190 190 * &Eacute; utilizado para verificar o status do mapa e bloquear ou
191 191 * n&atilde;o determinadas fun&ccedil;&otilde;es.
192   - *
  192 + *
193 193 * Por exemplo, na interface OpenLayers, identifica se as camadas
194 194 * est&atilde;o sendo atualizadas
195   - *
  195 + *
196 196 * STATUS = { atualizando: new Array(), //guarda os c&oacute;digos dos
197 197 * layers que est&atilde;o sendo redesenhados trocando: false //indica se o
198 198 * mapa est&aacute; na fase de troca de interface }
... ... @@ -282,7 +282,7 @@ i3GEO.Interface = {
282 282 },
283 283 /*
284 284 * Function: redesenha
285   - *
  285 + *
286 286 * Aplica o m&eacute;todo redesenha da interface atual. Em alguns casos, a
287 287 * fun&ccedil;&atilde;o de redesenho aplica os mesmos processos da
288 288 * fun&ccedil;&atilde;o de atualizar o mapa. Isso ocorre pq em alguns casos
... ... @@ -296,13 +296,13 @@ i3GEO.Interface = {
296 296 },
297 297 /*
298 298 * Function: aplicaOpacidade
299   - *
  299 + *
300 300 * Aplica um fator de opacidade a todos os layers do mapa
301   - *
  301 + *
302 302 * Parametro:
303   - *
  303 + *
304 304 * opacidade {numerico} - 0 a 1
305   - *
  305 + *
306 306 * layer {string} - (opcional) se for vazio aplica ao mapa todo
307 307 */
308 308 aplicaOpacidade : function(opacidade, layer) {
... ... @@ -313,7 +313,7 @@ i3GEO.Interface = {
313 313 },
314 314 /*
315 315 * Function: atualizaMapa
316   - *
  316 + *
317 317 * Aplica o m&eacute;todo atualizaMapa da interface atual. Em alguns casos,
318 318 * a fun&ccedil;&atilde;o de redesenho aplica os mesmos processos da
319 319 * fun&ccedil;&atilde;o de atualizar o mapa. Isso ocorre pq em alguns casos
... ... @@ -333,16 +333,16 @@ i3GEO.Interface = {
333 333 },
334 334 /*
335 335 * Function: atualizaTema
336   - *
  336 + *
337 337 * Aplica o m&eacute;todo atualizaTema da interface atual
338   - *
  338 + *
339 339 * Parametros:
340   - *
  340 + *
341 341 * retorno {JSON} - objeto JSON com os par�metros obtidos da
342 342 * fun&ccedil;&atilde;o PHP de redesenho do mapa. Quando igual a "",
343 343 * &eacute; feita apenas a atualiza&ccedil;&atilde;o da camada, sem que a
344 344 * &aacute;rvore de camadas seja atualizada.
345   - *
  345 + *
346 346 * tema {string} - c&oacute;digo do tema
347 347 */
348 348 atualizaTema : function(retorno, tema) {
... ... @@ -352,11 +352,11 @@ i3GEO.Interface = {
352 352 },
353 353 /*
354 354 * Function: ligaDesliga
355   - *
  355 + *
356 356 * Liga/desliga um tema
357   - *
  357 + *
358 358 * Parametros:
359   - *
  359 + *
360 360 * {object} objeto do tipo checkbox que foi acionado na arvore de camadas
361 361 */
362 362 ligaDesliga : function(obj) {
... ... @@ -364,7 +364,7 @@ i3GEO.Interface = {
364 364 },
365 365 /*
366 366 * Function: adicionaKml
367   - *
  367 + *
368 368 * Aplica o m&eacute;todo de adi&ccedil;&atilde;o de kml ao mapa conforme a
369 369 * interface atual
370 370 */
... ... @@ -383,14 +383,14 @@ i3GEO.Interface = {
383 383 },
384 384 /*
385 385 * Cria ou altera os elementos HTML necess&aacute;rios para a interface
386   - *
  386 + *
387 387 * Essa fun&ccedil;&atilde;o &eacute; executada na
388 388 * inicializa&ccedil;&atilde;o do i3geo
389   - *
  389 + *
390 390 * Parametros:
391   - *
  391 + *
392 392 * w {Integer} - largura do corpo do mapa em pixels
393   - *
  393 + *
394 394 * h {Integer} - altura do corpo do mapa em pixels
395 395 */
396 396 cria : function(w, h) {
... ... @@ -442,7 +442,7 @@ i3GEO.Interface = {
442 442 },
443 443 /*
444 444 * Function: alteraLayers
445   - *
  445 + *
446 446 * Altera todos os layers do mapa modificando um determinado par�metro
447 447 */
448 448 alteraParametroLayers : function(parametro, valor) {
... ... @@ -469,27 +469,27 @@ i3GEO.Interface = {
469 469 },
470 470 /*
471 471 * Classe: i3GEO.Interface.openlayers
472   - *
  472 + *
473 473 * Interface com motor de navega&ccedil;&atilde;o baseado na API OpenLayers
474   - *
  474 + *
475 475 * Utilizado quando
476   - *
  476 + *
477 477 * i3GEO.Interface.ATUAL = "openlayers"
478   - *
  478 + *
479 479 * Cria o objeto i3geoOL que pode receber os m&eacute;todos da API do
480 480 * OpenLayers
481   - *
  481 + *
482 482 * Para detalhes sobre a configura&ccedil;&atilde;o da interface, veja
483 483 * i3geo/aplicmap/openlayers.htm
484 484 */
485 485 openlayers : {
486 486 /*
487 487 * Propriedade: parametrosMap
488   - *
  488 + *
489 489 * Permite incluir parametros da API do OpenLayers nao previstos no
490 490 * i3Geo. Veja em
491 491 * http://dev.openlayers.org/releases/OpenLayers-2.12/doc/apidocs/files/OpenLayers/Map-js.html
492   - *
  492 + *
493 493 * Exemplo i3GEO.Interface.openlayers.parametrosMap.scales = [50000000,
494 494 * 30000000, 10000000, 5000000];
495 495 */
... ... @@ -505,46 +505,46 @@ i3GEO.Interface = {
505 505 },
506 506 /*
507 507 * Propriedade: FUNDOTEMA
508   - *
  508 + *
509 509 * Estilo "background" do nome do tema na &aacute;rvore de camadas
510 510 * enquanto o mesmo est&aacute; sendo carregado.
511   - *
  511 + *
512 512 * Permite destacar o nome do tema que est&aacute; em processo de
513 513 * carregamento
514   - *
  514 + *
515 515 * Tipo: {background style}
516   - *
  516 + *
517 517 * Default: {yellow}
518 518 */
519 519 FUNDOTEMA : "yellow",
520 520 /*
521 521 * Propriedade: TILES
522   - *
  522 + *
523 523 * Indica se ser&aacute; utilizado o modo de navega&ccedil;&atilde;o em
524 524 * tiles
525   - *
  525 + *
526 526 * Tipo: {boolean}
527   - *
  527 + *
528 528 * Default: {false}
529 529 */
530 530 TILES : true,
531 531 /*
532 532 * N&uacute;mero de TILES na &aacute;rea n&atilde;o vis&iacute;vel do
533 533 * mapa
534   - *
  534 + *
535 535 * Tipo: {integer}
536   - *
  536 + *
537 537 * Default: {0}
538 538 */
539 539 BUFFER : 0,
540 540 /*
541 541 * Propriedade: GADGETS
542   - *
  542 + *
543 543 * Lista dos controles espec&iacute;ficos da API do OpenLayers que
544 544 * ser&atilde;o inseridos ou n&atilde;o no mapa
545   - *
  545 + *
546 546 * Tipo: {object}
547   - *
  547 + *
548 548 * Default:
549 549 * {PanZoomBar:true,LayerSwitcher:true,ScaleLine:true,OverviewMap:true}
550 550 */
... ... @@ -557,37 +557,37 @@ i3GEO.Interface = {
557 557 },
558 558 /*
559 559 * Propriedade: MINEXTENT
560   - *
  560 + *
561 561 * Menor extens&atilde;o geogr&aacute;fica que pode ser mostrada no mapa
562   - *
  562 + *
563 563 * Tipo: {array}
564   - *
  564 + *
565 565 * Default: {-0.0003, -0.0003, 0.0003, 0.0003]}
566 566 */
567 567 MINEXTENT : [ -0.0003, -0.0003, 0.0003, 0.0003 ],
568 568 /*
569 569 * Propriedade: MAXEXTENT
570   - *
  570 + *
571 571 * Maior extens&atilde;o geogr&aacute;fica que pode ser mostrada no mapa
572   - *
  572 + *
573 573 * Tipo: {array}
574   - *
  574 + *
575 575 * Default: {[-180, -90, 180, 90]}
576 576 */
577 577 MAXEXTENT : [ -180, -90, 180, 90 ],
578 578 /*
579 579 * Propriedades: LAYERSADICIONAIS
580   - *
  580 + *
581 581 * Array com objetos do tipo LAYER que ser&atilde;o adicionados
582 582 * ap&oacute;s a crioa&ccedil;&atilde;o de todos os layers default.
583   - *
  583 + *
584 584 * Tipo: {array}
585   - *
  585 + *
586 586 */
587 587 LAYERSADICIONAIS : [],
588 588 /*
589 589 * Propriedade: LAYERFUNDO
590   - *
  590 + *
591 591 * Nome do layer do tipo baselayer que sera ativado
592 592 */
593 593 LAYERFUNDO : "",
... ... @@ -1628,13 +1628,13 @@ i3GEO.Interface = {
1628 1628 },
1629 1629 /*
1630 1630 * Classe: i3GEO.Interface.googlemaps
1631   - *
  1631 + *
1632 1632 * Interface com motor de navega&ccedil;&atilde;o baseado na API Google Maps
1633   - *
  1633 + *
1634 1634 * Utilizado quando
1635   - *
  1635 + *
1636 1636 * i3GEO.Interface.ATUAL = "googlemaps"
1637   - *
  1637 + *
1638 1638 * Cria o objeto i3GeoMap que pode receber os m&eacute;todos da API. Cria
1639 1639 * tamb&eacute;m o objeto i3GeoMapOverlay do tipo Overlay, utilizado para
1640 1640 * c&aacute;lculos ou para receber elementos gr&aacute;ficos.
... ... @@ -1642,14 +1642,14 @@ i3GEO.Interface = {
1642 1642 googlemaps : {
1643 1643 /*
1644 1644 * Propriedade: ESTILOS
1645   - *
  1645 + *
1646 1646 * Estilos que podem ser utilizados com o mapa
1647   - *
1648   - *
  1647 + *
  1648 + *
1649 1649 * Para novos estilos, acrescente seu codigo nesse objeto
1650   - *
  1650 + *
1651 1651 * Fonte http://maps-api-tt.appspot.com/apilite/styled/styled.html
1652   - *
  1652 + *
1653 1653 * Tipo: {objeto estilo do Google Maps}
1654 1654 */
1655 1655 ESTILOS : {
... ... @@ -1791,30 +1791,30 @@ i3GEO.Interface = {
1791 1791 },
1792 1792 /*
1793 1793 * Propriedade: ESTILOPADRAO
1794   - *
  1794 + *
1795 1795 * Nome do estilo definido em ESTILOS que sera usado como padrao para o
1796 1796 * mapa. Se for "" sera usado o estilo normal do Google
1797   - *
  1797 + *
1798 1798 * Estilos pre-definidos Red, Countries, Night, Blue, Greyscale, No
1799 1799 * roads, Mixed, Chilled
1800   - *
  1800 + *
1801 1801 * Tipo: {string}
1802   - *
  1802 + *
1803 1803 * Default: ""
1804 1804 */
1805 1805 ESTILOPADRAO : "",
1806 1806 /*
1807 1807 * Propriedade: MAPOPTIONS
1808   - *
  1808 + *
1809 1809 * Objeto contendo op&ccedil;&otilde;es que ser&atilde;o utilizadas no
1810 1810 * construtor do mapa conforme a API do GoogleMaps
1811   - *
  1811 + *
1812 1812 * Exemplo de uso
1813   - *
  1813 + *
1814 1814 * i3GEO.Interface.googlemaps.MAPOPTIONS = {maxZoom:5};
1815   - *
  1815 + *
1816 1816 * https://developers.google.com/maps/documentation/javascript/reference#MapOptions
1817   - *
  1817 + *
1818 1818 * Tipo: {MapOptions}
1819 1819 */
1820 1820 MAPOPTIONS : {
... ... @@ -1822,36 +1822,36 @@ i3GEO.Interface = {
1822 1822 },
1823 1823 /*
1824 1824 * Propriedade: OPACIDADE
1825   - *
  1825 + *
1826 1826 * Valor da opacidade das camadas i3geo do mapa
1827   - *
  1827 + *
1828 1828 * Varia de 0 a 1
1829   - *
  1829 + *
1830 1830 * Default: 0.8
1831   - *
  1831 + *
1832 1832 * Tipo: {Numeric}
1833 1833 */
1834 1834 OPACIDADE : 0.8,
1835 1835 /*
1836 1836 * Propriedade: TIPOMAPA
1837   - *
  1837 + *
1838 1838 * Tipo de mapa que ser&aacute; usado como default, conforme constantes
1839 1839 * definidas na API do Google Maps.
1840   - *
  1840 + *
1841 1841 * Default: "roadmap"
1842   - *
  1842 + *
1843 1843 * Tipo: {string - Google API constante
1844 1844 * "satellite"|"roadmap"|"hybrid"|"terrain"}
1845 1845 */
1846 1846 TIPOMAPA : "terrain",
1847 1847 /*
1848 1848 * Variable: ZOOMSCALE
1849   - *
  1849 + *
1850 1850 * Array com a lista de escalas em cada nivel de zoom utilizado pelo
1851 1851 * Google
1852   - *
  1852 + *
1853 1853 * Tipo: {array}
1854   - *
  1854 + *
1855 1855 */
1856 1856 ZOOMSCALE : [ 591657550, 295828775, 147914387, 73957193, 36978596,
1857 1857 18489298, 9244649, 4622324, 2311162, 1155581, 577790, 288895,
... ... @@ -1859,14 +1859,14 @@ i3GEO.Interface = {
1859 1859 /*
1860 1860 * Par�metros adicionais que s&atilde;o inseridos na URL que define cada
1861 1861 * layer
1862   - *
  1862 + *
1863 1863 * Tipo: {string}
1864 1864 */
1865 1865 PARAMETROSLAYER : "&TIPOIMAGEM=" + i3GEO.configura.tipoimagem,
1866 1866 /*
1867 1867 * String acrescentada � url de cada tile para garantir a
1868 1868 * remo&ccedil;&atilde;o do cache local
1869   - *
  1869 + *
1870 1870 * Type: {string}
1871 1871 */
1872 1872 posfixo : 0,
... ... @@ -2060,8 +2060,15 @@ i3GEO.Interface = {
2060 2060 if (!indice) {
2061 2061 // nao utilize !== aqui
2062 2062 if (camada.status != 0) {
  2063 + // verifica se a camada contem um plugin do i3geo
  2064 + // caso tenha, direciona para a classe_i3geoplugin
  2065 + if (camada.plugini3geo != "") {
  2066 + i3GEO.pluginI3geo.inicia(camada);
  2067 + continue;
  2068 + } else {
2063 2069 i3GEO.Interface.googlemaps.insereLayer(camada.name, 0,
2064 2070 camada.cache);
  2071 + }
2065 2072 }
2066 2073 }
2067 2074 }
... ... @@ -2172,7 +2179,7 @@ i3GEO.Interface = {
2172 2179 var i = false;
2173 2180 try {
2174 2181 i3GeoMap.overlayMapTypes.forEach(function(elemento, number) {
2175   - // alert(nomeLayer+" "+elemento.name)
  2182 + //alert(nomeLayer+" "+elemento.name)
2176 2183 if (elemento.name === nomeLayer) {
2177 2184 i = number;
2178 2185 }
... ... @@ -2353,27 +2360,27 @@ i3GEO.Interface = {
2353 2360 },
2354 2361 /*
2355 2362 * Function: adicionaKml
2356   - *
  2363 + *
2357 2364 * Insere no mapa uma camada KML com base na API do Google Maps
2358   - *
  2365 + *
2359 2366 * As camadas adicionadas s&atilde;o acrescentadas na &aacute;rvore de
2360 2367 * camadas
2361   - *
  2368 + *
2362 2369 * A lista de nomes dos objetos geoXml criados &eacute; mantida em
2363 2370 * i3GEO.mapas.GEOXML
2364   - *
  2371 + *
2365 2372 * Parametros:
2366   - *
  2373 + *
2367 2374 * pan {Boolean} - define se o mapa ser&aacute; deslocado para encaixar
2368 2375 * o KML
2369   - *
  2376 + *
2370 2377 * url {String} - URL do arquivo KML. Se n&atilde;o for definido, a URL
2371 2378 * ser&aacute; obtida do INPUT com id = i3geo_urlkml (veja
2372 2379 * i3GEO.gadgets.mostraInserirKml)
2373   - *
  2380 + *
2374 2381 * titulo {string} - titulo que aparecer&aacute; na &aacute;rvore. Se
2375 2382 * n&atilde;o for definido, ser&aacute; calculado aleatoriamente.
2376   - *
  2383 + *
2377 2384 * ativo {boolean} - indica se a camada estar&aacute; ativa ou
2378 2385 * n&atilde;o. Se n&atilde;o for definido, ser&aacute; considerado como
2379 2386 * true
... ... @@ -2424,24 +2431,24 @@ i3GEO.Interface = {
2424 2431 },
2425 2432 /*
2426 2433 * Function: adicionaNoArvoreGoogle
2427   - *
  2434 + *
2428 2435 * Acrescenta na &aacute;rvore de camadas um novo tema no n&oacute; que
2429 2436 * mostra os arquivos KML inseridos no mapa
2430   - *
  2437 + *
2431 2438 * Os temas s&atilde;o inclu&iacute;dos em um n&oacute; chamado "Google
2432 2439 * Maps".
2433   - *
  2440 + *
2434 2441 * Para obter esse n&oacute; utilize var node =
2435 2442 * i3GEO.arvoreDeCamadas.ARVORE.getNodeByProperty("idkml","raiz");
2436   - *
  2443 + *
2437 2444 * Parametros:
2438   - *
  2445 + *
2439 2446 * url {string} - url do arquivo KML
2440   - *
  2447 + *
2441 2448 * nomeOverlay {string} - t&iacute;tulo do tema
2442   - *
  2449 + *
2443 2450 * ativo {boolean} - indica o estado do checkbox
2444   - *
  2451 + *
2445 2452 * id {string} - nome do objeto GGeoXml
2446 2453 */
2447 2454 adicionaNoArvoreGoogle : function(url, nomeOverlay, ativo, id) {
... ... @@ -2524,13 +2531,13 @@ i3GEO.Interface = {
2524 2531 },
2525 2532 /*
2526 2533 * Function: ativaDesativaCamadaKml
2527   - *
  2534 + *
2528 2535 * Ativa ou desativa uma camada do n&oacute; de layers KML
2529   - *
  2536 + *
2530 2537 * Parametro:
2531   - *
  2538 + *
2532 2539 * obj {object} - objeto do tipo checkbox que foi ativado/desativado
2533   - *
  2540 + *
2534 2541 * url {string} - url do KML
2535 2542 */
2536 2543 ativaDesativaCamadaKml : function(obj, url) {
... ... @@ -2553,42 +2560,42 @@ i3GEO.Interface = {
2553 2560 },
2554 2561 /*
2555 2562 * Classe: i3GEO.Interface.googleearth
2556   - *
  2563 + *
2557 2564 * Interface com motor de navega&ccedil;&atilde;o baseado na API Google
2558 2565 * Earth
2559   - *
  2566 + *
2560 2567 * Utilizado quando
2561   - *
  2568 + *
2562 2569 * i3GEO.Interface.ATUAL = "googleearth"
2563   - *
  2570 + *
2564 2571 * Cria o objeto i3GeoMap que pode receber os m&eacute;todos da API do
2565 2572 * google Earth
2566 2573 */
2567 2574 googleearth : {
2568 2575 /*
2569 2576 * Variable: PARAMETROSLAYER
2570   - *
  2577 + *
2571 2578 * Par�metros adicionais que s&atilde;o inseridos na URL que define cada
2572 2579 * layer
2573   - *
  2580 + *
2574 2581 * Tipo: {string}
2575 2582 */
2576 2583 PARAMETROSLAYER : "&TIPOIMAGEM=" + i3GEO.configura.tipoimagem,
2577 2584 /*
2578 2585 * String acrescentada � url de cada tile para garantir a
2579 2586 * remo&ccedil;&atilde;o do cache local
2580   - *
  2587 + *
2581 2588 * Type: {string}
2582 2589 */
2583 2590 posfixo : "",
2584 2591 /*
2585 2592 * Propriedade: GADGETS
2586   - *
  2593 + *
2587 2594 * Lista dos controles espec&iacute;ficos da API do Google Earth que
2588 2595 * ser&atilde;o inseridos ou n&atilde;o no mapa
2589   - *
  2596 + *
2590 2597 * Tipo: {object}
2591   - *
  2598 + *
2592 2599 * Default: {}
2593 2600 */
2594 2601 GADGETS : {
... ... @@ -3060,27 +3067,27 @@ i3GEO.Interface = {
3060 3067 },
3061 3068 /*
3062 3069 * Function: adicionaKml
3063   - *
  3070 + *
3064 3071 * Insere no mapa uma camada KML com base na API do Google Earth
3065   - *
  3072 + *
3066 3073 * As camadas adicionadas s&atilde;o crescentadas na &aacute;rvore de
3067 3074 * camadas
3068   - *
  3075 + *
3069 3076 * A lista de nomes dos objetos geoXml criados &eacute; mantida em
3070 3077 * i3GEO.mapas.GEOXML
3071   - *
  3078 + *
3072 3079 * Parametros:
3073   - *
  3080 + *
3074 3081 * pan {Boolean} - define se o mapa ser&aacute; deslocado para encaixar
3075 3082 * o KML
3076   - *
  3083 + *
3077 3084 * url {String} - URL do arquivo KML. Se n&atilde;o for definido, a URL
3078 3085 * ser&aacute; obtida do INPUT com id = i3geo_urlkml (veja
3079 3086 * i3GEO.gadgets.mostraInserirKml)
3080   - *
  3087 + *
3081 3088 * titulo {string} - titulo que aparecer&aacute; na &aacute;rvore. Se
3082 3089 * n&atilde;o for definido, ser&aacute; calculado aleatoriamente.
3083   - *
  3090 + *
3084 3091 * ativo {boolean} - indica se a camada estar&aacute; ativa ou
3085 3092 * n&atilde;o. Se n&atilde;o for definido, ser&aacute; considerado como
3086 3093 * true
... ... @@ -3141,24 +3148,24 @@ i3GEO.Interface = {
3141 3148 },
3142 3149 /*
3143 3150 * Function: adicionaNoArvoreGoogle
3144   - *
  3151 + *
3145 3152 * Acrescenta na &aacute;rvore de camadas um novo tema no n&oacute; que
3146 3153 * mostra os arquivos KML inseridos no mapa
3147   - *
  3154 + *
3148 3155 * Os temas s&atilde;o inclu&iacute;dos em um n&oacute; chamado "Google
3149 3156 * Earth".
3150   - *
  3157 + *
3151 3158 * Para obter esse n&oacute; utilize var node =
3152 3159 * i3GEO.arvoreDeCamadas.ARVORE.getNodeByProperty("idkml","raiz");
3153   - *
  3160 + *
3154 3161 * Parametros:
3155   - *
  3162 + *
3156 3163 * url {string} - url do arquivo KML
3157   - *
  3164 + *
3158 3165 * nomeOverlay {string} - t&iacute;tulo do tema
3159   - *
  3166 + *
3160 3167 * ativo {boolean} - indica o estado do checkbox
3161   - *
  3168 + *
3162 3169 * id {string} - nome do objeto GGeoXml
3163 3170 */
3164 3171 adicionaNoArvoreGoogle : function(url, nomeOverlay, ativo, id) {
... ... @@ -3254,11 +3261,11 @@ i3GEO.Interface = {
3254 3261 },
3255 3262 /*
3256 3263 * Function: ativaDesativaCamadaKml
3257   - *
  3264 + *
3258 3265 * Ativa ou desativa uma camada do n&oacute; de layers KML
3259   - *
  3266 + *
3260 3267 * Parametro:
3261   - *
  3268 + *
3262 3269 * obj {object} - objeto do tipo checkbox que foi ativado/desativado
3263 3270 */
3264 3271 ativaDesativaCamadaKml : function(obj) {
... ...
classesjs/classe_plugini3geo.js
1 1 /**
2 2 * Title: pluginI3geo
3   - *
  3 + *
4 4 * i3GEO.pluginI3geo
5   - *
  5 + *
6 6 * Implementam os plugins do i3Geo que adicionam camadas especiais ao mapa,
7 7 * normalmente dados vetoriais.
8   - *
  8 + *
9 9 * Arquivo:
10   - *
  10 + *
11 11 * i3geo/classesjs/classe_plugini3geo.js
12   - *
  12 + *
13 13 * Licen&ccedil;a:
14   - *
  14 + *
15 15 * GPL2
16   - *
  16 + *
17 17 * i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
18   - *
  18 + *
19 19 * Direitos Autorais Reservados (c) 2006 Minist&eacute;rio do Meio Ambiente
20 20 * Brasil Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com
21   - *
  21 + *
22 22 * Este programa &eacute; software livre; voc&ecirc; pode redistribu&iacute;-lo
23 23 * e/ou modific&aacute;-lo sob os termos da Licen&ccedil;a P&uacute;blica Geral
24 24 * GNU conforme publicada pela Free Software Foundation;
25   - *
  25 + *
26 26 * Este programa &eacute; distribu&iacute;do na expectativa de que seja
27 27 * &uacute;til, por&eacute;m, SEM NENHUMA GARANTIA; nem mesmo a garantia
28 28 * impl&iacute;cita de COMERCIABILIDADE OU ADEQUAC&Atilde;O A UMA FINALIDADE
... ... @@ -37,108 +37,150 @@ if (typeof (i3GEO) === &#39;undefined&#39;) {
37 37 var i3GEO = {};
38 38 }
39 39 i3GEO.pluginI3geo = {
40   - /**
41   - * Inicia a execucao de um plugin
42   - *
43   - * Camada e um objeto gerado pelo i3Geo quando uma camada e adicionada ao
44   - * mapa O objeto i3GEO.arvoreDeCamadas.CAMADAS guarda todas as camadas
45   - * adicionadas ao mapa Ao adicionar uma camada pelo catalogo, o i3Geo
46   - * verifica se a camada possui plugin e direciona para ca Os plugins sao
47   - * definidos como metadados em cada mapfile de cada tema
48   - *
49   - * Veja em i3geo/classesphp/classe_mapa.php funcao parametrostemas
50   - */
51   - inicia : function(camada) {
52   - i3GEO.janela.AGUARDEMODAL = true;
53   - i3GEO.janela.abreAguarde("aguardePlugin","Calculando...");
54   - i3GEO.janela.AGUARDEMODAL = false;
55   - // chama a funcao conforme o tipo de plugin e a interface atual
56   - // para cada plugin deve haver um objeto com as funcoes especificas para
57   - // cada interface
58   - i3GEO.pluginI3geo[camada.plugini3geo.plugin][i3GEO.Interface.ATUAL]
59   - .call(null, camada);
60   - },
61   - /**
62   - * Function: heatmap
63   - *
64   - * Mapa de calor
65   - *
66   - * Gera um layer do tipo mapa de calor e adiciona ao mapa
67   - *
68   - * As depend&ecirc;ncias em javascript sao carregadas via script tag por
69   - * meio de ferramentas/heatmap/openlayers_js.php
70   - *
71   - * Esse programa tamb&eacute;m obt&eacute;m os dados necess&aacute;rios ao
72   - * plugin
73   - *
74   - * O layer existente no mapfile deve conter um metadata chamado PLUGINI3GEO
75   - *
76   - * Esse matadado deve conter uma string que ser&aacute; transformada em um
77   - * objeto javascript para uso no plugin
78   - *
79   - * Exemplo:
80   - *
81   - * "PLUGINI3GEO" '{"plugin":"heatmap","parametros":{"coluna":"teste"}}'
82   - *
83   - * Coluna &eacute; a que cont&eacute;m os dados num&eacute;ricos que definem
84   - * a quantidade de uma medida em cada ponto e &eacute; usada para gerar a
85   - * representa&ccedil;&atilde;o. Se for vazia, considera-se o valor como 1
86   - *
87   - * As cores das classes existentes no LAYER ser&atilde;o utilizadas para
88   - * calcular as cores do mapa de calor. Se n&atilde;o existirem classes,
89   - * ser&aacute; usado o default.
90   - *
91   - */
92   - heatmap : {
93   - openlayers : function(camada) {
94   - var p = i3GEO.configura.locaplic
95   - + "/ferramentas/heatmap/openlayers_js.php", carregaJs = "nao", crialayer;
96   - criaLayer = function() {
97   - var heatmap, g, datalen = heatmap_dados.length, features = [];
98   - if (i3GEO.Interface.openlayers.googleLike === true) {
99   - var sphericalMercatorProj = new OpenLayers.Projection(
100   - 'EPSG:900913'), geographicProj = new OpenLayers.Projection(
101   - 'EPSG:4326');
  40 + /**
  41 + * Inicia a execucao de um plugin
  42 + *
  43 + * Camada e um objeto gerado pelo i3Geo quando uma camada e adicionada
  44 + * ao mapa O objeto i3GEO.arvoreDeCamadas.CAMADAS guarda todas as
  45 + * camadas adicionadas ao mapa Ao adicionar uma camada pelo catalogo, o
  46 + * i3Geo verifica se a camada possui plugin e direciona para ca Os
  47 + * plugins sao definidos como metadados em cada mapfile de cada tema
  48 + *
  49 + * Veja em i3geo/classesphp/classe_mapa.php funcao parametrostemas
  50 + */
  51 + inicia : function(camada) {
  52 + i3GEO.janela.AGUARDEMODAL = true;
  53 + i3GEO.janela.abreAguarde("aguardePlugin","Calculando...");
  54 + i3GEO.janela.AGUARDEMODAL = false;
  55 + // chama a funcao conforme o tipo de plugin e a interface atual
  56 + // para cada plugin deve haver um objeto com as funcoes especificas
  57 + // para
  58 + // cada interface
  59 + i3GEO.pluginI3geo[camada.plugini3geo.plugin][i3GEO.Interface.ATUAL]
  60 + .call(null, camada);
  61 + },
  62 + /**
  63 + * Function: heatmap
  64 + *
  65 + * Mapa de calor
  66 + *
  67 + * Gera um layer do tipo mapa de calor e adiciona ao mapa
  68 + *
  69 + * As depend&ecirc;ncias em javascript sao carregadas via script tag por
  70 + * meio de ferramentas/heatmap/openlayers_js.php
  71 + *
  72 + * Esse programa tamb&eacute;m obt&eacute;m os dados necess&aacute;rios
  73 + * ao plugin
  74 + *
  75 + * O layer existente no mapfile deve conter um metadata chamado
  76 + * PLUGINI3GEO
  77 + *
  78 + * Esse matadado deve conter uma string que ser&aacute; transformada em
  79 + * um objeto javascript para uso no plugin
  80 + *
  81 + * Exemplo:
  82 + *
  83 + * "PLUGINI3GEO" '{"plugin":"heatmap","parametros":{"coluna":"teste"}}'
  84 + *
  85 + * Coluna &eacute; a que cont&eacute;m os dados num&eacute;ricos que
  86 + * definem a quantidade de uma medida em cada ponto e &eacute; usada
  87 + * para gerar a representa&ccedil;&atilde;o. Se for vazia, considera-se
  88 + * o valor como 1
  89 + *
  90 + * As cores das classes existentes no LAYER ser&atilde;o utilizadas para
  91 + * calcular as cores do mapa de calor. Se n&atilde;o existirem classes,
  92 + * ser&aacute; usado o default.
  93 + *
  94 + */
  95 + heatmap : {
  96 + googlemaps: function(camada){
  97 + var p = i3GEO.configura.locaplic
  98 + + "/ferramentas/heatmap/googlemaps_js.php", carregaJs = "nao", crialayer;
  99 + criaLayer = function() {
  100 + var heatmap,pontos;
  101 + heatmap = new HeatmapOverlay(i3GeoMap, {
  102 + "radius":15,
  103 + "visible":true,
  104 + "opacity":60,
  105 + "gradient": { 0.45: "rgb(0,0,255)", 0.55: "rgb(0,255,255)", 0.65: "rgb(0,255,0)", 0.95: "yellow", 1.0: "rgb(255,0,0)" },
  106 + "legend": {
  107 + "title": camada.tema,
  108 + "position": "bl",
  109 + "offset": [5,50]
  110 + }
  111 + });
  112 + pontos={
  113 + max: 10,
  114 + data: heatmap_dados
  115 + };
  116 + i3GEO.janela.fechaAguarde("aguardePlugin");
  117 + heatmap.setDataSet(pontos);
  118 + heatmap_dados = null;
  119 + //i3GeoMap.setZoom(i3GeoMap.getZoom());
  120 + };
  121 + if (typeof (HeatmapOverlay) === 'undefined') {
  122 + carregaJs = "sim";
102 123 }
103   - while (datalen--) {
104   - g = new OpenLayers.Geometry.Point(parseInt(
105   - heatmap_dados[datalen].lng, 10), parseInt(
106   - heatmap_dados[datalen].lat, 10));
107   - if(geographicProj){
108   - g.transform(geographicProj, sphericalMercatorProj);
  124 + p += "?carregajs=" + carregaJs + "&layer=" + camada.name
  125 + + "&coluna=" + camada.plugini3geo.parametros.coluna
  126 + + "&g_sid=" + i3GEO.configura.sid
  127 + + "&nomevariavel=heatmap_dados";
  128 + i3GEO.util.scriptTag(p, criaLayer,
  129 + "i3GEO.pluginI3geo.heatmap_script");
  130 + },
  131 + openlayers : function(camada) {
  132 + var p = i3GEO.configura.locaplic
  133 + + "/ferramentas/heatmap/openlayers_js.php", carregaJs = "nao", crialayer;
  134 + criaLayer = function() {
  135 + var heatmap, transformedTestData = { max: 10 , data: [] },
  136 + data = heatmap_dados,
  137 + datalen = heatmap_dados.length,
  138 + nudata = [];
  139 + // in order to use the OpenLayers Heatmap Layer we have to transform our data into
  140 + // { max: <max>, data: [{lonlat: <OpenLayers.LonLat>, count: <count>},...]}
  141 + while(datalen--){
  142 + nudata.push({
  143 + lonlat: new OpenLayers.LonLat(data[datalen].lng, heatmap_dados[datalen].lat),
  144 + count: heatmap_dados[datalen].count
  145 + });
109 146 }
110   - features.push(new OpenLayers.Feature.Vector(g, {
111   - count : parseInt(heatmap_dados[datalen].count, 10)
112   - }));
113   - }
  147 + transformedTestData.data = nudata;
  148 + // create our heatmap layer
  149 + heatmap = new OpenLayers.Layer.Heatmap(
  150 + camada.name,
  151 + i3geoOL,
  152 + i3geoOL.baseLayer,
  153 + {
  154 + visible: true,
  155 + radius:10,
  156 + "gradient": { 0.45: "rgb(0,0,255)", 0.55: "rgb(0,255,255)", 0.65: "rgb(0,255,0)", 0.95: "yellow", 1.0: "rgb(255,0,0)" },
  157 + "legend": {
  158 + "title": camada.tema,
  159 + "position": "bl",
  160 + "offset": [5,50]
  161 + }
  162 + },
  163 + {
  164 + isBaseLayer: false,
  165 + opacity: 0.3,
  166 + projection: new OpenLayers.Projection("EPSG:4326")
  167 + }
  168 + );
  169 + i3geoOL.addLayer(heatmap);
  170 + heatmap.setDataSet(transformedTestData);
114 171  
115   - // create our vectorial layer using heatmap renderer
116   - heatmap = new OpenLayers.Layer.Vector(camada.name, {
117   - opacity : 0.3,
118   - renderers : [ 'Heatmap' ],
119   - rendererOptions : {
120   - weight : 'count',
121   - heatmapConfig : {
122   - radius : 10
123   - }
124   - }
125   - });
126   - heatmap.addFeatures(features);
127   - i3geoOL.addLayer(heatmap);
128   - heatmap_dados = null;
129   - i3GEO.janela.fechaAguarde("aguardePlugin");
130   - };
131   - if (typeof (HeatmapOverlay) === 'undefined') {
132   - carregaJs = "sim";
  172 + heatmap_dados = null;
  173 + i3GEO.janela.fechaAguarde("aguardePlugin");
  174 + };
  175 + if (typeof (HeatmapOverlay) === 'undefined') {
  176 + carregaJs = "sim";
  177 + }
  178 + p += "?carregajs=" + carregaJs + "&layer=" + camada.name
  179 + + "&coluna=" + camada.plugini3geo.parametros.coluna
  180 + + "&g_sid=" + i3GEO.configura.sid
  181 + + "&nomevariavel=heatmap_dados";
  182 + i3GEO.util.scriptTag(p, criaLayer,
  183 + "i3GEO.pluginI3geo.heatmap_script");
133 184 }
134   - p += "?carregajs=" + carregaJs + "&layer=" + camada.name
135   - + "&coluna=" + camada.plugini3geo.parametros.coluna
136   - + "&g_sid=" + i3GEO.configura.sid
137   - + "&nomevariavel=heatmap_dados";
138   -
139   - i3GEO.util.scriptTag(p, criaLayer,
140   - "i3GEO.pluginI3geo.heatmap_script");
141   -
142 185 }
143   - }
144 186 }
145 187 \ No newline at end of file
... ...
classesphp/classe_atributos.php
... ... @@ -564,17 +564,17 @@ class Atributos
564 564 }
565 565 /*
566 566 function: listaRegistrosXY
567   -
  567 +
568 568 Pega o XY de cada registro e valores de itens especificos
569   -
  569 +
570 570 parameters:
571   -
  571 +
572 572 $items - lista de itens separado por ","
573   -
  573 +
574 574 $tipo - Tipo de abrang&ecirc;ncia espacial (brasil ou mapa).
575   -
  575 +
576 576 $tipolista - Indica se ser&atilde;o mostrados todos os registros ou apenas os selecionados (tudo|selecionados)
577   -
  577 +
578 578 */
579 579 function listaRegistrosXY($items,$tipo,$tipolista)
580 580 {
... ...
ferramentas/heatmap/openlayers_js.php
... ... @@ -47,7 +47,8 @@ if (!connection_aborted()){
47 47 echo $nomevariavel.' = ['.implode(",",$resultado).'];';
48 48 if($carregajs === "sim"){
49 49 include_once($dir."/../../pacotes/heatmap/src/heatmap.js");
50   - include_once($dir."/../../pacotes/heatmap/src/heatmap-openlayers-renderer.js");
  50 + //include_once($dir."/../../pacotes/heatmap/src/heatmap-openlayers-renderer.js");
  51 + include_once($dir."/../../pacotes/heatmap/src/heatmap-openlayers.js");
51 52 }
52 53  
53 54 ?>
54 55 \ No newline at end of file
... ...
pacotes/heatmap/src/heatmap-gmaps.js
1   -/*
  1 +/*
2 2 * heatmap.js GMaps overlay
3 3 *
4 4 * Copyright (c) 2011, Patrick Wied (http://www.patrick-wied.at)
5 5 * Dual-licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
6 6 * and the Beerware (http://en.wikipedia.org/wiki/Beerware) license.
7   - */
8   -
  7 + */
  8 +
  9 +//cria um layer idiota para poder calcular a projecao
  10 +//http://stackoverflow.com/questions/1538681/how-to-call-fromlatlngtodivpixel-in-google-maps-api-v3
  11 +heatmapFooOverlay.prototype = new google.maps.OverlayView();
  12 +heatmapFooOverlay.prototype.onAdd = function() { }
  13 +heatmapFooOverlay.prototype.onRemove = function() { }
  14 +heatmapFooOverlay.prototype.draw = function() { }
  15 +function heatmapFooOverlay() { this.setMap(i3GeoMap); }
  16 +var heatmapBarOverlay = new heatmapFooOverlay();
  17 +
  18 +
9 19 function HeatmapOverlay(map, cfg){
10 20 var me = this;
11 21  
... ... @@ -14,21 +24,20 @@ function HeatmapOverlay(map, cfg){
14 24 me.latlngs = [];
15 25 me.bounds = null;
16 26 me.setMap(map);
17   -
18   - google.maps.event.addListener(map, 'dragend', function() { me.draw() });
  27 + google.maps.event.addListener(map, 'bounds_changed', function() { me.draw() });
19 28 }
20 29  
21 30 HeatmapOverlay.prototype = new google.maps.OverlayView();
22 31  
23 32 HeatmapOverlay.prototype.onAdd = function(){
24   -
  33 +
25 34 var panes = this.getPanes(),
26 35 w = this.getMap().getDiv().clientWidth,
27   - h = this.getMap().getDiv().clientHeight,
  36 + h = this.getMap().getDiv().clientHeight,
28 37 el = document.createElement("div");
29   -
  38 +
30 39 el.style.cssText = "position:absolute;top:0;left:0;width:"+w+"px;height:"+h+"px;";
31   -
  40 +
32 41 this.conf.element = el;
33 42 panes.overlayLayer.appendChild(el);
34 43  
... ... @@ -40,16 +49,16 @@ HeatmapOverlay.prototype.onRemove = function(){
40 49 }
41 50  
42 51 HeatmapOverlay.prototype.draw = function(){
43   -
  52 +
44 53 var me = this,
45   - overlayProjection = me.getProjection(),
  54 + overlayProjection = heatmapBarOverlay.getProjection(), //me.getProjection(),
46 55 currentBounds = me.map.getBounds();
47   -
  56 +
48 57 if (currentBounds.equals(me.bounds)) {
49 58 return;
50 59 }
51 60 me.bounds = currentBounds;
52   -
  61 +
53 62 var ne = overlayProjection.fromLatLngToDivPixel(currentBounds.getNorthEast()),
54 63 sw = overlayProjection.fromLatLngToDivPixel(currentBounds.getSouthWest()),
55 64 topY = ne.y,
... ... @@ -62,12 +71,12 @@ HeatmapOverlay.prototype.draw = function(){
62 71 me.conf.element.style.width = w + 'px';
63 72 me.conf.element.style.height = h + 'px';
64 73 me.heatmap.store.get("heatmap").resize();
65   -
  74 +
66 75 if(this.latlngs.length > 0){
67 76 this.heatmap.clear();
68   -
  77 +
69 78 var len = this.latlngs.length,
70   - projection = this.getProjection();
  79 + projection = heatmapBarOverlay.getProjection(); //this.getProjection();
71 80 d = {
72 81 max: this.heatmap.store.max,
73 82 data: []
... ... @@ -76,7 +85,7 @@ HeatmapOverlay.prototype.draw = function(){
76 85 while(len--){
77 86 var latlng = this.latlngs[len].latlng;
78 87 if(!currentBounds.contains(latlng)) { continue; }
79   -
  88 +
80 89 // DivPixel is pixel in overlay pixel coordinates... we need
81 90 // to transform to screen coordinates so it'll match the canvas
82 91 // which is continually repositioned to follow the screen.
... ... @@ -84,8 +93,8 @@ HeatmapOverlay.prototype.draw = function(){
84 93 screenPixel = new google.maps.Point(divPixel.x - leftX, divPixel.y - topY);
85 94  
86 95 var roundedPoint = this.pixelTransform(screenPixel);
87   -
88   - d.data.push({
  96 +
  97 + d.data.push({
89 98 x: roundedPoint.x,
90 99 y: roundedPoint.y,
91 100 count: this.latlngs[len].c
... ... @@ -96,17 +105,17 @@ HeatmapOverlay.prototype.draw = function(){
96 105 }
97 106  
98 107 HeatmapOverlay.prototype.pixelTransform = function(p){
99   - var w = this.heatmap.get("width"),
100   - h = this.heatmap.get("height");
  108 + var w = i3GEO.parametros.w,//this.heatmap.get("width"),
  109 + h = i3GEO.parametros.h; //this.heatmap.get("height");
101 110  
102 111 while(p.x < 0){
103 112 p.x+=w;
104 113 }
105   -
  114 +
106 115 while(p.x > w){
107 116 p.x-=w;
108 117 }
109   -
  118 +
110 119 while(p.y < 0){
111 120 p.y+=h;
112 121 }
... ... @@ -117,7 +126,7 @@ HeatmapOverlay.prototype.pixelTransform = function(p){
117 126  
118 127 p.x = (p.x >> 0);
119 128 p.y = (p.y >> 0);
120   -
  129 +
121 130 return p;
122 131 }
123 132  
... ... @@ -131,32 +140,34 @@ HeatmapOverlay.prototype.setDataSet = function(data){
131 140 },
132 141 d = data.data,
133 142 dlen = d.length,
134   - projection = me.getProjection(),
  143 + projection = heatmapBarOverlay.getProjection(),//me.getProjection(),
135 144 latlng, point;
136 145  
137 146 me.latlngs = [];
138   -
139   - while(dlen--){
  147 +
  148 + while(dlen--){
140 149 latlng = new google.maps.LatLng(d[dlen].lat, d[dlen].lng);
141   -
142   - if(!currentBounds.contains(latlng)) {
143   - continue;
  150 +
  151 + if(!currentBounds.contains(latlng)) {
  152 + continue;
144 153 }
145 154  
146 155 me.latlngs.push({latlng: latlng, c: d[dlen].count});
147 156 point = me.pixelTransform(projection.fromLatLngToDivPixel(latlng));
148 157 mapdata.data.push({x: point.x, y: point.y, count: d[dlen].count});
149 158 }
150   - me.heatmap.clear();
151   - me.heatmap.store.setDataSet(mapdata);
  159 + if(me.heatmap){
  160 + me.heatmap.clear();
  161 + me.heatmap.store.setDataSet(mapdata);
  162 + }
152 163 }
153 164  
154 165 HeatmapOverlay.prototype.addDataPoint = function(lat, lng, count){
155 166  
156   - var projection = this.getProjection(),
  167 + var projection = heatmapBarOverlay.getProjection(),//this.getProjection(),
157 168 latlng = new google.maps.LatLng(lat, lng),
158 169 point = this.pixelTransform(projection.fromLatLngToDivPixel(latlng));
159   -
  170 +
160 171 this.heatmap.store.addDataPoint(point.x, point.y, count);
161 172 this.latlngs.push({ latlng: latlng, c: count });
162 173 }
... ...
pacotes/heatmap/src/heatmap.js
... ... @@ -53,7 +53,7 @@
53 53  
54 54 // if count parameter is set increment by count otherwise by 1
55 55 data[x][y]+=(arguments.length<3)?1:arguments[2];
56   -
  56 +
57 57 me.set("data", data);
58 58 // do we have a new maximum?
59 59 if(me.max < data[x][y]){
... ... @@ -75,7 +75,7 @@
75 75 this.max = obj.max;
76 76 // if a legend is set, update it
77 77 heatmap.get("legend") && heatmap.get("legend").update(obj.max);
78   -
  78 +
79 79 if(internal != null && internal){
80 80 for(var one in d){
81 81 // jump over undefined indexes
... ... @@ -85,7 +85,7 @@
85 85 if(two === undefined)
86 86 continue;
87 87 // if both indexes are defined, push the values into the array
88   - heatmap.drawAlpha(one, two, d[one][two], false);
  88 + heatmap.drawAlpha(one, two, d[one][two], false);
89 89 }
90 90 }
91 91 }else{
... ... @@ -162,28 +162,28 @@
162 162 config = me.config,
163 163 title = config.title || "Legend",
164 164 position = config.position,
165   - offset = config.offset || 10,
  165 + offset = config.offset || [10,10],
166 166 gconfig = config.gradient,
167 167 labelsEl = document.createElement("ul"),
168 168 labelsHtml = "",
169 169 grad, element, gradient, positionCss = "";
170   -
  170 +
171 171 me.processGradientObject();
172   -
  172 +
173 173 // Positioning
174 174  
175 175 // top or bottom
176 176 if(position.indexOf('t') > -1){
177   - positionCss += 'top:'+offset+'px;';
  177 + positionCss += 'top:'+offset[1]+'px;';
178 178 }else{
179   - positionCss += 'bottom:'+offset+'px;';
  179 + positionCss += 'bottom:'+offset[1]+'px;';
180 180 }
181 181  
182 182 // left or right
183 183 if(position.indexOf('l') > -1){
184   - positionCss += 'left:'+offset+'px;';
  184 + positionCss += 'left:'+offset[0]+'px;';
185 185 }else{
186   - positionCss += 'right:'+offset+'px;';
  186 + positionCss += 'right:'+offset[0]+'px;';
187 187 }
188 188  
189 189 element = document.createElement("div");
... ... @@ -191,7 +191,7 @@
191 191 element.innerHTML = "<h3 style='padding:0;margin:0;text-align:center;font-size:16px;'>"+title+"</h3>";
192 192 // create gradient in canvas
193 193 labelsEl.style.cssText = "position:relative;font-size:12px;display:block;list-style:none;list-style-type:none;margin:0;height:15px;";
194   -
  194 +
195 195  
196 196 // create gradient element
197 197 gradient = document.createElement("div");
... ... @@ -199,7 +199,7 @@
199 199  
200 200 element.appendChild(labelsEl);
201 201 element.appendChild(gradient);
202   -
  202 +
203 203 me.set("element", element);
204 204 me.set("labelsEl", labelsEl);
205 205  
... ... @@ -244,7 +244,7 @@
244 244 ctx.fillRect(0,5,256,10);
245 245 ctx.strokeStyle = "black";
246 246 ctx.beginPath();
247   -
  247 +
248 248 for(var i = 0; i < length; i++){
249 249 ctx.moveTo(((1/(length-1)*i*256) >> 0)+.5, 0);
250 250 ctx.lineTo(((1/(length-1)*i*256) >> 0)+.5, (i==0)?15:5);
... ... @@ -253,7 +253,7 @@
253 253 ctx.lineTo(255.5, 15);
254 254 ctx.moveTo(255.5, 4.5);
255 255 ctx.lineTo(0, 4.5);
256   -
  256 +
257 257 ctx.stroke();
258 258  
259 259 // we re-use the context for measuring the legends label widths
... ... @@ -283,7 +283,7 @@
283 283 offset *= 2;
284 284 }
285 285 labelsHtml += '<li style="position:absolute;left:'+(((((1/(gradient.length-1)*i*256) || 0)) >> 0)-offset+.5)+'px">'+labelText+'</li>';
286   - }
  286 + }
287 287 labels.innerHTML = labelsHtml;
288 288 }
289 289 };
... ... @@ -351,7 +351,7 @@
351 351 legendCfg.gradient = me.get("gradient");
352 352 me.set("legend", new legend(legendCfg));
353 353 }
354   -
  354 +
355 355 },
356 356 resize: function () {
357 357 var me = this,
... ... @@ -372,7 +372,7 @@
372 372 actx = acanvas.getContext("2d"),
373 373 element = me.get("element");
374 374  
375   -
  375 +
376 376 me.initColorPalette();
377 377  
378 378 me.set("canvas", canvas);
... ... @@ -382,7 +382,7 @@
382 382  
383 383 me.resize();
384 384 canvas.style.cssText = acanvas.style.cssText = "position:absolute;top:0;left:0;z-index:10000000;";
385   -
  385 +
386 386 if(!me.get("visible"))
387 387 canvas.style.display = "none";
388 388  
... ... @@ -390,14 +390,14 @@
390 390 if(me.get("legend")){
391 391 element.appendChild(me.get("legend").getElement());
392 392 }
393   -
  393 +
394 394 // debugging purposes only
395 395 if(me.get("debug"))
396 396 document.body.appendChild(acanvas);
397   -
398   - actx.shadowOffsetX = 15000;
399   - actx.shadowOffsetY = 15000;
400   - actx.shadowBlur = 15;
  397 +
  398 + actx.shadowOffsetX = 15000;
  399 + actx.shadowOffsetY = 15000;
  400 + actx.shadowBlur = 15;
401 401 },
402 402 initColorPalette: function(){
403 403  
... ... @@ -420,7 +420,7 @@
420 420 ctx.putImageData(testData, 0, 0);
421 421 testData = ctx.getImageData(0,0,1,1);
422 422 me.set("premultiplyAlpha", (testData.data[0] < 60 || testData.data[0] > 70));
423   -
  423 +
424 424 for(var x in gradient){
425 425 grad.addColorStop(x, gradient[x]);
426 426 }
... ... @@ -465,9 +465,9 @@
465 465 palette = me.get("gradient"),
466 466 opacity = me.get("opacity"),
467 467 bounds = me.get("bounds"),
468   - left, top, bottom, right,
  468 + left, top, bottom, right,
469 469 image, imageData, length, alpha, offset, finalAlpha;
470   -
  470 +
471 471 if(x != null && y != null){
472 472 if(x+x2>width){
473 473 x=width-x2;
... ... @@ -506,7 +506,7 @@
506 506 bottom = height;
507 507 }else{
508 508 bottom = bounds['b'];
509   - }
  509 + }
510 510 }
511 511  
512 512 image = actx.getImageData(left, top, right-left, bottom-top);
... ... @@ -528,7 +528,7 @@
528 528 imageData[i-3]=palette[offset];
529 529 imageData[i-2]=palette[offset+1];
530 530 imageData[i-1]=palette[offset+2];
531   -
  531 +
532 532 if (premultiplyAlpha) {
533 533 // To fix browsers that premultiply incorrectly, we'll pass in a value scaled
534 534 // appropriately so when the multiplication happens the correct value will result.
... ... @@ -536,7 +536,7 @@
536 536 imageData[i-2] /= 255/finalAlpha;
537 537 imageData[i-1] /= 255/finalAlpha;
538 538 }
539   -
  539 +
540 540 // we want the heatmap to have a gradient from transparent to the colors
541 541 // as long as alpha is lower than the defined opacity (maximum), we'll use the alpha value
542 542 imageData[i] = finalAlpha;
... ... @@ -558,9 +558,9 @@
558 558  
559 559 ctx.shadowColor = ('rgba(0,0,0,'+((count)?(count/me.store.max):'0.1')+')');
560 560  
561   - ctx.shadowOffsetX = 15000;
562   - ctx.shadowOffsetY = 15000;
563   - ctx.shadowBlur = 15;
  561 + ctx.shadowOffsetX = 15000;
  562 + ctx.shadowOffsetY = 15000;
  563 + ctx.shadowBlur = 15;
564 564  
565 565 ctx.beginPath();
566 566 ctx.arc(x - 15000, y - 15000, radius, 0, Math.PI * 2, true);
... ... @@ -621,7 +621,7 @@
621 621 return {
622 622 create: function(config){
623 623 return new heatmap(config);
624   - },
  624 + },
625 625 util: {
626 626 mousePosition: function(ev){
627 627 // this doesn't work right
... ...