Beispiel #1
0
     Adiciona um novo tema ao mapa.
     
     <Mapa->adicionaTema>
     */
 /*
  Valor: ADTEMA
 
 Adiciona um novo tema ao mapa.
 
 <Mapa->adicionaTema>
 */
 case "ADTEMA":
     include_once "classe_mapa.php";
     copiaSeguranca($map_file);
     $m = new Mapa($map_file);
     $salvar = $m->adicionaTema($_pg["temas"], $locaplic);
     if ($salvar) {
         $m->salva();
         $_SESSION["contadorsalva"]++;
     }
     validaAcessoTemas($map_file);
     $retorno = "ok";
     /*
      if($interface != "openlayers"){
     $teste = testaMapa($map_file,$postgis_mapa);
     if ($teste == "ok")
     {$retorno = "ok";$_SESSION["contadorsalva"]++;}
     else
     {$retorno = array("erro"=>"A camada nao pode ser adicionada. ".$teste);}
     }
     */
Beispiel #2
0
 function abrePrancha($atlasId, $pranchaId, $map_file, $locaplic)
 {
     $p = array();
     $temasa = array();
     $layers = array();
     $mapa = ms_newMapObj($map_file);
     $numlayers = $mapa->numlayers;
     for ($i = 0; $i < $numlayers; ++$i) {
         $l = $mapa->getlayer($i);
         if ($l->getmetadata("ATLAS") != "nao") {
             $l->set("status", MS_DELETE);
         }
     }
     $mapa->save(str_replace(".map", "", $map_file) . ".map");
     $mp = "";
     foreach ($this->xml->ATLAS as $s) {
         $ida = ixml($s, "ID");
         if ($ida == $atlasId) {
             foreach ($s->PRANCHAS as $pranchas) {
                 foreach ($pranchas->PRANCHA as $prancha) {
                     if ($pranchaId == ixml($prancha, "ID")) {
                         $link = ixml($prancha, "LINKMAISINFO");
                         $w = ixml($prancha, "WABERTURA");
                         $h = ixml($prancha, "HABERTURA");
                         $mp = ixml($prancha, "MAPEXT");
                         //pega os temas
                         foreach ($prancha->TEMAS as $temas) {
                             foreach ($temas->TEMA as $tema) {
                                 $codigo = ixml($tema, "CODIGO");
                                 $ligado = ixml($tema, "LIGADO");
                                 if ($codigo != "") {
                                     $temasa[] = $codigo;
                                     if (strtolower($ligado) == "sim") {
                                         $layers[] = $codigo;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if (count($temasa) > 0) {
         include_once "classe_mapa.php";
         $mapa = "";
         $m = new Mapa($map_file);
         $m->adicionaTema(implode(",", $temasa), $locaplic, "nao");
         $m->salva();
         $mapa = ms_newMapObj($map_file);
         $numlayers = $mapa->numlayers;
         for ($i = 0; $i < $numlayers; ++$i) {
             $l = $mapa->getlayer($i);
             if ($l->getmetadata("ATLAS") != "nao") {
                 $l->set("status", MS_OFF);
             }
         }
         foreach ($layers as $t) {
             $layer = $mapa->getlayerbyname($t);
             $layer->set("status", MS_DEFAULT);
         }
         $mapa->save(str_replace(".map", "", $map_file) . ".map");
     }
     //verifica extens&atilde;o geogr&aacute;fica
     $newext = array();
     if ($mp != "") {
         $ext = $mapa->extent;
         $newext = array();
         $temp = explode(",", $mp);
         foreach ($temp as $t) {
             if ($t != "") {
                 $newext[] = $t;
             }
         }
         if (count($newext) == 4) {
             $ext->setextent($newext[0], $newext[1], $newext[2], $newext[3]);
         }
         $mapa->save(str_replace(".map", "", $map_file) . ".map");
     }
     if (!function_exists("sobeAnno")) {
         include_once "funcoes_gerais.php";
     }
     sobeAnno($map_file);
     if ($w == "") {
         $w = 300;
     }
     if ($h == "") {
         $h = 300;
     }
     return array("link" => $link, "w" => $w, "h" => $h, "mapexten" => implode(" ", $newext));
 }