Commit ee698423e9f8401bdc1521be6dfbde718f140c38

Authored by Edmar Moretti
1 parent 3b563916

Correção na conversão de pontos em linhas e polígonos. Em função de um bug do Ma…

…pserver, foi necessário converter os pontos para WKT antes da conversão para linhas ou polígonos.
classesphp/classe_shp.php
@@ -424,6 +424,7 @@ $para - linha|poligono @@ -424,6 +424,7 @@ $para - linha|poligono
424 $this->layer->whichShapes($ret); 424 $this->layer->whichShapes($ret);
425 $linha = ms_newLineObj(); 425 $linha = ms_newLineObj();
426 $pponto = ""; 426 $pponto = "";
  427 + $pontos = array();
427 while ($shape = $this->layer->nextShape()) 428 while ($shape = $this->layer->nextShape())
428 { 429 {
429 $lin = $shape->line(0); 430 $lin = $shape->line(0);
@@ -432,19 +433,15 @@ $para - linha|poligono @@ -432,19 +433,15 @@ $para - linha|poligono
432 {$pponto = $pt;} 433 {$pponto = $pt;}
433 if (($prjTema != "") && ($prjMapa != $prjTema)) 434 if (($prjTema != "") && ($prjMapa != $prjTema))
434 {$pt->project($projInObj, $projOutObj);} 435 {$pt->project($projInObj, $projOutObj);}
435 - $linha->add($pt); 436 + $pontos[] = $pt->x;
  437 + $pontos[] = $pt->y;
436 } 438 }
  439 + $pontos = implode(" ",$pontos);
  440 + $pontos = xy2wkt($pontos);
437 if ($para == "poligono") 441 if ($para == "poligono")
438 - {  
439 - $linha->add($pponto);  
440 - }  
441 - $shape = ms_newShapeObj($tipos);  
442 - $shape->add($linha);  
443 -  
444 - //for ($i=0;$i < $linha->numpoints;$i++)  
445 - //{var_dump($linha->point($i));}  
446 -  
447 - 442 + {$shape = ms_shapeObjFromWkt($pontos["poligono"]);}
  443 + else
  444 + {$shape = ms_shapeObjFromWkt($pontos["linha"]);}
448 foreach ($items as $ni) 445 foreach ($items as $ni)
449 {$reg[] = "-";} 446 {$reg[] = "-";}
450 $novoshpf->addShape($shape); 447 $novoshpf->addShape($shape);
classesphp/mapa_controle.php
@@ -2765,7 +2765,7 @@ function redesenhaMapa() @@ -2765,7 +2765,7 @@ function redesenhaMapa()
2765 } 2765 }
2766 $mensagens = "var mensagens ='".$m->pegaMensagens()."'"; 2766 $mensagens = "var mensagens ='".$m->pegaMensagens()."'";
2767 restauraCon($map_file,$postgis_mapa); 2767 restauraCon($map_file,$postgis_mapa);
2768 - 2768 + ob_clean();
2769 if (($par == "") || ($imagem == "")) 2769 if (($par == "") || ($imagem == ""))
2770 {$cp->set_data("erro");} 2770 {$cp->set_data("erro");}
2771 else 2771 else