Commit d7ae5ea6eb842f7df4ae8586662afec4b287b69e
1 parent
687e539c
Exists in
master
and in
7 other branches
Inclusão de parâmetros de inicialização em ini_i3geo.js
Showing
6 changed files
with
225 additions
and
152 deletions
Show diff stats
admin/admin.db
No preview for this file type
classesphp/classe_shp.php
... | ... | @@ -485,11 +485,11 @@ $para - linha|poligono |
485 | 485 | $this->layer->set("template","none.htm"); |
486 | 486 | $diretorio = dirname($this->arquivo); |
487 | 487 | $tipol = MS_SHP_ARC; |
488 | - $tipos = MS_SHAPE_LINE; | |
488 | + //$tipos = MS_SHAPE_LINE; | |
489 | 489 | if ($para == "poligono") |
490 | 490 | { |
491 | 491 | $tipol = MS_SHP_POLYGON; |
492 | - $tipos = MS_SHAPE_POLYGON; | |
492 | + //$tipos = MS_SHAPE_POLYGON; | |
493 | 493 | } |
494 | 494 | $novonomelayer = nomeRandomico(); |
495 | 495 | $nomeshp = $diretorio."/".$novonomelayer; | ... | ... |
interface/config.php
... | ... | @@ -46,10 +46,9 @@ i3GEO.finalizaAPI = function() { |
46 | 46 | //indica se a opcao de navegacao nas pastas do servidor sera ativada |
47 | 47 | i3GEO.arvoreDeTemas.OPCOESADICIONAIS.navegacaoDir = true; |
48 | 48 | i3GEO.janela.TRANSICAOSUAVE = true; |
49 | -//desliga a camada com o mapa mundi | |
50 | -i3GEO.configura.mashuppar = "&desligar=mundo"; | |
49 | + | |
51 | 50 | //i3GEO.configura.guardaExtensao = false; |
52 | -//i3GEO.configura.mashuppar = "&mapext=-75 -22 -40 7"; | |
51 | + | |
53 | 52 | (function() { |
54 | 53 | if(typeof ol != "undefined" && i3GEO.Interface.openlayers.googleLike === false){ |
55 | 54 | var eng = new ol.layer.Tile( | ... | ... |
interface/openlayersdebug.htm
... | ... | @@ -542,33 +542,33 @@ |
542 | 542 | var parametrosMapa = { |
543 | 543 | //arquivo mapfile que servira de base para a criacao do mapa. Por default, sao utilizados os arquivos existentes em i3geo/aplicmap (geral1windows, geral1,...) |
544 | 544 | //Essa variavel pode ser definida em ms_configura tambem. Se nao estiver definida em nenhum lugar, o i3Geo tentara descobrir o arquivo adequado a ser utilizado. Você pode utilizar essa opcao para abrir um mapa com as camadas que você quiser, mas para evitar redundâncias, prefira o uso de &temasa |
545 | - mapfilebase: "", //base: "", | |
546 | - //lista com os nomes dos layers existentes em mapfilebase que serao desligados | |
547 | - //util para evitar que determinadas camadas default sejam mostradas em determinados tipos de interface | |
548 | - layersoff: "", //desligar | |
545 | + mapfilebase: "", | |
549 | 546 | //extensao geografica do mapa |
550 | 547 | //deve ser definida em coordenadas no formato decimos de grau e na projecao geografica na sequencia xmin ymin xmax ymax |
551 | - mapext: [], //mapext como string | |
548 | + mapext: [], | |
552 | 549 | //perfil utilizado para restringir os menus de temas mostrando apenas os que correspondem a determinado perfil |
553 | 550 | perfil: "", |
554 | 551 | //layers que serao adicionados ao mapa. |
555 | 552 | //Cada layer corresponde ao nome do mapfile existente na pasta i3geo/temas sem a extensao '.map' |
556 | 553 | layers: { |
557 | 554 | //array com a lista dos layers que serao adicionados e ligados (visiveis) |
558 | - on:[], //temasa | |
555 | + add:["_lbiomashp"], | |
559 | 556 | //array com a lista dos layers que serao adicionados mas nao ligados |
560 | - off:[], //layers | |
557 | + on:["_lbiomashp"], | |
558 | + //array com os layers desligados | |
559 | + off: [] | |
561 | 560 | }, |
562 | 561 | //lista de coordenadas x e y que serao adicionadas como pontos no mapa |
563 | 562 | points: { |
564 | 563 | //array com a lista de coordenadas |
565 | - coord: [], //pontos | |
564 | + coord: [], | |
566 | 565 | //titulo da nova camada |
567 | - title: "" //nometemapontos | |
566 | + title: "" | |
568 | 567 | }, |
569 | 568 | //lista de coordenadas x e y que serao adicionadas como linhas no mapa |
570 | 569 | lines: { |
571 | 570 | //array de arrays com a lista de coordenadas de cada linha |
571 | + //exemplo [[-54,-12,-50,-12],[-50,-1,-50,-2,-50,-3]] | |
572 | 572 | coord: [[]], |
573 | 573 | //titulo da nova camada |
574 | 574 | title:"" |
... | ... | @@ -576,42 +576,44 @@ |
576 | 576 | //lista de coordenadas x e y que serao adicionadas como poligonos no mapa |
577 | 577 | polygons: { |
578 | 578 | //array de arrays com a lista de coordenadas de cada poligono. A primeira coordenada deve ser igual a ultima. |
579 | - coord: [[]], //poligonos | |
579 | + //exemplo [[-50,-1,-48,-2,-50,-3,-50,-1]] | |
580 | + coord: [[]], | |
580 | 581 | //titulo da nova camada |
581 | - title:"" //nometemapoligonos | |
582 | + title:"" | |
582 | 583 | }, |
583 | 584 | //insere elementos no mapa com coordenadas definidas em wkt |
584 | 585 | wkt: { |
585 | 586 | //string no formato wkt |
586 | - coord: "", //wkt | |
587 | + coord: "", | |
587 | 588 | //titulo da nova camada |
588 | - title: "" //nometemawkt | |
589 | + title: "" | |
589 | 590 | }, |
590 | 591 | //simbolo que sera utilizado para desenhar os elementos inseridos |
591 | 592 | symbol: { |
592 | 593 | //codigo do simbolo conforme definido em i3geo/symbols |
593 | - name: "", //simbolo | |
594 | - color: "", //corsimbolo | |
594 | + name: "", | |
595 | + //em rgb, exemplo "0 255 0" | |
596 | + color: "", | |
595 | 597 | //em pixels |
596 | - size: "", //tamanhosimbolo | |
598 | + size: "" | |
597 | 599 | }, |
598 | 600 | //arquivo KML que sera incluido no mapa. Valido apenas na interface google maps |
599 | 601 | kml: { |
600 | - url: "" //kmlurl | |
602 | + url: "" | |
601 | 603 | }, |
602 | 604 | //endereco de um WMS (sera incluido como uma camada no mapa) |
603 | 605 | wms: { |
604 | - url: "", //url_wms | |
605 | - layer: "", //layer_wms | |
606 | - style: "", //style_wms | |
607 | - title: "", //nome_wms | |
608 | - srs: "", //srs_wms | |
609 | - imagetype: "", //image_wms | |
610 | - version: "", //versao_wms | |
606 | + url: "", | |
607 | + layer: "", | |
608 | + style: "", | |
609 | + title: "", | |
610 | + srs: "", | |
611 | + imagetype: "", | |
612 | + version: "" | |
611 | 613 | }, |
612 | 614 | //filtros que serao aplicados aos layers. Utilize a expressaso conforme definido na documentacao |
613 | 615 | //do mapserver, exemplo |
614 | - //{layer: "bioma",expression: "(('[CD_LEGENDA]'='CAATINGA'))"} ou {layer: "bioma",expression: "cd_legenda='CAATINGA'"} | |
616 | + //{layer: "_lbiomashp",expression: "(('[CD_LEGENDA]'='CAATINGA'))"} ou {layer: "_lbiomashp",expression: "cd_legenda='CAATINGA'"} | |
615 | 617 | filters: [{ |
616 | 618 | layer: "", |
617 | 619 | expression: "" | ... | ... |
js/ini_i3geo.js
... | ... | @@ -303,11 +303,13 @@ var i3GEO = { |
303 | 303 | contadorAtualiza : 0, |
304 | 304 | //atalho para as funcoes cria e inicia com a possibilidade de aplicacao de parametros |
305 | 305 | init: function(parametrosMapa){ |
306 | - var mashuppar; | |
306 | + if (typeof (console) !== 'undefined') | |
307 | + console.info("i3GEO.init()"); | |
308 | + | |
307 | 309 | if(parametrosMapa && parametrosMapa != ""){ |
308 | - mashuppar = i3GEO.parametrosMapa2mashuppar(parametrosMapa); | |
310 | + i3GEO.configura.mashuppar = i3GEO.parametrosMapa2mashuppar(parametrosMapa); | |
309 | 311 | } else { |
310 | - mashuppar = ""; | |
312 | + i3GEO.configura.mashuppar = ""; | |
311 | 313 | } |
312 | 314 | i3GEO.cria(); |
313 | 315 | i3GEO.inicia(); |
... | ... | @@ -316,8 +318,115 @@ var i3GEO = { |
316 | 318 | //os parametros utilizados sao os mesmos disponiveis em ms_criamapa.php |
317 | 319 | //na versao 7 os nomes dos parametros foram modificados para facilitar seu uso |
318 | 320 | //essa funcao faz a conversao dessa nova nomenclatura para poder compatibilizar com a sintaxe utilizada em mashuppar |
319 | - parametrosMapa2mashuppar: function(parametrosMapa){ | |
321 | + parametrosMapa2mashuppar: function(p){ | |
322 | + if (typeof (console) !== 'undefined') | |
323 | + console.info("i3GEO.parametrosMapa2mashuppar()"); | |
324 | + | |
325 | + var par = []; | |
326 | + if(p.mapfilebase && p.mapfilebase != ""){ | |
327 | + par.push("&base="+p.mapfilebase); | |
328 | + } | |
329 | + if(p.mapext && p.mapext != "" && p.mapext.length == 4){ | |
330 | + par.push("&mapext="+p.mapext.join(",")); | |
331 | + } | |
332 | + if(p.perfil && p.perfil != ""){ | |
333 | + par.push("&perfil="+p.perfil); | |
334 | + } | |
335 | + if(p.layers){ | |
336 | + if(p.layers.add && p.layers.add.length > 0){ | |
337 | + par.push("&temasa="+p.layers.add.join(",")); | |
338 | + } | |
339 | + if(p.layers.on && p.layers.on.length > 0){ | |
340 | + par.push("&layers="+p.layers.on.join(",")); | |
341 | + } | |
342 | + if(p.layers.off && p.layers.off.length > 0){ | |
343 | + par.push("&desligar="+p.layers.off.join(",")); | |
344 | + } | |
345 | + } | |
346 | + if(p.points && p.points.length > 0){ | |
347 | + par.push("&nometemapontos="+p.points.title); | |
348 | + par.push("&pontos="+p.points.coord.join(",")); | |
349 | + } | |
350 | + if(p.lines){ | |
351 | + var n = []; | |
352 | + jQuery.each( p.lines.coord, function(index, value) { | |
353 | + if(value.length > 0){ | |
354 | + n.push(value.join(" ")); | |
355 | + } | |
356 | + }); | |
357 | + if(n.length > 0){ | |
358 | + par.push("&nometemalinhas="+p.lines.title); | |
359 | + par.push("&linhas="+n.join(",")); | |
360 | + } | |
361 | + } | |
362 | + if(p.polygons){ | |
363 | + var n = []; | |
364 | + jQuery.each( p.polygons.coord, function(index, value) { | |
365 | + if(value.length > 0){ | |
366 | + n.push(value.join(" ")); | |
367 | + } | |
368 | + }); | |
369 | + if(n.length > 0){ | |
370 | + par.push("&nometemapoligonos="+p.polygons.title); | |
371 | + par.push("&poligonos="+n.join(",")); | |
372 | + } | |
373 | + } | |
374 | + if(p.wkt && p.wkt.coord != ""){ | |
375 | + par.push("&nometemawkt="+p.wkt.title); | |
376 | + par.push("&wkt="+p.wkt.coord); | |
377 | + } | |
378 | + if(p.symbol){ | |
379 | + if(p.symbol.name != ""){ | |
380 | + par.push("&simbolo="+p.symbol.name); | |
381 | + } | |
382 | + if(p.symbol.color != ""){ | |
383 | + par.push("&corsimbolo="+p.symbol.color); | |
384 | + } | |
385 | + if(p.symbol.size != ""){ | |
386 | + par.push("&tamanhosimbolo="+p.symbol.size); | |
387 | + } | |
388 | + } | |
389 | + if(p.kml && p.kml.url != ""){ | |
390 | + par.push("&kmlurl="+p.kml.url); | |
391 | + } | |
392 | + if(p.wms && p.wms.url != ""){ | |
393 | + if(p.wms.url != ""){ | |
394 | + par.push("&url_wms="+p.wms.url); | |
395 | + } | |
396 | + if(p.wms.layer != ""){ | |
397 | + par.push("&layer_wms="+p.wms.layer); | |
398 | + } | |
399 | + if(p.wms.style != ""){ | |
400 | + par.push("&style_wms="+p.wms.style); | |
401 | + } | |
402 | + if(p.wms.title != ""){ | |
403 | + par.push("&nome_wms="+p.wms.title); | |
404 | + } | |
405 | + if(p.wms.srs != ""){ | |
406 | + par.push("&srs_wms="+p.wms.srs); | |
407 | + } | |
408 | + if(p.wms.imagetype != ""){ | |
409 | + par.push("&image_wms="+p.wms.imagetype); | |
410 | + } | |
411 | + if(p.wms.version != ""){ | |
412 | + par.push("&versao_wms="+p.wms.version); | |
413 | + } | |
414 | + } | |
415 | + if(p.filters){ | |
416 | + var n = []; | |
417 | + jQuery.each( p.filters, function(index, value) { | |
418 | + if(value.layer != ""){ | |
419 | + n.push("&map_layer_" + value.layer + "_filter=" + value.expression); | |
420 | + } | |
421 | + }); | |
422 | + if(n.length > 0){ | |
423 | + par.push(n.join("")); | |
424 | + } | |
425 | + } | |
426 | + if (typeof (console) !== 'undefined') | |
427 | + console.info("i3GEO.parametrosMapa2mashuppar() " + par.join("")); | |
320 | 428 | |
429 | + return par.join(""); | |
321 | 430 | }, |
322 | 431 | /** |
323 | 432 | * Function: cria | ... | ... |
ms_criamapa.php
... | ... | @@ -215,6 +215,7 @@ filtros - filtros podem ser adicionados incluindo o parametro da seguinte forma: |
215 | 215 | //quando $funcao existe, é pq o ms_criamapa.php está |
216 | 216 | //sendo utilizado como um include em classesphp/mapa_controle.php |
217 | 217 | // |
218 | + | |
218 | 219 | if(!isset($funcao)){ |
219 | 220 | ob_end_clean(); |
220 | 221 | /* |
... | ... | @@ -243,35 +244,35 @@ if(empty($base) && !empty($parurl["base"])){ |
243 | 244 | } |
244 | 245 | |
245 | 246 | ms_ResetErrorList(); |
246 | -$temasa = $parurl["temasa"]; | |
247 | -$layers = $parurl["layers"]; | |
248 | -$desligar = $parurl["desligar"]; | |
249 | -$mapext = $parurl["mapext"]; | |
247 | +$temasa = @$parurl["temasa"]; | |
248 | +$layers = @$parurl["layers"]; | |
249 | +$desligar = @$parurl["desligar"]; | |
250 | +$mapext = @$parurl["mapext"]; | |
250 | 251 | $executa = "";//$parurl["executa"]; |
251 | -$perfil = $parurl["perfil"]; | |
252 | -$caminho = $parurl["caminho"]; | |
253 | -$pontos = $parurl["pontos"]; | |
254 | -$nometemapontos = $parurl["nometemapontos"]; | |
255 | -$linhas = $parurl["linhas"]; | |
256 | -$nometemalinhas = $parurl["nometemalinhas"]; | |
257 | -$poligonos = $parurl["poligonos"]; | |
258 | -$nometemapoligonos = $parurl["nometemapoligonos"]; | |
259 | -$simbolo = $parurl["simbolo"]; | |
260 | -$corsimbolo = $parurl["corsimbolo"]; | |
261 | -$tamanhosimbolo = $parurl["tamanhosimbolo"]; | |
262 | -$wkt = $parurl["wkt"]; | |
263 | -$nometemawkt = $parurl["nometemawkt"]; | |
264 | -$idioma = $parurl["idioma"]; | |
265 | -$kmlurl = $parurl["kmlurl"]; | |
266 | -$url_wms = $parurl["url_wms"]; | |
267 | -$layer_wms = $parurl["layer_wms"]; | |
268 | -$style_wms = $parurl["style_wms"]; | |
269 | -$nome_wms = $parurl["nome_wms"]; | |
270 | -$srs_wms = $parurl["srs_wms"]; | |
271 | -$image_wms = $parurl["image_wms"]; | |
272 | -$versao_wms = $parurl["versao_wms"]; | |
273 | -$gvsigview = $parurl["gvsigview"]; | |
274 | -$restauramapa = $parurl["restauramapa"]; | |
252 | +$perfil = @$parurl["perfil"]; | |
253 | +$caminho = @$parurl["caminho"]; | |
254 | +$pontos = @$parurl["pontos"]; | |
255 | +$nometemapontos = @$parurl["nometemapontos"]; | |
256 | +$linhas = @$parurl["linhas"]; | |
257 | +$nometemalinhas = @$parurl["nometemalinhas"]; | |
258 | +$poligonos = @$parurl["poligonos"]; | |
259 | +$nometemapoligonos = @$parurl["nometemapoligonos"]; | |
260 | +$simbolo = @$parurl["simbolo"]; | |
261 | +$corsimbolo = @$parurl["corsimbolo"]; | |
262 | +$tamanhosimbolo = @$parurl["tamanhosimbolo"]; | |
263 | +$wkt = @$parurl["wkt"]; | |
264 | +$nometemawkt = @$parurl["nometemawkt"]; | |
265 | +$idioma = @$parurl["idioma"]; | |
266 | +$kmlurl = @$parurl["kmlurl"]; | |
267 | +$url_wms = @$parurl["url_wms"]; | |
268 | +$layer_wms = @$parurl["layer_wms"]; | |
269 | +$style_wms = @$parurl["style_wms"]; | |
270 | +$nome_wms = @$parurl["nome_wms"]; | |
271 | +$srs_wms = @$parurl["srs_wms"]; | |
272 | +$image_wms = @$parurl["image_wms"]; | |
273 | +$versao_wms = @$parurl["versao_wms"]; | |
274 | +$gvsigview = @$parurl["gvsigview"]; | |
275 | +$restauramapa = @$parurl["restauramapa"]; | |
275 | 276 | |
276 | 277 | $versao = versao(); |
277 | 278 | $versao = $versao["principal"]; |
... | ... | @@ -335,7 +336,7 @@ Prepara as variáveis que serão incluidas na seção |
335 | 336 | |
336 | 337 | As variáveis vêm do arquivo ms_configura.php e são armazenadas em uma seção com nome específico para o i3geo. |
337 | 338 | */ |
338 | -if (!isset($mapext)){ | |
339 | +if (!isset($mapext) || empty($mapext)){ | |
339 | 340 | $mapext=""; |
340 | 341 | } |
341 | 342 | else{ |
... | ... | @@ -353,7 +354,7 @@ $locaplic_ = $locaplic; |
353 | 354 | $R_path_ = $R_path; |
354 | 355 | $mapext_ = $mapext; |
355 | 356 | |
356 | -$debug_ = $debug; | |
357 | +$debug_ = @$debug; | |
357 | 358 | $ler_extensoes_ = $ler_extensoes; |
358 | 359 | $postgis_mapa_ = $postgis_mapa; |
359 | 360 | $tituloInstituicao_ = $tituloInstituicao; |
... | ... | @@ -525,12 +526,6 @@ else{ |
525 | 526 | } |
526 | 527 | |
527 | 528 | /* |
528 | -Utiliza um projeto gvSig para compor o mapa | |
529 | -*/ | |
530 | -if(!empty($gvsiggvp)){ | |
531 | - incluiMapaGvsig($gvsiggvp,$gvsigview); | |
532 | -} | |
533 | -/* | |
534 | 529 | Parâmetros adicionais. |
535 | 530 | |
536 | 531 | Processa os parâmetros para a inicialização verificando se foram passados pela URL ou não. |
... | ... | @@ -665,6 +660,7 @@ Adapta os dados de cada layer. |
665 | 660 | Faz alterações em cada layer caso sejam necessárias. |
666 | 661 | */ |
667 | 662 | function adaptaLayers($tmpfname,$versao){ |
663 | + global $parurl; | |
668 | 664 | $mapa = ms_newMapObj($tmpfname); |
669 | 665 | $path = $mapa->shapepath; |
670 | 666 | $numlayers = $mapa->numlayers; |
... | ... | @@ -703,7 +699,7 @@ function adaptaLayers($tmpfname,$versao){ |
703 | 699 | // |
704 | 700 | //verifica se deve aplicar filtro |
705 | 701 | // |
706 | - $filtro = $_GET["map_layer_".$layer->name."_filter"]; | |
702 | + $filtro = @$parurl["map_layer_".$layer->name."_filter"]; | |
707 | 703 | if(!empty($filtro)){ |
708 | 704 | $layer->setmetadata("CACHE","nao"); |
709 | 705 | $layer->setfilter($filtro); |
... | ... | @@ -822,26 +818,9 @@ function incluiTemasIniciais(){ |
822 | 818 | if ($arqt == "") |
823 | 819 | {continue;} |
824 | 820 | $extensao = ".map"; |
825 | - $arqt = str_replace(".gvp","",$arqt); | |
826 | - if(file_exists($arqt.".gvp")){ | |
827 | - $extensao = ".gvp"; | |
828 | - $arqt = $arqt.".gvp"; | |
829 | - } | |
830 | 821 | if(file_exists($arqt)){ |
831 | 822 | $arqtemp = $arqt; |
832 | 823 | } |
833 | - if ((strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) && (file_exists($temasdir."\\".$arqt."php"))){ | |
834 | - //$extensao = ".php"; | |
835 | - } | |
836 | - elseif (file_exists($temasdir."/".$arqt.".php")){ | |
837 | - //$extensao = ".php"; | |
838 | - } | |
839 | - if ((strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) && (file_exists($temasdir."\\".$arqt."gvp"))){ | |
840 | - $extensao = ".gvp"; | |
841 | - } | |
842 | - elseif (file_exists($temasdir."/".$arqt.".gvp")){ | |
843 | - $extensao = ".gvp"; | |
844 | - } | |
845 | 824 | if ((strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) && (file_exists($locaplic."\\aplicmap\\".$arqt.$extensao))){ |
846 | 825 | $arqtemp = $locaplic."\\aplicmap\\".$arqt.$extensao; |
847 | 826 | } |
... | ... | @@ -862,7 +841,6 @@ function incluiTemasIniciais(){ |
862 | 841 | echo "<br>Problemas com a camada $arqtemp<br>"; |
863 | 842 | } |
864 | 843 | else{ |
865 | - if($extensao == ".map"){ | |
866 | 844 | $maptemp = @ms_newMapObj($arqtemp); |
867 | 845 | for($i=0;$i<($maptemp->numlayers);++$i){ |
868 | 846 | //error_reporting(0); |
... | ... | @@ -900,35 +878,10 @@ function incluiTemasIniciais(){ |
900 | 878 | cloneInlineSymbol($layern,$maptemp,$mapn); |
901 | 879 | $layerAdicionado = ms_newLayerObj($mapn, $layern); |
902 | 880 | corrigeLayerGrid($layern,$layerAdicionado); |
903 | - } | |
904 | - } | |
905 | - | |
906 | - if($extensao == ".php"){ | |
907 | - //include_once($arqtemp); | |
908 | - //eval($arqt."(\$mapn);"); | |
909 | - } | |
910 | - if($extensao == ".gvp"){ | |
911 | - include_once($locaplic."/pacotes/gvsig/gvsig2mapfile/class.gvsig2mapfile.php"); | |
912 | - $gm = new gvsig2mapfile($arqtemp); | |
913 | - $gvsigview = $gm->getViewsNames(); | |
914 | - foreach($gvsigview as $v){ | |
915 | - $dataView = $gm->getViewData($v); | |
916 | - $mapn = $gm->addLayers($mapn,$v,$dataView["layerNames"]); | |
917 | - } | |
918 | - $next = $dataView["extent"]; | |
919 | - $ext = $mapn->extent; | |
920 | - $ext->setextent($next[0],$next[1],$next[2],$next[3]); | |
921 | 881 | } |
922 | 882 | } |
923 | 883 | } |
924 | 884 | } |
925 | - // | |
926 | - //muda para RGB para melhorar o desenho da imagem raster | |
927 | - // | |
928 | - if($existeraster){ | |
929 | - //$of = $mapn->outputformat; | |
930 | - //$of->set("imagemode",MS_IMAGEMODE_RGB); | |
931 | - } | |
932 | 885 | erroCriacao(); |
933 | 886 | } |
934 | 887 | /* |
... | ... | @@ -1077,27 +1030,32 @@ function inserePontosUrl() |
1077 | 1030 | //cria o shape file |
1078 | 1031 | // |
1079 | 1032 | $tipol = MS_SHP_POINT; |
1080 | - $nomeshp = $dir_tmp."/".$imgdir."/pontosins"; | |
1033 | + $nomeshp = $dir_tmp."/".$imgdir."/".nomeRandomico(); | |
1081 | 1034 | // cria o dbf |
1082 | 1035 | $def = array(); |
1083 | 1036 | $items = array("COORD"); |
1084 | 1037 | foreach ($items as $ni) |
1085 | 1038 | {$def[] = array($ni,"C","254");} |
1086 | - if(!function_exists(dbase_create)) | |
1087 | - {xbase_create($nomeshp.".dbf", $def);} | |
1088 | - else | |
1089 | - {dbase_create($nomeshp.".dbf", $def);} | |
1039 | + if(!function_exists(dbase_create)){ | |
1040 | + xbase_create($nomeshp.".dbf", $def); | |
1041 | + } | |
1042 | + else{ | |
1043 | + dbase_create($nomeshp.".dbf", $def); | |
1044 | + } | |
1090 | 1045 | $dbname = $nomeshp.".dbf"; |
1091 | 1046 | $db=xbase_open($dbname,2); |
1092 | 1047 | $novoshpf = ms_newShapefileObj($nomeshp, $tipol); |
1093 | 1048 | $pontos = explode(" ",trim($pontos)); |
1094 | - if(count($pontos) == 1) | |
1095 | - {$pontos = explode(",",trim($pontos[0]));} | |
1096 | - foreach ($pontos as $p) | |
1097 | - {if (is_numeric($p)){$pontosn[] = $p;}} | |
1049 | + if(count($pontos) == 1){ | |
1050 | + $pontos = explode(",",trim($pontos[0])); | |
1051 | + } | |
1052 | + foreach ($pontos as $p){ | |
1053 | + if (is_numeric($p)){ | |
1054 | + $pontosn[] = $p; | |
1055 | + } | |
1056 | + } | |
1098 | 1057 | $pontos = $pontosn; |
1099 | - for ($ci = 0;$ci < count($pontos);$ci=$ci+2) | |
1100 | - { | |
1058 | + for ($ci = 0;$ci < count($pontos);$ci=$ci+2){ | |
1101 | 1059 | $reg = array(); |
1102 | 1060 | $reg[] = $pontos[$ci]." ".$pontos[$ci+1]; |
1103 | 1061 | $shape = ms_newShapeObj($tipol); |
... | ... | @@ -1159,41 +1117,45 @@ function insereLinhasUrl() |
1159 | 1117 | //cria o shape file |
1160 | 1118 | // |
1161 | 1119 | $tipol = MS_SHP_ARC; |
1162 | - $nomeshp = $dir_tmp."/".$imgdir."/linhains"; | |
1120 | + $nomeshp = $dir_tmp."/".$imgdir."/".nomeRandomico(); | |
1163 | 1121 | // cria o dbf |
1164 | 1122 | $def = array(); |
1165 | 1123 | $items = array("COORD"); |
1166 | - foreach ($items as $ni) | |
1167 | - {$def[] = array($ni,"C","254");} | |
1168 | - if(!function_exists(dbase_create)) | |
1169 | - {xbase_create($nomeshp.".dbf", $def);} | |
1170 | - else | |
1171 | - {dbase_create($nomeshp.".dbf", $def);} | |
1124 | + foreach ($items as $ni){ | |
1125 | + $def[] = array($ni,"C","254"); | |
1126 | + } | |
1127 | + if(!function_exists(dbase_create)){ | |
1128 | + xbase_create($nomeshp.".dbf", $def); | |
1129 | + } | |
1130 | + else{ | |
1131 | + dbase_create($nomeshp.".dbf", $def); | |
1132 | + } | |
1172 | 1133 | $dbname = $nomeshp.".dbf"; |
1173 | 1134 | $db=xbase_open($dbname,2); |
1174 | 1135 | $novoshpf = ms_newShapefileObj($nomeshp, $tipol); |
1175 | 1136 | $linhas = explode(",",trim($linhas)); |
1176 | 1137 | $pontosLinhas = array(); //guarda os pontos de cada linha em arrays |
1177 | - foreach ($linhas as $l) | |
1178 | - { | |
1138 | + foreach ($linhas as $l){ | |
1179 | 1139 | $tempPTs = explode(" ",trim($l)); |
1180 | 1140 | $temp = array(); |
1181 | - foreach ($tempPTs as $p) | |
1182 | - if (is_numeric($p)){$temp[] = $p;} | |
1141 | + foreach ($tempPTs as $p){ | |
1142 | + if (is_numeric($p)){ | |
1143 | + $temp[] = $p; | |
1144 | + } | |
1145 | + } | |
1183 | 1146 | $pontosLinhas[] = $temp; |
1184 | 1147 | } |
1185 | - foreach ($pontosLinhas as $ptsl) | |
1186 | - { | |
1148 | + foreach ($pontosLinhas as $ptsl){ | |
1187 | 1149 | $linhas = $ptsl; |
1188 | - $shape = ms_newShapeObj($tipol); | |
1150 | + $shape = ms_newShapeObj(MS_SHAPE_LINE); | |
1189 | 1151 | $linha = ms_newLineObj(); |
1190 | 1152 | $reg = array(); |
1191 | - $reg[] = ""; | |
1192 | - for ($ci = 0;$ci < count($linhas);$ci=$ci+2) | |
1193 | - { | |
1153 | + $reg[] = implode(",",$ptsl); | |
1154 | + for ($ci = 0;$ci < count($linhas);$ci=$ci+2){ | |
1194 | 1155 | $linha->addXY($linhas[$ci],$linhas[$ci+1]); |
1195 | - $shape->add($linha); | |
1156 | + | |
1196 | 1157 | } |
1158 | + $shape->add($linha); | |
1197 | 1159 | $novoshpf->addShape($shape); |
1198 | 1160 | xbase_add_record($db,$reg); |
1199 | 1161 | } |
... | ... | @@ -1215,12 +1177,14 @@ function insereLinhasUrl() |
1215 | 1177 | $classe->set("name"," "); |
1216 | 1178 | $estilo = ms_newStyleObj($classe); |
1217 | 1179 | |
1218 | - if(!isset($simbolo)) | |
1219 | - {$simbolo = "linha";} | |
1220 | - $estilo->set("symbolname",$simbolo); | |
1221 | - if(!isset($tamanhosimbolo)) | |
1222 | - {$tamanhosimbolo = 6;} | |
1223 | - $estilo->set("size",$tamanhosimbolo); | |
1180 | + if(isset($simbolo)){ | |
1181 | + $simbolo = "linha"; | |
1182 | + $estilo->set("symbolname",$simbolo); | |
1183 | + } | |
1184 | + if(!isset($tamanhosimbolo)){ | |
1185 | + $tamanhosimbolo = 4; | |
1186 | + } | |
1187 | + $estilo->set("width",$tamanhosimbolo); | |
1224 | 1188 | $cor = $estilo->color; |
1225 | 1189 | if(!isset($corsimbolo)) |
1226 | 1190 | {$corsimbolo ="255,0,0";} |
... | ... | @@ -1248,7 +1212,7 @@ function inserePoligonosUrl() |
1248 | 1212 | //cria o shape file |
1249 | 1213 | // |
1250 | 1214 | $tipol = MS_SHP_POLYGON; |
1251 | - $nomeshp = $dir_tmp."/".$imgdir."/poligonosins"; | |
1215 | + $nomeshp = $dir_tmp."/".$imgdir."/".nomeRandomico(); | |
1252 | 1216 | // cria o dbf |
1253 | 1217 | $def = array(); |
1254 | 1218 | $items = array("COORD"); |
... | ... | @@ -1274,14 +1238,13 @@ function inserePoligonosUrl() |
1274 | 1238 | foreach ($pontosLinhas as $ptsl) |
1275 | 1239 | { |
1276 | 1240 | $linhas = $ptsl; |
1277 | - $shape = ms_newShapeObj($tipol); | |
1241 | + $shape = ms_newShapeObj(MS_SHAPE_POLYGON); | |
1278 | 1242 | $linha = ms_newLineObj(); |
1279 | 1243 | $reg = array(); |
1280 | 1244 | $reg[] = ""; |
1281 | 1245 | for ($ci = 0;$ci < count($linhas);$ci=$ci+2) |
1282 | 1246 | { |
1283 | 1247 | $linha->addXY($linhas[$ci],$linhas[$ci+1]); |
1284 | - | |
1285 | 1248 | } |
1286 | 1249 | $shape->add($linha); |
1287 | 1250 | $novoshpf->addShape($shape); | ... | ... |