Commit a24ca97d4905db4c80a18661325d29f4a73bb72b

Authored by Edmar Moretti
1 parent 4dde11da

--no commit message

ferramentas/saiku/cartograma.php
... ... @@ -56,9 +56,7 @@ if($opcoes["tipo"] == "mapaPizzas" || $opcoes["tipo"] == "mapaBarras" || $opcoes
56 56 $colunageo = $meta["colunacentroide"];
57 57 $sqlColunaGeo = $meta["colunacentroide"];
58 58 }
59   - else{
60   - $sqlColunaGeo = "st_centroid(".$meta["colunageo"].")";
61   - }
  59 + $sqlColunaGeo = "st_centroid(".$colunageo.")";
62 60 $tipoLayer = "POINT";
63 61 if($opcoes["tipo"] == "mapaBarras" || $opcoes["tipo"] == "mapaPizzas"){
64 62 $tipoLayer = "CHART";
... ... @@ -90,6 +88,15 @@ $sqldados = "
90 88 from ".$meta["esquemadb"].".".$meta["tabela"]." INNER JOIN
91 89 (values ".implode(",",$valores).') as dataset ("'.implode('","',$nomesColunas).'") ON geocodigo = '.$meta["identificador"];
92 90 $sqlmapa = $colunageo." from ($sqldados) as foo using unique gid using srid=$srid";
  91 +
  92 +//para o tema com o outline caso o saiku tenha sido aberto de fora do i3Geo
  93 +$sqldados1 = "
  94 +select st_setsrid(".$meta["colunageo"].",".$srid.") as ".$meta["colunageo"].", ".implode(",",$colunastabela).",dataset.*
  95 +from ".$meta["esquemadb"].".".$meta["tabela"]." INNER JOIN
  96 +(values ".implode(",",$valores).') as dataset ("'.implode('","',$nomesColunas).'") ON geocodigo = '.$meta["identificador"];
  97 +
  98 +$sqlmapa1 = $meta["colunageo"]." from ($sqldados1) as foo using unique gid using srid=$srid";
  99 +
93 100 $mapa = ms_newMapObj($map_file);
94 101 $nlayers = $mapa->numlayers;
95 102 for($i=0;$i<$nlayers;$i++){
... ... @@ -151,6 +158,33 @@ $l .= PHP_EOL.&#39;END&#39;;
151 158 //echo $l;exit;
152 159 $layer->updateFromString($l);
153 160  
  161 +//inclui o layer com o contorno se for o caso
  162 +if(empty($_GET["origem"]) && ($tipoLayer == "CHART" || $tipoLayer == "POINT")){
  163 + $layer = ms_newLayerObj($mapa);
  164 + $nomeLayer = nomeRandomico();
  165 + $l = array();
  166 + $l[] = "LAYER";
  167 + $l[] = ' NAME "'.$nomeLayer.'"';
  168 + $l[] = " TYPE POLYGON";
  169 + $l[] = " DATA '".$sqlmapa1."'";
  170 + $l[] = ' CONNECTION "'.$conexao.'"';
  171 + $l[] = ' CONNECTIONTYPE POSTGIS';
  172 + $l[] = ' TEMPLATE "none.htm"';
  173 + $l[] = ' STATUS DEFAULT';
  174 + $l[] = ' METADATA';
  175 + $l[] = ' TEMA "Limites"';
  176 + $l[] = ' CLASSE "SIM"';
  177 + $l[] = ' SAIKU "'.$opcoes["tipo"].'"';
  178 + $l[] = ' METAESTAT_CODIGO_TIPO_REGIAO "'.$codigo_tipo_regiao.'"';
  179 + $l[] = ' END ';
  180 + $l[] = ' CLASS ';
  181 + $l[] = ' OUTLINECOLOR 255 255 255 ';
  182 + $l[] = ' END ';
  183 + $l[] = 'END ';
  184 + $l = implode(PHP_EOL,$l);
  185 + $layer->updateFromString($l);
  186 +}
  187 +
154 188 $mapa->save($map_file);
155 189  
156 190 if($opcoes["tipo"] == "coresChapadas"){
... ...
ferramentas/saiku/esquemaxml.php
... ... @@ -3,7 +3,7 @@
3 3 if(empty($_GET["g_sid"])){
4 4 include(dirname(__FILE__)."/../../ms_criamapa.php");
5 5 //reinicia a url
6   - $urln = "?g_sid=".session_id()."&locaplic=".$_GET["locaplic"]."&mapext=".$mapext;
  6 + $urln = "?g_sid=".session_id()."&locaplic=".$_GET["locaplic"]."&mapext=".$mapext."&origem=".$_GET["origem"];
7 7 header("Location:".$urln);
8 8 exit;
9 9 }
... ... @@ -386,7 +386,7 @@ ob_end_clean();
386 386 //echo $xml;exit;
387 387 gravaDados(array($xml),$arquivoXmlEsquema);
388 388  
389   -header("Location:".$saikuUrl."/?nomeConexao=".$nomeConexao."&locaplic=".$_GET["locaplic"]."&g_sid=".$_GET["g_sid"]."&mapext=".$_GET["mapext"]);
  389 +header("Location:".$saikuUrl."/?nomeConexao=".$nomeConexao."&locaplic=".$_GET["locaplic"]."&g_sid=".$_GET["g_sid"]."&mapext=".$_GET["mapext"]."&origem=".$_GET["origem"]);
390 390  
391 391 function converte($texto){
392 392 $texto = str_replace("&","&amp;",htmlentities($texto));
... ...
ferramentas/saiku/index.js
... ... @@ -154,7 +154,7 @@ i3GEOF.saiku = {
154 154 },
155 155 aplicar: function(){
156 156 var mapext = i3GEO.util.extOSM2Geo(i3GEO.parametros.mapexten);
157   - window.open(i3GEO.configura.locaplic+"/ferramentas/saiku/esquemaxml.php?g_sid="+i3GEO.configura.sid+"&locaplic="+i3GEO.configura.locaplic+"&mapext="+mapext);
  157 + window.open(i3GEO.configura.locaplic+"/ferramentas/saiku/esquemaxml.php?origem=i3geo&g_sid="+i3GEO.configura.sid+"&locaplic="+i3GEO.configura.locaplic+"&mapext="+mapext);
158 158 },
159 159 atualizaMapa: function(){
160 160 i3GEO.atualiza("");
... ...