From 86d7705fe53a198467cd4e71f8e428a644ba74b2 Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Thu, 11 Nov 2010 18:10:56 +0000 Subject: [PATCH] Resolvido o problema do destaque dos elementos selecionados nas versões novas do Mapserver --- classesphp/classe_mapa.php | 11 ++++++++--- classesphp/classe_selecao.php | 16 ++++++++++------ classesphp/mapa_googleearth.php | 19 ++++++++++++++++++- classesphp/mapa_googlemaps.php | 21 +++++++++++++++++++-- classesphp/mapa_openlayers.php | 20 +++++++++++++++++++- ferramentas/convertekml/index.js.php | 2 +- index.html | 2 +- 7 files changed, 76 insertions(+), 15 deletions(-) diff --git a/classesphp/classe_mapa.php b/classesphp/classe_mapa.php index 8811a51..6de309c 100644 --- a/classesphp/classe_mapa.php +++ b/classesphp/classe_mapa.php @@ -166,15 +166,19 @@ string - javascript com os parametros function parametrosTemas() { $existesel = false; - $qy = file_exists($this->qyfile); + $dir = dirname($this->arquivo); + //$qy = file_exists($this->qyfile); foreach($this->layers as $l) {$l->set("template","none.htm");} - if ($qy) - {$this->mapa->loadquery($this->qyfile);} + //if ($qy) + //{$this->mapa->loadquery($this->qyfile);} foreach ($this->layers as $oLayer) { $sel = "nao"; + if(file_exists($dir."/".$oLayer->name.".php")) + {$sel = "sim";$existesel = true;} + /* if ($qy) //verifica se existe alguma selecao no tema { $sopen = $oLayer->open(); @@ -185,6 +189,7 @@ string - javascript com os parametros if ($res_count > 0){$sel = "sim";$existesel = true;} } } + */ $escondido = $oLayer->getmetadata("escondido"); if($escondido == "") {$escondido = "nao";} diff --git a/classesphp/classe_selecao.php b/classesphp/classe_selecao.php index 4e8a8b7..bb8e895 100644 --- a/classesphp/classe_selecao.php +++ b/classesphp/classe_selecao.php @@ -586,16 +586,19 @@ Limpa a seleção do tema. */ function selecaoLimpa() { + //apaga o arquivo do i3geo com os ids selecionados if(file_exists($this->qyfileTema)) {unlink($this->qyfileTema);} if ($this->nome != "") //limpa de um tema { if(!$this->layer){return "erro";} if (file_exists($this->qyfile)) - {$this->mapa->loadquery($this->qyfile);} - $indxlayer = $this->layer->index; - $this->mapa->freequery($indxlayer); - $this->mapa->savequery($this->qyfile); + { + $this->mapa->loadquery($this->qyfile); + $indxlayer = $this->layer->index; + $this->mapa->freequery($indxlayer); + $this->mapa->savequery($this->qyfile); + } } else //limpa de todos os temas { @@ -668,6 +671,7 @@ $shp_atual - Indices dos elementos já selecionados. $this->mapa->freequery($indxlayer); foreach ($shp as $indx) {@$this->mapa->querybyindex($indxlayer,-1,$indx,MS_TRUE);} + //echo $this->layer->getNumresults(); $this->mapa->savequery($this->qyfile); $this->serializeQ($this->qyfileTema,$shp); return("ok"); @@ -865,7 +869,7 @@ $ext - coordenadas separadas por espaços no estilo xmin ymin xmax ymax /* function unserializeQ -Deserializa um arquivo de geometrias. +Deserializa um arquivo. Parametros: $arquivo - arquivo que será processado @@ -880,7 +884,7 @@ $arquivo - arquivo que será processado /* function serializeQ -Deserializa um arquivo de geometrias. +Serializa um arquivo. Parametros: $arquivo - arquivo que será processado diff --git a/classesphp/mapa_googleearth.php b/classesphp/mapa_googleearth.php index 3a9bf92..aaecebc 100644 --- a/classesphp/mapa_googleearth.php +++ b/classesphp/mapa_googleearth.php @@ -93,11 +93,28 @@ function retornaWms(){ } $mapa = ms_newMapObj($_GET["map"]); $mapa->setProjection("init=epsg:4326"); + /* $qyfile = str_replace(".map",".qy",$_GET["map"]); $qy = file_exists($qyfile); if($qy) {$mapa->loadquery($qyfile);} - + */ + // + //resolve o problema da seleção na versão nova do mapserver + // + $qyfile = dirname($_GET["map"])."/".$_GET["layer"].".php"; + $qy = file_exists($qyfile); + if($qy) + { + $l = $mapa->getLayerByname($_GET["layer"]); + $indxlayer = $l->index; + $handle = fopen ($qyfile, "r"); + $conteudo = fread ($handle, filesize ($qyfile)); + fclose ($handle); + $shp = unserialize($conteudo); + foreach ($shp as $indx) + {$mapa->querybyindex($indxlayer,-1,$indx,MS_TRUE);} + } $layersNames = $mapa->getalllayernames(); foreach ($layersNames as $layerName) { diff --git a/classesphp/mapa_googlemaps.php b/classesphp/mapa_googlemaps.php index 1fd795e..7e6fa17 100644 --- a/classesphp/mapa_googlemaps.php +++ b/classesphp/mapa_googlemaps.php @@ -11,7 +11,7 @@ Licenca: GPL2 -I3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil Desenvolvedor: Edmar Moretti edmar.moretti@mma.gov.br @@ -76,11 +76,28 @@ $_GET["WIDTH"] = "256"; $_GET["HEIGHT"] = "256"; $mapa = ms_newMapObj($_GET["map"]); +/* $qyfile = str_replace(".map",".qy",$_GET["map"]); $qy = file_exists($qyfile); if($qy) {$mapa->loadquery($qyfile);} - +*/ +// +//resolve o problema da seleção na versão nova do mapserver +// +$qyfile = dirname($_GET["map"])."/".$_GET["layer"].".php"; +$qy = file_exists($qyfile); +if($qy) +{ + $l = $mapa->getLayerByname($_GET["layer"]); + $indxlayer = $l->index; + $handle = fopen ($qyfile, "r"); + $conteudo = fread ($handle, filesize ($qyfile)); + fclose ($handle); + $shp = unserialize($conteudo); + foreach ($shp as $indx) + {$mapa->querybyindex($indxlayer,-1,$indx,MS_TRUE);} +} $layersNames = $mapa->getalllayernames(); $cache = false; foreach ($layersNames as $layerName) diff --git a/classesphp/mapa_openlayers.php b/classesphp/mapa_openlayers.php index 85d3835..db6951a 100644 --- a/classesphp/mapa_openlayers.php +++ b/classesphp/mapa_openlayers.php @@ -12,7 +12,7 @@ Licenca: GPL2 -I3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil Desenvolvedor: Edmar Moretti edmar.moretti@mma.gov.br @@ -50,10 +50,28 @@ if(isset($_GET["BBOX"])) $_GET["map_size"] = $_GET["WIDTH"]." ".$_GET["HEIGHT"]; } $mapa = ms_newMapObj($_GET["map"]); +/* $qyfile = str_replace(".map",".qy",$_GET["map"]); $qy = file_exists($qyfile); if($qy) {$mapa->loadquery($qyfile);} +*/ +// +//resolve o problema da seleção na versão nova do mapserver +// +$qyfile = dirname($_GET["map"])."/".$_GET["layer"].".php"; +$qy = file_exists($qyfile); +if($qy) +{ + $l = $mapa->getLayerByname($_GET["layer"]); + $indxlayer = $l->index; + $handle = fopen ($qyfile, "r"); + $conteudo = fread ($handle, filesize ($qyfile)); + fclose ($handle); + $shp = unserialize($conteudo); + foreach ($shp as $indx) + {$mapa->querybyindex($indxlayer,-1,$indx,MS_TRUE);} +} $layersNames = $mapa->getalllayernames(); $cache = false; diff --git a/ferramentas/convertekml/index.js.php b/ferramentas/convertekml/index.js.php index 6b508d6..44e6d3b 100644 --- a/ferramentas/convertekml/index.js.php +++ b/ferramentas/convertekml/index.js.php @@ -18,7 +18,7 @@ Licenca: GPL2 -I3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil Desenvolvedor: Edmar Moretti edmar.moretti@mma.gov.br diff --git a/index.html b/index.html index a6cad8c..3e65daf 100644 --- a/index.html +++ b/index.html @@ -13,7 +13,7 @@

- +
logomarca
i3Geo
-- libgit2 0.21.2