Commit d485a4e1ac267ea6996e26f9192fb65aa8e3c27f

Authored by Edmar Moretti
1 parent 232ca7ed

Alteração no ms_criamapa.php para ajustar o nome da imagem de referência conform…

…e o local onde o i3Geo está instalado
ferramentas/imprimir/a4lpaisagempdf.php
... ... @@ -123,7 +123,7 @@ $imgo->saveImage($nomer);
123 123 $pathlegenda = $dir_tmp."/".basename($imgo->imageurl)."/".basename($nomer);
124 124 $titulo = $_GET['titulo'];
125 125  
126   -substituiCon($map_file,$postgis_mapa);
  126 +substituiConObj($map_file,$postgis_mapa);
127 127  
128 128 require(dirname(__FILE__).'/../../pacotes/fpdf/fpdf.php');
129 129 $pdf = new FPDF("L","mm","A4");
... ...
ferramentas/imprimir/aggpng.php
... ... @@ -66,7 +66,7 @@ $nomes = nomeRandomico();
66 66 $map = ms_newMapObj($map_file);
67 67 $temp = str_replace(".map","xxx.map",$map_file);
68 68 $map->save($temp);
69   -substituiCon($temp,$postgis_mapa);
  69 +substituiConObj($temp,$postgis_mapa);
70 70 $of = $map->outputformat;
71 71 $of->set("driver","AGG/PNG");
72 72 $of->set("imagemode","RGB");
... ... @@ -108,10 +108,11 @@ foreach ($temas as $tema)
108 108 }
109 109 }
110 110 }
  111 +restauraConObj($map, $postgis_mapa);
111 112 $map->save($temp);
112 113 removeLinha("classeNula",$temp);
113 114 $map = ms_newMapObj($temp);
114   -substituiCon($temp,$postgis_mapa);
  115 +substituiConObj($temp,$postgis_mapa);
115 116 $o = $map->outputformat;
116 117  
117 118 if($mapexten != ""){
... ... @@ -133,7 +134,7 @@ $imgo = $map->drawscalebar();
133 134 $nomer = ($imgo->imagepath)."escala".$nomes.".png";
134 135 $imgo->saveImage($nomer);
135 136 $nomeescala = strtolower($protocolo[0])."://".$_SERVER['HTTP_HOST'].($imgo->imageurl).basename($nomer);
136   -//referência
  137 +//referencia
137 138 $o = $map->reference->outlinecolor;
138 139 $o->setrgb(255,0,0);
139 140 $map->preparequery();
... ...
ferramentas/imprimir/dicionario.js
... ... @@ -29,5 +29,10 @@ i3GEOF.imprimir.dicionario = {
29 29 pt : $trad("p7"),
30 30 en : $trad("p7"),
31 31 es : $trad("p7"),
32   - } ]
  32 + } ],
  33 + "ref" : [ {
  34 + pt : $trad("d9t"),
  35 + en : $trad("d9t"),
  36 + es : $trad("d9t"),
  37 + } ]
33 38 };
34 39 \ No newline at end of file
... ...
ferramentas/imprimir/template_mst.html
... ... @@ -9,4 +9,5 @@
9 9 <a href='javascript:void(0)' onclick="i3GEO.mapa.dialogo.opcoesLegenda();" class='btn btn-primary btn-lg btn-block btn-raised'>{{{legenda}}}</a>
10 10 <a href='javascript:void(0)' onclick="i3GEO.mapa.dialogo.opcoesEscala();" class='btn btn-primary btn-lg btn-block btn-raised'>{{{escala}}}</a>
11 11 <a href='javascript:void(0)' onclick="i3GEO.mapa.dialogo.tamanho()" class='btn btn-primary btn-lg btn-block btn-raised'>{{{tamanho}}}</a>
  12 + <a href='javascript:void(0)' onclick="i3GEO.mapa.dialogo.opcoesMapaRef();" class='btn btn-primary btn-lg btn-block btn-raised'>{{{ref}}}</a>
12 13 </div>
13 14 \ No newline at end of file
... ...
ferramentas/opcoes_maparef/dependencias.php 0 → 100644
... ... @@ -0,0 +1,24 @@
  1 +<?php
  2 +include(dirname(__FILE__)."/../blacklist.php");
  3 +verificaBlFerramentas(basename(dirname(__FILE__)));
  4 +
  5 +
  6 +/**
  7 + * Carrega os programas javascript necessarios para a ferramenta
  8 + * Esse programa e usado na tag <script> ou com a funcao scripttag do i3Geo
  9 + * Alem de carregar os scripts, carrega tambem o template no formato MUSTACHE, definindo a variavel
  10 + * javascript i3GEOF.opcoesTamanho.MUSTACHE
  11 + * O template e substituido pelos valores definidos em index.js no momento da inicializacao da ferramenta
  12 + */
  13 +if(extension_loaded('zlib')){
  14 + ob_start('ob_gzhandler');
  15 +}
  16 +header("Content-type: text/javascript");
  17 +include("index.js");
  18 +include("dicionario.js");
  19 +echo "\n";
  20 +
  21 +if(extension_loaded('zlib')){
  22 + ob_end_flush();
  23 +}
  24 +?>
0 25 \ No newline at end of file
... ...
ferramentas/opcoes_maparef/dicionario.js 0 → 100644
... ... @@ -0,0 +1,33 @@
  1 +//+$trad(1,i3GEOF.opcoesTamanho.dicionario)+
  2 +i3GEOF.opcoesMaparef.dicionario = {
  3 + 'largura' : [ {
  4 + pt : "Largura",
  5 + en : "Width",
  6 + es : "Ancho"
  7 + } ],
  8 + 'altura' : [ {
  9 + pt : "Altura",
  10 + en : "Height",
  11 + es : "Altura"
  12 + } ],
  13 + 'valor' : [ {
  14 + pt : "Valores em pixels",
  15 + en : "Values in pixels",
  16 + es : "Valores en p&iacute;xeles"
  17 + } ],
  18 + 'testa' : [ {
  19 + pt : "Testar",
  20 + en : "Test",
  21 + es : "Probar"
  22 + } ],
  23 + 'aplica' : [ {
  24 + pt : "Aplicar",
  25 + en : "Apply",
  26 + es : "Aplicar"
  27 + } ],
  28 + 'msg' : [ {
  29 + pt : "Essa opera&ccedil;&atilde;o afeta apenas a legenda utilizada na ferramenta de impress&atilde;o do mapa",
  30 + en : "This operation only affects the legend used for the map printing tool",
  31 + es : "Esta operaci&oacute;n solo afecta a la leyenda utilizada en la herramienta de impresi&oacute;n del mapa"
  32 + } ]
  33 +};
0 34 \ No newline at end of file
... ...
ferramentas/opcoes_maparef/exec.php 0 → 100644
... ... @@ -0,0 +1,34 @@
  1 +<?php
  2 +include_once(dirname(__FILE__)."/../safe.php");
  3 +verificaBlFerramentas(basename(dirname(__FILE__)),$i3geoBlFerramentas,false);
  4 +//
  5 +//faz a busca da fun&ccedil;&atilde;o que deve ser executada
  6 +//
  7 +$retorno = ""; //string que ser&aacute; retornada ao browser via JSON
  8 +switch (strtoupper($funcao))
  9 +{
  10 + case "ALTERA":
  11 + copiaSeguranca($map_file);
  12 + $map = ms_newMapObj($map_file);
  13 + $r = $map->reference;
  14 + $r->updateFromString("REFERENCE SIZE " . $_POST["width"] . " " . $_POST["height"] . " END");
  15 + $salvo = $map->save($map_file);
  16 + $retorno = "ok";
  17 + $_SESSION["contadorsalva"]++;
  18 + break;
  19 + case "GETREF":
  20 + $map = ms_newMapObj($map_file);
  21 + $r = $map->reference;
  22 + $retorno = array(
  23 + "width" => 150,
  24 + "height" => 150
  25 + );
  26 + break;
  27 +}
  28 +if(isset($map_file) && isset($postgis_mapa) && $map_file != ""){
  29 + restauraCon($map_file,$postgis_mapa);
  30 +}
  31 +ob_clean();
  32 +header("Content-type: application/json");
  33 +echo json_encode($retorno);
  34 +?>
0 35 \ No newline at end of file
... ...
ferramentas/opcoes_maparef/index.js 0 → 100644
... ... @@ -0,0 +1,134 @@
  1 +
  2 +if(typeof(i3GEOF) === 'undefined'){
  3 + var i3GEOF = {};
  4 +}
  5 +/*
  6 +Classe: i3GEOF.opcoesMaparef
  7 +
  8 + */
  9 +i3GEOF.opcoesMaparef = {
  10 + /*
  11 + Variavel: aguarde
  12 +
  13 + Estilo do objeto DOM com a imagem de aguarde existente no cabe&ccedil;alho da janela.
  14 + */
  15 + aguarde: "",
  16 + /**
  17 + * Template no formato mustache. E preenchido na carga do javascript com o programa dependencias.php
  18 + */
  19 + MUSTACHE : "",
  20 + CONFIG : {},
  21 + /**
  22 + * Susbtitutos para o template
  23 + */
  24 + mustacheHash : function() {
  25 + var dicionario = i3GEO.idioma.objetoIdioma(i3GEOF.opcoesMaparef.dicionario);
  26 + dicionario["Tamanhol"] = i3GEOF.opcoesMaparef.CONFIG.width;
  27 + dicionario["Tamanhoa"] = i3GEOF.opcoesMaparef.CONFIG.height;
  28 + return dicionario;
  29 + },
  30 + /*
  31 + Function: inicia
  32 +
  33 + Inicia a ferramenta. &Eacute; chamado por criaJanelaFlutuante
  34 +
  35 + Parametro:
  36 +
  37 + iddiv {String} - id do div que receber&aacute; o conteudo HTML da ferramenta
  38 + */
  39 + inicia: function(iddiv){
  40 + if(i3GEOF.opcoesMaparef.MUSTACHE == ""){
  41 + var t1 = i3GEO.configura.locaplic + "/ferramentas/opcoes_maparef/template_mst.html",
  42 + t2 = i3GEO.configura.locaplic + "/ferramentas/opcoes_maparef/exec.php?funcao=getref";
  43 + $.when( $.get(t1),$.get(t2) ).done(function(r1,r2) {
  44 + i3GEOF.opcoesMaparef.MUSTACHE = r1[0];
  45 + i3GEOF.opcoesMaparef.CONFIG = r2[0];
  46 + i3GEOF.opcoesMaparef.inicia(iddiv);
  47 + });
  48 + return;
  49 + }
  50 + var b,box;
  51 + try{
  52 + $i(iddiv).innerHTML = i3GEOF.opcoesMaparef.html();
  53 + i3GEO.janela.tempoMsg($trad('msg',i3GEOF.opcoesMaparef.dicionario));
  54 + }
  55 + catch(erro){i3GEO.janela.tempoMsg(erro);}
  56 + },
  57 + /*
  58 + Function: html
  59 +
  60 + Gera o c&oacute;digo html para apresenta&ccedil;&atilde;o das op&ccedil;&otilde;es da ferramenta
  61 +
  62 + Retorno:
  63 +
  64 + String com o c&oacute;digo html
  65 + */
  66 + html:function() {
  67 + var ins = Mustache.render(i3GEOF.opcoesMaparef.MUSTACHE, i3GEOF.opcoesMaparef.mustacheHash());
  68 + return ins;
  69 + },
  70 + /*
  71 + Function: iniciaJanelaFlutuante
  72 +
  73 + Cria a janela flutuante para controle da ferramenta.
  74 + */
  75 + iniciaJanelaFlutuante: function(){
  76 + var janela,divid,temp,titulo,cabecalho,minimiza;
  77 + if ($i("i3GEOF.opcoesMaparef")) {
  78 + return;
  79 + }
  80 + cabecalho = function(){};
  81 + minimiza = function(){
  82 + i3GEO.janela.minimiza("i3GEOF.opcoesMaparef",200);
  83 + };
  84 + //cria a janela flutuante
  85 + titulo = "<span class='i3GeoTituloJanelaBsNolink' >" + $trad("d9t") + "</span></div>";
  86 + janela = i3GEO.janela.cria(
  87 + "250px",
  88 + "270px",
  89 + "",
  90 + "",
  91 + "",
  92 + titulo,
  93 + "i3GEOF.opcoesMaparef",
  94 + false,
  95 + "hd",
  96 + cabecalho,
  97 + minimiza,
  98 + "",
  99 + true,
  100 + "",
  101 + "",
  102 + "",
  103 + ""
  104 + );
  105 + divid = janela[2].id;
  106 + $i("i3GEOF.opcoesMaparef_corpo").style.backgroundColor = "white";
  107 + $i("i3GEOF.opcoesMaparef_corpo").style.textAlign = "left";
  108 + i3GEOF.opcoesMaparef.aguarde = $i("i3GEOF.opcoesMaparef_imagemCabecalho").style;
  109 + i3GEOF.opcoesMaparef.inicia(divid);
  110 + },
  111 + /*
  112 + Function: executa
  113 + */
  114 + executa: function(){
  115 + if(i3GEOF.opcoesMaparef.aguarde.visibility === "visible"){
  116 + return;
  117 + }
  118 + i3GEOF.opcoesMaparef.aguarde.visibility = "visible";
  119 + $.post(
  120 + i3GEO.configura.locaplic+"/ferramentas/opcoes_maparef/exec.php?g_sid=" + i3GEO.configura.sid + "&funcao=altera&",
  121 + $("#form-opcoesMaparef").serialize()
  122 + )
  123 + .done(
  124 + function(data, status){
  125 + i3GEOF.opcoesMaparef.aguarde.visibility = "hidden";
  126 + }
  127 + )
  128 + .fail(
  129 + function(data){
  130 + i3GEOF.opcoesMaparef.aguarde.visibility = "hidden";
  131 + }
  132 + );
  133 + }
  134 +};
0 135 \ No newline at end of file
... ...
ferramentas/opcoes_maparef/template_mst.html 0 → 100644
... ... @@ -0,0 +1,14 @@
  1 +<div class='container-fluid customScrollBar'>
  2 + <form id="form-opcoesMaparef" style="" action="#" onsubmit="i3GEOF.opcoesMaparef.executa();return false;" class="form-horizontal" role="form" method="post">
  3 + <div class='form-group label-fixed condensed'>
  4 + <label class="control-label" for="i3GEOopcoesMaparefl">{{{largura}}}</label>
  5 + <input required class="form-control input-lg " type='text' name='width' value='{{{Tamanhol}}}' />
  6 + </div>
  7 + <div class='form-group label-fixed condensed'>
  8 + <label class="control-label" for="i3GEOopcoesMaparefa">{{{altura}}}</label>
  9 + <input required class="form-control input-lg " type='text' name='height' value='{{{Tamanhoa}}}' />
  10 + </div>
  11 + <h5>{{{valor}}}</h5>
  12 + <button type="submit" role="button" class='btn btn-primary btn-sm btn-raised'>{{{aplica}}}</button>
  13 + </form>
  14 +</div>
0 15 \ No newline at end of file
... ...
interface/config.php
... ... @@ -114,7 +114,7 @@ i3GEO.janela.ativaAlerta();
114 114  
115 115 var osm = new ol.layer.Tile({
116 116 title : "OSM",
117   - visible : true,
  117 + visible : false,
118 118 isBaseLayer : true,
119 119 name : "osm",
120 120 source: new ol.source.OSM({
... ...
js/dicionario.js
... ... @@ -1205,7 +1205,7 @@ g_traducao =
1205 1205 ],
1206 1206 "d9t" : [
1207 1207 {
1208   - pt : "mapa de refer&ecirc;ncia",
  1208 + pt : "Mapa de refer&ecirc;ncia",
1209 1209 en : "Overview map",
1210 1210 es : "Mapa de referencia"
1211 1211 }
... ...
js/mapa.js
... ... @@ -875,6 +875,19 @@ i3GEO.mapa =
875 875 "dependencias.php",
876 876 "i3GEOF.opcoesLegenda.iniciaJanelaFlutuante()");
877 877 },
  878 + /**
  879 + * Function: opcoesMapaRef
  880 + *
  881 + * Abre a janela de dialogo da ferramenta opcoes_maparef
  882 + */
  883 + opcoesMapaRef : function() {
  884 + i3GEO.util.dialogoFerramenta(
  885 + "i3GEO.mapa.dialogo.opcoesMapaRef()",
  886 + "opcoes_maparef",
  887 + "opcoesMaparef",
  888 + "dependencias.php",
  889 + "i3GEOF.opcoesMaparef.iniciaJanelaFlutuante()");
  890 + },
878 891 /**
879 892 * Function: gradeCoord
880 893 *
... ...
ms_criamapa.php
... ... @@ -545,6 +545,10 @@ if (! isset($mapext)) {
545 545 // arquivo com a imagem de refer&ecirc;ncia
546 546 if (! isset($map_reference_image)) {
547 547 $map_reference_image = $map->reference->image;
  548 + //verifica o caminho
  549 + if(!file_exists($map_reference_image)){
  550 + $map_reference_image = $locaplic . "/imagens/" . basename($map_reference_image);
  551 + }
548 552 }
549 553 // extens&atilde;o geogr&aacute;fica da imagem do mapa de refer&ecirc;ncia
550 554 if (! isset($map_reference_extent)) {
... ...