Commit 38528aca4df1190f59fab6630a98ea029cee645c
1 parent
9c81c685
Exists in
master
and in
7 other branches
inclusão de zoom para o tema na ferramenta de teste de mapfile
Showing
1 changed file
with
31 additions
and
1 deletions
Show diff stats
testamapfile.php
| ... | ... | @@ -127,7 +127,9 @@ function verifica($map) |
| 127 | 127 | if ($layern->data == "") |
| 128 | 128 | $dados = $layern->connection; |
| 129 | 129 | else |
| 130 | - $dados = $layern->data; | |
| 130 | + $dados = $layern->data; | |
| 131 | + | |
| 132 | + zoomTema($layern,$mapa); | |
| 131 | 133 | } |
| 132 | 134 | if (isset($postgis_mapa)) |
| 133 | 135 | { |
| ... | ... | @@ -198,4 +200,32 @@ function verifica($map) |
| 198 | 200 | $objImagem->free(); |
| 199 | 201 | } |
| 200 | 202 | } |
| 203 | +function zoomTema($layer,&$mapa) | |
| 204 | +{ | |
| 205 | + $prjMapa = $mapa->getProjection(); | |
| 206 | + $prjTema = $layer->getProjection(); | |
| 207 | + $extatual = $mapa->extent; | |
| 208 | + $ret = $layer->getmetadata("extensao"); | |
| 209 | + $ct = $layer->connectiontype; | |
| 210 | + if(($ret == "") && ($ct != 1)) | |
| 211 | + {return;} | |
| 212 | + if ($ret == "") | |
| 213 | + { | |
| 214 | + $ret = $layer->getextent(); | |
| 215 | + //reprojeta o retangulo | |
| 216 | + if (($prjTema != "") && ($prjMapa != $prjTema)) | |
| 217 | + { | |
| 218 | + $projInObj = ms_newprojectionobj($prjTema); | |
| 219 | + $projOutObj = ms_newprojectionobj($prjMapa); | |
| 220 | + $ret->project($projInObj, $projOutObj); | |
| 221 | + } | |
| 222 | + $extatual->setextent($ret->minx,$ret->miny,$ret->maxx,$ret->maxy); | |
| 223 | + } | |
| 224 | + else | |
| 225 | + { | |
| 226 | + $ret = explode(" ",$ret); | |
| 227 | + $extatual->setextent($ret[0],$ret[1],$ret[2],$ret[3]); | |
| 228 | + } | |
| 229 | +} | |
| 230 | + | |
| 201 | 231 | ?> |
| 202 | 232 | \ No newline at end of file | ... | ... |