Commit a2dee17d458558990d2ebb7d523e5a6fd4d4281a

Authored by Edmar Moretti
1 parent fde53c66

Inclusao de $customDir no ms_configura.php

Uso de $customDir em init/index.php
Conclusão do mapa de calor no Saiku
ferramentas/heatmap/openlayers_js.php
... ... @@ -27,6 +27,16 @@ include_once($dir."/../../classesphp/classe_atributos.php");
27 27 //o plugin pode ser chamado sem um mapfile criado
28 28 //usando apenas o mapfile existente em i3geo/temas
29 29 //nesse caso e necessario cirar um mapfile temporario
  30 +
  31 +//no caso do SAIKU, o nome do mapfile pode estar na sessao
  32 +session_name("i3GeoPHP");
  33 +session_start();
  34 +if(!empty($_SESSION["map_file"])){
  35 + $mapateste = ms_newMapObj($_SESSION["map_file"]);
  36 + if($mapateste->getlayerbyname($layer) != ""){
  37 + $map_file = $_SESSION["map_file"];
  38 + }
  39 +}
30 40 if(empty($map_file) && file_exists($dir."/../../temas/{$layer}.map")){
31 41 $versao = versao();
32 42 $versao = $versao["principal"];
... ...
ferramentas/saiku/cartograma.php
... ... @@ -9,7 +9,6 @@ include_once(dirname(__FILE__)."/../../classesphp/classe_estatistica.php");
9 9 if(!isset($dir_tmp)){
10 10 include(dirname(__FILE__)."/../../ms_configura.php");
11 11 }
12   -
13 12 //pega o filtro da sessao PHP aberta pelo i3Geo
14 13 session_name("i3GeoPHP");
15 14 session_id($_POST["g_sid"]);
... ... @@ -18,7 +17,6 @@ session_start();
18 17 $map_file = $_SESSION["map_file"];
19 18 $dados = (array) json_decode($_POST["dados"],true);
20 19 $opcoes = (array) json_decode($_POST["opcoes"],true);
21   -
22 20 $metadados = (array) json_decode($_POST["metadados"],true);
23 21 $nmetadados = count($metadados);
24 22 //pega o id da regiao (busca pelo posfixo geocod)
... ... @@ -51,7 +49,7 @@ $srid = $meta["srid"];
51 49 $colunastabela = $m->colunasTabela($meta["codigo_estat_conexao"],$meta["esquemadb"],$meta["tabela"],"geometry","!=");
52 50 $tipoLayer = "POLYGON";
53 51 //define a coluna geo correta
54   -if($opcoes["tipo"] == "mapaPizzas" || $opcoes["tipo"] == "mapaBarras" || $opcoes["tipo"] == "raiosProporcionais" || $opcoes["tipo"] == "circulosProporcionais"){
  52 +if($opcoes["tipo"] == "calor" || $opcoes["tipo"] == "mapaPizzas" || $opcoes["tipo"] == "mapaBarras" || $opcoes["tipo"] == "raiosProporcionais" || $opcoes["tipo"] == "circulosProporcionais"){
55 53 if($meta["colunacentroide"] != ""){
56 54 $colunageo = $meta["colunacentroide"];
57 55 $sqlColunaGeo = $meta["colunacentroide"];
... ... @@ -159,7 +157,7 @@ $l .= PHP_EOL.'END';
159 157 $layer->updateFromString($l);
160 158  
161 159 //inclui o layer com o contorno se for o caso
162   -if(empty($_GET["origem"]) && ($tipoLayer == "CHART" || $tipoLayer == "POINT")){
  160 +if($opcoes["tipo"] != "calor" && empty($_GET["origem"]) && ($tipoLayer == "CHART" || $tipoLayer == "POINT")){
163 161 $layer = ms_newLayerObj($mapa);
164 162 $nomeLayer = nomeRandomico();
165 163 $l = array();
... ... @@ -197,7 +195,11 @@ if($opcoes["tipo"] == "coresChapadas"){
197 195 $retorno = $m->alteraCoresClasses($cori,$corf);
198 196 $m->salva();
199 197 }
200   -
  198 +if($opcoes["tipo"] == "calor"){
  199 + $parametros = '{"plugin":"heatmap","parametros":{"opacity":".8","coluna":"","radius":"'.$opcoes["raio"].'","max":"'.$opcoes["max"].'"}}';
  200 + $layer->setmetadata("PLUGINI3GEO",$parametros);
  201 + $mapa->save($map_file);
  202 +}
201 203 header("Location:".$opcoes["locaplic"]."/mashups/openlayers.php?temas=".$map_file."&DESLIGACACHE=sim&botoes=legenda,pan,zoombox,zoomtot,zoomin,zoomout,distancia,area,identifica&controles=navigation,layerswitcher,scaleline,mouseposition,overviewmap,keyboarddefaults&tiles=false&mapext=".$opcoes["mapext"]);
202 204  
203 205 function mapaBarras($colunas){
... ...
ferramentas/saiku/saiku-server/tomcat/webapps/ROOT/js/saiku/plugins/i3GeoMap/plugin.js
... ... @@ -51,6 +51,7 @@ var i3GeoMap = Backbone.View.extend({
51 51 "&nbsp;<input type=button name=raiosProporcionais value='Raios proporcionais' />"+
52 52 "&nbsp;<input type=button name=circulosProporcionais value='C&iacute;rculos proporcionais' />"+
53 53 "&nbsp;<input type=button name=coresChapadas value='Cores' />"+
  54 + "&nbsp;<input type=button name=calor value='Calor' />"+
54 55 "&nbsp;<input type=button name=atualizarMapa value='Atualiza' />"+
55 56 "&nbsp;<input type=button name=fecharMapa value='Fechar' />"+
56 57 //"</ul>"+
... ... @@ -323,6 +324,44 @@ var i3GeoMap = Backbone.View.extend({
323 324 title: false
324 325 });
325 326 },
  327 + calor: function(s){
  328 + this.opcoes.size = 10;
  329 + $.fancybox("Raio de um ponto em pixels:<br><input type=text value='10' size=6 id='calorRaio' /><br>" +
  330 + "Valor m&aacute;ximo em cada ponto:<br><input type=text value='10' size=6 id='calorMax' /><br>" +
  331 + "<br>Coluna com os valores:<br>"+
  332 + "<select id='calorColuna' style='border:1px solid #BBBBBB;'>"+this.opcoesColunas()+"</select>" +
  333 + "<br><input type=button value='OK' id='calorOk' />" +
  334 + "&nbsp; <input type=button value='Cancela' id='calorCancela' />"
  335 + ,
  336 + {
  337 + 'autoDimensions' : false,
  338 + 'autoScale' : false,
  339 + 'height' : 250,
  340 + 'width' : 350,
  341 + 'transitionIn' : 'none',
  342 + 'transitionOut' : 'none',
  343 + 'showCloseButton' : false,
  344 + 'modal' : false
  345 + }
  346 + );
  347 + document.getElementById("calorOk").onclick = function(){
  348 + s.opcoes.tipo = "calor";
  349 + //s.opcoes.size = document.getElementById("raiosProporcionaisSize").value;
  350 + s.opcoes.indicecoluna = [parseInt(document.getElementById("calorColuna").value,10)];
  351 + s.opcoes.raio = document.getElementById("calorRaio").value;
  352 + s.opcoes.max = document.getElementById("calorMax").value;
  353 + s.render();
  354 + $.fancybox.close();
  355 + };
  356 + document.getElementById("calorCancela").onclick = function(){
  357 + $.fancybox.close();
  358 + s.fecharMapa();
  359 + };
  360 + jQuery('select[name="colour"]').colourPicker({
  361 + ico: 'js/jquery/jquery.colourPicker.gif',
  362 + title: false
  363 + });
  364 + },
326 365  
327 366 opcoesColunas: function(){
328 367 var m = this.data.metadata,
... ... @@ -476,6 +515,7 @@ var i3GeoMap = Backbone.View.extend({
476 515 //preenche os dados do formulario
477 516 this.opcoes.locaplic = parametroUrl("locaplic");
478 517 this.opcoes.mapext = parametroUrl("mapext");
  518 + //alert(JSON.stringify(this.opcoes))
479 519 document.getElementById("formi3GeoMapOpcoes").value = JSON.stringify(this.opcoes);
480 520 document.getElementById("formi3GeoMapdados").value = JSON.stringify(dados);
481 521 document.getElementById("formi3GeoMapmetadados").value = JSON.stringify(metadata);
... ...
guia_de_migracao.txt
... ... @@ -3,6 +3,8 @@ GUIA DE UPDATES e UPGRADES
3 3 -------------------------------------------------------------------------------------------------
4 4 Para a versão 6.0
5 5  
  6 +- Nova variável em ms_configura chamada $customDir que indica a pasta com as customizações dos mapas
  7 +
6 8 - nas interfaces que utilizam a API do google maps agora é necessário carregar a biblioteca geometry com o seguinte código:
7 9 <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&libraries=drawing,geometry"></script>
8 10  
... ...
init/index.php
1 1 <?php
2 2 /**
  3 + * Pagina inicial do i3Geo
  4 + * Voce pode utilizar o parametro customDir para indicar a pasta onde
  5 + * as interfaces de mapa estao. Nesse caso, os links utilizarao esse parametro
  6 + * Exemplo: localhost/i3geo/init/index.php?customDir=minhaPasta
  7 + *
  8 + * minhaPasta deve estar dentor da pasta i3geo.
  9 + *
  10 + * Se dentro da pasta $customDir existir um arquivo chamado index.php sera feito o include
  11 + * na pagina.
  12 + */
  13 +/**
3 14 * Cria as pastas temporarias que o i3Geo precisa, caso nao existam
4 15 */
5 16 include(dirname(__FILE__)."/../ms_configura.php");
  17 +if(!empty($_GET["customDir"])){
  18 + $customDir = $_GET["customDir"];
  19 +}
  20 +else if(empty($customDir)){
  21 + $customDir = "interface";
  22 +}
6 23 if(!file_exists($dir_tmp)){
7 24 @mkdir ($dir_tmp,0777);
8 25 }
... ... @@ -15,6 +32,9 @@ if(file_exists($dir_tmp)){
15 32 @mkdir($dir_tmp."/cache/googlemaps",0777);
16 33 chmod($dir_tmp."/cache/googlemaps",0777);
17 34 }
  35 +if(file_exists($locaplic."/".$customDir."/index.php")){
  36 + include($locaplic."/".$customDir."/index.php");
  37 +}
18 38 ?>
19 39 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/strict.dtd">
20 40 <html>
... ... @@ -91,6 +111,7 @@ a {
91 111 margin: 0px auto;
92 112 text-decoration: none;
93 113 }
  114 +
94 115 </style>
95 116 </head>
96 117 <body class=" yui-skin-sam ">
... ... @@ -110,19 +131,23 @@ a {
110 131 <div id="botoes"></div>
111 132 </div>
112 133 <div style="float: left">
113   - <div class="r" style="width: 230px; height: 380px"><table>
  134 + <div class="r" style="width: 230px; height: 380px">
  135 + <table>
114 136 <tr>
115   - <td><a class="twitter-timeline" href="https://twitter.com/i3geo" data-widget-id="288061915689787392" style="width:220px;height:350px">Tweets @i3Geo</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
  137 + <td><a class="twitter-timeline" href="https://twitter.com/i3geo" data-widget-id="288061915689787392" style="width: 220px; height: 350px">Tweets @i3Geo</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
116 138 </td>
117 139 </tr>
118   - </table> </div>
  140 + </table>
  141 + </div>
119 142  
120   - <div class="r" style="width: 230px; height: 380px"><table>
  143 + <div class="r" style="width: 230px; height: 380px">
  144 + <table>
121 145 <tr>
122   - <td><a class="twitter-timeline" href="https://twitter.com/search?q=@i3geo" data-widget-id="288053202174222336" style="width:220px;height:350px">Tweets #i3Geo</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
  146 + <td><a class="twitter-timeline" href="https://twitter.com/search?q=@i3geo" data-widget-id="288053202174222336" style="width: 220px; height: 350px">Tweets #i3Geo</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
123 147 </td>
124 148 </tr>
125   - </table> </div>
  149 + </table>
  150 + </div>
126 151 </div>
127 152 </div>
128 153  
... ... @@ -141,15 +166,15 @@ botoesIni.push({
141 166 "titulo":$trad(3,g_traducao_init)
142 167 },{
143 168 "img":"openlayers.png",
144   - "href":"../interface/black_ol.htm",
  169 + "href":"../<?php echo $customDir; ?>/black_ol.htm",
145 170 "titulo":$trad(4,g_traducao_init)
146 171 },{
147 172 "img":"openlayersdebug.png",
148   - "href":"../interface/openlayersdebug.htm",
  173 + "href":"../<?php echo $customDir; ?>/openlayersdebug.htm",
149 174 "titulo":$trad(5,g_traducao_init)
150 175 },{
151 176 "img":"osm.png",
152   - "href":"../interface/black_osm.htm",
  177 + "href":"../<?php echo $customDir; ?>/black_osm.htm",
153 178 "titulo":$trad(23,g_traducao_init)
154 179 },{
155 180 "img":"mashup.png",
... ... @@ -157,19 +182,19 @@ botoesIni.push({
157 182 "titulo":$trad(18,g_traducao_init)
158 183 },{
159 184 "img":"googlemaps.png",
160   - "href":"../interface/black_gm.phtml",
  185 + "href":"../<?php echo $customDir; ?>/black_gm.phtml",
161 186 "titulo":$trad(6,g_traducao_init)
162 187 },{
163 188 "img":"googlemaps_noite.png",
164   - "href":"../interface/googlemaps_noite.phtml",
  189 + "href":"../<?php echo $customDir; ?>/googlemaps_noite.phtml",
165 190 "titulo":$trad(22,g_traducao_init)
166 191 },{
167 192 "img":"googleearth.png",
168   - "href":"../interface/googleearth.phtml",
  193 + "href":"../<?php echo $customDir; ?>/googleearth.phtml",
169 194 "titulo":$trad(7,g_traducao_init)
170 195 },{
171 196 "img":"cartogramas.png",
172   - "href":"../interface/black_carto_ol.htm",
  197 + "href":"../<?php echo $customDir; ?>/black_carto_ol.htm",
173 198 "titulo":$trad(8,g_traducao_init)
174 199 },{
175 200 "img":"editor.png",
... ...
ms_configura.php
... ... @@ -220,7 +220,7 @@ $twitteroauth = array(
220 220  
221 221 Mensagem de inicializa&ccedil;&atilde;o mostrada pelo programa ms_criamapa.php
222 222  
223   - &Eacute; obtida de um include para permitir a atualiza&ccedil;&atilde;o da vers&atilde;o nos pacotes de corre&ccedil;&atilde;o
  223 + Por default &eacute; obtida de um include para permitir a atualiza&ccedil;&atilde;o da vers&atilde;o nos pacotes de corre&ccedil;&atilde;o
224 224  
225 225 Tipo:
226 226 {string}
... ... @@ -274,7 +274,7 @@ $metaestatTemplates = &quot;/ferramentas/metaestat/templates&quot;;
274 274 /*
275 275 Variable: navegadoresLocais
276 276  
277   -O i3geo possibilita que os usu&aacute;rios acessem dados geogr&aacute;ficos no servidor diretamente,
  277 +O i3geo possibilita que os usu&aacute;rios acessem dados geogr&aacute;ficos no servidor diretamente,
278 278 navegando pelo sistema de arquivos.
279 279 Isso possibilita o acesso aos dados mesmo que n&atilde;o constem na &aacute;rvore de temas
280 280  
... ... @@ -284,13 +284,13 @@ Se do lado do cliente a variavel javascript for false e $navegadoresLocais for v
284 284 na &aacute;rvore
285 285  
286 286 i3GEO.arvoreDeTemas.OPCOESADICIONAIS.navegacaoDir = false; //inserir no HTML
287   -
  287 +
288 288 Portanto, se vc n&atilde;o quiser que essa op&ccedil;&atilde;o seja ativada, mesmo com o usu&aacute;rio logado
289 289 mantenha essa vari&aacute;vel igual a
290 290  
291 291 $navegadoresLocais = "";
292 292  
293   -Para efeito de compatibilidade, manteve-se a possibilidade de um array com multiplos arrays,
  293 +Para efeito de compatibilidade, manteve-se a possibilidade de um array com multiplos arrays,
294 294 mas apenas o primeiro e utilizado
295 295  
296 296 Exemplo:
... ... @@ -497,6 +497,19 @@ Tipo:
497 497 {string}
498 498 */
499 499 $interfacePadrao = "black_ol.htm";
  500 +/*
  501 +Variable: customDir
  502 +
  503 + Nome da pasta dentro de &quot;i3geo&quot; utilizada para armazenar os arquivos das interfaces de mapas interativos e outras
  504 + customiza&ccedil;&otilde;es espec&iacute;ficas de determinada instala&ccedil;&atilde;o. O valor padr&atilde;o &eacute; &quot;interface&quot;, ou seja, os arquivos ficam
  505 + na pasta i3geo/interface.
  506 +
  507 + A p&aacute;gina inicial do i3Geo utiliza essa vari&aacute;vel para montar os links que abrem os mapas.
  508 +
  509 +Tipo:
  510 +{string}
  511 +*/
  512 +$customDir = "interface";
500 513 /*
501 514 Variable: base
502 515  
... ...