Commit 53b87b7bd3435990942c534cb7c5b0a9abbc21be

Authored by Edmar Moretti
1 parent b5bacf3c

V 6 - remoção da biblioteca Richdraw dos códigos JS

admin/admin.db
No preview for this file type
classesjs/classe_analise.js
... ... @@ -908,7 +908,7 @@ i3GEO.analise = {
908 908 y1 = i3GEO.analise.medeArea.pontos.ypt[0];
909 909 //projeta
910 910 if(i3GEO.Interface.openlayers.googleLike){
911   - temp = i3GEO.util.extOSM2Geo(x1+" "+y1+" "+x2+" "+y2);
  911 + temp = i3GEO.util.extOSM2Geo(x1+" "+y1);
912 912 temp = temp.split(" ");
913 913 x1 = temp[0];
914 914 y1 = temp[1];
... ... @@ -951,7 +951,7 @@ i3GEO.analise = {
951 951 y1 = i3GEO.analise.medeArea.pontos.ypt[0];
952 952 //projeta
953 953 if(i3GEO.Interface.openlayers.googleLike){
954   - temp = i3GEO.util.extOSM2Geo(x1+" "+y1+" "+x2+" "+y2);
  954 + temp = i3GEO.util.extOSM2Geo(x1+" "+y1);
955 955 temp = temp.split(" ");
956 956 x1 = temp[0];
957 957 y1 = temp[1];
... ...
classesjs/classe_util.js
... ... @@ -2921,7 +2921,7 @@ i3GEO.util = {
2921 2921 /*
2922 2922 Function: extGeo2OSM
2923 2923  
2924   - Converte string xmin ymin xmax ymax de geo para a projecao OSM
  2924 + Converte string 'xmin ymin xmax ymax' ou 'xmin ymin' de geo para a projecao OSM
2925 2925 */
2926 2926 extGeo2OSM: function(ext){
2927 2927 if(i3GEO.Interface.openlayers.googleLike === true){
... ... @@ -2932,9 +2932,11 @@ i3GEO.util = {
2932 2932 point = new OpenLayers.LonLat(temp[0], temp[1]);
2933 2933 metrica = point.transform(projWGS84,proj900913);
2934 2934 ext = metrica.lon+" "+metrica.lat;
2935   - point = new OpenLayers.LonLat(temp[2], temp[3]);
2936   - metrica = point.transform(projWGS84,proj900913);
2937   - ext += " "+metrica.lon+" "+metrica.lat;
  2935 + if(temp.length > 2){
  2936 + point = new OpenLayers.LonLat(temp[2], temp[3]);
  2937 + metrica = point.transform(projWGS84,proj900913);
  2938 + ext += " "+metrica.lon+" "+metrica.lat;
  2939 + }
2938 2940 }
2939 2941 }
2940 2942 return ext;
... ... @@ -2942,7 +2944,7 @@ i3GEO.util = {
2942 2944 /*
2943 2945 Function: extOSM2Geo
2944 2946  
2945   - Converte string xmin ymin xmax ymax de geo para a projecao OSM
  2947 + Converte string 'xmin ymin xmax ymax' ou 'xmin ymin' de geo para a projecao OSM
2946 2948 */
2947 2949 extOSM2Geo: function(ext){
2948 2950 if(i3GEO.Interface.openlayers.googleLike === true){
... ... @@ -2953,9 +2955,11 @@ i3GEO.util = {
2953 2955 point = new OpenLayers.LonLat(temp[0], temp[1]);
2954 2956 metrica = point.transform(proj900913,projWGS84);
2955 2957 ext = metrica.lon+" "+metrica.lat;
2956   - point = new OpenLayers.LonLat(temp[2], temp[3]);
2957   - metrica = point.transform(proj900913,projWGS84);
2958   - ext += " "+metrica.lon+" "+metrica.lat;
  2958 + if(temp.length > 2){
  2959 + point = new OpenLayers.LonLat(temp[2], temp[3]);
  2960 + metrica = point.transform(proj900913,projWGS84);
  2961 + ext += " "+metrica.lon+" "+metrica.lat;
  2962 + }
2959 2963 }
2960 2964 }
2961 2965 return ext;
... ...
classesphp/mapa_openlayers.php
... ... @@ -13,7 +13,7 @@ Precisa do codigo da "section" PHP aberta pelo i3Geo (veja ms_criamapa.php) ou o
13 13  
14 14 Parametros:
15 15  
16   -g_sid {string} - cdigo da "section" PHP
  16 +g_sid {string} - codigo da "section" PHP
17 17  
18 18 telaR {string} - (opcional) utilizado para autorizar o uso do mapfile aberto (deve estar registrado em $fingerprint (variável de seção)
19 19  
... ... @@ -49,7 +49,7 @@ Este programa é distribuído na expectativa de que seja útil
49 49 porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita
50 50 de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA.
51 51 Consulte a Licença Pública Geral do GNU para mais detalhes.
52   -Você deve ter recebido uma cpia da Licença Pública Geral do
  52 +Você deve ter recebido uma copia da Licença Pública Geral do
53 53 GNU junto com este programa; se não, escreva para a
54 54 Free Software Foundation, Inc., no endereço
55 55 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
... ... @@ -60,12 +60,8 @@ i3geo/classesphp/mapa_openlayers.php
60 60  
61 61 */
62 62 error_reporting(0);
63   -//para efeitos de compatibilidade
64   -if (!function_exists('ms_GetVersion')){
65   - include_once ("carrega_ext.php");
66   -}
67   -//carrega dados da seção, verifica segurança
68 63 inicializa();
  64 +
69 65 //
70 66 //calcula a extensao geografica com base no x,y,z
71 67 //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
104 100 if($qy == false && $_GET["cache"] == "sim" && $_GET["DESLIGACACHE"] != "sim"){
105 101 carregaCacheImagem($_SESSION["cachedir"],$_SESSION["map_file"],$_GET["tms"],$_SESSION["i3georendermode"]);
106 102 }
  103 +
107 104 //
108 105 //map_fileX e para o caso register_globals = On no PHP.INI
109 106  
... ... @@ -138,6 +135,13 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao e alter
138 135 {include_once("funcoes_gerais.php");}
139 136 autoClasses($l,$mapa);
140 137 }
  138 + //
  139 + //numero de pixels que serao considerados para corte da imagem no caso de cache ativo e tema de pontos
  140 + //
  141 + $cortePixels = 0;
  142 + if ($l->getmetadata("cortepixels") != ""){
  143 + $cortePixels = $l->getmetadata("cortepixels");
  144 + }
141 145 $l->set("status",MS_DEFAULT);
142 146 $l->set("template","none.htm");
143 147 if (!empty($postgis_mapa)){
... ... @@ -177,20 +181,23 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao e alter
177 181 }
178 182 }
179 183  
180   -if (!function_exists('imagepng'))
181   -{$_GET["TIPOIMAGEM"] = "";}
  184 +if (!function_exists('imagepng')){
  185 + $_GET["TIPOIMAGEM"] = "";
  186 +}
182 187  
183   -if($_GET["layer"] == "")
184   -{$cache = true;}
  188 +if($_GET["layer"] == ""){
  189 + $cache = true;
  190 +}
185 191  
186 192 if(($_GET == false) || ($qy) || (strtolower($_GET["DESLIGACACHE"]) == "sim")){
187 193 $cache = false;
188 194 }
189   -elseif($_GET["TIPOIMAGEM"] != "" && $_GET["TIPOIMAGEM"] != "nenhum")
190   -{$cache = false;}
  195 +elseif($_GET["TIPOIMAGEM"] != "" && $_GET["TIPOIMAGEM"] != "nenhum"){
  196 + $cache = false;
  197 +}
191 198  
192 199 if($cache == true && $_GET["cache"] != "nao"){
193   - carregaCacheImagem($cachedir,$map,$_GET["tms"]);
  200 + carregaCacheImagem($cachedir,$_SESSION["map_file"],$_GET["tms"]);
194 201 }
195 202 if(isset($_GET["map_size"])){
196 203 $map_size = explode(" ",$_GET["map_size"]);
... ... @@ -238,8 +245,27 @@ if(!isset($_GET["telaR"])){
238 245 //
239 246 if($_GET["tipolayer"] != "fundo")
240 247 {$o->set("transparent",MS_TRUE);}
241   -if($qy != true)
242   -{$img = $mapa->draw();}
  248 +
  249 +//
  250 +//se o layer foi marcado para corte altera os parametros para ampliar o mapa
  251 +//antes de gerar a imagem
  252 +//
  253 +if($cortePixels > 0){
  254 + //$imagemBranco = $mapa->prepareImage();
  255 + $escalaInicial = $mapa->scaledenom;
  256 + $extensaoInicial = $mapa->extent;
  257 + $wh = 256+($cortePixels*2);
  258 + $mapa->setsize($wh,$wh);
  259 + $ponto = new pointObj();
  260 + $ponto->setxy(($wh/2),($wh/2));
  261 + $mapa->zoomScale($escalaInicial, $ponto, $wh, $wh, $extensaoInicial);
  262 +}
  263 +
  264 +
  265 +//se nao houver selecao
  266 +if($qy != true){
  267 + $img = $mapa->draw();
  268 +}
243 269 else{
244 270 $handle = fopen ($qyfile, "r");
245 271 $conteudo = fread ($handle, filesize ($qyfile));
... ... @@ -285,7 +311,6 @@ else{
285 311 }
286 312 $cache = false;
287 313 }
288   -
289 314 //nao usa o cache pois e necessario processar a imagem com alguma rotina de filtro
290 315 if($_GET["TIPOIMAGEM"] != "" && $_GET["TIPOIMAGEM"] != "nenhum"){
291 316 if($img->imagepath == "")
... ... @@ -294,6 +319,14 @@ if($_GET["TIPOIMAGEM"] != "" && $_GET["TIPOIMAGEM"] != "nenhum"){
294 319 $img->saveImage($nomer);
295 320 filtraImg($nomer,$_GET["TIPOIMAGEM"]);
296 321 $img = imagecreatefrompng($nomer);
  322 + //
  323 + //corta a imagem gerada para voltar ao tamanho normal
  324 + //
  325 + if($cortePixels > 0){
  326 + $imgc = imagecreate(256,256);
  327 + imagecopy( $imgc, $img, 0 , 0 , $cortePixels , $cortePixels , 255, 255 );
  328 + $img = $imgc;
  329 + }
297 330 imagealphablending($img, false);
298 331 imagesavealpha($img, true);
299 332 ob_clean();
... ... @@ -356,7 +389,7 @@ else{
356 389 }
357 390 }
358 391 function salvaCacheImagem($cachedir,$map,$tms){
359   - global $img;
  392 + global $img,$cortePixels,$cortePixels;
360 393 if($cachedir == ""){
361 394 $nome = dirname(dirname($map))."/cache".$tms;
362 395 }
... ... @@ -365,8 +398,17 @@ function salvaCacheImagem($cachedir,$map,$tms){
365 398 }
366 399 if(!file_exists($nome)){
367 400 @mkdir(dirname($nome),0777,true);
368   - chmod(dirname($nome),0777);
369   - $img->saveImage($nome);
  401 + chmod(dirname($nome),0777);
  402 + $img->saveImage($nome);
  403 + //
  404 + //corta a imagem gerada para voltar ao tamanho normal
  405 + //
  406 + if($cortePixels > 0){
  407 + $img = imagecreatefrompng($nome);
  408 + $imgc = imagecreate(256,256);
  409 + imagecopy( $imgc, $img, 0 , 0 , $cortePixels , $cortePixels , 256, 256 );
  410 + imagepng($imgc,$nome);
  411 + }
370 412 chmod($nome,0777);
371 413 }
372 414 return $nome;
... ... @@ -448,10 +490,12 @@ function inicializa(){
448 490 if (md5('I3GEOSEC' . $_SERVER['HTTP_USER_AGENT'] . session_id()) != $f[0] && !in_array($_GET["telaR"],$f) )
449 491 {ilegal();}
450 492 }
451   - else
452   - {exit;}
453   - if(!isset($_SESSION["map_file"]))
454   - {exit;}
  493 + else{
  494 + exit;
  495 + }
  496 + if(!isset($_SESSION["map_file"])){
  497 + exit;
  498 + }
455 499 }
456 500 function ilegal(){
457 501 $img = imagecreatefrompng("../imagens/ilegal.png");
... ...
temas/_llocali.map
... ... @@ -6,7 +6,8 @@ MAP
6 6 DATA "/var/www/i3geo/aplicmap/dados/locali.shp"
7 7 METADATA
8 8 "METAESTAT_ID_MEDIDA_VARIAVEL" ""
9   - "cache" "NAO"
  9 + "cache" "SIM"
  10 + #"cortepixels" "50"
10 11 "LTEMPOITEMIMAGEM" ""
11 12 "TIP" "TIPO,ANOCRIA,NOMELOC"
12 13 "LTEMPOITEMDESCRICAO" "TIPO"
... ...