function ligaDesligaTemas($ligar, $desligar, $adicionar = "nao") { if (strTolower($adicionar) == "sim") { $teste = explode(",", $ligar); $adicionar = array(); $verificar = array(); foreach ($this->layers as $layerE) { $verificar[] = $layerE->getmetadata("nomeoriginal"); $verificar[] = $layerE->name; } foreach ($teste as $t) { if (!in_array($t, $verificar)) { $adicionar[] = $t; } } if (count($adicionar > 0)) { $this->adicionaTema(implode(",", $adicionar), $this->locaplic, $random = "sim"); $this->salva(); $this->mapa = ms_newMapObj($this->arquivo); $c = $this->mapa->numlayers; for ($i = 0; $i < $c; ++$i) { $this->layers[] = $this->mapa->getlayer($i); } } } if ($desligar == "todos") { $desligar = $this->mapa->getalllayernames(); $desligar = implode(",", $desligar); } if ($ligar != "") { $listal = explode(",", $ligar); foreach ($listal as $layer) { $ls = array(); $vermultilayer = new vermultilayer(); $vermultilayer->verifica($this->arquivo, $layer); if ($vermultilayer->resultado == 1) { $ls = $vermultilayer->temas; } $ls[] = $layer; foreach ($ls as $l) { $l = $this->mapa->getlayerbyname($l); if ($l) { $l->set("status", 2); } } } } if ($desligar != "") { $listad = explode(",", $desligar); foreach ($listad as $layer) { $ls = array(); $vermultilayer = new vermultilayer(); $vermultilayer->verifica($this->arquivo, $layer); if ($vermultilayer->resultado == 1) { $ls = $vermultilayer->temas; } else { $ls[] = $layer; } foreach ($ls as $l) { $l = $this->mapa->getlayerbyname($l); if ($l) { $l->set("status", 0); } } } } return "ok"; }
function __construct($map_file = "", $locaplic = "", $tema = "", $template = "") { include dirname(__FILE__) . "/../ms_configura.php"; $this->postgis_mapa = $postgis_mapa; include_once dirname(__FILE__) . "/funcoes_gerais.php"; $this->v = versao(); $this->v = $this->v["principal"]; $this->localaplicacao = $locaplic; if ($map_file == "") { return; } $this->mapa = ms_newMapObj($map_file); substituiConObj($this->mapa, $postgis_mapa); $this->arquivo = str_replace(".map", "", $map_file) . ".map"; if ($tema != "" && @$this->mapa->getlayerbyname($tema)) { $this->layer = $this->mapa->getlayerbyname($tema); $this->nome = $tema; $vermultilayer = new vermultilayer(); $vermultilayer->verifica($map_file, $tema); if ($vermultilayer->resultado == 1) { $ls = $vermultilayer->temas; $this->visiveis = $vermultilayer->temasvisiveis; } else { $ls[] = $tema; $this->visiveis = array($tema); } $this->grupo = $ls; foreach ($ls as $l) { $t = $this->mapa->getlayerbyname($l); $this->indices[] = $t->index; } } if ($template == "") { $template = "legenda.htm"; } if (file_exists($template)) { $this->templateleg = $template; return; } if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) { $this->templateleg = $locaplic . "\\aplicmap\\" . $template; } else { $this->templateleg = $locaplic . "/aplicmap/" . $template; } }
function __construct($map_file, $tema = null, $locaplic = "", $ext = "") { //error_reporting(0); include dirname(__FILE__) . "/../ms_configura.php"; $this->postgis_mapa = $postgis_mapa; if ($map_file != "") { $map_file = str_replace(".map", "", $map_file) . ".map"; $this->qyfile = str_replace(".map", ".qy", $map_file); $this->arquivo = $map_file; } if (file_exists($locaplic . "/funcoes_gerais.php")) { include_once $locaplic . "/funcoes_gerais.php"; } else { include_once "funcoes_gerais.php"; } $this->tema = $tema; $this->v = versao(); $this->vi = $this->v["inteiro"]; $this->v = $this->v["principal"]; $this->locaplic = $locaplic; if ($map_file != "" && file_exists($map_file)) { $this->mapa = ms_newMapObj($map_file); substituiConObj($this->mapa, $postgis_mapa); $this->arquivo = $map_file; if ($tema != "") { $listaTemas = str_replace(" ", ",", $tema); $listaTemas = explode(",", $tema); foreach ($listaTemas as $tema) { $this->layer = $this->mapa->getlayerbyname($tema); $this->nome = $tema; $vermultilayer = new vermultilayer(); $vermultilayer->verifica($map_file, $tema); if ($vermultilayer->resultado == 1) { $ls = $vermultilayer->temas; } else { $ls[] = $tema; } $this->grupo = $ls; $this->visiveis = $vermultilayer->temasvisiveis; foreach ($ls as $l) { $t = $this->mapa->getlayerbyname($l); $this->indices[] = $t->index; } } } if ($ext && $ext != "") { $e = explode(" ", $ext); $extatual = $this->mapa->extent; $extatual->setextent(min($e[0], $e[2]), min($e[1], $e[3]), max($e[0], $e[2]), max($e[1], $e[3])); } } }
function identifica3($opcao, $xy, $resolucao, $ext = "", $listaDeTemas = "", $wkt = "nao") { if ($opcao != "tema" && $opcao != "tip") { if ($listaDeTemas != "") { $listaDeTemas = str_replace(" ", ",", $listaDeTemas); $temas = explode(",", $listaDeTemas); } else { $temas = $this->mapa->getalllayernames(); } foreach ($temas as $tem) { $vermultilayer = new vermultilayer(); $vermultilayer->verifica($this->arquivo, $tem); if ($vermultilayer->resultado == 1) { foreach ($vermultilayer->temasvisiveis as $tv) { $l = $this->mapa->getlayerbyname($tv); if ($l->getmetadata("identifica") != "nao") { $listatemas[] = $tv; } } } else { $l = $this->mapa->getlayerbyname($tem); if ($l->getmetadata("escondido") == "" && $l->getmetadata("identifica") != "nao") { $listatemas[] = $tem; } } } $listatemas = array_unique($listatemas); } $xyarray = explode(",", $xy); $resultados = array(); //pesquisa um tema if ($opcao == "tema") { $listatemas = array(); $vermultilayer = new vermultilayer(); $vermultilayer->verifica($this->arquivo, $this->nome); // o tema e multi layer if ($vermultilayer->resultado == 1) { $listatemp = $vermultilayer->temasvisiveis; } else { $listatemp[] = $this->nome; } foreach ($listatemp as $t) { $layerteste = $this->mapa->getlayerbyname($t); $mclasse = strtoupper($layerteste->getmetadata("CLASSE")); $mtema = strtoupper($layerteste->getmetadata("TEMA")); $gr = $layerteste->group; if (!($mclasse == "NAO" && $mtema == "NAO") || $gr != "") { if ($layerteste->data != "" && $layerteste->connectiontype != MS_WMS || $layerteste->tileindex != "") { $listatemas[] = $t; } if ($layerteste->connectiontype == MS_OGR) { $listatemas[] = $t; } } } $layerteste = $this->layer; if ($layerteste->connectiontype == MS_WMS) { $listatemas = array(); $listatemas[] = $this->nome; } foreach ($listatemas as $tema) { $resultados[$tema] = $this->identificaQBP3($tema, $xyarray[0], $xyarray[1], "", $resolucao, "", "", false, $ext, $wkt); } } //pesquisa todos os temas acrescentados no mapa if ($opcao == "todos") { foreach ($listatemas as $tema) { $resultados[$tema] = $this->identificaQBP3($tema, $xyarray[0], $xyarray[1], "", $resolucao, "", "", false, $ext, $wkt); } } //pesquisa apenas os temas visiveis if ($opcao == "ligados" || $opcao == "lista") { if ($opcao == "ligados") { $novalista = array(); foreach ($listatemas as $tema) { $l = $this->mapa->getlayerbyname($tema); if ($l->status == MS_DEFAULT) { $novalista[] = $tema; } $listatemas = $novalista; } } foreach ($listatemas as $tema) { $l = $this->mapa->getlayerbyname($tema); $resultados[$tema] = $this->identificaQBP3($tema, $xyarray[0], $xyarray[1], "", $resolucao, "", "", false, $ext, $wkt); } //var_dump($resultados); } //pesquisa apenas os temas com tip if ($opcao == "tip") { $ltemp = array(); $numlayers = $this->mapa->numlayers; for ($i = 0; $i < $numlayers; ++$i) { $tl = $this->mapa->getlayer($i); $tema = $tl->name; $itemtip = $tl->getmetadata("TIP"); if ($itemtip != "") { if ($tl->status == MS_DEFAULT || $listaDeTemas != "") { $r = $this->identificaQBP3($tema, $xyarray[0], $xyarray[1], "", $resolucao, $itemtip, "", true, $ext, $wkt); $resultados[$tema] = array("todosItens" => $r["itensLayer"], "tips" => $itemtip, "dados" => $r["resultado"]); $ltemp[] = $tema; } } } $listatemas = $ltemp; } if (count($resultados) > 0) { $res = $this->retornaI2($listatemas, $resultados, $this->mapa); return $res; } else { return ""; } }