Commit 55d1b5ef80012222d002c8f345fd53ef7d2f313d
1 parent
3c59fb9c
Exists in
master
and in
7 other branches
Alteração em ogc.php para permitir o desenho de mais de uma camada com getmap. I…
…nclusão de parametro para definir o template da legenda em HTML. Ajustes na apresentação dos títulos das classes em legendas inseridas no mapa
Showing
3 changed files
with
201 additions
and
178 deletions
Show diff stats
ferramentas/selecao/index.js
@@ -393,7 +393,6 @@ i3GEOF.selecao = | @@ -393,7 +393,6 @@ i3GEOF.selecao = | ||
393 | i3GEO.util.mudaCursor(i3GEO.configura.cursores, "crosshair", i3GEO.Interface.IDMAPA, i3GEO.configura.locaplic); | 393 | i3GEO.util.mudaCursor(i3GEO.configura.cursores, "crosshair", i3GEO.Interface.IDMAPA, i3GEO.configura.locaplic); |
394 | i3GEO.barraDeBotoes.ativaIcone("selecao"); | 394 | i3GEO.barraDeBotoes.ativaIcone("selecao"); |
395 | i3GEOF.selecao.pegaTemasSel(); | 395 | i3GEOF.selecao.pegaTemasSel(); |
396 | - i3GEOF.selecao.mudaicone(); | ||
397 | var i = $i("i3GEOF.selecao_c").style; | 396 | var i = $i("i3GEOF.selecao_c").style; |
398 | i3GEO.janela.ULTIMOZINDEX++; | 397 | i3GEO.janela.ULTIMOZINDEX++; |
399 | i.zIndex = 51000 + i3GEO.janela.ULTIMOZINDEX; | 398 | i.zIndex = 51000 + i3GEO.janela.ULTIMOZINDEX; |
@@ -433,17 +432,7 @@ i3GEOF.selecao = | @@ -433,17 +432,7 @@ i3GEOF.selecao = | ||
433 | * Altera as bordas dos ícones | 432 | * Altera as bordas dos ícones |
434 | */ | 433 | */ |
435 | mudaicone : function() { | 434 | mudaicone : function() { |
436 | - $i("i3GEOselecaopt").parentNode.style.backgroundColor = "#F5F5F5"; | ||
437 | - $i("i3GEOselecaoext").parentNode.style.backgroundColor = "#F5F5F5"; | ||
438 | - if ($i("i3GEOselecaobox")) { | ||
439 | - $i("i3GEOselecaobox").parentNode.style.backgroundColor = "#F5F5F5"; | ||
440 | - } | ||
441 | - if ($i("i3GEOselecaopoli")) { | ||
442 | - $i("i3GEOselecaopoli").parentNode.style.backgroundColor = "#F5F5F5"; | ||
443 | - } | ||
444 | - if ($i("i3GEOselecaoFigura")) { | ||
445 | - $i("i3GEOselecaoFigura").parentNode.style.backgroundColor = "#F5F5F5"; | ||
446 | - } | 435 | + |
447 | }, | 436 | }, |
448 | /* | 437 | /* |
449 | * Function: pegaTemasSel | 438 | * Function: pegaTemasSel |
@@ -557,28 +546,24 @@ i3GEOF.selecao = | @@ -557,28 +546,24 @@ i3GEOF.selecao = | ||
557 | } | 546 | } |
558 | if (obj.value == "i3GEOselecaobox") { | 547 | if (obj.value == "i3GEOselecaobox") { |
559 | i3GEOF.selecao.tipoSel = obj.value; | 548 | i3GEOF.selecao.tipoSel = obj.value; |
560 | - i3GEOF.selecao.mudaicone(); | ||
561 | obj.style.backgroundColor = "#cedff2"; | 549 | obj.style.backgroundColor = "#cedff2"; |
562 | i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia(); | 550 | i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia(); |
563 | i3GEOF.selecao.box[api].inicia(); | 551 | i3GEOF.selecao.box[api].inicia(); |
564 | } | 552 | } |
565 | if (obj.value == "i3GEOselecaopt") { | 553 | if (obj.value == "i3GEOselecaopt") { |
566 | i3GEOF.selecao.tipoSel = obj.value; | 554 | i3GEOF.selecao.tipoSel = obj.value; |
567 | - i3GEOF.selecao.mudaicone(); | ||
568 | obj.style.backgroundColor = "#cedff2"; | 555 | obj.style.backgroundColor = "#cedff2"; |
569 | i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia(); | 556 | i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia(); |
570 | i3GEOF.selecao.clique[api].inicia(); | 557 | i3GEOF.selecao.clique[api].inicia(); |
571 | } | 558 | } |
572 | if (obj.value == "i3GEOselecaopoli") { | 559 | if (obj.value == "i3GEOselecaopoli") { |
573 | i3GEOF.selecao.tipoSel = obj.value; | 560 | i3GEOF.selecao.tipoSel = obj.value; |
574 | - i3GEOF.selecao.mudaicone(); | ||
575 | obj.style.backgroundColor = "#cedff2"; | 561 | obj.style.backgroundColor = "#cedff2"; |
576 | i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia(); | 562 | i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia(); |
577 | i3GEOF.selecao.poligono[api].inicia(); | 563 | i3GEOF.selecao.poligono[api].inicia(); |
578 | } | 564 | } |
579 | if (obj.value == "i3GEOselecaofigura") { | 565 | if (obj.value == "i3GEOselecaofigura") { |
580 | i3GEOF.selecao.tipoSel = obj.value; | 566 | i3GEOF.selecao.tipoSel = obj.value; |
581 | - i3GEOF.selecao.mudaicone(); | ||
582 | obj.style.backgroundColor = "#cedff2"; | 567 | obj.style.backgroundColor = "#cedff2"; |
583 | i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia(); | 568 | i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia(); |
584 | i3GEOF.selecao.figura[api].inicia(); | 569 | i3GEOF.selecao.figura[api].inicia(); |
@@ -744,7 +729,6 @@ i3GEOF.selecao = | @@ -744,7 +729,6 @@ i3GEOF.selecao = | ||
744 | i3GEO.janela.abreAguarde("i3GEO.atualiza", $trad("o1")); | 729 | i3GEO.janela.abreAguarde("i3GEO.atualiza", $trad("o1")); |
745 | i3GEO.eventos.cliquePerm.ativa(); | 730 | i3GEO.eventos.cliquePerm.ativa(); |
746 | i3GEO.php.selecaobox(retorna, tema, tipo, box); | 731 | i3GEO.php.selecaobox(retorna, tema, tipo, box); |
747 | - i3GEOF.selecao.mudaicone(); | ||
748 | } | 732 | } |
749 | }, | 733 | }, |
750 | /* | 734 | /* |
@@ -883,7 +867,6 @@ i3GEOF.selecao = | @@ -883,7 +867,6 @@ i3GEOF.selecao = | ||
883 | }; | 867 | }; |
884 | i3GEO.eventos.cliquePerm.ativa(); | 868 | i3GEO.eventos.cliquePerm.ativa(); |
885 | i3GEO.php.selecaopt(retorna, tema, x + " " + y, tipo, tolerancia); | 869 | i3GEO.php.selecaopt(retorna, tema, x + " " + y, tipo, tolerancia); |
886 | - i3GEOF.selecao.mudaicone(); | ||
887 | } | 870 | } |
888 | }, | 871 | }, |
889 | /* | 872 | /* |
@@ -997,7 +980,6 @@ i3GEOF.selecao = | @@ -997,7 +980,6 @@ i3GEOF.selecao = | ||
997 | }; | 980 | }; |
998 | i3GEO.eventos.cliquePerm.ativa(); | 981 | i3GEO.eventos.cliquePerm.ativa(); |
999 | i3GEO.php.selecaoWkt(retorna, tema, tipo, wkt, $i("i3GEOselecaotoleranciapt").value); | 982 | i3GEO.php.selecaoWkt(retorna, tema, tipo, wkt, $i("i3GEOselecaotoleranciapt").value); |
1000 | - i3GEOF.selecao.mudaicone(); | ||
1001 | } | 983 | } |
1002 | }, | 984 | }, |
1003 | /* | 985 | /* |
@@ -1188,7 +1170,6 @@ i3GEOF.selecao = | @@ -1188,7 +1170,6 @@ i3GEOF.selecao = | ||
1188 | }; | 1170 | }; |
1189 | i3GEO.janela.abreAguarde("i3GEO.atualiza", $trad("o1")); | 1171 | i3GEO.janela.abreAguarde("i3GEO.atualiza", $trad("o1")); |
1190 | i3GEO.eventos.cliquePerm.ativa(); | 1172 | i3GEO.eventos.cliquePerm.ativa(); |
1191 | - i3GEOF.selecao.mudaicone(); | ||
1192 | p = i3GEO.configura.locaplic + "/ferramentas/selecao/exec.php?g_sid=" + i3GEO.configura.sid + "&funcao=selecaoPoli"; | 1173 | p = i3GEO.configura.locaplic + "/ferramentas/selecao/exec.php?g_sid=" + i3GEO.configura.sid + "&funcao=selecaoPoli"; |
1193 | cp = new cpaint(); | 1174 | cp = new cpaint(); |
1194 | // cp.set_debug(2) | 1175 | // cp.set_debug(2) |
interface/openlayersdebug.htm
ogc.php
@@ -36,9 +36,12 @@ se for igual a "temaswfs", mostra a lista de links WFS | @@ -36,9 +36,12 @@ se for igual a "temaswfs", mostra a lista de links WFS | ||
36 | 36 | ||
37 | ajuda - (opcional) mostra uma ajuda ao usuário | 37 | ajuda - (opcional) mostra uma ajuda ao usuário |
38 | 38 | ||
39 | -tema - (opcional) nome do tema que será mostrado no serviço. Se for definido, o web service conterá apenas esse tema. O tema é o nome do mapfile existente em i3geo/temas, mas pode ser especificado um mapfile existente em outra pasta. Nesse caso, deve-se especificar o caminho completo para o arquivo. Se não for definido, serão considerados todos os temas | 39 | +tema ou temas - (opcional) nome do tema que será mostrado no serviço. Se for definido, o web service conterá apenas esse tema. O tema é o nome do mapfile existente em i3geo/temas, mas pode ser especificado um mapfile existente em outra pasta. Nesse caso, deve-se especificar o caminho completo para o arquivo. Se não for definido, serão considerados todos os temas |
40 | 40 | ||
41 | legenda - (opcional) mostra a legenda no corpo do mapa sim|nao | 41 | legenda - (opcional) mostra a legenda no corpo do mapa sim|nao |
42 | + | ||
43 | +templateLegenda - (opcional) nome de um template HTML para uso em legendas do tipo text/html. Dever ser o caminho relativo a pasta | ||
44 | +onde o i3Geo esta instalado e deve usar a extensao .htm. Sobre templates, veja a documentacao do Mapserver. exemplo &templateLegenda=aplicmap/legenda8.htm | ||
42 | 45 | ||
43 | perfil - (opcional) perfil utilizado para restringir os temas que serão mostrados | 46 | perfil - (opcional) perfil utilizado para restringir os temas que serão mostrados |
44 | 47 | ||
@@ -432,9 +435,9 @@ else{ | @@ -432,9 +435,9 @@ else{ | ||
432 | } | 435 | } |
433 | $e = $oMap->extent; | 436 | $e = $oMap->extent; |
434 | $extensaoMap = ($e->minx)." ".($e->miny)." ".($e->maxx)." ".($e->maxy); | 437 | $extensaoMap = ($e->minx)." ".($e->miny)." ".($e->maxx)." ".($e->maxy); |
435 | - //gera o mapa | 438 | + //gera o mapa |
436 | if ($tema != ""){ | 439 | if ($tema != ""){ |
437 | - $listatema = explode(" ",$tema); | 440 | + $listatema = explode(" ",str_replace(","," ",$tema)); |
438 | //para o caso do tema ser um arquivo mapfile existente em uma pasta qualquer | 441 | //para o caso do tema ser um arquivo mapfile existente em uma pasta qualquer |
439 | //$temai3geo = true indica que o layer será buscado na pasta i3geo/temas | 442 | //$temai3geo = true indica que o layer será buscado na pasta i3geo/temas |
440 | $temai3geo = true; | 443 | $temai3geo = true; |
@@ -452,8 +455,7 @@ else{ | @@ -452,8 +455,7 @@ else{ | ||
452 | if($temai3geo == true && file_exists($locaplic."/temas/".$tx.".gvp")){ | 455 | if($temai3geo == true && file_exists($locaplic."/temas/".$tx.".gvp")){ |
453 | $extensao = ".gvp"; | 456 | $extensao = ".gvp"; |
454 | } | 457 | } |
455 | - if($extensao == ".map"){ | ||
456 | - | 458 | + if($extensao == ".map"){ |
457 | //cria o mapfile com base no sistema de metadados estatisticos | 459 | //cria o mapfile com base no sistema de metadados estatisticos |
458 | //verifica se o id_medida_variavel existe no mapfile e nao foi passado como um parametro | 460 | //verifica se o id_medida_variavel existe no mapfile e nao foi passado como um parametro |
459 | if(!isset($_GET["id_medida_variavel"]) && $temai3geo == true){ | 461 | if(!isset($_GET["id_medida_variavel"]) && $temai3geo == true){ |
@@ -477,7 +479,7 @@ else{ | @@ -477,7 +479,7 @@ else{ | ||
477 | if($temai3geo == true){ | 479 | if($temai3geo == true){ |
478 | $nmap = ms_newMapobj($locaplic."/temas/".$tx.".map"); | 480 | $nmap = ms_newMapobj($locaplic."/temas/".$tx.".map"); |
479 | $nmap->setmetadata("ows_enable_request","*"); | 481 | $nmap->setmetadata("ows_enable_request","*"); |
480 | - } | 482 | + } |
481 | if($temai3geo == false || empty($layers)){ | 483 | if($temai3geo == false || empty($layers)){ |
482 | $ts = $nmap->getalllayernames(); | 484 | $ts = $nmap->getalllayernames(); |
483 | $nmap->setmetadata("ows_enable_request","*"); | 485 | $nmap->setmetadata("ows_enable_request","*"); |
@@ -489,128 +491,146 @@ else{ | @@ -489,128 +491,146 @@ else{ | ||
489 | $l = $nmap->getlayerbyname($t); | 491 | $l = $nmap->getlayerbyname($t); |
490 | if($l == ""){ | 492 | if($l == ""){ |
491 | $l = $nmap->getlayer(0); | 493 | $l = $nmap->getlayer(0); |
492 | - } | ||
493 | - $permite = $l->getmetadata("permiteogc"); | ||
494 | - if(strtolower($permite) != "nao"){ | ||
495 | - //necessário pq o mapfile pode ter todos os layers como default | ||
496 | - if($temai3geo == false){ | ||
497 | - $l->set("status",MS_OFF); | ||
498 | - } | ||
499 | - else{ | ||
500 | - $l->set("status",MS_DEFAULT); | ||
501 | - } | ||
502 | - $l->setmetadata("ows_title",pegaNome($l)); | ||
503 | - $l->setmetadata("ows_srs",$listaepsg); | ||
504 | - $l->set("group",""); | ||
505 | - //timeout | ||
506 | - $tout = $l->getmetadata("wms_connectiontimeout"); | ||
507 | - if($tout == ""){ | ||
508 | - $l->setmetadata("wms_connectiontimeout",0); | ||
509 | - } | ||
510 | - //essa linha é necessária pq as vezes no mapfile não tem nenhum layer com o nome igual ao nome do mapfile | ||
511 | - if(count($ts)==1 && $temai3geo == true){ | ||
512 | - $l->set("name",$tx); | ||
513 | - } | ||
514 | - $l->setmetadata("gml_include_items","all"); | ||
515 | - $l->set("template","none.htm"); | ||
516 | - $l->set("dump",MS_TRUE); | ||
517 | - $l->setmetadata("WMS_INCLUDE_ITEMS","all"); | ||
518 | - $l->setmetadata("WFS_INCLUDE_ITEMS","all"); | 494 | + } |
495 | + //verifica se ja existe layer com mesmo nome | ||
496 | + if($oMap->getlayerbyname($l->name) == ""){ | ||
497 | + $permite = $l->getmetadata("permiteogc"); | ||
498 | + if(strtolower($permite) != "nao"){ | ||
499 | + //necessário pq o mapfile pode ter todos os layers como default | ||
500 | + if($temai3geo == false){ | ||
501 | + $l->set("status",MS_OFF); | ||
502 | + } | ||
503 | + else{ | ||
504 | + $l->set("status",MS_DEFAULT); | ||
505 | + } | ||
506 | + $l->setmetadata("ows_title",pegaNome($l)); | ||
507 | + $l->setmetadata("ows_srs",$listaepsg); | ||
508 | + $l->set("group",""); | ||
509 | + //timeout | ||
510 | + $tout = $l->getmetadata("wms_connectiontimeout"); | ||
511 | + if($tout == ""){ | ||
512 | + $l->setmetadata("wms_connectiontimeout",0); | ||
513 | + } | ||
514 | + //essa linha é necessária pq as vezes no mapfile não tem nenhum layer com o nome igual ao nome do mapfile | ||
515 | + if(count($ts)==1 && $temai3geo == true){ | ||
516 | + $l->set("name",$tx); | ||
517 | + } | ||
518 | + $l->setmetadata("gml_include_items","all"); | ||
519 | + $l->set("template","none.htm"); | ||
520 | + $l->set("dump",MS_TRUE); | ||
521 | + $l->setmetadata("WMS_INCLUDE_ITEMS","all"); | ||
522 | + $l->setmetadata("WFS_INCLUDE_ITEMS","all"); | ||
519 | 523 | ||
520 | - if(file_exists($locaplic."/temas/miniaturas/".$t.".map.mini.png")){ | ||
521 | - $mini = $proto.$server.dirname($_SERVER['PHP_SELF'])."/temas/miniaturas/".$t.".map.mini.png"; | ||
522 | - $l->setmetadata("wms_attribution_logourl_format","image/png"); | ||
523 | - $l->setmetadata("wms_attribution_logourl_height","50"); | ||
524 | - $l->setmetadata("wms_attribution_logourl_width","50"); | ||
525 | - $l->setmetadata("wms_attribution_logourl_href",$mini); | ||
526 | - } | ||
527 | - if($l->type == MS_LAYER_RASTER && $l->numclasses > 0){ | ||
528 | - $c = $l->getclass(0); | ||
529 | - if($c->name == ""){ | ||
530 | - $c->name = " "; | 524 | + if(file_exists($locaplic."/temas/miniaturas/".$t.".map.mini.png")){ |
525 | + $mini = $proto.$server.dirname($_SERVER['PHP_SELF'])."/temas/miniaturas/".$t.".map.mini.png"; | ||
526 | + $l->setmetadata("wms_attribution_logourl_format","image/png"); | ||
527 | + $l->setmetadata("wms_attribution_logourl_height","50"); | ||
528 | + $l->setmetadata("wms_attribution_logourl_width","50"); | ||
529 | + $l->setmetadata("wms_attribution_logourl_href",$mini); | ||
531 | } | 530 | } |
532 | - } | ||
533 | - //inclui extensao geografica | ||
534 | - $extensao = $l->getmetadata("EXTENSAO"); | ||
535 | - if($extensao == ""){ | ||
536 | - $extensao = $extensaoMap; | ||
537 | - } | ||
538 | - $l->setmetadata("wms_extent",$extensao); | ||
539 | - if (!empty($postgis_mapa)){ | ||
540 | - if ($l->connectiontype == MS_POSTGIS){ | 531 | + if($l->type == MS_LAYER_RASTER && $l->numclasses > 0){ |
532 | + $c = $l->getclass(0); | ||
533 | + if($c->name == ""){ | ||
534 | + $c->name = " "; | ||
535 | + } | ||
536 | + } | ||
537 | + //inclui extensao geografica | ||
538 | + $extensao = $l->getmetadata("EXTENSAO"); | ||
539 | + if($extensao == ""){ | ||
540 | + $extensao = $extensaoMap; | ||
541 | + } | ||
542 | + $l->setmetadata("wms_extent",$extensao); | ||
543 | + if (!empty($postgis_mapa)){ | ||
544 | + if ($l->connectiontype == MS_POSTGIS){ | ||
541 | 545 | ||
542 | - $lcon = $l->connection; | ||
543 | - if (($lcon == " ") || ($lcon == "") || (in_array($lcon,array_keys($postgis_mapa)))){ | ||
544 | - // | ||
545 | - //o metadata CONEXAOORIGINAL guarda o valor original para posterior substituição | ||
546 | - // | ||
547 | - if(($lcon == " ") || ($lcon == "")){ | ||
548 | - $l->set("connection",$postgis_mapa); | ||
549 | - $l->setmetadata("CONEXAOORIGINAL",$lcon); | ||
550 | - } | ||
551 | - else{ | ||
552 | - $l->set("connection",$postgis_mapa[$lcon]); | ||
553 | - $l->setmetadata("CONEXAOORIGINAL",$lcon); | 546 | + $lcon = $l->connection; |
547 | + if (($lcon == " ") || ($lcon == "") || (in_array($lcon,array_keys($postgis_mapa)))){ | ||
548 | + // | ||
549 | + //o metadata CONEXAOORIGINAL guarda o valor original para posterior substituição | ||
550 | + // | ||
551 | + if(($lcon == " ") || ($lcon == "")){ | ||
552 | + $l->set("connection",$postgis_mapa); | ||
553 | + $l->setmetadata("CONEXAOORIGINAL",$lcon); | ||
554 | + } | ||
555 | + else{ | ||
556 | + $l->set("connection",$postgis_mapa[$lcon]); | ||
557 | + $l->setmetadata("CONEXAOORIGINAL",$lcon); | ||
558 | + } | ||
554 | } | 559 | } |
555 | } | 560 | } |
556 | - } | ||
557 | - } | 561 | + } |
558 | 562 | ||
559 | - autoClasses($l,$oMap); | 563 | + autoClasses($l,$oMap); |
560 | 564 | ||
561 | - if($versao > 5){ | ||
562 | - $pr = $l->getProcessing(); | ||
563 | - if(!in_array("LABEL_NO_CLIP=True",$pr)){ | ||
564 | - $l->setprocessing("LABEL_NO_CLIP=True"); | 565 | + if($versao > 5){ |
566 | + $pr = $l->getProcessing(); | ||
567 | + if(!in_array("LABEL_NO_CLIP=True",$pr)){ | ||
568 | + $l->setprocessing("LABEL_NO_CLIP=True"); | ||
569 | + } | ||
570 | + if(!in_array("POLYLINE_NO_CLIP=True",$pr)){ | ||
571 | + $l->setprocessing("POLYLINE_NO_CLIP=True"); | ||
572 | + } | ||
565 | } | 573 | } |
566 | - if(!in_array("POLYLINE_NO_CLIP=True",$pr)){ | ||
567 | - $l->setprocessing("POLYLINE_NO_CLIP=True"); | 574 | + |
575 | + // | ||
576 | + //verifica se existem parametros de substituicao passados via url | ||
577 | + // | ||
578 | + $parametro = $_GET["map_layer_".$l->name."_filter"]; | ||
579 | + //echo $parametro;exit; | ||
580 | + if(!empty($parametro)){ | ||
581 | + $l->setfilter($parametro); | ||
582 | + $cache = false; | ||
568 | } | 583 | } |
584 | + //muda o title se for vazio | ||
585 | + $nclass = $l->numclasses; | ||
586 | + for($i=0;$i<$nclass;$i++){ | ||
587 | + $classe = $l->getclass($i); | ||
588 | + if($classe->title == ""){ | ||
589 | + $classe->title = $classe->name; | ||
590 | + } | ||
591 | + } | ||
592 | + if($nclass == 1){ | ||
593 | + $classe = $l->getclass(0); | ||
594 | + if($classe->name == ""){ | ||
595 | + $classe->title = $l->getmetadata("tema"); | ||
596 | + $classe->set("name",$l->getmetadata("tema")); | ||
597 | + } | ||
598 | + } | ||
599 | + ms_newLayerObj($oMap, $l); | ||
569 | } | 600 | } |
570 | - | ||
571 | - // | ||
572 | - //verifica se existem parametros de substituicao passados via url | ||
573 | - // | ||
574 | - $parametro = $_GET["map_layer_".$l->name."_filter"]; | ||
575 | - //echo $parametro;exit; | ||
576 | - if(!empty($parametro)){ | ||
577 | - $l->setfilter($parametro); | ||
578 | - $cache = false; | ||
579 | - } | ||
580 | - ms_newLayerObj($oMap, $l); | ||
581 | - } | ||
582 | - else{ | ||
583 | - //a camada nao pode ser usada como servico WMS, entao e enviada uma mensagem | ||
584 | - $l->set("data",""); | ||
585 | - $l->set("type",MS_POINT); | ||
586 | - $l->setmetadata("cache","nao"); | ||
587 | - //apaga as classes | ||
588 | - $nclass = $l->numclasses; | ||
589 | - for($i=0;$i<$nclass;$i++){ | ||
590 | - $classe = $l->getclass($i); | ||
591 | - $classe->set("status",MS_DELETE); | 601 | + else{ |
602 | + //a camada nao pode ser usada como servico WMS, entao e enviada uma mensagem | ||
603 | + $l->set("data",""); | ||
604 | + $l->set("type",MS_POINT); | ||
605 | + $l->setmetadata("cache","nao"); | ||
606 | + //apaga as classes | ||
607 | + $nclass = $l->numclasses; | ||
608 | + for($i=0;$i<$nclass;$i++){ | ||
609 | + $classe = $l->getclass($i); | ||
610 | + $classe->set("status",MS_DELETE); | ||
611 | + } | ||
612 | + $l->updatefromstring(' | ||
613 | + LAYER | ||
614 | + SIZEUNITS PIXELS | ||
615 | + TRANSFORM FALSE | ||
616 | + CLASS | ||
617 | + LABEL | ||
618 | + SIZE 10 | ||
619 | + TYPE truetype | ||
620 | + FONT arial | ||
621 | + COLOR 255 0 0 | ||
622 | + POSITION cc | ||
623 | + FORCE true | ||
624 | + END | ||
625 | + END | ||
626 | + FEATURE POINTS 100 100 END | ||
627 | + TEXT "OGC denied" END | ||
628 | + FEATURE POINTS 100 120 END | ||
629 | + TEXT "' . $l->name . '" END | ||
630 | + END | ||
631 | + '); | ||
632 | + ms_newLayerObj($oMap, $l); | ||
592 | } | 633 | } |
593 | - $l->updatefromstring(' | ||
594 | - LAYER | ||
595 | - SIZEUNITS PIXELS | ||
596 | - TRANSFORM FALSE | ||
597 | - CLASS | ||
598 | - LABEL | ||
599 | - SIZE 10 | ||
600 | - TYPE truetype | ||
601 | - FONT arial | ||
602 | - COLOR 255 0 0 | ||
603 | - POSITION cc | ||
604 | - FORCE true | ||
605 | - END | ||
606 | - END | ||
607 | - FEATURE POINTS 100 100 END | ||
608 | - TEXT "OGC denied" END | ||
609 | - FEATURE POINTS 100 120 END | ||
610 | - TEXT "' . $l->name . '" END | ||
611 | - END | ||
612 | - '); | ||
613 | - ms_newLayerObj($oMap, $l); | ||
614 | } | 634 | } |
615 | } | 635 | } |
616 | } | 636 | } |
@@ -767,7 +787,6 @@ else{ | @@ -767,7 +787,6 @@ else{ | ||
767 | } | 787 | } |
768 | } | 788 | } |
769 | } | 789 | } |
770 | - | ||
771 | // | 790 | // |
772 | //a imagem do mapa recebera a legenda | 791 | //a imagem do mapa recebera a legenda |
773 | // | 792 | // |
@@ -787,11 +806,9 @@ else{ | @@ -787,11 +806,9 @@ else{ | ||
787 | $nomeMapfileTmp = str_replace(".map","",$nomeMapfileTmp).".map"; | 806 | $nomeMapfileTmp = str_replace(".map","",$nomeMapfileTmp).".map"; |
788 | restauraConObj($oMap,$postgis_mapa); | 807 | restauraConObj($oMap,$postgis_mapa); |
789 | $oMap->save($nomeMapfileTmp); | 808 | $oMap->save($nomeMapfileTmp); |
790 | - | ||
791 | validaAcessoTemas($oMap,true); | 809 | validaAcessoTemas($oMap,true); |
792 | substituiConObj($oMap,$postgis_mapa); | 810 | substituiConObj($oMap,$postgis_mapa); |
793 | -} | ||
794 | - | 811 | +} |
795 | if(ob_get_contents ()){ | 812 | if(ob_get_contents ()){ |
796 | ob_end_clean(); | 813 | ob_end_clean(); |
797 | } | 814 | } |
@@ -955,50 +972,74 @@ if(isset($_GET["Z"]) && isset($_GET["X"])){ | @@ -955,50 +972,74 @@ if(isset($_GET["Z"]) && isset($_GET["X"])){ | ||
955 | renderNocacheTms(); | 972 | renderNocacheTms(); |
956 | } | 973 | } |
957 | if(strtolower($req->getValueByName("REQUEST")) == "getlegendgraphic"){ | 974 | if(strtolower($req->getValueByName("REQUEST")) == "getlegendgraphic"){ |
958 | - $l = $oMap->getlayer(0); | ||
959 | - if($req->getValueByName("LAYER") == ""){ | ||
960 | - $req->setParameter("LAYER",$l->name); | ||
961 | - } | ||
962 | - //muda o title se for vazio | ||
963 | - $nclass = $l->numclasses; | ||
964 | - for($i=0;$i<$nclass;$i++){ | ||
965 | - $classe = $l->getclass($i); | ||
966 | - if($classe->title === ""){ | ||
967 | - $classe->title = $classe->name; | ||
968 | - } | ||
969 | - } | ||
970 | - if($req->getValueByName("FORMAT") == ""){ | ||
971 | - $req->setParameter("FORMAT","image/png"); | ||
972 | - } | ||
973 | $legenda = $oMap->legend; | 975 | $legenda = $oMap->legend; |
974 | $legenda->set("status",MS_ON); | 976 | $legenda->set("status",MS_ON); |
975 | - $l->set("minscaledenom",0); | ||
976 | - $l->set("maxscaledenom",0); | ||
977 | - if($req->getValueByName("FORMAT") == "text/html"){ | ||
978 | - //$req->setParameter("FORMAT","image/png"); | ||
979 | - $l = $oMap->getlayerbyname($req->getValueByName("LAYER")); | 977 | + $numlayers = $oMap->numlayers; |
978 | + for ($i=0;$i < $numlayers;$i++){ | ||
979 | + $l = $oMap->getlayer($i); | ||
980 | $l->set("status",MS_DEFAULT); | 980 | $l->set("status",MS_DEFAULT); |
981 | - //remove offset de simbolos pontuais | ||
982 | - $nclass = $l->numclasses; | ||
983 | - for($cc = 0; $cc < $nclass; $cc++){ | ||
984 | - $classe = $l->getclass($cc); | ||
985 | - if($classe->numstyles > 0){ | ||
986 | - $estilo = $classe->getstyle(0); | ||
987 | - if($estilo->symbolname != "" && file_exists($estilo->symbolname)){ | ||
988 | - $estilo->set("offsetx",0); | ||
989 | - $estilo->set("offsety",0); | ||
990 | - } | 981 | + if($req->getValueByName("LAYER") == ""){ |
982 | + $req->setParameter("LAYER",$l->name); | ||
983 | + } | ||
984 | + | ||
985 | + //muda o title se for vazio | ||
986 | + /* | ||
987 | + $nclass = $l->numclasses; | ||
988 | + for($i=0;$i<$nclass;$i++){ | ||
989 | + $classe = $l->getclass($i); | ||
990 | + if($classe->title == ""){ | ||
991 | + $classe->title = $classe->name; | ||
992 | + } | ||
993 | + } | ||
994 | + if($nclass == 1){ | ||
995 | + $classe = $l->getclass(0); | ||
996 | + if($classe->name == ""){ | ||
997 | + $classe->title = $l->getmetadata("tema"); | ||
998 | + $classe->set("name",$l->getmetadata("tema")); | ||
991 | } | 999 | } |
1000 | + } | ||
1001 | + */ | ||
1002 | + if($req->getValueByName("FORMAT") == ""){ | ||
1003 | + $req->setParameter("FORMAT","image/png"); | ||
992 | } | 1004 | } |
993 | - $legenda->set("template",$locaplic."/aplicmap/legendaOgc.html"); | ||
994 | - $tmparray["my_tag"] = "value_of_my_tag"; | ||
995 | - if($leg = @$oMap->processlegendtemplate($tmparray)){ | ||
996 | - if (function_exists("mb_convert_encoding")){ | ||
997 | - $leg = mb_convert_encoding($leg,"UTF-8","ISO-8859-1"); | 1005 | + $l->set("minscaledenom",0); |
1006 | + $l->set("maxscaledenom",0); | ||
1007 | + if($req->getValueByName("FORMAT") == "text/html"){ | ||
1008 | + //remove offset de simbolos pontuais | ||
1009 | + $nclass = $l->numclasses; | ||
1010 | + for($cc = 0; $cc < $nclass; $cc++){ | ||
1011 | + $classe = $l->getclass($cc); | ||
1012 | + if($classe->numstyles > 0){ | ||
1013 | + $estilo = $classe->getstyle(0); | ||
1014 | + if($estilo->symbolname != "" && file_exists($estilo->symbolname)){ | ||
1015 | + $estilo->set("offsetx",0); | ||
1016 | + $estilo->set("offsety",0); | ||
1017 | + } | ||
1018 | + } | ||
998 | } | 1019 | } |
1020 | + } | ||
1021 | + } | ||
1022 | + if($req->getValueByName("FORMAT") == "text/html"){ | ||
1023 | + //define qual template utilizar | ||
1024 | + if(empty($_GET["templateLegenda"])){ | ||
1025 | + $legenda->set("template",$locaplic."/aplicmap/legendaOgc.html"); | ||
1026 | + } else { | ||
1027 | + $_GET["templateLegenda"] = str_replace(".htm","",$_GET["templateLegenda"]); | ||
1028 | + $_GET["templateLegenda"] = str_replace(".","",$_GET["templateLegenda"]); | ||
1029 | + if(file_exists($locaplic."/".$_GET["templateLegenda"].".htm")){ | ||
1030 | + $legenda->set("template",$locaplic."/".$_GET["templateLegenda"].".htm"); | ||
1031 | + } else { | ||
1032 | + $legenda->set("template",$locaplic."/aplicmap/legendaOgc.html"); | ||
1033 | + } | ||
1034 | + } | ||
1035 | + $tmparray["my_tag"] = "value_of_my_tag"; | ||
1036 | + if($leg = @$oMap->processlegendtemplate($tmparray)){ | ||
1037 | + if (function_exists("mb_convert_encoding")){ | ||
1038 | + $leg = mb_convert_encoding($leg,"UTF-8","ISO-8859-1"); | ||
1039 | + } | ||
999 | echo $leg; | 1040 | echo $leg; |
1000 | - exit; | ||
1001 | - } | 1041 | + exit; |
1042 | + } | ||
1002 | } | 1043 | } |
1003 | } | 1044 | } |
1004 | 1045 |