Commit 4c4a50ba22a729c81ec5029f745d9fad538e0a0a
1 parent
8ae2738d
Exists in
master
and in
7 other branches
--no commit message
Showing
2 changed files
with
100 additions
and
15 deletions
Show diff stats
classesphp/classe_legenda.php
... | ... | @@ -231,6 +231,20 @@ string de variaveis no formato javascript que permitem montar a legenda. |
231 | 231 | */ |
232 | 232 | function legendaGrafica() |
233 | 233 | { |
234 | + $nomeslayers = $this->mapa->getalllayernames(); | |
235 | + foreach ($nomeslayers as $nomelayer) | |
236 | + { | |
237 | + $layer = $this->mapa->getlayerbyname($nomelayer); | |
238 | + if (($layer->data != "") && (strtoupper($layer->getmetadata("escondido")) != "SIM") && (strtoupper($layer->getmetadata("tema")) != "NAO")) | |
239 | + { | |
240 | + if ($layer->numclasses > 0) | |
241 | + { | |
242 | + $classe = $layer->getclass(0); | |
243 | + if (($classe->name == "") || ($classe->name == " ")) | |
244 | + {$classe->set("name",$layer->getmetadata("tema"));} | |
245 | + } | |
246 | + } | |
247 | + } | |
234 | 248 | $nomeImagem = nomeRandomico(); |
235 | 249 | $imgo = $this->mapa->drawlegend(); |
236 | 250 | $nomer = ($imgo->imagepath)."leg".$nomeImagem.".png"; |
... | ... | @@ -586,8 +600,22 @@ array - "imagecolor"=>$imagecolor,"transparent"=>transparent,"position"=>$positi |
586 | 600 | $transparent = $legenda->transparent; |
587 | 601 | $imagecolor = corRGB($legenda->imagecolor); |
588 | 602 | $label = $legenda->label; |
603 | + $font = $label->font; | |
604 | + if($font == MS_BITMAP) | |
605 | + { | |
606 | + $l = $label->size; | |
607 | + if ($l == MS_TINY){$t = 5;} | |
608 | + if ($l == MS_SMALL){$t = 7;} | |
609 | + if ($l == MS_MEDIUM){$t = 10;} | |
610 | + if ($l == MS_LARGE){$t = 12;} | |
611 | + if ($l == MS_GIANT){$t = 14;} | |
612 | + $labelsize = $t; | |
613 | + } | |
614 | + else | |
589 | 615 | $labelsize = $label->size; |
590 | - return(array("imagecolor"=>$imagecolor,"transparent"=>transparent,"position"=>$position,"status"=>$status,"outlinecolor"=>$outlinecolor,"keyspacingy"=>$keyspacingy,"keyspacingx"=>$keyspacingx,"keysizey"=>$keysizey,"keysizex"=>$keysizex,"height"=>$height,"width"=>$width,"labelsize"=>$labelsize)); | |
616 | + | |
617 | + $tipofonte = $label->type; | |
618 | + return(array("tipofonte"=>$tipofonte,"font"=>$font,"imagecolor"=>$imagecolor,"transparent"=>transparent,"position"=>$position,"status"=>$status,"outlinecolor"=>$outlinecolor,"keyspacingy"=>$keyspacingy,"keyspacingx"=>$keyspacingx,"keysizey"=>$keysizey,"keysizex"=>$keysizex,"height"=>$height,"width"=>$width,"labelsize"=>$labelsize)); | |
591 | 619 | } |
592 | 620 | /* |
593 | 621 | function: aplicaParametrosLegImg |
... | ... | @@ -616,7 +644,7 @@ $heigt |
616 | 644 | |
617 | 645 | $width |
618 | 646 | */ |
619 | - function aplicaParametrosLegImg($imagecolor,$position,$status,$outlinecolor,$keyspacingy,$keyspacingx,$keysizey,$keysizex,$height,$width,$labelsize) | |
647 | + function aplicaParametrosLegImg($fonte,$imagecolor,$position,$status,$outlinecolor,$keyspacingy,$keyspacingx,$keysizey,$keysizex,$height,$width,$labelsize) | |
620 | 648 | { |
621 | 649 | $legenda = $this->mapa->legend; |
622 | 650 | $legenda->set("height",$height); |
... | ... | @@ -642,7 +670,24 @@ $width |
642 | 670 | $cor = explode(",",$imagecolor); |
643 | 671 | $corres->setRGB($cor[0],$cor[1],$cor[2]); |
644 | 672 | $label = $legenda->label; |
645 | - $label->set("size",$labelsize); | |
673 | + | |
674 | + if ($fonte != "bitmap") | |
675 | + { | |
676 | + $label->set("type",MS_TRUETYPE); | |
677 | + $label->set("font",$fonte); | |
678 | + $label->set("size",$labelsize); | |
679 | + } | |
680 | + else | |
681 | + { | |
682 | + $label->set("type",MS_BITMAP); | |
683 | + $t = MS_TINY; | |
684 | + if ($labelsize > 5 ){$t = MS_TINY;} | |
685 | + if ($labelsize >= 7 ){$t = MS_SMALL;} | |
686 | + if ($labelsize >= 10 ){$t = MS_MEDIUM;} | |
687 | + if ($labelsize >= 12 ){$t = MS_LARGE;} | |
688 | + if ($labelsize >= 14 ){$t = MS_GIANT;} | |
689 | + $label->set("size",$t); | |
690 | + } | |
646 | 691 | return("ok"); |
647 | 692 | } |
648 | 693 | } | ... | ... |
classesphp/mapa_controle.php
... | ... | @@ -2204,6 +2204,21 @@ Include: |
2204 | 2204 | $cp->set_data($r); |
2205 | 2205 | break; |
2206 | 2206 | /* |
2207 | +Property: testaLegenda | |
2208 | + | |
2209 | +Testa os parâmetros de definiçăo da legenda inserida no mapa. | |
2210 | + | |
2211 | +Include: | |
2212 | +<classe_legenda.php> | |
2213 | +*/ | |
2214 | + case "testaLegenda": | |
2215 | + include_once("classe_legenda.php"); | |
2216 | + copy($map_file,str_replace(".map","testeleg.map",$map_file)); | |
2217 | + $m = new Legenda(str_replace(".map","testeleg.map",$map_file)); | |
2218 | + $m->aplicaParametrosLegImg($fonte,$imagecolor,$position,$status,$outlinecolor,$keyspacingy,$keyspacingx,$keysizey,$keysizex,$height,$width,$labelsize); | |
2219 | + $cp->set_data($m->legendaGrafica()); | |
2220 | + break; | |
2221 | +/* | |
2207 | 2222 | Property: contagemclasse |
2208 | 2223 | |
2209 | 2224 | Acrescenta a contagem de elementos em cada classe. |
... | ... | @@ -2263,7 +2278,7 @@ Include: |
2263 | 2278 | $utilizacgi = "nao"; |
2264 | 2279 | } |
2265 | 2280 | $m = new Legenda($map_file); |
2266 | - $cp->set_data($m->aplicaParametrosLegImg($imagecolor,$position,$status,$outlinecolor,$keyspacingy,$keyspacingx,$keysizey,$keysizex,$height,$width,$labelsize)); | |
2281 | + $cp->set_data($m->aplicaParametrosLegImg($fonte,$imagecolor,$position,$status,$outlinecolor,$keyspacingy,$keyspacingx,$keysizey,$keysizex,$height,$width,$labelsize)); | |
2267 | 2282 | $m->salva(); |
2268 | 2283 | break; |
2269 | 2284 | /* |
... | ... | @@ -2340,9 +2355,14 @@ Include: |
2340 | 2355 | case "selecaopt": |
2341 | 2356 | include_once("classe_selecao.php"); |
2342 | 2357 | copiaSeguranca($map_file); |
2343 | - $m = new Selecao($map_file,$tema); | |
2344 | 2358 | if(!isset($xy)){$xy = "";} |
2345 | - $cp->set_data($m->selecaoPT($xy,$tipo,$tolerancia)); | |
2359 | + $temas = explode(",",$tema); | |
2360 | + foreach($temas as $tema) | |
2361 | + { | |
2362 | + $m = new Selecao($map_file,$tema); | |
2363 | + $ok[] = $m->selecaoPT($xy,$tipo,$tolerancia); | |
2364 | + } | |
2365 | + $cp->set_data(implode(",",$ok)); | |
2346 | 2366 | break; |
2347 | 2367 | /* |
2348 | 2368 | Property: selecaoext |
... | ... | @@ -2355,8 +2375,13 @@ Include: |
2355 | 2375 | case "selecaoext": |
2356 | 2376 | include_once("classe_selecao.php"); |
2357 | 2377 | copiaSeguranca($map_file); |
2358 | - $m = new Selecao($map_file,$tema); | |
2359 | - $cp->set_data($m->selecaoEXT($tipo)); | |
2378 | + $temas = explode(",",$tema); | |
2379 | + foreach($temas as $tema) | |
2380 | + { | |
2381 | + $m = new Selecao($map_file,$tema); | |
2382 | + $ok[] = $m->selecaoEXT($tipo); | |
2383 | + } | |
2384 | + $cp->set_data(implode(",",$ok)); | |
2360 | 2385 | break; |
2361 | 2386 | /* |
2362 | 2387 | Property: selecaobox |
... | ... | @@ -2369,8 +2394,13 @@ Include: |
2369 | 2394 | case "selecaobox": |
2370 | 2395 | include_once("classe_selecao.php"); |
2371 | 2396 | copiaSeguranca($map_file); |
2372 | - $m = new Selecao($map_file,$tema); | |
2373 | - $cp->set_data($m->selecaoBOX($tipo,$ext)); | |
2397 | + $temas = explode(",",$tema); | |
2398 | + foreach($temas as $tema) | |
2399 | + { | |
2400 | + $m = new Selecao($map_file,$tema); | |
2401 | + $ok[] = $m->selecaoBOX($tipo,$ext); | |
2402 | + } | |
2403 | + $cp->set_data(implode(",",$ok)); | |
2374 | 2404 | break; |
2375 | 2405 | |
2376 | 2406 | /* |
... | ... | @@ -2398,8 +2428,13 @@ Include: |
2398 | 2428 | case "selecaotema": |
2399 | 2429 | include_once("classe_selecao.php"); |
2400 | 2430 | copiaSeguranca($map_file); |
2401 | - $m = new Selecao($map_file,$tema); | |
2402 | - $cp->set_data($m->selecaoTema($temao,$tipo)); | |
2431 | + $temas = explode(",",$tema); | |
2432 | + foreach($temas as $tema) | |
2433 | + { | |
2434 | + $m = new Selecao($map_file,$tema); | |
2435 | + $ok[] = $m->selecaoTema($temao,$tipo); | |
2436 | + } | |
2437 | + $cp->set_data(implode(",",$ok)); | |
2403 | 2438 | break; |
2404 | 2439 | /* |
2405 | 2440 | Property: selecaoPoli |
... | ... | @@ -2603,9 +2638,14 @@ function selecaoPoli($xs,$ys,$tema,$tipo) |
2603 | 2638 | { |
2604 | 2639 | global $map_file,$cp; |
2605 | 2640 | include_once("classe_selecao.php"); |
2606 | - $m = new Selecao($map_file,$tema); | |
2607 | - $cp->set_data($m->selecaoPorPoligono($tipo,$xs,$ys)); | |
2608 | - $m->salva(); | |
2641 | + $temas = explode(",",$tema); | |
2642 | + foreach($temas as $tema) | |
2643 | + { | |
2644 | + $m = new Selecao($map_file,$tema); | |
2645 | + $ok[] = $m->selecaoPorPoligono($tipo,$xs,$ys); | |
2646 | + $m->salva(); | |
2647 | + } | |
2648 | + $cp->set_data(implode(",",$ok)); | |
2609 | 2649 | } |
2610 | 2650 | /* |
2611 | 2651 | Function: redesenhaMapa | ... | ... |