Commit e5b5bc33da8099cdd273c075d47a1662e112c95f
1 parent
c3447d85
Exists in
master
and in
7 other branches
Reconstrução dos códigos da ferramenta Conexão WMS
Showing
73 changed files
with
2173 additions
and
1686 deletions
Show diff stats
classesphp/mapa_controle.php
classesphp/wmswfs.php
| 1 | -<?php | |
| 2 | -/* | |
| 3 | -Title: wmswfs.php | |
| 4 | - | |
| 5 | -Funções de uso geral para realizar a leitura e o processamento de Web Services nos padrões OGC. | |
| 6 | -Atualmente, processa apenas serviços no padrão WMS. | |
| 7 | - | |
| 8 | -Licenca: | |
| 9 | - | |
| 10 | -GPL2 | |
| 11 | - | |
| 12 | - | |
| 13 | -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | |
| 14 | - | |
| 15 | -Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | |
| 16 | -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | |
| 17 | - | |
| 18 | -Este programa é software livre; você pode redistribuí-lo | |
| 19 | -e/ou modificá-lo sob os termos da Licença Pública Geral | |
| 20 | -GNU conforme publicada pela Free Software Foundation; | |
| 21 | - | |
| 22 | -Este programa é distribuído na expectativa de que seja útil, | |
| 23 | -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | |
| 24 | -de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | |
| 25 | -Consulte a Licença Pública Geral do GNU para mais detalhes. | |
| 26 | -Você deve ter recebido uma c�pia da Licença Pública Geral do | |
| 27 | -GNU junto com este programa; se não, escreva para a | |
| 28 | -Free Software Foundation, Inc., no endereço | |
| 29 | -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 30 | - | |
| 31 | -Arquivo: | |
| 32 | - | |
| 33 | -i3geo/classesphp/wmswfs.php | |
| 34 | -*/ | |
| 35 | -/* | |
| 36 | -Function: gravaCacheWMS | |
| 37 | - | |
| 38 | -Lê o getcapabilities de um WMS e salva em disco se o mesmo não tiver sido salvo antes | |
| 39 | - | |
| 40 | -O arquivo é gravado no diretório temporário | |
| 41 | - | |
| 42 | -Parametros: | |
| 43 | - | |
| 44 | -$servico {string} - endereço do WMS | |
| 45 | - | |
| 46 | -Global: | |
| 47 | - | |
| 48 | -$dir_tmp {string} - (opcional) endereço do diretório temporário onde o cache será armazenado. Se não for definido, tenta obter das variáveis de configuração existentes em i3geo/ms_configura.php | |
| 49 | - | |
| 50 | -Return: | |
| 51 | - | |
| 52 | -{string} - Nome do arquivo criado. Retorna a palavra "erro" se tiver ocorrido um erro. | |
| 53 | -*/ | |
| 54 | -function gravaCacheWMS($servico) | |
| 55 | -{ | |
| 56 | - global $dir_tmp, $i3geo_proxy_server; | |
| 57 | - if($dir_tmp == ""){ | |
| 58 | - include(dirname(__FILE__)."/../ms_configura.php"); | |
| 59 | - } | |
| 60 | - //error_reporting(0); | |
| 61 | - try{ | |
| 62 | - $teste = explode("=",$servico); | |
| 63 | - if ( count($teste) > 1 ){ | |
| 64 | - $servico = $servico."&"; | |
| 65 | - } | |
| 66 | - else{ | |
| 67 | - $teste = explode("?",$servico); | |
| 68 | - if ( count($teste) == 1 ){ | |
| 69 | - $servico = $servico."?"; | |
| 70 | - } | |
| 71 | - } | |
| 72 | - $wms_service_request = $servico . "REQUEST=GetCapabilities&SERVICE=WMS"; | |
| 73 | - $teste = explode("version",strtolower($wms_service_request)); | |
| 74 | - if(count($teste) == 1){ | |
| 75 | - $wms_service_request .= "&VERSION=1.1.1"; | |
| 76 | - } | |
| 77 | - $nome = $dir_tmp."/wms".md5($servico).".xml"; | |
| 78 | - //echo ($wms_service_request);exit; | |
| 79 | - if(!file_exists($nome)){ | |
| 80 | - //$wms_capabilities = file($wms_service_request); | |
| 81 | - $curl = curl_init(); | |
| 82 | - curl_setopt ($curl, CURLOPT_URL, $wms_service_request); | |
| 83 | - curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); | |
| 84 | - curl_setopt($curl, CURLOPT_HEADER, 0); | |
| 85 | - if(isset($i3geo_proxy_server) && $i3geo_proxy_server != ""){ | |
| 86 | - curl_setopt($curl, CURLOPT_PROXY, $i3geo_proxy_server); | |
| 87 | - } | |
| 88 | - $wms_capabilities = curl_exec($curl); | |
| 89 | - curl_close ($curl); | |
| 90 | - if( !$wms_capabilities || $wms_capabilities == ""){ | |
| 91 | - return "erro"; | |
| 92 | - } | |
| 93 | - else{ | |
| 94 | - $fp = fopen($nome, 'w'); | |
| 95 | - //fwrite($fp, implode("",$wms_capabilities)); | |
| 96 | - fwrite($fp,$wms_capabilities); | |
| 97 | - fclose($fp); | |
| 98 | - } | |
| 99 | - } | |
| 100 | - return $nome; | |
| 101 | - } | |
| 102 | - catch(Exception $e){return "erro";} | |
| 103 | -} | |
| 104 | -/* | |
| 105 | -Function: existeTemaWFS | |
| 106 | - | |
| 107 | -Verifica se existe um tema em um servico WFS. | |
| 108 | - | |
| 109 | -Globais: | |
| 110 | - | |
| 111 | -$wfs {string} - endereço do serviço | |
| 112 | - | |
| 113 | -$tema {string} - tema (layer) que será verificado | |
| 114 | - | |
| 115 | -Retorno: | |
| 116 | - | |
| 117 | -{string} - sim|nao | |
| 118 | -*/ | |
| 119 | -function existeTemaWFS() | |
| 120 | -{ | |
| 121 | - global $wfs,$tema; | |
| 122 | - $capabilities = implode("",$wfs); | |
| 123 | - $dom = new DomDocument(); | |
| 124 | - $dom->loadXML($capabilities); | |
| 125 | - $xpath = new DOMXPath($dom); | |
| 126 | - $query = '//WFS_Capabilities/FeatureTypeList/FeatureType'; | |
| 127 | - $entries = $xpath->query($query); | |
| 128 | - foreach($entries as $e) | |
| 129 | - { | |
| 130 | - $e->getElementsByTagName("Name"); | |
| 131 | - $n = $e->nodeValue; | |
| 132 | - if ($n == $tema) | |
| 133 | - {return "sim";} | |
| 134 | - } | |
| 135 | - return "nao"; | |
| 136 | -} | |
| 137 | -/* | |
| 138 | -Function: existeWFS | |
| 139 | - | |
| 140 | -Verifica se existe um servico WFS invocando o getcapabilities. | |
| 141 | - | |
| 142 | -Global: | |
| 143 | - | |
| 144 | -$servico {string} - endereço do serviço | |
| 145 | - | |
| 146 | -Retorno: | |
| 147 | - | |
| 148 | -{string} - nao|true | |
| 149 | -*/ | |
| 150 | -function existeWFS() | |
| 151 | -{ | |
| 152 | - global $servico; | |
| 153 | - $teste = explode("=",$servico); | |
| 154 | - if ( count($teste) > 1 ){$servico = $servico."&";} | |
| 155 | - $wms_service_request = $servico . "REQUEST=GetCapabilities&SERVICE=WFS"; | |
| 156 | - # ------------------------------------------------------------- | |
| 157 | - # Test that the capabilites file has successfully downloaded. | |
| 158 | - # | |
| 159 | - if( !($wfs_capabilities = file($wms_service_request)) ) { | |
| 160 | - # Cannot download the capabilities file. | |
| 161 | - return "nao"; | |
| 162 | - } | |
| 163 | - else | |
| 164 | - {return $wfs_capabilities;} | |
| 165 | -} | |
| 166 | -/* | |
| 167 | -Function: getcapabilities | |
| 168 | - | |
| 169 | -Chama a função getcapabilities e retorna o resultado. | |
| 170 | - | |
| 171 | -Global: | |
| 172 | - | |
| 173 | -$servico {string} - Endereço do web service. | |
| 174 | - | |
| 175 | -Retorno: | |
| 176 | - | |
| 177 | -{string} | |
| 178 | -*/ | |
| 179 | -function getcapabilities() | |
| 180 | -{ | |
| 181 | - global $servico; | |
| 182 | - $teste = explode("=",$servico); | |
| 183 | - if ( count($teste) > 1 ){$servico = $servico."&";} | |
| 184 | - $wms_service_request = $servico . "REQUEST=GetCapabilities&SERVICE=WMS&version=1.1.0"; | |
| 185 | - # ------------------------------------------------------------- | |
| 186 | - # Test that the capabilites file has successfully downloaded. | |
| 187 | - # | |
| 188 | - if( !($wms_capabilities = file($wms_service_request)) ) { | |
| 189 | - # Cannot download the capabilities file. | |
| 190 | - $cp->set_data("Erro de acesso"); | |
| 191 | - return; | |
| 192 | - } | |
| 193 | - $wms_capabilities = implode("",$wms_capabilities); | |
| 194 | - return(xml2html($wms_capabilities)); | |
| 195 | -} | |
| 196 | -/* | |
| 197 | -function: getcapabilities2 | |
| 198 | - | |
| 199 | -Chama a função getcapabilities e retorna o resultado pré-formatado (WMS). | |
| 200 | - | |
| 201 | -Global: | |
| 202 | - | |
| 203 | -$servico {string} - Endereço do web service. | |
| 204 | - | |
| 205 | -Retorno: | |
| 206 | - | |
| 207 | -{string} | |
| 208 | -*/ | |
| 209 | -function getcapabilities2() | |
| 210 | -{ | |
| 211 | - global $servico; | |
| 212 | - $teste = explode("=",$servico); | |
| 213 | - if ( count($teste) > 1 ){$servico = $servico."&";} | |
| 214 | - $wms_service_request = $servico . "REQUEST=GetCapabilities&SERVICE=WMS"; | |
| 215 | - $teste = explode("version",strtolower($wms_service_request)); | |
| 216 | - if(count($teste) == 1) | |
| 217 | - {$wms_service_request .= "&VERSION=1.1.1";} | |
| 218 | - # ------------------------------------------------------------- | |
| 219 | - # Test that the capabilites file has successfully downloaded. | |
| 220 | - # | |
| 221 | - if( !($wms_capabilities = file($wms_service_request)) ) { | |
| 222 | - # Cannot download the capabilities file. | |
| 223 | - $cp->set_data("Erro de acesso"); | |
| 224 | - return; | |
| 225 | - } | |
| 226 | - $wms_capabilities = implode("",$wms_capabilities); | |
| 227 | - $dom = new DomDocument(); | |
| 228 | - $dom->loadXML($wms_capabilities); | |
| 229 | - $xpath = new DOMXPath($dom); | |
| 230 | - $retorno = ""; | |
| 231 | - $query = '//WMT_MS_Capabilities/Service/Name'; | |
| 232 | - $entries = $xpath->query($query); | |
| 233 | - if($entries == FALSE || $entries->length == 0){ | |
| 234 | - $rn = $xpath->registerNamespace("tag", "http://www.opengis.net/wms"); | |
| 235 | - $entries = $xpath->query('/tag:WMS_Capabilities/tag:Service/tag:Name'); | |
| 236 | - } | |
| 237 | - | |
| 238 | - $temp = ""; | |
| 239 | - foreach ($entries as $entry){$temp .= $entry->nodeValue;} | |
| 240 | - $retorno .= "<b>Nome: </b>".$temp; | |
| 241 | - | |
| 242 | - $query = '//WMT_MS_Capabilities/Service/Title'; | |
| 243 | - $entries = $xpath->query($query); | |
| 244 | - if($entries == FALSE || $entries->length == 0){ | |
| 245 | - $entries = $xpath->query('/tag:WMS_Capabilities/tag:Service/tag:Title'); | |
| 246 | - } | |
| 247 | - $temp = ""; | |
| 248 | - foreach ($entries as $entry){$temp .= $entry->nodeValue;} | |
| 249 | - $retorno .= "<br><br><b>Título: </b>".$temp; | |
| 250 | - | |
| 251 | - $query = '//WMT_MS_Capabilities/Service/Abstract'; | |
| 252 | - $entries = $xpath->query($query); | |
| 253 | - if($entries == FALSE || $entries->length == 0){ | |
| 254 | - $entries = $xpath->query('/tag:WMS_Capabilities/tag:Service/tag:Abstract'); | |
| 255 | - } | |
| 256 | - $temp = ""; | |
| 257 | - foreach ($entries as $entry){$temp .= $entry->nodeValue;} | |
| 258 | - $retorno .= "<br><br><b>Resumo: </b>".$temp; | |
| 259 | - | |
| 260 | - $query = '//WMT_MS_Capabilities/Service/KeywordList'; | |
| 261 | - $entries = $xpath->query($query); | |
| 262 | - if($entries == FALSE || $entries->length == 0){ | |
| 263 | - $entries = $xpath->query('/tag:WMS_Capabilities/tag:Service/tag:KeywordList'); | |
| 264 | - } | |
| 265 | - $temp = ""; | |
| 266 | - foreach ($entries as $entry){$temp .= $entry->nodeValue.".";} | |
| 267 | - $retorno .= "<br><br><b>Palavras-chave: </b>".$temp; | |
| 268 | - | |
| 269 | - $query = '//WMT_MS_Capabilities/Service/ContactInformation'; | |
| 270 | - $entries = $xpath->query($query); | |
| 271 | - if($entries == FALSE || $entries->length == 0){ | |
| 272 | - $entries = $xpath->query('/tag:WMS_Capabilities/tag:Service/tag:ContactInformation'); | |
| 273 | - } | |
| 274 | - $temp = ""; | |
| 275 | - foreach ($entries as $entry){$temp .= $entry->nodeValue.".";} | |
| 276 | - $retorno .= "<br><br><b>Contato: </b>".$temp; | |
| 277 | - | |
| 278 | - return($retorno); | |
| 279 | -} | |
| 280 | -/* | |
| 281 | -getcapabilities3 | |
| 282 | - | |
| 283 | -Chama a função getcapabilities e retorna o resultado formatado (WFS). | |
| 284 | - | |
| 285 | -Global: | |
| 286 | - | |
| 287 | -$servico {string} - Endereço do web service. | |
| 288 | - | |
| 289 | - | |
| 290 | -*/ | |
| 291 | -function getcapabilities3() | |
| 292 | -{ | |
| 293 | - global $servico; | |
| 294 | - $teste = explode("=",$servico); | |
| 295 | - if ( count($teste) > 1 ){$servico = $servico."&";} | |
| 296 | - $wms_service_request = $servico . "request=getcapabilities&service=wfs&version=1.0.0"; | |
| 297 | - # ------------------------------------------------------------- | |
| 298 | - # Test that the capabilites file has successfully downloaded. | |
| 299 | - # | |
| 300 | - if( !($wms_capabilities = file($wms_service_request)) ) { | |
| 301 | - # Cannot download the capabilities file. | |
| 302 | - $cp->set_data("Erro de acesso"); | |
| 303 | - return; | |
| 304 | - } | |
| 305 | - $wms_capabilities = implode("",$wms_capabilities); | |
| 306 | - $dom = new DomDocument(); | |
| 307 | - $dom->loadXML($wms_capabilities); | |
| 308 | - $retorno = ""; | |
| 309 | - $services = $dom->getElementsByTagName("Service"); | |
| 310 | - foreach ($services as $service) | |
| 311 | - { | |
| 312 | - $vs = $service->getElementsByTagName("Name"); | |
| 313 | - $temp = ""; | |
| 314 | - foreach ($vs as $v) | |
| 315 | - {$temp .= $v->nodeValue;} | |
| 316 | - $retorno .= "<b>Nome: </b>".$temp; | |
| 317 | - $vs = $service->getElementsByTagName("Title"); | |
| 318 | - $temp = ""; | |
| 319 | - foreach ($vs as $v) | |
| 320 | - {$temp .= $v->nodeValue;} | |
| 321 | - $retorno .= "<br><br><b>Título: </b>".$temp; | |
| 322 | - } | |
| 323 | - return($retorno); | |
| 324 | -} | |
| 325 | -/* | |
| 326 | -Function: temaswms | |
| 327 | - | |
| 328 | -Lista os temas de um web service WMS. | |
| 329 | - | |
| 330 | -Globais: | |
| 331 | - | |
| 332 | -$servico {string} - Endereço do web service. | |
| 333 | - | |
| 334 | -$id_ws {string} - (opcional) id do serviço registrado no sistema de administração do i3geo. Se definido, é feito o registro de tentativa de acesso ao serviço no sistema de administração | |
| 335 | - | |
| 336 | -Retorno: | |
| 337 | - | |
| 338 | -{html} - htaml formatado para permitir a escolha de uma camada | |
| 339 | -*/ | |
| 340 | -function temaswms() | |
| 341 | -{ | |
| 342 | - global $servico,$id_ws; | |
| 343 | - //para admin1/cadastros/servicos/exec.php | |
| 344 | - $_GET["funcao"] = "lista"; | |
| 345 | - $wms_service_request = gravaCacheWMS($servico); | |
| 346 | - # ------------------------------------------------------------- | |
| 347 | - # Test that the capabilites file has successfully downloaded. | |
| 348 | - # | |
| 349 | - //$wms_service_request = "c://temp//teste.xml"; | |
| 350 | - if(file_exists(dirname(__FILE__)."/../admin1/cadastros/servicos/exec.php")){ | |
| 351 | - include_once(dirname(__FILE__)."/../admin1/cadastros/servicos/exec.php"); | |
| 352 | - } | |
| 353 | - else{ | |
| 354 | - include_once(dirname(__FILE__)."/../admin/php/admin.php"); | |
| 355 | - include_once(dirname(__FILE__)."/../admin/php/webservices.php"); | |
| 356 | - } | |
| 357 | - | |
| 358 | - //error_reporting(0); | |
| 359 | - if($wms_service_request == "erro") { | |
| 360 | - # Cannot download the capabilities file. | |
| 361 | - //registra a tentativa de acesso | |
| 362 | - if(isset($id_ws)) | |
| 363 | - { | |
| 364 | - adicionaAcesso($id_ws,false); | |
| 365 | - } | |
| 366 | - $cp->set_data("Erro de acesso"); | |
| 367 | - return; | |
| 368 | - } | |
| 369 | - elseif(isset($id_ws)) | |
| 370 | - { | |
| 371 | - if($id_ws != "") | |
| 372 | - adicionaAcesso($id_ws,true); | |
| 373 | - } | |
| 374 | - $handle = fopen ($wms_service_request, "r"); | |
| 375 | - $wms_capabilities = fread($handle, filesize($wms_service_request)); | |
| 376 | - fclose ($handle); | |
| 377 | - $dom = new DomDocument(); | |
| 378 | - $dom->loadXML($wms_capabilities); | |
| 379 | - | |
| 380 | - //var_dump($dom);exit; | |
| 381 | - //$layers = wms_layers($dom); | |
| 382 | - $xpath = new DOMXPath($dom); | |
| 383 | - //verifica sld | |
| 384 | - $suporta = "nao"; | |
| 385 | - $query = '//WMT_MS_Capabilities/Capability/UserDefinedSymbolization'; | |
| 386 | - $entries = $xpath->query($query); | |
| 387 | - if($entries->length == 0){ | |
| 388 | - $suporta = "sim"; | |
| 389 | - } | |
| 390 | - else{ | |
| 391 | - foreach($entries as $e) | |
| 392 | - {$n = $e->getAttribute("SupportSLD");} | |
| 393 | - if ($n == 1){$suporta = "sim";} | |
| 394 | - } | |
| 395 | - $xpath = new DOMXPath($dom); | |
| 396 | - //var_dump($xpath);exit; | |
| 397 | - $q = '//WMT_MS_Capabilities/Capability'; | |
| 398 | - $query = $q.'/Layer'; | |
| 399 | - $layers = $xpath->query($query); | |
| 400 | - if($layers == FALSE || $layers->length == 0){ | |
| 401 | - $teste = $xpath->registerNamespace("tag", "http://www.opengis.net/wms"); | |
| 402 | - $q = '/tag:WMS_Capabilities/tag:Capability'; | |
| 403 | - $query = $q.'/tag:Layer'; | |
| 404 | - $layers = $xpath->query($query); | |
| 405 | - } | |
| 406 | - //var_dump($layers);exit; | |
| 407 | - $retorna = array(); | |
| 408 | - foreach ($layers as $layer) | |
| 409 | - { | |
| 410 | - $layers1 = $xpath->query('/Layer',$layer); | |
| 411 | - if($layers1->length == 0) //v 1.3.0 | |
| 412 | - {$layers1 = $layers;} | |
| 413 | - else{ | |
| 414 | - $r = pegaTag($layer); | |
| 415 | - $retorna = imprimeTag($r,$retorna); | |
| 416 | - } | |
| 417 | - foreach ($layers1 as $layer1) | |
| 418 | - { | |
| 419 | - $layers2 = $xpath->query('Layer',$layer1); | |
| 420 | - $r1 = pegaTag($layer1); | |
| 421 | - $camada1 = $r1["nome"]; | |
| 422 | - $titulocamada1 = $r1["titulo"]; | |
| 423 | - $retorna = imprimeTag($r1,$retorna); | |
| 424 | - if($r1["estilos"]) | |
| 425 | - {$retorna = imprimeEstilos($r1["estilos"],$suporta,$retorna,$camada1,$titulocamada1);} | |
| 426 | - else | |
| 427 | - { | |
| 428 | - if($layers2->length == 0) | |
| 429 | - $retorna[] = "<input style='cursor:pointer' type=radio NAME='checks' onClick='seltema(\"tema\",\"" . $camada1 . "\",\"\",\"default\",\"".$camada1." ".$titulocamada1."\",\"".$suporta."\")' value='" . $camada1 . "'/> default<i>".$titulocamada1."</i></span><br>"; | |
| 430 | - } | |
| 431 | - foreach ($layers2 as $layer2) | |
| 432 | - { | |
| 433 | - $layers3 = $xpath->query('Layer',$layer2); | |
| 434 | - $r2 = pegaTag($layer2); | |
| 435 | - $camada2 = $r2["nome"]; | |
| 436 | - $titulocamada2 = $r2["titulo"]; | |
| 437 | - $retorna = imprimeTag($r2,$retorna); | |
| 438 | - if($r2["estilos"]) | |
| 439 | - {$retorna = imprimeEstilos($r2["estilos"],$suporta,$retorna,$camada2,$titulocamada2);} | |
| 440 | - else | |
| 441 | - { | |
| 442 | - if($layers3->length == 0) | |
| 443 | - $retorna[] = "<input style='cursor:pointer' type=radio NAME='checks' onClick='seltema(\"tema\",\"" . $camada2 . "\",\"\",\"default\",\"".$camada2." ".$titulocamada2."\",\"".$suporta."\")' value='" . $camada2 . "'/> default <i>".$titulocamada2."</i></span><br>"; | |
| 444 | - } | |
| 445 | - foreach ($layers3 as $layer3) | |
| 446 | - { | |
| 447 | - $r3 = pegaTag($layer3); | |
| 448 | - $camada3 = $r3["nome"]; | |
| 449 | - $titulocamada3 = $r3["titulo"]; | |
| 450 | - $retorna = imprimeTag($r3,$retorna); | |
| 451 | - if($r3["estilos"]) | |
| 452 | - {$retorna = imprimeEstilos($r3["estilos"],$suporta,$retorna,$camada3,$titulocamada3);} | |
| 453 | - else | |
| 454 | - { | |
| 455 | - $retorna[] = "<input style='cursor:pointer' type=radio NAME='checks' onClick='seltema(\"tema\",\"" . $camada3 . "\",\"\",\"default\",\"".$camada3." ".$titulocamada3."\",\"".$suporta."\")' value='" . $camada3 . "'/> default <i>".$titulocamada3."</i></span><br>"; | |
| 456 | - } | |
| 457 | - } | |
| 458 | - } | |
| 459 | - if(count($layers2) == 1){$retorna[] = "<hr>";} | |
| 460 | - } | |
| 461 | - } | |
| 462 | - $retorna[] = "<p class='paragrafo'>Projeção:</p><div class='styled-select'><input type='text' id='proj' value='".implode(",",wms_srs($dom))."' /></div>"; | |
| 463 | - $retorna[] = "<br><p class='paragrafo'>Formatos imagem:</p><div class='styled-select'><input type='text' id='formatos' value='".implode(",",wms_formats($dom))."' /></div>"; | |
| 464 | - $retorna[] = "<br><p class='paragrafo'>Formatos de informação:</p><div class='styled-select'><input type='text' id='formatosinfo' value='".implode(",",wms_formatsinfo($dom))."' /></div>"; | |
| 465 | - $retorna[] = "<br><p class='paragrafo'>Versão:</p><div class='styled-select'><input type='text' id='versao' value='".implode(",",wms_version($dom))."' /></div>"; | |
| 466 | - $retorna[] = "<br><p class='paragrafo'>Suporta SLD:</p><div class='styled-select'><input type='text' id='suportasld' value='".$suporta."' /></div>"; | |
| 467 | - return(implode($retorna)); | |
| 468 | -} | |
| 469 | -/* | |
| 470 | -Function: listaLayersWMS | |
| 471 | - | |
| 472 | -Lista os temas de um web service WMS e retorna o resultado como um array. | |
| 473 | - | |
| 474 | -Globais: | |
| 475 | - | |
| 476 | -$servico {string} - Endereço do web service. | |
| 477 | - | |
| 478 | -$nivel - nível do layer na hierarquia existente no getcapabilities | |
| 479 | - | |
| 480 | -$nomelayer - nome do layer que contém os pr�ximos layers | |
| 481 | - | |
| 482 | -Retorno: | |
| 483 | - | |
| 484 | -{array} | |
| 485 | -*/ | |
| 486 | -function listaLayersWMS() | |
| 487 | -{ | |
| 488 | - global $servico,$nivel,$id_ws,$nomelayer,$tipo_ws; | |
| 489 | - | |
| 490 | - if(!isset($nomelayer)){ | |
| 491 | - $nomelayer = "undefined"; | |
| 492 | - } | |
| 493 | - //para o caso do sistema de metadados estatisticos | |
| 494 | - $wms_service_request = gravaCacheWMS($servico); | |
| 495 | - include_once(dirname(__FILE__)."/../admin/php/admin.php"); | |
| 496 | - include_once(dirname(__FILE__)."/../admin/php/webservices.php"); | |
| 497 | - | |
| 498 | - | |
| 499 | - if($tipo_ws != "WMSMETAESTAT" && $nivel < 2){ | |
| 500 | - if($wms_service_request == "erro") { | |
| 501 | - //registra a tentativa de acesso | |
| 502 | - if(isset($id_ws)){ | |
| 503 | - adicionaAcesso($id_ws,false); | |
| 504 | - } | |
| 505 | - $cp->set_data("Erro de acesso"); | |
| 506 | - return; | |
| 507 | - } | |
| 508 | - elseif(isset($id_ws)){ | |
| 509 | - adicionaAcesso($id_ws,true); | |
| 510 | - } | |
| 511 | - } | |
| 512 | - | |
| 513 | - $handle = fopen ($wms_service_request, "r"); | |
| 514 | - $wms_capabilities = fread ($handle, filesize ($wms_service_request)); | |
| 515 | - fclose ($handle); | |
| 516 | - | |
| 517 | - $dom = new DomDocument(); | |
| 518 | - $dom->loadXML($wms_capabilities); | |
| 519 | - $xpath = new DOMXPath($dom); | |
| 520 | - $q = '//WMT_MS_Capabilities/Capability'; | |
| 521 | - $res = array(); | |
| 522 | - if($nomelayer != "undefined"){ | |
| 523 | - for($i=0; $i < $nivel-1 ; ++$i){ | |
| 524 | - $q .= "/Layer"; | |
| 525 | - } | |
| 526 | - $layersanteriores = $xpath->query($q); | |
| 527 | - foreach ($layersanteriores as $layeranterior){ | |
| 528 | - $r1 = pegaTag($layeranterior); | |
| 529 | - //echo "<pre>";var_dump($layeranterior); | |
| 530 | - if($r1["nome"] == $nomelayer || $r1["titulo"] == $nomelayer) | |
| 531 | - { | |
| 532 | - $layers = $xpath->query('Layer',$layeranterior); | |
| 533 | - foreach ($layers as $layer) | |
| 534 | - { | |
| 535 | - $r = pegaTag($layer); | |
| 536 | - if(!$r["nome"]){$r["nome"] = $r["titulo"];} | |
| 537 | - $res[] = array("nome"=>$r["nome"],"titulo"=>$r["titulo"],"estilos"=>$r["estilos"],"srs"=>wms_srs($dom),"formats"=>wms_formats($dom),"version"=>wms_version($dom),"formatsinfo"=>wms_formatsinfo($dom)); | |
| 538 | - } | |
| 539 | - if($layers->length == 0) | |
| 540 | - { | |
| 541 | - $res[] = array("nome"=>$r1["nome"],"titulo"=>$r1["titulo"],"estilos"=>(array(array("nome"=>"default","titulo"=>"default"))),"srs"=>wms_srs($dom),"formats"=>wms_formats($dom),"version"=>wms_version($dom),"formatsinfo"=>wms_formatsinfo($dom)); | |
| 542 | - } | |
| 543 | - } | |
| 544 | - } | |
| 545 | - } | |
| 546 | - else{ | |
| 547 | - // | |
| 548 | - //pega os layers no primeiro nível | |
| 549 | - // | |
| 550 | - $q .= "/Layer"; | |
| 551 | - $layers = $xpath->query($q); | |
| 552 | - $res = array(); | |
| 553 | - foreach ($layers as $layer){ | |
| 554 | - $r = pegaTag($layer); | |
| 555 | - //var_dump($r); | |
| 556 | - if(!$r["nome"]){ | |
| 557 | - $r["nome"] = $r["titulo"]; | |
| 558 | - } | |
| 559 | - if(array_search("Style",$r["tags"]) || array_search("Layer",$r["tags"])){ | |
| 560 | - $res[] = array( | |
| 561 | - "nome"=>$r["nome"], | |
| 562 | - "titulo"=>$r["titulo"], | |
| 563 | - "estilos"=>$r["estilos"], | |
| 564 | - "srs"=>wms_srs($dom), | |
| 565 | - "formats"=>wms_formats($dom), | |
| 566 | - "version"=>wms_version($dom), | |
| 567 | - "formatsinfo"=>wms_formatsinfo($dom) | |
| 1 | +<?php | |
| 2 | +/* | |
| 3 | + * Title: wmswfs.php | |
| 4 | + * | |
| 5 | + * Funções de uso geral para realizar a leitura e o processamento de Web Services nos padrões OGC. | |
| 6 | + * Atualmente, processa apenas serviços no padrão WMS. | |
| 7 | + * | |
| 8 | + * Licenca: | |
| 9 | + * | |
| 10 | + * GPL2 | |
| 11 | + * | |
| 12 | + * | |
| 13 | + * i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | |
| 14 | + * | |
| 15 | + * Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | |
| 16 | + * Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | |
| 17 | + * | |
| 18 | + * Este programa é software livre; você pode redistribuí-lo | |
| 19 | + * e/ou modificá-lo sob os termos da Licença Pública Geral | |
| 20 | + * GNU conforme publicada pela Free Software Foundation; | |
| 21 | + * | |
| 22 | + * Este programa é distribuído na expectativa de que seja útil, | |
| 23 | + * porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | |
| 24 | + * de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | |
| 25 | + * Consulte a Licença Pública Geral do GNU para mais detalhes. | |
| 26 | + * Você deve ter recebido uma c�pia da Licença Pública Geral do | |
| 27 | + * GNU junto com este programa; se não, escreva para a | |
| 28 | + * Free Software Foundation, Inc., no endereço | |
| 29 | + * 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 30 | + * | |
| 31 | + * Arquivo: | |
| 32 | + * | |
| 33 | + * i3geo/classesphp/wmswfs.php | |
| 34 | + */ | |
| 35 | +/* | |
| 36 | + * Function: gravaCacheWMS | |
| 37 | + * | |
| 38 | + * Lê o getcapabilities de um WMS e salva em disco se o mesmo não tiver sido salvo antes | |
| 39 | + * | |
| 40 | + * O arquivo é gravado no diretório temporário | |
| 41 | + * | |
| 42 | + * Parametros: | |
| 43 | + * | |
| 44 | + * $servico {string} - endereço do WMS | |
| 45 | + * | |
| 46 | + * Global: | |
| 47 | + * | |
| 48 | + * $dir_tmp {string} - (opcional) endereço do diretório temporário onde o cache será armazenado. Se não for definido, tenta obter das variáveis de configuração existentes em i3geo/ms_configura.php | |
| 49 | + * | |
| 50 | + * Return: | |
| 51 | + * | |
| 52 | + * {string} - Nome do arquivo criado. Retorna a palavra "erro" se tiver ocorrido um erro. | |
| 53 | + */ | |
| 54 | +function gravaCacheWMS($servico) { | |
| 55 | + global $dir_tmp, $i3geo_proxy_server; | |
| 56 | + if ($dir_tmp == "") { | |
| 57 | + include (dirname ( __FILE__ ) . "/../ms_configura.php"); | |
| 58 | + } | |
| 59 | + // error_reporting(0); | |
| 60 | + try { | |
| 61 | + $teste = explode ( "=", $servico ); | |
| 62 | + if (count ( $teste ) > 1) { | |
| 63 | + $servico = $servico . "&"; | |
| 64 | + } else { | |
| 65 | + $teste = explode ( "?", $servico ); | |
| 66 | + if (count ( $teste ) == 1) { | |
| 67 | + $servico = $servico . "?"; | |
| 68 | + } | |
| 69 | + } | |
| 70 | + $wms_service_request = $servico . "REQUEST=GetCapabilities&SERVICE=WMS"; | |
| 71 | + $teste = explode ( "version", strtolower ( $wms_service_request ) ); | |
| 72 | + if (count ( $teste ) == 1) { | |
| 73 | + $wms_service_request .= "&VERSION=1.1.1"; | |
| 74 | + } | |
| 75 | + $nome = $dir_tmp . "/wms" . md5 ( $servico ) . ".xml"; | |
| 76 | + // echo ($wms_service_request);exit; | |
| 77 | + if (! file_exists ( $nome )) { | |
| 78 | + // $wms_capabilities = file($wms_service_request); | |
| 79 | + $curl = curl_init (); | |
| 80 | + curl_setopt ( $curl, CURLOPT_URL, $wms_service_request ); | |
| 81 | + curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 1 ); | |
| 82 | + curl_setopt ( $curl, CURLOPT_HEADER, 0 ); | |
| 83 | + if (isset ( $i3geo_proxy_server ) && $i3geo_proxy_server != "") { | |
| 84 | + curl_setopt ( $curl, CURLOPT_PROXY, $i3geo_proxy_server ); | |
| 85 | + } | |
| 86 | + $wms_capabilities = curl_exec ( $curl ); | |
| 87 | + curl_close ( $curl ); | |
| 88 | + if (! $wms_capabilities || $wms_capabilities == "") { | |
| 89 | + return "erro"; | |
| 90 | + } else { | |
| 91 | + $fp = fopen ( $nome, 'w' ); | |
| 92 | + // fwrite($fp, implode("",$wms_capabilities)); | |
| 93 | + fwrite ( $fp, $wms_capabilities ); | |
| 94 | + fclose ( $fp ); | |
| 95 | + } | |
| 96 | + } | |
| 97 | + return $nome; | |
| 98 | + } catch ( Exception $e ) { | |
| 99 | + return "erro"; | |
| 100 | + } | |
| 101 | +} | |
| 102 | +/* | |
| 103 | + * Function: existeTemaWFS | |
| 104 | + * | |
| 105 | + * Verifica se existe um tema em um servico WFS. | |
| 106 | + * | |
| 107 | + * Globais: | |
| 108 | + * | |
| 109 | + * $wfs {string} - endereço do serviço | |
| 110 | + * | |
| 111 | + * $tema {string} - tema (layer) que será verificado | |
| 112 | + * | |
| 113 | + * Retorno: | |
| 114 | + * | |
| 115 | + * {string} - sim|nao | |
| 116 | + */ | |
| 117 | +function existeTemaWFS() { | |
| 118 | + global $wfs, $tema; | |
| 119 | + $capabilities = implode ( "", $wfs ); | |
| 120 | + $dom = new DomDocument (); | |
| 121 | + $dom->loadXML ( $capabilities ); | |
| 122 | + $xpath = new DOMXPath ( $dom ); | |
| 123 | + $query = '//WFS_Capabilities/FeatureTypeList/FeatureType'; | |
| 124 | + $entries = $xpath->query ( $query ); | |
| 125 | + foreach ( $entries as $e ) { | |
| 126 | + $e->getElementsByTagName ( "Name" ); | |
| 127 | + $n = $e->nodeValue; | |
| 128 | + if ($n == $tema) { | |
| 129 | + return "sim"; | |
| 130 | + } | |
| 131 | + } | |
| 132 | + return "nao"; | |
| 133 | +} | |
| 134 | +/* | |
| 135 | + * Function: existeWFS | |
| 136 | + * | |
| 137 | + * Verifica se existe um servico WFS invocando o getcapabilities. | |
| 138 | + * | |
| 139 | + * Global: | |
| 140 | + * | |
| 141 | + * $servico {string} - endereço do serviço | |
| 142 | + * | |
| 143 | + * Retorno: | |
| 144 | + * | |
| 145 | + * {string} - nao|true | |
| 146 | + */ | |
| 147 | +function existeWFS() { | |
| 148 | + global $servico; | |
| 149 | + $teste = explode ( "=", $servico ); | |
| 150 | + if (count ( $teste ) > 1) { | |
| 151 | + $servico = $servico . "&"; | |
| 152 | + } | |
| 153 | + $wms_service_request = $servico . "REQUEST=GetCapabilities&SERVICE=WFS"; | |
| 154 | + // ------------------------------------------------------------- | |
| 155 | + // Test that the capabilites file has successfully downloaded. | |
| 156 | + // | |
| 157 | + if (! ($wfs_capabilities = file ( $wms_service_request ))) { | |
| 158 | + // Cannot download the capabilities file. | |
| 159 | + return "nao"; | |
| 160 | + } else { | |
| 161 | + return $wfs_capabilities; | |
| 162 | + } | |
| 163 | +} | |
| 164 | +/* | |
| 165 | + * Function: getcapabilities | |
| 166 | + * | |
| 167 | + * Chama a função getcapabilities e retorna o resultado. | |
| 168 | + * | |
| 169 | + * Global: | |
| 170 | + * | |
| 171 | + * $servico {string} - Endereço do web service. | |
| 172 | + * | |
| 173 | + * Retorno: | |
| 174 | + * | |
| 175 | + * {string} | |
| 176 | + */ | |
| 177 | +function getcapabilities() { | |
| 178 | + global $servico; | |
| 179 | + $teste = explode ( "=", $servico ); | |
| 180 | + if (count ( $teste ) > 1) { | |
| 181 | + $servico = $servico . "&"; | |
| 182 | + } | |
| 183 | + $wms_service_request = $servico . "REQUEST=GetCapabilities&SERVICE=WMS&version=1.1.0"; | |
| 184 | + // ------------------------------------------------------------- | |
| 185 | + // Test that the capabilites file has successfully downloaded. | |
| 186 | + // | |
| 187 | + if (! ($wms_capabilities = file ( $wms_service_request ))) { | |
| 188 | + // Cannot download the capabilities file. | |
| 189 | + $cp->set_data ( "Erro de acesso" ); | |
| 190 | + return; | |
| 191 | + } | |
| 192 | + $wms_capabilities = implode ( "", $wms_capabilities ); | |
| 193 | + return (xml2html ( $wms_capabilities )); | |
| 194 | +} | |
| 195 | +/* | |
| 196 | + * function: getcapabilities2 | |
| 197 | + * | |
| 198 | + * Chama a função getcapabilities e retorna o resultado pré-formatado (WMS). | |
| 199 | + * | |
| 200 | + * Global: | |
| 201 | + * | |
| 202 | + * $servico {string} - Endereço do web service. | |
| 203 | + * | |
| 204 | + * Retorno: | |
| 205 | + * | |
| 206 | + * {string} | |
| 207 | + */ | |
| 208 | +function getcapabilities2() { | |
| 209 | + global $servico; | |
| 210 | + $teste = explode ( "=", $servico ); | |
| 211 | + if (count ( $teste ) > 1) { | |
| 212 | + $servico = $servico . "&"; | |
| 213 | + } | |
| 214 | + $wms_service_request = $servico . "REQUEST=GetCapabilities&SERVICE=WMS"; | |
| 215 | + $teste = explode ( "version", strtolower ( $wms_service_request ) ); | |
| 216 | + if (count ( $teste ) == 1) { | |
| 217 | + $wms_service_request .= "&VERSION=1.1.1"; | |
| 218 | + } | |
| 219 | + // ------------------------------------------------------------- | |
| 220 | + // Test that the capabilites file has successfully downloaded. | |
| 221 | + // | |
| 222 | + if (! ($wms_capabilities = file ( $wms_service_request ))) { | |
| 223 | + // Cannot download the capabilities file. | |
| 224 | + $cp->set_data ( "Erro de acesso" ); | |
| 225 | + return; | |
| 226 | + } | |
| 227 | + $wms_capabilities = implode ( "", $wms_capabilities ); | |
| 228 | + $dom = new DomDocument (); | |
| 229 | + $dom->loadXML ( $wms_capabilities ); | |
| 230 | + $xpath = new DOMXPath ( $dom ); | |
| 231 | + $retorno = ""; | |
| 232 | + $query = '//WMT_MS_Capabilities/Service/Name'; | |
| 233 | + $entries = $xpath->query ( $query ); | |
| 234 | + if ($entries == FALSE || $entries->length == 0) { | |
| 235 | + $rn = $xpath->registerNamespace ( "tag", "http://www.opengis.net/wms" ); | |
| 236 | + $entries = $xpath->query ( '/tag:WMS_Capabilities/tag:Service/tag:Name' ); | |
| 237 | + } | |
| 238 | + | |
| 239 | + $temp = ""; | |
| 240 | + foreach ( $entries as $entry ) { | |
| 241 | + $temp .= $entry->nodeValue; | |
| 242 | + } | |
| 243 | + $retorno .= "<b>Nome: </b>" . $temp; | |
| 244 | + | |
| 245 | + $query = '//WMT_MS_Capabilities/Service/Title'; | |
| 246 | + $entries = $xpath->query ( $query ); | |
| 247 | + if ($entries == FALSE || $entries->length == 0) { | |
| 248 | + $entries = $xpath->query ( '/tag:WMS_Capabilities/tag:Service/tag:Title' ); | |
| 249 | + } | |
| 250 | + $temp = ""; | |
| 251 | + foreach ( $entries as $entry ) { | |
| 252 | + $temp .= $entry->nodeValue; | |
| 253 | + } | |
| 254 | + $retorno .= "<br><br><b>Título: </b>" . $temp; | |
| 255 | + | |
| 256 | + $query = '//WMT_MS_Capabilities/Service/Abstract'; | |
| 257 | + $entries = $xpath->query ( $query ); | |
| 258 | + if ($entries == FALSE || $entries->length == 0) { | |
| 259 | + $entries = $xpath->query ( '/tag:WMS_Capabilities/tag:Service/tag:Abstract' ); | |
| 260 | + } | |
| 261 | + $temp = ""; | |
| 262 | + foreach ( $entries as $entry ) { | |
| 263 | + $temp .= $entry->nodeValue; | |
| 264 | + } | |
| 265 | + $retorno .= "<br><br><b>Resumo: </b>" . $temp; | |
| 266 | + | |
| 267 | + $query = '//WMT_MS_Capabilities/Service/KeywordList'; | |
| 268 | + $entries = $xpath->query ( $query ); | |
| 269 | + if ($entries == FALSE || $entries->length == 0) { | |
| 270 | + $entries = $xpath->query ( '/tag:WMS_Capabilities/tag:Service/tag:KeywordList' ); | |
| 271 | + } | |
| 272 | + $temp = ""; | |
| 273 | + foreach ( $entries as $entry ) { | |
| 274 | + $temp .= $entry->nodeValue . "."; | |
| 275 | + } | |
| 276 | + $retorno .= "<br><br><b>Palavras-chave: </b>" . $temp; | |
| 277 | + | |
| 278 | + $query = '//WMT_MS_Capabilities/Service/ContactInformation'; | |
| 279 | + $entries = $xpath->query ( $query ); | |
| 280 | + if ($entries == FALSE || $entries->length == 0) { | |
| 281 | + $entries = $xpath->query ( '/tag:WMS_Capabilities/tag:Service/tag:ContactInformation' ); | |
| 282 | + } | |
| 283 | + $temp = ""; | |
| 284 | + foreach ( $entries as $entry ) { | |
| 285 | + $temp .= $entry->nodeValue . "."; | |
| 286 | + } | |
| 287 | + $retorno .= "<br><br><b>Contato: </b>" . $temp; | |
| 288 | + | |
| 289 | + return ($retorno); | |
| 290 | +} | |
| 291 | +/* | |
| 292 | + * getcapabilities3 | |
| 293 | + * | |
| 294 | + * Chama a função getcapabilities e retorna o resultado formatado (WFS). | |
| 295 | + * | |
| 296 | + * Global: | |
| 297 | + * | |
| 298 | + * $servico {string} - Endereço do web service. | |
| 299 | + * | |
| 300 | + * | |
| 301 | + */ | |
| 302 | +function getcapabilities3() { | |
| 303 | + global $servico; | |
| 304 | + $teste = explode ( "=", $servico ); | |
| 305 | + if (count ( $teste ) > 1) { | |
| 306 | + $servico = $servico . "&"; | |
| 307 | + } | |
| 308 | + $wms_service_request = $servico . "request=getcapabilities&service=wfs&version=1.0.0"; | |
| 309 | + // ------------------------------------------------------------- | |
| 310 | + // Test that the capabilites file has successfully downloaded. | |
| 311 | + // | |
| 312 | + if (! ($wms_capabilities = file ( $wms_service_request ))) { | |
| 313 | + // Cannot download the capabilities file. | |
| 314 | + $cp->set_data ( "Erro de acesso" ); | |
| 315 | + return; | |
| 316 | + } | |
| 317 | + $wms_capabilities = implode ( "", $wms_capabilities ); | |
| 318 | + $dom = new DomDocument (); | |
| 319 | + $dom->loadXML ( $wms_capabilities ); | |
| 320 | + $retorno = ""; | |
| 321 | + $services = $dom->getElementsByTagName ( "Service" ); | |
| 322 | + foreach ( $services as $service ) { | |
| 323 | + $vs = $service->getElementsByTagName ( "Name" ); | |
| 324 | + $temp = ""; | |
| 325 | + foreach ( $vs as $v ) { | |
| 326 | + $temp .= $v->nodeValue; | |
| 327 | + } | |
| 328 | + $retorno .= "<b>Nome: </b>" . $temp; | |
| 329 | + $vs = $service->getElementsByTagName ( "Title" ); | |
| 330 | + $temp = ""; | |
| 331 | + foreach ( $vs as $v ) { | |
| 332 | + $temp .= $v->nodeValue; | |
| 333 | + } | |
| 334 | + $retorno .= "<br><br><b>Título: </b>" . $temp; | |
| 335 | + } | |
| 336 | + return ($retorno); | |
| 337 | +} | |
| 338 | +/* | |
| 339 | + * Function: temaswms | |
| 340 | + * | |
| 341 | + * Lista os temas de um web service WMS. | |
| 342 | + * | |
| 343 | + * Globais: | |
| 344 | + * | |
| 345 | + * $servico {string} - Endereço do web service. | |
| 346 | + * | |
| 347 | + * $id_ws {string} - (opcional) id do serviço registrado no sistema de administração do i3geo. Se definido, é feito o registro de tentativa de acesso ao serviço no sistema de administração | |
| 348 | + * | |
| 349 | + * Retorno: | |
| 350 | + * | |
| 351 | + * {html} - htaml formatado para permitir a escolha de uma camada | |
| 352 | + */ | |
| 353 | +function temaswms() { | |
| 354 | + global $servico, $id_ws; | |
| 355 | + // para admin1/cadastros/servicos/exec.php | |
| 356 | + $_GET ["funcao"] = "lista"; | |
| 357 | + $wms_service_request = gravaCacheWMS ( $servico ); | |
| 358 | + // ------------------------------------------------------------- | |
| 359 | + // Test that the capabilites file has successfully downloaded. | |
| 360 | + // | |
| 361 | + // $wms_service_request = "c://temp//teste.xml"; | |
| 362 | + if (file_exists ( dirname ( __FILE__ ) . "/../admin1/cadastros/servicos/exec.php" )) { | |
| 363 | + include_once (dirname ( __FILE__ ) . "/../admin1/cadastros/servicos/exec.php"); | |
| 364 | + } else { | |
| 365 | + include_once (dirname ( __FILE__ ) . "/../admin/php/admin.php"); | |
| 366 | + include_once (dirname ( __FILE__ ) . "/../admin/php/webservices.php"); | |
| 367 | + } | |
| 368 | + | |
| 369 | + // error_reporting(0); | |
| 370 | + if ($wms_service_request == "erro") { | |
| 371 | + // Cannot download the capabilities file. | |
| 372 | + // registra a tentativa de acesso | |
| 373 | + if (isset ( $id_ws )) { | |
| 374 | + adicionaAcesso ( $id_ws, false ); | |
| 375 | + } | |
| 376 | + $cp->set_data ( "Erro de acesso" ); | |
| 377 | + return; | |
| 378 | + } elseif (isset ( $id_ws )) { | |
| 379 | + if ($id_ws != "") | |
| 380 | + adicionaAcesso ( $id_ws, true ); | |
| 381 | + } | |
| 382 | + $handle = fopen ( $wms_service_request, "r" ); | |
| 383 | + $wms_capabilities = fread ( $handle, filesize ( $wms_service_request ) ); | |
| 384 | + fclose ( $handle ); | |
| 385 | + $dom = new DomDocument (); | |
| 386 | + $dom->loadXML ( $wms_capabilities ); | |
| 387 | + | |
| 388 | + // var_dump($dom);exit; | |
| 389 | + // $layers = wms_layers($dom); | |
| 390 | + $xpath = new DOMXPath ( $dom ); | |
| 391 | + // verifica sld | |
| 392 | + $suporta = "nao"; | |
| 393 | + $query = '//WMT_MS_Capabilities/Capability/UserDefinedSymbolization'; | |
| 394 | + $entries = $xpath->query ( $query ); | |
| 395 | + if ($entries->length == 0) { | |
| 396 | + $suporta = "sim"; | |
| 397 | + } else { | |
| 398 | + foreach ( $entries as $e ) { | |
| 399 | + $n = $e->getAttribute ( "SupportSLD" ); | |
| 400 | + } | |
| 401 | + if ($n == 1) { | |
| 402 | + $suporta = "sim"; | |
| 403 | + } | |
| 404 | + } | |
| 405 | + $xpath = new DOMXPath ( $dom ); | |
| 406 | + // var_dump($xpath);exit; | |
| 407 | + $q = '//WMT_MS_Capabilities/Capability'; | |
| 408 | + $query = $q . '/Layer'; | |
| 409 | + $layers = $xpath->query ( $query ); | |
| 410 | + if ($layers == FALSE || $layers->length == 0) { | |
| 411 | + $teste = $xpath->registerNamespace ( "tag", "http://www.opengis.net/wms" ); | |
| 412 | + $q = '/tag:WMS_Capabilities/tag:Capability'; | |
| 413 | + $query = $q . '/tag:Layer'; | |
| 414 | + $layers = $xpath->query ( $query ); | |
| 415 | + } | |
| 416 | + // var_dump($layers);exit; | |
| 417 | + $retorna = array (); | |
| 418 | + foreach ( $layers as $layer ) { | |
| 419 | + $layers1 = $xpath->query ( '/Layer', $layer ); | |
| 420 | + if ($layers1->length == 0) // v 1.3.0 | |
| 421 | +{ | |
| 422 | + $layers1 = $layers; | |
| 423 | + } else { | |
| 424 | + $r = pegaTag ( $layer ); | |
| 425 | + $retorna = imprimeTag ( $r, $retorna ); | |
| 426 | + } | |
| 427 | + foreach ( $layers1 as $layer1 ) { | |
| 428 | + $layers2 = $xpath->query ( 'Layer', $layer1 ); | |
| 429 | + $r1 = pegaTag ( $layer1 ); | |
| 430 | + $camada1 = $r1 ["nome"]; | |
| 431 | + $titulocamada1 = $r1 ["titulo"]; | |
| 432 | + $retorna = imprimeTag ( $r1, $retorna ); | |
| 433 | + if ($r1 ["estilos"]) { | |
| 434 | + $retorna = imprimeEstilos ( $r1 ["estilos"], $suporta, $retorna, $camada1, $titulocamada1 ); | |
| 435 | + } else { | |
| 436 | + if ($layers2->length == 0){ | |
| 437 | + $retorna [] = imprimeEstilos2 ($camada1, $titulocamada1, $suporta); | |
| 438 | + //$retorna [] = "<input style='cursor:pointer' type=radio NAME='checks' onClick='seltema(\"tema\",\"" . $camada1 . "\",\"\",\"default\",\"" . $camada1 . " " . $titulocamada1 . "\",\"" . $suporta . "\")' value='" . $camada1 . "'/> default<i>" . $titulocamada1 . "</i></span><br>"; | |
| 439 | + } | |
| 440 | + } | |
| 441 | + foreach ( $layers2 as $layer2 ) { | |
| 442 | + $layers3 = $xpath->query ( 'Layer', $layer2 ); | |
| 443 | + $r2 = pegaTag ( $layer2 ); | |
| 444 | + $camada2 = $r2 ["nome"]; | |
| 445 | + $titulocamada2 = $r2 ["titulo"]; | |
| 446 | + $retorna = imprimeTag ( $r2, $retorna ); | |
| 447 | + if ($r2 ["estilos"]) { | |
| 448 | + $retorna = imprimeEstilos ( $r2 ["estilos"], $suporta, $retorna, $camada2, $titulocamada2 ); | |
| 449 | + } else { | |
| 450 | + if ($layers3->length == 0) | |
| 451 | + $retorna [] = imprimeEstilos2 ($camada2, $titulocamada2, $suporta); | |
| 452 | + //$retorna [] = "<input style='cursor:pointer' type=radio NAME='checks' onClick='seltema(\"tema\",\"" . $camada2 . "\",\"\",\"default\",\"" . $camada2 . " " . $titulocamada2 . "\",\"" . $suporta . "\")' value='" . $camada2 . "'/> default <i>" . $titulocamada2 . "</i></span><br>"; | |
| 453 | + } | |
| 454 | + foreach ( $layers3 as $layer3 ) { | |
| 455 | + $r3 = pegaTag ( $layer3 ); | |
| 456 | + $camada3 = $r3 ["nome"]; | |
| 457 | + $titulocamada3 = $r3 ["titulo"]; | |
| 458 | + $retorna = imprimeTag ( $r3, $retorna ); | |
| 459 | + if ($r3 ["estilos"]) { | |
| 460 | + $retorna = imprimeEstilos ( $r3 ["estilos"], $suporta, $retorna, $camada3, $titulocamada3 ); | |
| 461 | + } else { | |
| 462 | + $retorna [] = imprimeEstilos2 ($camada3, $titulocamada3, $suporta); | |
| 463 | + //$retorna [] = "<input style='cursor:pointer' type=radio NAME='checks' onClick='seltema(\"tema\",\"" . $camada3 . "\",\"\",\"default\",\"" . $camada3 . " " . $titulocamada3 . "\",\"" . $suporta . "\")' value='" . $camada3 . "'/> default <i>" . $titulocamada3 . "</i></span><br>"; | |
| 464 | + } | |
| 465 | + } | |
| 466 | + } | |
| 467 | + if (count ( $layers2 ) == 1) { | |
| 468 | + $retorna [] = "<hr>"; | |
| 469 | + } | |
| 470 | + } | |
| 471 | + } | |
| 472 | + | |
| 473 | + $retorna [] = "<div class='form-group label-fixed condensed' ><label class='control-label' for='proj'>Projeção</label><input class='form-control input-lg' type='text' id='proj' value='" . implode ( ",", wms_srs ( $dom ) ) . "' /></div>"; | |
| 474 | + $retorna [] = "<div class='form-group label-fixed condensed' ><label class='control-label' for='formatos'>Formatos imagem</label><input class='form-control input-lg' type='text' id='formatos' value='" . implode ( ",", wms_formats ( $dom ) ) . "' /></div>"; | |
| 475 | + $retorna [] = "<div class='form-group label-fixed condensed' ><label class='control-label' for='formatosinfo'>Formatos de informação</label><input class='form-control input-lg' type='text' id='formatosinfo' value='" . implode ( ",", wms_formatsinfo ( $dom ) ) . "' /></div>"; | |
| 476 | + $retorna [] = "<div class='form-group label-fixed condensed' ><label class='control-label' for='versao'>Versão</label><input class='form-control input-lg' type='text' id='versao' value='" . implode ( ",", wms_version ( $dom ) ) . "' /></div>"; | |
| 477 | + $retorna [] = "<div class='form-group label-fixed condensed' ><label class='control-label' for='suportasld'>Suporta SLD</label><input class='form-control input-lg' type='text' id='suportasld' value='" . $suporta . "' /></div>"; | |
| 478 | + | |
| 479 | + //$retorna [] = "<h5>Projeção:</h5><div class='styled-select'><input type='text' id='proj' value='" . implode ( ",", wms_srs ( $dom ) ) . "' /></div>"; | |
| 480 | + //$retorna [] = "<br><p class='paragrafo'>Formatos imagem:</p><div class='styled-select'><input type='text' id='formatos' value='" . implode ( ",", wms_formats ( $dom ) ) . "' /></div>"; | |
| 481 | + //$retorna [] = "<br><p class='paragrafo'>Formatos de informação:</p><div class='styled-select'><input type='text' id='formatosinfo' value='" . implode ( ",", wms_formatsinfo ( $dom ) ) . "' /></div>"; | |
| 482 | + //$retorna [] = "<br><p class='paragrafo'>Versão:</p><div class='styled-select'><input type='text' id='versao' value='" . implode ( ",", wms_version ( $dom ) ) . "' /></div>"; | |
| 483 | + //$retorna [] = "<br><p class='paragrafo'>Suporta SLD:</p><div class='styled-select'><input type='text' id='suportasld' value='" . $suporta . "' /></div>"; | |
| 484 | + return (implode ( $retorna )); | |
| 485 | +} | |
| 486 | +/* | |
| 487 | + * Function: listaLayersWMS | |
| 488 | + * | |
| 489 | + * Lista os temas de um web service WMS e retorna o resultado como um array. | |
| 490 | + * | |
| 491 | + * Globais: | |
| 492 | + * | |
| 493 | + * $servico {string} - Endereço do web service. | |
| 494 | + * | |
| 495 | + * $nivel - nível do layer na hierarquia existente no getcapabilities | |
| 496 | + * | |
| 497 | + * $nomelayer - nome do layer que contém os pr�ximos layers | |
| 498 | + * | |
| 499 | + * Retorno: | |
| 500 | + * | |
| 501 | + * {array} | |
| 502 | + */ | |
| 503 | +function listaLayersWMS() { | |
| 504 | + global $servico, $nivel, $id_ws, $nomelayer, $tipo_ws; | |
| 505 | + | |
| 506 | + if (! isset ( $nomelayer )) { | |
| 507 | + $nomelayer = "undefined"; | |
| 508 | + } | |
| 509 | + // para o caso do sistema de metadados estatisticos | |
| 510 | + $wms_service_request = gravaCacheWMS ( $servico ); | |
| 511 | + include_once (dirname ( __FILE__ ) . "/../admin/php/admin.php"); | |
| 512 | + include_once (dirname ( __FILE__ ) . "/../admin/php/webservices.php"); | |
| 513 | + | |
| 514 | + if ($tipo_ws != "WMSMETAESTAT" && $nivel < 2) { | |
| 515 | + if ($wms_service_request == "erro") { | |
| 516 | + // registra a tentativa de acesso | |
| 517 | + if (isset ( $id_ws )) { | |
| 518 | + adicionaAcesso ( $id_ws, false ); | |
| 519 | + } | |
| 520 | + $cp->set_data ( "Erro de acesso" ); | |
| 521 | + return; | |
| 522 | + } elseif (isset ( $id_ws )) { | |
| 523 | + adicionaAcesso ( $id_ws, true ); | |
| 524 | + } | |
| 525 | + } | |
| 526 | + | |
| 527 | + $handle = fopen ( $wms_service_request, "r" ); | |
| 528 | + $wms_capabilities = fread ( $handle, filesize ( $wms_service_request ) ); | |
| 529 | + fclose ( $handle ); | |
| 530 | + | |
| 531 | + $dom = new DomDocument (); | |
| 532 | + $dom->loadXML ( $wms_capabilities ); | |
| 533 | + $xpath = new DOMXPath ( $dom ); | |
| 534 | + $q = '//WMT_MS_Capabilities/Capability'; | |
| 535 | + $res = array (); | |
| 536 | + if ($nomelayer != "undefined") { | |
| 537 | + for($i = 0; $i < $nivel - 1; ++ $i) { | |
| 538 | + $q .= "/Layer"; | |
| 539 | + } | |
| 540 | + $layersanteriores = $xpath->query ( $q ); | |
| 541 | + foreach ( $layersanteriores as $layeranterior ) { | |
| 542 | + $r1 = pegaTag ( $layeranterior ); | |
| 543 | + // echo "<pre>";var_dump($layeranterior); | |
| 544 | + if ($r1 ["nome"] == $nomelayer || $r1 ["titulo"] == $nomelayer) { | |
| 545 | + $layers = $xpath->query ( 'Layer', $layeranterior ); | |
| 546 | + foreach ( $layers as $layer ) { | |
| 547 | + $r = pegaTag ( $layer ); | |
| 548 | + if (! $r ["nome"]) { | |
| 549 | + $r ["nome"] = $r ["titulo"]; | |
| 550 | + } | |
| 551 | + $res [] = array ( | |
| 552 | + "nome" => $r ["nome"], | |
| 553 | + "titulo" => $r ["titulo"], | |
| 554 | + "estilos" => $r ["estilos"], | |
| 555 | + "srs" => wms_srs ( $dom ), | |
| 556 | + "formats" => wms_formats ( $dom ), | |
| 557 | + "version" => wms_version ( $dom ), | |
| 558 | + "formatsinfo" => wms_formatsinfo ( $dom ) | |
| 559 | + ); | |
| 560 | + } | |
| 561 | + if ($layers->length == 0) { | |
| 562 | + $res [] = array ( | |
| 563 | + "nome" => $r1 ["nome"], | |
| 564 | + "titulo" => $r1 ["titulo"], | |
| 565 | + "estilos" => (array ( | |
| 566 | + array ( | |
| 567 | + "nome" => "default", | |
| 568 | + "titulo" => "default" | |
| 569 | + ) | |
| 570 | + )), | |
| 571 | + "srs" => wms_srs ( $dom ), | |
| 572 | + "formats" => wms_formats ( $dom ), | |
| 573 | + "version" => wms_version ( $dom ), | |
| 574 | + "formatsinfo" => wms_formatsinfo ( $dom ) | |
| 575 | + ); | |
| 576 | + } | |
| 577 | + } | |
| 578 | + } | |
| 579 | + } else { | |
| 580 | + // | |
| 581 | + // pega os layers no primeiro nível | |
| 582 | + // | |
| 583 | + $q .= "/Layer"; | |
| 584 | + $layers = $xpath->query ( $q ); | |
| 585 | + $res = array (); | |
| 586 | + foreach ( $layers as $layer ) { | |
| 587 | + $r = pegaTag ( $layer ); | |
| 588 | + // var_dump($r); | |
| 589 | + if (! $r ["nome"]) { | |
| 590 | + $r ["nome"] = $r ["titulo"]; | |
| 591 | + } | |
| 592 | + if (array_search ( "Style", $r ["tags"] ) || array_search ( "Layer", $r ["tags"] )) { | |
| 593 | + $res [] = array ( | |
| 594 | + "nome" => $r ["nome"], | |
| 595 | + "titulo" => $r ["titulo"], | |
| 596 | + "estilos" => $r ["estilos"], | |
| 597 | + "srs" => wms_srs ( $dom ), | |
| 598 | + "formats" => wms_formats ( $dom ), | |
| 599 | + "version" => wms_version ( $dom ), | |
| 600 | + "formatsinfo" => wms_formatsinfo ( $dom ) | |
| 601 | + ) | |
| 602 | + ; | |
| 603 | + } | |
| 604 | + } | |
| 605 | + } | |
| 606 | + // exit; | |
| 607 | + return ($res); | |
| 608 | +} | |
| 609 | +function imprimeEstilos($es, $suporta, $retorna, $tval, $tituloalternativo) { | |
| 610 | + foreach ( $es as $e ) { | |
| 611 | + $nomeestilo = $e ["nome"]; | |
| 612 | + $nomecamada = $e ["titulo"]; | |
| 613 | + $tituloestilo = $e ["titulo"]; | |
| 614 | + $onclick = "seltema(\"estilo\",\"" . $tval . "\",\"\",\"" . $nomeestilo . "\",\"" . $tituloalternativo . " " . $nomecamada . " " . $tituloestilo . "\",\"" . $suporta . "\")"; | |
| 615 | + | |
| 616 | + $retorna [] = <<<EOT | |
| 617 | +<div class="list-group condensed"> | |
| 618 | +<div class="row-content text-left"> | |
| 619 | +<a onclick='$onclick' role="button" class="btn btn-default btn-fab btn-fab-max" href="javascript:void(0)"> | |
| 620 | +<span class="material-icons">visibility</span> | |
| 621 | +</a> | |
| 622 | +<label class="nomeTema" > | |
| 623 | +<a onclick='$onclick' href="javascript:void(0)"><h4> | |
| 624 | +$nomeestilo | |
| 625 | +</h4></a> | |
| 626 | +<h6>$tituloestilo</h6> | |
| 627 | +</label> | |
| 628 | +</div> | |
| 629 | +</div> | |
| 630 | +EOT; | |
| 631 | + | |
| 632 | + // $retorna[] = "<button class='btn btn-primary btn-sm btn-raised' onClick='".onclick."' value='" . $nomeestilo . "'/>" . $nomeestilo." <i>".$tituloestilo."</i></span><br>"; | |
| 633 | + } | |
| 634 | + return $retorna; | |
| 635 | +} | |
| 636 | +function imprimeEstilos2($camada1, $titulocamada1, $suporta) { | |
| 637 | + $onclick = "seltema(\"tema\",\"" . $camada1 . "\",\"\",\"default\",\"" . $camada1 . " " . $titulocamada1 . "\",\"" . $suporta . "\")"; | |
| 638 | + $retorna = <<<EOT | |
| 639 | +<div class="list-group condensed"> | |
| 640 | +<div class="row-content text-left"> | |
| 641 | +<a onclick='$onclick' role="button" class="btn btn-default btn-fab btn-fab-max" href="javascript:void(0)"> | |
| 642 | +<span class="material-icons">visibility</span> | |
| 643 | +</a> | |
| 644 | +<label class="nomeTema" > | |
| 645 | +<a onclick='$onclick' href="javascript:void(0)"><h4> | |
| 646 | +default | |
| 647 | +</h4></a> | |
| 648 | +<h6>$titulocamada1</h6> | |
| 649 | +</label> | |
| 650 | +</div> | |
| 651 | +</div> | |
| 652 | +EOT; | |
| 653 | + | |
| 654 | + return $retorna; | |
| 655 | +} | |
| 656 | + | |
| 657 | +function imprimeTag($r, $retorna) { | |
| 658 | + if (! $r ["nome"]) { | |
| 659 | + $retorna [] = "<h4>" . $r ["titulo"] . "</h4>"; | |
| 660 | + } else { | |
| 661 | + $retorna [] = "<hr>"; | |
| 662 | + $retorna [] = "<h3>" . $r ["nome"] . "</h3>"; | |
| 663 | + //$retorna [] = "<h4>" . $r ["titulo"] . "</h4>"; | |
| 664 | + $retorna [] = "<h5>" . $r ["resumo"] . "</h5>"; | |
| 665 | + } | |
| 666 | + return $retorna; | |
| 667 | +} | |
| 668 | +function pegaTag($layer) { | |
| 669 | + // error_reporting(0); | |
| 670 | + $noslayer = $layer->childNodes; | |
| 671 | + $resultado = array ( | |
| 672 | + "estiloas" => array (), | |
| 673 | + "tags" => array () | |
| 674 | + ); | |
| 675 | + for($i = 0; $i < $noslayer->length; ++ $i) { | |
| 676 | + $tnome = $noslayer->item ( $i )->tagName; | |
| 677 | + $tvalor = $noslayer->item ( $i )->nodeValue; | |
| 678 | + if ($tnome) { | |
| 679 | + // echo "<br>".$tnome; | |
| 680 | + if ($tnome == "Title") { | |
| 681 | + $resultado ["titulo"] = $tvalor; | |
| 682 | + } | |
| 683 | + if ($tnome == "Name") { | |
| 684 | + $resultado ["nome"] = $tvalor; | |
| 685 | + } | |
| 686 | + if ($tnome == "Abstract") { | |
| 687 | + $resultado ["resumo"] = $tvalor; | |
| 688 | + } | |
| 689 | + | |
| 690 | + if ($tnome == "Style") { | |
| 691 | + $ss = $noslayer->item ( $i )->childNodes; | |
| 692 | + $ssl = $ss->length; | |
| 693 | + $n = ""; | |
| 694 | + $t = ""; | |
| 695 | + for($s = 0; $s < $ssl; $s ++) { | |
| 696 | + $snome = $ss->item ( $s )->tagName; | |
| 697 | + $svalor = $ss->item ( $s )->nodeValue; | |
| 698 | + if ($snome) { | |
| 699 | + if ($snome == "Title") { | |
| 700 | + $t = $svalor; | |
| 701 | + } | |
| 702 | + if ($snome == "Name") { | |
| 703 | + $n = $svalor; | |
| 704 | + } | |
| 705 | + } | |
| 706 | + } | |
| 707 | + // echo "<pre>";echo $n; | |
| 708 | + if ($n != "") { | |
| 709 | + array_push ( $resultado ["estilos"], array ( | |
| 710 | + "nome" => $n, | |
| 711 | + "titulo" => $t | |
| 712 | + ) ); | |
| 713 | + } | |
| 714 | + } | |
| 715 | + array_push ( $resultado ["tags"], $tnome ); | |
| 716 | + // echo "<pre>";var_dump($resultado); | |
| 717 | + } | |
| 718 | + } | |
| 719 | + return $resultado; | |
| 720 | +} | |
| 721 | + | |
| 722 | +/* | |
| 723 | + * temaswfs | |
| 724 | + * | |
| 725 | + * Lista os temas de um web service WFS. | |
| 726 | + * | |
| 727 | + * parameters: | |
| 728 | + * $servico - Endereço do web service. | |
| 729 | + * | |
| 730 | + * $cp - Objeto CPAINT. | |
| 731 | + */ | |
| 732 | +function temaswfs() { | |
| 733 | + global $servico, $cp; | |
| 734 | + $teste = explode ( "=", $servico ); | |
| 735 | + if (count ( $teste ) > 1) { | |
| 736 | + $servico = $servico . "&"; | |
| 737 | + } | |
| 738 | + $wms_service_request = $servico . "REQUEST=GetCapabilities&SERVICE=WFS"; | |
| 739 | + // ------------------------------------------------------------- | |
| 740 | + // Test that the capabilites file has successfully downloaded. | |
| 741 | + // | |
| 742 | + if (! ($wms_capabilities = file ( $wms_service_request ))) { | |
| 743 | + // Cannot download the capabilities file. | |
| 744 | + $cp->set_data ( "Erro de acesso" ); | |
| 745 | + return; | |
| 746 | + } | |
| 747 | + $wms_capabilities = implode ( "", $wms_capabilities ); | |
| 748 | + $dom = new DomDocument (); | |
| 749 | + $dom->loadXML ( $wms_capabilities ); | |
| 750 | + $services = $dom->getElementsByTagName ( "Service" ); | |
| 751 | + foreach ( $services as $service ) { | |
| 752 | + $vs = $service->getElementsByTagName ( "Name" ); | |
| 753 | + $serv = ""; | |
| 754 | + foreach ( $vs as $v ) { | |
| 755 | + $serv .= $v->nodeValue; | |
| 756 | + } | |
| 757 | + } | |
| 758 | + $layers = $dom->getElementsByTagName ( "FeatureType" ); | |
| 759 | + foreach ( $layers as $layer ) { | |
| 760 | + $vs = $layer->getElementsByTagName ( "Title" ); | |
| 761 | + $temp1 = ""; | |
| 762 | + foreach ( $vs as $v ) { | |
| 763 | + $temp1 .= $v->nodeValue; | |
| 764 | + } | |
| 765 | + | |
| 766 | + $vs = $layer->getElementsByTagName ( "Abstract" ); | |
| 767 | + $temp2 = ""; | |
| 768 | + foreach ( $vs as $v ) { | |
| 769 | + $temp2 .= $v->nodeValue; | |
| 770 | + } | |
| 771 | + | |
| 772 | + $vs = $layer->getElementsByTagName ( "SRS" ); | |
| 773 | + $temp3 = array (); | |
| 774 | + foreach ( $vs as $v ) { | |
| 775 | + $temp3 [] = $v->nodeValue; | |
| 776 | + } | |
| 777 | + $temp3 = implode ( "#", $temp3 ); | |
| 778 | + | |
| 779 | + $vs = $layer->getElementsByTagName ( "Name" ); | |
| 780 | + $temp = ""; | |
| 781 | + foreach ( $vs as $v ) { | |
| 782 | + $temp .= $v->nodeValue; | |
| 783 | + } | |
| 784 | + $temp = "<input style='cursor:pointer' type=radio NAME='checks' onClick='seltema(\"" . $temp . "\",\"" . $temp1 . "\",\"" . $temp3 . "\",\"" . $serv . "\")' /><span style=color:red >" . $temp . "</span><br>"; | |
| 785 | + $retorno .= "<br>" . $temp . $temp1 . "<br>" . $temp2 . "<hr>"; | |
| 786 | + } | |
| 787 | + $cp->set_data ( $retorno ); | |
| 788 | +} | |
| 789 | +/* | |
| 790 | + * Function: xml2html | |
| 791 | + * | |
| 792 | + * Converte caracteres XML em HTML. | |
| 793 | + * | |
| 794 | + * Parametro: | |
| 795 | + * | |
| 796 | + * $str {string} - Xml que será convertido | |
| 797 | + * | |
| 798 | + * Retorno: | |
| 799 | + * | |
| 800 | + * {string} | |
| 801 | + */ | |
| 802 | +function xml2html($str) { | |
| 803 | + $str = ereg_replace ( "&", "&", $str ); | |
| 804 | + $str = ereg_replace ( "<", "<", $str ); | |
| 805 | + $str = ereg_replace ( ">", "><BR>", $str ); | |
| 806 | + return $str; | |
| 807 | +} | |
| 808 | +/* | |
| 809 | + * wms_descricao | |
| 810 | + * | |
| 811 | + * Retorna a descrição de um serviço (n�). | |
| 812 | + */ | |
| 813 | +function wms_descricao($dom, $xp) { | |
| 814 | + $xpath = new DOMXPath ( $dom ); | |
| 815 | + $query = $xp; | |
| 816 | + $entries = $xpath->query ( $query ); | |
| 817 | + $n = ""; | |
| 818 | + foreach ( $entries as $entry ) { | |
| 819 | + $n = $entry->nodeValue; | |
| 820 | + } | |
| 821 | + return $n; | |
| 822 | +} | |
| 823 | +/* | |
| 824 | + * wms_descricaov | |
| 825 | + * | |
| 826 | + * Retorna a descrição de um serviço (atributo). | |
| 827 | + */ | |
| 828 | +function wms_descricaov($dom, $xp, $attrib) { | |
| 829 | + $xpath = new DOMXPath ( $dom ); | |
| 830 | + $query = $xp; | |
| 831 | + $entries = $xpath->query ( $query ); | |
| 832 | + $n = ""; | |
| 833 | + foreach ( $entries as $entry ) { | |
| 834 | + $n = $entry->getAttribute ( $attrib ); | |
| 835 | + } | |
| 836 | + return $n; | |
| 837 | +} | |
| 838 | +/* | |
| 839 | + * wms_descricaon | |
| 840 | + * | |
| 841 | + * Retorna a descrição de um serviço (filho de um n�). | |
| 842 | + */ | |
| 843 | +function wms_descricaon($dom, $xp, $n) { | |
| 844 | + $ctx = xpath_new_context ( $dom ); | |
| 845 | + $xpnode = xpath_eval ( $ctx, $xp ); | |
| 846 | + $dtnode = $xpnode->nodeset [$n]->first_child (); | |
| 847 | + return $dtnode->content; | |
| 848 | +} | |
| 849 | +/* | |
| 850 | + * wms_title | |
| 851 | + * | |
| 852 | + * Retorna o título de um WMS. | |
| 853 | + */ | |
| 854 | +function wms_title($dom) { | |
| 855 | + // | |
| 856 | + // Read the WMS service title and return it as text. | |
| 857 | + // | |
| 858 | + $xpath = new DOMXPath ( $dom ); | |
| 859 | + $query = '//WMT_MS_Capabilities/Service/Title'; | |
| 860 | + $entries = $xpath->query ( $query ); | |
| 861 | + foreach ( $entries as $entry ) { | |
| 862 | + $nomeserv = $entry->nodeValue; | |
| 863 | + } | |
| 864 | + return $nomeserv; | |
| 865 | +} | |
| 866 | +/* | |
| 867 | + * wms_onlineresource | |
| 868 | + * | |
| 869 | + * Retorna o recurso on-line de um WMS. | |
| 870 | + */ | |
| 871 | +function wms_onlineresource($dom) { | |
| 872 | + // | |
| 873 | + // Read the WMS online resource URL and return it as text. | |
| 874 | + // | |
| 875 | + $xp = "/WMT_MS_Capabilities/Service/OnlineResource"; | |
| 876 | + $ctx = xpath_new_context ( $dom ); | |
| 877 | + $xpnode = xpath_eval ( $ctx, $xp ); | |
| 878 | + return $xpnode->nodeset [0]->get_attribute ( "href" ); | |
| 879 | +} | |
| 880 | +/* | |
| 881 | + * wms_formats | |
| 882 | + * | |
| 883 | + * Retorna os formatos de imagem de um WMS. | |
| 884 | + */ | |
| 885 | +function wms_formats($dom) { | |
| 886 | + $xpath = new DOMXPath ( $dom ); | |
| 887 | + $query = '//WMT_MS_Capabilities/Capability/Request/GetMap/Format'; | |
| 888 | + $entries = $xpath->query ( $query ); | |
| 889 | + if ($entries == FALSE || $entries->length == 0) { | |
| 890 | + $teste = $xpath->registerNamespace ( "tag", "http://www.opengis.net/wms" ); | |
| 891 | + $q = '/tag:WMS_Capabilities/tag:Capability/tag:Request/tag:GetMap/tag:Format'; | |
| 892 | + $entries = $xpath->query ( $q ); | |
| 893 | + } | |
| 894 | + $arr = array (); | |
| 895 | + foreach ( $entries as $entry ) { | |
| 896 | + $arr [] = $entry->nodeValue; | |
| 897 | + } | |
| 898 | + return $arr; | |
| 899 | +} | |
| 900 | +/* | |
| 901 | + * wms_formatsinfo | |
| 902 | + * | |
| 903 | + * Retorna os formatos existentes de retorno da opção getfeatureinfo. | |
| 904 | + */ | |
| 905 | +function wms_formatsinfo($dom) { | |
| 906 | + $xpath = new DOMXPath ( $dom ); | |
| 907 | + $query = '//WMT_MS_Capabilities/Capability/Request/GetFeatureInfo/Format'; | |
| 908 | + $entries = $xpath->query ( $query ); | |
| 909 | + if ($entries == FALSE || $entries->length == 0) { | |
| 910 | + $teste = $xpath->registerNamespace ( "tag", "http://www.opengis.net/wms" ); | |
| 911 | + $q = '/tag:WMS_Capabilities/tag:Capability/tag:Request/tag:GetCapabilities/tag:Format'; | |
| 912 | + $entries = $xpath->query ( $q ); | |
| 913 | + } | |
| 914 | + $arr = array (); | |
| 915 | + foreach ( $entries as $entry ) { | |
| 916 | + $arr [] = $entry->nodeValue; | |
| 917 | + } | |
| 918 | + return $arr; | |
| 919 | +} | |
| 920 | +/* | |
| 921 | + * wms_estilos | |
| 922 | + * | |
| 923 | + * Retorna os estilos de um WMS. | |
| 924 | + */ | |
| 925 | +function wms_estilos($dom) { | |
| 926 | + // | |
| 927 | + // Read the WMS image formats and return them as an array. | |
| 928 | + // | |
| 929 | + // $xp = "/Style"; | |
| 930 | + // $ctx = xpath_new_context($dom); | |
| 931 | + // $xpnode = xpath_eval($ctx,$xp); | |
| 932 | + // return $xpnode->nodeset; | |
| 933 | + $return = $dom->getElementsByTagName ( "Style" ); | |
| 934 | +} | |
| 935 | +/* | |
| 936 | + * wms_exceptions | |
| 937 | + * | |
| 938 | + * Retorna as exceptions de um WMS. | |
| 939 | + */ | |
| 940 | +function wms_exceptions($dom) { | |
| 941 | + // | |
| 942 | + // Read the WMS exception formats and return them as an array. | |
| 943 | + // | |
| 944 | + $xp = "/WMT_MS_Capabilities/Capability/Exception/Format"; | |
| 945 | + $ctx = xpath_new_context ( $dom ); | |
| 946 | + $xpnode = xpath_eval ( $ctx, $xp ); | |
| 947 | + $arr = array (); | |
| 948 | + for($i = 0; $i < sizeof ( $xpnode->nodeset ); ++ $i) { | |
| 949 | + $dtnode = $xpnode->nodeset [0]->first_child (); | |
| 950 | + array_push ( $arr, $dtnode->content ); | |
| 951 | + } | |
| 952 | + return $arr; | |
| 953 | +} | |
| 954 | +/* | |
| 955 | + * wms_version | |
| 956 | + * | |
| 957 | + * Retorna a versao. | |
| 958 | + */ | |
| 959 | +function wms_version($dom) { | |
| 960 | + $n = $dom->getElementsByTagName ( 'WMT_MS_Capabilities' ); | |
| 961 | + $params = $dom->getElementsByTagName ( '*' ); | |
| 962 | + | |
| 963 | + foreach ( $params as $param ) { | |
| 964 | + $v = $param->getAttribute ( 'version' ); | |
| 965 | + break; | |
| 966 | + } | |
| 967 | + return $v; | |
| 968 | +} | |
| 969 | +/* | |
| 970 | + * wms_layers | |
| 971 | + * | |
| 972 | + * Retorna os layers de um WMS. | |
| 973 | + */ | |
| 974 | +function wms_layers($dom) { | |
| 975 | + // | |
| 976 | + // Read the WMS first level layers and return an | |
| 977 | + // array of nodes. | |
| 978 | + // | |
| 979 | + $xpath = new DOMXPath ( $dom ); | |
| 980 | + $query = '//WMT_MS_Capabilities/Capability/Layer/Layer/Layer'; | |
| 981 | + $entries = $xpath->query ( $query ); | |
| 982 | + if ($entries->length == 0) { | |
| 983 | + $query = '//WMT_MS_Capabilities/Capability/Layer'; | |
| 984 | + $entries = $xpath->query ( $query ); | |
| 985 | + } else { | |
| 986 | + $query = '//WMT_MS_Capabilities/Capability/Layer/Layer'; | |
| 987 | + $entries = $xpath->query ( $query ); | |
| 988 | + } | |
| 989 | + return $entries; | |
| 990 | +} | |
| 991 | +/* | |
| 992 | + * wms_xpnode2content | |
| 993 | + * | |
| 994 | + * Read the content child node of an element tag node WMS. | |
| 995 | + */ | |
| 996 | +function wms_xpnode2content($xp_node) { | |
| 997 | + // | |
| 998 | + // Read the content child node of an element tag | |
| 999 | + // node. | |
| 1000 | + // | |
| 1001 | + $content = ""; | |
| 1002 | + if ($xp_node->nodeset [0]) { | |
| 1003 | + $node = $xp_node->nodeset [0]->first_child (); | |
| 1004 | + $content = $node->content; | |
| 1005 | + } | |
| 1006 | + return $content; | |
| 1007 | +} | |
| 1008 | +/* | |
| 1009 | + * wms_srs | |
| 1010 | + * | |
| 1011 | + * Retorna os SRSs WMS. | |
| 1012 | + */ | |
| 1013 | +function wms_srs($dom) { | |
| 1014 | + $xpath = new DOMXPath ( $dom ); | |
| 1015 | + $query = '//WMT_MS_Capabilities/Capability/Layer/SRS'; | |
| 1016 | + $entries = $xpath->query ( $query ); | |
| 1017 | + if ($entries == FALSE || $entries->length == 0) { | |
| 1018 | + $teste = $xpath->registerNamespace ( "tag", "http://www.opengis.net/wms" ); | |
| 1019 | + $q = '/tag:WMS_Capabilities/tag:Capability/tag:Layer/tag:CRS'; | |
| 1020 | + $entries = $xpath->query ( $q ); | |
| 1021 | + } | |
| 1022 | + | |
| 1023 | + $srs = ""; | |
| 1024 | + // utiliza apenas os epsg do Brasil | |
| 1025 | + $single = array (); | |
| 1026 | + foreach ( $entries as $entry ) { | |
| 1027 | + $arr [] = $entry->nodeValue; | |
| 1028 | + if ($entry->nodeValue == "CRS:84") { | |
| 1029 | + $single [] = "CRS:84"; | |
| 1030 | + } | |
| 1031 | + if ($entry->nodeValue == "EPSG:4326") { | |
| 1032 | + $single [] = "EPSG:4326"; | |
| 1033 | + } | |
| 1034 | + if ($entry->nodeValue == "EPSG:4618") { | |
| 1035 | + $single [] = "EPSG:4618"; | |
| 1036 | + } | |
| 1037 | + } | |
| 1038 | + if (count ( $single ) > 0) { | |
| 1039 | + $arr = $single; | |
| 1040 | + } | |
| 1041 | + return $arr; | |
| 1042 | +} | |
| 1043 | +/* | |
| 1044 | + * wms_bbox | |
| 1045 | + * | |
| 1046 | + * Retorna o BBOX de um WMS. | |
| 1047 | + */ | |
| 1048 | +function wms_bbox($dom) { | |
| 1049 | + $xpath = new DOMXPath ( $dom ); | |
| 1050 | + $query = '//WMT_MS_Capabilities/Capability/Layer/LatLonBoundingBox'; | |
| 1051 | + $entries = $xpath->query ( $query ); | |
| 1052 | + foreach ( $entries as $entry ) { | |
| 1053 | + $bbox = $entry->nodeValue; | |
| 1054 | + } | |
| 1055 | + if ($bbox == '-1,-1,-1,-1') { | |
| 1056 | + return '-180,-90,180,90'; | |
| 1057 | + } else { | |
| 1058 | + return wms_bbox2txt ( $bbox ); | |
| 1059 | + } | |
| 1060 | +} | |
| 1061 | +/* | |
| 1062 | + * wms_bbox2txt | |
| 1063 | + * | |
| 1064 | + * Convert a BoundingBox node into a text string de um wms. | |
| 1065 | + */ | |
| 1066 | +function wms_bbox2txt($node) { | |
| 1067 | + // | |
| 1068 | + // Convert a BoundingBox node into a text string. | |
| 1069 | + // | |
| 1070 | + if ($node) { | |
| 1071 | + $txt .= 1 * $node->get_attribute ( "minx" ); | |
| 1072 | + $txt .= ","; | |
| 1073 | + $txt .= 1 * $node->get_attribute ( "miny" ); | |
| 1074 | + $txt .= ","; | |
| 1075 | + $txt .= 1 * $node->get_attribute ( "maxx" ); | |
| 1076 | + $txt .= ","; | |
| 1077 | + $txt .= 1 * $node->get_attribute ( "maxy" ); | |
| 1078 | + } else { | |
| 1079 | + $txt = "-180,-90,180,90"; | |
| 1080 | + } | |
| 1081 | + return $txt; | |
| 1082 | +} | |
| 1083 | +/* | |
| 1084 | + * wms_layer2html | |
| 1085 | + * | |
| 1086 | + * Convert a Layer node into an HTML representation wms. | |
| 1087 | + */ | |
| 1088 | +function wms_layer2html($node, $tipo, $layer) { | |
| 1089 | + // | |
| 1090 | + // Convert a Layer node into an HTML representation. | |
| 1091 | + // | |
| 1092 | + $ctx = xpath_new_context ( $node ); | |
| 1093 | + $xp_title = xpath_eval ( $ctx, "/Title" ); | |
| 1094 | + $xp_name = xpath_eval ( $ctx, "/Name" ); | |
| 1095 | + if (wms_xpnode2content ( $xp_name ) == "") { | |
| 1096 | + $xp_name = xpath_eval ( $ctx, "/name" ); | |
| 1097 | + } | |
| 1098 | + $xp_srs = xpath_eval ( $ctx, "/SRS" ); | |
| 1099 | + $xp_llbbox = xpath_eval ( $ctx, "/LatLonBoundingBox" ); | |
| 1100 | + $xp_bbox = xpath_eval ( $ctx, "/BoundingBox" ); | |
| 1101 | + $txt_title = wms_xpnode2content ( $xp_title ); | |
| 1102 | + $txt_name = wms_xpnode2content ( $xp_name ); | |
| 1103 | + $txt_srs = strtoupper ( wms_xpnode2content ( $xp_srs ) ); | |
| 1104 | + $node_llbbox = $xp_llbbox->nodeset [0]; | |
| 1105 | + $node_bbox = $xp_bbox->nodeset [0]; | |
| 1106 | + $queryable = 0; | |
| 1107 | + if ($node->get_attribute ( "queryable" )) { | |
| 1108 | + $queryable = 1; | |
| 1109 | + } | |
| 1110 | + $opaque = 0; | |
| 1111 | + if ($node->get_attribute ( "opaque" )) { | |
| 1112 | + $opaque = 1; | |
| 1113 | + } | |
| 1114 | + // legenda | |
| 1115 | + $xp_legenda = xpath_eval ( $ctx, "/LegendURL/OnlineResource" ); | |
| 1116 | + $nodelegenda = $xp_legenda->nodeset [0]; | |
| 1117 | + if ($nodelegenda) { | |
| 1118 | + $legenda = $nodelegenda->get_attribute ( "href" ); | |
| 1119 | + } | |
| 1120 | + | |
| 1121 | + $html = "<INPUT TYPE='radio' NAME='checks' VALUE='$txt_name' onClick='toggle(event,\"$tipo\",\"$layer\",\"$legenda\",\"$txt_title\")'>"; | |
| 1122 | + $html .= " "; | |
| 1123 | + $html .= $txt_title . "\n"; | |
| 1124 | + $html .= wms_hidden ( "bbox_$txt_name", wms_bbox2txt ( $node_bbox ) ); | |
| 1125 | + $html .= wms_hidden ( "llbox_$txt_name", wms_bbox2txt ( $node_llbbox ) ); | |
| 1126 | + $html .= wms_hidden ( "srs_$txt_name", $txt_srs ); | |
| 1127 | + $html .= wms_hidden ( "query_$txt_name", $queryable ); | |
| 1128 | + $html .= wms_hidden ( "opaque_$txt_name", $opaque ); | |
| 1129 | + $html .= "<BR>"; | |
| 1130 | + return $html; | |
| 1131 | +} | |
| 1132 | +/* | |
| 1133 | + * wms_layer3html | |
| 1134 | + * | |
| 1135 | + * Convert a Layer node into an HTML representation sem radio. | |
| 1136 | + */ | |
| 1137 | +function wms_layer3html($node) { | |
| 1138 | + // | |
| 1139 | + // Convert a Layer node into an HTML representation sem radio. | |
| 1140 | + // | |
| 1141 | + $ctx = xpath_new_context ( $node ); | |
| 1142 | + $xp_title = xpath_eval ( $ctx, "/Title" ); | |
| 1143 | + $xp_abs = xpath_eval ( $ctx, "/Abstract" ); | |
| 1144 | + $txt_title = wms_xpnode2content ( $xp_title ); | |
| 1145 | + $txt_abs = wms_xpnode2content ( $xp_abs ); | |
| 1146 | + $html .= "<b>" . $txt_title . "</b><i style='color:gray'>" . "-" . $txt_abs . "</i>\n"; | |
| 1147 | + $html .= "<BR>"; | |
| 1148 | + return $html; | |
| 1149 | +} | |
| 1150 | +/* | |
| 1151 | + * wms_layer4html | |
| 1152 | + * | |
| 1153 | + * Convert a Layer into an HTML WMS. | |
| 1154 | + */ | |
| 1155 | +function wms_layer4html($layer) { | |
| 1156 | + $estilos = wms_estilos ( $layer ); | |
| 1157 | + if (count ( $estilos ) > 0) { | |
| 1158 | + $ctxl = xpath_new_context ( $layer ); | |
| 1159 | + $xp_namel = xpath_eval ( $ctxl, "/Name" ); | |
| 1160 | + if (wms_xpnode2content ( $xp_namel ) == "") { | |
| 1161 | + $xp_namel = xpath_eval ( $ctxl, "/name" ); | |
| 1162 | + } | |
| 1163 | + $txt_namel = wms_xpnode2content ( $xp_namel ); | |
| 1164 | + $html .= wms_layer3html ( $layer ); | |
| 1165 | + foreach ( $estilos as $estilo ) { | |
| 1166 | + $html .= wms_layer2html ( $estilo, "estilo", $txt_namel ); | |
| 1167 | + } | |
| 1168 | + } else { | |
| 1169 | + $html .= wms_layer2html ( $layer, "tema", "" ); | |
| 1170 | + } | |
| 1171 | + return $html; | |
| 1172 | +} | |
| 568 | 1173 | |
| 569 | - ); | |
| 570 | - } | |
| 571 | - } | |
| 572 | - } | |
| 573 | - //exit; | |
| 574 | - return($res); | |
| 575 | -} | |
| 576 | - | |
| 577 | -function imprimeEstilos($es,$suporta,$retorna,$tval,$tituloalternativo) | |
| 578 | -{ | |
| 579 | - foreach($es as $e) | |
| 580 | - { | |
| 581 | - //$tval = $e["titulo"]; | |
| 582 | - $nomeestilo = $e["nome"]; | |
| 583 | - $nomecamada = $e["titulo"]; | |
| 584 | - //if($nomecamada == "default" || $nomecamada == "") | |
| 585 | - //{$nomecamada = $tituloalternativo;} | |
| 586 | - $tituloestilo = $e["titulo"]; | |
| 587 | - $retorna[] = "<input style='cursor:pointer' type=radio NAME='checks' onClick='seltema(\"estilo\",\"" . $tval . "\",\"\",\"" . $nomeestilo . "\",\"".$tituloalternativo." ".$nomecamada." ".$tituloestilo."\",\"".$suporta."\")' value='" . $nomeestilo . "'/><span style=color:blue >" . $nomeestilo." <i>".$tituloestilo."</i></span><br>"; | |
| 588 | - } | |
| 589 | - return $retorna; | |
| 590 | -} | |
| 591 | -function imprimeTag($r,$retorna) | |
| 592 | -{ | |
| 593 | - if(!$r["nome"]) | |
| 594 | - {$retorna[] = "<br><span style='color:brown;font-size:14pt' ><b>".$r["titulo"]."</b></span><br>";} | |
| 595 | - else | |
| 596 | - { | |
| 597 | - $retorna[] = "<hr>"; | |
| 598 | - $retorna[] = "<br><span style='color:brown;font-size:12pt' ><b>".$r["nome"]."</b></span><br>"; | |
| 599 | - $retorna[] = "<br><span style='color:black;font-size:12pt' ><b>".$r["titulo"]."</b></span><br>"; | |
| 600 | - $retorna[] = "<br><span style='color:gray;font-size:9pt' >".$r["resumo"]."</span><br>"; | |
| 601 | - } | |
| 602 | - return $retorna; | |
| 603 | -} | |
| 604 | -function pegaTag($layer) | |
| 605 | -{ | |
| 606 | - //error_reporting(0); | |
| 607 | - $noslayer = $layer->childNodes; | |
| 608 | - $resultado = array( | |
| 609 | - "estiloas" => array(), | |
| 610 | - "tags" => array() | |
| 611 | - ); | |
| 612 | - for ($i = 0; $i < $noslayer->length; ++$i){ | |
| 613 | - $tnome = $noslayer->item($i)->tagName; | |
| 614 | - $tvalor = $noslayer->item($i)->nodeValue; | |
| 615 | - if($tnome){ | |
| 616 | - //echo "<br>".$tnome; | |
| 617 | - if ($tnome == "Title") | |
| 618 | - {$resultado["titulo"] = $tvalor;} | |
| 619 | - if ($tnome == "Name") | |
| 620 | - {$resultado["nome"] = $tvalor;} | |
| 621 | - if ($tnome == "Abstract") | |
| 622 | - {$resultado["resumo"] = $tvalor;} | |
| 623 | - | |
| 624 | - if ($tnome == "Style"){ | |
| 625 | - $ss = $noslayer->item($i)->childNodes; | |
| 626 | - $ssl = $ss->length; | |
| 627 | - $n = ""; | |
| 628 | - $t = ""; | |
| 629 | - for ($s = 0; $s < $ssl; $s++) | |
| 630 | - { | |
| 631 | - $snome = $ss->item($s)->tagName; | |
| 632 | - $svalor = $ss->item($s)->nodeValue; | |
| 633 | - if($snome) | |
| 634 | - { | |
| 635 | - if ($snome == "Title") | |
| 636 | - {$t=$svalor;} | |
| 637 | - if ($snome == "Name") | |
| 638 | - {$n=$svalor;} | |
| 639 | - } | |
| 640 | - } | |
| 641 | - //echo "<pre>";echo $n; | |
| 642 | - if($n != ""){ | |
| 643 | - array_push($resultado["estilos"],array("nome"=>$n,"titulo"=>$t)); | |
| 644 | - } | |
| 645 | - } | |
| 646 | - array_push($resultado["tags"],$tnome); | |
| 647 | - //echo "<pre>";var_dump($resultado); | |
| 648 | - } | |
| 649 | - } | |
| 650 | - return $resultado; | |
| 651 | -} | |
| 652 | - | |
| 653 | - | |
| 654 | -/* | |
| 655 | -temaswfs | |
| 656 | - | |
| 657 | -Lista os temas de um web service WFS. | |
| 658 | - | |
| 659 | -parameters: | |
| 660 | -$servico - Endereço do web service. | |
| 661 | - | |
| 662 | -$cp - Objeto CPAINT. | |
| 663 | -*/ | |
| 664 | -function temaswfs() | |
| 665 | -{ | |
| 666 | - global $servico,$cp; | |
| 667 | - $teste = explode("=",$servico); | |
| 668 | - if ( count($teste) > 1 ){$servico = $servico."&";} | |
| 669 | - $wms_service_request = $servico . "REQUEST=GetCapabilities&SERVICE=WFS"; | |
| 670 | - # ------------------------------------------------------------- | |
| 671 | - # Test that the capabilites file has successfully downloaded. | |
| 672 | - # | |
| 673 | - if( !($wms_capabilities = file($wms_service_request)) ) { | |
| 674 | - # Cannot download the capabilities file. | |
| 675 | - $cp->set_data("Erro de acesso"); | |
| 676 | - return; | |
| 677 | - } | |
| 678 | - $wms_capabilities = implode("",$wms_capabilities); | |
| 679 | - $dom = new DomDocument(); | |
| 680 | - $dom->loadXML($wms_capabilities); | |
| 681 | - $services = $dom->getElementsByTagName("Service"); | |
| 682 | - foreach ($services as $service) | |
| 683 | - { | |
| 684 | - $vs = $service->getElementsByTagName("Name"); | |
| 685 | - $serv = ""; | |
| 686 | - foreach ($vs as $v) | |
| 687 | - {$serv .= $v->nodeValue;} | |
| 688 | - } | |
| 689 | - $layers = $dom->getElementsByTagName("FeatureType"); | |
| 690 | - foreach ($layers as $layer) | |
| 691 | - { | |
| 692 | - $vs = $layer->getElementsByTagName("Title"); | |
| 693 | - $temp1 = ""; | |
| 694 | - foreach ($vs as $v) | |
| 695 | - {$temp1 .= $v->nodeValue;} | |
| 696 | - | |
| 697 | - $vs = $layer->getElementsByTagName("Abstract"); | |
| 698 | - $temp2 = ""; | |
| 699 | - foreach ($vs as $v) | |
| 700 | - {$temp2 .= $v->nodeValue;} | |
| 701 | - | |
| 702 | - $vs = $layer->getElementsByTagName("SRS"); | |
| 703 | - $temp3 = array(); | |
| 704 | - foreach ($vs as $v) | |
| 705 | - {$temp3[] = $v->nodeValue;} | |
| 706 | - $temp3 = implode("#",$temp3); | |
| 707 | - | |
| 708 | - $vs = $layer->getElementsByTagName("Name"); | |
| 709 | - $temp = ""; | |
| 710 | - foreach ($vs as $v) | |
| 711 | - {$temp .= $v->nodeValue;} | |
| 712 | - $temp = "<input style='cursor:pointer' type=radio NAME='checks' onClick='seltema(\"" . $temp . "\",\"" .$temp1. "\",\"" . $temp3 . "\",\"" . $serv ."\")' /><span style=color:red >" . $temp . "</span><br>"; | |
| 713 | - $retorno .= "<br>".$temp.$temp1."<br>".$temp2."<hr>"; | |
| 714 | - } | |
| 715 | - $cp->set_data($retorno); | |
| 716 | -} | |
| 717 | -/* | |
| 718 | -Function: xml2html | |
| 719 | - | |
| 720 | -Converte caracteres XML em HTML. | |
| 721 | - | |
| 722 | -Parametro: | |
| 723 | - | |
| 724 | -$str {string} - Xml que será convertido | |
| 725 | - | |
| 726 | -Retorno: | |
| 727 | - | |
| 728 | -{string} | |
| 729 | -*/ | |
| 730 | -function xml2html ( $str ) | |
| 731 | -{ | |
| 732 | - $str = ereg_replace("&","&",$str); | |
| 733 | - $str = ereg_replace("<","<",$str); | |
| 734 | - $str = ereg_replace(">","><BR>",$str); | |
| 735 | - return $str; | |
| 736 | -} | |
| 737 | -/* | |
| 738 | -wms_descricao | |
| 739 | - | |
| 740 | -Retorna a descrição de um serviço (n�). | |
| 741 | -*/ | |
| 742 | -function wms_descricao ( $dom,$xp ) | |
| 743 | -{ | |
| 744 | - $xpath = new DOMXPath($dom); | |
| 745 | - $query = $xp; | |
| 746 | - $entries = $xpath->query($query); | |
| 747 | - $n = ""; | |
| 748 | - foreach ($entries as $entry) | |
| 749 | - { | |
| 750 | - $n = $entry->nodeValue; | |
| 751 | - } | |
| 752 | - return $n; | |
| 753 | -} | |
| 754 | -/* | |
| 755 | -wms_descricaov | |
| 756 | - | |
| 757 | -Retorna a descrição de um serviço (atributo). | |
| 758 | -*/ | |
| 759 | -function wms_descricaov ( $dom,$xp,$attrib ) | |
| 760 | -{ | |
| 761 | - $xpath = new DOMXPath($dom); | |
| 762 | - $query = $xp; | |
| 763 | - $entries = $xpath->query($query); | |
| 764 | - $n = ""; | |
| 765 | - foreach ($entries as $entry) | |
| 766 | - { | |
| 767 | - $n = $entry->getAttribute($attrib); | |
| 768 | - } | |
| 769 | - return $n; | |
| 770 | -} | |
| 771 | -/* | |
| 772 | -wms_descricaon | |
| 773 | - | |
| 774 | -Retorna a descrição de um serviço (filho de um n�). | |
| 775 | -*/ | |
| 776 | -function wms_descricaon ( $dom,$xp,$n ) { | |
| 777 | - $ctx = xpath_new_context($dom); | |
| 778 | - $xpnode = xpath_eval($ctx,$xp); | |
| 779 | - $dtnode = $xpnode->nodeset[$n]->first_child(); | |
| 780 | - return $dtnode->content; | |
| 781 | -} | |
| 782 | -/* | |
| 783 | -wms_title | |
| 784 | - | |
| 785 | -Retorna o título de um WMS. | |
| 786 | -*/ | |
| 787 | -function wms_title ( $dom ) { | |
| 788 | - # | |
| 789 | - # Read the WMS service title and return it as text. | |
| 790 | - # | |
| 791 | - $xpath = new DOMXPath($dom); | |
| 792 | - $query = '//WMT_MS_Capabilities/Service/Title'; | |
| 793 | - $entries = $xpath->query($query); | |
| 794 | - foreach ($entries as $entry){$nomeserv = $entry->nodeValue;} | |
| 795 | - return $nomeserv; | |
| 796 | -} | |
| 797 | -/* | |
| 798 | -wms_onlineresource | |
| 799 | - | |
| 800 | -Retorna o recurso on-line de um WMS. | |
| 801 | -*/ | |
| 802 | -function wms_onlineresource ( $dom ) { | |
| 803 | - # | |
| 804 | - # Read the WMS online resource URL and return it as text. | |
| 805 | - # | |
| 806 | - $xp = "/WMT_MS_Capabilities/Service/OnlineResource"; | |
| 807 | - $ctx = xpath_new_context($dom); | |
| 808 | - $xpnode = xpath_eval($ctx,$xp); | |
| 809 | - return $xpnode->nodeset[0]->get_attribute("href"); | |
| 810 | -} | |
| 811 | -/* | |
| 812 | -wms_formats | |
| 813 | - | |
| 814 | -Retorna os formatos de imagem de um WMS. | |
| 815 | -*/ | |
| 816 | -function wms_formats ( $dom ) | |
| 817 | -{ | |
| 818 | - $xpath = new DOMXPath($dom); | |
| 819 | - $query = '//WMT_MS_Capabilities/Capability/Request/GetMap/Format'; | |
| 820 | - $entries = $xpath->query($query); | |
| 821 | - if($entries == FALSE || $entries->length == 0){ | |
| 822 | - $teste = $xpath->registerNamespace("tag", "http://www.opengis.net/wms"); | |
| 823 | - $q = '/tag:WMS_Capabilities/tag:Capability/tag:Request/tag:GetMap/tag:Format'; | |
| 824 | - $entries = $xpath->query($q); | |
| 825 | - } | |
| 826 | - $arr = array(); | |
| 827 | - foreach ($entries as $entry) | |
| 828 | - { | |
| 829 | - $arr[] = $entry->nodeValue; | |
| 830 | - } | |
| 831 | - return $arr; | |
| 832 | -} | |
| 833 | -/* | |
| 834 | -wms_formatsinfo | |
| 835 | - | |
| 836 | -Retorna os formatos existentes de retorno da opção getfeatureinfo. | |
| 837 | -*/ | |
| 838 | -function wms_formatsinfo ( $dom ) | |
| 839 | -{ | |
| 840 | - $xpath = new DOMXPath($dom); | |
| 841 | - $query = '//WMT_MS_Capabilities/Capability/Request/GetFeatureInfo/Format'; | |
| 842 | - $entries = $xpath->query($query); | |
| 843 | - if($entries == FALSE || $entries->length == 0){ | |
| 844 | - $teste = $xpath->registerNamespace("tag", "http://www.opengis.net/wms"); | |
| 845 | - $q = '/tag:WMS_Capabilities/tag:Capability/tag:Request/tag:GetCapabilities/tag:Format'; | |
| 846 | - $entries = $xpath->query($q); | |
| 847 | - } | |
| 848 | - $arr = array(); | |
| 849 | - foreach ($entries as $entry) | |
| 850 | - { | |
| 851 | - $arr[] = $entry->nodeValue; | |
| 852 | - } | |
| 853 | - return $arr; | |
| 854 | -} | |
| 855 | -/* | |
| 856 | -wms_estilos | |
| 857 | - | |
| 858 | -Retorna os estilos de um WMS. | |
| 859 | -*/ | |
| 860 | -function wms_estilos ( $dom ) { | |
| 861 | - # | |
| 862 | - # Read the WMS image formats and return them as an array. | |
| 863 | - # | |
| 864 | - //$xp = "/Style"; | |
| 865 | - //$ctx = xpath_new_context($dom); | |
| 866 | - //$xpnode = xpath_eval($ctx,$xp); | |
| 867 | - //return $xpnode->nodeset; | |
| 868 | - $return = $dom->getElementsByTagName("Style"); | |
| 869 | - | |
| 870 | -} | |
| 871 | -/* | |
| 872 | -wms_exceptions | |
| 873 | - | |
| 874 | -Retorna as exceptions de um WMS. | |
| 875 | -*/ | |
| 876 | -function wms_exceptions ( $dom ) { | |
| 877 | - # | |
| 878 | - # Read the WMS exception formats and return them as an array. | |
| 879 | - # | |
| 880 | - $xp = "/WMT_MS_Capabilities/Capability/Exception/Format"; | |
| 881 | - $ctx = xpath_new_context($dom); | |
| 882 | - $xpnode = xpath_eval($ctx,$xp); | |
| 883 | - $arr = array(); | |
| 884 | - for( $i = 0; $i < sizeof($xpnode->nodeset); ++$i ) { | |
| 885 | - $dtnode = $xpnode->nodeset[0]->first_child(); | |
| 886 | - array_push($arr,$dtnode->content); | |
| 887 | - } | |
| 888 | - return $arr; | |
| 889 | -} | |
| 890 | -/* | |
| 891 | -wms_version | |
| 892 | - | |
| 893 | -Retorna a versao. | |
| 894 | -*/ | |
| 895 | -function wms_version ( $dom ) | |
| 896 | -{ | |
| 897 | - $n = $dom->getElementsByTagName('WMT_MS_Capabilities'); | |
| 898 | - $params = $dom->getElementsByTagName('*'); | |
| 899 | - | |
| 900 | - foreach ($params as $param) { | |
| 901 | - $v = $param -> getAttribute('version'); | |
| 902 | - break; | |
| 903 | - } | |
| 904 | - return $v; | |
| 905 | -} | |
| 906 | -/* | |
| 907 | -wms_layers | |
| 908 | - | |
| 909 | -Retorna os layers de um WMS. | |
| 910 | -*/ | |
| 911 | -function wms_layers ( $dom ) { | |
| 912 | - # | |
| 913 | - # Read the WMS first level layers and return an | |
| 914 | - # array of nodes. | |
| 915 | - # | |
| 916 | - $xpath = new DOMXPath($dom); | |
| 917 | - $query = '//WMT_MS_Capabilities/Capability/Layer/Layer/Layer'; | |
| 918 | - $entries = $xpath->query($query); | |
| 919 | - if ($entries->length == 0) | |
| 920 | - { | |
| 921 | - $query = '//WMT_MS_Capabilities/Capability/Layer'; | |
| 922 | - $entries = $xpath->query($query); | |
| 923 | - } | |
| 924 | - else | |
| 925 | - { | |
| 926 | - $query = '//WMT_MS_Capabilities/Capability/Layer/Layer'; | |
| 927 | - $entries = $xpath->query($query); | |
| 928 | - } | |
| 929 | - return $entries; | |
| 930 | -} | |
| 931 | -/* | |
| 932 | -wms_xpnode2content | |
| 933 | - | |
| 934 | -Read the content child node of an element tag node WMS. | |
| 935 | -*/ | |
| 936 | -function wms_xpnode2content( $xp_node ) { | |
| 937 | - # | |
| 938 | - # Read the content child node of an element tag | |
| 939 | - # node. | |
| 940 | - # | |
| 941 | - $content = ""; | |
| 942 | - if( $xp_node->nodeset[0] ) { | |
| 943 | - $node = $xp_node->nodeset[0]->first_child(); | |
| 944 | - $content = $node->content; | |
| 945 | - } | |
| 946 | - return $content; | |
| 947 | -} | |
| 948 | -/* | |
| 949 | -wms_srs | |
| 950 | - | |
| 951 | -Retorna os SRSs WMS. | |
| 952 | -*/ | |
| 953 | -function wms_srs( $dom ) | |
| 954 | -{ | |
| 955 | - $xpath = new DOMXPath($dom); | |
| 956 | - $query = '//WMT_MS_Capabilities/Capability/Layer/SRS'; | |
| 957 | - $entries = $xpath->query($query); | |
| 958 | - if($entries == FALSE || $entries->length == 0){ | |
| 959 | - $teste = $xpath->registerNamespace("tag", "http://www.opengis.net/wms"); | |
| 960 | - $q = '/tag:WMS_Capabilities/tag:Capability/tag:Layer/tag:CRS'; | |
| 961 | - $entries = $xpath->query($q); | |
| 962 | - } | |
| 963 | - | |
| 964 | - $srs = ""; | |
| 965 | - //utiliza apenas os epsg do Brasil | |
| 966 | - $single = array(); | |
| 967 | - foreach ($entries as $entry) | |
| 968 | - { | |
| 969 | - $arr[] = $entry->nodeValue; | |
| 970 | - if ($entry->nodeValue == "CRS:84") | |
| 971 | - {$single[] = "CRS:84";} | |
| 972 | - if ($entry->nodeValue == "EPSG:4326") | |
| 973 | - {$single[] = "EPSG:4326";} | |
| 974 | - if ($entry->nodeValue == "EPSG:4618") | |
| 975 | - {$single[] = "EPSG:4618";} | |
| 976 | - } | |
| 977 | - if (count($single) > 0) | |
| 978 | - {$arr = $single;} | |
| 979 | - return $arr; | |
| 980 | -} | |
| 981 | -/* | |
| 982 | -wms_bbox | |
| 983 | - | |
| 984 | -Retorna o BBOX de um WMS. | |
| 985 | -*/ | |
| 986 | -function wms_bbox( $dom ) | |
| 987 | -{ | |
| 988 | - $xpath = new DOMXPath($dom); | |
| 989 | - $query = '//WMT_MS_Capabilities/Capability/Layer/LatLonBoundingBox'; | |
| 990 | - $entries = $xpath->query($query); | |
| 991 | - foreach ($entries as $entry){$bbox = $entry->nodeValue;} | |
| 992 | - if ($bbox == '-1,-1,-1,-1') | |
| 993 | - {return '-180,-90,180,90';} | |
| 994 | - else | |
| 995 | - {return wms_bbox2txt($bbox);} | |
| 996 | -} | |
| 997 | -/* | |
| 998 | -wms_bbox2txt | |
| 999 | - | |
| 1000 | -Convert a BoundingBox node into a text string de um wms. | |
| 1001 | -*/ | |
| 1002 | -function wms_bbox2txt( $node ) { | |
| 1003 | - # | |
| 1004 | - # Convert a BoundingBox node into a text string. | |
| 1005 | - # | |
| 1006 | - if( $node ) { | |
| 1007 | - $txt .= 1 * $node->get_attribute("minx"); | |
| 1008 | - $txt .= ","; | |
| 1009 | - $txt .= 1 * $node->get_attribute("miny"); | |
| 1010 | - $txt .= ","; | |
| 1011 | - $txt .= 1 * $node->get_attribute("maxx"); | |
| 1012 | - $txt .= ","; | |
| 1013 | - $txt .= 1 * $node->get_attribute("maxy"); | |
| 1014 | - } | |
| 1015 | - else { | |
| 1016 | - $txt = "-180,-90,180,90"; | |
| 1017 | - } | |
| 1018 | - return $txt; | |
| 1019 | -} | |
| 1020 | -/* | |
| 1021 | -wms_layer2html | |
| 1022 | - | |
| 1023 | -Convert a Layer node into an HTML representation wms. | |
| 1024 | -*/ | |
| 1025 | -function wms_layer2html( $node, $tipo , $layer ) { | |
| 1026 | - # | |
| 1027 | - # Convert a Layer node into an HTML representation. | |
| 1028 | - # | |
| 1029 | - $ctx = xpath_new_context($node); | |
| 1030 | - $xp_title = xpath_eval($ctx,"/Title"); | |
| 1031 | - $xp_name = xpath_eval($ctx,"/Name"); | |
| 1032 | - if (wms_xpnode2content($xp_name) == ""){$xp_name = xpath_eval($ctx,"/name");} | |
| 1033 | - $xp_srs = xpath_eval($ctx,"/SRS"); | |
| 1034 | - $xp_llbbox = xpath_eval($ctx,"/LatLonBoundingBox"); | |
| 1035 | - $xp_bbox = xpath_eval($ctx,"/BoundingBox"); | |
| 1036 | - $txt_title = wms_xpnode2content($xp_title); | |
| 1037 | - $txt_name = wms_xpnode2content($xp_name); | |
| 1038 | - $txt_srs = strtoupper(wms_xpnode2content($xp_srs)); | |
| 1039 | - $node_llbbox = $xp_llbbox->nodeset[0]; | |
| 1040 | - $node_bbox = $xp_bbox->nodeset[0]; | |
| 1041 | - $queryable = 0; | |
| 1042 | - if ( $node->get_attribute("queryable") ) { | |
| 1043 | - $queryable = 1; | |
| 1044 | - } | |
| 1045 | - $opaque = 0; | |
| 1046 | - if ( $node->get_attribute("opaque") ) { | |
| 1047 | - $opaque = 1; | |
| 1048 | - } | |
| 1049 | - //legenda | |
| 1050 | - $xp_legenda = xpath_eval($ctx,"/LegendURL/OnlineResource"); | |
| 1051 | - $nodelegenda = $xp_legenda->nodeset[0]; | |
| 1052 | - if($nodelegenda) | |
| 1053 | - { $legenda = $nodelegenda->get_attribute("href");} | |
| 1054 | - | |
| 1055 | - $html = "<INPUT TYPE='radio' NAME='checks' VALUE='$txt_name' onClick='toggle(event,\"$tipo\",\"$layer\",\"$legenda\",\"$txt_title\")'>"; | |
| 1056 | - $html .= " "; | |
| 1057 | - $html .= $txt_title . "\n"; | |
| 1058 | - $html .= wms_hidden("bbox_$txt_name", wms_bbox2txt($node_bbox)); | |
| 1059 | - $html .= wms_hidden("llbox_$txt_name", wms_bbox2txt($node_llbbox)); | |
| 1060 | - $html .= wms_hidden("srs_$txt_name", $txt_srs); | |
| 1061 | - $html .= wms_hidden("query_$txt_name", $queryable ); | |
| 1062 | - $html .= wms_hidden("opaque_$txt_name", $opaque ); | |
| 1063 | - $html .= "<BR>"; | |
| 1064 | - return $html; | |
| 1065 | -} | |
| 1066 | -/* | |
| 1067 | -wms_layer3html | |
| 1068 | - | |
| 1069 | -Convert a Layer node into an HTML representation sem radio. | |
| 1070 | -*/ | |
| 1071 | -function wms_layer3html( $node ) { | |
| 1072 | - # | |
| 1073 | - # Convert a Layer node into an HTML representation sem radio. | |
| 1074 | - # | |
| 1075 | - $ctx = xpath_new_context($node); | |
| 1076 | - $xp_title = xpath_eval($ctx,"/Title"); | |
| 1077 | - $xp_abs = xpath_eval($ctx,"/Abstract"); | |
| 1078 | - $txt_title = wms_xpnode2content($xp_title); | |
| 1079 | - $txt_abs = wms_xpnode2content($xp_abs); | |
| 1080 | - $html .= "<b>".$txt_title . "</b><i style='color:gray'>" . "-" . $txt_abs . "</i>\n"; | |
| 1081 | - $html .= "<BR>"; | |
| 1082 | - return $html; | |
| 1083 | -} | |
| 1084 | -/* | |
| 1085 | -wms_layer4html | |
| 1086 | - | |
| 1087 | -Convert a Layer into an HTML WMS. | |
| 1088 | -*/ | |
| 1089 | -function wms_layer4html( $layer ) { | |
| 1090 | - $estilos = wms_estilos($layer); | |
| 1091 | - if (count($estilos) > 0) | |
| 1092 | - { | |
| 1093 | - $ctxl = xpath_new_context($layer); | |
| 1094 | - $xp_namel = xpath_eval($ctxl,"/Name"); | |
| 1095 | - if (wms_xpnode2content($xp_namel) == ""){$xp_namel = xpath_eval($ctxl,"/name");} | |
| 1096 | - $txt_namel = wms_xpnode2content($xp_namel); | |
| 1097 | - $html .= wms_layer3html($layer); | |
| 1098 | - foreach ($estilos as $estilo) | |
| 1099 | - { | |
| 1100 | - $html .= wms_layer2html($estilo,"estilo",$txt_namel); | |
| 1101 | - } | |
| 1102 | - } | |
| 1103 | - else | |
| 1104 | - { | |
| 1105 | - $html .= wms_layer2html($layer,"tema",""); | |
| 1106 | - } | |
| 1107 | - return $html; | |
| 1108 | -} | |
| 1109 | - | |
| 1110 | 1174 | ?> | ... | ... |
ferramentas/conectargeorss/dicionario.js
| ... | ... | @@ -31,7 +31,7 @@ i3GEOF.conectargeorss.dicionario = { |
| 31 | 31 | es : "" |
| 32 | 32 | } ], |
| 33 | 33 | 'sel' : [ { |
| 34 | - pt : "Digite o endereço do serviço ou escolha da lista abaixo. Utilize as guias acima para ver o resultado da conexão", | |
| 34 | + pt : "Digite o endereço do serviço ou escolha da lista abaixo", | |
| 35 | 35 | en : "", |
| 36 | 36 | es : "" |
| 37 | 37 | } ] | ... | ... |
ferramentas/conectargeorss/index.js
| ... | ... | @@ -168,8 +168,12 @@ i3GEOF.conectargeorss = { |
| 168 | 168 | if (retorno.data != undefined){ |
| 169 | 169 | retorno = retorno.data; |
| 170 | 170 | for (i=0;i<retorno.length; i++){ |
| 171 | - ins += "<div class='list-group condensed'><div class='row-content text-left'>" + | |
| 172 | - "<label class='nomeTema'><a onclick='i3GEOF.conectargeorss.adiciona(\""+i+"\");return false;' href='javascript:void(0)'><h4>" + retorno[i].title + "</h4></a></label></div></div>"; | |
| 171 | + ins += "<div class='list-group condensed'><div class='row-content text-left'>" | |
| 172 | + + "<a onclick='i3GEOF.conectargeorss.adiciona(\""+i+"\");return false;' role='button' class='btn btn-default btn-fab btn-fab-max' href='javascript:void(0)'>" | |
| 173 | + + "<span class='material-icons'>visibility</span></a><label style='width:200px;' class='nomeTema' >" | |
| 174 | + + "<a onclick='i3GEOF.conectargeorss.adiciona(\""+i+"\");return false;' href='javascript:void(0)'><h4>" | |
| 175 | + + retorno[i].title + | |
| 176 | + + "</h4></a></label></div></div>"; | |
| 173 | 177 | } |
| 174 | 178 | $i("resultadoget").innerHTML = ins; |
| 175 | 179 | } | ... | ... |
ferramentas/conectarservicos/index.js
| ... | ... | @@ -75,26 +75,10 @@ i3GEOF.conectarservicos = |
| 75 | 75 | ); |
| 76 | 76 | }, |
| 77 | 77 | wms: function(){ |
| 78 | - i3GEO.janela.cria( | |
| 79 | - "440px", | |
| 80 | - "400px", | |
| 81 | - i3GEO.configura.locaplic + "/ferramentas/conectarwms/index.htm", | |
| 82 | - "", | |
| 83 | - "", | |
| 84 | - "<span class='i3GeoTituloJanelaBsNolink' >" + $trad("a4") + "</span></div>", | |
| 85 | - "i3GEO.conectarwms", | |
| 86 | - false, | |
| 87 | - "hd", | |
| 88 | - "", | |
| 89 | - "", | |
| 90 | - "", | |
| 91 | - false, | |
| 92 | - "", | |
| 93 | - "", | |
| 94 | - "nao", | |
| 95 | - "", | |
| 96 | - "28" | |
| 97 | - ); | |
| 78 | + i3GEO.util.scriptTag(i3GEO.configura.locaplic | |
| 79 | + + "/ferramentas/conectarwms/dependencias.php", | |
| 80 | + "i3GEOF.conectarwms.iniciaJanelaFlutuante()", | |
| 81 | + "i3GEOF.conectarwms_script"); | |
| 98 | 82 | }, |
| 99 | 83 | kml: function() { |
| 100 | 84 | i3GEO.util.scriptTag(i3GEO.configura.locaplic | ... | ... |
| ... | ... | @@ -0,0 +1,24 @@ |
| 1 | +<?php | |
| 2 | +include(dirname(__FILE__)."/../blacklist.php"); | |
| 3 | +verificaBlFerramentas(basename(dirname(__FILE__))); | |
| 4 | + | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * Carrega os programas javascript necessarios para a ferramenta | |
| 8 | + * Esse programa e usado na tag <script> ou com a funcao scripttag do i3Geo | |
| 9 | + * Alem de carregar os scripts, carrega tambem o template no formato MUSTACHE, definindo a variavel | |
| 10 | + * javascript i3GEOF.carregakml.MUSTACHE | |
| 11 | + * O template e substituido pelos valores definidos em index.js no momento da inicializacao da ferramenta | |
| 12 | + */ | |
| 13 | +if(extension_loaded('zlib')){ | |
| 14 | + ob_start('ob_gzhandler'); | |
| 15 | +} | |
| 16 | +header("Content-type: text/javascript"); | |
| 17 | +include("index.js"); | |
| 18 | +include("dicionario.js"); | |
| 19 | +echo "\n"; | |
| 20 | + | |
| 21 | +if(extension_loaded('zlib')){ | |
| 22 | + ob_end_flush(); | |
| 23 | +} | |
| 24 | +?> | |
| 0 | 25 | \ No newline at end of file | ... | ... |
ferramentas/conectarwms/dicionario.js
| ... | ... | @@ -20,6 +20,16 @@ i3GEOF.conectarwms.dicionario = { |
| 20 | 20 | en : "", |
| 21 | 21 | es : "Servicio no definido" |
| 22 | 22 | } ], |
| 23 | + 'listaLayers' : [ { | |
| 24 | + pt : "Lista as camadas do WMS", | |
| 25 | + en : "", | |
| 26 | + es : "" | |
| 27 | + } ], | |
| 28 | + 'sel' : [ { | |
| 29 | + pt : "Digite o endereço do serviço ou escolha da lista abaixo", | |
| 30 | + en : "", | |
| 31 | + es : "" | |
| 32 | + } ], | |
| 23 | 33 | 5 : [ { |
| 24 | 34 | pt : "Ooops! Problemas ao acessar o serviço.", |
| 25 | 35 | en : "", | ... | ... |
| ... | ... | @@ -0,0 +1,34 @@ |
| 1 | +<?php | |
| 2 | +include_once(dirname(__FILE__)."/../safe.php"); | |
| 3 | +verificaBlFerramentas(basename(dirname(__FILE__)),$i3geoBlFerramentas,false); | |
| 4 | +// | |
| 5 | +//faz a busca da função que deve ser executada | |
| 6 | +// | |
| 7 | +$retorno = ""; //string que será retornada ao browser via JSON | |
| 8 | +switch (strtoupper($funcao)){ | |
| 9 | +/* | |
| 10 | +Valor: ADICIONATEMAGEORSS | |
| 11 | + | |
| 12 | +Adiciona um tema baseado em um RSS. | |
| 13 | + | |
| 14 | +<Mapa->adicionaTemaGeoRSS> | |
| 15 | +*/ | |
| 16 | + case "ADICIONATEMAGEORSS": | |
| 17 | + include_once(dirname(__FILE__)."/../../classesphp/classe_mapa.php"); | |
| 18 | + $m = new Mapa($map_file); | |
| 19 | + $retorno = $m->adicionaTemaGeoRSS($_GET["servico"],$dir_tmp,$locaplic,$_GET["canal"]); | |
| 20 | + if ($retorno != "erro"){ | |
| 21 | + $m->salva(); | |
| 22 | + $_SESSION["contadorsalva"]++; | |
| 23 | + redesenhaMapa(); | |
| 24 | + } | |
| 25 | + else{ | |
| 26 | + $retorno = "erro.Nenhum dado espacializado foi encontrado."; | |
| 27 | + } | |
| 28 | + break; | |
| 29 | +} | |
| 30 | +if(isset($map_file) && isset($postgis_mapa) && $map_file != ""){ | |
| 31 | + restauraCon($map_file,$postgis_mapa); | |
| 32 | +} | |
| 33 | +cpjson($retorno); | |
| 34 | +?> | |
| 0 | 35 | \ No newline at end of file | ... | ... |
ferramentas/conectarwms/imagens/rss.gif
1.48 KB
ferramentas/conectarwms/index.htm
| ... | ... | @@ -1,141 +0,0 @@ |
| 1 | -<!DOCTYPE html> | |
| 2 | -<html> | |
| 3 | -<head> | |
| 4 | -<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> | |
| 5 | -<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=0"> | |
| 6 | -<script src="../../js/i3geo.js"></script> | |
| 7 | -<link rel="stylesheet" type="text/css" href="../../pacotes/bootstrap/css/bootstrap.min.css"> | |
| 8 | -<link rel="stylesheet" type="text/css" href="../../pacotes/bootstrap-material-design/dist/css/bootstrap-material-design.min.css"> | |
| 9 | -<link rel="stylesheet" type="text/css" href="../../css/default.css"> | |
| 10 | -</head> | |
| 11 | -<body id="i3geo" style='background-color: #477596; height: 400px; visibility:visible' class="yui-skin-sam bd"> | |
| 12 | - <div class='yui-navset' style='top: 0px; cursor: pointer; left: 0px; margin-left: 2px;'> | |
| 13 | - <ul class="yui-nav" style="border-width: 0pt 0pt 0px; border-color: rgb(240, 240, 240); border-bottom-color: white;"> | |
| 14 | - <li> | |
| 15 | - <div id='guia1' style='text-align: center; left: 0px;'> | |
| 16 | - <a> | |
| 17 | - <em>Serviços</em> | |
| 18 | - </a> | |
| 19 | - </div> | |
| 20 | - </li> | |
| 21 | - <li> | |
| 22 | - <div id='guia2' style='text-align: center; left: 0px;'> | |
| 23 | - <a> | |
| 24 | - <em>Metadados</em> | |
| 25 | - </a> | |
| 26 | - </div> | |
| 27 | - </li> | |
| 28 | - <li> | |
| 29 | - <div id='guia3' style='text-align: center; left: 0px;'> | |
| 30 | - <a> | |
| 31 | - <em>Lista de temas</em> | |
| 32 | - </a> | |
| 33 | - </div> | |
| 34 | - </li> | |
| 35 | - </ul> | |
| 36 | - </div> | |
| 37 | - | |
| 38 | - <div class='container-fluid bd' id="guia1obj"> | |
| 39 | - <h5> | |
| 40 | - <a href="../../documentacao/ajuda/The_ArcIMS_OGC_WMS_Connector.pdf" target=blank>Veja como criar web services no ARCIMS</a> | |
| 41 | - </h5> | |
| 42 | - <h5> | |
| 43 | - <a href="../../documentacao/ajuda/ArcGIS9.x.html" target=blank>Veja como utilizar web services no ARCGIS</a> | |
| 44 | - </h5> | |
| 45 | - <h5>Digite o endereço do serviço ou escolha da lista abaixo. Utilize as guias acima para ver o resultado da conexão. Por padrão, utiliza-se a versão | |
| 46 | - 1.1.0 do GetCapabilities. Você pode adicionar um outro, bastando incluir no endereço do serviço "&version=1.3.0" por exemplo.</h5> | |
| 47 | - | |
| 48 | - <div class='form-group label-fixed condensed'> | |
| 49 | - <input class="form-control input-lg" type='text' id='servico' value='' /> | |
| 50 | - </div> | |
| 51 | - | |
| 52 | - <div style="width: 100%;" class='form-group label-fixed condensed'> | |
| 53 | - <div id=RSSwms class="input-group"></div> | |
| 54 | - </div> | |
| 55 | - <br> | |
| 56 | - <div id=RSSbt style="text-align: left;"></div> | |
| 57 | - </div> | |
| 58 | - <div class='container-fluid' id="guia2obj"> | |
| 59 | - <p class=paragrafo> | |
| 60 | - <input type=button id="getCapabilities" value="Descrição do WMS" /> | |
| 61 | - </p> | |
| 62 | - <div id=resultadoget style="display: block; position: relative; top: 5px; left: 1px" class=paragrafo></div> | |
| 63 | - </div> | |
| 64 | - <div class='container-fluid' id="guia3obj"> | |
| 65 | - <p class=paragrafo> | |
| 66 | - Após a conexão ser estabelecida e surgir a lista de temas, selecione a camada que será adicionada ao mapa. | |
| 67 | - <br> | |
| 68 | - </p> | |
| 69 | - <div id=textoSLD style="display: none; font-size: 10px"> | |
| 70 | - <p class=paragrafo> | |
| 71 | - Opcionalmente vc pode indicar o tipo de representação que será utilizada. | |
| 72 | - <br> | |
| 73 | - Não altere o tipo de representação se a camada escolhida for uma imagem (dados raster) ou se você tiver dúvidas sobre ela. | |
| 74 | - <br> | |
| 75 | - </p> | |
| 76 | - <div class=styled-select> | |
| 77 | - <select id=tiporep> | |
| 78 | - <option value="">---</option> | |
| 79 | - <option value="poligonal">poligonal</option> | |
| 80 | - <option value="linear">linear</option> | |
| 81 | - <option value="pontual">pontual</option> | |
| 82 | - </select> | |
| 83 | - </div> | |
| 84 | - </div> | |
| 85 | - <div id=listatemas class=paragrafo></div> | |
| 86 | - </div> | |
| 87 | - | |
| 88 | - <div id="aguarde">Aguarde...</div> | |
| 89 | - | |
| 90 | - <script type="text/javascript" src="index.js"></script> | |
| 91 | - <script type="text/javascript"> | |
| 92 | - $.material.init(); | |
| 93 | - var b = new YAHOO.widget.Button("getCapabilities", { | |
| 94 | - onclick : { | |
| 95 | - fn : getcapabilities | |
| 96 | - } | |
| 97 | - }); | |
| 98 | - b.addClass("rodar"); | |
| 99 | - g_locaplic = "../.."; | |
| 100 | - iniciaListaWS(); | |
| 101 | - function iniciaListaWS() { | |
| 102 | - g_RSSwms = new Array(""); | |
| 103 | - aguarde("block"); | |
| 104 | - | |
| 105 | - if (document.getElementById("RSSwms")) { | |
| 106 | - if (g_RSSwms.length > 0) { | |
| 107 | - var p = g_locaplic | |
| 108 | - + "/classesphp/wscliente.php?funcao=listaRSSwsARRAY&rss=" | |
| 109 | - + g_RSSwms.join("|") + "&tipo=WMS"; | |
| 110 | - var cp = new cpaint(); | |
| 111 | - //cp.set_debug(2) | |
| 112 | - cp.set_response_type("JSON"); | |
| 113 | - cp.call(p, "listaRSSwsARRAY", mostraRetornowmsRSS); | |
| 114 | - } | |
| 115 | - } | |
| 116 | - } | |
| 117 | - function mostraRetornowmsRSS(retorno) { | |
| 118 | - var reg = /Erro/gi; | |
| 119 | - if (retorno.data.rss.search(reg) != -1) { | |
| 120 | - i3GEO.janela.tempoMsg("OOps! Ocorreu um erro\n" + retorno.data); | |
| 121 | - return; | |
| 122 | - } | |
| 123 | - var canais = retorno.data.canais; | |
| 124 | - var ncanais = canais.length; | |
| 125 | - $i("RSSbt").innerHTML = retorno.data.rss; | |
| 126 | - var i, ins = ""; | |
| 127 | - ins += "<select class='form-control' size='5' onchange='registraws(this.value)' style='width:100%;' >"; | |
| 128 | - for (i = 0; i < ncanais; i++) { | |
| 129 | - var caso = canais[i]; | |
| 130 | - var valor = "'" + caso.link + "','" + caso.id_ws + "','" | |
| 131 | - + caso.tipo_ws + "'"; | |
| 132 | - ins += "<option value=" + valor + " >" + caso.title | |
| 133 | - + "</option>"; | |
| 134 | - } | |
| 135 | - ins += "</select>"; | |
| 136 | - document.getElementById("RSSwms").innerHTML = ins; | |
| 137 | - aguarde("none"); | |
| 138 | - } | |
| 139 | - </script> | |
| 140 | -</body> | |
| 141 | -</html> |
ferramentas/conectarwms/index.js
| 1 | -/* | |
| 2 | -Title: Conexão com WMS | |
| 3 | - | |
| 4 | -Acrescenta ao mapa um novo tema com base em um endereço de WMS | |
| 5 | - | |
| 6 | -O usuário pode indicar o endereço ou escolher de uma lista. A lista é pré-definida por meio do sistema de administração | |
| 7 | -do i3Geo. | |
| 8 | - | |
| 9 | -Veja: | |
| 10 | - | |
| 11 | -<ADICIONATEMAWMS> | |
| 12 | - | |
| 13 | -Arquivo: | |
| 14 | - | |
| 15 | -i3geo/ferramentas/conectarwms/index.js | |
| 16 | - | |
| 17 | -Licenca: | |
| 18 | - | |
| 19 | -GPL2 | |
| 20 | - | |
| 21 | -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | |
| 22 | - | |
| 23 | -Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | |
| 24 | -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | |
| 25 | - | |
| 26 | -Este programa é software livre; você pode redistribuí-lo | |
| 27 | -e/ou modificá-lo sob os termos da Licença Pública Geral | |
| 28 | -GNU conforme publicada pela Free Software Foundation; | |
| 29 | - | |
| 30 | -Este programa é distribuído na expectativa de que seja útil, | |
| 31 | -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | |
| 32 | -de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | |
| 33 | -Consulte a Licença Pública Geral do GNU para mais detalhes. | |
| 34 | -Você deve ter recebido uma cópia da Licença Pública Geral do | |
| 35 | -GNU junto com este programa; se não, escreva para a | |
| 36 | -Free Software Foundation, Inc., no endereço | |
| 37 | -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 38 | -*/ | |
| 39 | -//variaveis globais | |
| 40 | -g_tipo = ""; //tipo de tema | |
| 41 | -g_tema = ""; //tema selecionado do ws | |
| 42 | -g_legenda = ""; //legenda do tema | |
| 43 | -g_nometema = ""; //nome do tema | |
| 44 | -g_idws = ""; | |
| 45 | -g_sid = window.parent.i3GEO.configura.sid; | |
| 46 | -var g_tipows = "";//obtido do mapfile | |
| 47 | -//ativaGuias(""); | |
| 48 | -//mostraGuia("guia1"); | |
| 49 | -i3GEO.guias.mostraGuiaFerramenta("guia1"); | |
| 50 | -if($i("guia1")){ | |
| 51 | - $i("guia1").onclick = function(){ | |
| 52 | - //mostraGuia("guia1"); | |
| 53 | - i3GEO.guias.mostraGuiaFerramenta("guia1"); | |
| 54 | - $i("resultadoget").innerHTML = ""; | |
| 55 | - }; | |
| 1 | +if(typeof(i3GEOF) === 'undefined'){ | |
| 2 | + var i3GEOF = {}; | |
| 56 | 3 | } |
| 57 | -if($i("guia2")){ | |
| 58 | - $i("guia2").onclick = function(){clickGuia2();}; | |
| 59 | -} | |
| 60 | -if($i("guia3")){ | |
| 61 | - $i("guia3").onclick = function(){clickGuia3();}; | |
| 62 | -} | |
| 63 | -function aguarde(valor){ | |
| 64 | - if(document.getElementById("aguarde")) | |
| 65 | - document.getElementById("aguarde").style.display = valor; | |
| 66 | -} | |
| 67 | -/* | |
| 68 | -Function: listaRSS | |
| 69 | - | |
| 70 | -Monta a lista de serviços WMS cadastrados no sistema de administração do i3Geo | |
| 71 | - | |
| 72 | -Veja: | |
| 73 | - | |
| 74 | -<LISTARSSWSARRAY> | |
| 75 | 4 | |
| 76 | -Parametros: | |
| 77 | - | |
| 78 | -g_RSS {Array} - array com a lista de RSS que contém a lista de WMS cadastrados. Se for um array com um único elemento vazio, | |
| 79 | -será utilizado o endereço default do i3GEO (g_RSS = new Array("")) | |
| 80 | - | |
| 81 | -onde {Stribg} - id do elemento HTML que receberá a lista de endereços formatada | |
| 82 | -*/ | |
| 83 | -function listaRSS(g_RSS,onde) | |
| 84 | -{ | |
| 85 | - var mostraRetornoRSS = function(retorno){ | |
| 86 | - aguarde("none"); | |
| 87 | - var reg = /Erro/gi; | |
| 88 | - if (retorno.data.rss.search(reg) != -1) | |
| 89 | - { | |
| 90 | - i3GEO.janela.tempoMsg($trad('erro',i3GEOF.conectarwms.dicionario)+"\n"+retorno.data); | |
| 91 | - return; | |
| 92 | - } | |
| 93 | - var canais = retorno.data.canais; | |
| 94 | - var ncanais = canais.length; | |
| 95 | - var ins = "<br>"+retorno.data.rss; | |
| 96 | - for (var i=0;i<ncanais; i++) | |
| 97 | - { | |
| 98 | - var caso = canais[i]; | |
| 99 | - ins += "\<p class=clique onclick=\"registraws('"+caso.link+"','"+caso.id_ws+"','"+caso.tipo_ws+"')\" \>\<b\>"+caso.title+"\<\/b\> "+caso.description+" ("+caso.author+")"; | |
| 100 | - if(caso.nacessos > 0) | |
| 101 | - { | |
| 102 | - var pc = (parseInt(caso.nacessosok) * 100) / parseInt(caso.nacessos); | |
| 103 | - ins += " \<span style=color:gray \>("+$trad('disponibilidade',i3GEOF.conectarwms.dicionario)+": "+pc+"%, "+$trad('acessos',i3GEOF.conectarwms.dicionario)+": "+caso.nacessos+")\<\/span>\<\/p\>"; | |
| 5 | +/* | |
| 6 | +Classe: i3GEOF.conectarwmsi3GEOF.conectarwms | |
| 7 | + */ | |
| 8 | +i3GEOF.conectarwms = { | |
| 9 | + IDWS: "", | |
| 10 | + TIPO: "", | |
| 11 | + TIPOWS: "WMS", | |
| 12 | + TEMA: "", | |
| 13 | + LEGENDA: "", | |
| 14 | + NOMETEMA: "", | |
| 15 | + /* | |
| 16 | + Variavel: aguarde | |
| 17 | + | |
| 18 | + Estilo do objeto DOM com a imagem de aguarde existente no cabeçalho da janela. | |
| 19 | + */ | |
| 20 | + aguarde: "", | |
| 21 | + /** | |
| 22 | + * Template no formato mustache. E preenchido na carga do javascript com o programa dependencias.php | |
| 23 | + */ | |
| 24 | + MUSTACHE : "", | |
| 25 | + /** | |
| 26 | + * Susbtitutos para o template | |
| 27 | + */ | |
| 28 | + mustacheHash : function() { | |
| 29 | + var dicionario = i3GEO.idioma.objetoIdioma(i3GEOF.conectarwms.dicionario); | |
| 30 | + return dicionario; | |
| 31 | + }, | |
| 32 | + /* | |
| 33 | + Function: inicia | |
| 34 | + | |
| 35 | + Inicia a ferramenta. É chamado por criaJanelaFlutuante | |
| 36 | + | |
| 37 | + Parametro: | |
| 38 | + | |
| 39 | + iddiv {String} - id do div que receberá o conteudo HTML da ferramenta | |
| 40 | + */ | |
| 41 | + inicia: function(iddiv){ | |
| 42 | + if(i3GEOF.conectarwms.MUSTACHE == ""){ | |
| 43 | + $.get(i3GEO.configura.locaplic + "/ferramentas/conectarwms/template_mst.html", function(template) { | |
| 44 | + i3GEOF.conectarwms.MUSTACHE = template; | |
| 45 | + i3GEOF.conectarwms.inicia(iddiv); | |
| 46 | + }); | |
| 47 | + return; | |
| 104 | 48 | } |
| 105 | - } | |
| 106 | - document.getElementById(onde).innerHTML = ins+"<br><br>"; | |
| 107 | - }; | |
| 108 | - if (document.getElementById(onde)) | |
| 109 | - { | |
| 110 | - if (g_RSS.length > 0) | |
| 111 | - { | |
| 112 | - var p = "../../classesphp/wscliente.php?funcao=listaRSSwsARRAY&rss="+g_RSS.join("|")+"&tipo=GEORSS"; | |
| 49 | + $i(iddiv).innerHTML = i3GEOF.conectarwms.html(); | |
| 50 | + var b, monta = function(retorno){ | |
| 51 | + if (retorno.data.rss.search(/Erro/gi) != -1){ | |
| 52 | + i3GEO.janela.tempoMsg("OOps! Ocorreu um erro\n"+retorno.data); | |
| 53 | + return; | |
| 54 | + } | |
| 55 | + var canais = retorno.data.canais; | |
| 56 | + var ncanais = canais.length; | |
| 57 | + var i, ins = ""; | |
| 58 | + ins += "<select class='form-control' onchange='i3GEOF.conectarwms.registraws(this.value)' style='width:100%;' >"; | |
| 59 | + ins += "<option value='' >---</option>"; | |
| 60 | + for (i = 0; i < ncanais; i++) { | |
| 61 | + var caso = canais[i]; | |
| 62 | + var valor = "'" + caso.link + "','" + caso.id_ws + "'"; | |
| 63 | + ins += "<option value=" + valor + " >"+caso.title+"</option>"; | |
| 64 | + } | |
| 65 | + ins += "</select>"; | |
| 66 | + document.getElementById("RSSgeo").innerHTML = ins; | |
| 67 | + }; | |
| 68 | + | |
| 69 | + var p = i3GEO.configura.locaplic + "/classesphp/wscliente.php?funcao=listaRSSwsARRAY&rss=&tipo=WMS"; | |
| 113 | 70 | var cp = new cpaint(); |
| 114 | - //cp.set_debug(2) | |
| 115 | 71 | cp.set_response_type("JSON"); |
| 116 | - cp.call(p,"listaRSSwsARRAY",mostraRetornoRSS); | |
| 117 | - } | |
| 118 | - } | |
| 119 | -} | |
| 120 | -/* | |
| 121 | -Function: getcapabilities | |
| 122 | - | |
| 123 | -Abre uma nova janela com o resultado da chamada GETCAPABILITIES sobre o WMS escolhido | |
| 124 | -*/ | |
| 125 | -function getcapabilities() | |
| 126 | -{ | |
| 127 | - if ($i("servico").value == ""){i3GEO.janela.tempoMsg($trad('servico',i3GEOF.conectarwms.dicionario));} | |
| 128 | - else | |
| 129 | - {window.open($i("servico").value+"&service=wms&request=getcapabilities&version=1.1.1");} | |
| 130 | -} | |
| 131 | -/* | |
| 132 | -Function: clickGuia2 | |
| 133 | - | |
| 134 | -Mostra as principais informações sobre o WMS escolhido tendo como fonte o getcapabilities | |
| 135 | - | |
| 136 | -Veja: | |
| 137 | - | |
| 138 | -<GETCAPABILITIES2> | |
| 139 | -*/ | |
| 140 | -function clickGuia2() | |
| 141 | -{ | |
| 142 | - //mostraGuia("guia2"); | |
| 143 | - i3GEO.guias.mostraGuiaFerramenta("guia2"); | |
| 144 | - if ($i("servico").value == ""){i3GEO.janela.tempoMsg($trad('servico',i3GEOF.conectarwms.dicionario));} | |
| 145 | - else | |
| 146 | - { | |
| 147 | - var metadados = function(retorno){ | |
| 148 | - if (retorno.data != undefined) | |
| 149 | - { | |
| 150 | - aguarde("none"); | |
| 151 | - $i("resultadoget").innerHTML = retorno.data; | |
| 72 | + cp.call(p,"listaRSSwsARRAY",monta); | |
| 73 | + }, | |
| 74 | + /* | |
| 75 | + Function: html | |
| 76 | + | |
| 77 | + Gera o código html para apresentação das opções da ferramenta | |
| 78 | + | |
| 79 | + Retorno: | |
| 80 | + | |
| 81 | + String com o código html | |
| 82 | + */ | |
| 83 | + html:function() { | |
| 84 | + var ins = Mustache.render(i3GEOF.conectarwms.MUSTACHE, i3GEOF.conectarwms.mustacheHash()); | |
| 85 | + return ins; | |
| 86 | + }, | |
| 87 | + /* | |
| 88 | + Function: iniciaJanelaFlutuante | |
| 89 | + | |
| 90 | + Cria a janela flutuante para controle da ferramenta. | |
| 91 | + */ | |
| 92 | + iniciaJanelaFlutuante: function(){ | |
| 93 | + var minimiza,cabecalho,janela,divid,titulo; | |
| 94 | + if($i("i3GEOF.conectarwms")){ | |
| 95 | + return; | |
| 152 | 96 | } |
| 153 | - else | |
| 154 | - { | |
| 155 | - aguarde("none"); | |
| 156 | - $i("resultadoget").innerHTML = "<p style=color:red >"+$trad('erro',i3GEOF.conectarwms.dicionario)+"<br>"; | |
| 97 | + //cria a janela flutuante | |
| 98 | + minimiza = function(){ | |
| 99 | + i3GEO.janela.minimiza("i3GEOF.conectarwms",200); | |
| 100 | + }; | |
| 101 | + titulo = "<span class='i3GeoTituloJanelaBsNolink' >" + $trad("a4") + "</span></div>"; | |
| 102 | + janela = i3GEO.janela.cria( | |
| 103 | + "600px", | |
| 104 | + "500px", | |
| 105 | + "", | |
| 106 | + "", | |
| 107 | + "", | |
| 108 | + titulo, | |
| 109 | + "i3GEOF.conectarwms", | |
| 110 | + false, | |
| 111 | + "hd", | |
| 112 | + "", | |
| 113 | + minimiza, | |
| 114 | + "", | |
| 115 | + true, | |
| 116 | + "", | |
| 117 | + "", | |
| 118 | + "", | |
| 119 | + "", | |
| 120 | + "28" | |
| 121 | + ); | |
| 122 | + divid = janela[2].id; | |
| 123 | + i3GEOF.conectarwms.aguarde = $i("i3GEOF.conectarwms_imagemCabecalho").style; | |
| 124 | + $i("i3GEOF.conectarwms_corpo").style.backgroundColor = "white"; | |
| 125 | + i3GEOF.conectarwms.inicia(divid); | |
| 126 | + }, | |
| 127 | + adiciona: function(id){ | |
| 128 | + var url, temp, cp, p; | |
| 129 | + if(i3GEOF.conectarwms.aguarde.visibility === "visible"){ | |
| 130 | + return; | |
| 157 | 131 | } |
| 158 | - }; | |
| 159 | - $i("guia2obj").style.display="block"; | |
| 160 | - aguarde("block"); | |
| 161 | - var p = "../../classesphp/mapa_controle.php?g_sid="+g_sid+"&funcao=getcapabilities2&servico="+$i("servico").value; | |
| 162 | - var cp = new cpaint(); | |
| 163 | - //cp.set_debug(2) | |
| 164 | - cp.set_response_type("JSON"); | |
| 165 | - cp.call(p,"getcapabilities2",metadados); | |
| 166 | - } | |
| 167 | -} | |
| 168 | -/* | |
| 169 | -Function: clickGuia3 | |
| 170 | - | |
| 171 | -Lista as camadas existentes no WMS escolhido. | |
| 172 | - | |
| 173 | -O resultado da chamada em PHP é uma string HTML já formatada. O "radio" aponta para a função "adiciona" | |
| 174 | - | |
| 175 | -Veja: | |
| 176 | - | |
| 177 | -<TEMASWMS> | |
| 178 | -*/ | |
| 179 | -function clickGuia3(codLayer) | |
| 180 | -{ | |
| 181 | - //mostraGuia("guia3"); | |
| 182 | - i3GEO.guias.mostraGuiaFerramenta("guia3"); | |
| 183 | - var listatemas = function(retorno){ | |
| 184 | - g_idws = ""; | |
| 185 | - aguarde("none"); | |
| 186 | - if ((retorno.data != "erro") && (retorno.data != undefined)){ | |
| 187 | - $i("listatemas").innerHTML = retorno.data; | |
| 188 | - g_tipo = ""; //tipo de tema | |
| 189 | - g_tema = ""; //tema selecionado do ws | |
| 190 | - g_legenda = ""; //legenda do tema | |
| 191 | - g_nometema = ""; //nome do tema | |
| 192 | - g_sld = ""; | |
| 193 | - if ($i("suportasld")){ | |
| 194 | - if ($i("suportasld").value != "nao") { | |
| 195 | - if ($i("textoSLD")) | |
| 196 | - $i("textoSLD").style.display = "block"; | |
| 132 | + if($i("servicoWms").value !== ""){ | |
| 133 | + i3GEOF.conectarwms.aguarde.visibility = "visible"; | |
| 134 | + temp = function(retorno){ | |
| 135 | + i3GEOF.conectarwms.aguarde.visibility = "hidden"; | |
| 136 | + i3GEO.atualiza(); | |
| 137 | + }; | |
| 138 | + cp = new cpaint(); | |
| 139 | + cp.set_response_type("JSON"); | |
| 140 | + p = i3GEO.configura.locaplic+"/ferramentas/conectarwms/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=adicionaTemaGeoRSS&canal="+id+"&servico="+$i("servicoWms").value; | |
| 141 | + cp.call(p,"foo",temp); | |
| 142 | + } | |
| 143 | + }, | |
| 144 | + listaLayers: function(codLayer){ | |
| 145 | + if(i3GEOF.conectarwms.aguarde.visibility === "visible"){ | |
| 146 | + return; | |
| 147 | + } | |
| 148 | + var listatemas = function(retorno){ | |
| 149 | + i3GEOF.conectarwms.aguarde.visibility = "hidden"; | |
| 150 | + i3GEOF.conectarwms.IDWS = ""; | |
| 151 | + if ((retorno.data != "erro") && (retorno.data != undefined)){ | |
| 152 | + $i("resultadoget").innerHTML = retorno.data; | |
| 153 | + i3GEOF.conectarwms.TIPO = ""; //tipo de tema | |
| 154 | + i3GEOF.conectarwms.TEMA = ""; //tema selecionado do ws | |
| 155 | + i3GEOF.conectarwms.LEGENDA = ""; //legenda do tema | |
| 156 | + i3GEOF.conectarwms.NOMETEMA = ""; //nome do tema | |
| 157 | + g_sld = ""; | |
| 158 | + if ($i("suportasld")){ | |
| 159 | + if ($i("suportasld").value != "nao") { | |
| 160 | + if ($i("textoSLD")) | |
| 161 | + $i("textoSLD").style.display = "block"; | |
| 162 | + } | |
| 163 | + } | |
| 164 | + //ativa um layer caso tenha sido enviado como um parametro no inicio da ferramenta | |
| 165 | + i3GEOF.conectarwms.ativaAutoLayer(codLayer); | |
| 166 | + } | |
| 167 | + else{ | |
| 168 | + $i("resultadoget").innerHTML = "<h5 class='alert alert-danger'>"+$trad('erro',i3GEOF.conectarwms.dicionario)+"</h5>"; | |
| 197 | 169 | } |
| 170 | + }; | |
| 171 | + if ($i("servicoWms").value == ""){ | |
| 172 | + i3GEO.janela.tempoMsg($trad('servico',i3GEOF.conectarwms.dicionario)); | |
| 198 | 173 | } |
| 199 | - //ativa um layer caso tenha sido enviado como um parametro no inicio da ferramenta | |
| 200 | - ativaAutoLayer(codLayer); | |
| 201 | - } | |
| 202 | - else{ | |
| 203 | - //$i("listatemas").innerHTML = "erro"; | |
| 204 | - } | |
| 205 | - }; | |
| 206 | - if ($i("servico").value == ""){ | |
| 207 | - i3GEO.janela.tempoMsg($trad('servico',i3GEOF.conectarwms.dicionario)); | |
| 208 | - } | |
| 209 | - else | |
| 210 | - { | |
| 211 | - $i("listatemas").innerHTML = ""; | |
| 212 | - aguarde("block"); | |
| 213 | - var p = "../../classesphp/mapa_controle.php?g_sid="+g_sid+"&funcao=temaswms&id_ws="+g_idws+"&servico="+$i("servico").value; | |
| 214 | - var cp = new cpaint(); | |
| 215 | - //cp.set_debug(2) | |
| 216 | - cp.set_response_type("JSON"); | |
| 217 | - cp.call(p,"temaswms",listatemas); | |
| 218 | - } | |
| 219 | -} | |
| 220 | -function ativaAutoLayer(codLayer){ | |
| 221 | - if(codLayer && codLayer != ""){ | |
| 222 | - var container, rs, nrs, i, r, codLayer1; | |
| 223 | - codLayer1 = codLayer.split(":"); | |
| 224 | - if(codLayer1.length > 0){ | |
| 225 | - codLayer1 = codLayer1[1]; | |
| 226 | - } | |
| 227 | - else{ | |
| 228 | - codLayer1 = codLayer1[0]; | |
| 229 | - } | |
| 230 | - container = $i("listatemas"); | |
| 231 | - if(container){ | |
| 232 | - rs = container.getElementsByTagName("input"); | |
| 233 | - nrs = rs.length; | |
| 234 | - | |
| 235 | - for(i = 0; i < nrs; i++){ | |
| 236 | - r = rs[i]; | |
| 237 | - if(r.type === "radio" && (r.value === codLayer || r.value === codLayer1)){ | |
| 238 | - r.onclick.call(); | |
| 239 | - r.checked = true; | |
| 240 | - r.previousElementSibling.previousElementSibling.previousElementSibling.previousElementSibling.previousElementSibling.previousElementSibling.scrollIntoView(true); | |
| 174 | + else{ | |
| 175 | + $i("resultadoget").innerHTML = ""; | |
| 176 | + i3GEOF.conectarwms.aguarde.visibility = "visible"; | |
| 177 | + var p = i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=temaswms&id_ws="+i3GEOF.conectarwms.IDWS+"&servico="+$i("servicoWms").value; | |
| 178 | + var cp = new cpaint(); | |
| 179 | + cp.set_response_type("JSON"); | |
| 180 | + cp.call(p,"temaswms",listatemas); | |
| 181 | + } | |
| 182 | + }, | |
| 183 | + registraws: function(nome,id_ws,tipo){ | |
| 184 | + $i("servicoWms").value = nome; | |
| 185 | + if(arguments.length == 2){ | |
| 186 | + i3GEOF.conectarwms.IDWS = id_ws; | |
| 187 | + } | |
| 188 | + else { | |
| 189 | + i3GEOF.conectarwms.IDWS = ""; | |
| 190 | + } | |
| 191 | + i3GEOF.conectarwms.listaLayers(); | |
| 192 | + | |
| 193 | + i3GEOF.conectarwms.TIPO = ""; //tipo de tema | |
| 194 | + i3GEOF.conectarwms.TIPOWS = "WMS"; //tipo de servico | |
| 195 | + i3GEOF.conectarwms.TEMA = ""; //tema selecionado do ws | |
| 196 | + i3GEOF.conectarwms.LEGENDA = ""; //legenda do tema | |
| 197 | + i3GEOF.conectarwms.NOMETEMA = ""; //nome do tema | |
| 198 | + if(tipo){ | |
| 199 | + i3GEOF.conectarwms.TIPOWS = tipo; | |
| 200 | + } | |
| 201 | + i3GEOF.conectarwms.listaLayers(); | |
| 202 | + }, | |
| 203 | + montaCanais: function(retorno){ | |
| 204 | + var i,ins = "<h5>"+ $trad('selecionaItem',i3GEOF.conectarwms.dicionario)+"</h5>"; | |
| 205 | + i3GEOF.conectarwms.aguarde.visibility = "hidden"; | |
| 206 | + if (retorno.data != undefined){ | |
| 207 | + retorno = retorno.data; | |
| 208 | + for (i=0;i<retorno.length; i++){ | |
| 209 | + ins += "<div class='list-group condensed'><div class='row-content text-left'>" + | |
| 210 | + "<label class='nomeTema'><a onclick='i3GEOF.conectarwms.adiciona(\""+i+"\");return false;' href='javascript:void(0)'><h4>" + retorno[i].title + "</h4></a></label></div></div>"; | |
| 211 | + } | |
| 212 | + $i("resultadoget").innerHTML = ins; | |
| 213 | + } | |
| 214 | + else{ | |
| 215 | + $i("resultadoget").innerHTML = "<h5 class='alert alert-danger'>"+$trad('erro',i3GEOF.conectarwms.dicionario)+"</h5>"; | |
| 216 | + } | |
| 217 | + }, | |
| 218 | + ativaAutoLayer: function (codLayer){ | |
| 219 | + if(codLayer && codLayer != ""){ | |
| 220 | + var container, rs, nrs, i, r, codLayer1; | |
| 221 | + codLayer1 = codLayer.split(":"); | |
| 222 | + if(codLayer1.length > 0){ | |
| 223 | + codLayer1 = codLayer1[1]; | |
| 224 | + } | |
| 225 | + else{ | |
| 226 | + codLayer1 = codLayer1[0]; | |
| 227 | + } | |
| 228 | + container = $i("resultadoget"); | |
| 229 | + if(container){ | |
| 230 | + rs = container.getElementsByTagName("input"); | |
| 231 | + nrs = rs.length; | |
| 232 | + | |
| 233 | + for(i = 0; i < nrs; i++){ | |
| 234 | + r = rs[i]; | |
| 235 | + if(r.type === "radio" && (r.value === codLayer || r.value === codLayer1)){ | |
| 236 | + r.onclick.call(); | |
| 237 | + r.checked = true; | |
| 238 | + r.previousElementSibling.previousElementSibling.previousElementSibling.previousElementSibling.previousElementSibling.previousElementSibling.scrollIntoView(true); | |
| 239 | + } | |
| 240 | + } | |
| 241 | + } | |
| 242 | + } | |
| 243 | + }, | |
| 244 | + seltema: function(tipo,tema,legenda,nometema,nomecamada,sldflag){ | |
| 245 | + i3GEOF.conectarwms.TIPO = tipo; //tipo de tema | |
| 246 | + i3GEOF.conectarwms.TIPOWS = "WMS"; //tipo de servico | |
| 247 | + i3GEOF.conectarwms.TEMA = tema; //tema selecionado do ws | |
| 248 | + i3GEOF.conectarwms.LEGENDA = legenda; //legenda do tema | |
| 249 | + | |
| 250 | + if (tema != ""){ | |
| 251 | + var retorno = function(retorno){ | |
| 252 | + i3GEOF.conectarwms.aguarde.visibility = "hidden"; | |
| 253 | + if(retorno.data != "ok"){ | |
| 254 | + i3GEO.janela.tempoMsg($trad('erro2',i3GEOF.conectarwms.dicionario));aguarde("none"); | |
| 255 | + } | |
| 256 | + else{ | |
| 257 | + i3GEO.atualiza(); | |
| 258 | + } | |
| 259 | + }; | |
| 260 | + i3GEOF.conectarwms.aguarde.visibility = "visible"; | |
| 261 | + var tiporep = ""; | |
| 262 | + if($i("tiporep")){ | |
| 263 | + tiporep = $i("tiporep").value; | |
| 264 | + } | |
| 265 | + var url = i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid; | |
| 266 | + if($i("servicoWms").value.split("?").length === 1){ | |
| 267 | + $i("servicoWms").value = $i("servicoWms").value+"?"; | |
| 268 | + } | |
| 269 | + if($i("proj").value === ""){ | |
| 270 | + $i("proj").value = "EPSG:4326"; | |
| 271 | + } | |
| 272 | + var p = "&funcao=adicionatemawms&servico="+$i("servicoWms").value+"&tema="+i3GEOF.conectarwms.tema+"&nome="+nometema+"&proj="+$i("proj").value+"&formato="+$i("formatos").value+"&tipo="+tipo+"&versao="+$i("versao").value+"&nomecamada="+nomecamada+"&tiporep="+tiporep+"&suportasld="+sldflag+"&formatosinfo="+$i("formatosinfo").value; | |
| 273 | + if(g_tipows == "WMS-Tile"){ | |
| 274 | + p += "&tile=1"; | |
| 275 | + } | |
| 276 | + else{ | |
| 277 | + p += "&tile=0"; | |
| 241 | 278 | } |
| 279 | + var cp = new cpaint(); | |
| 280 | + cp.set_transfer_mode("POST"); | |
| 281 | + cp.set_response_type("JSON"); | |
| 282 | + cp.call(url,"adicionatemawms",retorno,p); | |
| 242 | 283 | } |
| 243 | 284 | } |
| 244 | - } | |
| 245 | -} | |
| 246 | - | |
| 247 | -/* | |
| 248 | -Function: registraws | |
| 249 | - | |
| 250 | -Armazena em variáveis locais os parametros do WMS escolhido e ativa a guia 3, mostrando a lista de camadas disponíveis | |
| 251 | - | |
| 252 | -Parametros: | |
| 253 | - | |
| 254 | -nome {string} - nome do WMS | |
| 255 | - | |
| 256 | -id_ws {String} - id do WMS | |
| 257 | -*/ | |
| 258 | -function registraws(nome,id_ws,tipo) | |
| 259 | -{ | |
| 260 | - $i("servico").value = nome; | |
| 261 | - g_tipo = ""; //tipo de tema | |
| 262 | - g_tipows = "WMS"; //tipo de servico | |
| 263 | - g_tema = ""; //tema selecionado do ws | |
| 264 | - g_legenda = ""; //legenda do tema | |
| 265 | - g_nometema = ""; //nome do tema | |
| 266 | - if(arguments.length == 2) | |
| 267 | - g_idws = id_ws; | |
| 268 | - else | |
| 269 | - g_idws = ""; | |
| 270 | - if(tipo){ | |
| 271 | - g_tipows = tipo; | |
| 272 | - } | |
| 273 | - clickGuia3(); | |
| 274 | -} | |
| 275 | -/* | |
| 276 | -Function: seltema | |
| 277 | - | |
| 278 | -Inclui um LAYER, escolhido de um WMS, no mapa atual | |
| 279 | - | |
| 280 | -Veja: | |
| 281 | - | |
| 282 | -<ADICIONATEMAWMS> | |
| 283 | - | |
| 284 | -*/ | |
| 285 | -function seltema(tipo,tema,legenda,nometema,nomecamada,sldflag) | |
| 286 | -{ | |
| 287 | - g_tipo = tipo; //tipo de tema | |
| 288 | - g_tema = tema; //tema selecionado do ws | |
| 289 | - g_legenda = legenda; //legenda do tema | |
| 290 | - g_nometema = nometema; //nome do tema | |
| 291 | - g_nomecamada = nomecamada; //nome que vai na legenda | |
| 292 | - g_sld = sldflag; //suporta ou nao sld | |
| 293 | - if (g_tema != "") | |
| 294 | - { | |
| 295 | - var retorno = function(retorno) | |
| 296 | - { | |
| 297 | - aguarde("none"); | |
| 298 | - if(retorno.data != "ok") | |
| 299 | - {i3GEO.janela.tempoMsg($trad('erro2',i3GEOF.conectarwms.dicionario));aguarde("none");} | |
| 300 | - else | |
| 301 | - {window.parent.i3GEO.atualiza();} | |
| 285 | +}; | |
| 286 | +function seltema (tipo,tema,legenda,nometema,nomecamada,sldflag){ | |
| 287 | + i3GEOF.conectarwms.TIPO = tipo; //tipo de tema | |
| 288 | + i3GEOF.conectarwms.TEMA = tema; //tema selecionado do ws | |
| 289 | + i3GEOF.conectarwms.LEGENDA = legenda; //legenda do tema | |
| 290 | + | |
| 291 | + if (tema != ""){ | |
| 292 | + var retorno = function(retorno) { | |
| 293 | + if(retorno.data != "ok"){ | |
| 294 | + i3GEO.janela.tempoMsg($trad('erro2',i3GEOF.conectarwms.dicionario)); | |
| 295 | + } | |
| 296 | + else{ | |
| 297 | + i3GEO.atualiza(); | |
| 298 | + } | |
| 302 | 299 | }; |
| 303 | - aguarde("block"); | |
| 300 | + | |
| 304 | 301 | var tiporep = ""; |
| 305 | 302 | if($i("tiporep")){ |
| 306 | 303 | tiporep = $i("tiporep").value; |
| 307 | 304 | } |
| 308 | - var url = "../../classesphp/mapa_controle.php?g_sid="+g_sid; | |
| 309 | - if($i("servico").value.split("?").length === 1){ | |
| 310 | - $i("servico").value = $i("servico").value+"?"; | |
| 305 | + var url = i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid; | |
| 306 | + if($i("servicoWms").value.split("?").length === 1){ | |
| 307 | + $i("servicoWms").value = $i("servicoWms").value+"?"; | |
| 311 | 308 | } |
| 312 | 309 | if($i("proj").value === ""){ |
| 313 | 310 | $i("proj").value = "EPSG:4326"; |
| 314 | 311 | } |
| 315 | - var p = "&funcao=adicionatemawms&servico="+$i("servico").value+"&tema="+g_tema+"&nome="+g_nometema+"&proj="+$i("proj").value+"&formato="+$i("formatos").value+"&tipo="+g_tipo+"&versao="+$i("versao").value+"&nomecamada="+g_nomecamada+"&tiporep="+tiporep+"&suportasld="+g_sld+"&formatosinfo="+$i("formatosinfo").value; | |
| 316 | - if(g_tipows == "WMS-Tile"){ | |
| 312 | + var p = "&funcao=adicionatemawms&servico="+$i("servicoWms").value+"&tema="+tema+"&nome="+nometema | |
| 313 | + +"&proj="+$i("proj").value+"&formato="+$i("formatos").value | |
| 314 | + +"&tipo="+tipo+"&versao="+$i("versao").value | |
| 315 | + +"&nomecamada="+nomecamada+"&tiporep="+tiporep+"&suportasld="+sldflag+"&formatosinfo="+$i("formatosinfo").value; | |
| 316 | + if(i3GEOF.conectarwms.TIPOWS == "WMS-Tile"){ | |
| 317 | 317 | p += "&tile=1"; |
| 318 | 318 | } |
| 319 | 319 | else{ |
| ... | ... | @@ -321,41 +321,7 @@ function seltema(tipo,tema,legenda,nometema,nomecamada,sldflag) |
| 321 | 321 | } |
| 322 | 322 | var cp = new cpaint(); |
| 323 | 323 | cp.set_transfer_mode("POST"); |
| 324 | - //cp.set_debug(2) | |
| 325 | 324 | cp.set_response_type("JSON"); |
| 326 | 325 | cp.call(url,"adicionatemawms",retorno,p); |
| 327 | 326 | } |
| 328 | -} | |
| 329 | -/* | |
| 330 | -Function abrejanelaIframe | |
| 331 | - | |
| 332 | -Abre uma janela flutuante contendo um iframe | |
| 333 | - | |
| 334 | -Parametros: | |
| 335 | - | |
| 336 | -w {string} - largura | |
| 337 | - | |
| 338 | -h {string} - altura | |
| 339 | - | |
| 340 | -s {string} - src do iframe | |
| 341 | -*/ | |
| 342 | -function abrejanelaIframe(){ | |
| 343 | - var s = "../../admin/html/webservices.html?tipo=wms"; | |
| 344 | - var janelaeditor = i3GEO.janela.cria( | |
| 345 | - "1000", | |
| 346 | - "500", | |
| 347 | - s, | |
| 348 | - parseInt(Math.random()*100,10), | |
| 349 | - 10, | |
| 350 | - s, | |
| 351 | - "janela"+window.parent.i3GEO.util.randomRGB(), | |
| 352 | - false, | |
| 353 | - "hd", | |
| 354 | - "", | |
| 355 | - "", | |
| 356 | - "", | |
| 357 | - true, | |
| 358 | - window.parent.i3GEO.configura.locaplic+"/imagens/oxygen/16x16/application-x-smb-workgroup.png" | |
| 359 | - ); | |
| 360 | - YAHOO.util.Event.addListener(janelaeditor[0].close, "click", iniciaListaWS,janelaeditor[0].panel,{id:janelaeditor[0].id},true); | |
| 361 | -} | |
| 362 | 327 | \ No newline at end of file |
| 328 | +}; | |
| 363 | 329 | \ No newline at end of file | ... | ... |
ferramentas/conectarwms/listalayers.php
| ... | ... | @@ -1,84 +0,0 @@ |
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Este programa e utilizado pela ferramenta buscainde | |
| 4 | - * E uma copia da ferramenta conctarwms sem mostrar as guias de esolha de servico | |
| 5 | - * Isso pq o endereco do servico e um parametro obtido em $_GET["servico"] | |
| 6 | - */ | |
| 7 | -include (dirname(__FILE__)."/../../classesphp/sani_request.php"); | |
| 8 | -include(dirname(__FILE__)."../../ms_configura.php"); | |
| 9 | -include(dirname(__FILE__)."../blacklist.php"); | |
| 10 | -verificaBlFerramentas(basename(dirname(__FILE__)),$i3geoBlFerramentas,true); | |
| 11 | -?> | |
| 12 | -<html> | |
| 13 | - | |
| 14 | -<head> | |
| 15 | -<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> | |
| 16 | -<link rel="stylesheet" type="text/css" href="../../css/i3geo_ferramentas6.css"> | |
| 17 | -<title></title> | |
| 18 | -<style type="text/css" >button{background:url(../../imagens/tic.png) 98% 50% no-repeat;}</style> | |
| 19 | -<link rel="stylesheet" type="text/css" href="../../pacotes/yui290/build/button/assets/skins/sam/button.css"/> | |
| 20 | -<style type="text/css"> | |
| 21 | -body { | |
| 22 | - margin:0; | |
| 23 | - padding:0;border:0px; | |
| 24 | -} | |
| 25 | -p{ | |
| 26 | - text-align: left; | |
| 27 | -} | |
| 28 | -.guiaobj { | |
| 29 | - background-color: white; | |
| 30 | - display: block; | |
| 31 | - height: 97%; | |
| 32 | - left: 0; | |
| 33 | - overflow: auto; | |
| 34 | - text-align: left; | |
| 35 | - top: 0; | |
| 36 | - width: 98%; | |
| 37 | -} | |
| 38 | -</style> | |
| 39 | -</head> | |
| 40 | -<body class="yui-skin-sam" style="background-color: white;"> | |
| 41 | - | |
| 42 | - <div class=guiaobj id="guia3obj" style="left:0px;display:block;"> | |
| 43 | - <div id=listatemas style="display:block;position:relative;top:10px;left:0px;"> | |
| 44 | - Aguarde... | |
| 45 | - </div> | |
| 46 | - </div> | |
| 47 | - | |
| 48 | -<input type=hidden id=servico value="<?php echo $_GET["servico"];?>" /> | |
| 49 | - | |
| 50 | -<script type="text/javascript" src="../../classesjs/i3geo.js"></script> | |
| 51 | -<script type="text/javascript" src="index.js"></script> | |
| 52 | - | |
| 53 | -<script type="text/javascript" > | |
| 54 | -// | |
| 55 | -//tenta pegar o codigo do layer do endereco do servico | |
| 56 | -// | |
| 57 | -var buscarEm = ["LAYER","LAYERS","layer","layers","tema","typename","typeName"], | |
| 58 | - n = buscarEm.length, | |
| 59 | - i,s,partes, | |
| 60 | - b = [], | |
| 61 | - codLayer = "", | |
| 62 | - u = window.location.href; | |
| 63 | - | |
| 64 | -//acrescenta novas strings | |
| 65 | -for(i = 0; i < n; i++){ | |
| 66 | - b.push("&" + buscarEm[i] + "="); | |
| 67 | - b.push("?" + buscarEm[i] + "="); | |
| 68 | -} | |
| 69 | -n = b.length; | |
| 70 | -//quebra as strings pra achar o padrao | |
| 71 | -for(i = 0; i < n; i++){ | |
| 72 | - s = b[i]; | |
| 73 | - partes = u.split(s); | |
| 74 | - if(partes.length > 1){ | |
| 75 | - partes = partes[1].split("&"); | |
| 76 | - codLayer = partes[0]; | |
| 77 | - } | |
| 78 | -} | |
| 79 | -g_locaplic = "../.."; | |
| 80 | -//console.info(codLayer) | |
| 81 | -clickGuia3(codLayer); | |
| 82 | -</script> | |
| 83 | -</body> | |
| 84 | -</html> |
| ... | ... | @@ -0,0 +1,11 @@ |
| 1 | +<div class="container-fluid"> | |
| 2 | + <div class='form-group label-fixed condensed'> | |
| 3 | + <label class="control-label" for="servicoWms">{{{sel}}}</label> | |
| 4 | + <input class="form-control input-lg" type='text' id='servicoWms' value='' /> | |
| 5 | + </div> | |
| 6 | + <div class='form-group label-fixed condensed'> | |
| 7 | + <div style="width: 100%;" class="input-group" id='RSSgeo'></div> | |
| 8 | + </div> | |
| 9 | + <button onclick="i3GEOF.conectarwms.listaLayers()" class='btn btn-primary btn-sm btn-raised'>{{{listaLayers}}}</button> | |
| 10 | + <div id="resultadoget" ></div> | |
| 11 | +</div> | |
| 0 | 12 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,28 @@ |
| 1 | +//+$trad(1,i3GEOF.conectarwms.dicionario)+ | |
| 2 | +i3GEOF.conectarwms.dicionario = { | |
| 3 | + 'erro' : [ { | |
| 4 | + pt : "Oops! Ocorreu um erro", | |
| 5 | + en : "", | |
| 6 | + es : "¡Oops! Ocurrió un error" | |
| 7 | + } ], | |
| 8 | + 'disponibilidade' : [ { | |
| 9 | + pt : "disponibilidade", | |
| 10 | + en : "", | |
| 11 | + es : "disponibilidad" | |
| 12 | + } ], | |
| 13 | + 'acessos' : [ { | |
| 14 | + pt : "acessos considerados", | |
| 15 | + en : "", | |
| 16 | + es : "Accesos considerados" | |
| 17 | + } ], | |
| 18 | + 'servico' : [ { | |
| 19 | + pt : "Serviço não definido", | |
| 20 | + en : "", | |
| 21 | + es : "Servicio no definido" | |
| 22 | + } ], | |
| 23 | + 5 : [ { | |
| 24 | + pt : "Ooops! Problemas ao acessar o serviço.", | |
| 25 | + en : "", | |
| 26 | + es : "¡Oops! Problemas para acceder al servicio." | |
| 27 | + } ] | |
| 28 | +}; | |
| 0 | 29 | \ No newline at end of file | ... | ... |
1.48 KB
| ... | ... | @@ -0,0 +1,141 @@ |
| 1 | +<!DOCTYPE html> | |
| 2 | +<html> | |
| 3 | +<head> | |
| 4 | +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> | |
| 5 | +<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=0"> | |
| 6 | +<script src="../../js/i3geo.js"></script> | |
| 7 | +<link rel="stylesheet" type="text/css" href="../../pacotes/bootstrap/css/bootstrap.min.css"> | |
| 8 | +<link rel="stylesheet" type="text/css" href="../../pacotes/bootstrap-material-design/dist/css/bootstrap-material-design.min.css"> | |
| 9 | +<link rel="stylesheet" type="text/css" href="../../css/default.css"> | |
| 10 | +</head> | |
| 11 | +<body id="i3geo" style='background-color: #477596; height: 400px; visibility:visible' class="yui-skin-sam bd"> | |
| 12 | + <div class='yui-navset' style='top: 0px; cursor: pointer; left: 0px; margin-left: 2px;'> | |
| 13 | + <ul class="yui-nav" style="border-width: 0pt 0pt 0px; border-color: rgb(240, 240, 240); border-bottom-color: white;"> | |
| 14 | + <li> | |
| 15 | + <div id='guia1' style='text-align: center; left: 0px;'> | |
| 16 | + <a> | |
| 17 | + <em>Serviços</em> | |
| 18 | + </a> | |
| 19 | + </div> | |
| 20 | + </li> | |
| 21 | + <li> | |
| 22 | + <div id='guia2' style='text-align: center; left: 0px;'> | |
| 23 | + <a> | |
| 24 | + <em>Metadados</em> | |
| 25 | + </a> | |
| 26 | + </div> | |
| 27 | + </li> | |
| 28 | + <li> | |
| 29 | + <div id='guia3' style='text-align: center; left: 0px;'> | |
| 30 | + <a> | |
| 31 | + <em>Lista de temas</em> | |
| 32 | + </a> | |
| 33 | + </div> | |
| 34 | + </li> | |
| 35 | + </ul> | |
| 36 | + </div> | |
| 37 | + | |
| 38 | + <div class='container-fluid bd' id="guia1obj"> | |
| 39 | + <h5> | |
| 40 | + <a href="../../documentacao/ajuda/The_ArcIMS_OGC_WMS_Connector.pdf" target=blank>Veja como criar web services no ARCIMS</a> | |
| 41 | + </h5> | |
| 42 | + <h5> | |
| 43 | + <a href="../../documentacao/ajuda/ArcGIS9.x.html" target=blank>Veja como utilizar web services no ARCGIS</a> | |
| 44 | + </h5> | |
| 45 | + <h5>Digite o endereço do serviço ou escolha da lista abaixo. Utilize as guias acima para ver o resultado da conexão. Por padrão, utiliza-se a versão | |
| 46 | + 1.1.0 do GetCapabilities. Você pode adicionar um outro, bastando incluir no endereço do serviço "&version=1.3.0" por exemplo.</h5> | |
| 47 | + | |
| 48 | + <div class='form-group label-fixed condensed'> | |
| 49 | + <input class="form-control input-lg" type='text' id='servico' value='' /> | |
| 50 | + </div> | |
| 51 | + | |
| 52 | + <div style="width: 100%;" class='form-group label-fixed condensed'> | |
| 53 | + <div id=RSSwms class="input-group"></div> | |
| 54 | + </div> | |
| 55 | + <br> | |
| 56 | + <div id=RSSbt style="text-align: left;"></div> | |
| 57 | + </div> | |
| 58 | + <div class='container-fluid' id="guia2obj"> | |
| 59 | + <p class=paragrafo> | |
| 60 | + <input type=button id="getCapabilities" value="Descrição do WMS" /> | |
| 61 | + </p> | |
| 62 | + <div id=resultadoget style="display: block; position: relative; top: 5px; left: 1px" class=paragrafo></div> | |
| 63 | + </div> | |
| 64 | + <div class='container-fluid' id="guia3obj"> | |
| 65 | + <p class=paragrafo> | |
| 66 | + Após a conexão ser estabelecida e surgir a lista de temas, selecione a camada que será adicionada ao mapa. | |
| 67 | + <br> | |
| 68 | + </p> | |
| 69 | + <div id=textoSLD style="display: none; font-size: 10px"> | |
| 70 | + <p class=paragrafo> | |
| 71 | + Opcionalmente vc pode indicar o tipo de representação que será utilizada. | |
| 72 | + <br> | |
| 73 | + Não altere o tipo de representação se a camada escolhida for uma imagem (dados raster) ou se você tiver dúvidas sobre ela. | |
| 74 | + <br> | |
| 75 | + </p> | |
| 76 | + <div class=styled-select> | |
| 77 | + <select id=tiporep> | |
| 78 | + <option value="">---</option> | |
| 79 | + <option value="poligonal">poligonal</option> | |
| 80 | + <option value="linear">linear</option> | |
| 81 | + <option value="pontual">pontual</option> | |
| 82 | + </select> | |
| 83 | + </div> | |
| 84 | + </div> | |
| 85 | + <div id=listatemas class=paragrafo></div> | |
| 86 | + </div> | |
| 87 | + | |
| 88 | + <div id="aguarde">Aguarde...</div> | |
| 89 | + | |
| 90 | + <script type="text/javascript" src="index.js"></script> | |
| 91 | + <script type="text/javascript"> | |
| 92 | + $.material.init(); | |
| 93 | + var b = new YAHOO.widget.Button("getCapabilities", { | |
| 94 | + onclick : { | |
| 95 | + fn : getcapabilities | |
| 96 | + } | |
| 97 | + }); | |
| 98 | + b.addClass("rodar"); | |
| 99 | + g_locaplic = "../.."; | |
| 100 | + iniciaListaWS(); | |
| 101 | + function iniciaListaWS() { | |
| 102 | + g_RSSwms = new Array(""); | |
| 103 | + aguarde("block"); | |
| 104 | + | |
| 105 | + if (document.getElementById("RSSwms")) { | |
| 106 | + if (g_RSSwms.length > 0) { | |
| 107 | + var p = g_locaplic | |
| 108 | + + "/classesphp/wscliente.php?funcao=listaRSSwsARRAY&rss=" | |
| 109 | + + g_RSSwms.join("|") + "&tipo=WMS"; | |
| 110 | + var cp = new cpaint(); | |
| 111 | + //cp.set_debug(2) | |
| 112 | + cp.set_response_type("JSON"); | |
| 113 | + cp.call(p, "listaRSSwsARRAY", mostraRetornowmsRSS); | |
| 114 | + } | |
| 115 | + } | |
| 116 | + } | |
| 117 | + function mostraRetornowmsRSS(retorno) { | |
| 118 | + var reg = /Erro/gi; | |
| 119 | + if (retorno.data.rss.search(reg) != -1) { | |
| 120 | + i3GEO.janela.tempoMsg("OOps! Ocorreu um erro\n" + retorno.data); | |
| 121 | + return; | |
| 122 | + } | |
| 123 | + var canais = retorno.data.canais; | |
| 124 | + var ncanais = canais.length; | |
| 125 | + $i("RSSbt").innerHTML = retorno.data.rss; | |
| 126 | + var i, ins = ""; | |
| 127 | + ins += "<select class='form-control' size='5' onchange='registraws(this.value)' style='width:100%;' >"; | |
| 128 | + for (i = 0; i < ncanais; i++) { | |
| 129 | + var caso = canais[i]; | |
| 130 | + var valor = "'" + caso.link + "','" + caso.id_ws + "','" | |
| 131 | + + caso.tipo_ws + "'"; | |
| 132 | + ins += "<option value=" + valor + " >" + caso.title | |
| 133 | + + "</option>"; | |
| 134 | + } | |
| 135 | + ins += "</select>"; | |
| 136 | + document.getElementById("RSSwms").innerHTML = ins; | |
| 137 | + aguarde("none"); | |
| 138 | + } | |
| 139 | + </script> | |
| 140 | +</body> | |
| 141 | +</html> | ... | ... |
| ... | ... | @@ -0,0 +1,361 @@ |
| 1 | +/* | |
| 2 | +Title: Conexão com WMS | |
| 3 | + | |
| 4 | +Acrescenta ao mapa um novo tema com base em um endereço de WMS | |
| 5 | + | |
| 6 | +O usuário pode indicar o endereço ou escolher de uma lista. A lista é pré-definida por meio do sistema de administração | |
| 7 | +do i3Geo. | |
| 8 | + | |
| 9 | +Veja: | |
| 10 | + | |
| 11 | +<ADICIONATEMAWMS> | |
| 12 | + | |
| 13 | +Arquivo: | |
| 14 | + | |
| 15 | +i3geo/ferramentas/conectarwms/index.js | |
| 16 | + | |
| 17 | +Licenca: | |
| 18 | + | |
| 19 | +GPL2 | |
| 20 | + | |
| 21 | +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | |
| 22 | + | |
| 23 | +Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | |
| 24 | +Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | |
| 25 | + | |
| 26 | +Este programa é software livre; você pode redistribuí-lo | |
| 27 | +e/ou modificá-lo sob os termos da Licença Pública Geral | |
| 28 | +GNU conforme publicada pela Free Software Foundation; | |
| 29 | + | |
| 30 | +Este programa é distribuído na expectativa de que seja útil, | |
| 31 | +porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | |
| 32 | +de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | |
| 33 | +Consulte a Licença Pública Geral do GNU para mais detalhes. | |
| 34 | +Você deve ter recebido uma cópia da Licença Pública Geral do | |
| 35 | +GNU junto com este programa; se não, escreva para a | |
| 36 | +Free Software Foundation, Inc., no endereço | |
| 37 | +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 38 | +*/ | |
| 39 | +//variaveis globais | |
| 40 | +g_tipo = ""; //tipo de tema | |
| 41 | +g_tema = ""; //tema selecionado do ws | |
| 42 | +g_legenda = ""; //legenda do tema | |
| 43 | +g_nometema = ""; //nome do tema | |
| 44 | +g_idws = ""; | |
| 45 | +g_sid = window.parent.i3GEO.configura.sid; | |
| 46 | +var g_tipows = "";//obtido do mapfile | |
| 47 | +//ativaGuias(""); | |
| 48 | +//mostraGuia("guia1"); | |
| 49 | +i3GEO.guias.mostraGuiaFerramenta("guia1"); | |
| 50 | +if($i("guia1")){ | |
| 51 | + $i("guia1").onclick = function(){ | |
| 52 | + //mostraGuia("guia1"); | |
| 53 | + i3GEO.guias.mostraGuiaFerramenta("guia1"); | |
| 54 | + $i("resultadoget").innerHTML = ""; | |
| 55 | + }; | |
| 56 | +} | |
| 57 | +if($i("guia2")){ | |
| 58 | + $i("guia2").onclick = function(){clickGuia2();}; | |
| 59 | +} | |
| 60 | +if($i("guia3")){ | |
| 61 | + $i("guia3").onclick = function(){clickGuia3();}; | |
| 62 | +} | |
| 63 | +function aguarde(valor){ | |
| 64 | + if(document.getElementById("aguarde")) | |
| 65 | + document.getElementById("aguarde").style.display = valor; | |
| 66 | +} | |
| 67 | +/* | |
| 68 | +Function: listaRSS | |
| 69 | + | |
| 70 | +Monta a lista de serviços WMS cadastrados no sistema de administração do i3Geo | |
| 71 | + | |
| 72 | +Veja: | |
| 73 | + | |
| 74 | +<LISTARSSWSARRAY> | |
| 75 | + | |
| 76 | +Parametros: | |
| 77 | + | |
| 78 | +g_RSS {Array} - array com a lista de RSS que contém a lista de WMS cadastrados. Se for um array com um único elemento vazio, | |
| 79 | +será utilizado o endereço default do i3GEO (g_RSS = new Array("")) | |
| 80 | + | |
| 81 | +onde {Stribg} - id do elemento HTML que receberá a lista de endereços formatada | |
| 82 | +*/ | |
| 83 | +function listaRSS(g_RSS,onde) | |
| 84 | +{ | |
| 85 | + var mostraRetornoRSS = function(retorno){ | |
| 86 | + aguarde("none"); | |
| 87 | + var reg = /Erro/gi; | |
| 88 | + if (retorno.data.rss.search(reg) != -1) | |
| 89 | + { | |
| 90 | + i3GEO.janela.tempoMsg($trad('erro',i3GEOF.conectarwms.dicionario)+"\n"+retorno.data); | |
| 91 | + return; | |
| 92 | + } | |
| 93 | + var canais = retorno.data.canais; | |
| 94 | + var ncanais = canais.length; | |
| 95 | + var ins = "<br>"+retorno.data.rss; | |
| 96 | + for (var i=0;i<ncanais; i++) | |
| 97 | + { | |
| 98 | + var caso = canais[i]; | |
| 99 | + ins += "\<p class=clique onclick=\"registraws('"+caso.link+"','"+caso.id_ws+"','"+caso.tipo_ws+"')\" \>\<b\>"+caso.title+"\<\/b\> "+caso.description+" ("+caso.author+")"; | |
| 100 | + if(caso.nacessos > 0) | |
| 101 | + { | |
| 102 | + var pc = (parseInt(caso.nacessosok) * 100) / parseInt(caso.nacessos); | |
| 103 | + ins += " \<span style=color:gray \>("+$trad('disponibilidade',i3GEOF.conectarwms.dicionario)+": "+pc+"%, "+$trad('acessos',i3GEOF.conectarwms.dicionario)+": "+caso.nacessos+")\<\/span>\<\/p\>"; | |
| 104 | + } | |
| 105 | + } | |
| 106 | + document.getElementById(onde).innerHTML = ins+"<br><br>"; | |
| 107 | + }; | |
| 108 | + if (document.getElementById(onde)) | |
| 109 | + { | |
| 110 | + if (g_RSS.length > 0) | |
| 111 | + { | |
| 112 | + var p = "../../classesphp/wscliente.php?funcao=listaRSSwsARRAY&rss="+g_RSS.join("|")+"&tipo=GEORSS"; | |
| 113 | + var cp = new cpaint(); | |
| 114 | + //cp.set_debug(2) | |
| 115 | + cp.set_response_type("JSON"); | |
| 116 | + cp.call(p,"listaRSSwsARRAY",mostraRetornoRSS); | |
| 117 | + } | |
| 118 | + } | |
| 119 | +} | |
| 120 | +/* | |
| 121 | +Function: getcapabilities | |
| 122 | + | |
| 123 | +Abre uma nova janela com o resultado da chamada GETCAPABILITIES sobre o WMS escolhido | |
| 124 | +*/ | |
| 125 | +function getcapabilities() | |
| 126 | +{ | |
| 127 | + if ($i("servico").value == ""){i3GEO.janela.tempoMsg($trad('servico',i3GEOF.conectarwms.dicionario));} | |
| 128 | + else | |
| 129 | + {window.open($i("servico").value+"&service=wms&request=getcapabilities&version=1.1.1");} | |
| 130 | +} | |
| 131 | +/* | |
| 132 | +Function: clickGuia2 | |
| 133 | + | |
| 134 | +Mostra as principais informações sobre o WMS escolhido tendo como fonte o getcapabilities | |
| 135 | + | |
| 136 | +Veja: | |
| 137 | + | |
| 138 | +<GETCAPABILITIES2> | |
| 139 | +*/ | |
| 140 | +function clickGuia2() | |
| 141 | +{ | |
| 142 | + //mostraGuia("guia2"); | |
| 143 | + i3GEO.guias.mostraGuiaFerramenta("guia2"); | |
| 144 | + if ($i("servico").value == ""){i3GEO.janela.tempoMsg($trad('servico',i3GEOF.conectarwms.dicionario));} | |
| 145 | + else | |
| 146 | + { | |
| 147 | + var metadados = function(retorno){ | |
| 148 | + if (retorno.data != undefined) | |
| 149 | + { | |
| 150 | + aguarde("none"); | |
| 151 | + $i("resultadoget").innerHTML = retorno.data; | |
| 152 | + } | |
| 153 | + else | |
| 154 | + { | |
| 155 | + aguarde("none"); | |
| 156 | + $i("resultadoget").innerHTML = "<p style=color:red >"+$trad('erro',i3GEOF.conectarwms.dicionario)+"<br>"; | |
| 157 | + } | |
| 158 | + }; | |
| 159 | + $i("guia2obj").style.display="block"; | |
| 160 | + aguarde("block"); | |
| 161 | + var p = "../../classesphp/mapa_controle.php?g_sid="+g_sid+"&funcao=getcapabilities2&servico="+$i("servico").value; | |
| 162 | + var cp = new cpaint(); | |
| 163 | + //cp.set_debug(2) | |
| 164 | + cp.set_response_type("JSON"); | |
| 165 | + cp.call(p,"getcapabilities2",metadados); | |
| 166 | + } | |
| 167 | +} | |
| 168 | +/* | |
| 169 | +Function: clickGuia3 | |
| 170 | + | |
| 171 | +Lista as camadas existentes no WMS escolhido. | |
| 172 | + | |
| 173 | +O resultado da chamada em PHP é uma string HTML já formatada. O "radio" aponta para a função "adiciona" | |
| 174 | + | |
| 175 | +Veja: | |
| 176 | + | |
| 177 | +<TEMASWMS> | |
| 178 | +*/ | |
| 179 | +function clickGuia3(codLayer) | |
| 180 | +{ | |
| 181 | + //mostraGuia("guia3"); | |
| 182 | + i3GEO.guias.mostraGuiaFerramenta("guia3"); | |
| 183 | + var listatemas = function(retorno){ | |
| 184 | + g_idws = ""; | |
| 185 | + aguarde("none"); | |
| 186 | + if ((retorno.data != "erro") && (retorno.data != undefined)){ | |
| 187 | + $i("listatemas").innerHTML = retorno.data; | |
| 188 | + g_tipo = ""; //tipo de tema | |
| 189 | + g_tema = ""; //tema selecionado do ws | |
| 190 | + g_legenda = ""; //legenda do tema | |
| 191 | + g_nometema = ""; //nome do tema | |
| 192 | + g_sld = ""; | |
| 193 | + if ($i("suportasld")){ | |
| 194 | + if ($i("suportasld").value != "nao") { | |
| 195 | + if ($i("textoSLD")) | |
| 196 | + $i("textoSLD").style.display = "block"; | |
| 197 | + } | |
| 198 | + } | |
| 199 | + //ativa um layer caso tenha sido enviado como um parametro no inicio da ferramenta | |
| 200 | + ativaAutoLayer(codLayer); | |
| 201 | + } | |
| 202 | + else{ | |
| 203 | + //$i("listatemas").innerHTML = "erro"; | |
| 204 | + } | |
| 205 | + }; | |
| 206 | + if ($i("servico").value == ""){ | |
| 207 | + i3GEO.janela.tempoMsg($trad('servico',i3GEOF.conectarwms.dicionario)); | |
| 208 | + } | |
| 209 | + else | |
| 210 | + { | |
| 211 | + $i("listatemas").innerHTML = ""; | |
| 212 | + aguarde("block"); | |
| 213 | + var p = "../../classesphp/mapa_controle.php?g_sid="+g_sid+"&funcao=temaswms&id_ws="+g_idws+"&servico="+$i("servico").value; | |
| 214 | + var cp = new cpaint(); | |
| 215 | + //cp.set_debug(2) | |
| 216 | + cp.set_response_type("JSON"); | |
| 217 | + cp.call(p,"temaswms",listatemas); | |
| 218 | + } | |
| 219 | +} | |
| 220 | +function ativaAutoLayer(codLayer){ | |
| 221 | + if(codLayer && codLayer != ""){ | |
| 222 | + var container, rs, nrs, i, r, codLayer1; | |
| 223 | + codLayer1 = codLayer.split(":"); | |
| 224 | + if(codLayer1.length > 0){ | |
| 225 | + codLayer1 = codLayer1[1]; | |
| 226 | + } | |
| 227 | + else{ | |
| 228 | + codLayer1 = codLayer1[0]; | |
| 229 | + } | |
| 230 | + container = $i("listatemas"); | |
| 231 | + if(container){ | |
| 232 | + rs = container.getElementsByTagName("input"); | |
| 233 | + nrs = rs.length; | |
| 234 | + | |
| 235 | + for(i = 0; i < nrs; i++){ | |
| 236 | + r = rs[i]; | |
| 237 | + if(r.type === "radio" && (r.value === codLayer || r.value === codLayer1)){ | |
| 238 | + r.onclick.call(); | |
| 239 | + r.checked = true; | |
| 240 | + r.previousElementSibling.previousElementSibling.previousElementSibling.previousElementSibling.previousElementSibling.previousElementSibling.scrollIntoView(true); | |
| 241 | + } | |
| 242 | + } | |
| 243 | + } | |
| 244 | + } | |
| 245 | +} | |
| 246 | + | |
| 247 | +/* | |
| 248 | +Function: registraws | |
| 249 | + | |
| 250 | +Armazena em variáveis locais os parametros do WMS escolhido e ativa a guia 3, mostrando a lista de camadas disponíveis | |
| 251 | + | |
| 252 | +Parametros: | |
| 253 | + | |
| 254 | +nome {string} - nome do WMS | |
| 255 | + | |
| 256 | +id_ws {String} - id do WMS | |
| 257 | +*/ | |
| 258 | +function registraws(nome,id_ws,tipo) | |
| 259 | +{ | |
| 260 | + $i("servico").value = nome; | |
| 261 | + g_tipo = ""; //tipo de tema | |
| 262 | + g_tipows = "WMS"; //tipo de servico | |
| 263 | + g_tema = ""; //tema selecionado do ws | |
| 264 | + g_legenda = ""; //legenda do tema | |
| 265 | + g_nometema = ""; //nome do tema | |
| 266 | + if(arguments.length == 2) | |
| 267 | + g_idws = id_ws; | |
| 268 | + else | |
| 269 | + g_idws = ""; | |
| 270 | + if(tipo){ | |
| 271 | + g_tipows = tipo; | |
| 272 | + } | |
| 273 | + clickGuia3(); | |
| 274 | +} | |
| 275 | +/* | |
| 276 | +Function: seltema | |
| 277 | + | |
| 278 | +Inclui um LAYER, escolhido de um WMS, no mapa atual | |
| 279 | + | |
| 280 | +Veja: | |
| 281 | + | |
| 282 | +<ADICIONATEMAWMS> | |
| 283 | + | |
| 284 | +*/ | |
| 285 | +function seltema(tipo,tema,legenda,nometema,nomecamada,sldflag) | |
| 286 | +{ | |
| 287 | + g_tipo = tipo; //tipo de tema | |
| 288 | + g_tema = tema; //tema selecionado do ws | |
| 289 | + g_legenda = legenda; //legenda do tema | |
| 290 | + g_nometema = nometema; //nome do tema | |
| 291 | + g_nomecamada = nomecamada; //nome que vai na legenda | |
| 292 | + g_sld = sldflag; //suporta ou nao sld | |
| 293 | + if (g_tema != "") | |
| 294 | + { | |
| 295 | + var retorno = function(retorno) | |
| 296 | + { | |
| 297 | + aguarde("none"); | |
| 298 | + if(retorno.data != "ok") | |
| 299 | + {i3GEO.janela.tempoMsg($trad('erro2',i3GEOF.conectarwms.dicionario));aguarde("none");} | |
| 300 | + else | |
| 301 | + {window.parent.i3GEO.atualiza();} | |
| 302 | + }; | |
| 303 | + aguarde("block"); | |
| 304 | + var tiporep = ""; | |
| 305 | + if($i("tiporep")){ | |
| 306 | + tiporep = $i("tiporep").value; | |
| 307 | + } | |
| 308 | + var url = "../../classesphp/mapa_controle.php?g_sid="+g_sid; | |
| 309 | + if($i("servico").value.split("?").length === 1){ | |
| 310 | + $i("servico").value = $i("servico").value+"?"; | |
| 311 | + } | |
| 312 | + if($i("proj").value === ""){ | |
| 313 | + $i("proj").value = "EPSG:4326"; | |
| 314 | + } | |
| 315 | + var p = "&funcao=adicionatemawms&servico="+$i("servico").value+"&tema="+g_tema+"&nome="+g_nometema+"&proj="+$i("proj").value+"&formato="+$i("formatos").value+"&tipo="+g_tipo+"&versao="+$i("versao").value+"&nomecamada="+g_nomecamada+"&tiporep="+tiporep+"&suportasld="+g_sld+"&formatosinfo="+$i("formatosinfo").value; | |
| 316 | + if(g_tipows == "WMS-Tile"){ | |
| 317 | + p += "&tile=1"; | |
| 318 | + } | |
| 319 | + else{ | |
| 320 | + p += "&tile=0"; | |
| 321 | + } | |
| 322 | + var cp = new cpaint(); | |
| 323 | + cp.set_transfer_mode("POST"); | |
| 324 | + //cp.set_debug(2) | |
| 325 | + cp.set_response_type("JSON"); | |
| 326 | + cp.call(url,"adicionatemawms",retorno,p); | |
| 327 | + } | |
| 328 | +} | |
| 329 | +/* | |
| 330 | +Function abrejanelaIframe | |
| 331 | + | |
| 332 | +Abre uma janela flutuante contendo um iframe | |
| 333 | + | |
| 334 | +Parametros: | |
| 335 | + | |
| 336 | +w {string} - largura | |
| 337 | + | |
| 338 | +h {string} - altura | |
| 339 | + | |
| 340 | +s {string} - src do iframe | |
| 341 | +*/ | |
| 342 | +function abrejanelaIframe(){ | |
| 343 | + var s = "../../admin/html/webservices.html?tipo=wms"; | |
| 344 | + var janelaeditor = i3GEO.janela.cria( | |
| 345 | + "1000", | |
| 346 | + "500", | |
| 347 | + s, | |
| 348 | + parseInt(Math.random()*100,10), | |
| 349 | + 10, | |
| 350 | + s, | |
| 351 | + "janela"+window.parent.i3GEO.util.randomRGB(), | |
| 352 | + false, | |
| 353 | + "hd", | |
| 354 | + "", | |
| 355 | + "", | |
| 356 | + "", | |
| 357 | + true, | |
| 358 | + window.parent.i3GEO.configura.locaplic+"/imagens/oxygen/16x16/application-x-smb-workgroup.png" | |
| 359 | + ); | |
| 360 | + YAHOO.util.Event.addListener(janelaeditor[0].close, "click", iniciaListaWS,janelaeditor[0].panel,{id:janelaeditor[0].id},true); | |
| 361 | +} | |
| 0 | 362 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,84 @@ |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Este programa e utilizado pela ferramenta buscainde | |
| 4 | + * E uma copia da ferramenta conctarwms sem mostrar as guias de esolha de servico | |
| 5 | + * Isso pq o endereco do servico e um parametro obtido em $_GET["servico"] | |
| 6 | + */ | |
| 7 | +include (dirname(__FILE__)."/../../classesphp/sani_request.php"); | |
| 8 | +include(dirname(__FILE__)."../../ms_configura.php"); | |
| 9 | +include(dirname(__FILE__)."../blacklist.php"); | |
| 10 | +verificaBlFerramentas(basename(dirname(__FILE__)),$i3geoBlFerramentas,true); | |
| 11 | +?> | |
| 12 | +<html> | |
| 13 | + | |
| 14 | +<head> | |
| 15 | +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> | |
| 16 | +<link rel="stylesheet" type="text/css" href="../../css/i3geo_ferramentas6.css"> | |
| 17 | +<title></title> | |
| 18 | +<style type="text/css" >button{background:url(../../imagens/tic.png) 98% 50% no-repeat;}</style> | |
| 19 | +<link rel="stylesheet" type="text/css" href="../../pacotes/yui290/build/button/assets/skins/sam/button.css"/> | |
| 20 | +<style type="text/css"> | |
| 21 | +body { | |
| 22 | + margin:0; | |
| 23 | + padding:0;border:0px; | |
| 24 | +} | |
| 25 | +p{ | |
| 26 | + text-align: left; | |
| 27 | +} | |
| 28 | +.guiaobj { | |
| 29 | + background-color: white; | |
| 30 | + display: block; | |
| 31 | + height: 97%; | |
| 32 | + left: 0; | |
| 33 | + overflow: auto; | |
| 34 | + text-align: left; | |
| 35 | + top: 0; | |
| 36 | + width: 98%; | |
| 37 | +} | |
| 38 | +</style> | |
| 39 | +</head> | |
| 40 | +<body class="yui-skin-sam" style="background-color: white;"> | |
| 41 | + | |
| 42 | + <div class=guiaobj id="guia3obj" style="left:0px;display:block;"> | |
| 43 | + <div id=listatemas style="display:block;position:relative;top:10px;left:0px;"> | |
| 44 | + Aguarde... | |
| 45 | + </div> | |
| 46 | + </div> | |
| 47 | + | |
| 48 | +<input type=hidden id=servico value="<?php echo $_GET["servico"];?>" /> | |
| 49 | + | |
| 50 | +<script type="text/javascript" src="../../classesjs/i3geo.js"></script> | |
| 51 | +<script type="text/javascript" src="index.js"></script> | |
| 52 | + | |
| 53 | +<script type="text/javascript" > | |
| 54 | +// | |
| 55 | +//tenta pegar o codigo do layer do endereco do servico | |
| 56 | +// | |
| 57 | +var buscarEm = ["LAYER","LAYERS","layer","layers","tema","typename","typeName"], | |
| 58 | + n = buscarEm.length, | |
| 59 | + i,s,partes, | |
| 60 | + b = [], | |
| 61 | + codLayer = "", | |
| 62 | + u = window.location.href; | |
| 63 | + | |
| 64 | +//acrescenta novas strings | |
| 65 | +for(i = 0; i < n; i++){ | |
| 66 | + b.push("&" + buscarEm[i] + "="); | |
| 67 | + b.push("?" + buscarEm[i] + "="); | |
| 68 | +} | |
| 69 | +n = b.length; | |
| 70 | +//quebra as strings pra achar o padrao | |
| 71 | +for(i = 0; i < n; i++){ | |
| 72 | + s = b[i]; | |
| 73 | + partes = u.split(s); | |
| 74 | + if(partes.length > 1){ | |
| 75 | + partes = partes[1].split("&"); | |
| 76 | + codLayer = partes[0]; | |
| 77 | + } | |
| 78 | +} | |
| 79 | +g_locaplic = "../.."; | |
| 80 | +//console.info(codLayer) | |
| 81 | +clickGuia3(codLayer); | |
| 82 | +</script> | |
| 83 | +</body> | |
| 84 | +</html> | ... | ... |
pacotes/yui290/build/container/container_compacto.js
100644 → 100755
pacotes/yui290/build/container/container_core_compacto.js
100644 → 100755
pacotes/yui290/build/utilities/utilities_compacto.js
100644 → 100755