diff --git a/admin/admin.db b/admin/admin.db index 2993308..ad15bbb 100644 Binary files a/admin/admin.db and b/admin/admin.db differ diff --git a/classesjs/classe_analise.js b/classesjs/classe_analise.js index 87f7137..973ef1b 100644 --- a/classesjs/classe_analise.js +++ b/classesjs/classe_analise.js @@ -908,7 +908,7 @@ i3GEO.analise = { y1 = i3GEO.analise.medeArea.pontos.ypt[0]; //projeta if(i3GEO.Interface.openlayers.googleLike){ - temp = i3GEO.util.extOSM2Geo(x1+" "+y1+" "+x2+" "+y2); + temp = i3GEO.util.extOSM2Geo(x1+" "+y1); temp = temp.split(" "); x1 = temp[0]; y1 = temp[1]; @@ -951,7 +951,7 @@ i3GEO.analise = { y1 = i3GEO.analise.medeArea.pontos.ypt[0]; //projeta if(i3GEO.Interface.openlayers.googleLike){ - temp = i3GEO.util.extOSM2Geo(x1+" "+y1+" "+x2+" "+y2); + temp = i3GEO.util.extOSM2Geo(x1+" "+y1); temp = temp.split(" "); x1 = temp[0]; y1 = temp[1]; diff --git a/classesjs/classe_util.js b/classesjs/classe_util.js index 9875a3b..07b420a 100644 --- a/classesjs/classe_util.js +++ b/classesjs/classe_util.js @@ -2921,7 +2921,7 @@ i3GEO.util = { /* Function: extGeo2OSM - Converte string xmin ymin xmax ymax de geo para a projecao OSM + Converte string 'xmin ymin xmax ymax' ou 'xmin ymin' de geo para a projecao OSM */ extGeo2OSM: function(ext){ if(i3GEO.Interface.openlayers.googleLike === true){ @@ -2932,9 +2932,11 @@ i3GEO.util = { point = new OpenLayers.LonLat(temp[0], temp[1]); metrica = point.transform(projWGS84,proj900913); ext = metrica.lon+" "+metrica.lat; - point = new OpenLayers.LonLat(temp[2], temp[3]); - metrica = point.transform(projWGS84,proj900913); - ext += " "+metrica.lon+" "+metrica.lat; + if(temp.length > 2){ + point = new OpenLayers.LonLat(temp[2], temp[3]); + metrica = point.transform(projWGS84,proj900913); + ext += " "+metrica.lon+" "+metrica.lat; + } } } return ext; @@ -2942,7 +2944,7 @@ i3GEO.util = { /* Function: extOSM2Geo - Converte string xmin ymin xmax ymax de geo para a projecao OSM + Converte string 'xmin ymin xmax ymax' ou 'xmin ymin' de geo para a projecao OSM */ extOSM2Geo: function(ext){ if(i3GEO.Interface.openlayers.googleLike === true){ @@ -2953,9 +2955,11 @@ i3GEO.util = { point = new OpenLayers.LonLat(temp[0], temp[1]); metrica = point.transform(proj900913,projWGS84); ext = metrica.lon+" "+metrica.lat; - point = new OpenLayers.LonLat(temp[2], temp[3]); - metrica = point.transform(proj900913,projWGS84); - ext += " "+metrica.lon+" "+metrica.lat; + if(temp.length > 2){ + point = new OpenLayers.LonLat(temp[2], temp[3]); + metrica = point.transform(proj900913,projWGS84); + ext += " "+metrica.lon+" "+metrica.lat; + } } } return ext; diff --git a/classesphp/mapa_openlayers.php b/classesphp/mapa_openlayers.php index 94fa51c..f72bcc0 100644 --- a/classesphp/mapa_openlayers.php +++ b/classesphp/mapa_openlayers.php @@ -13,7 +13,7 @@ Precisa do codigo da "section" PHP aberta pelo i3Geo (veja ms_criamapa.php) ou o Parametros: -g_sid {string} - c�digo da "section" PHP +g_sid {string} - codigo da "section" PHP telaR {string} - (opcional) utilizado para autorizar o uso do mapfile aberto (deve estar registrado em $fingerprint (variável de seção) @@ -49,7 +49,7 @@ Este programa é distribuído na expectativa de que seja útil porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral do GNU para mais detalhes. -Você deve ter recebido uma c�pia da Licença Pública Geral do +Você deve ter recebido uma copia da Licença Pública Geral do GNU junto com este programa; se não, escreva para a Free Software Foundation, Inc., no endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. @@ -60,12 +60,8 @@ i3geo/classesphp/mapa_openlayers.php */ error_reporting(0); -//para efeitos de compatibilidade -if (!function_exists('ms_GetVersion')){ - include_once ("carrega_ext.php"); -} -//carrega dados da seção, verifica segurança inicializa(); + // //calcula a extensao geografica com base no x,y,z //nos casos do modo notile, a requisicao e feita como se fosse um wms @@ -104,6 +100,7 @@ if($_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getf if($qy == false && $_GET["cache"] == "sim" && $_GET["DESLIGACACHE"] != "sim"){ carregaCacheImagem($_SESSION["cachedir"],$_SESSION["map_file"],$_GET["tms"],$_SESSION["i3georendermode"]); } + // //map_fileX e para o caso register_globals = On no PHP.INI @@ -138,6 +135,13 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao e alter {include_once("funcoes_gerais.php");} autoClasses($l,$mapa); } + // + //numero de pixels que serao considerados para corte da imagem no caso de cache ativo e tema de pontos + // + $cortePixels = 0; + if ($l->getmetadata("cortepixels") != ""){ + $cortePixels = $l->getmetadata("cortepixels"); + } $l->set("status",MS_DEFAULT); $l->set("template","none.htm"); if (!empty($postgis_mapa)){ @@ -177,20 +181,23 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao e alter } } -if (!function_exists('imagepng')) -{$_GET["TIPOIMAGEM"] = "";} +if (!function_exists('imagepng')){ + $_GET["TIPOIMAGEM"] = ""; +} -if($_GET["layer"] == "") -{$cache = true;} +if($_GET["layer"] == ""){ + $cache = true; +} if(($_GET == false) || ($qy) || (strtolower($_GET["DESLIGACACHE"]) == "sim")){ $cache = false; } -elseif($_GET["TIPOIMAGEM"] != "" && $_GET["TIPOIMAGEM"] != "nenhum") -{$cache = false;} +elseif($_GET["TIPOIMAGEM"] != "" && $_GET["TIPOIMAGEM"] != "nenhum"){ + $cache = false; +} if($cache == true && $_GET["cache"] != "nao"){ - carregaCacheImagem($cachedir,$map,$_GET["tms"]); + carregaCacheImagem($cachedir,$_SESSION["map_file"],$_GET["tms"]); } if(isset($_GET["map_size"])){ $map_size = explode(" ",$_GET["map_size"]); @@ -238,8 +245,27 @@ if(!isset($_GET["telaR"])){ // if($_GET["tipolayer"] != "fundo") {$o->set("transparent",MS_TRUE);} -if($qy != true) -{$img = $mapa->draw();} + +// +//se o layer foi marcado para corte altera os parametros para ampliar o mapa +//antes de gerar a imagem +// +if($cortePixels > 0){ + //$imagemBranco = $mapa->prepareImage(); + $escalaInicial = $mapa->scaledenom; + $extensaoInicial = $mapa->extent; + $wh = 256+($cortePixels*2); + $mapa->setsize($wh,$wh); + $ponto = new pointObj(); + $ponto->setxy(($wh/2),($wh/2)); + $mapa->zoomScale($escalaInicial, $ponto, $wh, $wh, $extensaoInicial); +} + + +//se nao houver selecao +if($qy != true){ + $img = $mapa->draw(); +} else{ $handle = fopen ($qyfile, "r"); $conteudo = fread ($handle, filesize ($qyfile)); @@ -285,7 +311,6 @@ else{ } $cache = false; } - //nao usa o cache pois e necessario processar a imagem com alguma rotina de filtro if($_GET["TIPOIMAGEM"] != "" && $_GET["TIPOIMAGEM"] != "nenhum"){ if($img->imagepath == "") @@ -294,6 +319,14 @@ if($_GET["TIPOIMAGEM"] != "" && $_GET["TIPOIMAGEM"] != "nenhum"){ $img->saveImage($nomer); filtraImg($nomer,$_GET["TIPOIMAGEM"]); $img = imagecreatefrompng($nomer); + // + //corta a imagem gerada para voltar ao tamanho normal + // + if($cortePixels > 0){ + $imgc = imagecreate(256,256); + imagecopy( $imgc, $img, 0 , 0 , $cortePixels , $cortePixels , 255, 255 ); + $img = $imgc; + } imagealphablending($img, false); imagesavealpha($img, true); ob_clean(); @@ -356,7 +389,7 @@ else{ } } function salvaCacheImagem($cachedir,$map,$tms){ - global $img; + global $img,$cortePixels,$cortePixels; if($cachedir == ""){ $nome = dirname(dirname($map))."/cache".$tms; } @@ -365,8 +398,17 @@ function salvaCacheImagem($cachedir,$map,$tms){ } if(!file_exists($nome)){ @mkdir(dirname($nome),0777,true); - chmod(dirname($nome),0777); - $img->saveImage($nome); + chmod(dirname($nome),0777); + $img->saveImage($nome); + // + //corta a imagem gerada para voltar ao tamanho normal + // + if($cortePixels > 0){ + $img = imagecreatefrompng($nome); + $imgc = imagecreate(256,256); + imagecopy( $imgc, $img, 0 , 0 , $cortePixels , $cortePixels , 256, 256 ); + imagepng($imgc,$nome); + } chmod($nome,0777); } return $nome; @@ -448,10 +490,12 @@ function inicializa(){ if (md5('I3GEOSEC' . $_SERVER['HTTP_USER_AGENT'] . session_id()) != $f[0] && !in_array($_GET["telaR"],$f) ) {ilegal();} } - else - {exit;} - if(!isset($_SESSION["map_file"])) - {exit;} + else{ + exit; + } + if(!isset($_SESSION["map_file"])){ + exit; + } } function ilegal(){ $img = imagecreatefrompng("../imagens/ilegal.png"); diff --git a/temas/_llocali.map b/temas/_llocali.map index 1075e90..330ee2b 100644 --- a/temas/_llocali.map +++ b/temas/_llocali.map @@ -6,7 +6,8 @@ MAP DATA "/var/www/i3geo/aplicmap/dados/locali.shp" METADATA "METAESTAT_ID_MEDIDA_VARIAVEL" "" - "cache" "NAO" + "cache" "SIM" + #"cortepixels" "50" "LTEMPOITEMIMAGEM" "" "TIP" "TIPO,ANOCRIA,NOMELOC" "LTEMPOITEMDESCRICAO" "TIPO" -- libgit2 0.21.2