Commit 74ebb5a9646b1d2aab6e6e7cc795efdcdccb1401
1 parent
8c68a47f
Exists in
master
and in
7 other branches
-
Showing
10 changed files
with
850 additions
and
653 deletions
Show diff stats
admin/admin.db
No preview for this file type
classesphp/classe_alteraclasse.php
| @@ -21,7 +21,7 @@ Este programa é distribuído na expectativa de que seja útil | @@ -21,7 +21,7 @@ Este programa é distribuído na expectativa de que seja útil | ||
| 21 | porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | 21 | porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita |
| 22 | de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | 22 | de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. |
| 23 | Consulte a Licença Pública Geral do GNU para mais detalhes. | 23 | Consulte a Licença Pública Geral do GNU para mais detalhes. |
| 24 | -Você deve ter recebido uma c�pia da Licença Pública Geral do | 24 | +Você deve ter recebido uma copia da Licença Pública Geral do |
| 25 | GNU junto com este programa; se não, escreva para a | 25 | GNU junto com este programa; se não, escreva para a |
| 26 | Free Software Foundation, Inc., no endereço | 26 | Free Software Foundation, Inc., no endereço |
| 27 | 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | 27 | 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. |
| @@ -213,6 +213,7 @@ $base64 sim|nao indica se as strings estao codificadas em base64 | @@ -213,6 +213,7 @@ $base64 sim|nao indica se as strings estao codificadas em base64 | ||
| 213 | { | 213 | { |
| 214 | $layerc = explode("-",$ids[$i]); //nome do layer é o indice 0 do array | 214 | $layerc = explode("-",$ids[$i]); //nome do layer é o indice 0 do array |
| 215 | $layer = $this->mapa->getlayerbyname($layerc[0]); | 215 | $layer = $this->mapa->getlayerbyname($layerc[0]); |
| 216 | + $layer->setMetaData("cache",""); | ||
| 216 | $ncl = $layer->numclasses; | 217 | $ncl = $layer->numclasses; |
| 217 | if ($layerc[1] < $ncl) | 218 | if ($layerc[1] < $ncl) |
| 218 | { | 219 | { |
classesphp/classe_analise.php
| 1 | <?php | 1 | <?php |
| 2 | /* | 2 | /* |
| 3 | -Title: classe_analise.php | 3 | + Title: classe_analise.php |
| 4 | 4 | ||
| 5 | -Gera análises espaciais, como buffer, calculo de centróides, etc. | 5 | +Gera análises espaciais, como buffer, calculo de centr�ides, etc. |
| 6 | 6 | ||
| 7 | Licenca: | 7 | Licenca: |
| 8 | 8 | ||
| @@ -22,8 +22,8 @@ Este programa &eacute; distribu&iacute;do na expectativa de que seja &uacute;til | @@ -22,8 +22,8 @@ Este programa &eacute; distribu&iacute;do na expectativa de que seja &uacute;til | ||
| 22 | porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | 22 | porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita |
| 23 | de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | 23 | de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. |
| 24 | Consulte a Licença Pública Geral do GNU para mais detalhes. | 24 | Consulte a Licença Pública Geral do GNU para mais detalhes. |
| 25 | -Você deve ter recebido uma cópia da Licença Pública Geral do | ||
| 26 | -GNU junto com este programa; se não, escreva para a | 25 | +Você deve ter recebido uma c�pia da Licença Pública Geral do |
| 26 | + GNU junto com este programa; se não, escreva para a | ||
| 27 | Free Software Foundation, Inc., no endereço | 27 | Free Software Foundation, Inc., no endereço |
| 28 | 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | 28 | 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. |
| 29 | 29 | ||
| @@ -32,110 +32,114 @@ Arquivo: | @@ -32,110 +32,114 @@ Arquivo: | ||
| 32 | i3geo/classesphp/classe_analise.php | 32 | i3geo/classesphp/classe_analise.php |
| 33 | */ | 33 | */ |
| 34 | /* | 34 | /* |
| 35 | -Classe: Analise | 35 | + Classe: Analise |
| 36 | 36 | ||
| 37 | */ | 37 | */ |
| 38 | class Analise | 38 | class Analise |
| 39 | { | 39 | { |
| 40 | /* | 40 | /* |
| 41 | - Variavel: $mapa | 41 | + Variavel: $mapa |
| 42 | 42 | ||
| 43 | Objeto mapa | 43 | Objeto mapa |
| 44 | */ | 44 | */ |
| 45 | public $mapa; | 45 | public $mapa; |
| 46 | /* | 46 | /* |
| 47 | - Variavel: $arquivo | 47 | + Variavel: $arquivo |
| 48 | 48 | ||
| 49 | Arquivo map file | 49 | Arquivo map file |
| 50 | */ | 50 | */ |
| 51 | protected $arquivo; | 51 | protected $arquivo; |
| 52 | /* | 52 | /* |
| 53 | - Variavel: $layer | 53 | + Variavel: $layer |
| 54 | 54 | ||
| 55 | Objeto layer | 55 | Objeto layer |
| 56 | */ | 56 | */ |
| 57 | protected $layer; | 57 | protected $layer; |
| 58 | /* | 58 | /* |
| 59 | - Variavel: $nome | 59 | + Variavel: $nome |
| 60 | 60 | ||
| 61 | Nome do layer | 61 | Nome do layer |
| 62 | */ | 62 | */ |
| 63 | protected $nome; | 63 | protected $nome; |
| 64 | /* | 64 | /* |
| 65 | - Variavel: $diretorio | 65 | + Variavel: $diretorio |
| 66 | 66 | ||
| 67 | - Diretório do arquivo map_file | 67 | + Diret�rio do arquivo map_file |
| 68 | */ | 68 | */ |
| 69 | protected $diretorio; | 69 | protected $diretorio; |
| 70 | /* | 70 | /* |
| 71 | - Variavel: $qyfile | 71 | + Variavel: $qyfile |
| 72 | 72 | ||
| 73 | Nome do arquivo de seleção (.qy) | 73 | Nome do arquivo de seleção (.qy) |
| 74 | */ | 74 | */ |
| 75 | public $qyfile; | 75 | public $qyfile; |
| 76 | /* | 76 | /* |
| 77 | - Variavel: $v | 77 | + Variavel: $v |
| 78 | 78 | ||
| 79 | Versão atual do Mapserver (primeiro dígito) | 79 | Versão atual do Mapserver (primeiro dígito) |
| 80 | */ | 80 | */ |
| 81 | public $v; | 81 | public $v; |
| 82 | /* | 82 | /* |
| 83 | - Variavel: $dbaseExiste | 83 | + Variavel: $dbaseExiste |
| 84 | 84 | ||
| 85 | Indica se a biblioteca dbase está carregada | 85 | Indica se a biblioteca dbase está carregada |
| 86 | */ | 86 | */ |
| 87 | protected $dbaseExiste; | 87 | protected $dbaseExiste; |
| 88 | -/* | ||
| 89 | -Function: __construct | 88 | + /* |
| 89 | + Function: __construct | ||
| 90 | 90 | ||
| 91 | -Cria um objeto Analise | 91 | + Cria um objeto Analise |
| 92 | 92 | ||
| 93 | -parameters: | 93 | + parameters: |
| 94 | 94 | ||
| 95 | -$map_file - Endereço do mapfile no servidor. | 95 | + $map_file - Endereço do mapfile no servidor. |
| 96 | 96 | ||
| 97 | -$tema - Nome do tema que será processado | 97 | + $tema - Nome do tema que será processado |
| 98 | 98 | ||
| 99 | -$ext - Extensão geográfica do mapa | ||
| 100 | -*/ | 99 | + $ext - Extensão geográfica do mapa |
| 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;} | ||
| 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); | 113 | + { |
| 114 | + $this->dbaseExiste = true; | ||
| 115 | + } | ||
| 116 | + $this->locaplic = $locaplic; | ||
| 117 | + $this->mapa = ms_newMapObj($map_file); | ||
| 118 | + $this->arquivo = $map_file; | ||
| 119 | + if($tema != "" && @$this->mapa->getlayerbyname($tema)) | ||
| 120 | + { | ||
| 121 | + $this->layer = $this->mapa->getlayerbyname($tema); | ||
| 122 | + } | ||
| 123 | + $this->nome = $tema; | ||
| 124 | + $this->diretorio = dirname($this->arquivo); | ||
| 121 | if($ext && $ext != ""){ | 125 | if($ext && $ext != ""){ |
| 122 | $e = explode(" ",$ext); | 126 | $e = explode(" ",$ext); |
| 123 | $extatual = $this->mapa->extent; | 127 | $extatual = $this->mapa->extent; |
| 124 | $extatual->setextent((min($e[0],$e[2])),(min($e[1],$e[3])),(max($e[0],$e[2])),(max($e[1],$e[3]))); | 128 | $extatual->setextent((min($e[0],$e[2])),(min($e[1],$e[3])),(max($e[0],$e[2])),(max($e[1],$e[3]))); |
| 125 | } | 129 | } |
| 126 | } | 130 | } |
| 127 | -/* | ||
| 128 | -Method: criaDefDb | 131 | + /* |
| 132 | + Method: criaDefDb | ||
| 129 | 133 | ||
| 130 | -Cria um array contendo as definições das colunas que serão criadas em uma tabela DBF conforme as exigências de arquivos dbf | 134 | + Cria um array contendo as definições das colunas que serão criadas em uma tabela DBF conforme as exigências de arquivos dbf |
| 131 | 135 | ||
| 132 | -parameters: | 136 | + parameters: |
| 133 | 137 | ||
| 134 | -$itens - array com os nomes originais das colunas | 138 | + $itens - array com os nomes originais das colunas |
| 135 | 139 | ||
| 136 | -return: | ||
| 137 | -{array} | ||
| 138 | -*/ | 140 | + return: |
| 141 | + {array} | ||
| 142 | + */ | ||
| 139 | function criaDefDb($itens,$unico=true){ | 143 | function criaDefDb($itens,$unico=true){ |
| 140 | $c = 0; | 144 | $c = 0; |
| 141 | $def = array(); | 145 | $def = array(); |
| @@ -151,71 +155,73 @@ return: | @@ -151,71 +155,73 @@ return: | ||
| 151 | } | 155 | } |
| 152 | return $def; | 156 | return $def; |
| 153 | } | 157 | } |
| 154 | -/* | ||
| 155 | -Method: truncaS | 158 | + /* |
| 159 | + Method: truncaS | ||
| 156 | 160 | ||
| 157 | -Trunca o comprimento de uma string em 255 caracteres | 161 | + Trunca o comprimento de uma string em 255 caracteres |
| 158 | 162 | ||
| 159 | -parameters: | 163 | + parameters: |
| 160 | 164 | ||
| 161 | -$s - string | 165 | + $s - string |
| 162 | 166 | ||
| 163 | -return | ||
| 164 | -{string} | ||
| 165 | -*/ | 167 | + return |
| 168 | + {string} | ||
| 169 | + */ | ||
| 166 | function truncaS($s){ | 170 | function truncaS($s){ |
| 167 | if(strlen($s) > 255){ | 171 | if(strlen($s) > 255){ |
| 168 | $s = substr($s,0,255); | 172 | $s = substr($s,0,255); |
| 169 | } | 173 | } |
| 170 | return $s; | 174 | return $s; |
| 171 | } | 175 | } |
| 172 | -/* | ||
| 173 | -Method: salva | 176 | + /* |
| 177 | + Method: salva | ||
| 174 | 178 | ||
| 175 | -Salva o mapfile atual | ||
| 176 | -*/ | 179 | + Salva o mapfile atual |
| 180 | + */ | ||
| 177 | function salva() | 181 | function salva() |
| 178 | { | 182 | { |
| 179 | - if (connection_aborted()){exit();} | ||
| 180 | - $this->mapa->save($this->arquivo); | 183 | + if (connection_aborted()){ |
| 184 | + exit(); | ||
| 185 | + } | ||
| 186 | + $this->mapa->save($this->arquivo); | ||
| 181 | } | 187 | } |
| 182 | 188 | ||
| 183 | -/* | ||
| 184 | -function: analiseDistriPt | 189 | + /* |
| 190 | + function: analiseDistriPt | ||
| 185 | 191 | ||
| 186 | -Gera análise de distribuição de pontos. | 192 | + Gera análise de distribuição de pontos. |
| 187 | 193 | ||
| 188 | -Executa script R para gerar a imagem. | 194 | + Executa script R para gerar a imagem. |
| 189 | 195 | ||
| 190 | -parameters: | 196 | + parameters: |
| 191 | 197 | ||
| 192 | -$locaplic - Localização da aplicação I3Geo | 198 | + $locaplic - Localização da aplicação I3Geo |
| 193 | 199 | ||
| 194 | -$dir_tmp - Diretório temporário do mapserver | 200 | + $dir_tmp - Diret�rio temporário do mapserver |
| 195 | 201 | ||
| 196 | -$R_path - Onde fica o R | 202 | + $R_path - Onde fica o R |
| 197 | 203 | ||
| 198 | -$numclasses - Número de classes que serão representadas | 204 | + $numclasses - Número de classes que serão representadas |
| 199 | 205 | ||
| 200 | -$tipo - Tipo de análise. | 206 | + $tipo - Tipo de análise. |
| 201 | 207 | ||
| 202 | -$cori - Cor inicial em rgb. | 208 | + $cori - Cor inicial em rgb. |
| 203 | 209 | ||
| 204 | -$corf - Cor final em rgb. | 210 | + $corf - Cor final em rgb. |
| 205 | 211 | ||
| 206 | -$tmpurl - Url com o nome da imagem final (apenas para relatorio) | 212 | + $tmpurl - Url com o nome da imagem final (apenas para relatorio) |
| 207 | 213 | ||
| 208 | -$sigma - desvio padrão para a opção kernel | 214 | + $sigma - desvio padrão para a opção kernel |
| 209 | 215 | ||
| 210 | -$limitepontos - "TRUE"|"FALSE" limita o resultado ao limite geográfico dos pontos se "TRUE" ou ao limite do mapa se "FALSE" | 216 | + $limitepontos - "TRUE"|"FALSE" limita o resultado ao limite geográfico dos pontos se "TRUE" ou ao limite do mapa se "FALSE" |
| 211 | 217 | ||
| 212 | -$extendelimite - extende o limite dos pontos em um determinado percentual em relação a área final de abrangência | 218 | + $extendelimite - extende o limite dos pontos em um determinado percentual em relação a área final de abrangência |
| 213 | 219 | ||
| 214 | -$item - item contendo os pesos utilizado na operacao de calculo de densidade (opcional) | 220 | + $item - item contendo os pesos utilizado na operacao de calculo de densidade (opcional) |
| 215 | 221 | ||
| 216 | -Include: | ||
| 217 | -<class.palette.php> | ||
| 218 | -*/ | 222 | + Include: |
| 223 | + <class.palette.php> | ||
| 224 | + */ | ||
| 219 | function analiseDistriPt($locaplic,$dir_tmp,$R_path,$numclasses,$tipo,$cori,$corf,$tmpurl,$sigma="",$limitepontos="TRUE",$tema2="",$extendelimite=5,$item="") | 225 | function analiseDistriPt($locaplic,$dir_tmp,$R_path,$numclasses,$tipo,$cori,$corf,$tmpurl,$sigma="",$limitepontos="TRUE",$tema2="",$extendelimite=5,$item="") |
| 220 | { | 226 | { |
| 221 | set_time_limit(120); | 227 | set_time_limit(120); |
| @@ -236,30 +242,30 @@ Include: | @@ -236,30 +242,30 @@ Include: | ||
| 236 | switch ($tipo){ | 242 | switch ($tipo){ |
| 237 | //cluster espacial | 243 | //cluster espacial |
| 238 | case "cluster": | 244 | case "cluster": |
| 239 | - $this->mapaCluster($nomearq,$nomearq2,$dimx,$dimy,$dir_tmp,$R_path,$locaplic); | ||
| 240 | - return "ok"; | ||
| 241 | - break; | ||
| 242 | - //delaunay e voronoi | 245 | + $this->mapaCluster($nomearq,$nomearq2,$dimx,$dimy,$dir_tmp,$R_path,$locaplic); |
| 246 | + return "ok"; | ||
| 247 | + break; | ||
| 248 | + //delaunay e voronoi | ||
| 243 | case "deldir": | 249 | case "deldir": |
| 244 | //error_reporting(0); | 250 | //error_reporting(0); |
| 245 | $this->mapaDeldir($nomearq,$dir_tmp,$R_path,$locaplic); | 251 | $this->mapaDeldir($nomearq,$dir_tmp,$R_path,$locaplic); |
| 246 | $this->deldirDir2shp($nomearq."dirsgs",$dir_tmp,$locaplic); | 252 | $this->deldirDir2shp($nomearq."dirsgs",$dir_tmp,$locaplic); |
| 247 | $this->deldirDel2shp($nomearq."delsgs",$dir_tmp,$locaplic); | 253 | $this->deldirDel2shp($nomearq."delsgs",$dir_tmp,$locaplic); |
| 248 | - return "ok"; | ||
| 249 | - break; | 254 | + return "ok"; |
| 255 | + break; | ||
| 250 | case "kernel": | 256 | case "kernel": |
| 251 | $this->mapaKernel($nomearq,$dimx,$dimy,$dir_tmp,$R_path,$locaplic,$sigma); | 257 | $this->mapaKernel($nomearq,$dimx,$dimy,$dir_tmp,$R_path,$locaplic,$sigma); |
| 252 | - break; | 258 | + break; |
| 253 | case "densidade": | 259 | case "densidade": |
| 254 | $this->mapaDensidade($nomearq,$dimx,$dimy,$dir_tmp,$R_path,$locaplic,$dimz); | 260 | $this->mapaDensidade($nomearq,$dimx,$dimy,$dir_tmp,$R_path,$locaplic,$dimz); |
| 255 | - break; | 261 | + break; |
| 256 | case "distancia": | 262 | case "distancia": |
| 257 | $this->mapaDistancia($nomearq,$dimx,$dimy,$dir_tmp,$R_path,$locaplic); | 263 | $this->mapaDistancia($nomearq,$dimx,$dimy,$dir_tmp,$R_path,$locaplic); |
| 258 | - break; | 264 | + break; |
| 259 | case "relatorio": | 265 | case "relatorio": |
| 260 | $r = $this->mapaRelatorioAnaliseDist($nomearq,$dimx,$dimy,$dir_tmp,$R_path,$locaplic); | 266 | $r = $this->mapaRelatorioAnaliseDist($nomearq,$dimx,$dimy,$dir_tmp,$R_path,$locaplic); |
| 261 | return($tmpurl.basename($this->diretorio)."/".basename($nomearq).'.htm'); | 267 | return($tmpurl.basename($this->diretorio)."/".basename($nomearq).'.htm'); |
| 262 | - break; | 268 | + break; |
| 263 | } | 269 | } |
| 264 | //cria a imagem | 270 | //cria a imagem |
| 265 | $minmax = $this->criaImagemR($nomearq); | 271 | $minmax = $this->criaImagemR($nomearq); |
| @@ -271,7 +277,9 @@ Include: | @@ -271,7 +277,9 @@ Include: | ||
| 271 | //cria os parametros das classes | 277 | //cria os parametros das classes |
| 272 | $cls = $this->classesRasterI($minmax[0],$minmax[1],$numclasses,$myPalette->colorRGB); | 278 | $cls = $this->classesRasterI($minmax[0],$minmax[1],$numclasses,$myPalette->colorRGB); |
| 273 | 279 | ||
| 274 | - if (count($cls) != $numclasses){return("erro.");} | 280 | + if (count($cls) != $numclasses){ |
| 281 | + return("erro."); | ||
| 282 | + } | ||
| 275 | //adiciona o novo tema | 283 | //adiciona o novo tema |
| 276 | if (file_exists($nomearq.".png")){ | 284 | if (file_exists($nomearq.".png")){ |
| 277 | $novolayer = criaLayer($this->mapa,MS_LAYER_RASTER,MS_DEFAULT,($tipo." (".$this->nome.")"),$metaClasse="SIM"); | 285 | $novolayer = criaLayer($this->mapa,MS_LAYER_RASTER,MS_DEFAULT,($tipo." (".$this->nome.")"),$metaClasse="SIM"); |
| @@ -314,42 +322,49 @@ Include: | @@ -314,42 +322,49 @@ Include: | ||
| 314 | $layerAbaixo = $this->mapa->getlayer($i); | 322 | $layerAbaixo = $this->mapa->getlayer($i); |
| 315 | $tipo = $layerAbaixo->type; | 323 | $tipo = $layerAbaixo->type; |
| 316 | if (($tipo != 2) && ($tipo != 3)) | 324 | if (($tipo != 2) && ($tipo != 3)) |
| 317 | - {$nummove++;} | 325 | + { |
| 326 | + $nummove++; | ||
| 327 | + } | ||
| 318 | } | 328 | } |
| 319 | if ($nummove > 2) | 329 | if ($nummove > 2) |
| 320 | { | 330 | { |
| 321 | for ($i=0;$i<=($nummove - 3);++$i) | 331 | for ($i=0;$i<=($nummove - 3);++$i) |
| 322 | - {$this->mapa->movelayerup($indicel);} | 332 | + { |
| 333 | + $this->mapa->movelayerup($indicel); | ||
| 334 | + } | ||
| 323 | } | 335 | } |
| 324 | } | 336 | } |
| 325 | } | 337 | } |
| 326 | else | 338 | else |
| 327 | - {return("erro");} | 339 | + {return("erro"); |
| 340 | + } | ||
| 328 | if(file_exists($this->qyfile)) | 341 | if(file_exists($this->qyfile)) |
| 329 | - {unlink($this->qyfile);} | 342 | + { |
| 343 | + unlink($this->qyfile); | ||
| 344 | + } | ||
| 330 | return($novolayer->name); | 345 | return($novolayer->name); |
| 331 | } | 346 | } |
| 332 | -/* | ||
| 333 | -function: mapaRelatorioAnaliseDist | 347 | + /* |
| 348 | + function: mapaRelatorioAnaliseDist | ||
| 334 | 349 | ||
| 335 | -Gera um relatório da análise de distribuição de pontos. | 350 | + Gera um relat�rio da análise de distribuição de pontos. |
| 336 | 351 | ||
| 337 | -Executa script R para gerar relatório . | 352 | + Executa script R para gerar relat�rio . |
| 338 | 353 | ||
| 339 | -parameters: | 354 | + parameters: |
| 340 | 355 | ||
| 341 | -$arqpt - Prefixo dos arquivos em disco com os pontos. | 356 | + $arqpt - Prefixo dos arquivos em disco com os pontos. |
| 342 | 357 | ||
| 343 | -$dimx - Range em x no formato R c(-54,-53). | 358 | + $dimx - Range em x no formato R c(-54,-53). |
| 344 | 359 | ||
| 345 | -$dimy - Range em y no formato R c(-25,-23). | 360 | + $dimy - Range em y no formato R c(-25,-23). |
| 346 | 361 | ||
| 347 | -$dir_tmp - Diretório temporário do mapserver. | 362 | + $dir_tmp - Diret�rio temporário do mapserver. |
| 348 | 363 | ||
| 349 | -$R_path - Onde fica o R. | 364 | + $R_path - Onde fica o R. |
| 350 | 365 | ||
| 351 | -$locaplic - Onde fica o I3Geo. | ||
| 352 | -*/ | 366 | + $locaplic - Onde fica o I3Geo. |
| 367 | + */ | ||
| 353 | function mapaRelatorioAnaliseDist($arqpt,$dimx,$dimy,$dir_tmp,$R_path,$locaplic) | 368 | function mapaRelatorioAnaliseDist($arqpt,$dimx,$dimy,$dir_tmp,$R_path,$locaplic) |
| 354 | { | 369 | { |
| 355 | set_time_limit(180); | 370 | set_time_limit(180); |
| @@ -361,7 +376,7 @@ $locaplic - Onde fica o I3Geo. | @@ -361,7 +376,7 @@ $locaplic - Onde fica o I3Geo. | ||
| 361 | { | 376 | { |
| 362 | $lib = '.libPaths("'.$locaplic.'/pacotes/rlib/win")'; | 377 | $lib = '.libPaths("'.$locaplic.'/pacotes/rlib/win")'; |
| 363 | if(file_exists($locaplic.'/pacotes/rlib/win')) | 378 | if(file_exists($locaplic.'/pacotes/rlib/win')) |
| 364 | - $rcode[] = $lib; | 379 | + $rcode[] = $lib; |
| 365 | $tipoimg = "png"; | 380 | $tipoimg = "png"; |
| 366 | } | 381 | } |
| 367 | else | 382 | else |
| @@ -455,29 +470,29 @@ $locaplic - Onde fica o I3Geo. | @@ -455,29 +470,29 @@ $locaplic - Onde fica o I3Geo. | ||
| 455 | $rcode[] = 'close(zz)'; | 470 | $rcode[] = 'close(zz)'; |
| 456 | $r = $this->executaR($rcode,$dir_tmp,$R_path); | 471 | $r = $this->executaR($rcode,$dir_tmp,$R_path); |
| 457 | } | 472 | } |
| 458 | -/* | ||
| 459 | -function: mapaCluster | 473 | + /* |
| 474 | + function: mapaCluster | ||
| 460 | 475 | ||
| 461 | -Gera um mapa de cluster. | 476 | + Gera um mapa de cluster. |
| 462 | 477 | ||
| 463 | -Executa script R para gerar os dados. | 478 | + Executa script R para gerar os dados. |
| 464 | 479 | ||
| 465 | -parameters: | 480 | + parameters: |
| 466 | 481 | ||
| 467 | -$arqpt - Prefixo dos arquivos em disco com os pontos. | 482 | + $arqpt - Prefixo dos arquivos em disco com os pontos. |
| 468 | 483 | ||
| 469 | -$dimx - Range em x no formato R c(-54,-53). | 484 | + $dimx - Range em x no formato R c(-54,-53). |
| 470 | 485 | ||
| 471 | -$dimy - Range em y no formato R c(-25,-23). | 486 | + $dimy - Range em y no formato R c(-25,-23). |
| 472 | 487 | ||
| 473 | -$dir_tmp - Diretório temporário do mapserver. | 488 | + $dir_tmp - Diretorio temporário do mapserver. |
| 474 | 489 | ||
| 475 | -$R_path - Onde fica o R. | 490 | + $R_path - Onde fica o R. |
| 476 | 491 | ||
| 477 | -$locaplic - Onde fica o I3Geo. | 492 | + $locaplic - Onde fica o I3Geo. |
| 478 | 493 | ||
| 479 | -$sigma - Bandwidth for kernel smoother in "smooth" option. | ||
| 480 | -*/ | 494 | + $sigma - Bandwidth for kernel smoother in "smooth" option. |
| 495 | + */ | ||
| 481 | function mapaCluster($arqpt,$arqpt2,$dimx,$dimy,$dir_tmp,$R_path,$locaplic) | 496 | function mapaCluster($arqpt,$arqpt2,$dimx,$dimy,$dir_tmp,$R_path,$locaplic) |
| 482 | { | 497 | { |
| 483 | $gfile_name = nomeRandomico(20); | 498 | $gfile_name = nomeRandomico(20); |
| @@ -493,7 +508,7 @@ $sigma - Bandwidth for kernel smoother in "smooth" option. | @@ -493,7 +508,7 @@ $sigma - Bandwidth for kernel smoother in "smooth" option. | ||
| 493 | if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')){ | 508 | if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')){ |
| 494 | $lib = '.libPaths("'.$locaplic.'/pacotes/rlib/win")'; | 509 | $lib = '.libPaths("'.$locaplic.'/pacotes/rlib/win")'; |
| 495 | if(file_exists($locaplic.'/pacotes/rlib/win')) | 510 | if(file_exists($locaplic.'/pacotes/rlib/win')) |
| 496 | - $rcode[] = $lib; | 511 | + $rcode[] = $lib; |
| 497 | } | 512 | } |
| 498 | else{ | 513 | else{ |
| 499 | if(file_exists($locaplic."/pacotes/rlib/linux")){ | 514 | if(file_exists($locaplic."/pacotes/rlib/linux")){ |
| @@ -508,28 +523,28 @@ $sigma - Bandwidth for kernel smoother in "smooth" option. | @@ -508,28 +523,28 @@ $sigma - Bandwidth for kernel smoother in "smooth" option. | ||
| 508 | return "ok"; | 523 | return "ok"; |
| 509 | } | 524 | } |
| 510 | 525 | ||
| 511 | -/* | ||
| 512 | -function: mapaKernel | 526 | + /* |
| 527 | + function: mapaKernel | ||
| 513 | 528 | ||
| 514 | -Gera um mapa de kernel. | 529 | + Gera um mapa de kernel. |
| 515 | 530 | ||
| 516 | -Executa script R para gerar a imagem. | 531 | + Executa script R para gerar a imagem. |
| 517 | 532 | ||
| 518 | -parameters: | ||
| 519 | -$arqpt - Prefixo dos arquivos em disco com os pontos. | 533 | + parameters: |
| 534 | + $arqpt - Prefixo dos arquivos em disco com os pontos. | ||
| 520 | 535 | ||
| 521 | -$dimx - Range em x no formato R c(-54,-53). | 536 | + $dimx - Range em x no formato R c(-54,-53). |
| 522 | 537 | ||
| 523 | -$dimy - Range em y no formato R c(-25,-23). | 538 | + $dimy - Range em y no formato R c(-25,-23). |
| 524 | 539 | ||
| 525 | -$dir_tmp - Diretório temporário do mapserver. | 540 | + $dir_tmp - Diret�rio temporário do mapserver. |
| 526 | 541 | ||
| 527 | -$R_path - Onde fica o R. | 542 | + $R_path - Onde fica o R. |
| 528 | 543 | ||
| 529 | -$locaplic - Onde fica o I3Geo. | 544 | + $locaplic - Onde fica o I3Geo. |
| 530 | 545 | ||
| 531 | -$sigma - Bandwidth for kernel smoother in "smooth" option. | ||
| 532 | -*/ | 546 | + $sigma - Bandwidth for kernel smoother in "smooth" option. |
| 547 | + */ | ||
| 533 | function mapaKernel($arqpt,$dimx,$dimy,$dir_tmp,$R_path,$locaplic,$sigma=""){ | 548 | function mapaKernel($arqpt,$dimx,$dimy,$dir_tmp,$R_path,$locaplic,$sigma=""){ |
| 534 | $gfile_name = nomeRandomico(20); | 549 | $gfile_name = nomeRandomico(20); |
| 535 | $graf = "png"; | 550 | $graf = "png"; |
| @@ -538,7 +553,7 @@ $sigma - Bandwidth for kernel smoother in "smooth" option. | @@ -538,7 +553,7 @@ $sigma - Bandwidth for kernel smoother in "smooth" option. | ||
| 538 | if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')){ | 553 | if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')){ |
| 539 | $lib = '.libPaths("'.$locaplic.'/pacotes/rlib/win")'; | 554 | $lib = '.libPaths("'.$locaplic.'/pacotes/rlib/win")'; |
| 540 | if(file_exists($locaplic.'/pacotes/rlib/win')) | 555 | if(file_exists($locaplic.'/pacotes/rlib/win')) |
| 541 | - $rcode[] = $lib; | 556 | + $rcode[] = $lib; |
| 542 | $tipoimg = "png"; | 557 | $tipoimg = "png"; |
| 543 | } | 558 | } |
| 544 | else{ | 559 | else{ |
| @@ -551,9 +566,12 @@ $sigma - Bandwidth for kernel smoother in "smooth" option. | @@ -551,9 +566,12 @@ $sigma - Bandwidth for kernel smoother in "smooth" option. | ||
| 551 | $rcode[] = 'pt <- ppp(dadosx, dadosy, '.$dimx.','.$dimy.')'; | 566 | $rcode[] = 'pt <- ppp(dadosx, dadosy, '.$dimx.','.$dimy.')'; |
| 552 | $rcode[] = 'img <- ksmooth.ppp(pt'; | 567 | $rcode[] = 'img <- ksmooth.ppp(pt'; |
| 553 | if (is_numeric($sigma)) | 568 | if (is_numeric($sigma)) |
| 554 | - {$rcode[] = ',sigma='.$sigma.')';} | 569 | + { |
| 570 | + $rcode[] = ',sigma='.$sigma.')'; | ||
| 571 | + } | ||
| 555 | else | 572 | else |
| 556 | - {$rcode[] = ')';} | 573 | + {$rcode[] = ')'; |
| 574 | + } | ||
| 557 | $rcode[] = 'cat(img$v,file="'.$arqpt.'img",fill=FALSE)'; | 575 | $rcode[] = 'cat(img$v,file="'.$arqpt.'img",fill=FALSE)'; |
| 558 | $rcode[] = 'cat(img$xstep,file="'.$arqpt.'h",fill=TRUE)'; | 576 | $rcode[] = 'cat(img$xstep,file="'.$arqpt.'h",fill=TRUE)'; |
| 559 | $rcode[] = 'cat(img$ystep,file="'.$arqpt.'h",append=TRUE,fill=TRUE)'; | 577 | $rcode[] = 'cat(img$ystep,file="'.$arqpt.'h",append=TRUE,fill=TRUE)'; |
| @@ -564,28 +582,28 @@ $sigma - Bandwidth for kernel smoother in "smooth" option. | @@ -564,28 +582,28 @@ $sigma - Bandwidth for kernel smoother in "smooth" option. | ||
| 564 | $r = $this->executaR($rcode,$dir_tmp,$R_path,$gfile_name); | 582 | $r = $this->executaR($rcode,$dir_tmp,$R_path,$gfile_name); |
| 565 | return "ok"; | 583 | return "ok"; |
| 566 | } | 584 | } |
| 567 | -/* | ||
| 568 | -function: mapaDensidade | 585 | + /* |
| 586 | + function: mapaDensidade | ||
| 569 | 587 | ||
| 570 | -Gera um mapa de densidade de pontos. | 588 | + Gera um mapa de densidade de pontos. |
| 571 | 589 | ||
| 572 | -Executa script R para gerar a imagem. | 590 | + Executa script R para gerar a imagem. |
| 573 | 591 | ||
| 574 | -parameters: | ||
| 575 | -$arqpt - Prefixo dos arquivos em disco com os pontos. | 592 | + parameters: |
| 593 | + $arqpt - Prefixo dos arquivos em disco com os pontos. | ||
| 576 | 594 | ||
| 577 | -$dimx - Range em x no formato R c(-54,-53). | 595 | + $dimx - Range em x no formato R c(-54,-53). |
| 578 | 596 | ||
| 579 | -$dimy - Range em y no formato R c(-25,-23). | 597 | + $dimy - Range em y no formato R c(-25,-23). |
| 580 | 598 | ||
| 581 | -$dir_tmp - Diretório temporário do mapserver. | 599 | + $dir_tmp - Diret�rio temporário do mapserver. |
| 582 | 600 | ||
| 583 | -$R_path - Onde fica o R. | 601 | + $R_path - Onde fica o R. |
| 584 | 602 | ||
| 585 | -$locaplic - Onde fica o I3Geo. | 603 | + $locaplic - Onde fica o I3Geo. |
| 586 | 604 | ||
| 587 | -$dimz - arquivo opcional com os valores de z | ||
| 588 | -*/ | 605 | + $dimz - arquivo opcional com os valores de z |
| 606 | + */ | ||
| 589 | function mapaDensidade($arqpt,$dimx,$dimy,$dir_tmp,$R_path,$locaplic,$dimz=""){ | 607 | function mapaDensidade($arqpt,$dimx,$dimy,$dir_tmp,$R_path,$locaplic,$dimz=""){ |
| 590 | $gfile_name = nomeRandomico(20); | 608 | $gfile_name = nomeRandomico(20); |
| 591 | $graf = "png"; | 609 | $graf = "png"; |
| @@ -595,7 +613,7 @@ $dimz - arquivo opcional com os valores de z | @@ -595,7 +613,7 @@ $dimz - arquivo opcional com os valores de z | ||
| 595 | if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')){ | 613 | if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')){ |
| 596 | $lib = '.libPaths("'.$locaplic.'/pacotes/rlib/win")'; | 614 | $lib = '.libPaths("'.$locaplic.'/pacotes/rlib/win")'; |
| 597 | if(file_exists($locaplic.'/pacotes/rlib/win')) | 615 | if(file_exists($locaplic.'/pacotes/rlib/win')) |
| 598 | - $rcode[] = $lib; | 616 | + $rcode[] = $lib; |
| 599 | $tipoimg = "png"; | 617 | $tipoimg = "png"; |
| 600 | } | 618 | } |
| 601 | else{ | 619 | else{ |
| @@ -621,27 +639,27 @@ $dimz - arquivo opcional com os valores de z | @@ -621,27 +639,27 @@ $dimz - arquivo opcional com os valores de z | ||
| 621 | $r = $this->executaR($rcode,$dir_tmp,$R_path,$gfile_name); | 639 | $r = $this->executaR($rcode,$dir_tmp,$R_path,$gfile_name); |
| 622 | return "ok"; | 640 | return "ok"; |
| 623 | } | 641 | } |
| 624 | -/* | ||
| 625 | -function: mapaDistancia | 642 | + /* |
| 643 | + function: mapaDistancia | ||
| 626 | 644 | ||
| 627 | -Gera um mapa de distancia de pontos. | 645 | + Gera um mapa de distancia de pontos. |
| 628 | 646 | ||
| 629 | -Executa script R para gerar a imagem. | 647 | + Executa script R para gerar a imagem. |
| 630 | 648 | ||
| 631 | -parameters: | 649 | + parameters: |
| 632 | 650 | ||
| 633 | -$arqpt - Prefixo dos arquivos em disco com os pontos. | 651 | + $arqpt - Prefixo dos arquivos em disco com os pontos. |
| 634 | 652 | ||
| 635 | -$dimx - Range em x no formato R c(-54,-53). | 653 | + $dimx - Range em x no formato R c(-54,-53). |
| 636 | 654 | ||
| 637 | -$dimy - Range em y no formato R c(-25,-23). | 655 | + $dimy - Range em y no formato R c(-25,-23). |
| 638 | 656 | ||
| 639 | -$dir_tmp - Diretório temporário do mapserver. | 657 | + $dir_tmp - Diretorio temporário do mapserver. |
| 640 | 658 | ||
| 641 | -$R_path - Onde fica o R. | 659 | + $R_path - Onde fica o R. |
| 642 | 660 | ||
| 643 | -$locaplic - Onde fica o I3Geo. | ||
| 644 | -*/ | 661 | + $locaplic - Onde fica o I3Geo. |
| 662 | + */ | ||
| 645 | function mapaDistancia($arqpt,$dimx,$dimy,$dir_tmp,$R_path,$locaplic) | 663 | function mapaDistancia($arqpt,$dimx,$dimy,$dir_tmp,$R_path,$locaplic) |
| 646 | { | 664 | { |
| 647 | $gfile_name = nomeRandomico(20); | 665 | $gfile_name = nomeRandomico(20); |
| @@ -652,7 +670,7 @@ $locaplic - Onde fica o I3Geo. | @@ -652,7 +670,7 @@ $locaplic - Onde fica o I3Geo. | ||
| 652 | { | 670 | { |
| 653 | $lib = '.libPaths("'.$locaplic.'/pacotes/rlib/win")'; | 671 | $lib = '.libPaths("'.$locaplic.'/pacotes/rlib/win")'; |
| 654 | if(file_exists($locaplic.'/pacotes/rlib/win')) | 672 | if(file_exists($locaplic.'/pacotes/rlib/win')) |
| 655 | - $rcode[] = $lib; | 673 | + $rcode[] = $lib; |
| 656 | $tipoimg = "png"; | 674 | $tipoimg = "png"; |
| 657 | } | 675 | } |
| 658 | else | 676 | else |
| @@ -675,25 +693,25 @@ $locaplic - Onde fica o I3Geo. | @@ -675,25 +693,25 @@ $locaplic - Onde fica o I3Geo. | ||
| 675 | $r = $this->executaR($rcode,$dir_tmp,$R_path,$gfile_name); | 693 | $r = $this->executaR($rcode,$dir_tmp,$R_path,$gfile_name); |
| 676 | return "ok"; | 694 | return "ok"; |
| 677 | } | 695 | } |
| 678 | -/* | ||
| 679 | -function: mapaDeldir | 696 | + /* |
| 697 | + function: mapaDeldir | ||
| 680 | 698 | ||
| 681 | -Calcula a triangulação de Delaunay e diagrama de Voronoi. | 699 | + Calcula a triangulação de Delaunay e diagrama de Voronoi. |
| 682 | 700 | ||
| 683 | -Para funcionar, é necessário a instalação da biblioteca deldir do R. | 701 | + Para funcionar, é necessário a instalação da biblioteca deldir do R. |
| 684 | 702 | ||
| 685 | -http://cran.r-project.org/web/packages/deldir | 703 | + http://cran.r-project.org/web/packages/deldir |
| 686 | 704 | ||
| 687 | -parameters: | 705 | + parameters: |
| 688 | 706 | ||
| 689 | -$arqpt - Prefixo dos arquivos em disco com os pontos. | 707 | + $arqpt - Prefixo dos arquivos em disco com os pontos. |
| 690 | 708 | ||
| 691 | -$dir_tmp - Diretório temporário do mapserver. | 709 | + $dir_tmp - Diret�rio temporário do mapserver. |
| 692 | 710 | ||
| 693 | -$R_path - Onde fica o R. | 711 | + $R_path - Onde fica o R. |
| 694 | 712 | ||
| 695 | -$locaplic - Onde fica o I3Geo. | ||
| 696 | -*/ | 713 | + $locaplic - Onde fica o I3Geo. |
| 714 | + */ | ||
| 697 | function mapaDeldir($arqpt,$dir_tmp,$R_path,$locaplic) | 715 | function mapaDeldir($arqpt,$dir_tmp,$R_path,$locaplic) |
| 698 | { | 716 | { |
| 699 | $gfile_name = nomeRandomico(20); | 717 | $gfile_name = nomeRandomico(20); |
| @@ -703,7 +721,7 @@ $locaplic - Onde fica o I3Geo. | @@ -703,7 +721,7 @@ $locaplic - Onde fica o I3Geo. | ||
| 703 | { | 721 | { |
| 704 | $lib = '.libPaths("'.$locaplic.'/pacotes/rlib/win")'; | 722 | $lib = '.libPaths("'.$locaplic.'/pacotes/rlib/win")'; |
| 705 | if(file_exists($locaplic.'/pacotes/rlib/win')) | 723 | if(file_exists($locaplic.'/pacotes/rlib/win')) |
| 706 | - $rcode[] = $lib; | 724 | + $rcode[] = $lib; |
| 707 | } | 725 | } |
| 708 | else | 726 | else |
| 709 | { | 727 | { |
| @@ -714,28 +732,28 @@ $locaplic - Onde fica o I3Geo. | @@ -714,28 +732,28 @@ $locaplic - Onde fica o I3Geo. | ||
| 714 | } | 732 | } |
| 715 | } | 733 | } |
| 716 | $rcode[] = 'library(deldir)'; | 734 | $rcode[] = 'library(deldir)'; |
| 717 | - | 735 | + |
| 718 | $rcode[] = 'pt <- deldir(dadosx, dadosy)'; | 736 | $rcode[] = 'pt <- deldir(dadosx, dadosy)'; |
| 719 | $rcode[] = 'write.csv(pt$delsgs,file="'.$arqpt.'delsgs")'; | 737 | $rcode[] = 'write.csv(pt$delsgs,file="'.$arqpt.'delsgs")'; |
| 720 | $rcode[] = 'write.csv(pt$dirsgs,file="'.$arqpt.'dirsgs")'; | 738 | $rcode[] = 'write.csv(pt$dirsgs,file="'.$arqpt.'dirsgs")'; |
| 721 | $r = $this->executaR($rcode,$dir_tmp,$R_path,$gfile_name); | 739 | $r = $this->executaR($rcode,$dir_tmp,$R_path,$gfile_name); |
| 722 | return "ok"; | 740 | return "ok"; |
| 723 | } | 741 | } |
| 724 | -/* | ||
| 725 | -function deldirDel2shp | 742 | + /* |
| 743 | + function deldirDel2shp | ||
| 726 | 744 | ||
| 727 | -Lê um arquivo CSV gerado pelo software R com os dados referentes à triangulação de Delaunay. | 745 | + Lê um arquivo CSV gerado pelo software R com os dados referentes a triangulação de Delaunay. |
| 728 | 746 | ||
| 729 | -O arquivo CSV é lido e convertido em um shape file que é então adicionado ao mapa. | 747 | + O arquivo CSV é lido e convertido em um shape file que é então adicionado ao mapa. |
| 730 | 748 | ||
| 731 | -Parametros: | 749 | + Parametros: |
| 732 | 750 | ||
| 733 | -$nomearq - nome do arquivo CSV | 751 | + $nomearq - nome do arquivo CSV |
| 734 | 752 | ||
| 735 | -$dir_tmp - diretório temporário do Mapserver | 753 | + $dir_tmp - diretorio temporário do Mapserver |
| 736 | 754 | ||
| 737 | -$locaplic - diretório da aplicação i3geo | ||
| 738 | -*/ | 755 | + $locaplic - diretorio da aplicação i3geo |
| 756 | + */ | ||
| 739 | function deldirDel2shp($nomearq,$dir_tmp,$locaplic) | 757 | function deldirDel2shp($nomearq,$dir_tmp,$locaplic) |
| 740 | { | 758 | { |
| 741 | if (file_exists($nomearq)) | 759 | if (file_exists($nomearq)) |
| @@ -756,9 +774,12 @@ $locaplic - diretório da aplica&ccedil;&atilde;o i3geo | @@ -756,9 +774,12 @@ $locaplic - diretório da aplica&ccedil;&atilde;o i3geo | ||
| 756 | $def[] = array("ind1","N","5","0"); | 774 | $def[] = array("ind1","N","5","0"); |
| 757 | $def[] = array("ind2","N","5","0"); | 775 | $def[] = array("ind2","N","5","0"); |
| 758 | if($this->dbaseExiste == false) | 776 | if($this->dbaseExiste == false) |
| 759 | - {$db = xbase_create($nomeshp.".dbf", $def);} | 777 | + { |
| 778 | + $db = xbase_create($nomeshp.".dbf", $def); | ||
| 779 | + } | ||
| 760 | else | 780 | else |
| 761 | - {$db = dbase_create($nomeshp.".dbf", $def);} | 781 | + {$db = dbase_create($nomeshp.".dbf", $def); |
| 782 | + } | ||
| 762 | $dbname = $nomeshp.".dbf"; | 783 | $dbname = $nomeshp.".dbf"; |
| 763 | //le o arquivo linha a linha, pulando a primeira | 784 | //le o arquivo linha a linha, pulando a primeira |
| 764 | //acrescenta os pontos no shape file formando as linhas | 785 | //acrescenta os pontos no shape file formando as linhas |
| @@ -789,15 +810,15 @@ $locaplic - diretório da aplica&ccedil;&atilde;o i3geo | @@ -789,15 +810,15 @@ $locaplic - diretório da aplica&ccedil;&atilde;o i3geo | ||
| 789 | $novoshpf->addShape($ShapeObj); | 810 | $novoshpf->addShape($ShapeObj); |
| 790 | $registro = array($i1,$i2,$i3,$i4,$i5,$i6); | 811 | $registro = array($i1,$i2,$i3,$i4,$i5,$i6); |
| 791 | if($this->dbaseExiste == false) | 812 | if($this->dbaseExiste == false) |
| 792 | - xbase_add_record($db,$registro); | 813 | + xbase_add_record($db,$registro); |
| 793 | else | 814 | else |
| 794 | - dbase_add_record($db,$registro); | 815 | + dbase_add_record($db,$registro); |
| 795 | } | 816 | } |
| 796 | } | 817 | } |
| 797 | if($this->dbaseExiste == false) | 818 | if($this->dbaseExiste == false) |
| 798 | - xbase_close($db); | 819 | + xbase_close($db); |
| 799 | else | 820 | else |
| 800 | - dbase_close($db); | 821 | + dbase_close($db); |
| 801 | fclose($abre); | 822 | fclose($abre); |
| 802 | //adiciona no mapa atual o novo tema | 823 | //adiciona no mapa atual o novo tema |
| 803 | $novolayer = criaLayer($this->mapa,MS_LAYER_LINE,MS_DEFAULT,("Delaunay (".$nomefinal.")"),$metaClasse="SIM"); | 824 | $novolayer = criaLayer($this->mapa,MS_LAYER_LINE,MS_DEFAULT,("Delaunay (".$nomefinal.")"),$metaClasse="SIM"); |
| @@ -812,21 +833,21 @@ $locaplic - diretório da aplica&ccedil;&atilde;o i3geo | @@ -812,21 +833,21 @@ $locaplic - diretório da aplica&ccedil;&atilde;o i3geo | ||
| 812 | $cor->setrgb(255,50,0); | 833 | $cor->setrgb(255,50,0); |
| 813 | } | 834 | } |
| 814 | } | 835 | } |
| 815 | -/* | ||
| 816 | -function deldirDir2shp | 836 | + /* |
| 837 | + function deldirDir2shp | ||
| 817 | 838 | ||
| 818 | -Lê um arquivo CSV gerado pelo software R com os dados referentes ao diagrama de Voronoi. | 839 | + Lê um arquivo CSV gerado pelo software R com os dados referentes ao diagrama de Voronoi. |
| 819 | 840 | ||
| 820 | -O arquivo CSV é lido e convertido em um shape file que é então adicionado ao mapa. | 841 | + O arquivo CSV é lido e convertido em um shape file que é então adicionado ao mapa. |
| 821 | 842 | ||
| 822 | -Parametros: | 843 | + Parametros: |
| 823 | 844 | ||
| 824 | -$nomearq - nome do arquivo CSV | 845 | + $nomearq - nome do arquivo CSV |
| 825 | 846 | ||
| 826 | -$dir_tmp - diretório temporário do Mapserver | 847 | + $dir_tmp - diretorio temporário do Mapserver |
| 827 | 848 | ||
| 828 | -$locaplic - diretório da aplicação i3geo | ||
| 829 | -*/ | 849 | + $locaplic - diretorio da aplicação i3geo |
| 850 | + */ | ||
| 830 | function deldirDir2shp($nomearq,$dir_tmp,$locaplic) | 851 | function deldirDir2shp($nomearq,$dir_tmp,$locaplic) |
| 831 | { | 852 | { |
| 832 | if (file_exists($nomearq)) | 853 | if (file_exists($nomearq)) |
| @@ -856,9 +877,12 @@ $locaplic - diretório da aplica&ccedil;&atilde;o i3geo | @@ -856,9 +877,12 @@ $locaplic - diretório da aplica&ccedil;&atilde;o i3geo | ||
| 856 | $def[] = array("b1","C","6"); | 877 | $def[] = array("b1","C","6"); |
| 857 | $def[] = array("b2","C","6"); | 878 | $def[] = array("b2","C","6"); |
| 858 | if($this->dbaseExiste == false) | 879 | if($this->dbaseExiste == false) |
| 859 | - {$dbLinhas = xbase_create($nomeshpLinhas.".dbf", $def);} | 880 | + { |
| 881 | + $dbLinhas = xbase_create($nomeshpLinhas.".dbf", $def); | ||
| 882 | + } | ||
| 860 | else | 883 | else |
| 861 | - {$dbLinhas = dbase_create($nomeshpLinhas.".dbf", $def);} | 884 | + {$dbLinhas = dbase_create($nomeshpLinhas.".dbf", $def); |
| 885 | + } | ||
| 862 | $dbnameLinhas = $nomeshpLinhas.".dbf"; | 886 | $dbnameLinhas = $nomeshpLinhas.".dbf"; |
| 863 | // | 887 | // |
| 864 | // cria o dbf para o shapefile poligonal | 888 | // cria o dbf para o shapefile poligonal |
| @@ -866,12 +890,15 @@ $locaplic - diretório da aplica&ccedil;&atilde;o i3geo | @@ -866,12 +890,15 @@ $locaplic - diretório da aplica&ccedil;&atilde;o i3geo | ||
| 866 | $def = array(); | 890 | $def = array(); |
| 867 | $def[] = array("area","N","12","5"); | 891 | $def[] = array("area","N","12","5"); |
| 868 | if($this->dbaseExiste == false) | 892 | if($this->dbaseExiste == false) |
| 869 | - {$dbPoligonos = xbase_create($nomeshpPoligonos.".dbf", $def);} | 893 | + { |
| 894 | + $dbPoligonos = xbase_create($nomeshpPoligonos.".dbf", $def); | ||
| 895 | + } | ||
| 870 | else | 896 | else |
| 871 | - {$dbPoligonos = dbase_create($nomeshpPoligonos.".dbf", $def);} | 897 | + {$dbPoligonos = dbase_create($nomeshpPoligonos.".dbf", $def); |
| 898 | + } | ||
| 872 | $dbnamePoligonos = $nomeshpPoligonos.".dbf"; | 899 | $dbnamePoligonos = $nomeshpPoligonos.".dbf"; |
| 873 | // | 900 | // |
| 874 | - //constrói as linhas do diagrama | 901 | + //constr�i as linhas do diagrama |
| 875 | // | 902 | // |
| 876 | //le o arquivo linha a linha, pulando a primeira | 903 | //le o arquivo linha a linha, pulando a primeira |
| 877 | //acrescenta os pontos no shape file formando as linhas | 904 | //acrescenta os pontos no shape file formando as linhas |
| @@ -898,28 +925,32 @@ $locaplic - diretório da aplica&ccedil;&atilde;o i3geo | @@ -898,28 +925,32 @@ $locaplic - diretório da aplica&ccedil;&atilde;o i3geo | ||
| 898 | $poPoint2 = ms_newpointobj(); | 925 | $poPoint2 = ms_newpointobj(); |
| 899 | $poPoint2->setXY($i3, $i4); | 926 | $poPoint2->setXY($i3, $i4); |
| 900 | if(trim($i[7]) == "TRUE") | 927 | if(trim($i[7]) == "TRUE") |
| 901 | - {$borda[] = $poPoint1;} | 928 | + { |
| 929 | + $borda[] = $poPoint1; | ||
| 930 | + } | ||
| 902 | if(trim($i[8]) == "TRUE") | 931 | if(trim($i[8]) == "TRUE") |
| 903 | - {$borda[] = $poPoint2;} | 932 | + { |
| 933 | + $borda[] = $poPoint2; | ||
| 934 | + } | ||
| 904 | $linha = ms_newLineObj(); | 935 | $linha = ms_newLineObj(); |
| 905 | $linha->add($poPoint1); | 936 | $linha->add($poPoint1); |
| 906 | $linha->add($poPoint2); | 937 | $linha->add($poPoint2); |
| 907 | if($poligonos[$i[5]]) | 938 | if($poligonos[$i[5]]) |
| 908 | - $poligonos[$i[5]] = array_merge(array($linha),$poligonos[$i[5]]); | 939 | + $poligonos[$i[5]] = array_merge(array($linha),$poligonos[$i[5]]); |
| 909 | else | 940 | else |
| 910 | - $poligonos[$i[5]] = array($linha); | 941 | + $poligonos[$i[5]] = array($linha); |
| 911 | if($poligonos[$i[6]]) | 942 | if($poligonos[$i[6]]) |
| 912 | - $poligonos[$i[6]] = array_merge(array($linha),$poligonos[$i[6]]); | 943 | + $poligonos[$i[6]] = array_merge(array($linha),$poligonos[$i[6]]); |
| 913 | else | 944 | else |
| 914 | - $poligonos[$i[6]] = array($linha); | 945 | + $poligonos[$i[6]] = array($linha); |
| 915 | $ShapeObj = ms_newShapeObj(MS_SHAPE_LINE); | 946 | $ShapeObj = ms_newShapeObj(MS_SHAPE_LINE); |
| 916 | $ShapeObj->add($linha); | 947 | $ShapeObj->add($linha); |
| 917 | $novoshpLinhas->addShape($ShapeObj); | 948 | $novoshpLinhas->addShape($ShapeObj); |
| 918 | $registro = array($i1,$i2,$i3,$i4,$i5,$i6,$i[7],$i[8]); | 949 | $registro = array($i1,$i2,$i3,$i4,$i5,$i6,$i[7],$i[8]); |
| 919 | if($this->dbaseExiste == false) | 950 | if($this->dbaseExiste == false) |
| 920 | - xbase_add_record($dbLinhas,$registro); | 951 | + xbase_add_record($dbLinhas,$registro); |
| 921 | else | 952 | else |
| 922 | - dbase_add_record($dbLinhas,$registro); | 953 | + dbase_add_record($dbLinhas,$registro); |
| 923 | } | 954 | } |
| 924 | } | 955 | } |
| 925 | // | 956 | // |
| @@ -929,19 +960,21 @@ $locaplic - diretório da aplica&ccedil;&atilde;o i3geo | @@ -929,19 +960,21 @@ $locaplic - diretório da aplica&ccedil;&atilde;o i3geo | ||
| 929 | { | 960 | { |
| 930 | $ShapeObjp = ms_newShapeObj(MS_SHAPE_LINE); | 961 | $ShapeObjp = ms_newShapeObj(MS_SHAPE_LINE); |
| 931 | foreach ($p as $o) | 962 | foreach ($p as $o) |
| 932 | - {$ShapeObjp->add($o);} | 963 | + { |
| 964 | + $ShapeObjp->add($o); | ||
| 965 | + } | ||
| 933 | $ns = $ShapeObjp->convexhull(); | 966 | $ns = $ShapeObjp->convexhull(); |
| 934 | $novoshpPoligonos->addShape($ns); | 967 | $novoshpPoligonos->addShape($ns); |
| 935 | $registro = array($ns->getArea()); | 968 | $registro = array($ns->getArea()); |
| 936 | if($this->dbaseExiste == false) | 969 | if($this->dbaseExiste == false) |
| 937 | - xbase_add_record($dbPoligonos,$registro); | 970 | + xbase_add_record($dbPoligonos,$registro); |
| 938 | else | 971 | else |
| 939 | - dbase_add_record($dbPoligonos,$registro); | 972 | + dbase_add_record($dbPoligonos,$registro); |
| 940 | } | 973 | } |
| 941 | if($this->dbaseExiste == false) | 974 | if($this->dbaseExiste == false) |
| 942 | - xbase_close($dbPoligonos); | 975 | + xbase_close($dbPoligonos); |
| 943 | else | 976 | else |
| 944 | - dbase_close($dbPoligonos); | 977 | + dbase_close($dbPoligonos); |
| 945 | // | 978 | // |
| 946 | //adiciona o layer com os polígonos no mapa | 979 | //adiciona o layer com os polígonos no mapa |
| 947 | // | 980 | // |
| @@ -968,14 +1001,14 @@ $locaplic - diretório da aplica&ccedil;&atilde;o i3geo | @@ -968,14 +1001,14 @@ $locaplic - diretório da aplica&ccedil;&atilde;o i3geo | ||
| 968 | $novoshpLinhas->addShape($ShapeObj->convexhull()); | 1001 | $novoshpLinhas->addShape($ShapeObj->convexhull()); |
| 969 | $registro = array(0,0,0,0,0,0,0,0); | 1002 | $registro = array(0,0,0,0,0,0,0,0); |
| 970 | if($this->dbaseExiste == false) | 1003 | if($this->dbaseExiste == false) |
| 971 | - xbase_add_record($dbLinhas,$registro); | 1004 | + xbase_add_record($dbLinhas,$registro); |
| 972 | else | 1005 | else |
| 973 | - dbase_add_record($dbLinhas,$registro); | 1006 | + dbase_add_record($dbLinhas,$registro); |
| 974 | } | 1007 | } |
| 975 | if($this->dbaseExiste == false) | 1008 | if($this->dbaseExiste == false) |
| 976 | - xbase_close($dbLinhas); | 1009 | + xbase_close($dbLinhas); |
| 977 | else | 1010 | else |
| 978 | - dbase_close($dbLinhas); | 1011 | + dbase_close($dbLinhas); |
| 979 | fclose($abre); | 1012 | fclose($abre); |
| 980 | $novolayer = criaLayer($this->mapa,MS_LAYER_LINE,MS_DEFAULT,("Voronoi (".$nomeLinhas.")"),$metaClasse="SIM"); | 1013 | $novolayer = criaLayer($this->mapa,MS_LAYER_LINE,MS_DEFAULT,("Voronoi (".$nomeLinhas.")"),$metaClasse="SIM"); |
| 981 | $novolayer->set("data",$nomeshpLinhas.".shp"); | 1014 | $novolayer->set("data",$nomeshpLinhas.".shp"); |
| @@ -989,21 +1022,21 @@ $locaplic - diretório da aplica&ccedil;&atilde;o i3geo | @@ -989,21 +1022,21 @@ $locaplic - diretório da aplica&ccedil;&atilde;o i3geo | ||
| 989 | $cor->setrgb(255,210,0); | 1022 | $cor->setrgb(255,210,0); |
| 990 | } | 1023 | } |
| 991 | } | 1024 | } |
| 992 | -/* | ||
| 993 | -function: pontoEmPoligono | 1025 | + /* |
| 1026 | + function: pontoEmPoligono | ||
| 994 | 1027 | ||
| 995 | -Cruza um tema pontual com temas poligonais ou raster. | 1028 | + Cruza um tema pontual com temas poligonais ou raster. |
| 996 | 1029 | ||
| 997 | -Salva o mapa acrescentando um novo layer com o resultado. | 1030 | + Salva o mapa acrescentando um novo layer com o resultado. |
| 998 | 1031 | ||
| 999 | -parameters: | 1032 | + parameters: |
| 1000 | 1033 | ||
| 1001 | -$temaPt - Tema de pontos que será utilizado. | 1034 | + $temaPt - Tema de pontos que será utilizado. |
| 1002 | 1035 | ||
| 1003 | -$temaPo - Temas poligonais separados por virgula. | 1036 | + $temaPo - Temas poligonais separados por virgula. |
| 1004 | 1037 | ||
| 1005 | -$locaplic - Localização do I3geo. | ||
| 1006 | -*/ | 1038 | + $locaplic - Localização do I3geo. |
| 1039 | + */ | ||
| 1007 | function pontoEmPoligono($temaPt,$temasPo,$locaplic) | 1040 | function pontoEmPoligono($temaPt,$temasPo,$locaplic) |
| 1008 | { | 1041 | { |
| 1009 | set_time_limit(3000); | 1042 | set_time_limit(3000); |
| @@ -1048,7 +1081,9 @@ $locaplic - Localiza&ccedil;&atilde;o do I3geo. | @@ -1048,7 +1081,9 @@ $locaplic - Localiza&ccedil;&atilde;o do I3geo. | ||
| 1048 | $layers[] = $layer; | 1081 | $layers[] = $layer; |
| 1049 | 1082 | ||
| 1050 | if(!$items) | 1083 | if(!$items) |
| 1051 | - {return "erro ao obter a lista de itens do tema $layer->name";} | 1084 | + { |
| 1085 | + return "erro ao obter a lista de itens do tema $layer->name"; | ||
| 1086 | + } | ||
| 1052 | $listaItens[$layer->name] = $items; | 1087 | $listaItens[$layer->name] = $items; |
| 1053 | foreach ($items as $ni) | 1088 | foreach ($items as $ni) |
| 1054 | { | 1089 | { |
| @@ -1058,21 +1093,26 @@ $locaplic - Localiza&ccedil;&atilde;o do I3geo. | @@ -1058,21 +1093,26 @@ $locaplic - Localiza&ccedil;&atilde;o do I3geo. | ||
| 1058 | } | 1093 | } |
| 1059 | } | 1094 | } |
| 1060 | if($this->dbaseExiste == false) | 1095 | if($this->dbaseExiste == false) |
| 1061 | - {$db = xbase_create($nomeshp.".dbf", $def);xbase_close($db);} | 1096 | + { |
| 1097 | + $db = xbase_create($nomeshp.".dbf", $def);xbase_close($db); | ||
| 1098 | + } | ||
| 1062 | else | 1099 | else |
| 1063 | - {$db = dbase_create($nomeshp.".dbf", $def);dbase_close($db);} | 1100 | + {$db = dbase_create($nomeshp.".dbf", $def);dbase_close($db); |
| 1101 | + } | ||
| 1064 | //acrescenta os pontos no novo shapefile | 1102 | //acrescenta os pontos no novo shapefile |
| 1065 | $dbname = $nomeshp.".dbf"; | 1103 | $dbname = $nomeshp.".dbf"; |
| 1066 | if($this->dbaseExiste == false) | 1104 | if($this->dbaseExiste == false) |
| 1067 | - $db=xbase_open($dbname,2); | 1105 | + $db=xbase_open($dbname,2); |
| 1068 | else | 1106 | else |
| 1069 | - $db=dbase_open($dbname,2); | 1107 | + $db=dbase_open($dbname,2); |
| 1070 | // cria o shapefile | 1108 | // cria o shapefile |
| 1071 | $novoshpf = ms_newShapefileObj($nomeshp, MS_SHP_POINT); | 1109 | $novoshpf = ms_newShapefileObj($nomeshp, MS_SHP_POINT); |
| 1072 | foreach($spts as $spt) | 1110 | foreach($spts as $spt) |
| 1073 | { | 1111 | { |
| 1074 | foreach ($itemspt as $ni) | 1112 | foreach ($itemspt as $ni) |
| 1075 | - {$reg[] = $this->truncaS($spt->values[$ni]);} | 1113 | + { |
| 1114 | + $reg[] = $this->truncaS($spt->values[$ni]); | ||
| 1115 | + } | ||
| 1076 | $novoshpf->addShape($spt); | 1116 | $novoshpf->addShape($spt); |
| 1077 | $lineo = $spt->line(0); | 1117 | $lineo = $spt->line(0); |
| 1078 | $pt = $lineo->point(0); | 1118 | $pt = $lineo->point(0); |
| @@ -1087,11 +1127,15 @@ $locaplic - Localiza&ccedil;&atilde;o do I3geo. | @@ -1087,11 +1127,15 @@ $locaplic - Localiza&ccedil;&atilde;o do I3geo. | ||
| 1087 | if($ident == "MS_SUCCESS"){ | 1127 | if($ident == "MS_SUCCESS"){ |
| 1088 | $itens = $listaItens[$layer->name]; | 1128 | $itens = $listaItens[$layer->name]; |
| 1089 | $sopen = $layer->open(); | 1129 | $sopen = $layer->open(); |
| 1090 | - if($sopen == MS_FAILURE){return "erro";} | 1130 | + if($sopen == MS_FAILURE){ |
| 1131 | + return "erro"; | ||
| 1132 | + } | ||
| 1091 | if ($layer->getResult(0) !== FALSE) | 1133 | if ($layer->getResult(0) !== FALSE) |
| 1092 | { | 1134 | { |
| 1093 | if($this->v == 6) | 1135 | if($this->v == 6) |
| 1094 | - {$shape = $layer->getShape($layer->getResult(0));} | 1136 | + { |
| 1137 | + $shape = $layer->getShape($layer->getResult(0)); | ||
| 1138 | + } | ||
| 1095 | else{ | 1139 | else{ |
| 1096 | $result = $layer->getResult(0); | 1140 | $result = $layer->getResult(0); |
| 1097 | $shp_index = $result->shapeindex; | 1141 | $shp_index = $result->shapeindex; |
| @@ -1101,33 +1145,39 @@ $locaplic - Localiza&ccedil;&atilde;o do I3geo. | @@ -1101,33 +1145,39 @@ $locaplic - Localiza&ccedil;&atilde;o do I3geo. | ||
| 1101 | { | 1145 | { |
| 1102 | $p = $this->truncaS($shape->values[$item]); | 1146 | $p = $this->truncaS($shape->values[$item]); |
| 1103 | if(empty($p)) | 1147 | if(empty($p)) |
| 1104 | - {$p = "-";} | 1148 | + { |
| 1149 | + $p = "-"; | ||
| 1150 | + } | ||
| 1105 | $reg[] = $p; | 1151 | $reg[] = $p; |
| 1106 | } | 1152 | } |
| 1107 | } | 1153 | } |
| 1108 | else | 1154 | else |
| 1109 | { | 1155 | { |
| 1110 | foreach ($itens as $item) | 1156 | foreach ($itens as $item) |
| 1111 | - {$reg[] = "???";} | 1157 | + { |
| 1158 | + $reg[] = "???"; | ||
| 1159 | + } | ||
| 1112 | } | 1160 | } |
| 1113 | } | 1161 | } |
| 1114 | else | 1162 | else |
| 1115 | { | 1163 | { |
| 1116 | foreach ($itens as $item) | 1164 | foreach ($itens as $item) |
| 1117 | - {$reg[] = "???";} | 1165 | + { |
| 1166 | + $reg[] = "???"; | ||
| 1167 | + } | ||
| 1118 | } | 1168 | } |
| 1119 | $layer->close(); | 1169 | $layer->close(); |
| 1120 | } | 1170 | } |
| 1121 | if($this->dbaseExiste == false) | 1171 | if($this->dbaseExiste == false) |
| 1122 | - xbase_add_record($db,$reg); | 1172 | + xbase_add_record($db,$reg); |
| 1123 | else | 1173 | else |
| 1124 | - dbase_add_record($db,$reg); | 1174 | + dbase_add_record($db,$reg); |
| 1125 | $reg = array(); | 1175 | $reg = array(); |
| 1126 | } | 1176 | } |
| 1127 | if($this->dbaseExiste == false) | 1177 | if($this->dbaseExiste == false) |
| 1128 | - xbase_close($db); | 1178 | + xbase_close($db); |
| 1129 | else | 1179 | else |
| 1130 | - dbase_close($db); | 1180 | + dbase_close($db); |
| 1131 | $novolayer = ms_newLayerObj($this->mapa, $layerPt); | 1181 | $novolayer = ms_newLayerObj($this->mapa, $layerPt); |
| 1132 | $novolayer->set("data",$nomeshp.".shp"); | 1182 | $novolayer->set("data",$nomeshp.".shp"); |
| 1133 | $novolayer->set("name",$nomefinal); | 1183 | $novolayer->set("name",$nomefinal); |
| @@ -1136,184 +1186,216 @@ $locaplic - Localiza&ccedil;&atilde;o do I3geo. | @@ -1136,184 +1186,216 @@ $locaplic - Localiza&ccedil;&atilde;o do I3geo. | ||
| 1136 | $novolayer->setmetadata("DOWNLOAD","SIM"); | 1186 | $novolayer->setmetadata("DOWNLOAD","SIM"); |
| 1137 | $novolayer->setmetadata("ITENS",""); | 1187 | $novolayer->setmetadata("ITENS",""); |
| 1138 | $novolayer->setmetadata("ITENSDESC",""); | 1188 | $novolayer->setmetadata("ITENSDESC",""); |
| 1189 | + $novolayer->setmetadata("CACHE",""); | ||
| 1139 | if(ms_GetVersionInt() > 50201) | 1190 | if(ms_GetVersionInt() > 50201) |
| 1140 | - {$novolayer->setconnectiontype(MS_SHAPEFILE);} | 1191 | + { |
| 1192 | + $novolayer->setconnectiontype(MS_SHAPEFILE); | ||
| 1193 | + } | ||
| 1141 | else | 1194 | else |
| 1142 | - {$novolayer->set("connectiontype",MS_SHAPEFILE);} | 1195 | + {$novolayer->set("connectiontype",MS_SHAPEFILE); |
| 1196 | + } | ||
| 1143 | if (file_exists($this->qyfile)) | 1197 | if (file_exists($this->qyfile)) |
| 1144 | - {unlink ($this->qyfile);} | 1198 | + { |
| 1199 | + unlink ($this->qyfile); | ||
| 1200 | + } | ||
| 1145 | return(implode(" ",$nomesitens)); | 1201 | return(implode(" ",$nomesitens)); |
| 1146 | } | 1202 | } |
| 1147 | -/* | ||
| 1148 | -function: distanciaptpt | 1203 | + /* |
| 1204 | + function: distanciaptpt | ||
| 1149 | 1205 | ||
| 1150 | -Calcula a distancia entre um ponto de origem e os pontos em um tema. | 1206 | + Calcula a distancia entre um ponto de origem e os pontos em um tema. |
| 1151 | 1207 | ||
| 1152 | -São considerados apenas os pontos dentro de um tema de overlay. | 1208 | + São considerados apenas os pontos dentro de um tema de overlay. |
| 1153 | 1209 | ||
| 1154 | -parameters: | 1210 | + parameters: |
| 1155 | 1211 | ||
| 1156 | -temaorigem - nome do layer com o ponto de origem | 1212 | + temaorigem - nome do layer com o ponto de origem |
| 1157 | 1213 | ||
| 1158 | -temadestino - nome do tema com os pontos de destino | 1214 | + temadestino - nome do tema com os pontos de destino |
| 1159 | 1215 | ||
| 1160 | -temaoverlay - tema que será utilizado para selecionar o tema de destino | 1216 | + temaoverlay - tema que será utilizado para selecionar o tema de destino |
| 1161 | 1217 | ||
| 1162 | -locapli - endereço da aplicação i3geo | 1218 | + locapli - endereço da aplicação i3geo |
| 1163 | 1219 | ||
| 1164 | -itemorigem - nome do item na tabela de atributos do tema de origem que será acrescentado ao tema que será criado | 1220 | + itemorigem - nome do item na tabela de atributos do tema de origem que será acrescentado ao tema que será criado |
| 1165 | 1221 | ||
| 1166 | -itemdestino - nome do item na tabela de atributos do tema de origem que será acrescentado ao tema que será criado | 1222 | + itemdestino - nome do item na tabela de atributos do tema de origem que será acrescentado ao tema que será criado |
| 1167 | 1223 | ||
| 1168 | -*/ | ||
| 1169 | -function distanciaptpt($temaorigem,$temadestino,$temaoverlay,$locaplic,$itemorigem="",$itemdestino="") | ||
| 1170 | -{ | ||
| 1171 | - //error_reporting(0); | ||
| 1172 | - set_time_limit(180); | ||
| 1173 | - //para manipular dbf | ||
| 1174 | - if($this->dbaseExiste == false){ | ||
| 1175 | - include_once dirname(__FILE__)."/../pacotes/phpxbase/api_conversion.php"; | ||
| 1176 | - } | ||
| 1177 | - //define o nome do novo shapefile que será criado | ||
| 1178 | - $nomefinal = nomeRandomico(); | ||
| 1179 | - $nomeshp = $this->diretorio."/".$nomefinal; | 1224 | + */ |
| 1225 | + function distanciaptpt($temaorigem,$temadestino,$temaoverlay,$locaplic,$itemorigem="",$itemdestino="") | ||
| 1226 | + { | ||
| 1227 | + //error_reporting(0); | ||
| 1228 | + set_time_limit(180); | ||
| 1229 | + //para manipular dbf | ||
| 1230 | + if($this->dbaseExiste == false){ | ||
| 1231 | + include_once dirname(__FILE__)."/../pacotes/phpxbase/api_conversion.php"; | ||
| 1232 | + } | ||
| 1233 | + //define o nome do novo shapefile que será criado | ||
| 1234 | + $nomefinal = nomeRandomico(); | ||
| 1235 | + $nomeshp = $this->diretorio."/".$nomefinal; | ||
| 1180 | 1236 | ||
| 1181 | - $existesel = carregaquery2($this->arquivo,$this->layer,$this->mapa); | ||
| 1182 | - if ($existesel == "nao") | ||
| 1183 | - {return "errox";} | 1237 | + $existesel = carregaquery2($this->arquivo,$this->layer,$this->mapa); |
| 1238 | + if ($existesel == "nao") | ||
| 1239 | + { | ||
| 1240 | + return "errox"; | ||
| 1241 | + } | ||
| 1184 | 1242 | ||
| 1185 | - $layerorigem = $this->mapa->getlayerbyname($temaorigem); | ||
| 1186 | - $layerdestino = $this->mapa->getlayerbyname($temadestino); | ||
| 1187 | - $layeroverlay = $this->mapa->getlayerbyname($temaoverlay); | 1243 | + $layerorigem = $this->mapa->getlayerbyname($temaorigem); |
| 1244 | + $layerdestino = $this->mapa->getlayerbyname($temadestino); | ||
| 1245 | + $layeroverlay = $this->mapa->getlayerbyname($temaoverlay); | ||
| 1188 | 1246 | ||
| 1189 | - $shapesorigem = retornaShapesSelecionados($layerorigem,$this->arquivo,$this->mapa); | ||
| 1190 | - if(count($shapesorigem) == 0){ | ||
| 1191 | - return "erro"; | ||
| 1192 | - } | ||
| 1193 | - $layeroverlay->set("tolerance",0); | ||
| 1194 | - $layerdestino->set("tolerance",0); | ||
| 1195 | - $layeroverlay->queryByrect($this->mapa->extent); | ||
| 1196 | - $layerdestino->queryByFeatures($layeroverlay->index); | 1247 | + $shapesorigem = retornaShapesSelecionados($layerorigem,$this->arquivo,$this->mapa); |
| 1248 | + if(count($shapesorigem) == 0){ | ||
| 1249 | + return "erro"; | ||
| 1250 | + } | ||
| 1251 | + $layeroverlay->set("tolerance",0); | ||
| 1252 | + $layerdestino->set("tolerance",0); | ||
| 1253 | + $layeroverlay->queryByrect($this->mapa->extent); | ||
| 1254 | + $layerdestino->queryByFeatures($layeroverlay->index); | ||
| 1197 | 1255 | ||
| 1198 | - $sopen = $layerdestino->open(); | ||
| 1199 | - if($sopen == MS_FAILURE){return "erro";} | ||
| 1200 | - $res_count = $layerdestino->getNumresults(); | 1256 | + $sopen = $layerdestino->open(); |
| 1257 | + if($sopen == MS_FAILURE){ | ||
| 1258 | + return "erro"; | ||
| 1259 | + } | ||
| 1260 | + $res_count = $layerdestino->getNumresults(); | ||
| 1201 | 1261 | ||
| 1202 | - for ($i = 0; $i < $res_count; ++$i) | ||
| 1203 | - { | ||
| 1204 | - if($this->v == 6) | ||
| 1205 | - {$shapesdestino[] = $layerdestino->getShape($layerdestino->getResult($i));} | ||
| 1206 | - else{ | ||
| 1207 | - $result = $layerdestino->getResult($i); | ||
| 1208 | - $shp_index = $result->shapeindex; | ||
| 1209 | - $shapesdestino[] = $layerdestino->getshape(-1, $shp_index); | 1262 | + for ($i = 0; $i < $res_count; ++$i) |
| 1263 | + { | ||
| 1264 | + if($this->v == 6) | ||
| 1265 | + { | ||
| 1266 | + $shapesdestino[] = $layerdestino->getShape($layerdestino->getResult($i)); | ||
| 1267 | + } | ||
| 1268 | + else{ | ||
| 1269 | + $result = $layerdestino->getResult($i); | ||
| 1270 | + $shp_index = $result->shapeindex; | ||
| 1271 | + $shapesdestino[] = $layerdestino->getshape(-1, $shp_index); | ||
| 1272 | + } | ||
| 1273 | + } | ||
| 1274 | + $layerdestino->close(); | ||
| 1275 | + $rect = $this->mapa->extent; | ||
| 1276 | + $projInObj = $layerorigem->getProjection(); | ||
| 1277 | + if ($projInObj == "") | ||
| 1278 | + { | ||
| 1279 | + $projInObj = ms_newprojectionobj("proj=latlong"); | ||
| 1280 | + } | ||
| 1281 | + $projOutObj = ms_newprojectionobj("proj=poly,ellps=GRS67,lat_0=".$rect->miny.",lon_0=".$rect->minx.",x_0=5000000,y_0=10000000"); | ||
| 1282 | + $origemdestino = array(); | ||
| 1283 | + if (count($shapesorigem)==0){ | ||
| 1284 | + return "erro"; | ||
| 1285 | + } | ||
| 1286 | + if (count($shapesdestino)==0){ | ||
| 1287 | + return "erro"; | ||
| 1288 | + } | ||
| 1289 | + $novoshpf = ms_newShapefileObj($nomeshp, MS_SHP_ARC); | ||
| 1290 | + // cria o dbf | ||
| 1291 | + $def[] = array("dist_m","N","10","2"); | ||
| 1292 | + $def[] = array("origem","C","255"); | ||
| 1293 | + $def[] = array("destino","C","255"); | ||
| 1294 | + if($this->dbaseExiste == false) | ||
| 1295 | + { | ||
| 1296 | + $db = xbase_create($nomeshp.".dbf", $def);xbase_close($db); | ||
| 1210 | } | 1297 | } |
| 1211 | - } | ||
| 1212 | - $layerdestino->close(); | ||
| 1213 | - $rect = $this->mapa->extent; | ||
| 1214 | - $projInObj = $layerorigem->getProjection(); | ||
| 1215 | - if ($projInObj == "") | ||
| 1216 | - {$projInObj = ms_newprojectionobj("proj=latlong");} | ||
| 1217 | - $projOutObj = ms_newprojectionobj("proj=poly,ellps=GRS67,lat_0=".$rect->miny.",lon_0=".$rect->minx.",x_0=5000000,y_0=10000000"); | ||
| 1218 | - $origemdestino = array(); | ||
| 1219 | - if (count($shapesorigem)==0){return "erro";} | ||
| 1220 | - if (count($shapesdestino)==0){return "erro";} | ||
| 1221 | - $novoshpf = ms_newShapefileObj($nomeshp, MS_SHP_ARC); | ||
| 1222 | - // cria o dbf | ||
| 1223 | - $def[] = array("dist_m","N","10","2"); | ||
| 1224 | - $def[] = array("origem","C","255"); | ||
| 1225 | - $def[] = array("destino","C","255"); | ||
| 1226 | - if($this->dbaseExiste == false) | ||
| 1227 | - {$db = xbase_create($nomeshp.".dbf", $def);xbase_close($db);} | ||
| 1228 | - else | ||
| 1229 | - {$db = dbase_create($nomeshp.".dbf", $def);dbase_close($db);} | ||
| 1230 | - //acrescenta os pontos no novo shapefile | ||
| 1231 | - $dbname = $nomeshp.".dbf"; | ||
| 1232 | - if($this->dbaseExiste == false) | ||
| 1233 | - $db=xbase_open($dbname,2); | ||
| 1234 | - else | ||
| 1235 | - $db=dbase_open($dbname,2); | ||
| 1236 | - foreach ($shapesorigem as $sorigem) | ||
| 1237 | - { | ||
| 1238 | - if($itemorigem != "") | ||
| 1239 | - {$valororigem = $sorigem->values[$itemorigem];} | ||
| 1240 | else | 1298 | else |
| 1241 | - {$valororigem = "";} | ||
| 1242 | - foreach ($shapesdestino as $sdestino) | ||
| 1243 | - { | ||
| 1244 | - $linha = ms_newLineObj(); | ||
| 1245 | - $linha->add($sorigem->getCentroid()); | ||
| 1246 | - $linha->add($sdestino->getCentroid()); | ||
| 1247 | - if($itemdestino != "") | ||
| 1248 | - {$valordestino = $sdestino->values[$itemdestino];} | ||
| 1249 | - else | ||
| 1250 | - {$valordestino = "";} | ||
| 1251 | - $ShapeObj = ms_newShapeObj(MS_SHAPE_LINE); | ||
| 1252 | - $ShapeObj->add($linha); | ||
| 1253 | - $novoshpf->addShape($ShapeObj); | ||
| 1254 | - $ShapeObj->project($projInObj, $projOutObj); | ||
| 1255 | - $distancia = $ShapeObj->getLength(); | ||
| 1256 | - $registro = array($distancia,$valororigem,$valordestino); | ||
| 1257 | - if($this->dbaseExiste == false) | ||
| 1258 | - xbase_add_record($db,$registro); | 1299 | + {$db = dbase_create($nomeshp.".dbf", $def);dbase_close($db); |
| 1300 | + } | ||
| 1301 | + //acrescenta os pontos no novo shapefile | ||
| 1302 | + $dbname = $nomeshp.".dbf"; | ||
| 1303 | + if($this->dbaseExiste == false) | ||
| 1304 | + $db=xbase_open($dbname,2); | ||
| 1305 | + else | ||
| 1306 | + $db=dbase_open($dbname,2); | ||
| 1307 | + foreach ($shapesorigem as $sorigem) | ||
| 1308 | + { | ||
| 1309 | + if($itemorigem != "") | ||
| 1310 | + { | ||
| 1311 | + $valororigem = $sorigem->values[$itemorigem]; | ||
| 1312 | + } | ||
| 1259 | else | 1313 | else |
| 1260 | - dbase_add_record($db,$registro); | 1314 | + {$valororigem = ""; |
| 1315 | + } | ||
| 1316 | + foreach ($shapesdestino as $sdestino) | ||
| 1317 | + { | ||
| 1318 | + $linha = ms_newLineObj(); | ||
| 1319 | + $linha->add($sorigem->getCentroid()); | ||
| 1320 | + $linha->add($sdestino->getCentroid()); | ||
| 1321 | + if($itemdestino != "") | ||
| 1322 | + { | ||
| 1323 | + $valordestino = $sdestino->values[$itemdestino]; | ||
| 1324 | + } | ||
| 1325 | + else | ||
| 1326 | + {$valordestino = ""; | ||
| 1327 | + } | ||
| 1328 | + $ShapeObj = ms_newShapeObj(MS_SHAPE_LINE); | ||
| 1329 | + $ShapeObj->add($linha); | ||
| 1330 | + $novoshpf->addShape($ShapeObj); | ||
| 1331 | + $ShapeObj->project($projInObj, $projOutObj); | ||
| 1332 | + $distancia = $ShapeObj->getLength(); | ||
| 1333 | + $registro = array($distancia,$valororigem,$valordestino); | ||
| 1334 | + if($this->dbaseExiste == false) | ||
| 1335 | + xbase_add_record($db,$registro); | ||
| 1336 | + else | ||
| 1337 | + dbase_add_record($db,$registro); | ||
| 1338 | + } | ||
| 1339 | + } | ||
| 1340 | + if($this->dbaseExiste == false) | ||
| 1341 | + xbase_close($db); | ||
| 1342 | + else | ||
| 1343 | + dbase_close($db); | ||
| 1344 | + //adiciona no mapa atual o novo tema | ||
| 1345 | + $novolayer = criaLayer($this->mapa,MS_LAYER_LINE,MS_DEFAULT,("Distancias (".$nomefinal.")"),$metaClasse="SIM"); | ||
| 1346 | + $novolayer->set("data",$nomeshp.".shp"); | ||
| 1347 | + $novolayer->setmetadata("DOWNLOAD","SIM"); | ||
| 1348 | + $novolayer->set("template","none.htm"); | ||
| 1349 | + $classe = $novolayer->getclass(0); | ||
| 1350 | + $estilo = $classe->getstyle(0); | ||
| 1351 | + $estilo->set("symbolname","linha"); | ||
| 1352 | + $estilo->set("size",4); | ||
| 1353 | + $cor = $estilo->color; | ||
| 1354 | + $cor->setrgb(255,210,0); | ||
| 1355 | + //limpa selecao | ||
| 1356 | + if (file_exists($this->qyfile)) | ||
| 1357 | + { | ||
| 1358 | + unlink ($this->qyfile); | ||
| 1261 | } | 1359 | } |
| 1360 | + return($nomeshp.".shp"); | ||
| 1262 | } | 1361 | } |
| 1263 | - if($this->dbaseExiste == false) | ||
| 1264 | - xbase_close($db); | ||
| 1265 | - else | ||
| 1266 | - dbase_close($db); | ||
| 1267 | - //adiciona no mapa atual o novo tema | ||
| 1268 | - $novolayer = criaLayer($this->mapa,MS_LAYER_LINE,MS_DEFAULT,("Distancias (".$nomefinal.")"),$metaClasse="SIM"); | ||
| 1269 | - $novolayer->set("data",$nomeshp.".shp"); | ||
| 1270 | - $novolayer->setmetadata("DOWNLOAD","SIM"); | ||
| 1271 | - $novolayer->set("template","none.htm"); | ||
| 1272 | - $classe = $novolayer->getclass(0); | ||
| 1273 | - $estilo = $classe->getstyle(0); | ||
| 1274 | - $estilo->set("symbolname","linha"); | ||
| 1275 | - $estilo->set("size",4); | ||
| 1276 | - $cor = $estilo->color; | ||
| 1277 | - $cor->setrgb(255,210,0); | ||
| 1278 | - //limpa selecao | ||
| 1279 | - if (file_exists($this->qyfile)) | ||
| 1280 | - {unlink ($this->qyfile);} | ||
| 1281 | - return($nomeshp.".shp"); | ||
| 1282 | -} | ||
| 1283 | -/* | ||
| 1284 | -Function: criaBuffer | 1362 | + /* |
| 1363 | + Function: criaBuffer | ||
| 1285 | 1364 | ||
| 1286 | -Gera entorno (buffer) nos elementos selecionados de um tema. | 1365 | + Gera entorno (buffer) nos elementos selecionados de um tema. |
| 1287 | 1366 | ||
| 1288 | -Salva o mapa acrescentando um novo layer com o buffer. | 1367 | + Salva o mapa acrescentando um novo layer com o buffer. |
| 1289 | 1368 | ||
| 1290 | -Parametros: | 1369 | + Parametros: |
| 1291 | 1370 | ||
| 1292 | -$distancia - Distância em metros. | 1371 | + $distancia - Distância em metros. |
| 1293 | 1372 | ||
| 1294 | -$locaplic - Localização do I3geo. | 1373 | + $locaplic - Localização do I3geo. |
| 1295 | 1374 | ||
| 1296 | -$unir - sim|nao indica se os elementos selecionados deverão ser unidos em um só antes do buffer ser criado | 1375 | + $unir - sim|nao indica se os elementos selecionados deverão ser unidos em um s� antes do buffer ser criado |
| 1297 | 1376 | ||
| 1298 | -$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 | ||
| 1299 | -se o parâmetro "tema" não tiver sido fornecido ao construtor da classe | 1377 | + $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 |
| 1378 | + se o parâmetro "tema" não tiver sido fornecido ao construtor da classe | ||
| 1300 | 1379 | ||
| 1301 | -$multiplicar - (opcional) multiplicar os valores por | 1380 | + $multiplicar - (opcional) multiplicar os valores por |
| 1302 | 1381 | ||
| 1303 | -$itemdistancia - (opcional) coluna com os valores | 1382 | + $itemdistancia - (opcional) coluna com os valores |
| 1304 | 1383 | ||
| 1305 | -return: | 1384 | + return: |
| 1306 | 1385 | ||
| 1307 | -nome do layer criado com o buffer. | ||
| 1308 | -*/ | 1386 | + nome do layer criado com o buffer. |
| 1387 | + */ | ||
| 1309 | function criaBuffer($distancia,$locaplic,$unir="nao",$wkt="",$multiplicar=1,$itemdistancia="") | 1388 | function criaBuffer($distancia,$locaplic,$unir="nao",$wkt="",$multiplicar=1,$itemdistancia="") |
| 1310 | { | 1389 | { |
| 1311 | set_time_limit(180); | 1390 | set_time_limit(180); |
| 1312 | error_reporting(0); | 1391 | error_reporting(0); |
| 1313 | if($this->nome != "") | 1392 | if($this->nome != "") |
| 1314 | - {$items = pegaItens($this->layer);} | 1393 | + { |
| 1394 | + $items = pegaItens($this->layer); | ||
| 1395 | + } | ||
| 1315 | else | 1396 | else |
| 1316 | - {$items = array();} | 1397 | + {$items = array(); |
| 1398 | + } | ||
| 1317 | //para manipular dbf | 1399 | //para manipular dbf |
| 1318 | if($this->dbaseExiste == false){ | 1400 | if($this->dbaseExiste == false){ |
| 1319 | include_once dirname(__FILE__)."/../pacotes/phpxbase/api_conversion.php"; | 1401 | include_once dirname(__FILE__)."/../pacotes/phpxbase/api_conversion.php"; |
| @@ -1348,7 +1430,9 @@ nome do layer criado com o buffer. | @@ -1348,7 +1430,9 @@ nome do layer criado com o buffer. | ||
| 1348 | $dd2->setXY(($poPoint->x) + ($distancia * $multiplicar), $poPoint->y); | 1430 | $dd2->setXY(($poPoint->x) + ($distancia * $multiplicar), $poPoint->y); |
| 1349 | $dd2->project($projOutObj,$projInObj); | 1431 | $dd2->project($projOutObj,$projInObj); |
| 1350 | $d = $dd1->distanceToPoint($dd2); | 1432 | $d = $dd1->distanceToPoint($dd2); |
| 1351 | - if ($distancia < 0){$d = $d * -1;} | 1433 | + if ($distancia < 0){ |
| 1434 | + $d = $d * -1; | ||
| 1435 | + } | ||
| 1352 | //calcula a distancia 29100 | 1436 | //calcula a distancia 29100 |
| 1353 | //gera o buffer | 1437 | //gera o buffer |
| 1354 | $buffers[] = $shape->buffer($d); | 1438 | $buffers[] = $shape->buffer($d); |
| @@ -1359,7 +1443,9 @@ nome do layer criado com o buffer. | @@ -1359,7 +1443,9 @@ nome do layer criado com o buffer. | ||
| 1359 | if($unir == "sim"){ | 1443 | if($unir == "sim"){ |
| 1360 | $ns = $buffers[0]; | 1444 | $ns = $buffers[0]; |
| 1361 | for($s=1;$s < count($buffers);$s++) | 1445 | for($s=1;$s < count($buffers);$s++) |
| 1362 | - {$ns = $ns->union($buffers[$s]);} | 1446 | + { |
| 1447 | + $ns = $ns->union($buffers[$s]); | ||
| 1448 | + } | ||
| 1363 | $buffers = array($ns); | 1449 | $buffers = array($ns); |
| 1364 | $shapes = array($shapes[0]); | 1450 | $shapes = array($shapes[0]); |
| 1365 | } | 1451 | } |
| @@ -1370,31 +1456,36 @@ nome do layer criado com o buffer. | @@ -1370,31 +1456,36 @@ nome do layer criado com o buffer. | ||
| 1370 | $def = $this->criaDefDb($items); | 1456 | $def = $this->criaDefDb($items); |
| 1371 | $def[] = array("i3geo","C","254"); | 1457 | $def[] = array("i3geo","C","254"); |
| 1372 | if($this->dbaseExiste == false) | 1458 | if($this->dbaseExiste == false) |
| 1373 | - {$db = xbase_create($nomeshp.".dbf", $def);xbase_close($db);} | 1459 | + { |
| 1460 | + $db = xbase_create($nomeshp.".dbf", $def);xbase_close($db); | ||
| 1461 | + } | ||
| 1374 | else | 1462 | else |
| 1375 | - {$db = dbase_create($nomeshp.".dbf", $def);dbase_close($db);} | 1463 | + {$db = dbase_create($nomeshp.".dbf", $def);dbase_close($db); |
| 1464 | + } | ||
| 1376 | //acrescenta os pontos no novo shapefile | 1465 | //acrescenta os pontos no novo shapefile |
| 1377 | $dbname = $nomeshp.".dbf"; | 1466 | $dbname = $nomeshp.".dbf"; |
| 1378 | if($this->dbaseExiste == false) | 1467 | if($this->dbaseExiste == false) |
| 1379 | - $db=xbase_open($dbname,2); | 1468 | + $db=xbase_open($dbname,2); |
| 1380 | else | 1469 | else |
| 1381 | - $db=dbase_open($dbname,2); | 1470 | + $db=dbase_open($dbname,2); |
| 1382 | for($i = 0;$i < count($buffers);++$i) | 1471 | for($i = 0;$i < count($buffers);++$i) |
| 1383 | { | 1472 | { |
| 1384 | foreach ($items as $ni) | 1473 | foreach ($items as $ni) |
| 1385 | - {$reg[] = $this->truncaS($shapes[$i]->values[$ni]);} | 1474 | + { |
| 1475 | + $reg[] = $this->truncaS($shapes[$i]->values[$ni]); | ||
| 1476 | + } | ||
| 1386 | $reg[] = $i; | 1477 | $reg[] = $i; |
| 1387 | $novoshpf->addShape($buffers[$i]); | 1478 | $novoshpf->addShape($buffers[$i]); |
| 1388 | if($this->dbaseExiste == false) | 1479 | if($this->dbaseExiste == false) |
| 1389 | - xbase_add_record($db,$reg); | 1480 | + xbase_add_record($db,$reg); |
| 1390 | else | 1481 | else |
| 1391 | - dbase_add_record($db,$reg); | 1482 | + dbase_add_record($db,$reg); |
| 1392 | $reg = array(); | 1483 | $reg = array(); |
| 1393 | } | 1484 | } |
| 1394 | if($this->dbaseExiste == false) | 1485 | if($this->dbaseExiste == false) |
| 1395 | - xbase_close($db); | 1486 | + xbase_close($db); |
| 1396 | else | 1487 | else |
| 1397 | - dbase_close($db); | 1488 | + dbase_close($db); |
| 1398 | //adiciona no mapa atual o novo tema | 1489 | //adiciona no mapa atual o novo tema |
| 1399 | $novolayer = criaLayer($this->mapa,MS_LAYER_POLYGON,MS_DEFAULT,("Buffer (".$nomebuffer.")"),$metaClasse="SIM",false); | 1490 | $novolayer = criaLayer($this->mapa,MS_LAYER_POLYGON,MS_DEFAULT,("Buffer (".$nomebuffer.")"),$metaClasse="SIM",false); |
| 1400 | $novolayer->set("data",$nomeshp.".shp"); | 1491 | $novolayer->set("data",$nomeshp.".shp"); |
| @@ -1410,20 +1501,22 @@ nome do layer criado com o buffer. | @@ -1410,20 +1501,22 @@ nome do layer criado com o buffer. | ||
| 1410 | $coro->setrgb(255,0,0); | 1501 | $coro->setrgb(255,0,0); |
| 1411 | return($novolayer->name); | 1502 | return($novolayer->name); |
| 1412 | } | 1503 | } |
| 1413 | -/* | ||
| 1414 | -function: centroMassa | 1504 | + /* |
| 1505 | + function: centroMassa | ||
| 1415 | 1506 | ||
| 1416 | -Calcula o centro médio. | 1507 | + Calcula o centro médio. |
| 1417 | 1508 | ||
| 1418 | -Se "item" for diferente de vazio, calcula o centro médio ponderado baseado no item | 1509 | + Se "item" for diferente de vazio, calcula o centro médio ponderado baseado no item |
| 1419 | 1510 | ||
| 1420 | -Parametros: | 1511 | + Parametros: |
| 1421 | 1512 | ||
| 1422 | -$item {string} - (opcional) Item q será utilizado para ponderar os valores. | ||
| 1423 | -*/ | 1513 | + $item {string} - (opcional) Item q será utilizado para ponderar os valores. |
| 1514 | + */ | ||
| 1424 | function centroMassa($item="") | 1515 | function centroMassa($item="") |
| 1425 | { | 1516 | { |
| 1426 | - if(!$this->layer){return "erro";} | 1517 | + if(!$this->layer){ |
| 1518 | + return "erro"; | ||
| 1519 | + } | ||
| 1427 | set_time_limit(180); | 1520 | set_time_limit(180); |
| 1428 | //para manipular dbf | 1521 | //para manipular dbf |
| 1429 | if($this->dbaseExiste == false){ | 1522 | if($this->dbaseExiste == false){ |
| @@ -1442,7 +1535,9 @@ $item {string} - (opcional) Item q ser&aacute; utilizado para ponderar os valore | @@ -1442,7 +1535,9 @@ $item {string} - (opcional) Item q ser&aacute; utilizado para ponderar os valore | ||
| 1442 | $ys = 0; | 1535 | $ys = 0; |
| 1443 | foreach($lshapes as $shape){ | 1536 | foreach($lshapes as $shape){ |
| 1444 | if($item != "") | 1537 | if($item != "") |
| 1445 | - {$pondera = $shape->values[$item];} | 1538 | + { |
| 1539 | + $pondera = $shape->values[$item]; | ||
| 1540 | + } | ||
| 1446 | $pt = $shape->line(0)->point(0); | 1541 | $pt = $shape->line(0)->point(0); |
| 1447 | $xs += ($pt->x * $pondera); | 1542 | $xs += ($pt->x * $pondera); |
| 1448 | $ys += ($pt->y * $pondera); | 1543 | $ys += ($pt->y * $pondera); |
| @@ -1453,15 +1548,18 @@ $item {string} - (opcional) Item q ser&aacute; utilizado para ponderar os valore | @@ -1453,15 +1548,18 @@ $item {string} - (opcional) Item q ser&aacute; utilizado para ponderar os valore | ||
| 1453 | // cria o dbf | 1548 | // cria o dbf |
| 1454 | $def[] = array("id","C","254"); | 1549 | $def[] = array("id","C","254"); |
| 1455 | if($this->dbaseExiste == false) | 1550 | if($this->dbaseExiste == false) |
| 1456 | - {$db = xbase_create($nomeshp.".dbf", $def);xbase_close($db);} | 1551 | + { |
| 1552 | + $db = xbase_create($nomeshp.".dbf", $def);xbase_close($db); | ||
| 1553 | + } | ||
| 1457 | else | 1554 | else |
| 1458 | - {$db = dbase_create($nomeshp.".dbf", $def);dbase_close($db);} | 1555 | + {$db = dbase_create($nomeshp.".dbf", $def);dbase_close($db); |
| 1556 | + } | ||
| 1459 | //acrescenta os pontos no novo shapefile | 1557 | //acrescenta os pontos no novo shapefile |
| 1460 | $dbname = $nomeshp.".dbf"; | 1558 | $dbname = $nomeshp.".dbf"; |
| 1461 | if($this->dbaseExiste == false) | 1559 | if($this->dbaseExiste == false) |
| 1462 | - $db=xbase_open($dbname,2); | 1560 | + $db=xbase_open($dbname,2); |
| 1463 | else | 1561 | else |
| 1464 | - $db=dbase_open($dbname,2); | 1562 | + $db=dbase_open($dbname,2); |
| 1465 | $reg[] = ""; | 1563 | $reg[] = ""; |
| 1466 | $res_count = count($lshapes); | 1564 | $res_count = count($lshapes); |
| 1467 | $shp = ms_newShapeObj(MS_SHP_POINT); | 1565 | $shp = ms_newShapeObj(MS_SHP_POINT); |
| @@ -1471,15 +1569,15 @@ $item {string} - (opcional) Item q ser&aacute; utilizado para ponderar os valore | @@ -1471,15 +1569,15 @@ $item {string} - (opcional) Item q ser&aacute; utilizado para ponderar os valore | ||
| 1471 | 1569 | ||
| 1472 | $novoshpf->addShape($shp); | 1570 | $novoshpf->addShape($shp); |
| 1473 | if($this->dbaseExiste == false) | 1571 | if($this->dbaseExiste == false) |
| 1474 | - xbase_add_record($db,$reg); | 1572 | + xbase_add_record($db,$reg); |
| 1475 | else | 1573 | else |
| 1476 | - dbase_add_record($db,$reg); | 1574 | + dbase_add_record($db,$reg); |
| 1477 | if($this->dbaseExiste == false) | 1575 | if($this->dbaseExiste == false) |
| 1478 | - xbase_close($db); | 1576 | + xbase_close($db); |
| 1479 | else | 1577 | else |
| 1480 | - dbase_close($db); | 1578 | + dbase_close($db); |
| 1481 | //adiciona no mapa atual o novo tema | 1579 | //adiciona no mapa atual o novo tema |
| 1482 | - $novolayer = criaLayer($this->mapa,MS_LAYER_POINT,MS_DEFAULT,("Centróide (".$nomeCentro.")"),$metaClasse="SIM"); | 1580 | + $novolayer = criaLayer($this->mapa,MS_LAYER_POINT,MS_DEFAULT,("Centr�ide (".$nomeCentro.")"),$metaClasse="SIM"); |
| 1483 | $novolayer->set("data",$nomeshp.".shp"); | 1581 | $novolayer->set("data",$nomeshp.".shp"); |
| 1484 | $novolayer->setmetadata("DOWNLOAD","SIM"); | 1582 | $novolayer->setmetadata("DOWNLOAD","SIM"); |
| 1485 | $novolayer->set("template","none.htm"); | 1583 | $novolayer->set("template","none.htm"); |
| @@ -1489,23 +1587,27 @@ $item {string} - (opcional) Item q ser&aacute; utilizado para ponderar os valore | @@ -1489,23 +1587,27 @@ $item {string} - (opcional) Item q ser&aacute; utilizado para ponderar os valore | ||
| 1489 | $estilo->set("size","14"); | 1587 | $estilo->set("size","14"); |
| 1490 | //limpa selecao | 1588 | //limpa selecao |
| 1491 | if (file_exists($this->qyfile)) | 1589 | if (file_exists($this->qyfile)) |
| 1492 | - {unlink ($this->qyfile);} | 1590 | + { |
| 1591 | + unlink ($this->qyfile); | ||
| 1592 | + } | ||
| 1493 | return("ok"); | 1593 | return("ok"); |
| 1494 | } | 1594 | } |
| 1495 | -/* | ||
| 1496 | -function: criaCentroide | 1595 | + /* |
| 1596 | + function: criaCentroide | ||
| 1497 | 1597 | ||
| 1498 | -Gera centroide dos elementos selecionados de um tema. | 1598 | + Gera centroide dos elementos selecionados de um tema. |
| 1499 | 1599 | ||
| 1500 | -Salva o mapa acrescentando um novo layer com os pontos. | 1600 | + Salva o mapa acrescentando um novo layer com os pontos. |
| 1501 | 1601 | ||
| 1502 | -Parametros: | 1602 | + Parametros: |
| 1503 | 1603 | ||
| 1504 | -$locaplic - Localização do I3geo. | ||
| 1505 | -*/ | 1604 | + $locaplic - Localização do I3geo. |
| 1605 | + */ | ||
| 1506 | function criaCentroide($locaplic) | 1606 | function criaCentroide($locaplic) |
| 1507 | { | 1607 | { |
| 1508 | - if(!$this->layer){return "erro";} | 1608 | + if(!$this->layer){ |
| 1609 | + return "erro"; | ||
| 1610 | + } | ||
| 1509 | $items = pegaItens($this->layer); | 1611 | $items = pegaItens($this->layer); |
| 1510 | set_time_limit(180); | 1612 | set_time_limit(180); |
| 1511 | //para manipular dbf | 1613 | //para manipular dbf |
| @@ -1528,63 +1630,70 @@ $locaplic - Localiza&ccedil;&atilde;o do I3geo. | @@ -1528,63 +1630,70 @@ $locaplic - Localiza&ccedil;&atilde;o do I3geo. | ||
| 1528 | // cria o dbf | 1630 | // cria o dbf |
| 1529 | $def = $this->criaDefDb($items); | 1631 | $def = $this->criaDefDb($items); |
| 1530 | if($this->dbaseExiste == false) | 1632 | if($this->dbaseExiste == false) |
| 1531 | - {$db = xbase_create($nomeshp.".dbf", $def);xbase_close($db);} | 1633 | + { |
| 1634 | + $db = xbase_create($nomeshp.".dbf", $def);xbase_close($db); | ||
| 1635 | + } | ||
| 1532 | else | 1636 | else |
| 1533 | - {$db = dbase_create($nomeshp.".dbf", $def);dbase_close($db);} | 1637 | + {$db = dbase_create($nomeshp.".dbf", $def);dbase_close($db); |
| 1638 | + } | ||
| 1534 | //acrescenta os pontos no novo shapefile | 1639 | //acrescenta os pontos no novo shapefile |
| 1535 | $dbname = $nomeshp.".dbf"; | 1640 | $dbname = $nomeshp.".dbf"; |
| 1536 | if($this->dbaseExiste == false) | 1641 | if($this->dbaseExiste == false) |
| 1537 | - $db=xbase_open($dbname,2); | 1642 | + $db=xbase_open($dbname,2); |
| 1538 | else | 1643 | else |
| 1539 | - $db=dbase_open($dbname,2); | 1644 | + $db=dbase_open($dbname,2); |
| 1540 | for($i = 0;$i < count($centroides);++$i) | 1645 | for($i = 0;$i < count($centroides);++$i) |
| 1541 | { | 1646 | { |
| 1542 | foreach ($items as $ni) | 1647 | foreach ($items as $ni) |
| 1543 | - {$reg[] = $this->truncaS($shapes[$i]->values[$ni]);} | 1648 | + { |
| 1649 | + $reg[] = $this->truncaS($shapes[$i]->values[$ni]); | ||
| 1650 | + } | ||
| 1544 | $novoshpf->addShape($centroides[$i]); | 1651 | $novoshpf->addShape($centroides[$i]); |
| 1545 | if($this->dbaseExiste == false) | 1652 | if($this->dbaseExiste == false) |
| 1546 | - xbase_add_record($db,$reg); | 1653 | + xbase_add_record($db,$reg); |
| 1547 | else | 1654 | else |
| 1548 | - dbase_add_record($db,$reg); | 1655 | + dbase_add_record($db,$reg); |
| 1549 | $reg = array(); | 1656 | $reg = array(); |
| 1550 | } | 1657 | } |
| 1551 | if($this->dbaseExiste == false) | 1658 | if($this->dbaseExiste == false) |
| 1552 | - xbase_close($db); | 1659 | + xbase_close($db); |
| 1553 | else | 1660 | else |
| 1554 | - dbase_close($db); | 1661 | + dbase_close($db); |
| 1555 | //adiciona no mapa atual o novo tema | 1662 | //adiciona no mapa atual o novo tema |
| 1556 | - $novolayer = criaLayer($this->mapa,MS_LAYER_POINT,MS_DEFAULT,("Centróide (".$nomeCentroides.")"),$metaClasse="SIM"); | 1663 | + $novolayer = criaLayer($this->mapa,MS_LAYER_POINT,MS_DEFAULT,("Centr�ide (".$nomeCentroides.")"),$metaClasse="SIM"); |
| 1557 | $novolayer->set("data",$nomeshp.".shp"); | 1664 | $novolayer->set("data",$nomeshp.".shp"); |
| 1558 | $novolayer->setmetadata("DOWNLOAD","SIM"); | 1665 | $novolayer->setmetadata("DOWNLOAD","SIM"); |
| 1559 | $novolayer->set("template","none.htm"); | 1666 | $novolayer->set("template","none.htm"); |
| 1560 | $novolayer->setmetadata("TEMALOCAL","SIM"); | 1667 | $novolayer->setmetadata("TEMALOCAL","SIM"); |
| 1561 | //limpa selecao | 1668 | //limpa selecao |
| 1562 | if (file_exists($this->qyfile)) | 1669 | if (file_exists($this->qyfile)) |
| 1563 | - {unlink ($this->qyfile);} | 1670 | + { |
| 1671 | + unlink ($this->qyfile); | ||
| 1672 | + } | ||
| 1564 | return("ok"); | 1673 | return("ok"); |
| 1565 | } | 1674 | } |
| 1566 | 1675 | ||
| 1567 | -/* | ||
| 1568 | -function: gradeDePontos | 1676 | + /* |
| 1677 | + function: gradeDePontos | ||
| 1569 | 1678 | ||
| 1570 | -Gera uma grade de pontos com espaçamento regular definido em décimos de grau. | 1679 | + Gera uma grade de pontos com espaçamento regular definido em décimos de grau. |
| 1571 | 1680 | ||
| 1572 | -Salva o mapa acrescentando um novo layer com a grade de coordenadas. | 1681 | + Salva o mapa acrescentando um novo layer com a grade de coordenadas. |
| 1573 | 1682 | ||
| 1574 | -$ddx - Espaçamento em x. | 1683 | + $ddx - Espaçamento em x. |
| 1575 | 1684 | ||
| 1576 | -$ddy - Espaçamento em y. | 1685 | + $ddy - Espaçamento em y. |
| 1577 | 1686 | ||
| 1578 | -$px - X do primeiro ponto (superior esquerdo) | 1687 | + $px - X do primeiro ponto (superior esquerdo) |
| 1579 | 1688 | ||
| 1580 | -$py - Y do primeiro ponto. | 1689 | + $py - Y do primeiro ponto. |
| 1581 | 1690 | ||
| 1582 | -$locaplic - Endereço da aplicação. | 1691 | + $locaplic - Endereço da aplicação. |
| 1583 | 1692 | ||
| 1584 | -$nptx - Número de pontos em X (opcional) | 1693 | + $nptx - Número de pontos em X (opcional) |
| 1585 | 1694 | ||
| 1586 | -$npty - Número de pontos em Y (opcional) | ||
| 1587 | -*/ | 1695 | + $npty - Número de pontos em Y (opcional) |
| 1696 | + */ | ||
| 1588 | function gradeDePontos($xdd,$ydd,$px,$py,$locaplic,$nptx,$npty,$proj=false) | 1697 | function gradeDePontos($xdd,$ydd,$px,$py,$locaplic,$nptx,$npty,$proj=false) |
| 1589 | { | 1698 | { |
| 1590 | set_time_limit(180); | 1699 | set_time_limit(180); |
| @@ -1619,27 +1728,38 @@ $npty - N&uacute;mero de pontos em Y (opcional) | @@ -1619,27 +1728,38 @@ $npty - N&uacute;mero de pontos em Y (opcional) | ||
| 1619 | //calcula a distância entre os pontos em dd | 1728 | //calcula a distância entre os pontos em dd |
| 1620 | $distx = $fx - $px; | 1729 | $distx = $fx - $px; |
| 1621 | $disty = $fy - $py; | 1730 | $disty = $fy - $py; |
| 1622 | - if ($distx < 0){$distx = $distx * -1;} | ||
| 1623 | - if ($disty < 0){$disty = $disty * -1;} | 1731 | + if ($distx < 0){ |
| 1732 | + $distx = $distx * -1; | ||
| 1733 | + } | ||
| 1734 | + if ($disty < 0){ | ||
| 1735 | + $disty = $disty * -1; | ||
| 1736 | + } | ||
| 1624 | if ($nptx == "") | 1737 | if ($nptx == "") |
| 1625 | - {$nptx = round(($distx / $xdd),0);} | 1738 | + { |
| 1739 | + $nptx = round(($distx / $xdd),0); | ||
| 1740 | + } | ||
| 1626 | if ($npty == "") | 1741 | if ($npty == "") |
| 1627 | - {$npty = round(($disty / $ydd),0);} | 1742 | + { |
| 1743 | + $npty = round(($disty / $ydd),0); | ||
| 1744 | + } | ||
| 1628 | // cria o shapefile | 1745 | // cria o shapefile |
| 1629 | $novoshpf = ms_newShapefileObj($nomeshp, MS_SHP_POINT); | 1746 | $novoshpf = ms_newShapefileObj($nomeshp, MS_SHP_POINT); |
| 1630 | $def = array(); | 1747 | $def = array(); |
| 1631 | $def[] = array("x","C","20"); | 1748 | $def[] = array("x","C","20"); |
| 1632 | $def[] = array("y","C","20"); | 1749 | $def[] = array("y","C","20"); |
| 1633 | if($this->dbaseExiste == false) | 1750 | if($this->dbaseExiste == false) |
| 1634 | - {$db = xbase_create($nomeshp.".dbf", $def);xbase_close($db);} | 1751 | + { |
| 1752 | + $db = xbase_create($nomeshp.".dbf", $def);xbase_close($db); | ||
| 1753 | + } | ||
| 1635 | else | 1754 | else |
| 1636 | - {$db = dbase_create($nomeshp.".dbf", $def);dbase_close($db);} | 1755 | + {$db = dbase_create($nomeshp.".dbf", $def);dbase_close($db); |
| 1756 | + } | ||
| 1637 | //acrescenta os pontos no novo shapefile | 1757 | //acrescenta os pontos no novo shapefile |
| 1638 | $dbname = $nomeshp.".dbf"; | 1758 | $dbname = $nomeshp.".dbf"; |
| 1639 | if($this->dbaseExiste == false) | 1759 | if($this->dbaseExiste == false) |
| 1640 | - $db=xbase_open($dbname,2); | 1760 | + $db=xbase_open($dbname,2); |
| 1641 | else | 1761 | else |
| 1642 | - $db=dbase_open($dbname,2); | 1762 | + $db=dbase_open($dbname,2); |
| 1643 | $reg = array(); | 1763 | $reg = array(); |
| 1644 | $valorcoluna = $px; | 1764 | $valorcoluna = $px; |
| 1645 | for ($coluna = 0; $coluna < $nptx; $coluna++) | 1765 | for ($coluna = 0; $coluna < $nptx; $coluna++) |
| @@ -1659,49 +1779,51 @@ $npty - N&uacute;mero de pontos em Y (opcional) | @@ -1659,49 +1779,51 @@ $npty - N&uacute;mero de pontos em Y (opcional) | ||
| 1659 | $reg[] = $x; | 1779 | $reg[] = $x; |
| 1660 | $reg[] = $y; | 1780 | $reg[] = $y; |
| 1661 | if($this->dbaseExiste == false) | 1781 | if($this->dbaseExiste == false) |
| 1662 | - xbase_add_record($db,$reg); | 1782 | + xbase_add_record($db,$reg); |
| 1663 | else | 1783 | else |
| 1664 | - dbase_add_record($db,$reg); | 1784 | + dbase_add_record($db,$reg); |
| 1665 | $reg = array(); | 1785 | $reg = array(); |
| 1666 | } | 1786 | } |
| 1667 | $valorcoluna = $valorcoluna + $xdd; | 1787 | $valorcoluna = $valorcoluna + $xdd; |
| 1668 | } | 1788 | } |
| 1669 | if($this->dbaseExiste == false) | 1789 | if($this->dbaseExiste == false) |
| 1670 | - xbase_close($db); | 1790 | + xbase_close($db); |
| 1671 | else | 1791 | else |
| 1672 | - dbase_close($db); | 1792 | + dbase_close($db); |
| 1673 | //adiciona o novo tema no mapa | 1793 | //adiciona o novo tema no mapa |
| 1674 | $novolayer = criaLayer($this->mapa,MS_LAYER_POINT,MS_DEFAULT,("Grade (".$nomegrade.")"),$metaClasse="SIM"); | 1794 | $novolayer = criaLayer($this->mapa,MS_LAYER_POINT,MS_DEFAULT,("Grade (".$nomegrade.")"),$metaClasse="SIM"); |
| 1675 | $novolayer->set("data",$nomeshp.".shp"); | 1795 | $novolayer->set("data",$nomeshp.".shp"); |
| 1676 | $novolayer->setmetadata("DOWNLOAD","SIM"); | 1796 | $novolayer->setmetadata("DOWNLOAD","SIM"); |
| 1677 | $novolayer->setmetadata("TEMALOCAL","SIM"); | 1797 | $novolayer->setmetadata("TEMALOCAL","SIM"); |
| 1678 | if (file_exists($this->qyfile)) | 1798 | if (file_exists($this->qyfile)) |
| 1679 | - {unlink ($this->qyfile);} | 1799 | + { |
| 1800 | + unlink ($this->qyfile); | ||
| 1801 | + } | ||
| 1680 | return("ok"); | 1802 | return("ok"); |
| 1681 | } | 1803 | } |
| 1682 | -/* | ||
| 1683 | -function: gradeDePol | 1804 | + /* |
| 1805 | + function: gradeDePol | ||
| 1684 | 1806 | ||
| 1685 | -Gera uma grade de polígonos com espaçamento regular definido em décimos de grau. | 1807 | + Gera uma grade de polígonos com espaçamento regular definido em décimos de grau. |
| 1686 | 1808 | ||
| 1687 | -Salva o mapa acrescentando um novo layer com a grade. | 1809 | + Salva o mapa acrescentando um novo layer com a grade. |
| 1688 | 1810 | ||
| 1689 | -parameters: | 1811 | + parameters: |
| 1690 | 1812 | ||
| 1691 | -$xdd - Espaçamento em x. | 1813 | + $xdd - Espaçamento em x. |
| 1692 | 1814 | ||
| 1693 | -$ydd - Espaçamento em y. | 1815 | + $ydd - Espaçamento em y. |
| 1694 | 1816 | ||
| 1695 | -$x - X do primeiro ponto (superior esquerdo) | 1817 | + $x - X do primeiro ponto (superior esquerdo) |
| 1696 | 1818 | ||
| 1697 | -$y - Y do primeiro ponto. | 1819 | + $y - Y do primeiro ponto. |
| 1698 | 1820 | ||
| 1699 | -$locaplic - Endereço da aplicação. | 1821 | + $locaplic - Endereço da aplicação. |
| 1700 | 1822 | ||
| 1701 | -$nptx - Número de pontos em X (opcional) | 1823 | + $nptx - Número de pontos em X (opcional) |
| 1702 | 1824 | ||
| 1703 | -$npty - Número de pontos em Y (opcional) | ||
| 1704 | -*/ | 1825 | + $npty - Número de pontos em Y (opcional) |
| 1826 | + */ | ||
| 1705 | function gradeDePol($xdd,$ydd,$px,$py,$locaplic,$nptx,$npty,$proj=false) | 1827 | function gradeDePol($xdd,$ydd,$px,$py,$locaplic,$nptx,$npty,$proj=false) |
| 1706 | { | 1828 | { |
| 1707 | set_time_limit(180); | 1829 | set_time_limit(180); |
| @@ -1736,26 +1858,37 @@ $npty - N&uacute;mero de pontos em Y (opcional) | @@ -1736,26 +1858,37 @@ $npty - N&uacute;mero de pontos em Y (opcional) | ||
| 1736 | //calcula a distância entre os pontos em dd | 1858 | //calcula a distância entre os pontos em dd |
| 1737 | $distx = $fx - $px; | 1859 | $distx = $fx - $px; |
| 1738 | $disty = $fy - $py; | 1860 | $disty = $fy - $py; |
| 1739 | - if ($distx < 0){$distx = $distx * -1;} | ||
| 1740 | - if ($disty < 0){$disty = $disty * -1;} | 1861 | + if ($distx < 0){ |
| 1862 | + $distx = $distx * -1; | ||
| 1863 | + } | ||
| 1864 | + if ($disty < 0){ | ||
| 1865 | + $disty = $disty * -1; | ||
| 1866 | + } | ||
| 1741 | if ($nptx == "") | 1867 | if ($nptx == "") |
| 1742 | - {$nptx = round(($distx / $xdd),0);} | 1868 | + { |
| 1869 | + $nptx = round(($distx / $xdd),0); | ||
| 1870 | + } | ||
| 1743 | if ($npty == "") | 1871 | if ($npty == "") |
| 1744 | - {$npty = round(($disty / $ydd),0);} | 1872 | + { |
| 1873 | + $npty = round(($disty / $ydd),0); | ||
| 1874 | + } | ||
| 1745 | // cria o shapefile | 1875 | // cria o shapefile |
| 1746 | $novoshpf = ms_newShapefileObj($nomeshp, MS_SHP_POLYGON); | 1876 | $novoshpf = ms_newShapefileObj($nomeshp, MS_SHP_POLYGON); |
| 1747 | $def = array(); | 1877 | $def = array(); |
| 1748 | $def[] = array("id","C","20"); | 1878 | $def[] = array("id","C","20"); |
| 1749 | if($this->dbaseExiste == false) | 1879 | if($this->dbaseExiste == false) |
| 1750 | - {$db = xbase_create($nomeshp.".dbf", $def);xbase_close($db);} | 1880 | + { |
| 1881 | + $db = xbase_create($nomeshp.".dbf", $def);xbase_close($db); | ||
| 1882 | + } | ||
| 1751 | else | 1883 | else |
| 1752 | - {$db = dbase_create($nomeshp.".dbf", $def);dbase_close($db);} | 1884 | + {$db = dbase_create($nomeshp.".dbf", $def);dbase_close($db); |
| 1885 | + } | ||
| 1753 | //acrescenta os pontos no novo shapefile | 1886 | //acrescenta os pontos no novo shapefile |
| 1754 | $dbname = $nomeshp.".dbf"; | 1887 | $dbname = $nomeshp.".dbf"; |
| 1755 | if($this->dbaseExiste == false) | 1888 | if($this->dbaseExiste == false) |
| 1756 | - $db=xbase_open($dbname,2); | 1889 | + $db=xbase_open($dbname,2); |
| 1757 | else | 1890 | else |
| 1758 | - $db=dbase_open($dbname,2); | 1891 | + $db=dbase_open($dbname,2); |
| 1759 | $reg = array(); | 1892 | $reg = array(); |
| 1760 | $valorcoluna = $px; | 1893 | $valorcoluna = $px; |
| 1761 | for ($coluna = 0; $coluna < $nptx; $coluna++){ | 1894 | for ($coluna = 0; $coluna < $nptx; $coluna++){ |
| @@ -1791,17 +1924,17 @@ $npty - N&uacute;mero de pontos em Y (opcional) | @@ -1791,17 +1924,17 @@ $npty - N&uacute;mero de pontos em Y (opcional) | ||
| 1791 | $novoshpf->addShape($shapen); | 1924 | $novoshpf->addShape($shapen); |
| 1792 | $reg[] = $linha."-".$coluna; | 1925 | $reg[] = $linha."-".$coluna; |
| 1793 | if($this->dbaseExiste == false) | 1926 | if($this->dbaseExiste == false) |
| 1794 | - xbase_add_record($db,$reg); | 1927 | + xbase_add_record($db,$reg); |
| 1795 | else | 1928 | else |
| 1796 | - dbase_add_record($db,$reg); | 1929 | + dbase_add_record($db,$reg); |
| 1797 | $reg = array(); | 1930 | $reg = array(); |
| 1798 | } | 1931 | } |
| 1799 | - $valorcoluna = $valorcoluna + $xdd; | 1932 | + $valorcoluna = $valorcoluna + $xdd; |
| 1800 | } | 1933 | } |
| 1801 | if($this->dbaseExiste == false) | 1934 | if($this->dbaseExiste == false) |
| 1802 | - xbase_close($db); | 1935 | + xbase_close($db); |
| 1803 | else | 1936 | else |
| 1804 | - dbase_close($db); | 1937 | + dbase_close($db); |
| 1805 | //adiciona o novo tema no mapa | 1938 | //adiciona o novo tema no mapa |
| 1806 | $novolayer = criaLayer($this->mapa,MS_LAYER_POLYGON,MS_DEFAULT,("Grade (".$nomegrade.")"),$metaClasse="SIM"); | 1939 | $novolayer = criaLayer($this->mapa,MS_LAYER_POLYGON,MS_DEFAULT,("Grade (".$nomegrade.")"),$metaClasse="SIM"); |
| 1807 | $novolayer->set("data",$nomeshp.".shp"); | 1940 | $novolayer->set("data",$nomeshp.".shp"); |
| @@ -1809,11 +1942,13 @@ $npty - N&uacute;mero de pontos em Y (opcional) | @@ -1809,11 +1942,13 @@ $npty - N&uacute;mero de pontos em Y (opcional) | ||
| 1809 | $novolayer->setmetadata("TEMALOCAL","SIM"); | 1942 | $novolayer->setmetadata("TEMALOCAL","SIM"); |
| 1810 | $novolayer->set("opacity","50"); | 1943 | $novolayer->set("opacity","50"); |
| 1811 | if (file_exists($this->qyfile)) | 1944 | if (file_exists($this->qyfile)) |
| 1812 | - {unlink ($this->qyfile);} | 1945 | + { |
| 1946 | + unlink ($this->qyfile); | ||
| 1947 | + } | ||
| 1813 | return("ok"); | 1948 | return("ok"); |
| 1814 | } | 1949 | } |
| 1815 | /* | 1950 | /* |
| 1816 | - function: gradeDeHex | 1951 | + function: gradeDeHex |
| 1817 | 1952 | ||
| 1818 | Gera uma grade de polígonos hexagonais regulares definido em décimos de grau. | 1953 | Gera uma grade de polígonos hexagonais regulares definido em décimos de grau. |
| 1819 | 1954 | ||
| @@ -1873,20 +2008,31 @@ $npty - N&uacute;mero de pontos em Y (opcional) | @@ -1873,20 +2008,31 @@ $npty - N&uacute;mero de pontos em Y (opcional) | ||
| 1873 | //calcula a distância entre os pontos em dd se nao tiver sido especificada ou for 0 | 2008 | //calcula a distância entre os pontos em dd se nao tiver sido especificada ou for 0 |
| 1874 | $distx = $fx - $px; | 2009 | $distx = $fx - $px; |
| 1875 | $disty = $fy - $py; | 2010 | $disty = $fy - $py; |
| 1876 | - if ($distx < 0){$distx = $distx * -1;} | ||
| 1877 | - if ($disty < 0){$disty = $disty * -1;} | 2011 | + if ($distx < 0){ |
| 2012 | + $distx = $distx * -1; | ||
| 2013 | + } | ||
| 2014 | + if ($disty < 0){ | ||
| 2015 | + $disty = $disty * -1; | ||
| 2016 | + } | ||
| 1878 | if ($nptx == "") | 2017 | if ($nptx == "") |
| 1879 | - {$nptx = round(($distx / $dd),0);} | 2018 | + { |
| 2019 | + $nptx = round(($distx / $dd),0); | ||
| 2020 | + } | ||
| 1880 | if ($npty == "") | 2021 | if ($npty == "") |
| 1881 | - {$npty = round(($disty / $dd),0);} | 2022 | + { |
| 2023 | + $npty = round(($disty / $dd),0); | ||
| 2024 | + } | ||
| 1882 | // cria o shapefile | 2025 | // cria o shapefile |
| 1883 | $novoshpf = ms_newShapefileObj($nomeshp, MS_SHP_POLYGON); | 2026 | $novoshpf = ms_newShapefileObj($nomeshp, MS_SHP_POLYGON); |
| 1884 | $def = array(); | 2027 | $def = array(); |
| 1885 | $def[] = array("id","C","20"); | 2028 | $def[] = array("id","C","20"); |
| 1886 | if($this->dbaseExiste == false) | 2029 | if($this->dbaseExiste == false) |
| 1887 | - {$db = xbase_create($nomeshp.".dbf", $def);xbase_close($db);} | 2030 | + { |
| 2031 | + $db = xbase_create($nomeshp.".dbf", $def);xbase_close($db); | ||
| 2032 | + } | ||
| 1888 | else | 2033 | else |
| 1889 | - {$db = dbase_create($nomeshp.".dbf", $def);dbase_close($db);} | 2034 | + {$db = dbase_create($nomeshp.".dbf", $def);dbase_close($db); |
| 2035 | + } | ||
| 1890 | //acrescenta os pontos no novo shapefile | 2036 | //acrescenta os pontos no novo shapefile |
| 1891 | $dbname = $nomeshp.".dbf"; | 2037 | $dbname = $nomeshp.".dbf"; |
| 1892 | if($this->dbaseExiste == false) | 2038 | if($this->dbaseExiste == false) |
| @@ -1978,24 +2124,25 @@ $npty - N&uacute;mero de pontos em Y (opcional) | @@ -1978,24 +2124,25 @@ $npty - N&uacute;mero de pontos em Y (opcional) | ||
| 1978 | $novolayer->setmetadata("TEMALOCAL","SIM"); | 2124 | $novolayer->setmetadata("TEMALOCAL","SIM"); |
| 1979 | $novolayer->set("opacity","50"); | 2125 | $novolayer->set("opacity","50"); |
| 1980 | if (file_exists($this->qyfile)) | 2126 | if (file_exists($this->qyfile)) |
| 1981 | - {unlink ($this->qyfile);} | ||
| 1982 | - return("ok"); | ||
| 1983 | - | 2127 | + { |
| 2128 | + unlink ($this->qyfile); | ||
| 2129 | + } | ||
| 2130 | + return("ok"); | ||
| 1984 | } | 2131 | } |
| 1985 | -/* | ||
| 1986 | -function: nptPol | 2132 | + /* |
| 2133 | + function: nptPol | ||
| 1987 | 2134 | ||
| 1988 | -Conta o número de pontos em polígono cruzando dois temas. | 2135 | + Conta o número de pontos em polígono cruzando dois temas. |
| 1989 | 2136 | ||
| 1990 | -Salva o mapa acrescentando um novo layer com o resultado. | 2137 | + Salva o mapa acrescentando um novo layer com o resultado. |
| 1991 | 2138 | ||
| 1992 | -parameters: | ||
| 1993 | -$temaPt - Tema de pontos. | 2139 | + parameters: |
| 2140 | + $temaPt - Tema de pontos. | ||
| 1994 | 2141 | ||
| 1995 | -$temaPo - Tema poligonal. | 2142 | + $temaPo - Tema poligonal. |
| 1996 | 2143 | ||
| 1997 | -$locaplic - Localização do I3geo | ||
| 1998 | -*/ | 2144 | + $locaplic - Localização do I3geo |
| 2145 | + */ | ||
| 1999 | function nptPol($temaPt,$temaPo,$locaplic,$somaritem="") | 2146 | function nptPol($temaPt,$temaPo,$locaplic,$somaritem="") |
| 2000 | { | 2147 | { |
| 2001 | //error_reporting(0); | 2148 | //error_reporting(0); |
| @@ -2093,19 +2240,23 @@ $locaplic - Localiza&ccedil;&atilde;o do I3geo | @@ -2093,19 +2240,23 @@ $locaplic - Localiza&ccedil;&atilde;o do I3geo | ||
| 2093 | } | 2240 | } |
| 2094 | return("ok"); | 2241 | return("ok"); |
| 2095 | } | 2242 | } |
| 2096 | -/* | ||
| 2097 | -Function: agrupaElementos | 2243 | + /* |
| 2244 | + Function: agrupaElementos | ||
| 2098 | 2245 | ||
| 2099 | -Agrupa elementos em um polígono. | 2246 | + Agrupa elementos em um polígono. |
| 2100 | 2247 | ||
| 2101 | -Salva o mapa acrescentando um novo layer com o resultado. | ||
| 2102 | -*/ | 2248 | + Salva o mapa acrescentando um novo layer com o resultado. |
| 2249 | + */ | ||
| 2103 | function agrupaElementos($item,$locaplic) | 2250 | function agrupaElementos($item,$locaplic) |
| 2104 | { | 2251 | { |
| 2105 | - if(!$this->layer){return "erro";} | 2252 | + if(!$this->layer){ |
| 2253 | + return "erro"; | ||
| 2254 | + } | ||
| 2106 | set_time_limit(180); | 2255 | set_time_limit(180); |
| 2107 | //para manipular dbf | 2256 | //para manipular dbf |
| 2108 | - if(!isset($item)){$item="";} | 2257 | + if(!isset($item)){ |
| 2258 | + $item=""; | ||
| 2259 | + } | ||
| 2109 | if($this->dbaseExiste == false){ | 2260 | if($this->dbaseExiste == false){ |
| 2110 | include_once dirname(__FILE__)."/../pacotes/phpxbase/api_conversion.php"; | 2261 | include_once dirname(__FILE__)."/../pacotes/phpxbase/api_conversion.php"; |
| 2111 | } | 2262 | } |
| @@ -2113,25 +2264,30 @@ Salva o mapa acrescentando um novo layer com o resultado. | @@ -2113,25 +2264,30 @@ Salva o mapa acrescentando um novo layer com o resultado. | ||
| 2113 | $indices = array(); | 2264 | $indices = array(); |
| 2114 | foreach($shapes as $shape){ | 2265 | foreach($shapes as $shape){ |
| 2115 | if($item != "") | 2266 | if($item != "") |
| 2116 | - {$valor = $shape->values[$item];} | 2267 | + { |
| 2268 | + $valor = $shape->values[$item]; | ||
| 2269 | + } | ||
| 2117 | else | 2270 | else |
| 2118 | - {$valor = "nenhum";} | 2271 | + {$valor = "nenhum"; |
| 2272 | + } | ||
| 2119 | if(!isset($indices[$valor])){ | 2273 | if(!isset($indices[$valor])){ |
| 2120 | $indices[$valor] = array($shape); | 2274 | $indices[$valor] = array($shape); |
| 2121 | } | 2275 | } |
| 2122 | else | 2276 | else |
| 2123 | - $indices[$valor] = array_merge($indices[$valor],array($shape)); | 2277 | + $indices[$valor] = array_merge($indices[$valor],array($shape)); |
| 2124 | } | 2278 | } |
| 2125 | $dissolve=array(); | 2279 | $dissolve=array(); |
| 2126 | foreach($indices as $shapes) | 2280 | foreach($indices as $shapes) |
| 2127 | { | 2281 | { |
| 2128 | foreach($shapes as $shape){ | 2282 | foreach($shapes as $shape){ |
| 2129 | if($item != "") | 2283 | if($item != "") |
| 2130 | - $valor = $shape->values[$item]; | 2284 | + $valor = $shape->values[$item]; |
| 2131 | else | 2285 | else |
| 2132 | - $valor = "nenhum"; | 2286 | + $valor = "nenhum"; |
| 2133 | if (!isset($dissolve[$valor])) | 2287 | if (!isset($dissolve[$valor])) |
| 2134 | - {$dissolve[$valor] = $shape;} | 2288 | + { |
| 2289 | + $dissolve[$valor] = $shape; | ||
| 2290 | + } | ||
| 2135 | else | 2291 | else |
| 2136 | { | 2292 | { |
| 2137 | $tipo = $shape->type; | 2293 | $tipo = $shape->type; |
| @@ -2160,31 +2316,36 @@ Salva o mapa acrescentando um novo layer com o resultado. | @@ -2160,31 +2316,36 @@ Salva o mapa acrescentando um novo layer com o resultado. | ||
| 2160 | $novoshpf = ms_newShapefileObj($nomeshp, MS_SHP_POLYGON); | 2316 | $novoshpf = ms_newShapefileObj($nomeshp, MS_SHP_POLYGON); |
| 2161 | // cria o dbf | 2317 | // cria o dbf |
| 2162 | $def = array(); | 2318 | $def = array(); |
| 2163 | - if($item==""){$item="nenhum";} | 2319 | + if($item==""){ |
| 2320 | + $item="nenhum"; | ||
| 2321 | + } | ||
| 2164 | $def[] = array($item,"C","254"); | 2322 | $def[] = array($item,"C","254"); |
| 2165 | if($this->dbaseExiste == false) | 2323 | if($this->dbaseExiste == false) |
| 2166 | - {$db = xbase_create($nomeshp.".dbf", $def);xbase_close($db);} | 2324 | + { |
| 2325 | + $db = xbase_create($nomeshp.".dbf", $def);xbase_close($db); | ||
| 2326 | + } | ||
| 2167 | else | 2327 | else |
| 2168 | - {$db = dbase_create($nomeshp.".dbf", $def);dbase_close($db);} | 2328 | + {$db = dbase_create($nomeshp.".dbf", $def);dbase_close($db); |
| 2329 | + } | ||
| 2169 | //acrescenta os pontos no novo shapefile | 2330 | //acrescenta os pontos no novo shapefile |
| 2170 | $dbname = $nomeshp.".dbf"; | 2331 | $dbname = $nomeshp.".dbf"; |
| 2171 | if($this->dbaseExiste == false) | 2332 | if($this->dbaseExiste == false) |
| 2172 | - $db=xbase_open($dbname,2); | 2333 | + $db=xbase_open($dbname,2); |
| 2173 | else | 2334 | else |
| 2174 | - $db=dbase_open($dbname,2); | 2335 | + $db=dbase_open($dbname,2); |
| 2175 | $classes = array_keys($dissolve); | 2336 | $classes = array_keys($dissolve); |
| 2176 | foreach ($classes as $classe) | 2337 | foreach ($classes as $classe) |
| 2177 | { | 2338 | { |
| 2178 | $novoshpf->addShape($dissolve[$classe]->convexhull()); | 2339 | $novoshpf->addShape($dissolve[$classe]->convexhull()); |
| 2179 | if($this->dbaseExiste == false) | 2340 | if($this->dbaseExiste == false) |
| 2180 | - xbase_add_record($db,array($classe)); | 2341 | + xbase_add_record($db,array($classe)); |
| 2181 | else | 2342 | else |
| 2182 | - dbase_add_record($db,array($classe)); | 2343 | + dbase_add_record($db,array($classe)); |
| 2183 | } | 2344 | } |
| 2184 | if($this->dbaseExiste == false) | 2345 | if($this->dbaseExiste == false) |
| 2185 | - xbase_close($db); | 2346 | + xbase_close($db); |
| 2186 | else | 2347 | else |
| 2187 | - dbase_close($db); | 2348 | + dbase_close($db); |
| 2188 | // | 2349 | // |
| 2189 | //adiciona o novo layer no mapa | 2350 | //adiciona o novo layer no mapa |
| 2190 | // | 2351 | // |
| @@ -2196,23 +2357,27 @@ Salva o mapa acrescentando um novo layer com o resultado. | @@ -2196,23 +2357,27 @@ Salva o mapa acrescentando um novo layer com o resultado. | ||
| 2196 | return("ok"); | 2357 | return("ok"); |
| 2197 | } | 2358 | } |
| 2198 | 2359 | ||
| 2199 | -/* | ||
| 2200 | -function: dissolvePoligono | 2360 | + /* |
| 2361 | + function: dissolvePoligono | ||
| 2201 | 2362 | ||
| 2202 | -Dissolve as bordas entre polígonos com o mesmo atributo. | 2363 | + Dissolve as bordas entre polígonos com o mesmo atributo. |
| 2203 | 2364 | ||
| 2204 | -Salva o mapa acrescentando um novo layer com o resultado. | 2365 | + Salva o mapa acrescentando um novo layer com o resultado. |
| 2205 | 2366 | ||
| 2206 | -$item - item utilizado para agregar os polígonos | 2367 | + $item - item utilizado para agregar os polígonos |
| 2207 | 2368 | ||
| 2208 | -$locaplic - Localização do I3geo | ||
| 2209 | -*/ | 2369 | + $locaplic - Localização do I3geo |
| 2370 | + */ | ||
| 2210 | function dissolvePoligono($item,$locaplic) | 2371 | function dissolvePoligono($item,$locaplic) |
| 2211 | { | 2372 | { |
| 2212 | - if(!$this->layer){return "erro";} | 2373 | + if(!$this->layer){ |
| 2374 | + return "erro"; | ||
| 2375 | + } | ||
| 2213 | set_time_limit(180); | 2376 | set_time_limit(180); |
| 2214 | //para manipular dbf | 2377 | //para manipular dbf |
| 2215 | - if(!isset($item)){$item="";} | 2378 | + if(!isset($item)){ |
| 2379 | + $item=""; | ||
| 2380 | + } | ||
| 2216 | if($this->dbaseExiste == false){ | 2381 | if($this->dbaseExiste == false){ |
| 2217 | include_once dirname(__FILE__)."/../pacotes/phpxbase/api_conversion.php"; | 2382 | include_once dirname(__FILE__)."/../pacotes/phpxbase/api_conversion.php"; |
| 2218 | } | 2383 | } |
| @@ -2220,25 +2385,30 @@ $locaplic - Localiza&ccedil;&atilde;o do I3geo | @@ -2220,25 +2385,30 @@ $locaplic - Localiza&ccedil;&atilde;o do I3geo | ||
| 2220 | $indices = array(); | 2385 | $indices = array(); |
| 2221 | foreach($shapes as $shape){ | 2386 | foreach($shapes as $shape){ |
| 2222 | if($item != "") | 2387 | if($item != "") |
| 2223 | - {$valor = $shape->values[$item];} | 2388 | + { |
| 2389 | + $valor = $shape->values[$item]; | ||
| 2390 | + } | ||
| 2224 | else | 2391 | else |
| 2225 | - {$valor = "nenhum";} | 2392 | + {$valor = "nenhum"; |
| 2393 | + } | ||
| 2226 | if(!isset($indices[$valor])){ | 2394 | if(!isset($indices[$valor])){ |
| 2227 | $indices[$valor] = array($shape); | 2395 | $indices[$valor] = array($shape); |
| 2228 | } | 2396 | } |
| 2229 | else | 2397 | else |
| 2230 | - $indices[$valor] = array_merge($indices[$valor],array($shape)); | 2398 | + $indices[$valor] = array_merge($indices[$valor],array($shape)); |
| 2231 | } | 2399 | } |
| 2232 | $dissolve=array(); | 2400 | $dissolve=array(); |
| 2233 | foreach($indices as $shapes) | 2401 | foreach($indices as $shapes) |
| 2234 | { | 2402 | { |
| 2235 | foreach($shapes as $shape){ | 2403 | foreach($shapes as $shape){ |
| 2236 | if($item != "") | 2404 | if($item != "") |
| 2237 | - $valor = $shape->values[$item]; | 2405 | + $valor = $shape->values[$item]; |
| 2238 | else | 2406 | else |
| 2239 | - $valor = "nenhum"; | 2407 | + $valor = "nenhum"; |
| 2240 | if (!isset($dissolve[$valor])) | 2408 | if (!isset($dissolve[$valor])) |
| 2241 | - {$dissolve[$valor] = $shape;} | 2409 | + { |
| 2410 | + $dissolve[$valor] = $shape; | ||
| 2411 | + } | ||
| 2242 | else | 2412 | else |
| 2243 | { | 2413 | { |
| 2244 | if($shape->type != MS_SHAPE_POLYGON) | 2414 | if($shape->type != MS_SHAPE_POLYGON) |
| @@ -2266,31 +2436,36 @@ $locaplic - Localiza&ccedil;&atilde;o do I3geo | @@ -2266,31 +2436,36 @@ $locaplic - Localiza&ccedil;&atilde;o do I3geo | ||
| 2266 | $novoshpf = ms_newShapefileObj($nomeshp, MS_SHP_POLYGON); | 2436 | $novoshpf = ms_newShapefileObj($nomeshp, MS_SHP_POLYGON); |
| 2267 | // cria o dbf | 2437 | // cria o dbf |
| 2268 | $def = array(); | 2438 | $def = array(); |
| 2269 | - if($item==""){$item="nenhum";} | 2439 | + if($item==""){ |
| 2440 | + $item="nenhum"; | ||
| 2441 | + } | ||
| 2270 | $def[] = array($item,"C","254"); | 2442 | $def[] = array($item,"C","254"); |
| 2271 | if($this->dbaseExiste == false) | 2443 | if($this->dbaseExiste == false) |
| 2272 | - {$db = xbase_create($nomeshp.".dbf", $def);xbase_close($db);} | 2444 | + { |
| 2445 | + $db = xbase_create($nomeshp.".dbf", $def);xbase_close($db); | ||
| 2446 | + } | ||
| 2273 | else | 2447 | else |
| 2274 | - {$db = dbase_create($nomeshp.".dbf", $def);dbase_close($db);} | 2448 | + {$db = dbase_create($nomeshp.".dbf", $def);dbase_close($db); |
| 2449 | + } | ||
| 2275 | //acrescenta os pontos no novo shapefile | 2450 | //acrescenta os pontos no novo shapefile |
| 2276 | $dbname = $nomeshp.".dbf"; | 2451 | $dbname = $nomeshp.".dbf"; |
| 2277 | if($this->dbaseExiste == false) | 2452 | if($this->dbaseExiste == false) |
| 2278 | - $db=xbase_open($dbname,2); | 2453 | + $db=xbase_open($dbname,2); |
| 2279 | else | 2454 | else |
| 2280 | - $db=dbase_open($dbname,2); | 2455 | + $db=dbase_open($dbname,2); |
| 2281 | $classes = array_keys($dissolve); | 2456 | $classes = array_keys($dissolve); |
| 2282 | foreach ($classes as $classe) | 2457 | foreach ($classes as $classe) |
| 2283 | { | 2458 | { |
| 2284 | $novoshpf->addShape($dissolve[$classe]); | 2459 | $novoshpf->addShape($dissolve[$classe]); |
| 2285 | if($this->dbaseExiste == false) | 2460 | if($this->dbaseExiste == false) |
| 2286 | - xbase_add_record($db,array($classe)); | 2461 | + xbase_add_record($db,array($classe)); |
| 2287 | else | 2462 | else |
| 2288 | - dbase_add_record($db,array($classe)); | 2463 | + dbase_add_record($db,array($classe)); |
| 2289 | } | 2464 | } |
| 2290 | if($this->dbaseExiste == false) | 2465 | if($this->dbaseExiste == false) |
| 2291 | - xbase_close($db); | 2466 | + xbase_close($db); |
| 2292 | else | 2467 | else |
| 2293 | - dbase_close($db); | 2468 | + dbase_close($db); |
| 2294 | // | 2469 | // |
| 2295 | //adiciona o novo layer no mapa | 2470 | //adiciona o novo layer no mapa |
| 2296 | // | 2471 | // |
| @@ -2300,14 +2475,16 @@ $locaplic - Localiza&ccedil;&atilde;o do I3geo | @@ -2300,14 +2475,16 @@ $locaplic - Localiza&ccedil;&atilde;o do I3geo | ||
| 2300 | $novolayer->setmetadata("DOWNLOAD","SIM"); | 2475 | $novolayer->setmetadata("DOWNLOAD","SIM"); |
| 2301 | $novolayer->setmetadata("TEMALOCAL","SIM"); | 2476 | $novolayer->setmetadata("TEMALOCAL","SIM"); |
| 2302 | if (file_exists($this->qyfile)) | 2477 | if (file_exists($this->qyfile)) |
| 2303 | - {unlink ($this->qyfile);} | 2478 | + { |
| 2479 | + unlink ($this->qyfile); | ||
| 2480 | + } | ||
| 2304 | 2481 | ||
| 2305 | return("ok"); | 2482 | return("ok"); |
| 2306 | } | 2483 | } |
| 2307 | /* | 2484 | /* |
| 2308 | - Function aplicaFuncaoListaWKT | 2485 | + Function aplicaFuncaoListaWKT |
| 2309 | 2486 | ||
| 2310 | - Aplica uma função do Mapserver à uma lista de geometrias no formato WKT | 2487 | + Aplica uma função do Mapserver � uma lista de geometrias no formato WKT |
| 2311 | 2488 | ||
| 2312 | Parametros: | 2489 | Parametros: |
| 2313 | 2490 | ||
| @@ -2315,9 +2492,9 @@ $locaplic - Localiza&ccedil;&atilde;o do I3geo | @@ -2315,9 +2492,9 @@ $locaplic - Localiza&ccedil;&atilde;o do I3geo | ||
| 2315 | 2492 | ||
| 2316 | $operacao {String} - operação suportada pelo Mapserver, por exemplo, union, intersects, etc. converteSHP irá converter as geometrias em um tema e adicioná-lo ao mapa | 2493 | $operacao {String} - operação suportada pelo Mapserver, por exemplo, union, intersects, etc. converteSHP irá converter as geometrias em um tema e adicioná-lo ao mapa |
| 2317 | 2494 | ||
| 2318 | - $dir_tmp - Diretório temporário do mapserver. Utilizado apenas se $operacao = "converteSHP" | 2495 | + $dir_tmp - Diret�rio temporário do mapserver. Utilizado apenas se $operacao = "converteSHP" |
| 2319 | 2496 | ||
| 2320 | - $imgdir - Diretório das imagens do mapa atual. Utilizado apenas se $operacao = "converteSHP" | 2497 | + $imgdir - Diret�rio das imagens do mapa atual. Utilizado apenas se $operacao = "converteSHP" |
| 2321 | 2498 | ||
| 2322 | Return: | 2499 | Return: |
| 2323 | 2500 | ||
| @@ -2353,20 +2530,20 @@ $locaplic - Localiza&ccedil;&atilde;o do I3geo | @@ -2353,20 +2530,20 @@ $locaplic - Localiza&ccedil;&atilde;o do I3geo | ||
| 2353 | return $geoc->toWkt(); | 2530 | return $geoc->toWkt(); |
| 2354 | } | 2531 | } |
| 2355 | } | 2532 | } |
| 2356 | -/* | ||
| 2357 | -function: funcoesGeometrias | 2533 | + /* |
| 2534 | + function: funcoesGeometrias | ||
| 2358 | 2535 | ||
| 2359 | -Funções de análise de geometrias da ferramenta Geometrias. | 2536 | + Funções de análise de geometrias da ferramenta Geometrias. |
| 2360 | 2537 | ||
| 2361 | -parameters: | ||
| 2362 | -$dir_tmp - Diretório temporário do mapserver | 2538 | + parameters: |
| 2539 | + $dir_tmp - Diret�rio temporário do mapserver | ||
| 2363 | 2540 | ||
| 2364 | -$imgdir - Diretório das imagens do mapa atual | 2541 | + $imgdir - Diret�rio das imagens do mapa atual |
| 2365 | 2542 | ||
| 2366 | -$lista - String com a lista de nomes dos arquivos serializados que contém as geometrias | 2543 | + $lista - String com a lista de nomes dos arquivos serializados que contém as geometrias |
| 2367 | 2544 | ||
| 2368 | -$operacao - Tipo de análise. | ||
| 2369 | -*/ | 2545 | + $operacao - Tipo de análise. |
| 2546 | + */ | ||
| 2370 | function funcoesGeometrias($dir_tmp,$imgdir,$lista,$operacao) | 2547 | function funcoesGeometrias($dir_tmp,$imgdir,$lista,$operacao) |
| 2371 | { | 2548 | { |
| 2372 | $lista = explode(",",$lista); | 2549 | $lista = explode(",",$lista); |
| @@ -2424,21 +2601,21 @@ $operacao - Tipo de an&aacute;lise. | @@ -2424,21 +2601,21 @@ $operacao - Tipo de an&aacute;lise. | ||
| 2424 | return($nomegeo); | 2601 | return($nomegeo); |
| 2425 | } | 2602 | } |
| 2426 | 2603 | ||
| 2427 | -/* | ||
| 2428 | -function: calculaGeometrias | 2604 | + /* |
| 2605 | + function: calculaGeometrias | ||
| 2429 | 2606 | ||
| 2430 | -Funções de cálculo de geometrias da ferramenta Geometrias. | 2607 | + Funções de cálculo de geometrias da ferramenta Geometrias. |
| 2431 | 2608 | ||
| 2432 | -parameters: | 2609 | + parameters: |
| 2433 | 2610 | ||
| 2434 | -$dir_tmp - Diretório temporário do mapserver | 2611 | + $dir_tmp - Diret�rio temporário do mapserver |
| 2435 | 2612 | ||
| 2436 | -$imgdir - Diretório das imagens do mapa atual | 2613 | + $imgdir - Diret�rio das imagens do mapa atual |
| 2437 | 2614 | ||
| 2438 | -$lista - Arquivos com as geometrias | 2615 | + $lista - Arquivos com as geometrias |
| 2439 | 2616 | ||
| 2440 | -$operacao - Tipo de análise. | ||
| 2441 | -*/ | 2617 | + $operacao - Tipo de análise. |
| 2618 | + */ | ||
| 2442 | function calculaGeometrias($dir_tmp,$imgdir,$lista,$operacao) | 2619 | function calculaGeometrias($dir_tmp,$imgdir,$lista,$operacao) |
| 2443 | { | 2620 | { |
| 2444 | //error_reporting(0); | 2621 | //error_reporting(0); |
| @@ -2451,9 +2628,11 @@ $operacao - Tipo de an&aacute;lise. | @@ -2451,9 +2628,11 @@ $operacao - Tipo de an&aacute;lise. | ||
| 2451 | //verifica a versão do mapserver | 2628 | //verifica a versão do mapserver |
| 2452 | //se for anterior a 5, utiliza a conexão com o postgis para fazer o processamento dos daods | 2629 | //se for anterior a 5, utiliza a conexão com o postgis para fazer o processamento dos daods |
| 2453 | // | 2630 | // |
| 2454 | - $v = versao(); | 2631 | + $v = versao(); |
| 2455 | if (($v["principal"] < 5)) | 2632 | if (($v["principal"] < 5)) |
| 2456 | - {return ("erro. E necessario uma versão maior que 5.0 do Mapserver.");} | 2633 | + { |
| 2634 | + return ("erro. E necessario uma versão maior que 5.0 do Mapserver."); | ||
| 2635 | + } | ||
| 2457 | foreach ($geos["dados"] as &$geo) | 2636 | foreach ($geos["dados"] as &$geo) |
| 2458 | { | 2637 | { |
| 2459 | $g = $geo["wkt"]; | 2638 | $g = $geo["wkt"]; |
| @@ -2469,7 +2648,7 @@ $operacao - Tipo de an&aacute;lise. | @@ -2469,7 +2648,7 @@ $operacao - Tipo de an&aacute;lise. | ||
| 2469 | $shape = ms_shapeObjFromWkt($s); | 2648 | $shape = ms_shapeObjFromWkt($s); |
| 2470 | $area = $shape->getLength(); | 2649 | $area = $shape->getLength(); |
| 2471 | $geo["valores"][] = array("item"=>"P_perim_metros","valor"=>$area); | 2650 | $geo["valores"][] = array("item"=>"P_perim_metros","valor"=>$area); |
| 2472 | - break; | 2651 | + break; |
| 2473 | case "area": | 2652 | case "area": |
| 2474 | $shape = ms_shapeObjFromWkt($g); | 2653 | $shape = ms_shapeObjFromWkt($g); |
| 2475 | $rect = $shape->bounds; | 2654 | $rect = $shape->bounds; |
| @@ -2480,30 +2659,30 @@ $operacao - Tipo de an&aacute;lise. | @@ -2480,30 +2659,30 @@ $operacao - Tipo de an&aacute;lise. | ||
| 2480 | $shape = ms_shapeObjFromWkt($s); | 2659 | $shape = ms_shapeObjFromWkt($s); |
| 2481 | $area = $shape->getArea(); | 2660 | $area = $shape->getArea(); |
| 2482 | $geo["valores"][] = array("item"=>"P_area_metros","valor"=>$area); | 2661 | $geo["valores"][] = array("item"=>"P_area_metros","valor"=>$area); |
| 2483 | - break; | 2662 | + break; |
| 2484 | case "comprimento": | 2663 | case "comprimento": |
| 2485 | - break; | 2664 | + break; |
| 2486 | } | 2665 | } |
| 2487 | } | 2666 | } |
| 2488 | $this->serializeGeo($dir.$l,$geos); | 2667 | $this->serializeGeo($dir.$l,$geos); |
| 2489 | } | 2668 | } |
| 2490 | return("ok"); | 2669 | return("ok"); |
| 2491 | } | 2670 | } |
| 2492 | -/* | ||
| 2493 | -Function: incmapageometrias | 2671 | + /* |
| 2672 | + Function: incmapageometrias | ||
| 2494 | 2673 | ||
| 2495 | -Insere geometrias como tema no mapa. | 2674 | + Insere geometrias como tema no mapa. |
| 2496 | 2675 | ||
| 2497 | -parameters: | 2676 | + parameters: |
| 2498 | 2677 | ||
| 2499 | -$dir_tmp - Diretório temporário do mapserver | 2678 | + $dir_tmp - Diretorio temporário do mapserver |
| 2500 | 2679 | ||
| 2501 | -$imgdir - Diretório das imagens do mapa atual | 2680 | + $imgdir - Diretorio das imagens do mapa atual |
| 2502 | 2681 | ||
| 2503 | -$lista - Nomes, sem o caminho, dos arquivos com as geometrias, separados por vírgula. | 2682 | + $lista - Nomes, sem o caminho, dos arquivos com as geometrias, separados por vírgula. |
| 2504 | 2683 | ||
| 2505 | -$tipoLista - tipo de valores que são passados em $lista stringArquivos|arraywkt. O default é stringArquivos | ||
| 2506 | -*/ | 2684 | + $tipoLista - tipo de valores que são passados em $lista stringArquivos|arraywkt. O default é stringArquivos |
| 2685 | + */ | ||
| 2507 | function incmapageometrias($dir_tmp,$imgdir,$lista,$tipoLista="stringArquivos") | 2686 | function incmapageometrias($dir_tmp,$imgdir,$lista,$tipoLista="stringArquivos") |
| 2508 | { | 2687 | { |
| 2509 | $dir = $dir_tmp."/".$imgdir."/"; | 2688 | $dir = $dir_tmp."/".$imgdir."/"; |
| @@ -2521,7 +2700,9 @@ $tipoLista - tipo de valores que s&atilde;o passados em $lista stringArquivos|ar | @@ -2521,7 +2700,9 @@ $tipoLista - tipo de valores que s&atilde;o passados em $lista stringArquivos|ar | ||
| 2521 | //echo $geo["wkt"]."<br>"; | 2700 | //echo $geo["wkt"]."<br>"; |
| 2522 | $shapes[] = ms_shapeObjFromWkt(str_replace("'","",$geo["wkt"])); | 2701 | $shapes[] = ms_shapeObjFromWkt(str_replace("'","",$geo["wkt"])); |
| 2523 | foreach ($geo["valores"] as $v) | 2702 | foreach ($geo["valores"] as $v) |
| 2524 | - {$valorestemp[] = $v["item"]."=".$v["valor"];} | 2703 | + { |
| 2704 | + $valorestemp[] = $v["item"]."=".$v["valor"]; | ||
| 2705 | + } | ||
| 2525 | $valoresoriginais[] = implode(" ",$valorestemp); | 2706 | $valoresoriginais[] = implode(" ",$valorestemp); |
| 2526 | } | 2707 | } |
| 2527 | } | 2708 | } |
| @@ -2545,11 +2726,17 @@ $tipoLista - tipo de valores que s&atilde;o passados em $lista stringArquivos|ar | @@ -2545,11 +2726,17 @@ $tipoLista - tipo de valores que s&atilde;o passados em $lista stringArquivos|ar | ||
| 2545 | $tituloTema = " marcadores"; | 2726 | $tituloTema = " marcadores"; |
| 2546 | } | 2727 | } |
| 2547 | //verifica o tipo | 2728 | //verifica o tipo |
| 2548 | - if (count($shapes) == 0){return("erro.");} | 2729 | + if (count($shapes) == 0){ |
| 2730 | + return("erro."); | ||
| 2731 | + } | ||
| 2549 | $tiposhape = $shapes[0]->type; | 2732 | $tiposhape = $shapes[0]->type; |
| 2550 | $tiposhapefile = MS_SHP_POLYGON; | 2733 | $tiposhapefile = MS_SHP_POLYGON; |
| 2551 | - if ($tiposhape == 0){$tiposhapefile = MS_SHP_MULTIPOINT;} | ||
| 2552 | - if ($tiposhape == 1){$tiposhapefile = MS_SHP_ARC;} | 2734 | + if ($tiposhape == 0){ |
| 2735 | + $tiposhapefile = MS_SHP_MULTIPOINT; | ||
| 2736 | + } | ||
| 2737 | + if ($tiposhape == 1){ | ||
| 2738 | + $tiposhapefile = MS_SHP_ARC; | ||
| 2739 | + } | ||
| 2553 | //cria o shapefile | 2740 | //cria o shapefile |
| 2554 | if($this->dbaseExiste == false){ | 2741 | if($this->dbaseExiste == false){ |
| 2555 | include_once dirname(__FILE__)."/../pacotes/phpxbase/api_conversion.php"; | 2742 | include_once dirname(__FILE__)."/../pacotes/phpxbase/api_conversion.php"; |
| @@ -2561,31 +2748,34 @@ $tipoLista - tipo de valores que s&atilde;o passados em $lista stringArquivos|ar | @@ -2561,31 +2748,34 @@ $tipoLista - tipo de valores que s&atilde;o passados em $lista stringArquivos|ar | ||
| 2561 | $novoshpf = ms_newShapefileObj($nomeshp, $tiposhapefile); | 2748 | $novoshpf = ms_newShapefileObj($nomeshp, $tiposhapefile); |
| 2562 | $def[] = array("ID","C","250"); | 2749 | $def[] = array("ID","C","250"); |
| 2563 | if($this->dbaseExiste == false) | 2750 | if($this->dbaseExiste == false) |
| 2564 | - {$db = xbase_create($nomeshp.".dbf", $def);xbase_close($db);} | 2751 | + { |
| 2752 | + $db = xbase_create($nomeshp.".dbf", $def);xbase_close($db); | ||
| 2753 | + } | ||
| 2565 | else | 2754 | else |
| 2566 | - {$db = dbase_create($nomeshp.".dbf", $def);dbase_close($db);} | 2755 | + {$db = dbase_create($nomeshp.".dbf", $def);dbase_close($db); |
| 2756 | + } | ||
| 2567 | //acrescenta os pontos no novo shapefile | 2757 | //acrescenta os pontos no novo shapefile |
| 2568 | $dbname = $nomeshp.".dbf"; | 2758 | $dbname = $nomeshp.".dbf"; |
| 2569 | if($this->dbaseExiste == false) | 2759 | if($this->dbaseExiste == false) |
| 2570 | - $db=xbase_open($dbname,2); | 2760 | + $db=xbase_open($dbname,2); |
| 2571 | else | 2761 | else |
| 2572 | - $db=dbase_open($dbname,2); | 2762 | + $db=dbase_open($dbname,2); |
| 2573 | $conta = 0; | 2763 | $conta = 0; |
| 2574 | foreach ($shapes as $s) | 2764 | foreach ($shapes as $s) |
| 2575 | { | 2765 | { |
| 2576 | $reg = array(); | 2766 | $reg = array(); |
| 2577 | $reg[] = $valoresoriginais[$conta]; | 2767 | $reg[] = $valoresoriginais[$conta]; |
| 2578 | if($this->dbaseExiste == false) | 2768 | if($this->dbaseExiste == false) |
| 2579 | - xbase_add_record($db,$reg); | 2769 | + xbase_add_record($db,$reg); |
| 2580 | else | 2770 | else |
| 2581 | - dbase_add_record($db,$reg); | 2771 | + dbase_add_record($db,$reg); |
| 2582 | $novoshpf->addshape($s); | 2772 | $novoshpf->addshape($s); |
| 2583 | $conta = $conta + 1; | 2773 | $conta = $conta + 1; |
| 2584 | } | 2774 | } |
| 2585 | if($this->dbaseExiste == false) | 2775 | if($this->dbaseExiste == false) |
| 2586 | - xbase_close($db); | 2776 | + xbase_close($db); |
| 2587 | else | 2777 | else |
| 2588 | - dbase_close($db); | 2778 | + dbase_close($db); |
| 2589 | $l->set("opacity",80); | 2779 | $l->set("opacity",80); |
| 2590 | $l->setmetadata("tema",$novonomelayer.$tituloTema); | 2780 | $l->setmetadata("tema",$novonomelayer.$tituloTema); |
| 2591 | $l->setmetadata("TEMALOCAL","SIM"); | 2781 | $l->setmetadata("TEMALOCAL","SIM"); |
| @@ -2606,28 +2796,28 @@ $tipoLista - tipo de valores que s&atilde;o passados em $lista stringArquivos|ar | @@ -2606,28 +2796,28 @@ $tipoLista - tipo de valores que s&atilde;o passados em $lista stringArquivos|ar | ||
| 2606 | $this->salva(); | 2796 | $this->salva(); |
| 2607 | return($novonomelayer); | 2797 | return($novonomelayer); |
| 2608 | } | 2798 | } |
| 2609 | -/* | ||
| 2610 | -function: gravaCoordenadasPt | 2799 | + /* |
| 2800 | + function: gravaCoordenadasPt | ||
| 2611 | 2801 | ||
| 2612 | -Lê as coordenadas de um tema pontual e grava em arquivos. | 2802 | + Lê as coordenadas de um tema pontual e grava em arquivos. |
| 2613 | 2803 | ||
| 2614 | -Essa função é utilizada nas opções que utilizam o R para cálculos e necessitam ler as coordenadas dos pontos. | 2804 | + Essa função é utilizada nas opções que utilizam o R para cálculos e necessitam ler as coordenadas dos pontos. |
| 2615 | 2805 | ||
| 2616 | -Parametros: | 2806 | + Parametros: |
| 2617 | 2807 | ||
| 2618 | -tema - nome do tema com os pontos | 2808 | + tema - nome do tema com os pontos |
| 2619 | 2809 | ||
| 2620 | -limitepontos - FALSE para considerar a extensão geográfica do mapa atual e TRUE para considerar como limite as ocorrências pontuais do tema | 2810 | + limitepontos - FALSE para considerar a extensão geográfica do mapa atual e TRUE para considerar como limite as ocorrências pontuais do tema |
| 2621 | 2811 | ||
| 2622 | -extendelimite - percentual utilizado para extender o limite da área resultante | 2812 | + extendelimite - percentual utilizado para extender o limite da área resultante |
| 2623 | 2813 | ||
| 2624 | -item - item com os valors de peso (opcional) | 2814 | + item - item com os valors de peso (opcional) |
| 2625 | 2815 | ||
| 2626 | -return: | 2816 | + return: |
| 2627 | 2817 | ||
| 2628 | -array com as dimensões em x e y e nome dos arquivos com x e y gerados. | ||
| 2629 | -*/ | ||
| 2630 | -function gravaCoordenadasPt($tema,$limitepontos="TRUE",$extendelimite,$item=""){ | 2818 | + array com as dimensões em x e y e nome dos arquivos com x e y gerados. |
| 2819 | + */ | ||
| 2820 | + function gravaCoordenadasPt($tema,$limitepontos="TRUE",$extendelimite,$item=""){ | ||
| 2631 | $prjMapa = $this->mapa->getProjection(); | 2821 | $prjMapa = $this->mapa->getProjection(); |
| 2632 | $layerPt = $this->mapa->getlayerbyname($tema); | 2822 | $layerPt = $this->mapa->getlayerbyname($tema); |
| 2633 | $prjTema = $layerPt->getProjection(); | 2823 | $prjTema = $layerPt->getProjection(); |
| @@ -2704,15 +2894,15 @@ function gravaCoordenadasPt($tema,$limitepontos="TRUE",$extendelimite,$item=""){ | @@ -2704,15 +2894,15 @@ function gravaCoordenadasPt($tema,$limitepontos="TRUE",$extendelimite,$item=""){ | ||
| 2704 | $dimx = "c(".$xi.",".$xf.")"; | 2894 | $dimx = "c(".$xi.",".$xf.")"; |
| 2705 | $dimy = "c(".$yi.",".$yf.")"; | 2895 | $dimy = "c(".$yi.",".$yf.")"; |
| 2706 | return array("dimx"=>$dimx,"dimy"=>$dimy,"arqx"=>($nomearq."x"),"arqy"=>($nomearq."y"),"arqz"=>($nomearq."z"),"prefixoarquivo"=>$nomearq); | 2896 | return array("dimx"=>$dimx,"dimy"=>$dimy,"arqx"=>($nomearq."x"),"arqy"=>($nomearq."y"),"arqz"=>($nomearq."z"),"prefixoarquivo"=>$nomearq); |
| 2707 | -} | ||
| 2708 | -/* | ||
| 2709 | -function unserializeGeo | 2897 | + } |
| 2898 | + /* | ||
| 2899 | + function unserializeGeo | ||
| 2710 | 2900 | ||
| 2711 | -Deserializa um arquivo de geometrias. | 2901 | + Deserializa um arquivo de geometrias. |
| 2712 | 2902 | ||
| 2713 | -Parametros: | ||
| 2714 | -$arquivo - arquivo que será processado | ||
| 2715 | -*/ | 2903 | + Parametros: |
| 2904 | + $arquivo - arquivo que será processado | ||
| 2905 | + */ | ||
| 2716 | public function unserializeGeo($arq) | 2906 | public function unserializeGeo($arq) |
| 2717 | { | 2907 | { |
| 2718 | $handle = fopen ($arq, "r"); | 2908 | $handle = fopen ($arq, "r"); |
| @@ -2720,55 +2910,57 @@ $arquivo - arquivo que ser&aacute; processado | @@ -2720,55 +2910,57 @@ $arquivo - arquivo que ser&aacute; processado | ||
| 2720 | fclose ($handle); | 2910 | fclose ($handle); |
| 2721 | return(unserialize($conteudo)); | 2911 | return(unserialize($conteudo)); |
| 2722 | } | 2912 | } |
| 2723 | -/* | ||
| 2724 | -function serializeGeo | 2913 | + /* |
| 2914 | + function serializeGeo | ||
| 2725 | 2915 | ||
| 2726 | -Deserializa um arquivo de geometrias. | 2916 | + Deserializa um arquivo de geometrias. |
| 2727 | 2917 | ||
| 2728 | -Parametros: | ||
| 2729 | -$arquivo - arquivo que será processado | 2918 | + Parametros: |
| 2919 | + $arquivo - arquivo que será processado | ||
| 2730 | 2920 | ||
| 2731 | -$geos - array com os dados | ||
| 2732 | -*/ | 2921 | + $geos - array com os dados |
| 2922 | + */ | ||
| 2733 | public function serializeGeo($arq,$geos) | 2923 | public function serializeGeo($arq,$geos) |
| 2734 | { | 2924 | { |
| 2735 | if (file_exists($arq)) | 2925 | if (file_exists($arq)) |
| 2736 | - {unlink($arq);} | 2926 | + { |
| 2927 | + unlink($arq); | ||
| 2928 | + } | ||
| 2737 | $fp = fopen($arq,"w"); | 2929 | $fp = fopen($arq,"w"); |
| 2738 | $r = serialize($geos); | 2930 | $r = serialize($geos); |
| 2739 | fwrite($fp,$r); | 2931 | fwrite($fp,$r); |
| 2740 | fclose($fp); | 2932 | fclose($fp); |
| 2741 | } | 2933 | } |
| 2742 | -/* | ||
| 2743 | -Function: classesRasterI | 2934 | + /* |
| 2935 | + Function: classesRasterI | ||
| 2744 | 2936 | ||
| 2745 | -Gera parâmetros para classificação de imagens. | 2937 | + Gera parâmetros para classificação de imagens. |
| 2746 | 2938 | ||
| 2747 | -Gera a expressão e as cores para uso em classes com intervalos iguais para representação de imagens raster. | 2939 | + Gera a expressão e as cores para uso em classes com intervalos iguais para representação de imagens raster. |
| 2748 | 2940 | ||
| 2749 | -Parametros: | 2941 | + Parametros: |
| 2750 | 2942 | ||
| 2751 | -$minvalor {numeric} - Menor valor existente na série | 2943 | + $minvalor {numeric} - Menor valor existente na série |
| 2752 | 2944 | ||
| 2753 | -$maxvalor {numeric} - Maior valor | 2945 | + $maxvalor {numeric} - Maior valor |
| 2754 | 2946 | ||
| 2755 | -$nclasses {numeric} - Número de classes | 2947 | + $nclasses {numeric} - Número de classes |
| 2756 | 2948 | ||
| 2757 | -$cores {array} - Cores. Array de array de cores cores[0] = array(r,g,b) | 2949 | + $cores {array} - Cores. Array de array de cores cores[0] = array(r,g,b) |
| 2758 | 2950 | ||
| 2759 | -Retorno: | 2951 | + Retorno: |
| 2760 | 2952 | ||
| 2761 | -(start code) | ||
| 2762 | -array( | 2953 | + (start code) |
| 2763 | array( | 2954 | array( |
| 2764 | - "nomeclasse"=>, | ||
| 2765 | - "expressao"=>, | ||
| 2766 | - "cores"=> | 2955 | + array( |
| 2956 | + "nomeclasse"=>, | ||
| 2957 | + "expressao"=>, | ||
| 2958 | + "cores"=> | ||
| 2959 | + ) | ||
| 2767 | ) | 2960 | ) |
| 2768 | -) | ||
| 2769 | -(end) | ||
| 2770 | -*/ | ||
| 2771 | -//error_reporting(0); | 2961 | + (end) |
| 2962 | + */ | ||
| 2963 | + //error_reporting(0); | ||
| 2772 | function classesRasterI($minvalor,$maxvalor,$nclasses,$cores) | 2964 | function classesRasterI($minvalor,$maxvalor,$nclasses,$cores) |
| 2773 | { | 2965 | { |
| 2774 | $resultado = array(); | 2966 | $resultado = array(); |
| @@ -2804,7 +2996,7 @@ array( | @@ -2804,7 +2996,7 @@ array( | ||
| 2804 | return($r_input); | 2996 | return($r_input); |
| 2805 | } | 2997 | } |
| 2806 | /* | 2998 | /* |
| 2807 | - Function: criaImagemR | 2999 | + Function: criaImagemR |
| 2808 | 3000 | ||
| 2809 | Cria uma imagem png a partir de dados armazenados em disco. | 3001 | Cria uma imagem png a partir de dados armazenados em disco. |
| 2810 | 3002 | ||
| @@ -2823,7 +3015,9 @@ array( | @@ -2823,7 +3015,9 @@ array( | ||
| 2823 | function criaImagemR($nomearq) | 3015 | function criaImagemR($nomearq) |
| 2824 | { | 3016 | { |
| 2825 | if (!file_exists($nomearq."img")) | 3017 | if (!file_exists($nomearq."img")) |
| 2826 | - {return "erro";} | 3018 | + { |
| 3019 | + return "erro"; | ||
| 3020 | + } | ||
| 2827 | //pega os parametros | 3021 | //pega os parametros |
| 2828 | $abre = fopen($nomearq."h", "r"); | 3022 | $abre = fopen($nomearq."h", "r"); |
| 2829 | while (!feof($abre)) | 3023 | while (!feof($abre)) |
classesphp/mapa_googlemaps.php
| @@ -554,7 +554,7 @@ function versaoMS() | @@ -554,7 +554,7 @@ function versaoMS() | ||
| 554 | */ | 554 | */ |
| 555 | function cortaImagemDisco($arquivo,$cortePixels,$tamanhoFinal=256){ | 555 | function cortaImagemDisco($arquivo,$cortePixels,$tamanhoFinal=256){ |
| 556 | $img = imagecreatefrompng($arquivo); | 556 | $img = imagecreatefrompng($arquivo); |
| 557 | - $imgc = imagecreate($tamanhoFinal,$tamanhoFinal); | 557 | + $imgc = imagecreatetruecolor($tamanhoFinal,$tamanhoFinal); |
| 558 | //@FIXME necessario, sem isso algumas imagens sao geradas de forma errada | 558 | //@FIXME necessario, sem isso algumas imagens sao geradas de forma errada |
| 559 | imagesavealpha($imgc, true); | 559 | imagesavealpha($imgc, true); |
| 560 | $color = imagecolorallocatealpha($imgc,0x00,0x00,0x00,127); | 560 | $color = imagecolorallocatealpha($imgc,0x00,0x00,0x00,127); |
classesphp/mapa_openlayers.php
| @@ -522,7 +522,7 @@ function ilegal(){ | @@ -522,7 +522,7 @@ function ilegal(){ | ||
| 522 | */ | 522 | */ |
| 523 | function cortaImagemDisco($arquivo,$cortePixels,$tamanhoFinal=256){ | 523 | function cortaImagemDisco($arquivo,$cortePixels,$tamanhoFinal=256){ |
| 524 | $img = imagecreatefrompng($arquivo); | 524 | $img = imagecreatefrompng($arquivo); |
| 525 | - $imgc = imagecreate($tamanhoFinal,$tamanhoFinal); | 525 | + $imgc = imagecreatetruecolor($tamanhoFinal,$tamanhoFinal); |
| 526 | //@FIXME necessario, sem isso algumas imagens sao geradas de forma errada | 526 | //@FIXME necessario, sem isso algumas imagens sao geradas de forma errada |
| 527 | imagesavealpha($imgc, true); | 527 | imagesavealpha($imgc, true); |
| 528 | $color = imagecolorallocatealpha($imgc,0x00,0x00,0x00,127); | 528 | $color = imagecolorallocatealpha($imgc,0x00,0x00,0x00,127); |
6.15 KB
ferramentas/nptpol/index.js
| @@ -149,9 +149,10 @@ i3GEOF.nptpol = { | @@ -149,9 +149,10 @@ i3GEOF.nptpol = { | ||
| 149 | }, | 149 | }, |
| 150 | t0: function() | 150 | t0: function() |
| 151 | { | 151 | { |
| 152 | - var ins = "<p class='paragrafo'>"+$trad(1,i3GEOF.nptpol.dicionario)+"</p>"; | ||
| 153 | - ins += "<p class='paragrafo'>"+$trad(2,i3GEOF.nptpol.dicionario)+"</p>"; | ||
| 154 | - ins += "<p class='paragrafo'>"+$trad(3,i3GEOF.nptpol.dicionario)+"</p>"; | 152 | + var ins = "<img class=i3GeoExemploImg src='"+i3GEO.configura.locaplic+"/ferramentas/nptpol/exemplo.png' />" + |
| 153 | + "<p class='paragrafo'>"+$trad(1,i3GEOF.nptpol.dicionario)+"</p>" + | ||
| 154 | + "<p class='paragrafo'>"+$trad(2,i3GEOF.nptpol.dicionario)+"</p>" + | ||
| 155 | + "<p class='paragrafo'>"+$trad(3,i3GEOF.nptpol.dicionario)+"</p>"; | ||
| 155 | i3GEO.util.proximoAnterior("","i3GEOF.nptpol.t1()",ins,"i3GEOFgradeDePontost0","i3GEOnptpolresultado",true,"i3GEOF.nptpol_rodape"); | 156 | i3GEO.util.proximoAnterior("","i3GEOF.nptpol.t1()",ins,"i3GEOFgradeDePontost0","i3GEOnptpolresultado",true,"i3GEOF.nptpol_rodape"); |
| 156 | }, | 157 | }, |
| 157 | t1: function(){ | 158 | t1: function(){ |
2.42 KB
ferramentas/pontoempoligono/index.js
| @@ -152,9 +152,10 @@ i3GEOF.pontoEmPoligono = { | @@ -152,9 +152,10 @@ i3GEOF.pontoEmPoligono = { | ||
| 152 | }, | 152 | }, |
| 153 | t0: function() | 153 | t0: function() |
| 154 | { | 154 | { |
| 155 | - var ins = "<p class='paragrafo'>"+$trad(1,i3GEOF.pontoEmPoligono.dicionario); | ||
| 156 | - ins += "<p class='paragrafo'>"+$trad(2,i3GEOF.pontoEmPoligono.dicionario); | ||
| 157 | - ins += "<p class='paragrafo'>"+$trad(3,i3GEOF.pontoEmPoligono.dicionario); | 155 | + var ins = "<img class=i3GeoExemploImg src='"+i3GEO.configura.locaplic+"/ferramentas/pontoempoligono/exemplo.png' />" + |
| 156 | + "<p class='paragrafo'>"+$trad(1,i3GEOF.pontoEmPoligono.dicionario) + | ||
| 157 | + "<p class='paragrafo'>"+$trad(2,i3GEOF.pontoEmPoligono.dicionario) + | ||
| 158 | + "<p class='paragrafo'>"+$trad(3,i3GEOF.pontoEmPoligono.dicionario); | ||
| 158 | i3GEO.util.proximoAnterior("","i3GEOF.pontoEmPoligono.t1()",ins,"i3GEOFgradeDePontost0","i3GEOpontoEmPoligonoresultado",true,"i3GEOF.pontoEmPoligono_rodape"); | 159 | i3GEO.util.proximoAnterior("","i3GEOF.pontoEmPoligono.t1()",ins,"i3GEOFgradeDePontost0","i3GEOpontoEmPoligonoresultado",true,"i3GEOF.pontoEmPoligono_rodape"); |
| 159 | }, | 160 | }, |
| 160 | t1: function(){ | 161 | t1: function(){ |
temas/_llocali.map
| @@ -37,7 +37,7 @@ MAP | @@ -37,7 +37,7 @@ MAP | ||
| 37 | "TEMA" "Localidades (usar com timeline)" | 37 | "TEMA" "Localidades (usar com timeline)" |
| 38 | "convcaracter" "" | 38 | "convcaracter" "" |
| 39 | "cortepixels" "40" | 39 | "cortepixels" "40" |
| 40 | - "cache" "SIM" | 40 | + #"cache" "SIM" |
| 41 | "editorsql" "" | 41 | "editorsql" "" |
| 42 | "LTEMPOCONVENCODE" "SIM" | 42 | "LTEMPOCONVENCODE" "SIM" |
| 43 | "LTEMPOITEMFIM" "" | 43 | "LTEMPOITEMFIM" "" |