Commit c53f9f280e2d2724441a794428979967f6c20475

Authored by Edmar Moretti
1 parent 45b6b41c

$1

admin/admin.db
No preview for this file type
classesphp/classe_analise.php
@@ -100,24 +100,24 @@ $ext - Extensão geográfica do mapa @@ -100,24 +100,24 @@ $ext - Extensão geográfica do mapa
100 */ 100 */
101 function __construct($map_file,$tema="",$locaplic="",$ext="") 101 function __construct($map_file,$tema="",$locaplic="",$ext="")
102 { 102 {
103 - //error_reporting(0); 103 + //error_reporting(0);
104 $this->qyfile = str_replace(".map",".qy",$map_file); 104 $this->qyfile = str_replace(".map",".qy",$map_file);
105 - include_once(dirname(__FILE__)."/funcoes_gerais.php"); 105 + include_once(dirname(__FILE__)."/funcoes_gerais.php");
106 if(empty($locaplic)){ 106 if(empty($locaplic)){
107 $locaplic = dirname(__FILE__)."/.."; 107 $locaplic = dirname(__FILE__)."/..";
108 } 108 }
109 - $this->v = versao(); 109 + $this->v = versao();
110 $this->v = $this->v["principal"]; 110 $this->v = $this->v["principal"];
111 $this->dbaseExiste = false; 111 $this->dbaseExiste = false;
112 if(function_exists("dbase_create")) 112 if(function_exists("dbase_create"))
113 {$this->dbaseExiste = true;} 113 {$this->dbaseExiste = true;}
114 - $this->locaplic = $locaplic;  
115 - $this->mapa = ms_newMapObj($map_file);  
116 - $this->arquivo = $map_file;  
117 - if($tema != "" && @$this->mapa->getlayerbyname($tema))  
118 - {$this->layer = $this->mapa->getlayerbyname($tema);}  
119 - $this->nome = $tema;  
120 - $this->diretorio = dirname($this->arquivo); 114 + $this->locaplic = $locaplic;
  115 + $this->mapa = ms_newMapObj($map_file);
  116 + $this->arquivo = $map_file;
  117 + if($tema != "" && @$this->mapa->getlayerbyname($tema))
  118 + {$this->layer = $this->mapa->getlayerbyname($tema);}
  119 + $this->nome = $tema;
  120 + $this->diretorio = dirname($this->arquivo);
121 if($ext && $ext != ""){ 121 if($ext && $ext != ""){
122 $e = explode(" ",$ext); 122 $e = explode(" ",$ext);
123 $extatual = $this->mapa->extent; 123 $extatual = $this->mapa->extent;
@@ -169,10 +169,10 @@ Method: salva @@ -169,10 +169,10 @@ Method: salva
169 169
170 Salva o mapfile atual 170 Salva o mapfile atual
171 */ 171 */
172 - function salva()  
173 - {  
174 - if (connection_aborted()){exit();}  
175 - $this->mapa->save($this->arquivo); 172 + function salva()
  173 + {
  174 + if (connection_aborted()){exit();}
  175 + $this->mapa->save($this->arquivo);
176 } 176 }
177 177
178 /* 178 /*
@@ -733,7 +733,7 @@ $locaplic - diretório da aplicação i3geo @@ -733,7 +733,7 @@ $locaplic - diretório da aplicação i3geo
733 { 733 {
734 if (file_exists($nomearq)) 734 if (file_exists($nomearq))
735 { 735 {
736 - if($this->dbaseExiste == false){ 736 + if($this->dbaseExiste == false){
737 if(file_exists($this->locaplic."/pacotes/phpxbase/api_conversion.php")) 737 if(file_exists($this->locaplic."/pacotes/phpxbase/api_conversion.php"))
738 include_once($this->locaplic."/pacotes/phpxbase/api_conversion.php"); 738 include_once($this->locaplic."/pacotes/phpxbase/api_conversion.php");
739 else 739 else
@@ -827,7 +827,7 @@ $locaplic - diretório da aplicação i3geo @@ -827,7 +827,7 @@ $locaplic - diretório da aplicação i3geo
827 { 827 {
828 if (file_exists($nomearq)) 828 if (file_exists($nomearq))
829 { 829 {
830 - if($this->dbaseExiste == false){ 830 + if($this->dbaseExiste == false){
831 if(file_exists($this->locaplic."/pacotes/phpxbase/api_conversion.php")) 831 if(file_exists($this->locaplic."/pacotes/phpxbase/api_conversion.php"))
832 include_once($this->locaplic."/pacotes/phpxbase/api_conversion.php"); 832 include_once($this->locaplic."/pacotes/phpxbase/api_conversion.php");
833 else 833 else
@@ -1303,11 +1303,15 @@ $unir - sim|nao indica se os elementos selecionados deverão ser unidos em @@ -1303,11 +1303,15 @@ $unir - sim|nao indica se os elementos selecionados deverão ser unidos em
1303 $wkt - (opcional) elemento no formato wkt para o qual o buffer será gerado. Só de ve ser definido se $this->nome for vazio, ou seja 1303 $wkt - (opcional) elemento no formato wkt para o qual o buffer será gerado. Só de ve ser definido se $this->nome for vazio, ou seja
1304 se o parâmetro "tema" não tiver sido fornecido ao construtor da classe 1304 se o parâmetro "tema" não tiver sido fornecido ao construtor da classe
1305 1305
  1306 +$multiplicar - (opcional) multiplicar os valores por
  1307 +
  1308 +$itemdistancia - (opcional) coluna com os valores
  1309 +
1306 return: 1310 return:
1307 1311
1308 nome do layer criado com o buffer. 1312 nome do layer criado com o buffer.
1309 */ 1313 */
1310 - function criaBuffer($distancia,$locaplic,$unir="nao",$wkt="") 1314 + function criaBuffer($distancia,$locaplic,$unir="nao",$wkt="",$multiplicar=1,$itemdistancia="")
1311 { 1315 {
1312 set_time_limit(180); 1316 set_time_limit(180);
1313 error_reporting(0); 1317 error_reporting(0);
@@ -1345,18 +1349,22 @@ nome do layer criado com o buffer. @@ -1345,18 +1349,22 @@ nome do layer criado com o buffer.
1345 $dd1->setXY($rect->minx, $rect->miny); 1349 $dd1->setXY($rect->minx, $rect->miny);
1346 $poPoint->project($projInObj, $projOutObj); 1350 $poPoint->project($projInObj, $projOutObj);
1347 $dd2 = ms_newpointobj(); 1351 $dd2 = ms_newpointobj();
1348 - $dd2->setXY(($poPoint->x + $distancia), $poPoint->y);  
1349 - $dd2->project($projOutObj,$projInObj);  
1350 - $d = $dd1->distanceToPoint($dd2);  
1351 - if ($distancia < 0){$d = $d * -1;}  
1352 - //calcula a distancia 29100  
1353 - //gera o buffer  
1354 - $buffers[] = $shape->buffer($d);  
1355 - $shapes[] = $shape; 1352 + if($itemdistancia != ""){
  1353 + $distancia = $shape->values[$itemdistancia];
  1354 + }
  1355 + if(is_numeric($distancia)){
  1356 + $dd2->setXY(($poPoint->x) + ($distancia * $multiplicar), $poPoint->y);
  1357 + $dd2->project($projOutObj,$projInObj);
  1358 + $d = $dd1->distanceToPoint($dd2);
  1359 + if ($distancia < 0){$d = $d * -1;}
  1360 + //calcula a distancia 29100
  1361 + //gera o buffer
  1362 + $buffers[] = $shape->buffer($d);
  1363 + $shapes[] = $shape;
  1364 + }
1356 } 1365 }
1357 //faz a uni&atilde;o dos elementos se necess&aacute;rio 1366 //faz a uni&atilde;o dos elementos se necess&aacute;rio
1358 - if($unir == "sim")  
1359 - { 1367 + if($unir == "sim"){
1360 $ns = $buffers[0]; 1368 $ns = $buffers[0];
1361 for($s=1;$s < count($buffers);$s++) 1369 for($s=1;$s < count($buffers);$s++)
1362 {$ns = $ns->union($buffers[$s]);} 1370 {$ns = $ns->union($buffers[$s]);}
@@ -2419,7 +2427,7 @@ $operacao - Tipo de an&amp;aacute;lise. @@ -2419,7 +2427,7 @@ $operacao - Tipo de an&amp;aacute;lise.
2419 $statusoriginal = $sb->status; 2427 $statusoriginal = $sb->status;
2420 $sb->set("status",MS_OFF); 2428 $sb->set("status",MS_OFF);
2421 $ext->setextent(($bounds->minx),($bounds->miny),($bounds->maxx),($bounds->maxy)); 2429 $ext->setextent(($bounds->minx),($bounds->miny),($bounds->maxx),($bounds->maxy));
2422 - $imagem = gravaImagemMapa($this->mapa); 2430 + $imagem = gravaImagemMapa($this->mapa);
2423 $this->mapa->setsize($w,$h); 2431 $this->mapa->setsize($w,$h);
2424 $ext->setextent($minx,$miny,$maxx,$maxy); 2432 $ext->setextent($minx,$miny,$maxx,$maxy);
2425 $nlayer->set("status",MS_DELETE); 2433 $nlayer->set("status",MS_DELETE);
@@ -2461,7 +2469,7 @@ $operacao - Tipo de an&amp;aacute;lise. @@ -2461,7 +2469,7 @@ $operacao - Tipo de an&amp;aacute;lise.
2461 //verifica a vers&atilde;o do mapserver 2469 //verifica a vers&atilde;o do mapserver
2462 //se for anterior a 5, utiliza a conex&atilde;o com o postgis para fazer o processamento dos daods 2470 //se for anterior a 5, utiliza a conex&atilde;o com o postgis para fazer o processamento dos daods
2463 // 2471 //
2464 - $v = versao(); 2472 + $v = versao();
2465 if (($v["principal"] < 5)) 2473 if (($v["principal"] < 5))
2466 {return ("erro. E necessario uma vers&atilde;o maior que 5.0 do Mapserver.");} 2474 {return ("erro. E necessario uma vers&atilde;o maior que 5.0 do Mapserver.");}
2467 foreach ($geos["dados"] as &$geo) 2475 foreach ($geos["dados"] as &$geo)
ferramentas/buffer/dicionario.js
@@ -19,7 +19,7 @@ es:&quot;&quot;, @@ -19,7 +19,7 @@ es:&quot;&quot;,
19 it:"" 19 it:""
20 }], 20 }],
21 4: [{ 21 4: [{
22 -pt:"Dist&acirc;ncia do entorno em metros", 22 +pt:"Dist&acirc;ncia do entorno em metros:",
23 en:"", 23 en:"",
24 es:"", 24 es:"",
25 it:"" 25 it:""
@@ -55,7 +55,13 @@ es:&quot;&quot;, @@ -55,7 +55,13 @@ es:&quot;&quot;,
55 it:"" 55 it:""
56 }], 56 }],
57 10: [{ 57 10: [{
58 -pt:"", 58 +pt:"Ou um item da tabela de atributos que cont&eacute;m as dist&acirc;ncias:",
  59 +en:"",
  60 +es:"",
  61 +it:""
  62 +}],
  63 +11: [{
  64 +pt:"Multiplicar por:",
59 en:"", 65 en:"",
60 es:"", 66 es:"",
61 it:"" 67 it:""
ferramentas/buffer/exec.php
@@ -19,7 +19,7 @@ Salva o mapa acrescentando um novo layer com o buffer. @@ -19,7 +19,7 @@ Salva o mapa acrescentando um novo layer com o buffer.
19 include_once(dirname(__FILE__)."/../../classesphp/classe_analise.php"); 19 include_once(dirname(__FILE__)."/../../classesphp/classe_analise.php");
20 copiaSeguranca($map_file); 20 copiaSeguranca($map_file);
21 $m = new Analise($map_file,$tema,$locaplic,$ext); 21 $m = new Analise($map_file,$tema,$locaplic,$ext);
22 - $retorno = $m->criaBuffer($distancia,$locaplic,$unir,$wkt); 22 + $retorno = $m->criaBuffer($distancia,$locaplic,$unir,$wkt,$multiplicar,$itemdistancia);
23 $m->salva(); 23 $m->salva();
24 $_SESSION["contadorsalva"]++; 24 $_SESSION["contadorsalva"]++;
25 //limpa selecao 25 //limpa selecao
ferramentas/buffer/index.js
@@ -160,10 +160,15 @@ i3GEOF.buffer = { @@ -160,10 +160,15 @@ i3GEOF.buffer = {
160 }, 160 },
161 t2: function(){ 161 t2: function(){
162 var ins = "<p class='paragrafo'>"+$trad(4,i3GEOF.buffer.dicionario); 162 var ins = "<p class='paragrafo'>"+$trad(4,i3GEOF.buffer.dicionario);
163 - ins += "<br><br><input onclick='javascript:this.select();' class=digitar id='i3GEObufferd' type=text size=10 value='0'/><br>";  
164 - ins += "<p class='paragrafo'>"+$trad(5,i3GEOF.buffer.dicionario);  
165 - ins += "<br><br><select id=i3GEObufferunir ><option value=nao selected >"+$trad("x15")+"</option><option value=sim >"+$trad("x14")+"</option></select>"; 163 + ins += "<br></p><input onclick='javascript:this.select();' class=digitar id='i3GEObufferd' type=text size=10 value='0'/>";
  164 +
  165 + ins += "<br><br><p class='paragrafo' >"+$trad(10,i3GEOF.buffer.dicionario);
  166 + ins += "<br></p><div id=i3GEObufferondeItens style='text-align:left;display:block' ></div> ";
  167 +
  168 + ins += "<br><p class='paragrafo'>"+$trad(5,i3GEOF.buffer.dicionario);
  169 + ins += "<br></p><select id=i3GEObufferunir ><option value=nao selected >"+$trad("x15")+"</option><option value=sim >"+$trad("x14")+"</option></select>";
166 i3GEO.util.proximoAnterior("i3GEOF.buffer.t1()","i3GEOF.buffer.t3()",ins,"i3GEOF.buffer.t2","i3GEObufferresultado"); 170 i3GEO.util.proximoAnterior("i3GEOF.buffer.t1()","i3GEOF.buffer.t3()",ins,"i3GEOF.buffer.t2","i3GEObufferresultado");
  171 + i3GEOF.buffer.comboItens();
167 }, 172 },
168 t3: function(){ 173 t3: function(){
169 var ins = "<p class='paragrafo'>"+$trad(6,i3GEOF.buffer.dicionario); 174 var ins = "<p class='paragrafo'>"+$trad(6,i3GEOF.buffer.dicionario);
@@ -189,11 +194,12 @@ i3GEOF.buffer = { @@ -189,11 +194,12 @@ i3GEOF.buffer = {
189 {return;} 194 {return;}
190 var distancia = $i("i3GEObufferd").value, 195 var distancia = $i("i3GEObufferd").value,
191 tema = $i("i3GEObuffertemasComSel").value, 196 tema = $i("i3GEObuffertemasComSel").value,
  197 + multiplicar = $i("i3GEObufferdfator").value*1,
  198 + itemdistancia = $i("i3GEObuffertemasItem").value,
192 p, 199 p,
193 fim, 200 fim,
194 cp; 201 cp;
195 - if (distancia*1 !== 0)  
196 - { 202 + if (distancia*1 !== 0 || itemdistancia != ""){
197 i3GEOF.buffer.aguarde.visibility = "visible"; 203 i3GEOF.buffer.aguarde.visibility = "visible";
198 fim = function(retorno){ 204 fim = function(retorno){
199 i3GEOF.buffer.aguarde.visibility = "hidden"; 205 i3GEOF.buffer.aguarde.visibility = "hidden";
@@ -202,7 +208,12 @@ i3GEOF.buffer = { @@ -202,7 +208,12 @@ i3GEOF.buffer = {
202 else 208 else
203 {i3GEO.atualiza();} 209 {i3GEO.atualiza();}
204 }; 210 };
205 - p = i3GEO.configura.locaplic+"/ferramentas/buffer/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=criabuffer&tema="+tema+"&distancia="+distancia+"&unir="+$i("i3GEObufferunir").value; 211 + p = i3GEO.configura.locaplic+"/ferramentas/buffer/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=criabuffer&tema="+tema+"&unir="+$i("i3GEObufferunir").value;
  212 + if(itemdistancia != ""){
  213 + p += "&distancia=0&itemdistancia="+itemdistancia+"&multiplicar="+multiplicar;
  214 + }else{
  215 + p += "&distancia=" + distancia*1 + "&itemdistancia=&multiplicar=1";
  216 + }
206 cp = new cpaint(); 217 cp = new cpaint();
207 cp.set_response_type("JSON"); 218 cp.set_response_type("JSON");
208 cp.call(p,"criaBuffer",fim); 219 cp.call(p,"criaBuffer",fim);
@@ -225,12 +236,12 @@ i3GEOF.buffer = { @@ -225,12 +236,12 @@ i3GEOF.buffer = {
225 i3GEO.util.comboTemas( 236 i3GEO.util.comboTemas(
226 "i3GEObuffertemasComSel", 237 "i3GEObuffertemasComSel",
227 function(retorno){ 238 function(retorno){
228 - $i("i3GEObufferSelTemas").innerHTML = retorno.dados;  
229 - $i("i3GEObufferSelTemas").style.display = "block";  
230 - if ($i("i3GEObuffertemasComSel")){  
231 - $i("i3GEObuffertemasComSel").onchange = function(){  
232 - i3GEO.mapa.ativaTema($i("i3GEObuffertemasComSel").value);  
233 - }; 239 + $i("i3GEObufferSelTemas").innerHTML = retorno.dados;
  240 + $i("i3GEObufferSelTemas").style.display = "block";
  241 + if ($i("i3GEObuffertemasComSel")){
  242 + $i("i3GEObuffertemasComSel").onchange = function(){
  243 + i3GEO.mapa.ativaTema($i("i3GEObuffertemasComSel").value);
  244 + };
234 } 245 }
235 if(i3GEO.temaAtivo !== ""){ 246 if(i3GEO.temaAtivo !== ""){
236 $i("i3GEObuffertemasComSel").value = i3GEO.temaAtivo; 247 $i("i3GEObuffertemasComSel").value = i3GEO.temaAtivo;
@@ -242,5 +253,26 @@ i3GEOF.buffer = { @@ -242,5 +253,26 @@ i3GEOF.buffer = {
242 false, 253 false,
243 "selecionados" 254 "selecionados"
244 ); 255 );
  256 + },
  257 + /*
  258 + Function: comboItens
  259 +
  260 + Cria um combo para escolha de um item do tema
  261 +
  262 + Veja:
  263 +
  264 + <i3GEO.util.comboItens>
  265 +
  266 + */
  267 + comboItens: function(){
  268 + i3GEO.util.comboItens(
  269 + "i3GEObuffertemasItem",
  270 + $i("i3GEObuffertemasComSel").value,
  271 + function(retorno){
  272 + $i("i3GEObufferondeItens").innerHTML = retorno.dados + " " + $trad(11,i3GEOF.buffer.dicionario)+" <input onclick='javascript:this.select();' class=digitar id='i3GEObufferdfator' type=text size=10 value='1'/>";
  273 + $i("i3GEObufferondeItens").style.display = "block";
  274 + },
  275 + "i3GEObufferondeItens"
  276 + );
245 } 277 }
246 }; 278 };
247 \ No newline at end of file 279 \ No newline at end of file