Commit 5179238e38cb7f2c79628cd2b6fc3e3d2b0ae756

Authored by Edmar Moretti
1 parent 4a92d8f9

--no commit message

Showing 1 changed file with 35 additions and 4 deletions   Show diff stats
classesphp/classe_legenda.php
@@ -92,7 +92,13 @@ class Legenda @@ -92,7 +92,13 @@ class Legenda
92 92
93 Localização da aplicação 93 Localização da aplicação
94 */ 94 */
95 - protected $localaplicacao; 95 + protected $localaplicacao;
  96 + /*
  97 + Variavel: $v
  98 +
  99 + Versão atual do Mapserver (primeiro dígito)
  100 + */
  101 + public $v;
96 /* 102 /*
97 Function: __construct 103 Function: __construct
98 104
@@ -116,6 +122,8 @@ $template - nome do template para processar a legenda @@ -116,6 +122,8 @@ $template - nome do template para processar a legenda
116 include_once($locaplic."/funcoes_gerais.php"); 122 include_once($locaplic."/funcoes_gerais.php");
117 else 123 else
118 include_once("funcoes_gerais.php"); 124 include_once("funcoes_gerais.php");
  125 + $this->v = versao();
  126 + $this->v = $this->v["principal"];
119 $this->localaplicacao = $locaplic; 127 $this->localaplicacao = $locaplic;
120 if($map_file == "") 128 if($map_file == "")
121 {return;} 129 {return;}
@@ -438,6 +446,7 @@ Exclui um estilo de uma classe. @@ -438,6 +446,7 @@ Exclui um estilo de uma classe.
438 $classe = $this->layer->getclass($classe); 446 $classe = $this->layer->getclass($classe);
439 $classe->deletestyle($estilo); 447 $classe->deletestyle($estilo);
440 $this->layer->removeMetaData("cache"); 448 $this->layer->removeMetaData("cache");
  449 + return "ok";
441 } 450 }
442 /* 451 /*
443 function: adicionaEstilo 452 function: adicionaEstilo
@@ -610,6 +619,15 @@ string com o tipo do layer,id do estilo,outlinecolor,backgroundcolor,color,symbo @@ -610,6 +619,15 @@ string com o tipo do layer,id do estilo,outlinecolor,backgroundcolor,color,symbo
610 $linha[] = $estilo->symbolname; 619 $linha[] = $estilo->symbolname;
611 $linha[] = $estilo->size; 620 $linha[] = $estilo->size;
612 $linha[] = $estilo->opacity; 621 $linha[] = $estilo->opacity;
  622 + if($this->v == 6){
  623 + $linha[] = $estilo->width;
  624 + $s = $estilo->symbol;
  625 + $linha[] = implode(" ",$s->getPatternArray);
  626 + }
  627 + else{
  628 + $linha[] = "";
  629 + $linha[] = "";
  630 + }
613 $linhas[] = $tipoLayer."#".implode("#",$linha); 631 $linhas[] = $tipoLayer."#".implode("#",$linha);
614 } 632 }
615 //retorna tipo do layer,id do estilo,outlinecolor,backgroundcolor,color,symbolname,size 633 //retorna tipo do layer,id do estilo,outlinecolor,backgroundcolor,color,symbolname,size
@@ -638,11 +656,20 @@ $size - Tamanho que será aplicado ao símbolo. @@ -638,11 +656,20 @@ $size - Tamanho que será aplicado ao símbolo.
638 656
639 $opacidade - Opacidade 657 $opacidade - Opacidade
640 */ 658 */
641 - function aplicaParametro($classe,$estilo,$outlinecolor,$backgroundcolor,$color,$symbolname,$size,$opacidade) 659 + function aplicaParametro($classe,$estilo,$outlinecolor,$backgroundcolor,$color,$symbolname,$size,$opacidade,$width,$pattern)
642 { 660 {
643 if(!$this->layer){return "erro";} 661 if(!$this->layer){return "erro";}
  662 + if(!empty($pattern))
  663 + {$pattern = str_replace(","," ",$pattern);}
644 $classe = $this->layer->getclass($classe); 664 $classe = $this->layer->getclass($classe);
645 - $estilo = $classe->getstyle($estilo); 665 + //isso é necessário pq o mapserver não consegue apagar o nome de um estilo
  666 + if(isset($symbolname) && ($symbolname == "" || $symbolname == "0")){
  667 + $classe->deletestyle($estilo);
  668 + $estilo = ms_newStyleObj($classe);
  669 + }
  670 + else{
  671 + $estilo = $classe->getstyle($estilo);
  672 + }
646 if (isset($outlinecolor)) 673 if (isset($outlinecolor))
647 { 674 {
648 $cor = $estilo->outlinecolor; 675 $cor = $estilo->outlinecolor;
@@ -661,7 +688,7 @@ $opacidade - Opacidade @@ -661,7 +688,7 @@ $opacidade - Opacidade
661 $nc = explode(",",$color); 688 $nc = explode(",",$color);
662 $cor->setRGB($nc[0],$nc[1],$nc[2]); 689 $cor->setRGB($nc[0],$nc[1],$nc[2]);
663 } 690 }
664 - if ((isset($symbolname)) && ($symbolname != "")) 691 + if((isset($symbolname)) && ($symbolname != ""))
665 { 692 {
666 if(is_numeric($symbolname)) 693 if(is_numeric($symbolname))
667 {$estilo->set("symbol",$symbolname);} 694 {$estilo->set("symbol",$symbolname);}
@@ -670,6 +697,10 @@ $opacidade - Opacidade @@ -670,6 +697,10 @@ $opacidade - Opacidade
670 } 697 }
671 if ((isset ($size)) && ($size != "-1")) 698 if ((isset ($size)) && ($size != "-1"))
672 {$estilo->set("size",$size);} 699 {$estilo->set("size",$size);}
  700 + if ((isset ($width)) && ($width != "-1") && ($this->v == 6))
  701 + {$estilo->set("width",$width);}
  702 + if ((isset ($pattern)) && ($pattern != "-1") && ($this->v == 6))
  703 + {$estilo->updatefromstring("STYLE PATTERN ".$pattern." END");}
673 if(isset($opacidade)) 704 if(isset($opacidade))
674 {$estilo->set("opacity",$opacidade);} 705 {$estilo->set("opacity",$opacidade);}
675 if ($this->layer->getmetadata("sld") != "") 706 if ($this->layer->getmetadata("sld") != "")