Commit 56475d097029d0251b3cf1313782f4bb83df9cc1
1 parent
d61aae81
Exists in
master
and in
7 other branches
Corrigir a função que mostra os limites geográficos na ferramenta de análise do …
…METAESTAT para evitar a inclusão repetida de layers
Showing
4 changed files
with
62 additions
and
14 deletions
Show diff stats
admin/admin.db
No preview for this file type
admin/php/classe_metaestat.php
| @@ -484,12 +484,17 @@ class Metaestat{ | @@ -484,12 +484,17 @@ class Metaestat{ | ||
| 484 | } | 484 | } |
| 485 | return array("mapfile"=>$arq,"layer"=>$this->nomecache,"titulolayer"=>$titulolayer); | 485 | return array("mapfile"=>$arq,"layer"=>$this->nomecache,"titulolayer"=>$titulolayer); |
| 486 | } | 486 | } |
| 487 | - function mapfileTipoRegiao($codigo_tipo_regiao,$outlinecolor="255,0,0",$width=1,$nomes="nao"){ | 487 | + function mapfileTipoRegiao($codigo_tipo_regiao,$outlinecolor="255,0,0",$width=1,$nomes="nao",$forcaArquivo=false){ |
| 488 | //para permitir a inclusao de filtros, o fim do sql e marcado com /*FW*//*FW*/ | 488 | //para permitir a inclusao de filtros, o fim do sql e marcado com /*FW*//*FW*/ |
| 489 | //indicando onde deve comecar e terminar uma possivel clausula where | 489 | //indicando onde deve comecar e terminar uma possivel clausula where |
| 490 | //Layers adicionados aqui sao marcados com o metadata METAESTAT "SIM" | 490 | //Layers adicionados aqui sao marcados com o metadata METAESTAT "SIM" |
| 491 | //O codigo_tipo_regiao e marcado com o metadata METAESTAT_CODIGO_TIPO_REGIAO | 491 | //O codigo_tipo_regiao e marcado com o metadata METAESTAT_CODIGO_TIPO_REGIAO |
| 492 | - $arq = $this->dir_tmp."/".$this->nomecache.".map"; | 492 | + if($forcaArquivo == false){ |
| 493 | + $arq = $this->dir_tmp."/".$this->nomecache.".map"; | ||
| 494 | + } | ||
| 495 | + else{ | ||
| 496 | + $arq = $this->dir_tmp."/".$this->nomecache.nomeRandomico(3).".map"; | ||
| 497 | + } | ||
| 493 | if(!file_exists($arq)){ | 498 | if(!file_exists($arq)){ |
| 494 | $tipolayer = "polygon"; | 499 | $tipolayer = "polygon"; |
| 495 | $meta = $this->listaTipoRegiao($codigo_tipo_regiao); | 500 | $meta = $this->listaTipoRegiao($codigo_tipo_regiao); |
| @@ -577,7 +582,7 @@ class Metaestat{ | @@ -577,7 +582,7 @@ class Metaestat{ | ||
| 577 | fwrite($fp,$dado."\n"); | 582 | fwrite($fp,$dado."\n"); |
| 578 | } | 583 | } |
| 579 | } | 584 | } |
| 580 | - return array("mapfile"=>$arq,"layer"=>$this->nomecache,"titulolayer"=>$titulolayer); | 585 | + return array("mapfile"=>$arq,"layer"=>$this->nomecache,"titulolayer"=>$titulolayer,"codigo_tipo_regiao"=>$codigo_tipo_regiao); |
| 581 | } | 586 | } |
| 582 | function mapfileCompleto($mapfile){ | 587 | function mapfileCompleto($mapfile){ |
| 583 | $f = $this->base; | 588 | $f = $this->base; |
ferramentas/metaestat/analise.php
| @@ -101,6 +101,18 @@ switch (strtoupper($funcao)){ | @@ -101,6 +101,18 @@ switch (strtoupper($funcao)){ | ||
| 101 | break; | 101 | break; |
| 102 | case "CALOR": | 102 | case "CALOR": |
| 103 | $retorno = mapaDeCalor($map_file,$tema); | 103 | $retorno = mapaDeCalor($map_file,$tema); |
| 104 | + break; | ||
| 105 | + case "ADICIONALIMITEREGIAO": | ||
| 106 | + if(empty($outlinecolor)){ | ||
| 107 | + $outlinecolor = "255,0,0"; | ||
| 108 | + } | ||
| 109 | + if(empty($width)){ | ||
| 110 | + $width = 1; | ||
| 111 | + } | ||
| 112 | + if(empty($nomes)){ | ||
| 113 | + $nomes = "nao"; | ||
| 114 | + } | ||
| 115 | + $retorno = adicionaLimiteRegiao($map_file,$codigo_tipo_regiao,$outlinecolor,$width,$nomes); | ||
| 104 | break; | 116 | break; |
| 105 | } | 117 | } |
| 106 | if (!connection_aborted()){ | 118 | if (!connection_aborted()){ |
| @@ -108,6 +120,31 @@ if (!connection_aborted()){ | @@ -108,6 +120,31 @@ if (!connection_aborted()){ | ||
| 108 | } | 120 | } |
| 109 | else | 121 | else |
| 110 | {exit();} | 122 | {exit();} |
| 123 | +function adicionaLimiteRegiao($map_file,$codigo_tipo_regiao,$outlinecolor,$width,$nomes){ | ||
| 124 | + global $locaplic,$dir_tmp; | ||
| 125 | + $m = new Metaestat(); | ||
| 126 | + $res = $m->mapfileTipoRegiao($codigo_tipo_regiao,$outlinecolor,$width,$nomes,true); | ||
| 127 | + $mapaNovo = ms_newMapObj($res["mapfile"]); | ||
| 128 | + $layerNovo = $mapaNovo->getlayerbyname($res["layer"]); | ||
| 129 | + $layerNovo->set("status",MS_DEFAULT); | ||
| 130 | + $dataNovo = $layerNovo->data; | ||
| 131 | + $mapa = ms_newMapObj($map_file); | ||
| 132 | + $c = $mapa->numlayers; | ||
| 133 | + for($i=0;$i < $c;++$i){ | ||
| 134 | + $l = $mapa->getlayer($i); | ||
| 135 | + if($l->data == $dataNovo){ | ||
| 136 | + $l->set("status",MS_DELETE); | ||
| 137 | + } | ||
| 138 | + } | ||
| 139 | + ms_newLayerObj($mapa, $layerNovo); | ||
| 140 | + if($nomes == "sim"){ | ||
| 141 | + $layerNovo = $mapaNovo->getlayerbyname($res["layer"]."_anno"); | ||
| 142 | + $layerNovo->set("status",MS_DEFAULT); | ||
| 143 | + ms_newLayerObj($mapa, $layerNovo); | ||
| 144 | + } | ||
| 145 | + $mapa->save($map_file); | ||
| 146 | + return "ok"; | ||
| 147 | +} | ||
| 111 | function mapaDeCalor($map_file,$tema){ | 148 | function mapaDeCalor($map_file,$tema){ |
| 112 | global $locaplic,$dir_tmp,$R_path,$ext; | 149 | global $locaplic,$dir_tmp,$R_path,$ext; |
| 113 | $nome = basename($map_file).$tema."calor"; | 150 | $nome = basename($map_file).$tema."calor"; |
ferramentas/metaestat/mostraregiao.js
| @@ -63,10 +63,12 @@ i3GEOF.mostraregiao = { | @@ -63,10 +63,12 @@ i3GEOF.mostraregiao = { | ||
| 63 | inicia: function(divid){ | 63 | inicia: function(divid){ |
| 64 | $i(divid).innerHTML = i3GEOF.mostraregiao.html(); | 64 | $i(divid).innerHTML = i3GEOF.mostraregiao.html(); |
| 65 | i3GEOF.mostraregiao.comboRegioes($i("i3geomostraregiaoTipoRegiao")); | 65 | i3GEOF.mostraregiao.comboRegioes($i("i3geomostraregiaoTipoRegiao")); |
| 66 | + YAHOO.i3GEO.janela.manager.find("i3GEOF.mostraregiao").setFooter('<input id=i3geomostraregiaoAplica type="button" value="'+$trad("p14")+'" />'); | ||
| 66 | new YAHOO.widget.Button( | 67 | new YAHOO.widget.Button( |
| 67 | "i3geomostraregiaoAplica", | 68 | "i3geomostraregiaoAplica", |
| 68 | {onclick:{fn: function(){i3GEOF.mostraregiao.aplica();}}} | 69 | {onclick:{fn: function(){i3GEOF.mostraregiao.aplica();}}} |
| 69 | ); | 70 | ); |
| 71 | + $i("i3geomostraregiaoAplica-button").style.width = "180px"; | ||
| 70 | }, | 72 | }, |
| 71 | //utiliza o dicionario compartilhado | 73 | //utiliza o dicionario compartilhado |
| 72 | iniciaDicionario: function(){ | 74 | iniciaDicionario: function(){ |
| @@ -113,15 +115,14 @@ i3GEOF.mostraregiao = { | @@ -113,15 +115,14 @@ i3GEOF.mostraregiao = { | ||
| 113 | }, | 115 | }, |
| 114 | html: function(){ | 116 | html: function(){ |
| 115 | var ins = "" + | 117 | var ins = "" + |
| 116 | - '<input id=i3geomostraregiaoAplica type="button" value="'+$trad("p14")+'" /> ' + | ||
| 117 | - '<br><br><div class="paragrafo" id="i3geomostraregiaoTipoRegiao" >' + | 118 | + '<div class="paragrafo" id="i3geomostraregiaoTipoRegiao" >' + |
| 118 | '</div>' + | 119 | '</div>' + |
| 119 | '<p class=paragrafo ><input type=checkbox id="i3geomostraregiaoNomes" style="cursor:pointer;position:relative;top:2px;" /> Inclui nomes</p>' + | 120 | '<p class=paragrafo ><input type=checkbox id="i3geomostraregiaoNomes" style="cursor:pointer;position:relative;top:2px;" /> Inclui nomes</p>' + |
| 120 | '<p class=paragrafo >Contorno:</p>' + | 121 | '<p class=paragrafo >Contorno:</p>' + |
| 121 | 'Cor: ' + $inputText("","","i3geomostraregiaoOutlinecolor","",12,"255,0,0") + | 122 | 'Cor: ' + $inputText("","","i3geomostraregiaoOutlinecolor","",12,"255,0,0") + |
| 122 | ' <img alt="aquarela.gif" style=position:relative;top:2px;cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEOF.mostraregiao.corj(\'i3geomostraregiaoOutlinecolor\')" /> ' + | 123 | ' <img alt="aquarela.gif" style=position:relative;top:2px;cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEOF.mostraregiao.corj(\'i3geomostraregiaoOutlinecolor\')" /> ' + |
| 123 | '<br><br>Largura: ' + $inputText("","","i3geomostraregiaoWidth","",3,"1") + | 124 | '<br><br>Largura: ' + $inputText("","","i3geomostraregiaoWidth","",3,"1") + |
| 124 | - '<br>' ; | 125 | + '<br><br>' ; |
| 125 | return ins; | 126 | return ins; |
| 126 | }, | 127 | }, |
| 127 | comboRegioes: function(objonde){ | 128 | comboRegioes: function(objonde){ |
| @@ -154,13 +155,8 @@ i3GEOF.mostraregiao = { | @@ -154,13 +155,8 @@ i3GEOF.mostraregiao = { | ||
| 154 | i3GEO.janela.abreAguarde("aguardeMostraRegiao","Aguarde..."); | 155 | i3GEO.janela.abreAguarde("aguardeMostraRegiao","Aguarde..."); |
| 155 | var temp = function(retorno){ | 156 | var temp = function(retorno){ |
| 156 | i3GEO.janela.fechaAguarde("aguardeMostraRegiao"); | 157 | i3GEO.janela.fechaAguarde("aguardeMostraRegiao"); |
| 157 | - if(retorno.layer == ""){ | ||
| 158 | - i3GEO.atualiza(); | ||
| 159 | - return; | ||
| 160 | - } | ||
| 161 | - if(i3GEO.arvoreDeCamadas.pegaTema(retorno.layer) == ""){ | ||
| 162 | - i3GEO.php.adtema(i3GEO.atualiza,retorno.mapfile); | ||
| 163 | - } | 158 | + i3GEO.atualiza(); |
| 159 | + | ||
| 164 | }; | 160 | }; |
| 165 | if(nomes.checked == true){ | 161 | if(nomes.checked == true){ |
| 166 | nomes = "sim"; | 162 | nomes = "sim"; |
| @@ -168,7 +164,17 @@ i3GEOF.mostraregiao = { | @@ -168,7 +164,17 @@ i3GEOF.mostraregiao = { | ||
| 168 | else{ | 164 | else{ |
| 169 | nomes = "nao"; | 165 | nomes = "nao"; |
| 170 | } | 166 | } |
| 171 | - i3GEO.php.mapfileTipoRegiao(temp,combo.value,$i("i3geomostraregiaoOutlinecolor").value,$i("i3geomostraregiaoWidth").value,nomes); | 167 | + i3GEO.janela.AGUARDEMODAL = true; |
| 168 | + i3GEO.janela.abreAguarde("aguardeMostraRegiao","Aplicando..."); | ||
| 169 | + i3GEO.janela.AGUARDEMODAL = false; | ||
| 170 | + p = i3GEO.configura.locaplic+"/ferramentas/metaestat/analise.php?funcao=adicionaLimiteRegiao"+ | ||
| 171 | + "&codigo_tipo_regiao="+combo.value+ | ||
| 172 | + "&g_sid="+i3GEO.configura.sid+ | ||
| 173 | + "&outlinecolor="+$i("i3geomostraregiaoOutlinecolor").value+ | ||
| 174 | + "&width="+$i("i3geomostraregiaoWidth").value+ | ||
| 175 | + "&nomes="+nomes; | ||
| 176 | + i3GEO.util.ajaxGet(p,temp); | ||
| 177 | + //i3GEO.php.mapfileTipoRegiao(temp,combo.value,$i("i3geomostraregiaoOutlinecolor").value,$i("i3geomostraregiaoWidth").value,nomes); | ||
| 172 | }, | 178 | }, |
| 173 | corj: function(obj){ | 179 | corj: function(obj){ |
| 174 | i3GEO.util.abreCor("",obj); | 180 | i3GEO.util.abreCor("",obj); |