set_data(""); // //verifica se o usuário está tentando utilizar um link que não funciona mais // if (!isset($map_file)) { //nesse caso é necessário criar o diretório temporário e iniciar o mapa //$cp->set_data("linkquebrado"); //$cp->return_data(); cpjson(array("erro"=>"linkquebrado")); exit; } include_once("classe_vermultilayer.php"); if ($map_file != "") { // //copia o map_file atual com outro nome para restaurar caso ocorra algum problema // copiaSeguranca($map_file); // //substitui a string de conexão // substituiCon($map_file,$postgis_mapa); } if($atlasxml == "") { include($locaplic."/admin/php/xml.php"); $xml = simplexml_load_string(geraXmlAtlas($locaplic,$editores)); } else $xml = simplexml_load_file($atlasxml); // //faz a busca da função que deve ser executada // switch (strtoupper($funcao)) { /* Valor: PEGALISTADEATLAS Pega a lista de Atlas definida no arquivo xml menutemas/atlas.xml. */ case "PEGALISTADEATLAS": include_once("classe_atlas.php"); $atl = new Atlas($xml,$atlasxml); $retorno = $atl->pegaListaDeAtlas($tituloInstituicao); break; /* Valor: CRIAATLAS Abre um Atlas específico, criando o mapa e chamando a interface desejada. Esse programa é chamado diretamente, por exemplo, i3geo/classesphp/atlas_controle.php?atlasxml=&atlasId= */ case "CRIAATLAS": include_once("classe_atlas.php"); $atlasxmltemp = $atlasxml; $atl = new Atlas($xml,$atlasxml); $res = $atl->criaAtlas($atlasId_); $interface = $res["interface"]; $base = $res["base"]; if ($interface == "") { echo "Erro. Nenhuma interface definida para esse Atlas"; exit; } if (!isset($caminho)) {$caminho = "../";} // // a função gravaId será executada no final do processo de geração do mapa (ver ms_criamapa.php) // $executa = "gravaId"; $temasa = ""; include_once("../ms_criamapa.php"); exit; break; /* Valor: PEGALISTADEPRANCHAS Pega a lista de pranchas de um atlas específico. */ case "PEGALISTADEPRANCHAS": include_once("classe_atlas.php"); $atl = new Atlas($xml,$atlasxml); $retorno = $atl->pegaListaDePranchas($atlasId); break; /* Valor: ABREPRANCHA Ativa uma prancha do atlas. */ case "ABREPRANCHA": include_once("classe_atlas.php"); $atl = new Atlas($xml,$atlasxml); $retorno = $atl->abrePrancha($atlasId,$pranchaId,$map_file,$locaplic); break; } if (!connection_aborted()) { if ($map_file != "") { restauraCon($map_file,$postgis_mapa); } cpjson($retorno); } else {exit();} function gravaid() { global $atlasId_,$tmpfname,$atlasxmltemp;//a variavel tmpfname vem do ms_criamapa.php $_SESSION["atlasId"] = $atlasId_; $_SESSION["utilizacgi"] = "nao"; $_SESSION["atlasxml"] = $atlasxmltemp; $m = ms_newMapObj($tmpfname); $c = $m->numlayers; for ($i=0;$i < $c;++$i) { $l = $m->getlayer($i); $l->setmetadata("ATLAS","nao"); $l->setmetadata("TIP",""); } $m->save($tmpfname); } ?>