Commit e2e0ef616dd12856f2a15fe2e40c870af4f45709
1 parent
0aac48de
Exists in
master
and in
7 other branches
ticket #28 - acrescentada a possibilidade de inclusão de temas dinâmicos (temas …
…que são programas em PHP) no menu de temas
Showing
3 changed files
with
84 additions
and
52 deletions
Show diff stats
classesphp/classe_mapa.php
| ... | ... | @@ -661,66 +661,73 @@ $locaplic - string Diretório onde fica a aplicação. |
| 661 | 661 | foreach ($temas as $nome) |
| 662 | 662 | { |
| 663 | 663 | $nomemap = ""; |
| 664 | - if (file_exists($locaplic."/temas/".$nome.".map")) | |
| 665 | - {$nomemap = $locaplic."/temas/".$nome.".map";} | |
| 666 | - if (file_exists($nome)) | |
| 667 | - {$nomemap = $nome;} | |
| 668 | - if (file_exists($nome.".map")) | |
| 669 | - {$nomemap = $nome.".map";} | |
| 670 | - if ($nomemap != "") | |
| 664 | + // | |
| 665 | + //verifica se o tema é um arquivo php | |
| 666 | + // | |
| 667 | + if (file_exists($locaplic."/temas/".$nome.".php")) | |
| 668 | + {include_once($locaplic."/temas/".$nome.".php");} | |
| 669 | + else | |
| 671 | 670 | { |
| 672 | - $nmap = ms_newMapObj($nomemap); | |
| 673 | - $novosnomes = $nmap->getAllLayerNames(); | |
| 674 | - //define nomes unicos para os temas | |
| 675 | - foreach ($novosnomes as $n) | |
| 676 | - {$nomeunico[$n] = nomeRandomico();} | |
| 677 | - //altera os temas para incluir o nome unico | |
| 678 | - foreach ($novosnomes as $n) | |
| 671 | + if (file_exists($locaplic."/temas/".$nome.".map")) | |
| 672 | + {$nomemap = $locaplic."/temas/".$nome.".map";} | |
| 673 | + if (file_exists($nome)) | |
| 674 | + {$nomemap = $nome;} | |
| 675 | + if (file_exists($nome.".map")) | |
| 676 | + {$nomemap = $nome.".map";} | |
| 677 | + if ($nomemap != "") | |
| 679 | 678 | { |
| 680 | - $nlayer = $nmap->getlayerbyname($n); | |
| 681 | - // | |
| 682 | - //muda para RGB para melhorar o desenho da imagem raster | |
| 683 | - // | |
| 684 | - if($nlayer->type == MS_LAYER_RASTER) | |
| 685 | - { | |
| 686 | - $of = $this->mapa->outputformat; | |
| 687 | - $of->set("imagemode",MS_IMAGEMODE_RGB); | |
| 688 | - } | |
| 689 | - $nlayer->set("status",MS_DEFAULT); | |
| 690 | - $nlayer->setmetadata("nomeoriginal",$nlayer->name); | |
| 691 | - $nlayer->set("name",$nomeunico[$n]); | |
| 692 | - //altera o nome do grupo se existir | |
| 693 | - if ($nlayer->group != " ") | |
| 679 | + $nmap = ms_newMapObj($nomemap); | |
| 680 | + $novosnomes = $nmap->getAllLayerNames(); | |
| 681 | + //define nomes unicos para os temas | |
| 682 | + foreach ($novosnomes as $n) | |
| 683 | + {$nomeunico[$n] = nomeRandomico();} | |
| 684 | + //altera os temas para incluir o nome unico | |
| 685 | + foreach ($novosnomes as $n) | |
| 694 | 686 | { |
| 695 | - $lr = $nlayer->group; | |
| 696 | - $nlayer->set("group",$nomeunico[$lr]); | |
| 697 | - } | |
| 698 | - ms_newLayerObj($this->mapa, $nlayer); | |
| 699 | - $l = $this->mapa->getlayerbyname($nlayer->name); | |
| 700 | - //reposiciona o layer se for o caso | |
| 701 | - if ($l->group == "") | |
| 702 | - { | |
| 703 | - $ltipo = $l->type; | |
| 704 | - if (($ltipo == 2) || ($ltipo == 3))//poligono = 2 | |
| 687 | + $nlayer = $nmap->getlayerbyname($n); | |
| 688 | + // | |
| 689 | + //muda para RGB para melhorar o desenho da imagem raster | |
| 690 | + // | |
| 691 | + if($nlayer->type == MS_LAYER_RASTER) | |
| 705 | 692 | { |
| 706 | - $indicel = $l->index; | |
| 707 | - $numlayers = $this->mapa->numlayers; | |
| 708 | - $nummove = 0; | |
| 709 | - for ($i = $numlayers-1;$i > 0;$i--) | |
| 710 | - { | |
| 711 | - $layerAbaixo = $this->mapa->getlayer($i); | |
| 712 | - $tipo = $layerAbaixo->type; | |
| 713 | - if (($tipo != 2) && ($tipo != 3)) | |
| 714 | - {$nummove++;} | |
| 715 | - } | |
| 716 | - if ($nummove > 2) | |
| 693 | + $of = $this->mapa->outputformat; | |
| 694 | + $of->set("imagemode",MS_IMAGEMODE_RGB); | |
| 695 | + } | |
| 696 | + $nlayer->set("status",MS_DEFAULT); | |
| 697 | + $nlayer->setmetadata("nomeoriginal",$nlayer->name); | |
| 698 | + $nlayer->set("name",$nomeunico[$n]); | |
| 699 | + //altera o nome do grupo se existir | |
| 700 | + if ($nlayer->group != " ") | |
| 701 | + { | |
| 702 | + $lr = $nlayer->group; | |
| 703 | + $nlayer->set("group",$nomeunico[$lr]); | |
| 704 | + } | |
| 705 | + ms_newLayerObj($this->mapa, $nlayer); | |
| 706 | + $l = $this->mapa->getlayerbyname($nlayer->name); | |
| 707 | + //reposiciona o layer se for o caso | |
| 708 | + if ($l->group == "") | |
| 709 | + { | |
| 710 | + $ltipo = $l->type; | |
| 711 | + if (($ltipo == 2) || ($ltipo == 3))//poligono = 2 | |
| 717 | 712 | { |
| 718 | - for ($i=0;$i<=($nummove - 3);$i++) | |
| 713 | + $indicel = $l->index; | |
| 714 | + $numlayers = $this->mapa->numlayers; | |
| 715 | + $nummove = 0; | |
| 716 | + for ($i = $numlayers-1;$i > 0;$i--) | |
| 719 | 717 | { |
| 720 | - $this->mapa->movelayerup($indicel); | |
| 718 | + $layerAbaixo = $this->mapa->getlayer($i); | |
| 719 | + $tipo = $layerAbaixo->type; | |
| 720 | + if (($tipo != 2) && ($tipo != 3)) | |
| 721 | + {$nummove++;} | |
| 722 | + } | |
| 723 | + if ($nummove > 2) | |
| 724 | + { | |
| 725 | + for ($i=0;$i<=($nummove - 3);$i++) | |
| 726 | + { | |
| 727 | + $this->mapa->movelayerup($indicel); | |
| 728 | + } | |
| 721 | 729 | } |
| 722 | 730 | } |
| 723 | - | |
| 724 | 731 | } |
| 725 | 732 | } |
| 726 | 733 | } | ... | ... |
menutemas/menutemas.xml
| ... | ... | @@ -112,6 +112,12 @@ File: i3geo/menutemas/menutemas.xml |
| 112 | 112 | <TDESC></TDESC> |
| 113 | 113 | <TLINK></TLINK> |
| 114 | 114 | </TEMA> |
| 115 | + <TEMA> | |
| 116 | + <TID>testephp</TID> | |
| 117 | + <TNOME>Teste de inclusao de tema PHP</TNOME> | |
| 118 | + <TDESC></TDESC> | |
| 119 | + <TLINK></TLINK> | |
| 120 | + </TEMA> | |
| 115 | 121 | </SGRUPO> |
| 116 | 122 | </GRUPO> |
| 117 | 123 | </TEMASGEO> |
| 118 | 124 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | +<?php | |
| 2 | +// | |
| 3 | +//esse programa é incluido na classe classesphp/classe_mapa.php | |
| 4 | +//herdando os objetos | |
| 5 | +//$this->mapa | |
| 6 | +//$this->arquivo | |
| 7 | +// | |
| 8 | +// exemplo | |
| 9 | +// | |
| 10 | +$layer = $this->mapa->getlayerbyname("copyright"); | |
| 11 | +$layer->set("status",MS_DEFAULT); | |
| 12 | +$shp = ms_newshapeobj(MS_SHAPE_POINT); | |
| 13 | +$shp->set("text","teste .... teste"); | |
| 14 | +$lin = ms_newlineobj(); | |
| 15 | +$lin->addxy(200,100); | |
| 16 | +$shp->add($lin); | |
| 17 | +$layer->addfeature($shp); | |
| 18 | +$shp->free(); | |
| 19 | +?> | |
| 0 | 20 | \ No newline at end of file | ... | ... |