Commit b4fc61563be3a80bde5250572aa987a0d5638b68
1 parent
dd071ace
Exists in
master
and in
7 other branches
Inclus~]ao de opção para união dos polígonos resultantes da operação de buffer
Showing
4 changed files
with
20 additions
and
8 deletions
Show diff stats
classesphp/classe_analise.php
| @@ -671,8 +671,7 @@ $locaplic - diretório da aplicação i3geo | @@ -671,8 +671,7 @@ $locaplic - diretório da aplicação i3geo | ||
| 671 | $linha->add($poPoint1); | 671 | $linha->add($poPoint1); |
| 672 | $linha->add($poPoint2); | 672 | $linha->add($poPoint2); |
| 673 | $ShapeObj = ms_newShapeObj(MS_SHAPE_LINE); | 673 | $ShapeObj = ms_newShapeObj(MS_SHAPE_LINE); |
| 674 | - $ShapeObj->add($linha); | ||
| 675 | - | 674 | + $ShapeObj->add($linha); |
| 676 | $novoshpf->addShape($ShapeObj); | 675 | $novoshpf->addShape($ShapeObj); |
| 677 | $registro = array($i1,$i2,$i3,$i4,$i5,$i6); | 676 | $registro = array($i1,$i2,$i3,$i4,$i5,$i6); |
| 678 | xbase_add_record($db,$registro); | 677 | xbase_add_record($db,$registro); |
| @@ -1138,11 +1137,13 @@ $distancia - Distância em km. | @@ -1138,11 +1137,13 @@ $distancia - Distância em km. | ||
| 1138 | 1137 | ||
| 1139 | $locaplic - Localização do I3geo. | 1138 | $locaplic - Localização do I3geo. |
| 1140 | 1139 | ||
| 1140 | +$unir - sim|nao indica se os elementos selecionados deverão ser unidos em um só antes do buffer ser criado | ||
| 1141 | + | ||
| 1141 | return: | 1142 | return: |
| 1142 | 1143 | ||
| 1143 | nome do layer criado com o buffer. | 1144 | nome do layer criado com o buffer. |
| 1144 | */ | 1145 | */ |
| 1145 | - function criaBuffer($distancia,$locaplic) | 1146 | + function criaBuffer($distancia,$locaplic,$unir="nao") |
| 1146 | { | 1147 | { |
| 1147 | //para manipular dbf | 1148 | //para manipular dbf |
| 1148 | if(file_exists($this->locaplic."/pacotes/phpxbase/api_conversion.php")) | 1149 | if(file_exists($this->locaplic."/pacotes/phpxbase/api_conversion.php")) |
| @@ -1186,6 +1187,15 @@ nome do layer criado com o buffer. | @@ -1186,6 +1187,15 @@ nome do layer criado com o buffer. | ||
| 1186 | $shapes[] = $shape; | 1187 | $shapes[] = $shape; |
| 1187 | } | 1188 | } |
| 1188 | } | 1189 | } |
| 1190 | + //faz a união dos elementos se necessário | ||
| 1191 | + if($unir == "sim") | ||
| 1192 | + { | ||
| 1193 | + $ns = $buffers[0]; | ||
| 1194 | + for($s=1;$s < count($buffers);$s++) | ||
| 1195 | + {$ns = $ns->union_geos($buffers[$s]);} | ||
| 1196 | + $buffers = array($ns); | ||
| 1197 | + $shapes = array($shapes[0]); | ||
| 1198 | + } | ||
| 1189 | $fechou = $this->layer->close(); | 1199 | $fechou = $this->layer->close(); |
| 1190 | //gera o novo arquivo shape file | 1200 | //gera o novo arquivo shape file |
| 1191 | // cria o shapefile | 1201 | // cria o shapefile |
classesphp/classe_temas.php
| @@ -191,9 +191,9 @@ A mudança é feita apenas na representação do layer. | @@ -191,9 +191,9 @@ A mudança é feita apenas na representação do layer. | ||
| 191 | foreach ($this->grupo as $l) | 191 | foreach ($this->grupo as $l) |
| 192 | { | 192 | { |
| 193 | $l = $this->mapa->getlayerbyname($l); | 193 | $l = $this->mapa->getlayerbyname($l); |
| 194 | - if ($l->type == 1) //se for do tipo linear | 194 | + if (($l->type == 1) || ($l->type == MS_LAYER_LINE)) //se for do tipo linear |
| 195 | {$l->set("type",MS_LAYER_POLYGON);} | 195 | {$l->set("type",MS_LAYER_POLYGON);} |
| 196 | - elseif ($l->type == 2) //se for do tipo poligonal | 196 | + elseif (($l->type == 2) || ($l->type == MS_LAYER_POLYGON)) //se for do tipo poligonal |
| 197 | {$l->set("type",MS_LAYER_LINE);} | 197 | {$l->set("type",MS_LAYER_LINE);} |
| 198 | if (($l->type < 1) || ($l->type > 2)) | 198 | if (($l->type < 1) || ($l->type > 2)) |
| 199 | {$retorno = "erro. O tipo desse tema nao pode ser alterado";} | 199 | {$retorno = "erro. O tipo desse tema nao pode ser alterado";} |
classesphp/mapa_controle.php
| @@ -1249,7 +1249,7 @@ Include: | @@ -1249,7 +1249,7 @@ Include: | ||
| 1249 | include("classe_analise.php"); | 1249 | include("classe_analise.php"); |
| 1250 | copiaSeguranca($map_file); | 1250 | copiaSeguranca($map_file); |
| 1251 | $m = new Analise($map_file,$tema); | 1251 | $m = new Analise($map_file,$tema); |
| 1252 | - $cp->set_data($m->criaBuffer($distancia,$locaplic)); | 1252 | + $cp->set_data($m->criaBuffer($distancia,$locaplic,$unir)); |
| 1253 | $m->salva(); | 1253 | $m->salva(); |
| 1254 | //limpa selecao | 1254 | //limpa selecao |
| 1255 | if (file_exists($map_file."qy")) | 1255 | if (file_exists($map_file."qy")) |
ferramentas/buffer/index.js
| @@ -42,7 +42,9 @@ function t1() | @@ -42,7 +42,9 @@ function t1() | ||
| 42 | function t2() | 42 | function t2() |
| 43 | { | 43 | { |
| 44 | ins = "Distância do entorno em metros" | 44 | ins = "Distância do entorno em metros" |
| 45 | - ins += "<br><br><input class=digitar id='d' type=text size=10 value='0'/>" | 45 | + ins += "<br><input class=digitar id='d' type=text size=10 value='0'/><br><br>" |
| 46 | + ins += "Considerar os elementos selecionados como se fossem um só?"; | ||
| 47 | + ins += "<br><select id=unir ><option value=nao selected >não</option><option value=sim >sim</option></select>" | ||
| 46 | mostraOpcao("t1()","t3()",ins,"t2") | 48 | mostraOpcao("t1()","t3()",ins,"t2") |
| 47 | } | 49 | } |
| 48 | function t3() | 50 | function t3() |
| @@ -73,7 +75,7 @@ function criarbuffer() | @@ -73,7 +75,7 @@ function criarbuffer() | ||
| 73 | else | 75 | else |
| 74 | {window.parent.ajaxredesenha("");} | 76 | {window.parent.ajaxredesenha("");} |
| 75 | } | 77 | } |
| 76 | - var p = g_locaplic+"/classesphp/mapa_controle.php?g_sid="+g_sid+"&funcao=criabuffer&tema="+tema+"&distancia="+distancia | 78 | + var p = g_locaplic+"/classesphp/mapa_controle.php?g_sid="+g_sid+"&funcao=criabuffer&tema="+tema+"&distancia="+distancia+"&unir="+$i("unir").value |
| 77 | var cp = new cpaint(); | 79 | var cp = new cpaint(); |
| 78 | //cp.set_debug(2); | 80 | //cp.set_debug(2); |
| 79 | cp.set_response_type("JSON"); | 81 | cp.set_response_type("JSON"); |