Commit 7ac1998bef59495c51ef94d25cabb82eb0a4b7d8

Authored by Edmar Moretti
1 parent cc325c6b

Inclusão de novas opções na ferramenta exportar/imprimir mapa

classesphp/classe_escala.php
1 -<?php  
2 -/*  
3 -Title: classe_escala.php  
4 -  
5 -Manipula&ccedil;&atilde;o da escala.  
6 -  
7 -Cria escala grafica, edita caracter&iacute;sticas, etc.  
8 -  
9 -Licenca:  
10 -  
11 -GPL2  
12 -  
13 -  
14 -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet  
15 -  
16 -Direitos Autorais Reservados (c) 2006 Minist&eacute;rio do Meio Ambiente Brasil  
17 -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com  
18 -  
19 -Este programa &eacute; software livre; voc&ecirc; pode redistribu&iacute;-lo  
20 -e/ou modific&aacute;-lo sob os termos da Licen&ccedil;a P&uacute;blica Geral  
21 -GNU conforme publicada pela Free Software Foundation;  
22 -  
23 -Este programa &eacute; distribu&iacute;do na expectativa de que seja &uacute;til,  
24 -por&eacute;m, SEM NENHUMA GARANTIA; nem mesmo a garantia impl&iacute;cita  
25 -de COMERCIABILIDADE OU ADEQUA&Ccedil;&Atilde;O A UMA FINALIDADE ESPEC&Iacute;FICA.  
26 -Consulte a Licen&ccedil;a P&uacute;blica Geral do GNU para mais detalhes.  
27 -Voc&ecirc; deve ter recebido uma c�pia da Licen&ccedil;a P&uacute;blica Geral do  
28 -GNU junto com este programa; se n&atilde;o, escreva para a  
29 -Free Software Foundation, Inc., no endere&ccedil;o  
30 -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.  
31 -  
32 -Arquivo:  
33 -  
34 -i3geo/classesphp/classe_escala.php  
35 -*/  
36 -/*  
37 -Classe: Escala  
38 -*/  
39 -class Escala  
40 -{  
41 - /*  
42 - Variavel: $mapa  
43 -  
44 - Objeto mapa  
45 - */  
46 - protected $mapa;  
47 - /*  
48 - Variavel: $arquivo  
49 -  
50 - Arquivo map file  
51 - */  
52 - protected $arquivo;  
53 - /*  
54 - Variavel: $nomeImagem  
55 -  
56 - Nome da imagem criada  
57 - */  
58 - protected $nomeImagem;  
59 -  
60 -  
61 -/*  
62 -function: __construct  
63 -  
64 -Cria um objeto Escala  
65 -  
66 -parameters:  
67 -$map_file - Endere&ccedil;o do mapfile no servidor.  
68 -*/  
69 - function __construct($map_file,$nomeImagem="",$locaplic="")  
70 - {  
71 - include(dirname(__FILE__)."/../ms_configura.php");  
72 - $this->postgis_mapa = $postgis_mapa;  
73 -  
74 - if(file_exists($locaplic."/funcoes_gerais.php"))  
75 - include_once($locaplic."/funcoes_gerais.php");  
76 - else  
77 - include_once("funcoes_gerais.php");  
78 -  
79 - $this->locaplic = $locaplic;  
80 - $this->mapa = ms_newMapObj($map_file);  
81 - substituiConObj($this->mapa,$postgis_mapa);  
82 - $this->arquivo = str_replace(".map","",$map_file).".map";  
83 - if ($nomeImagem == "")  
84 - {$this->nomeImagem = nomeRandomico();}  
85 - }  
86 -/*  
87 -function: salva  
88 -  
89 -Salva o mapfile atual  
90 -  
91 -*/  
92 - function salva()  
93 - {  
94 - restauraConObj($this->mapa,$this->postgis_mapa);  
95 - $this->mapa->save($this->arquivo);  
96 - }  
97 -  
98 -/*  
99 -function: retornaBarraEscala  
100 -  
101 -Gera barra de escala.  
102 -  
103 -Retorna uma string com sintaxe em javaScript com o nome da imagem e demais par&acirc;metros.  
104 -  
105 -return:  
106 -string com vari&aacute;veis javascript.  
107 -*/  
108 - function retornaBarraEscala()  
109 - {  
110 - $objImagem = $this->mapa->drawscalebar();  
111 - if($objImagem->imagepath == "")  
112 - {echo "Erro IMAGEPATH vazio";exit;}  
113 - $nomer = ($objImagem->imagepath)."sca".$this->nomeImagem.".png";  
114 - $objImagem->saveImage($nomer);  
115 - $nomer = ($objImagem->imageurl).basename($nomer);  
116 - return ("var scaimagem='".$nomer."';var scawidth=".$objImagem->width.";var scaheight=".$objImagem->height.";var scapath='".$objImagem->imagepath."';var scaurl='".$objImagem->imageurl."'");  
117 - }  
118 -/*  
119 -function: parametrosBarraEscala  
120 -  
121 -Pega os par&acirc;metros da barra de escala.  
122 -  
123 -return:  
124 -string javascript com os parametros.  
125 -*/  
126 - function parametrosBarraEscala()  
127 - {  
128 - $eb = $this->mapa->scalebar;  
129 - $cor = $eb->color;  
130 - $fcor = $cor->red.",".$cor->green.",".$cor->blue;  
131 - $cor = $eb->backgroundcolor;  
132 - $bcor = $cor->red.",".$cor->green.",".$cor->blue;  
133 - $cor = $eb->outlinecolor;  
134 - $ocor = $cor->red.",".$cor->green.",".$cor->blue;  
135 - return (array(  
136 - "color"=>$fcor,  
137 - "backgroundcolor"=>$bcor,  
138 - "outlinecolor"=>$ocor,  
139 - "status"=>$eb->status,  
140 - "width"=>$eb->width,  
141 - "height"=>$eb->height,  
142 - "style"=>$eb->style,  
143 - "intervals"=>$eb->intervals,  
144 - "units"=>$eb->units  
145 - ));  
146 - }  
147 -/*  
148 -array("color"=>"","backgroundcolor"=>"","outlinecolor"=>"","status"=>"","width"=>"","height"=>"","style"=>"","intervals"=>"","units"=>"")  
149 -*/  
150 - function mudaEscalaGrafica($parameters = array("color"=>"","backgroundcolor"=>"","outlinecolor"=>"","status"=>"","width"=>"","height"=>"","style"=>"","intervals"=>"","units"=>""))  
151 - {  
152 - $eb = $this->mapa->scalebar;  
153 - $eb->set("width",$parameters["width"]);  
154 - $eb->set("height",$parameters["height"]);  
155 - if ($parameters["style"] != 2){  
156 - $eb->set("style",$parameters["style"]);  
157 - }  
158 - $eb->set("intervals",$parameters["intervals"]);  
159 - $eb->set("units",$parameters["units"]);  
160 - $corn = $eb->color;  
161 - $n = explode(",",$parameters["color"]);  
162 - $corn->setrgb($n[0],$n[1],$n[2]);  
163 - $cornb = $eb->backgroundcolor;  
164 - $n = explode(",",$parameters["backgroundcolor"]);  
165 - $cornb->setrgb($n[0],$n[1],$n[2]);  
166 - $corno = $eb->outlinecolor;  
167 - $n = explode(",",$parameters["outlinecolor"]);  
168 - $corno->setrgb($n[0],$n[1],$n[2]);  
169 - //desabilita a escala  
170 - if ($parameters["style"] == 2)  
171 - {$eb->set("status",MS_OFF);}  
172 - else  
173 - {$eb->set("status",MS_EMBED);}  
174 - if ($parameters["status"] == 3)  
175 - {$eb->set("status",MS_EMBED);} //MS_ON, MS_OFF, MS_EMBED  
176 - else  
177 - {$eb->set("status",MS_OFF);}  
178 - $this->salva();  
179 - return("ok");  
180 -}  
181 -/*  
182 -array("color"=>"","backgroundcolor"=>"","outlinecolor"=>"","status"=>"","width"=>"","height"=>"","style"=>"","intervals"=>"","units"=>"")  
183 -*/  
184 -function testaescalagrafica($parameters = array("color"=>"","backgroundcolor"=>"","outlinecolor"=>"","status"=>"","width"=>"","height"=>"","style"=>"","intervals"=>"","units"=>""))  
185 - {  
186 - $eb = $this->mapa->scalebar;  
187 - $eb->set("width",$parameters["width"]);  
188 - $eb->set("height",$parameters["height"]);  
189 - if ($parameters["style"] != 2){  
190 - $eb->set("style",$parameters["style"]);  
191 - }  
192 - $eb->set("intervals",$parameters["intervals"]);  
193 - $eb->set("units",$parameters["units"]);  
194 - $corn = $eb->color;  
195 - $n = explode(",",$parameters["color"]);  
196 - $corn->setrgb($n[0],$n[1],$n[2]);  
197 - $cornb = $eb->backgroundcolor;  
198 - $n = explode(",",$parameters["backgroundcolor"]);  
199 - $cornb->setrgb($n[0],$n[1],$n[2]);  
200 - $corno = $eb->outlinecolor;  
201 - $n = explode(",",$parameters["outlinecolor"]);  
202 - $corno->setrgb($n[0],$n[1],$n[2]);  
203 - //desabilita a escala  
204 - if ($parameters["style"] == 2)  
205 - {$eb->set("status",MS_OFF);}  
206 - else  
207 - {$eb->set("status",MS_EMBED);}  
208 - if ($parameters["status"] == 3)  
209 - {$eb->set("status",MS_EMBED);} //MS_ON, MS_OFF, MS_EMBED  
210 - else  
211 - {$eb->set("status",MS_OFF);}  
212 - $objImagem = $this->mapa->drawscalebar();  
213 - $nomer = ($objImagem->imagepath)."sca".$this->nomeImagem.".png";  
214 - $objImagem->saveImage($nomer);  
215 - $nomer = ($objImagem->imageurl).basename($nomer);  
216 - return ($nomer);  
217 - }  
218 -} 1 +<?php
  2 +
  3 +/*
  4 + * Title: classe_escala.php
  5 + *
  6 + * Manipula&ccedil;&atilde;o da escala.
  7 + *
  8 + * Cria escala grafica, edita caracter&iacute;sticas, etc.
  9 + *
  10 + * Licenca:
  11 + *
  12 + * GPL2
  13 + *
  14 + *
  15 + * i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
  16 + *
  17 + * Direitos Autorais Reservados (c) 2006 Minist&eacute;rio do Meio Ambiente Brasil
  18 + * Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com
  19 + *
  20 + * Este programa &eacute; software livre; voc&ecirc; pode redistribu&iacute;-lo
  21 + * e/ou modific&aacute;-lo sob os termos da Licen&ccedil;a P&uacute;blica Geral
  22 + * GNU conforme publicada pela Free Software Foundation;
  23 + *
  24 + * Este programa &eacute; distribu&iacute;do na expectativa de que seja &uacute;til,
  25 + * por&eacute;m, SEM NENHUMA GARANTIA; nem mesmo a garantia impl&iacute;cita
  26 + * de COMERCIABILIDADE OU ADEQUA&Ccedil;&Atilde;O A UMA FINALIDADE ESPEC&Iacute;FICA.
  27 + * Consulte a Licen&ccedil;a P&uacute;blica Geral do GNU para mais detalhes.
  28 + * Voc&ecirc; deve ter recebido uma c�pia da Licen&ccedil;a P&uacute;blica Geral do
  29 + * GNU junto com este programa; se n&atilde;o, escreva para a
  30 + * Free Software Foundation, Inc., no endere&ccedil;o
  31 + * 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  32 + *
  33 + * Arquivo:
  34 + *
  35 + * i3geo/classesphp/classe_escala.php
  36 + */
  37 +/*
  38 + * Classe: Escala
  39 + */
  40 +class Escala
  41 +{
  42 +
  43 + /*
  44 + * Variavel: $mapa
  45 + *
  46 + * Objeto mapa
  47 + */
  48 + protected $mapa;
  49 +
  50 + /*
  51 + * Variavel: $arquivo
  52 + *
  53 + * Arquivo map file
  54 + */
  55 + protected $arquivo;
  56 +
  57 + /*
  58 + * Variavel: $nomeImagem
  59 + *
  60 + * Nome da imagem criada
  61 + */
  62 + protected $nomeImagem;
  63 +
  64 + /*
  65 + * function: __construct
  66 + *
  67 + * Cria um objeto Escala
  68 + *
  69 + * parameters:
  70 + * $map_file - Endere&ccedil;o do mapfile no servidor.
  71 + */
  72 + function __construct($map_file, $nomeImagem = "", $locaplic = "", $mapexten = "")
  73 + {
  74 + include (dirname(__FILE__) . "/../ms_configura.php");
  75 + $this->postgis_mapa = $postgis_mapa;
  76 +
  77 + if (file_exists($locaplic . "/funcoes_gerais.php"))
  78 + include_once ($locaplic . "/funcoes_gerais.php");
  79 + else
  80 + include_once ("funcoes_gerais.php");
  81 +
  82 + $this->locaplic = $locaplic;
  83 + $this->mapa = ms_newMapObj($map_file);
  84 + substituiConObj($this->mapa, $postgis_mapa);
  85 + $this->arquivo = str_replace(".map", "", $map_file) . ".map";
  86 + if ($nomeImagem == "") {
  87 + $this->nomeImagem = nomeRandomico();
  88 + }
  89 + if ($mapexten != "") {
  90 + $ext = explode(" ", $mapexten);
  91 + $extatual = $this->mapa->extent;
  92 + $extatual->setextent($ext[0], $ext[1], $ext[2], $ext[3]);
  93 + }
  94 + }
  95 +
  96 + /*
  97 + * function: salva
  98 + *
  99 + * Salva o mapfile atual
  100 + *
  101 + */
  102 + function salva()
  103 + {
  104 + restauraConObj($this->mapa, $this->postgis_mapa);
  105 + $this->mapa->save($this->arquivo);
  106 + }
  107 +
  108 + /*
  109 + * function: retornaBarraEscala
  110 + *
  111 + * Gera barra de escala.
  112 + *
  113 + * Retorna uma string com sintaxe em javaScript com o nome da imagem e demais par&acirc;metros.
  114 + *
  115 + * return:
  116 + * string com vari&aacute;veis javascript.
  117 + */
  118 + function retornaBarraEscala()
  119 + {
  120 + $this->mapa->preparequery();
  121 + $objImagem = $this->mapa->drawscalebar();
  122 + if ($objImagem->imagepath == "") {
  123 + echo "Erro IMAGEPATH vazio";
  124 + exit();
  125 + }
  126 + $nomer = ($objImagem->imagepath) . "sca" . $this->nomeImagem . ".png";
  127 + $objImagem->saveImage($nomer);
  128 + $nomer = ($objImagem->imageurl) . basename($nomer);
  129 + return (array(
  130 + "scaimagem" => $nomer,
  131 + "scawidth" => $objImagem->width,
  132 + "scaheight" => $objImagem->height,
  133 + "scapath" => $objImagem->imagepath,
  134 + "scaurl" => $objImagem->imageurl
  135 + ));
  136 + }
  137 +
  138 + /*
  139 + * function: parametrosBarraEscala
  140 + *
  141 + * Pega os par&acirc;metros da barra de escala.
  142 + *
  143 + * return:
  144 + * string javascript com os parametros.
  145 + */
  146 + function parametrosBarraEscala()
  147 + {
  148 + $eb = $this->mapa->scalebar;
  149 + $cor = $eb->color;
  150 + $fcor = $cor->red . "," . $cor->green . "," . $cor->blue;
  151 + $cor = $eb->backgroundcolor;
  152 + $bcor = $cor->red . "," . $cor->green . "," . $cor->blue;
  153 + $cor = $eb->outlinecolor;
  154 + $ocor = $cor->red . "," . $cor->green . "," . $cor->blue;
  155 + return (array(
  156 + "color" => $fcor,
  157 + "backgroundcolor" => $bcor,
  158 + "outlinecolor" => $ocor,
  159 + "status" => $eb->status,
  160 + "width" => $eb->width,
  161 + "height" => $eb->height,
  162 + "style" => $eb->style,
  163 + "intervals" => $eb->intervals,
  164 + "units" => $eb->units
  165 + ));
  166 + }
  167 +
  168 + /*
  169 + * array("color"=>"","backgroundcolor"=>"","outlinecolor"=>"","status"=>"","width"=>"","height"=>"","style"=>"","intervals"=>"","units"=>"")
  170 + */
  171 + function mudaEscalaGrafica($parameters = array("color"=>"","backgroundcolor"=>"","outlinecolor"=>"","status"=>"","width"=>"","height"=>"","style"=>"","intervals"=>"","units"=>""))
  172 + {
  173 + $eb = $this->mapa->scalebar;
  174 + $eb->set("width", $parameters["width"]);
  175 + $eb->set("height", $parameters["height"]);
  176 + if ($parameters["style"] != 2) {
  177 + $eb->set("style", $parameters["style"]);
  178 + }
  179 + $eb->set("intervals", $parameters["intervals"]);
  180 + $eb->set("units", $parameters["units"]);
  181 + $corn = $eb->color;
  182 + $n = explode(",", $parameters["color"]);
  183 + $corn->setrgb($n[0], $n[1], $n[2]);
  184 + $cornb = $eb->backgroundcolor;
  185 + $n = explode(",", $parameters["backgroundcolor"]);
  186 + $cornb->setrgb($n[0], $n[1], $n[2]);
  187 + $corno = $eb->outlinecolor;
  188 + $n = explode(",", $parameters["outlinecolor"]);
  189 + $corno->setrgb($n[0], $n[1], $n[2]);
  190 + // desabilita a escala
  191 + if ($parameters["style"] == 2) {
  192 + $eb->set("status", MS_OFF);
  193 + } else {
  194 + $eb->set("status", MS_EMBED);
  195 + }
  196 + if ($parameters["status"] == 3) {
  197 + $eb->set("status", MS_EMBED);
  198 + } // MS_ON, MS_OFF, MS_EMBED
  199 + else {
  200 + $eb->set("status", MS_OFF);
  201 + }
  202 + $this->salva();
  203 + return ("ok");
  204 + }
  205 +
  206 + /*
  207 + * array("color"=>"","backgroundcolor"=>"","outlinecolor"=>"","status"=>"","width"=>"","height"=>"","style"=>"","intervals"=>"","units"=>"")
  208 + */
  209 + function testaescalagrafica($parameters = array("color"=>"","backgroundcolor"=>"","outlinecolor"=>"","status"=>"","width"=>"","height"=>"","style"=>"","intervals"=>"","units"=>""))
  210 + {
  211 + $eb = $this->mapa->scalebar;
  212 + $eb->set("width", $parameters["width"]);
  213 + $eb->set("height", $parameters["height"]);
  214 + if ($parameters["style"] != 2) {
  215 + $eb->set("style", $parameters["style"]);
  216 + }
  217 + $eb->set("intervals", $parameters["intervals"]);
  218 + $eb->set("units", $parameters["units"]);
  219 + $corn = $eb->color;
  220 + $n = explode(",", $parameters["color"]);
  221 + $corn->setrgb($n[0], $n[1], $n[2]);
  222 + $cornb = $eb->backgroundcolor;
  223 + $n = explode(",", $parameters["backgroundcolor"]);
  224 + $cornb->setrgb($n[0], $n[1], $n[2]);
  225 + $corno = $eb->outlinecolor;
  226 + $n = explode(",", $parameters["outlinecolor"]);
  227 + $corno->setrgb($n[0], $n[1], $n[2]);
  228 + // desabilita a escala
  229 + if ($parameters["style"] == 2) {
  230 + $eb->set("status", MS_OFF);
  231 + } else {
  232 + $eb->set("status", MS_EMBED);
  233 + }
  234 + if ($parameters["status"] == 3) {
  235 + $eb->set("status", MS_EMBED);
  236 + } // MS_ON, MS_OFF, MS_EMBED
  237 + else {
  238 + $eb->set("status", MS_OFF);
  239 + }
  240 + $objImagem = $this->mapa->drawscalebar();
  241 + $nomer = ($objImagem->imagepath) . "sca" . $this->nomeImagem . ".png";
  242 + $objImagem->saveImage($nomer);
  243 + $nomer = ($objImagem->imageurl) . basename($nomer);
  244 + return ($nomer);
  245 + }
  246 +}
219 ?> 247 ?>
220 \ No newline at end of file 248 \ No newline at end of file
classesphp/classe_legenda.php
@@ -468,15 +468,16 @@ class Legenda @@ -468,15 +468,16 @@ class Legenda
468 echo "Erro IMAGEPATH vazio"; 468 echo "Erro IMAGEPATH vazio";
469 exit(); 469 exit();
470 } 470 }
471 - $nomer = ($imgo->imagepath) . "leg" . $nomeImagem . ".png";  
472 - $imgo->saveImage($nomer);  
473 - $nomer = ($imgo->imageurl) . basename($nomer); 471 + $arq = ($imgo->imagepath) . "leg" . $nomeImagem . ".png";
  472 + $imgo->saveImage($arq);
  473 + $nomer = ($imgo->imageurl) . basename($arq);
474 return (array( 474 return (array(
475 "imagem" => $nomer, 475 "imagem" => $nomer,
476 "width" => $imgo->width, 476 "width" => $imgo->width,
477 "height" => $imgo->height, 477 "height" => $imgo->height,
478 "path" => $imgo->imagepath, 478 "path" => $imgo->imagepath,
479 - "url" => $imgo->imageurl 479 + "url" => $imgo->imageurl,
  480 + "arq" => $arq
480 )); 481 ));
481 } 482 }
482 483
ferramentas/imprimir/dicionario.js
@@ -30,9 +30,19 @@ i3GEOF.imprimir.dicionario = { @@ -30,9 +30,19 @@ i3GEOF.imprimir.dicionario = {
30 en : $trad("p7"), 30 en : $trad("p7"),
31 es : $trad("p7"), 31 es : $trad("p7"),
32 } ], 32 } ],
33 - "ref" : [ {  
34 - pt : $trad("d9t"),  
35 - en : $trad("d9t"),  
36 - es : $trad("d9t"),  
37 - } ] 33 + "ref" : [ {
  34 + pt : $trad("d9t"),
  35 + en : $trad("d9t"),
  36 + es : $trad("d9t"),
  37 + } ],
  38 + "mapaPng" : [ {
  39 + pt : $trad("g4a"),
  40 + en : $trad("g4a"),
  41 + es : $trad("g4a"),
  42 + } ],
  43 + "legenda" : [ {
  44 + pt : $trad("p3"),
  45 + en : $trad("p3"),
  46 + es : $trad("p3"),
  47 + } ]
38 }; 48 };
39 \ No newline at end of file 49 \ No newline at end of file
ferramentas/imprimir/index.js
@@ -10,8 +10,8 @@ i3GEOF.imprimir = { @@ -10,8 +10,8 @@ i3GEOF.imprimir = {
10 }, 10 },
11 start : function(){ 11 start : function(){
12 var p = this._parameters, 12 var p = this._parameters,
13 - i3f = this,  
14 - t1 = i3GEO.configura.locaplic + "/ferramentas/"+p.namespace+"/template_mst.html"; 13 + i3f = this,
  14 + t1 = i3GEO.configura.locaplic + "/ferramentas/"+p.namespace+"/template_mst.html";
15 if(p.mustache === ""){ 15 if(p.mustache === ""){
16 $.get(t1, function(template) { 16 $.get(t1, function(template) {
17 p.mustache = template; 17 p.mustache = template;
@@ -25,51 +25,68 @@ i3GEOF.imprimir = { @@ -25,51 +25,68 @@ i3GEOF.imprimir = {
25 }, 25 },
26 html:function() { 26 html:function() {
27 var p = this._parameters, 27 var p = this._parameters,
28 - i3f = this,  
29 - hash = i3GEO.idioma.objetoIdioma(i3GEOF[p.namespace].dicionario); 28 + i3f = this,
  29 + hash = i3GEO.idioma.objetoIdioma(i3GEOF[p.namespace].dicionario);
30 hash["locaplic"] = i3GEO.configura.locaplic; 30 hash["locaplic"] = i3GEO.configura.locaplic;
31 hash["namespace"] = p.namespace; 31 hash["namespace"] = p.namespace;
32 hash["idContainer"] = p.idContainer; 32 hash["idContainer"] = p.idContainer;
33 i3f.renderFunction.call(this,{texto: Mustache.render(p.mustache, hash)}); 33 i3f.renderFunction.call(this,{texto: Mustache.render(p.mustache, hash)});
34 i3GEO.janela.applyScrollBar(p.idContainer); 34 i3GEO.janela.applyScrollBar(p.idContainer);
35 - var temp = function(retorno){  
36 - g_legendaHTML = retorno.data.legenda;  
37 - };  
38 - i3GEO.php.criaLegendaHTML(temp,"","legendaseminput.htm");  
39 }, 35 },
40 pngExport: function(){ 36 pngExport: function(){
41 i3geoOL.once('postcompose', function(event) { 37 i3geoOL.once('postcompose', function(event) {
42 - var canvas = event.context.canvas;  
43 - if (navigator.msSaveBlob) {  
44 - navigator.msSaveBlob(canvas.msToBlob(), 'map.png');  
45 - } else {  
46 - canvas.toBlob(function(blob) {  
47 - saveAs(blob, 'map.png');  
48 - });  
49 - }  
50 - }); 38 + var canvas = event.context.canvas;
  39 + if (navigator.msSaveBlob) {
  40 + navigator.msSaveBlob(canvas.msToBlob(), 'map.png');
  41 + } else {
  42 + canvas.toBlob(function(blob) {
  43 + saveAs(blob, 'map.png');
  44 + });
  45 + }
  46 + });
51 i3geoOL.renderSync(); 47 i3geoOL.renderSync();
52 }, 48 },
53 tiffExport: function(){ 49 tiffExport: function(){
54 - var url = i3GEO.configura.locaplic + "/ferramentas/imprimir/geotif.php?g_sid="  
55 - + i3GEO.configura.sid  
56 - +"&mapexten="+i3GEO.util.extOSM2Geo(i3GEO.parametros.mapexten);  
57 - var link = document.createElement("a");  
58 - $(link).click(function(e) {  
59 - e.preventDefault();  
60 - window.location.href = url;  
61 - });  
62 - $(link).click(); 50 + var url = i3GEO.configura.locaplic + "/ferramentas/imprimir/geotif.php?g_sid="
  51 + + i3GEO.configura.sid
  52 + +"&mapexten="+i3GEO.util.extOSM2Geo(i3GEO.parametros.mapexten);
  53 + var link = document.createElement("a");
  54 + $(link).click(function(e) {
  55 + e.preventDefault();
  56 + window.location.href = url;
  57 + });
  58 + $(link).click();
63 }, 59 },
64 svgExport: function(){ 60 svgExport: function(){
65 - var url = i3GEO.configura.locaplic + "/ferramentas/imprimir/svg.php?g_sid="  
66 - + i3GEO.configura.sid  
67 - +"&mapexten="+i3GEO.util.extOSM2Geo(i3GEO.parametros.mapexten);  
68 - var link = document.createElement("a");  
69 - $(link).click(function(e) {  
70 - e.preventDefault();  
71 - window.location.href = url;  
72 - });  
73 - $(link).click(); 61 + var url = i3GEO.configura.locaplic + "/ferramentas/imprimir/svg.php?g_sid="
  62 + + i3GEO.configura.sid
  63 + +"&mapexten="+i3GEO.util.extOSM2Geo(i3GEO.parametros.mapexten);
  64 + var link = document.createElement("a");
  65 + $(link).click(function(e) {
  66 + e.preventDefault();
  67 + window.location.href = url;
  68 + });
  69 + $(link).click();
  70 + },
  71 + legendExport: function(){
  72 + var url = i3GEO.configura.locaplic + "/ferramentas/opcoeslegenda/exec.php?g_sid="
  73 + + i3GEO.configura.sid + "&funcao=getlegenda&=" + i3GEO.util.uid();
  74 + i3GEO.janela.closeMsg("<img src='" + url + "' >");
  75 + },
  76 + scaleExport: function(){
  77 + var url = i3GEO.configura.locaplic + "/ferramentas/opcoesescala/exec.php?g_sid="
  78 + + i3GEO.configura.sid
  79 + + "&ext=" + i3GEO.util.extOSM2Geo(i3GEO.parametros.mapexten)
  80 + + "&funcao=getscaleimg&="
  81 + + i3GEO.util.uid();
  82 + i3GEO.janela.closeMsg("<img src='" + url + "' >");
  83 + },
  84 + maparefExport: function(){
  85 + var url = i3GEO.configura.locaplic + "/ferramentas/opcoesmaparef/exec.php?g_sid="
  86 + + i3GEO.configura.sid
  87 + + "&ext=" + i3GEO.util.extOSM2Geo(i3GEO.parametros.mapexten)
  88 + + "&funcao=getrefimg&="
  89 + + i3GEO.util.uid();
  90 + i3GEO.janela.closeMsg("<img src='" + url + "' >");
74 } 91 }
75 }; 92 };
ferramentas/imprimir/template_mst.html
1 <div id='{{idContainer}}' class='container-fluid container-tools'> 1 <div id='{{idContainer}}' class='container-fluid container-tools'>
2 <div class='form-group condensed'> 2 <div class='form-group condensed'>
  3 + <button onclick='i3GEOF.{{namespace}}.pngExport();' class='btn btn-default btn-xs btn-raised'>{{{mapaPng}}}</button>
  4 + <button onclick='i3GEOF.{{namespace}}.legendExport();' class='btn btn-default btn-xs btn-raised'>{{{legenda}}}</button>
  5 + <button onclick='i3GEOF.{{namespace}}.scaleExport();' class='btn btn-default btn-xs btn-raised'>{{{escala}}}</button>
  6 + <button onclick='i3GEOF.{{namespace}}.maparefExport();' class='btn btn-default btn-xs btn-raised'>{{{ref}}}</button>
3 <button onclick='i3GEOF.{{namespace}}.tiffExport();' class='btn btn-default btn-xs btn-raised'>Geo Tiff</button> 7 <button onclick='i3GEOF.{{namespace}}.tiffExport();' class='btn btn-default btn-xs btn-raised'>Geo Tiff</button>
4 - <button onclick='i3GEOF.{{namespace}}.pngExport();' class='btn btn-default btn-xs btn-raised'>Png</button>  
5 - <button onclick='i3GEOF.{{namespace}}.svgExport();' class='btn btn-default btn-xs btn-raised'>Svg - vetorial</button> 8 + <button onclick='i3GEOF.{{namespace}}.svgExport();' class='btn btn-default btn-xs btn-raised'>Svg</button>
6 </div> 9 </div>
7 <div class='form-group condensed'> 10 <div class='form-group condensed'>
8 <h4>{{{config}}}:</h4> 11 <h4>{{{config}}}:</h4>
ferramentas/opcoesescala/exec.php
@@ -13,7 +13,7 @@ Aplica novos par&amp;acirc;metros na barra de escala atual. @@ -13,7 +13,7 @@ Aplica novos par&amp;acirc;metros na barra de escala atual.
13 <Escala->mudaEscalaGrafica> 13 <Escala->mudaEscalaGrafica>
14 */ 14 */
15 case "MUDAESCALAGRAFICA": 15 case "MUDAESCALAGRAFICA":
16 - $m = new Escala($_SESSION["map_file"]); 16 + $m = new Escala($_SESSION["map_file"],"","",$_SESSION["mapexten"]);
17 $retorno = $m->mudaEscalaGrafica($_GET); 17 $retorno = $m->mudaEscalaGrafica($_GET);
18 ob_clean(); 18 ob_clean();
19 header("Content-type: application/json"); 19 header("Content-type: application/json");
@@ -46,12 +46,20 @@ Testa os novos par&amp;acirc;metros de uma barra de escala. @@ -46,12 +46,20 @@ Testa os novos par&amp;acirc;metros de uma barra de escala.
46 */ 46 */
47 case "TESTAESCALAGRAFICA": 47 case "TESTAESCALAGRAFICA":
48 include_once(dirname(__FILE__)."/../../classesphp/classe_escala.php"); 48 include_once(dirname(__FILE__)."/../../classesphp/classe_escala.php");
49 - $m = new Escala($_SESSION["map_file"]); 49 + $m = new Escala($_SESSION["map_file"],"","",$_GET["ext"]);
50 $retorno = $m->testaescalagrafica($_GET); 50 $retorno = $m->testaescalagrafica($_GET);
51 ob_clean(); 51 ob_clean();
52 header("Content-type: application/json"); 52 header("Content-type: application/json");
53 echo json_encode($retorno); 53 echo json_encode($retorno);
54 exit; 54 exit;
55 break; 55 break;
  56 + case "GETSCALEIMG":
  57 + $m = new Escala($_SESSION["map_file"],"","",$_GET["ext"]);
  58 + $retorno = $m->retornaBarraEscala();
  59 + ob_end_clean();
  60 + header('Content-type: image/png');
  61 + readfile($retorno["scaimagem"]);
  62 + exit;
  63 + break;
56 64
57 } 65 }
58 \ No newline at end of file 66 \ No newline at end of file
ferramentas/opcoesescala/index.js
@@ -75,6 +75,7 @@ i3GEOF.opcoesescala = { @@ -75,6 +75,7 @@ i3GEOF.opcoesescala = {
75 }, 75 },
76 getFormData: function(){ 76 getFormData: function(){
77 var data = i3GEO.util.getFormData("#" + this._parameters.idContainer + " form"); 77 var data = i3GEO.util.getFormData("#" + this._parameters.idContainer + " form");
  78 + data.ext = i3GEO.util.extOSM2Geo(i3GEO.parametros.mapexten);
78 return data 79 return data
79 }, 80 },
80 mudaEscalaGrafica: function(btn){ 81 mudaEscalaGrafica: function(btn){
ferramentas/opcoeslegenda/exec.php
@@ -59,5 +59,12 @@ Testa os par&amp;acirc;metros de defini&amp;ccedil;&amp;atilde;o da legenda inserida no mapa @@ -59,5 +59,12 @@ Testa os par&amp;acirc;metros de defini&amp;ccedil;&amp;atilde;o da legenda inserida no mapa
59 echo json_encode($retorno["imagem"]); 59 echo json_encode($retorno["imagem"]);
60 exit; 60 exit;
61 break; 61 break;
62 - 62 + case "GETLEGENDA":
  63 + $m = new Legenda($_SESSION["map_file"]);
  64 + $retorno = $m->legendaGrafica();
  65 + ob_end_clean();
  66 + header('Content-type: image/png');
  67 + readfile($retorno["arq"]);
  68 + exit;
  69 + break;
63 } 70 }
ferramentas/opcoesmaparef/exec.php
@@ -34,4 +34,23 @@ switch (strtoupper($_GET[&quot;funcao&quot;])) @@ -34,4 +34,23 @@ switch (strtoupper($_GET[&quot;funcao&quot;]))
34 echo json_encode($retorno); 34 echo json_encode($retorno);
35 exit; 35 exit;
36 break; 36 break;
  37 + case "GETREFIMG":
  38 + $map = ms_newMapObj($_SESSION["map_file"]);
  39 + $ext = explode(" ", $_GET["ext"]);
  40 + $extatual = $map->extent;
  41 + $extatual->setextent($ext[0], $ext[1], $ext[2], $ext[3]);
  42 + $ref = $map->reference;
  43 + $o = $ref->outlinecolor;
  44 + if ($o->red == - 1) {
  45 + $o->setrgb(255, 0, 0);
  46 + }
  47 + $map->preparequery();
  48 + $objImagem = $map->drawreferencemap();
  49 + $nomer = ($objImagem->imagepath) . "ref" . nomeRandomico(5) . ".png";
  50 + $objImagem->saveImage($nomer);
  51 + ob_clean();
  52 + header('Content-type: image/png');
  53 + readfile($nomer);
  54 + exit;
  55 + break;
37 } 56 }
38 \ No newline at end of file 57 \ No newline at end of file
interface/ol.php
@@ -388,7 +388,7 @@ include ($configInc[&quot;url&quot;].&quot;/css.php&quot;); @@ -388,7 +388,7 @@ include ($configInc[&quot;url&quot;].&quot;/css.php&quot;);
388 controls : [ 388 controls : [
389 //new ol.control.Zoom(), 389 //new ol.control.Zoom(),
390 //new ol.control.ZoomSlider(), 390 //new ol.control.ZoomSlider(),
391 - new ol.control.ScaleLine(), 391 + //new ol.control.ScaleLine(),
392 new ol.control.Attribution({ 392 new ol.control.Attribution({
393 collapsible : true 393 collapsible : true
394 }) 394 })
interface/openlayersdebug.php
@@ -388,7 +388,7 @@ include ($configInc[&quot;url&quot;].&quot;/css.php&quot;); @@ -388,7 +388,7 @@ include ($configInc[&quot;url&quot;].&quot;/css.php&quot;);
388 controls : [ 388 controls : [
389 //new ol.control.Zoom(), 389 //new ol.control.Zoom(),
390 //new ol.control.ZoomSlider(), 390 //new ol.control.ZoomSlider(),
391 - new ol.control.ScaleLine(), 391 + //new ol.control.ScaleLine(),//o Openlayers aparentemente tem um bug
392 new ol.control.Attribution({ 392 new ol.control.Attribution({
393 collapsible : true 393 collapsible : true
394 }) 394 })