Commit e4f491cc9e13844ff2db02cebf8c54e9700ec107
1 parent
b3683672
Exists in
master
Correções nas ferramentas filtro e renderização de elementos selecionados
Showing
7 changed files
with
195 additions
and
89 deletions
Show diff stats
classesphp/classe_selecao.php
| ... | ... | @@ -117,6 +117,7 @@ $ext - extensão geográfica do mapa |
| 117 | 117 | $this->arquivo = str_replace(".map","",$map_file).".map"; |
| 118 | 118 | if($tema != "" && @$this->mapa->getlayerbyname($tema)) |
| 119 | 119 | $this->layer = $this->mapa->getlayerbyname($tema); |
| 120 | + | |
| 120 | 121 | $this->nome = $tema; |
| 121 | 122 | $c = $this->mapa->numlayers; |
| 122 | 123 | for ($i=0;$i < $c;++$i) |
| ... | ... | @@ -882,6 +883,7 @@ $retornaShapes - retorna os shapes selecionados. Nesse caso, nao e gerado o arqu |
| 882 | 883 | $this->selecaoLimpa(); |
| 883 | 884 | $tipo = "adiciona"; |
| 884 | 885 | } |
| 886 | + | |
| 885 | 887 | if(!$this->layer){ |
| 886 | 888 | return "erro"; |
| 887 | 889 | } | ... | ... |
classesphp/funcoes_gerais.php
| ... | ... | @@ -554,6 +554,7 @@ function listaTrueType() |
| 554 | 554 | function substituiCon($map_file, $postgis_mapa) |
| 555 | 555 | { |
| 556 | 556 | // error_reporting(0); |
| 557 | + return; | |
| 557 | 558 | if (! empty($postgis_mapa) && (file_exists($map_file))) { |
| 558 | 559 | if (! @ms_newMapObj($map_file)) { |
| 559 | 560 | return false; | ... | ... |
classesphp/mapa_googlemaps.php
| ... | ... | @@ -55,8 +55,6 @@ |
| 55 | 55 | * i3geo/classesphp/mapa_googlemaps.php |
| 56 | 56 | * |
| 57 | 57 | */ |
| 58 | -// error_reporting(0); | |
| 59 | -// error_reporting(0); | |
| 60 | 58 | include ("sani_request.php"); |
| 61 | 59 | // para efeitos de compatibilidade |
| 62 | 60 | if (! function_exists('ms_GetVersion')) { |
| ... | ... | @@ -96,6 +94,9 @@ $postgis_mapa = $_SESSION["postgis_mapa"]; |
| 96 | 94 | $cachedir = $_SESSION["cachedir"]; |
| 97 | 95 | $i3georendermode = $_SESSION["i3georendermode"]; |
| 98 | 96 | |
| 97 | +$projInObj = ms_newprojectionobj("proj=latlong,a=6378137,b=6378137"); | |
| 98 | +$projOutObj = ms_newprojectionobj("proj=merc,a=6378137,b=6378137,lat_ts=0.0,lon_0=0.0,x_0=0.0,y_0=0,k=1.0,units=m"); | |
| 99 | + | |
| 99 | 100 | if (! empty($_GET["request"])) { |
| 100 | 101 | $_GET["REQUEST"] = $_GET["request"]; |
| 101 | 102 | } |
| ... | ... | @@ -127,9 +128,6 @@ if ($_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "get |
| 127 | 128 | $x --; |
| 128 | 129 | $y --; |
| 129 | 130 | |
| 130 | - $projInObj = ms_newprojectionobj("proj=latlong,a=6378137,b=6378137"); | |
| 131 | - $projOutObj = ms_newprojectionobj("proj=merc,a=6378137,b=6378137,lat_ts=0.0,lon_0=0.0,x_0=0.0,y_0=0,k=1.0,units=m"); | |
| 132 | - | |
| 133 | 131 | $poPoint1 = ms_newpointobj(); |
| 134 | 132 | $poPoint1->setXY($lon1, $lat1); |
| 135 | 133 | $poPoint1->project($projInObj, $projOutObj); |
| ... | ... | @@ -309,6 +307,7 @@ $legenda = $mapa->legend; |
| 309 | 307 | $legenda->set("status", MS_OFF); |
| 310 | 308 | $escala = $mapa->scalebar; |
| 311 | 309 | $escala->set("status", MS_OFF); |
| 310 | + | |
| 312 | 311 | if (trim($_GET["TIPOIMAGEM"]) != "" && trim($_GET["TIPOIMAGEM"]) != "nenhum") { |
| 313 | 312 | $o->setOption("QUANTIZE_FORCE", "OFF"); |
| 314 | 313 | } |
| ... | ... | @@ -331,11 +330,13 @@ if ($cortePixels > 0) { |
| 331 | 330 | if ($qy != true) { |
| 332 | 331 | $img = $mapa->draw(); |
| 333 | 332 | } else { |
| 334 | - $handle = fopen($qyfile, "r"); | |
| 335 | - $conteudo = fread($handle, filesize($qyfile)); | |
| 336 | - fclose($handle); | |
| 333 | + //$handle = fopen($qyfile, "r"); | |
| 334 | + //$conteudo = fread($handle, filesize($qyfile)); | |
| 335 | + //fclose($handle); | |
| 336 | + $conteudo = file_get_contents($qyfile); | |
| 337 | 337 | $shp = unserialize($conteudo); |
| 338 | 338 | $l = $mapa->getLayerByname($_GET["layer"]); |
| 339 | + $c = $mapa->querymap->color; | |
| 339 | 340 | $indxlayer = $l->index; |
| 340 | 341 | if ($l->connectiontype != MS_POSTGIS) { |
| 341 | 342 | if($l->type == MS_LAYER_POINT){ |
| ... | ... | @@ -354,15 +355,14 @@ if ($qy != true) { |
| 354 | 355 | } |
| 355 | 356 | } |
| 356 | 357 | foreach ($shp as $indx) { |
| 357 | - $mapa->querybyindex($indxlayer, - 1, $indx, MS_TRUE); | |
| 358 | + $mapa->querybyindex($indxlayer, -1, $indx, MS_TRUE); | |
| 358 | 359 | } |
| 359 | 360 | $qm = $mapa->querymap; |
| 360 | - $qm->set("width", $_GET["WIDTH"]); | |
| 361 | - $qm->set("height", $_GET["HEIGHT"]); | |
| 361 | + $qm->set("width", 256); | |
| 362 | + $qm->set("height", 256); | |
| 362 | 363 | $img = $mapa->drawQuery(); |
| 363 | 364 | } else { |
| 364 | 365 | $img = $mapa->draw(); |
| 365 | - $c = $mapa->querymap->color; | |
| 366 | 366 | $numclasses = $l->numclasses; |
| 367 | 367 | if ($numclasses > 0) { |
| 368 | 368 | $classe0 = $l->getClass(0); |
| ... | ... | @@ -378,37 +378,25 @@ if ($qy != true) { |
| 378 | 378 | } |
| 379 | 379 | $cor = $classe0->getstyle(0)->color; |
| 380 | 380 | $cor->setrgb($c->red, $c->green, $c->blue); |
| 381 | - $cor = $classe0->getstyle(0)->outlinecolor; | |
| 382 | - $cor->setrgb($c->red, $c->green, $c->blue); | |
| 383 | - // $v = versaoMS(); | |
| 384 | - if ($versao["principal"] == 6) { | |
| 385 | - $l->open(); | |
| 386 | - foreach ($shp as $indx) { | |
| 387 | - $shape = $l->getShape(new resultObj($indx)); | |
| 381 | + $status = $l->open(); | |
| 382 | + $rect = $mapa->extent; | |
| 383 | + $rect->project($projOutObj,$projInObj); | |
| 384 | + $status = $l->whichShapes($rect); | |
| 385 | + while ($shape = $l->nextShape()) { | |
| 386 | + //$shape->project($projInObj,$projOutObj); | |
| 387 | + if (in_array($shape->index, $shp)){ | |
| 388 | + $shape->project($projInObj,$projOutObj); | |
| 389 | + //echo $shape->toWkt();exit; | |
| 390 | + //$shape = ms_shapeObjFromWkt($shape->toWkt()); | |
| 388 | 391 | $shape->draw($mapa, $l, $img); |
| 389 | 392 | } |
| 390 | - $l->close(); | |
| 391 | - } else { | |
| 392 | - $l->open(); | |
| 393 | - foreach ($shp as $indx) { | |
| 394 | - $shape = $l->getfeature($indx, - 1); | |
| 395 | - $shape->draw($mapa, $l, $img); | |
| 396 | - } | |
| 397 | - $l->close(); | |
| 398 | 393 | } |
| 394 | + $l->close(); | |
| 399 | 395 | } |
| 396 | + $cache = false; | |
| 400 | 397 | } |
| 401 | -if (! function_exists('imagepng')) { | |
| 402 | - $s = PHP_SHLIB_SUFFIX; | |
| 403 | - @dl('php_gd.' . $s); | |
| 404 | - if (! function_exists('imagepng')) { | |
| 405 | - @dl('php_gd2.' . $s); | |
| 406 | - } | |
| 407 | - if (! function_exists('imagepng')) { | |
| 408 | - $_GET["TIPOIMAGEM"] = ""; | |
| 409 | - } | |
| 410 | -} | |
| 411 | -if (trim($_GET["TIPOIMAGEM"]) != "" && trim($_GET["TIPOIMAGEM"]) != "nenhum") { | |
| 398 | +//exit; | |
| 399 | +if ($_GET["TIPOIMAGEM"] != "" && $_GET["TIPOIMAGEM"] != "nenhum") { | |
| 412 | 400 | if ($img->imagepath == "") { |
| 413 | 401 | echo "Erro IMAGEPATH vazio"; |
| 414 | 402 | exit(); |
| ... | ... | @@ -427,34 +415,23 @@ if (trim($_GET["TIPOIMAGEM"]) != "" && trim($_GET["TIPOIMAGEM"]) != "nenhum") { |
| 427 | 415 | imagesavealpha($img, true); |
| 428 | 416 | cabecalhoImagem($nomer); |
| 429 | 417 | imagepng($img); |
| 418 | + //imagedestroy($img); | |
| 430 | 419 | } else { |
| 431 | - if ($cache == true) { | |
| 432 | - $nomer = salvaCacheImagem(); | |
| 420 | + if ($cache == true && $_GET["cache"] != "nao") { | |
| 421 | + // cache ativo. Salva a imagem em cache | |
| 422 | + $nomer = salvaCacheImagem($cachedir, $map_fileX, $_GET["tms"]); | |
| 433 | 423 | cabecalhoImagem($nomer); |
| 434 | - carregaCacheImagem(); | |
| 424 | + if ($_SESSION["i3georendermode"] == 2) { | |
| 425 | + header("X-Sendfile: $nomer"); | |
| 426 | + } else { | |
| 427 | + readfile($nomer); | |
| 428 | + } | |
| 435 | 429 | } else { |
| 436 | - if ($_SESSION["i3georendermode"] == 0 || ($_SESSION["i3georendermode"] == 1 && $cortePixels > 0)) { | |
| 437 | - $nomer = ($img->imagepath) . "temp" . nomeRand() . ".png"; | |
| 438 | - if ($img->imagepath == "") { | |
| 439 | - ilegal(); | |
| 440 | - } | |
| 441 | - $img->saveImage($nomer); | |
| 442 | - // | |
| 443 | - // corta a imagem gerada para voltar ao tamanho normal | |
| 444 | - // | |
| 445 | - if ($cortePixels > 0) { | |
| 446 | - $img = cortaImagemDisco($nomer, $cortePixels, 256); | |
| 447 | - } else { | |
| 448 | - $img = imagecreatefrompng($nomer); | |
| 449 | - imagealphablending($img, false); | |
| 450 | - imagesavealpha($img, true); | |
| 451 | - } | |
| 452 | - cabecalhoImagem($nomer); | |
| 453 | - imagepng($img); | |
| 454 | - imagedestroy($img); | |
| 455 | - exit(); | |
| 430 | + // cache inativo | |
| 431 | + if ($img->imagepath == "") { | |
| 432 | + ilegal(); | |
| 456 | 433 | } |
| 457 | - if ($_SESSION["i3georendermode"] == 1) { | |
| 434 | + if ($_SESSION["i3georendermode"] == 0 || ($_SESSION["i3georendermode"] == 1 && $cortePixels > 0)) { | |
| 458 | 435 | ob_clean(); |
| 459 | 436 | header('Content-Type: image/png'); |
| 460 | 437 | $img->saveImage(); |
| ... | ... | @@ -466,13 +443,12 @@ if (trim($_GET["TIPOIMAGEM"]) != "" && trim($_GET["TIPOIMAGEM"]) != "nenhum") { |
| 466 | 443 | // corta a imagem gerada para voltar ao tamanho normal |
| 467 | 444 | // |
| 468 | 445 | if ($cortePixels > 0) { |
| 469 | - $img = cortaImagemDisco($nomer, $cortePixels, 256); | |
| 446 | + $img = cortaImagemDisco($nomer, $cortePixels, $_GET["WIDTH"]); | |
| 470 | 447 | } |
| 471 | 448 | cabecalhoImagem($nomer); |
| 472 | - header("X-Sendfile: $nomer"); | |
| 449 | + header("X-Sendfile: ".$nomer); | |
| 473 | 450 | } |
| 474 | 451 | } |
| 475 | - exit(); | |
| 476 | 452 | } |
| 477 | 453 | |
| 478 | 454 | function cabecalhoImagem($nome,$tipo="image/png") | ... | ... |
classesphp/mapa_openlayers.php
| ... | ... | @@ -318,6 +318,9 @@ if ($cache == true && $_GET["cache"] != "nao") { |
| 318 | 318 | if (isset($_GET["map_size"])) { |
| 319 | 319 | $map_size = explode(" ", $_GET["map_size"]); |
| 320 | 320 | $mapa->setsize($map_size[0], $map_size[1]); |
| 321 | +} else { | |
| 322 | + $map_size = array(256,256); | |
| 323 | + $mapa->setsize($map_size[0], $map_size[1]); | |
| 321 | 324 | } |
| 322 | 325 | |
| 323 | 326 | if (isset($_GET["mapext"])) { |
| ... | ... | @@ -418,7 +421,6 @@ if ($qy != true) { |
| 418 | 421 | $img = $mapa->drawQuery(); |
| 419 | 422 | } else { |
| 420 | 423 | $img = $mapa->draw(); |
| 421 | - | |
| 422 | 424 | $numclasses = $l->numclasses; |
| 423 | 425 | if ($numclasses > 0) { |
| 424 | 426 | $classe0 = $l->getClass(0); |
| ... | ... | @@ -476,7 +478,6 @@ if ($_GET["TIPOIMAGEM"] != "" && $_GET["TIPOIMAGEM"] != "nenhum") { |
| 476 | 478 | readfile($nomer); |
| 477 | 479 | } |
| 478 | 480 | } else { |
| 479 | - | |
| 480 | 481 | // cache inativo |
| 481 | 482 | if ($img->imagepath == "") { |
| 482 | 483 | ilegal(); | ... | ... |
ferramentas/identifica/index.js
| ... | ... | @@ -452,30 +452,52 @@ i3GEOF.identifica = { |
| 452 | 452 | }, |
| 453 | 453 | filtrar : function(tema, item, valor) { |
| 454 | 454 | i3GEO.janela.abreAguarde(); |
| 455 | - var filtro = "", | |
| 456 | - temp = function(retorno) { | |
| 457 | - i3GEO.janela.fechaAguarde(); | |
| 458 | - i3GEO.Interface.atualizaTema(retorno, tema); | |
| 459 | - }, | |
| 460 | - p = i3GEO.configura.locaplic + "/ferramentas/filtro/exec.php?base64=sim&g_sid=" + i3GEO.configura.sid + "&funcao=inserefiltro", | |
| 461 | - cp = new cpaint(); | |
| 462 | - | |
| 463 | - filtro = "(*[" + item + "]* = *" + valor + "*)"; | |
| 464 | - cp.set_response_type("JSON"); | |
| 465 | - cp.set_transfer_mode('POST'); | |
| 466 | - cp.call(p, "insereFiltro", temp, "tema=" + tema + "&filtro=" + i3GEO.util.base64encode(filtro)); | |
| 455 | + $.get( | |
| 456 | + i3GEO.configura.locaplic+"/ferramentas/filtro/exec.php", | |
| 457 | + { | |
| 458 | + g_sid: i3GEO.configura.sid, | |
| 459 | + base64: "sim", | |
| 460 | + funcao: "inserefiltro", | |
| 461 | + tema: tema, | |
| 462 | + filtro: i3GEO.util.base64encode("(*[" + item + "]* = *" + valor + "*)") | |
| 463 | + } | |
| 464 | + ) | |
| 465 | + .done( | |
| 466 | + function(data, status){ | |
| 467 | + i3GEO.janela.fechaAguarde(); | |
| 468 | + i3GEO.Interface.atualizaTema(data, tema); | |
| 469 | + } | |
| 470 | + ) | |
| 471 | + .fail( | |
| 472 | + function(data){ | |
| 473 | + i3GEO.janela.fechaAguarde(); | |
| 474 | + i3GEO.janela.snackBar({content: data.statusText, style:'red'}); | |
| 475 | + } | |
| 476 | + ); | |
| 467 | 477 | }, |
| 468 | 478 | removeFiltro : function(tema) { |
| 469 | 479 | i3GEO.janela.abreAguarde(); |
| 470 | - var temp = function(retorno) { | |
| 471 | - i3GEO.janela.fechaAguarde(); | |
| 472 | - i3GEO.Interface.atualizaTema(retorno, tema); | |
| 473 | - }, p = | |
| 474 | - i3GEO.configura.locaplic + "/ferramentas/filtro/exec.php?base64=nao&g_sid=" + i3GEO.configura.sid + "&funcao=inserefiltro", cp = | |
| 475 | - new cpaint(); | |
| 476 | - cp.set_response_type("JSON"); | |
| 477 | - cp.set_transfer_mode('POST'); | |
| 478 | - cp.call(p, "insereFiltro", temp, "tema=" + tema + "&filtro="); | |
| 480 | + $.get( | |
| 481 | + i3GEO.configura.locaplic+"/ferramentas/filtro/exec.php", | |
| 482 | + { | |
| 483 | + g_sid: i3GEO.configura.sid, | |
| 484 | + funcao: "inserefiltro", | |
| 485 | + tema: tema, | |
| 486 | + filtro: "" | |
| 487 | + } | |
| 488 | + ) | |
| 489 | + .done( | |
| 490 | + function(data, status){ | |
| 491 | + i3GEO.janela.fechaAguarde(); | |
| 492 | + i3GEO.Interface.atualizaTema(data, tema); | |
| 493 | + } | |
| 494 | + ) | |
| 495 | + .fail( | |
| 496 | + function(data){ | |
| 497 | + i3GEO.janela.fechaAguarde(); | |
| 498 | + i3GEO.janela.snackBar({content: data.statusText, style:'red'}); | |
| 499 | + } | |
| 500 | + ); | |
| 479 | 501 | }, |
| 480 | 502 | adicionaPontoRegiao : function(idjanela) { |
| 481 | 503 | var p = i3GEO.configura.locaplic + "/ferramentas/editortema/exec.php?funcao=adicionaGeometria&g_sid=" + i3GEO.configura.sid, tema = | ... | ... |
ms_configura.php
| ... | ... | @@ -0,0 +1,104 @@ |
| 1 | +MAP | |
| 2 | + FONTSET "../symbols/fontes.txt" | |
| 3 | + SYMBOLSET "../symbols/simbolosv6.sym" | |
| 4 | + LAYER | |
| 5 | + COMPOSITE | |
| 6 | + OPACITY 40 | |
| 7 | + END # COMPOSITE | |
| 8 | + CONNECTION "" | |
| 9 | + CONNECTIONTYPE POSTGIS | |
| 10 | + DATA "geom FROM (select class_regiao,class_regiao_desc,geom FROM dbauxiliares.tb_class_regiao WHERE superintendencia = 't') as foo USING UNIQUE class_regiao USING SRID=4674" | |
| 11 | + METADATA | |
| 12 | + "cache" "sim" | |
| 13 | + "TIP" "class_regiao,class_regiao_desc" | |
| 14 | + "CLASSE" "SIM" | |
| 15 | + "permitekmz" "SIM" | |
| 16 | + "ITENSDESC" "Codigo,Nome" | |
| 17 | + "TILES" "SIM" | |
| 18 | + "ITENSLINK" "," | |
| 19 | + "extensao" "-48.285791068245 -16.050264262644 -47.308386987058 -15.500255153363" | |
| 20 | + "permitedownload" "SIM" | |
| 21 | + "download" "SIM" | |
| 22 | + "UTFDATA" "class_regiao_desc" | |
| 23 | + "ITENS" "class_regiao,class_regiao_desc" | |
| 24 | + "permitekml" "SIM" | |
| 25 | + "permiteogc" "SIM" | |
| 26 | + "convcaracter" "SIM" | |
| 27 | + "TEMA" "Regiões de saúde (superintendências)" | |
| 28 | + "IDENTIFICA" "sim" | |
| 29 | + END # METADATA | |
| 30 | + NAME "regioesdesaude" | |
| 31 | + PROCESSING "LABEL_NO_CLIP=True" | |
| 32 | + PROCESSING "POLYLINE_NO_CLIP=True" | |
| 33 | + STATUS DEFAULT | |
| 34 | + TEMPLATE "none.htm" | |
| 35 | + TILEITEM "location" | |
| 36 | + TYPE POLYGON | |
| 37 | + UNITS METERS | |
| 38 | + CLASS | |
| 39 | + NAME "Região Central" | |
| 40 | + EXPRESSION ('[class_regiao]'eq'2') | |
| 41 | + STYLE | |
| 42 | + COLOR 203 115 203 | |
| 43 | + OUTLINECOLOR 255 255 255 | |
| 44 | + END # STYLE | |
| 45 | + TITLE "" | |
| 46 | + END # CLASS | |
| 47 | + CLASS | |
| 48 | + NAME "Região Oeste" | |
| 49 | + EXPRESSION ('[class_regiao]'eq'5') | |
| 50 | + STYLE | |
| 51 | + COLOR 17 166 64 | |
| 52 | + OUTLINECOLOR 255 255 255 | |
| 53 | + END # STYLE | |
| 54 | + TITLE "" | |
| 55 | + END # CLASS | |
| 56 | + CLASS | |
| 57 | + NAME "Região Norte" | |
| 58 | + EXPRESSION ('[class_regiao]'eq'6') | |
| 59 | + STYLE | |
| 60 | + COLOR 2 210 239 | |
| 61 | + OUTLINECOLOR 255 255 255 | |
| 62 | + END # STYLE | |
| 63 | + TITLE "" | |
| 64 | + END # CLASS | |
| 65 | + CLASS | |
| 66 | + NAME "Região Sul" | |
| 67 | + EXPRESSION ('[class_regiao]'eq'3') | |
| 68 | + STYLE | |
| 69 | + COLOR 249 110 138 | |
| 70 | + OUTLINECOLOR 255 255 255 | |
| 71 | + END # STYLE | |
| 72 | + TITLE "" | |
| 73 | + END # CLASS | |
| 74 | + CLASS | |
| 75 | + NAME "Região Leste" | |
| 76 | + EXPRESSION ('[class_regiao]'eq'7') | |
| 77 | + STYLE | |
| 78 | + COLOR 243 26 74 | |
| 79 | + OUTLINECOLOR 255 255 255 | |
| 80 | + END # STYLE | |
| 81 | + TITLE "" | |
| 82 | + END # CLASS | |
| 83 | + CLASS | |
| 84 | + NAME "Região Sudoeste" | |
| 85 | + EXPRESSION ('[class_regiao]'eq'4') | |
| 86 | + STYLE | |
| 87 | + COLOR 122 60 248 | |
| 88 | + OUTLINECOLOR 255 255 255 | |
| 89 | + END # STYLE | |
| 90 | + TITLE "" | |
| 91 | + END # CLASS | |
| 92 | + CLASS | |
| 93 | + NAME "Região Centro-Sul" | |
| 94 | + EXPRESSION ('[class_regiao]'eq'1') | |
| 95 | + STYLE | |
| 96 | + COLOR 189 247 118 | |
| 97 | + OUTLINECOLOR 255 255 255 | |
| 98 | + END # STYLE | |
| 99 | + TITLE "" | |
| 100 | + END # CLASS | |
| 101 | + END # LAYER | |
| 102 | + | |
| 103 | +END # MAP | |
| 104 | + | ... | ... |