Commit 1145194e791d8a6dc7dd752b75f7c59e74871091

Authored by Edmar Moretti
1 parent d47d60b0

i3geo/i3geo#57 conclusão da implementação de UTFGRID

classesphp/classe_toponimia.php
1 1 <?php
2   -/*
3   -Title: classe_toponimia.php
4   -
5   -Processa a topon&iacute;mia de um tema.
6   -
7   -Adiciona, remove, altera, etc.
8   -
9   -Cria camadas com a topon&iacute;mia e gerencia o status das etiquetas mostradas no mapa.
10   -
11   -Licenca:
12   -
13   -GPL2
14   -
15   -
16   -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
17   -
18   -Direitos Autorais Reservados (c) 2006 Minist&eacute;rio do Meio Ambiente Brasil
19   -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com
20 2  
21   -Este programa &eacute; software livre; voc&ecirc; pode redistribu&iacute;-lo
22   -e/ou modific&aacute;-lo sob os termos da Licen&ccedil;a P&uacute;blica Geral
23   -GNU conforme publicada pela Free Software Foundation;
24   -
25   -Este programa &eacute; distribu&iacute;do na expectativa de que seja &uacute;til,
26   -por&eacute;m, SEM NENHUMA GARANTIA; nem mesmo a garantia impl&iacute;cita
27   -de COMERCIABILIDADE OU ADEQUA&Ccedil;&Atilde;O A UMA FINALIDADE ESPEC&Iacute;FICA.
28   -Consulte a Licen&ccedil;a P&uacute;blica Geral do GNU para mais detalhes.
29   -Voc&ecirc; deve ter recebido uma c�pia da Licen&ccedil;a P&uacute;blica Geral do
30   -GNU junto com este programa; se n&atilde;o, escreva para a
31   -Free Software Foundation, Inc., no endere&ccedil;o
32   -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
33   -
34   -Arquivo:
35   -
36   -i3geo/classesphp/classe_toponimia.php
37   -*/
38 3 /*
39   -Classe: Toponimia
40   -*/
41   -
  4 + * Title: classe_toponimia.php
  5 + *
  6 + * Processa a topon&iacute;mia de um tema.
  7 + *
  8 + * Adiciona, remove, altera, etc.
  9 + *
  10 + * Cria camadas com a topon&iacute;mia e gerencia o status das etiquetas mostradas no mapa.
  11 + *
  12 + * Licenca:
  13 + *
  14 + * GPL2
  15 + *
  16 + *
  17 + * i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
  18 + *
  19 + * Direitos Autorais Reservados (c) 2006 Minist&eacute;rio do Meio Ambiente Brasil
  20 + * Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com
  21 + *
  22 + * Este programa &eacute; software livre; voc&ecirc; pode redistribu&iacute;-lo
  23 + * e/ou modific&aacute;-lo sob os termos da Licen&ccedil;a P&uacute;blica Geral
  24 + * GNU conforme publicada pela Free Software Foundation;
  25 + *
  26 + * Este programa &eacute; distribu&iacute;do na expectativa de que seja &uacute;til,
  27 + * por&eacute;m, SEM NENHUMA GARANTIA; nem mesmo a garantia impl&iacute;cita
  28 + * de COMERCIABILIDADE OU ADEQUA&Ccedil;&Atilde;O A UMA FINALIDADE ESPEC&Iacute;FICA.
  29 + * Consulte a Licen&ccedil;a P&uacute;blica Geral do GNU para mais detalhes.
  30 + * Voc&ecirc; deve ter recebido uma c�pia da Licen&ccedil;a P&uacute;blica Geral do
  31 + * GNU junto com este programa; se n&atilde;o, escreva para a
  32 + * Free Software Foundation, Inc., no endere&ccedil;o
  33 + * 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  34 + *
  35 + * Arquivo:
  36 + *
  37 + * i3geo/classesphp/classe_toponimia.php
  38 + */
  39 +/*
  40 + * Classe: Toponimia
  41 + */
42 42 class Toponimia
43 43 {
44   - /*
45   - Variavel: $mapa
46   -
47   - Objeto mapa
48   - */
49   - protected $mapa;
50   - /*
51   - Variavel: $map_file
52   -
53   - Arquivo map file
54   - */
55   - protected $map_file;
56   - /*
57   - Variavel: $layer
58   -
59   - Objeto layer
60   - */
61   - public $layer;
62   - /*
63   - Variavel: $nome
64   -
65   - Nome do layer
66   - */
67   - protected $nome;
68   - /*
69   - Variavel: $v
70   -
71   - Vers&atilde;o atual do Mapserver (primeiro d&iacute;gito)
72   - */
73   - public $v;
74   - /*
75   - Variavel: $vi
76   -
77   - Vers&atilde;o atual do Mapserver (valor inteiro)
78   -
79   - Returns the MapServer version number (x.y.z) as an integer (x*10000 + y*100 + z). (New in v5.0) e.g. V5.4.3 would return 50403
80   - */
81   - public $vi;
82   -/*
83   -function __construct
84   -
85   -Cria um objeto map e seta a variavel tema
86   -
87   -parameters:
88   -$map_file - Endere&ccedil;o do mapfile no servidor.
89   -
90   -$tema - nome do tema que ser&aacute; processado
91   -*/
92   - function __construct($map_file,$tema="",$locaplic="")
93   - {
94   - include(dirname(__FILE__)."/../ms_configura.php");
95   - $this->postgis_mapa = $postgis_mapa;
96   -
97   - if(file_exists($locaplic."/funcoes_gerais.php"))
98   - include_once($locaplic."/funcoes_gerais.php");
99   - else
100   - include_once("funcoes_gerais.php");
101   -
102   - $this->v = versao();
103   - $this->vi = $this->v["inteiro"];
104   - $this->v = $this->v["principal"];
105   -
106   - $this->mapa = ms_newMapObj($map_file);
107   - substituiConObj($this->mapa,$postgis_mapa);
108   -
109   - $this->arquivo = str_replace(".map","",$map_file).".map";
110   - if($tema != "" && @$this->mapa->getlayerbyname($tema))
111   - $this->layer = $this->mapa->getlayerbyname($tema);
112   - $this->nome = $tema;
113   - }
114   -/*
115   -function: salva
116   -
117   -Salva o mapfile atual
118   -*/
119   - function salva()
120   - {
121   - restauraConObj($this->mapa,$this->postgis_mapa);
122   - $this->mapa->save($this->arquivo);
123   - }
124   -/*
125   -function: criaToponimia
126   -
127   -Cria a topon&iacute;mia de um tema
128   -
129   -parameter:
130   -
131   -$item Item que ser&aacute; utilizado.
132 44  
133   -$position Posi&ccedil;&atilde;o da &acirc;ncora do texto.
134   -
135   -$partials Corta texto nas bordas do mapa.
136   -
137   -$offsetx Deslocamento em X.
138   -
139   -$offsety Deslocamento em Y.
140   -
141   -$minfeaturesize Tamanho m&iacute;nimo que o texto deve ter.
142   -
143   -$mindistance Dist&acirc;ncia m&iacute;nima entre os textos.
144   -
145   -$force For&ccedil;a colis&atilde;o.
146   -
147   -$shadowcolor Cor da sombra.
148   -
149   -$shadowsizex Tamanho em X da sombra.
150   -
151   -$shadowsizey Tamanho em Y da sombra.
152   -
153   -$outlinecolor Cor do contorno.
154   -
155   -$cor Cor do texto.
156   -
157   -$sombray Deslocamento Y da sombra.
158   -
159   -$sombrax Deslocamento X da sombra.
160   -
161   -$sombra string Inclui sombra.
162   -
163   -$fundo Cor do fundo.
164   -
165   -$angulo &Acirc;ngulo do texto.
166   -
167   -$tamanho Tamanho do texto.
168   -
169   -$fonte Fonte.
170   -
171   -$tipo Tipo teste|
172   -
173   -$wrap
174   -
175   -$novotema sim|nao Cria um novo tema ou n&atilde;o, nesse &uacute;ltimo caso, a topon&iacute;mia &eacute; inserida em todas as classes
176   -
177   -Retorno:
178   -
179   -{string} - codigo do layer criado
180   -*/
181   - function criaToponimia($item,$position,$partials,$offsetx,$offsety,$minfeaturesize,$mindistance,$force,$shadowcolor,$shadowsizex,$shadowsizey,$outlinecolor,$cor,$sombray,$sombrax,$sombra,$fundo,$angulo,$tamanho,$fonte,$tipo,$wrap,$novotema="sim")
182   - {
183   - //error_reporting(0);
184   - if(!$this->layer){return "erro";}
185   - $this->removeToponimia();
186   -
187   - if (!isset($tipo)){$tipo = "";}
188   - if ($item != "") //o layer nao tem tabela mas tem toponimia
189   - {
190   - if($novotema == "sim"){
191   - $nome = pegaNome($this->layer);
192   - $novolayer = ms_newLayerObj($this->mapa, $this->layer);
193   - $nomer = nomeRandomico();
194   - $novolayer->set("name",$nomer);
195   - $novolayer->set("group","");
196   - $novolayer->set("type",$this->layer->type);
197   - $nclasses = $novolayer->numclasses;
198   - for ($i=0; $i < $nclasses; ++$i){
199   - $c = $novolayer->getclass($i);
200   - $c->set("status",MS_DELETE);
201   - }
202   - $novac = ms_newClassObj($novolayer);
203   - $novolayer->set("status",MS_DEFAULT);
204   - $novolayer->setmetadata("tema","texto de ".$nome);
205   - $novolayer->setmetadata("tip","");
206   - $novolayer->setmetadata("tiles","nao");
207   - $novolayer->setmetadata("identifica","nao");
208   - $novolayer->set("labelitem",$item);
209   - }
210   - else{
211   - $nomer = $this->layer->name;
212   - $novolayer = $this->mapa->getlayerbyname($nomer);
213   - }
214   - $novolayer->setmetadata("cache","");
215   - $this->layer = $novolayer;
216   - }
217   - else
218   - {
219   - $nomer = $this->layer->name;
220   - }
221   - if(!($this->vi >= 60200)){
222   - $this->layer->set("labelitem",$item);
223   - }
224   - $nclasses = $this->layer->numclasses;
225   - for ($i=0; $i < $nclasses; ++$i){
226   - $novac = $this->layer->getclass($i);
227   - if($this->vi >= 60200){
228   - $s = "CLASS LABEL TEXT '[".$item."]' END END";
229   - $novac->updateFromString($s);
230   - $label = $novac->getLabel($indiceLabel);
231   - }
232   - else{
233   - $label = $novac->label;
234   - }
235   - if($wrap != "")
236   - {
237   - $label->set("maxlength",1);
238   - $s = $novac->getTextString;
239   - $s = "CLASS LABEL WRAP '$wrap' END END";
240   - $novac->updateFromString($s);
241   - }
242   - if($this->vi >= 60200){
243   - $label = $novac->getLabel($indiceLabel);
244   - }
245   - else{
246   - $label = $novac->label;
247   - }
248   - if ($fonte != "bitmap")
249   - {
250   - //$label->set("type",MS_TRUETYPE);
251   - $label->updatefromstring("LABEL TYPE TRUETYPE END");
252   - $label->set("font",$fonte);
253   - $label->set("size",$tamanho);
254   - }
255   - else
256   - {
257   - //$label->set("type",MS_BITMAP);
258   - $label->updatefromstring("LABEL TYPE BITMAP END");
259   - //$label->set("font",$fonte);
260   - $t = MS_TINY;
261   - if ($tamanho > 5 ){$t = MS_TINY;}
262   - if ($tamanho >= 7 ){$t = MS_SMALL;}
263   - if ($tamanho >= 10 ){$t = MS_MEDIUM;}
264   - if ($tamanho >= 12 ){$t = MS_LARGE;}
265   - if ($tamanho >= 14 ){$t = MS_GIANT;}
266   - $label->set("size",$t);
267   - }
268   - if($angulo > 0){
269   - $label->set("angle",$angulo);
270   - }
271   - if($angulo == "AUTO"){
272   - $label->updatefromstring("LABEL ANGLE AUTO END");
273   - }
274   - if (strtoupper($angulo) == "CURVO" || strtoupper($angulo) == "FOLLOW"){
275   - $label->updatefromstring("LABEL ANGLE FOLLOW END");
276   - }
277   - corE($label,$cor,"color");
278   - corE($label,$fundo,"backgroundcolor");
279   - corE($label,$sombra,"backgroundshadowcolor",$sombrax,$sombray);
280   - corE($label,$outlinecolor,"outlinecolor");
281   - corE($label,$shadowcolor,"shadowcolor");
282   - $label->set("shadowsizex",$shadowsizex);
283   - $label->set("shadowsizey",$shadowsizey);
284   - $label->set("force",$force);
285   - $label->set("mindistance",$mindistance);
286   - $label->set("minfeaturesize",$minfeaturesize);
287   - $label->set("offsetx",$offsetx);
288   - $label->set("offsety",$offsety);
289   - $label->set("partials",$partials);
290   - $p = array("MS_AUTO"=>MS_AUTO,"MS_UL"=>MS_UL,"MS_LR"=>MS_LR,"MS_UR"=>MS_UR,"MS_LL"=>MS_LL,"MS_CR"=>MS_CR,"MS_CL"=>MS_CL,"MS_UC"=>MS_UC,"MS_LC"=>MS_LC,"MS_CC"=>MS_CC);
291   - $label->set("position",$p[$position]);
292   - }
293   - if ($tipo == "teste"){
294   - $i = gravaImagemMapa($this->mapa);
295   - return ($i["url"]);
296   - }
297   - else
298   - {return($nomer);}
299   - }
300   - function removeToponimia(){
301   - $nclasses = $this->layer->numclasses;
302   - if($this->vi >= 60200){
303   - for ($i=0; $i < $nclasses; ++$i){
304   - $classe = $this->layer->getclass($i);
305   - while($classe->numlabels > 0){
306   - $classe->removeLabel(0);
307   - }
308   - }
309   - }
310   - if ($this->layer){
311   - $this->layer->setMetaData("cache","");
312   - }
313   - }
314   - /*
315   -function: ativaEtiquetas
316   -
317   -ativa a inclus&atilde;o de etiquetas em um tema
318   -
319   -parameter:
320   -$item Lista de Itens separados por v&iacute;rgula que ser&atilde;o utilizados.
321   -*/
322   - function ativaEtiquetas($item)
323   - {
324   - if(!$this->layer){return "erro";}
325   - $this->layer->setmetadata("IDENTIFICA","");
326   - $this->layer->setmetadata("TIP",$item);
327   - return("ok");
328   - }
329   - /*
330   - function: pegaDadosEtiquetas
331   -
332   - ativa a inclus&atilde;o de etiquetas em um tema
333   -
334   - parameter:
335   - $item Lista de Itens separados por v&iacute;rgula que ser&atilde;o utilizados.
336   - */
337   - function pegaDadosEtiquetas()
338   - {
339   - if(!$this->layer){return "erro";}
340   - $itens = $this->layer->getmetadata("ITENS");
341   - $itens = explode(",",$itens);
342   - $itensdesc = mb_convert_encoding($this->layer->getmetadata("ITENSDESC"),"UTF-8","ISO-8859-1");
343   - $itensdesc = explode(",",$itensdesc);
344   - $itenslink = $this->layer->getmetadata("ITENSLINK");
345   - $itenslink = explode(",",$itenslink);
346   -
347   - $tips = $this->layer->getmetadata("TIP");
348   -
349   - $res = array(
350   - "itens"=>$itens,
351   - "itensdesc"=>array_combine($itens,$itensdesc),
352   - "itenslink"=>array_combine($itens,$itenslink),
353   - "tips"=>explode(",",$tips),
354   - "itembuscarapida"=>$this->layer->getmetadata("itembuscarapida")
355   - );
356   - return($res);
357   - }
358   -/*
359   -function: removeEtiquetas
360   -
361   -remove a inclus&atilde;o de etiquetas em um tema.
362   -
363   -*/
364   - function removeEtiquetas()
365   - {
366   - if(!$this->layer){return "erro";}
367   - $this->layer->setmetadata("TIP","");
368   - return("ok");
369   - }
  45 + /*
  46 + * Variavel: $mapa
  47 + *
  48 + * Objeto mapa
  49 + */
  50 + protected $mapa;
  51 +
  52 + /*
  53 + * Variavel: $map_file
  54 + *
  55 + * Arquivo map file
  56 + */
  57 + protected $map_file;
  58 +
  59 + /*
  60 + * Variavel: $layer
  61 + *
  62 + * Objeto layer
  63 + */
  64 + public $layer;
  65 +
  66 + /*
  67 + * Variavel: $nome
  68 + *
  69 + * Nome do layer
  70 + */
  71 + protected $nome;
  72 +
  73 + /*
  74 + * Variavel: $v
  75 + *
  76 + * Vers&atilde;o atual do Mapserver (primeiro d&iacute;gito)
  77 + */
  78 + public $v;
  79 +
  80 + /*
  81 + * Variavel: $vi
  82 + *
  83 + * Vers&atilde;o atual do Mapserver (valor inteiro)
  84 + *
  85 + * Returns the MapServer version number (x.y.z) as an integer (x*10000 + y*100 + z). (New in v5.0) e.g. V5.4.3 would return 50403
  86 + */
  87 + public $vi;
  88 +
  89 + /*
  90 + * function __construct
  91 + *
  92 + * Cria um objeto map e seta a variavel tema
  93 + *
  94 + * parameters:
  95 + * $map_file - Endere&ccedil;o do mapfile no servidor.
  96 + *
  97 + * $tema - nome do tema que ser&aacute; processado
  98 + */
  99 + function __construct($map_file, $tema = "", $locaplic = "")
  100 + {
  101 + include (dirname(__FILE__) . "/../ms_configura.php");
  102 + $this->postgis_mapa = $postgis_mapa;
  103 +
  104 + if (file_exists($locaplic . "/funcoes_gerais.php"))
  105 + include_once ($locaplic . "/funcoes_gerais.php");
  106 + else
  107 + include_once ("funcoes_gerais.php");
  108 +
  109 + $this->v = versao();
  110 + $this->vi = $this->v["inteiro"];
  111 + $this->v = $this->v["principal"];
  112 +
  113 + $this->mapa = ms_newMapObj($map_file);
  114 + substituiConObj($this->mapa, $postgis_mapa);
  115 +
  116 + $this->arquivo = str_replace(".map", "", $map_file) . ".map";
  117 + if ($tema != "" && @$this->mapa->getlayerbyname($tema))
  118 + $this->layer = $this->mapa->getlayerbyname($tema);
  119 + $this->nome = $tema;
  120 + }
  121 +
  122 + /*
  123 + * function: salva
  124 + *
  125 + * Salva o mapfile atual
  126 + */
  127 + function salva()
  128 + {
  129 + restauraConObj($this->mapa, $this->postgis_mapa);
  130 + $this->mapa->save($this->arquivo);
  131 + }
  132 +
  133 + /*
  134 + * function: criaToponimia
  135 + *
  136 + * Cria a topon&iacute;mia de um tema
  137 + *
  138 + * parameter:
  139 + *
  140 + * $item Item que ser&aacute; utilizado.
  141 + *
  142 + * $position Posi&ccedil;&atilde;o da &acirc;ncora do texto.
  143 + *
  144 + * $partials Corta texto nas bordas do mapa.
  145 + *
  146 + * $offsetx Deslocamento em X.
  147 + *
  148 + * $offsety Deslocamento em Y.
  149 + *
  150 + * $minfeaturesize Tamanho m&iacute;nimo que o texto deve ter.
  151 + *
  152 + * $mindistance Dist&acirc;ncia m&iacute;nima entre os textos.
  153 + *
  154 + * $force For&ccedil;a colis&atilde;o.
  155 + *
  156 + * $shadowcolor Cor da sombra.
  157 + *
  158 + * $shadowsizex Tamanho em X da sombra.
  159 + *
  160 + * $shadowsizey Tamanho em Y da sombra.
  161 + *
  162 + * $outlinecolor Cor do contorno.
  163 + *
  164 + * $cor Cor do texto.
  165 + *
  166 + * $sombray Deslocamento Y da sombra.
  167 + *
  168 + * $sombrax Deslocamento X da sombra.
  169 + *
  170 + * $sombra string Inclui sombra.
  171 + *
  172 + * $fundo Cor do fundo.
  173 + *
  174 + * $angulo &Acirc;ngulo do texto.
  175 + *
  176 + * $tamanho Tamanho do texto.
  177 + *
  178 + * $fonte Fonte.
  179 + *
  180 + * $tipo Tipo teste|
  181 + *
  182 + * $wrap
  183 + *
  184 + * $novotema sim|nao Cria um novo tema ou n&atilde;o, nesse &uacute;ltimo caso, a topon&iacute;mia &eacute; inserida em todas as classes
  185 + *
  186 + * Retorno:
  187 + *
  188 + * {string} - codigo do layer criado
  189 + */
  190 + function criaToponimia($item, $position, $partials, $offsetx, $offsety, $minfeaturesize, $mindistance, $force, $shadowcolor, $shadowsizex, $shadowsizey, $outlinecolor, $cor, $sombray, $sombrax, $sombra, $fundo, $angulo, $tamanho, $fonte, $tipo, $wrap, $novotema = "sim")
  191 + {
  192 + // error_reporting(0);
  193 + if (! $this->layer) {
  194 + return "erro";
  195 + }
  196 + $this->removeToponimia();
  197 +
  198 + if (! isset($tipo)) {
  199 + $tipo = "";
  200 + }
  201 + if ($item != "") // o layer nao tem tabela mas tem toponimia
  202 +{
  203 + if ($novotema == "sim") {
  204 + $nome = pegaNome($this->layer);
  205 + $novolayer = ms_newLayerObj($this->mapa, $this->layer);
  206 + $nomer = nomeRandomico();
  207 + $novolayer->set("name", $nomer);
  208 + $novolayer->set("group", "");
  209 + $novolayer->set("type", $this->layer->type);
  210 + $nclasses = $novolayer->numclasses;
  211 + for ($i = 0; $i < $nclasses; ++ $i) {
  212 + $c = $novolayer->getclass($i);
  213 + $c->set("status", MS_DELETE);
  214 + }
  215 + $novac = ms_newClassObj($novolayer);
  216 + $novolayer->set("status", MS_DEFAULT);
  217 + $novolayer->setmetadata("tema", "texto de " . $nome);
  218 + $novolayer->setmetadata("tip", "");
  219 + $novolayer->setmetadata("tiles", "nao");
  220 + $novolayer->setmetadata("identifica", "nao");
  221 + $novolayer->set("labelitem", $item);
  222 + } else {
  223 + $nomer = $this->layer->name;
  224 + $novolayer = $this->mapa->getlayerbyname($nomer);
  225 + }
  226 + $novolayer->setmetadata("cache", "");
  227 + $this->layer = $novolayer;
  228 + } else {
  229 + $nomer = $this->layer->name;
  230 + }
  231 + if (! ($this->vi >= 60200)) {
  232 + $this->layer->set("labelitem", $item);
  233 + }
  234 + $nclasses = $this->layer->numclasses;
  235 + for ($i = 0; $i < $nclasses; ++ $i) {
  236 + $novac = $this->layer->getclass($i);
  237 + if ($this->vi >= 60200) {
  238 + $s = "CLASS LABEL TEXT '[" . $item . "]' END END";
  239 + $novac->updateFromString($s);
  240 + $label = $novac->getLabel($indiceLabel);
  241 + } else {
  242 + $label = $novac->label;
  243 + }
  244 + if ($wrap != "") {
  245 + $label->set("maxlength", 1);
  246 + $s = $novac->getTextString;
  247 + $s = "CLASS LABEL WRAP '$wrap' END END";
  248 + $novac->updateFromString($s);
  249 + }
  250 + if ($this->vi >= 60200) {
  251 + $label = $novac->getLabel($indiceLabel);
  252 + } else {
  253 + $label = $novac->label;
  254 + }
  255 + if ($fonte != "bitmap") {
  256 + // $label->set("type",MS_TRUETYPE);
  257 + $label->updatefromstring("LABEL TYPE TRUETYPE END");
  258 + $label->set("font", $fonte);
  259 + $label->set("size", $tamanho);
  260 + } else {
  261 + // $label->set("type",MS_BITMAP);
  262 + $label->updatefromstring("LABEL TYPE BITMAP END");
  263 + // $label->set("font",$fonte);
  264 + $t = MS_TINY;
  265 + if ($tamanho > 5) {
  266 + $t = MS_TINY;
  267 + }
  268 + if ($tamanho >= 7) {
  269 + $t = MS_SMALL;
  270 + }
  271 + if ($tamanho >= 10) {
  272 + $t = MS_MEDIUM;
  273 + }
  274 + if ($tamanho >= 12) {
  275 + $t = MS_LARGE;
  276 + }
  277 + if ($tamanho >= 14) {
  278 + $t = MS_GIANT;
  279 + }
  280 + $label->set("size", $t);
  281 + }
  282 + if ($angulo > 0) {
  283 + $label->set("angle", $angulo);
  284 + }
  285 + if ($angulo == "AUTO") {
  286 + $label->updatefromstring("LABEL ANGLE AUTO END");
  287 + }
  288 + if (strtoupper($angulo) == "CURVO" || strtoupper($angulo) == "FOLLOW") {
  289 + $label->updatefromstring("LABEL ANGLE FOLLOW END");
  290 + }
  291 + corE($label, $cor, "color");
  292 + corE($label, $fundo, "backgroundcolor");
  293 + corE($label, $sombra, "backgroundshadowcolor", $sombrax, $sombray);
  294 + corE($label, $outlinecolor, "outlinecolor");
  295 + corE($label, $shadowcolor, "shadowcolor");
  296 + $label->set("shadowsizex", $shadowsizex);
  297 + $label->set("shadowsizey", $shadowsizey);
  298 + $label->set("force", $force);
  299 + $label->set("mindistance", $mindistance);
  300 + $label->set("minfeaturesize", $minfeaturesize);
  301 + $label->set("offsetx", $offsetx);
  302 + $label->set("offsety", $offsety);
  303 + $label->set("partials", $partials);
  304 + $p = array(
  305 + "MS_AUTO" => MS_AUTO,
  306 + "MS_UL" => MS_UL,
  307 + "MS_LR" => MS_LR,
  308 + "MS_UR" => MS_UR,
  309 + "MS_LL" => MS_LL,
  310 + "MS_CR" => MS_CR,
  311 + "MS_CL" => MS_CL,
  312 + "MS_UC" => MS_UC,
  313 + "MS_LC" => MS_LC,
  314 + "MS_CC" => MS_CC
  315 + );
  316 + $label->set("position", $p[$position]);
  317 + }
  318 + if ($tipo == "teste") {
  319 + $i = gravaImagemMapa($this->mapa);
  320 + return ($i["url"]);
  321 + } else {
  322 + return ($nomer);
  323 + }
  324 + }
  325 +
  326 + function removeToponimia()
  327 + {
  328 + $nclasses = $this->layer->numclasses;
  329 + if ($this->vi >= 60200) {
  330 + for ($i = 0; $i < $nclasses; ++ $i) {
  331 + $classe = $this->layer->getclass($i);
  332 + while ($classe->numlabels > 0) {
  333 + $classe->removeLabel(0);
  334 + }
  335 + }
  336 + }
  337 + if ($this->layer) {
  338 + $this->layer->setMetaData("cache", "");
  339 + }
  340 + }
  341 +
  342 + /*
  343 + * function: ativaEtiquetas
  344 + *
  345 + * ativa a inclus&atilde;o de etiquetas em um tema
  346 + *
  347 + * parameter:
  348 + * $item Lista de Itens separados por v&iacute;rgula que ser&atilde;o utilizados.
  349 + */
  350 + function ativaEtiquetas($item)
  351 + {
  352 + if (! $this->layer) {
  353 + return "erro";
  354 + }
  355 + $this->layer->setmetadata("IDENTIFICA", "");
  356 + $this->layer->setmetadata("TIP", $item);
  357 + return ("ok");
  358 + }
  359 +
  360 + /*
  361 + * function: pegaDadosEtiquetas
  362 + *
  363 + * ativa a inclus&atilde;o de etiquetas em um tema
  364 + *
  365 + * parameter:
  366 + * $item Lista de Itens separados por v&iacute;rgula que ser&atilde;o utilizados.
  367 + */
  368 + function pegaDadosEtiquetas()
  369 + {
  370 + if (! $this->layer) {
  371 + return "erro";
  372 + }
  373 + $itens = $this->layer->getmetadata("ITENS");
  374 + $itens = explode(",", $itens);
  375 + $itensdesc = mb_convert_encoding($this->layer->getmetadata("ITENSDESC"), "UTF-8", "ISO-8859-1");
  376 + $itensdesc = explode(",", $itensdesc);
  377 + $itenslink = $this->layer->getmetadata("ITENSLINK");
  378 + $itenslink = explode(",", $itenslink);
  379 +
  380 + $tips = $this->layer->getmetadata("TIP");
  381 +
  382 + $res = array(
  383 + "itens" => $itens,
  384 + "itensdesc" => array_combine($itens, $itensdesc),
  385 + "itenslink" => array_combine($itens, $itenslink),
  386 + "tips" => explode(",", $tips),
  387 + "itembuscarapida" => $this->layer->getmetadata("itembuscarapida"),
  388 + "utfdata" => $this->layer->getmetadata("UTFDATA")
  389 + );
  390 + return ($res);
  391 + }
  392 +
  393 + /*
  394 + * function: removeEtiquetas
  395 + *
  396 + * remove a inclus&atilde;o de etiquetas em um tema.
  397 + *
  398 + */
  399 + function removeEtiquetas()
  400 + {
  401 + if (! $this->layer) {
  402 + return "erro";
  403 + }
  404 + $this->layer->setmetadata("TIP", "");
  405 + $this->layer->setmetadata("UTFDATA", "");
  406 + return ("ok");
  407 + }
370 408 }
371 409 ?>
... ...
ferramentas/etiqueta/exec.php
... ... @@ -23,6 +23,7 @@ Ativa as etiquetas de um tema.
23 23 $m->layer->setmetadata("ITENS",$_GET["itens"]);
24 24 $m->layer->setmetadata("ITENSDESC",$_GET["itensdesc"]);
25 25 $m->layer->setmetadata("ITENSLINK",$_GET["itenslink"]);
  26 + $m->layer->setmetadata("UTFDATA",$_GET["utfdata"]);
26 27 $m->layer->setmetadata("itembuscarapida",$_GET["itembuscarapida"]);
27 28 $m->salva();
28 29 $_SESSION["contadorsalva"]++;
... ... @@ -46,7 +47,7 @@ Desativa as etiquetas de um tema.
46 47 /*
47 48 Valor: PEGADADOSETIQUETAS
48 49  
49   -Obtém os dados sobre itens, itensdesc, etc
  50 +Obt�m os dados sobre itens, itensdesc, etc
50 51  
51 52 <Toponimia->pegaDadosEtiquetas>
52 53 */
... ...
ferramentas/etiqueta/index.js
... ... @@ -30,36 +30,36 @@ Voc&amp;ecirc; deve ter recebido uma c&amp;oacute;pia da Licen&amp;ccedil;a P&amp;uacute;blica G
30 30 GNU junto com este programa; se n&atilde;o, escreva para a
31 31 Free Software Foundation, Inc., no endere&ccedil;o
32 32 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
33   -*/
  33 + */
34 34 if(typeof(i3GEOF) === 'undefined'){
35   - var i3GEOF = {};
  35 + var i3GEOF = {};
36 36 }
37 37  
38 38 /*
39 39 Classe: i3GEOF.etiqueta
40   -*/
  40 + */
41 41 i3GEOF.etiqueta = {
42   - tema : i3GEO.temaAtivo,
43   - /*
  42 + tema : i3GEO.temaAtivo,
  43 + /*
44 44 Variavel: aguarde
45 45  
46 46 Estilo do objeto DOM com a imagem de aguarde existente no cabe&ccedil;alho da janela.
47   - */
48   - aguarde: "",
49   - /**
50   - * Template no formato mustache. E preenchido na carga do javascript com o programa dependencias.php
51   - */
52   - MUSTACHE : "",
53   - MUSTACHELISTA : "",
54   - /**
55   - * Susbtitutos para o template
56   - */
57   - mustacheHash : function() {
58   - var dicionario = i3GEO.idioma.objetoIdioma(i3GEOF.etiqueta.dicionario);
59   - dicionario["aplica"] = $trad("p14");
60   - return dicionario;
61   - },
62   - /*
  47 + */
  48 + aguarde: "",
  49 + /**
  50 + * Template no formato mustache. E preenchido na carga do javascript com o programa dependencias.php
  51 + */
  52 + MUSTACHE : "",
  53 + MUSTACHELISTA : "",
  54 + /**
  55 + * Susbtitutos para o template
  56 + */
  57 + mustacheHash : function() {
  58 + var dicionario = i3GEO.idioma.objetoIdioma(i3GEOF.etiqueta.dicionario);
  59 + dicionario["aplica"] = $trad("p14");
  60 + return dicionario;
  61 + },
  62 + /*
63 63 Function: inicia
64 64  
65 65 Inicia a ferramenta. &Eacute; chamado por criaJanelaFlutuante
... ... @@ -67,50 +67,50 @@ i3GEOF.etiqueta = {
67 67 Parametro:
68 68  
69 69 iddiv {String} - id do div que receber&aacute; o conteudo HTML da ferramenta
70   - */
71   - inicia: function(iddiv){
72   - if(i3GEOF.etiqueta.MUSTACHE == ""){
73   - var t1 = i3GEO.configura.locaplic + "/ferramentas/etiqueta/template_mst.html",
74   - t2 = i3GEO.configura.locaplic + "/ferramentas/etiqueta/templateLista_mst.html";
75   -
76   - $.when( $.get(t1),$.get(t2) ).done(function(r1,r2) {
77   - i3GEOF.etiqueta.MUSTACHE = r1[0];
78   - i3GEOF.etiqueta.MUSTACHELISTA = r2[0];
79   - i3GEOF.etiqueta.inicia(iddiv);
80   - }).fail(function() {
81   - i3GEO.janela.closeMsg($trad("erroTpl"));
82   - return;
83   - });
84   - return;
85   - }
86   -
87   - if(i3GEOF.etiqueta.tema === ""){
88   - $i(iddiv).innerHTML = "";
89   - return;
90   - }
91   - try{
92   - $i(iddiv).innerHTML = i3GEOF.etiqueta.html();
93   -
94   - if (!$i("i3GEOFetiquetaComboCabecaSel")) {
95   - i3GEO.janela.comboCabecalhoTemasBs("i3GEOFetiquetaComboCabeca","i3GEOFetiquetaComboCabecaSel","etiqueta","ligadosComTabela",function(evt){
96   - var botao = evt.target;
97   - if (botao) {
98   - if (botao.value != "") {
99   - i3GEO.mapa.ativaTema(botao.value);
100   - i3GEOF.etiqueta.tema = botao.value;
101   - $i(iddiv).innerHTML = "";
102   - i3GEOF.etiqueta.inicia(iddiv);
103   - } else {
104   - //$i(iddiv).innerHTML = "";
105   - }
106   - }
107   - });
108   - }
109   - i3GEOF.etiqueta.ativaFoco();
110   - }
111   - catch(erro){i3GEO.janela.tempoMsg(erro);}
112   - },
113   - /*
  70 + */
  71 + inicia: function(iddiv){
  72 + if(i3GEOF.etiqueta.MUSTACHE == ""){
  73 + var t1 = i3GEO.configura.locaplic + "/ferramentas/etiqueta/template_mst.html",
  74 + t2 = i3GEO.configura.locaplic + "/ferramentas/etiqueta/templateLista_mst.html";
  75 +
  76 + $.when( $.get(t1),$.get(t2) ).done(function(r1,r2) {
  77 + i3GEOF.etiqueta.MUSTACHE = r1[0];
  78 + i3GEOF.etiqueta.MUSTACHELISTA = r2[0];
  79 + i3GEOF.etiqueta.inicia(iddiv);
  80 + }).fail(function() {
  81 + i3GEO.janela.closeMsg($trad("erroTpl"));
  82 + return;
  83 + });
  84 + return;
  85 + }
  86 +
  87 + if(i3GEOF.etiqueta.tema === ""){
  88 + $i(iddiv).innerHTML = "";
  89 + return;
  90 + }
  91 + try{
  92 + $i(iddiv).innerHTML = i3GEOF.etiqueta.html();
  93 +
  94 + if (!$i("i3GEOFetiquetaComboCabecaSel")) {
  95 + i3GEO.janela.comboCabecalhoTemasBs("i3GEOFetiquetaComboCabeca","i3GEOFetiquetaComboCabecaSel","etiqueta","ligadosComTabela",function(evt){
  96 + var botao = evt.target;
  97 + if (botao) {
  98 + if (botao.value != "") {
  99 + i3GEO.mapa.ativaTema(botao.value);
  100 + i3GEOF.etiqueta.tema = botao.value;
  101 + $i(iddiv).innerHTML = "";
  102 + i3GEOF.etiqueta.inicia(iddiv);
  103 + } else {
  104 + //$i(iddiv).innerHTML = "";
  105 + }
  106 + }
  107 + });
  108 + }
  109 + i3GEOF.etiqueta.ativaFoco();
  110 + }
  111 + catch(erro){i3GEO.janela.tempoMsg(erro);}
  112 + },
  113 + /*
114 114 Function: html
115 115  
116 116 Gera o c&oacute;digo html para apresenta&ccedil;&atilde;o das op&ccedil;&otilde;es da ferramenta
... ... @@ -118,73 +118,73 @@ i3GEOF.etiqueta = {
118 118 Retorno:
119 119  
120 120 String com o c&oacute;digo html
121   - */
122   - html:function() {
123   - var ins = Mustache.render(i3GEOF.etiqueta.MUSTACHE, i3GEOF.etiqueta.mustacheHash());
124   - return ins;
125   - },
126   - /*
  121 + */
  122 + html:function() {
  123 + var ins = Mustache.render(i3GEOF.etiqueta.MUSTACHE, i3GEOF.etiqueta.mustacheHash());
  124 + return ins;
  125 + },
  126 + /*
127 127 Function: iniciaJanelaFlutuante
128 128  
129 129 Cria a janela flutuante para controle da ferramenta.
130   - */
131   - iniciaJanelaFlutuante: function(){
132   - var minimiza,cabecalho,janela,divid,temp,titulo;
133   - if($i("i3GEOF.etiqueta")){
134   - i3GEOF.etiqueta.inicia("i3GEOF.etiqueta_corpo");
135   - return;
136   - }
137   - cabecalho = function(){
138   - i3GEOF.etiqueta.ativaFoco();
139   - };
140   - minimiza = function(){
141   - i3GEO.janela.minimiza("i3GEOF.etiqueta");
142   - };
143   - //cria a janela flutuante
144   - titulo = "<span class='i3GeoTituloJanelaBsNolink' >"+$trad("d7at")+"</span></div>";
145   - janela = i3GEO.janela.cria(
146   - "510px",
147   - "300px",
148   - "",
149   - "",
150   - "",
151   - titulo,
152   - "i3GEOF.etiqueta",
153   - false,
154   - "hd",
155   - cabecalho,
156   - minimiza,
157   - "",
158   - true,
159   - "",
160   - "",
161   - "",
162   - "",
163   - "37"
164   - );
165   - divid = janela[2].id;
166   - i3GEOF.etiqueta.aguarde = $i("i3GEOF.etiqueta_imagemCabecalho").style;
167   - $i("i3GEOF.etiqueta_corpo").style.backgroundColor = "white";
168   - i3GEOF.etiqueta.inicia(divid);
169   - },
170   - /*
  130 + */
  131 + iniciaJanelaFlutuante: function(){
  132 + var minimiza,cabecalho,janela,divid,temp,titulo;
  133 + if($i("i3GEOF.etiqueta")){
  134 + i3GEOF.etiqueta.inicia("i3GEOF.etiqueta_corpo");
  135 + return;
  136 + }
  137 + cabecalho = function(){
  138 + i3GEOF.etiqueta.ativaFoco();
  139 + };
  140 + minimiza = function(){
  141 + i3GEO.janela.minimiza("i3GEOF.etiqueta");
  142 + };
  143 + //cria a janela flutuante
  144 + titulo = "<span class='i3GeoTituloJanelaBsNolink' >"+$trad("d7at")+"</span></div>";
  145 + janela = i3GEO.janela.cria(
  146 + "600px",
  147 + "380px",
  148 + "",
  149 + "",
  150 + "",
  151 + titulo,
  152 + "i3GEOF.etiqueta",
  153 + false,
  154 + "hd",
  155 + cabecalho,
  156 + minimiza,
  157 + "",
  158 + true,
  159 + "",
  160 + "",
  161 + "",
  162 + "",
  163 + "37"
  164 + );
  165 + divid = janela[2].id;
  166 + i3GEOF.etiqueta.aguarde = $i("i3GEOF.etiqueta_imagemCabecalho").style;
  167 + $i("i3GEOF.etiqueta_corpo").style.backgroundColor = "white";
  168 + i3GEOF.etiqueta.inicia(divid);
  169 + },
  170 + /*
171 171 Function: ativaFoco
172 172  
173 173 Refaz a interface da ferramenta quando a janela flutuante tem seu foco ativado
174   - */
175   - ativaFoco: function(){
176   - if(i3GEO.temaAtivo != ""){
177   - i3GEO.php.listaItensTema(i3GEOF.etiqueta.montaListaItens,i3GEOF.etiqueta.tema);
178   - }
179   - },
180   - pegaDadosEtiquetas: function(funcao){
181   - var cp = new cpaint(),
182   - p;
183   - p = i3GEO.configura.locaplic+"/ferramentas/etiqueta/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=pegaDadosEtiquetas&tema="+i3GEOF.etiqueta.tema;
184   - cp.set_response_type("JSON");
185   - cp.call(p,"etiqueta",funcao);
186   - },
187   - /*
  174 + */
  175 + ativaFoco: function(){
  176 + if(i3GEO.temaAtivo != ""){
  177 + i3GEO.php.listaItensTema(i3GEOF.etiqueta.montaListaItens,i3GEOF.etiqueta.tema);
  178 + }
  179 + },
  180 + pegaDadosEtiquetas: function(funcao){
  181 + var cp = new cpaint(),
  182 + p;
  183 + p = i3GEO.configura.locaplic+"/ferramentas/etiqueta/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=pegaDadosEtiquetas&tema="+i3GEOF.etiqueta.tema;
  184 + cp.set_response_type("JSON");
  185 + cp.call(p,"etiqueta",funcao);
  186 + },
  187 + /*
188 188 Function: montaListaItens
189 189  
190 190 Monta a lista de itens que poder&atilde;o ser escolhidos para compor o mapa.
... ... @@ -192,122 +192,134 @@ i3GEOF.etiqueta = {
192 192 A lista &eacute; inserida no elemento html com id "i3GEOetiquetalistai"
193 193  
194 194 @TODO verificar quando um item ja esta na lista e marca-lo no checkbox
195   - */
196   - montaListaItens: function(retorno){
197   - var funcao = function(dadosItens){
198   - var mustache = [], ins,i,n,itensatuais,item, ck = '',lista, temp;
199   - lista = dadosItens.data;
200   - try{
201   - itensatuais = i3GEO.arvoreDeCamadas.pegaTema(i3GEO.temaAtivo);
202   - itensatuais = itensatuais.etiquetas.split(",");
203   - n = retorno.data.valores.length;
204   - for (i=0;i<n; i++){
205   - temp = {};
206   - item = retorno.data.valores[i].item;
207   - temp.item = item;
208   - if(i3GEO.util.in_array(item,lista.itens) || i3GEO.util.in_array(item,itensatuais) || lista.itembuscarapida[item]){
209   - temp.ckIdentifica = "checked";
210   - }
211   - else{
212   - temp.ckIdentifica = "";
213   - }
214   - if(i3GEO.util.in_array(item,itensatuais)){
215   - temp.ckEtiquetaTip = "checked";
216   - }
217   - else{
218   - temp.ckEtiquetaTip = "";
219   - }
220   - //buscarapida
221   - if(lista.itembuscarapida === item){
222   - temp.ckBuscaRapida = "checked";
223   - }
224   - else{
225   - temp.ckBuscaRapida = "";
226   - }
227   - if(lista.itensdesc[item]){
228   - temp.ckitensdesc = lista.itensdesc[item];
229   - }
230   - else{
231   - temp.ckitensdesc = item;
232   - }
233   - //links
234   - if(lista.itenslink[item]){
235   - temp.ckitem = lista.itenslink[item];
236   - }
237   - else{
238   - temp.ckitem = "";
239   - }
240   - mustache.push(temp);
241   - }
242   - ins = Mustache.render(
243   - i3GEOF.etiqueta.MUSTACHELISTA,
244   - $.extend(
245   - {},
246   - {
247   - "linhas" : mustache,
248   - },
249   - i3GEOF.etiqueta.DICIONARIO
250   - )
251   - );
252   - $i("i3GEOetiquetalistai").innerHTML = ins;
253   -
254   - //enable
255   - lista = $i("i3GEOetiquetalistai").getElementsByTagName("input");
256   - n = lista.length;
257   - for (i=0;i<n; i++){
258   - if(lista[i].name === "identifica"){
259   - i3GEOF.etiqueta.ativaLinha(lista[i]);
260   - }
261   - }
262   - }
263   - catch(e)
264   - {$i("i3GEOetiquetalistai").innerHTML = "<p style=color:red >Erro<br>"+e;}
265   - };
266   - i3GEOF.etiqueta.pegaDadosEtiquetas(funcao);
267   - },
268   - ativaLinha: function(obj){
269   - var linha = obj.parentNode.parentNode,
270   - objs = linha.getElementsByTagName("input"),
271   - n = objs.length,
272   - i;
273   - for(i=0;i<n;i++){
274   - if(objs[i].name != "identifica"){
275   - objs[i].disabled = !obj.checked;
276   - }
277   - }
278   - },
279   - /*
  195 + */
  196 + montaListaItens: function(retorno){
  197 + var funcao = function(dadosItens){
  198 + var mustache = [], ins,i,n,itensatuais,item, ck = '',lista, temp;
  199 + lista = dadosItens.data;
  200 + try{
  201 + itensatuais = i3GEO.arvoreDeCamadas.pegaTema(i3GEO.temaAtivo);
  202 + itensatuais = itensatuais.etiquetas.split(",");
  203 + n = retorno.data.valores.length;
  204 + for (i=0;i<n; i++){
  205 + temp = {};
  206 + item = retorno.data.valores[i].item;
  207 + temp.item = item;
  208 + if(i3GEO.util.in_array(item,lista.itens) || i3GEO.util.in_array(item,itensatuais) || lista.itembuscarapida[item]){
  209 + temp.ckIdentifica = "checked";
  210 + }
  211 + else{
  212 + temp.ckIdentifica = "";
  213 + }
  214 + if(i3GEO.util.in_array(item,itensatuais)){
  215 + temp.ckEtiquetaTip = "checked";
  216 + }
  217 + else{
  218 + temp.ckEtiquetaTip = "";
  219 + }
  220 + //utfdata
  221 + if(lista.utfdata === item){
  222 + temp.ckUtfdata = "checked";
  223 + }
  224 + else{
  225 + temp.ckUtfdata = "";
  226 + }
  227 + //buscarapida
  228 + if(lista.itembuscarapida === item){
  229 + temp.ckBuscaRapida = "checked";
  230 + }
  231 + else{
  232 + temp.ckBuscaRapida = "";
  233 + }
  234 + if(lista.itensdesc[item]){
  235 + temp.ckitensdesc = lista.itensdesc[item];
  236 + }
  237 + else{
  238 + temp.ckitensdesc = item;
  239 + }
  240 + //links
  241 + if(lista.itenslink[item]){
  242 + temp.ckitem = lista.itenslink[item];
  243 + }
  244 + else{
  245 + temp.ckitem = "";
  246 + }
  247 + mustache.push(temp);
  248 + }
  249 + ins = Mustache.render(
  250 + i3GEOF.etiqueta.MUSTACHELISTA,
  251 + $.extend(
  252 + {},
  253 + {
  254 + "linhas" : mustache,
  255 + },
  256 + i3GEOF.etiqueta.DICIONARIO
  257 + )
  258 + );
  259 + $i("i3GEOetiquetalistai").innerHTML = ins;
  260 +
  261 + //enable
  262 + lista = $i("i3GEOetiquetalistai").getElementsByTagName("input");
  263 + n = lista.length;
  264 + for (i=0;i<n; i++){
  265 + if(lista[i].name === "identifica"){
  266 + i3GEOF.etiqueta.ativaLinha(lista[i]);
  267 + }
  268 + }
  269 + }
  270 + catch(e)
  271 + {$i("i3GEOetiquetalistai").innerHTML = "<p style=color:red >Erro<br>"+e;}
  272 + };
  273 + i3GEOF.etiqueta.pegaDadosEtiquetas(funcao);
  274 + },
  275 + ativaLinha: function(obj){
  276 + var linha = obj.parentNode.parentNode,
  277 + objs = linha.getElementsByTagName("input"),
  278 + n = objs.length,
  279 + i;
  280 + for(i=0;i<n;i++){
  281 + if(objs[i].name != "identifica"){
  282 + objs[i].disabled = !obj.checked;
  283 + }
  284 + }
  285 + },
  286 + /*
280 287 Function: pegaItensMarcados
281 288  
282 289 Recupera os itens que foram marcados e monta uma lista para enviar como par&acirc;metro para a fun&ccedil;&atilde;o de gera&ccedil;&atilde;o dos gr&aacute;ficos
283   - */
284   - pegaItensMarcados: function(){
285   - var tips = [],
286   - itens = [],
287   - itensdesc = [],
288   - itenslink = [],
289   - itembuscarapida = "",
290   - inputs = $i("i3GEOetiquetalistai").getElementsByTagName("input"),
291   - i,
292   - it,
293   - n = inputs.length;
294   - for (i=0;i<n; i=i+5){
295   - if (inputs[i].checked === true){
296   - itens.push(inputs[i].value);
297   - if (inputs[i+1].checked === true){
298   - tips.push(inputs[i+1].value);
299   - }
300   - if (inputs[i+2].checked){
301   - itembuscarapida = inputs[i+2].value;
302   - }
303   - itensdesc.push(inputs[i+3].value);
304   - itenslink.push(inputs[i+4].value);
305   - }
306   -
307   - }
308   - return([tips,itens,itensdesc,itenslink,itembuscarapida]);
309   - },
310   - /*
  290 + */
  291 + pegaItensMarcados: function(){
  292 + var tips = [],
  293 + itens = [],
  294 + itensdesc = [],
  295 + itenslink = [],
  296 + itembuscarapida = "",
  297 + utfdata = "",
  298 + inputs = $i("i3GEOetiquetalistai").getElementsByTagName("input"),
  299 + i,
  300 + it,
  301 + n = inputs.length;
  302 + for (i=0;i<n; i=i+5){
  303 + if (inputs[i].checked === true){
  304 + itens.push(inputs[i].value);
  305 + if (inputs[i+1].checked === true){
  306 + tips.push(inputs[i+1].value);
  307 + }
  308 +
  309 + if (inputs[i+2].checked){
  310 + utfdata = inputs[i+2].value;
  311 + }
  312 + if (inputs[i+3].checked){
  313 + itembuscarapida = inputs[i+3].value;
  314 + }
  315 + itensdesc.push(inputs[i+4].value);
  316 + itenslink.push(inputs[i+5].value);
  317 + }
  318 +
  319 + }
  320 + return([tips,itens,itensdesc,itenslink,itembuscarapida,utfdata]);
  321 + },
  322 + /*
311 323 Function: ativa
312 324  
313 325 Ativa a etiqueta com os itens marcados
... ... @@ -315,39 +327,40 @@ i3GEOF.etiqueta = {
315 327 Veja:
316 328  
317 329 <ATIVAETIQUETAS>
318   - */
319   - ativa: function(){
320   - try{
321   - if(i3GEOF.etiqueta.aguarde.visibility === "visible")
322   - {return;}
323   - var lista = i3GEOF.etiqueta.pegaItensMarcados(),
324   - cp = new cpaint(),
325   - temp,
326   - p;
327   -
328   - i3GEOF.etiqueta.aguarde.visibility = "visible";
329   - temp = function(retorno){
330   - i3GEOF.etiqueta.aguarde.visibility = "hidden";
331   - i3GEO.atualiza(retorno);
332   - i3GEO.php.listaItensTema(i3GEOF.etiqueta.montaListaItens,i3GEO.temaAtivo);
333   - };
334   - p = i3GEO.configura.locaplic+"/ferramentas/etiqueta/exec.php?g_sid="
335   - + i3GEO.configura.sid
336   - + "&funcao=ativaEtiquetas&tema="
337   - + i3GEOF.etiqueta.tema
338   - + "&tips="+lista[0].toString(",")
339   - + "&itens="+lista[1].toString(",")
340   - //+ "&itensdesc="+i3GEO.util.base64encode(lista[2].toString(","))
341   - //+ "&itenslink="+i3GEO.util.base64encode(lista[3].toString(","))
342   - + "&itensdesc="+lista[2].toString(",")
343   - + "&itenslink="+lista[3].toString(",")
344   - + "&itembuscarapida="+lista[4];
345   - cp.set_response_type("JSON");
346   - cp.set_transfer_mode('POST');
347   - cp.call(p,"etiqueta",temp);
348   - }catch(e){i3GEO.janela.tempoMsg("Erro: "+e);i3GEOF.etiqueta.aguarde.visibility = "hidden";}
349   - },
350   - /*
  330 + */
  331 + ativa: function(){
  332 + try{
  333 + if(i3GEOF.etiqueta.aguarde.visibility === "visible")
  334 + {return;}
  335 + var lista = i3GEOF.etiqueta.pegaItensMarcados(),
  336 + cp = new cpaint(),
  337 + temp,
  338 + p;
  339 +
  340 + i3GEOF.etiqueta.aguarde.visibility = "visible";
  341 + temp = function(retorno){
  342 + i3GEOF.etiqueta.aguarde.visibility = "hidden";
  343 + i3GEO.atualiza(retorno);
  344 + i3GEO.php.listaItensTema(i3GEOF.etiqueta.montaListaItens,i3GEO.temaAtivo);
  345 + };
  346 + p = i3GEO.configura.locaplic+"/ferramentas/etiqueta/exec.php?g_sid="
  347 + + i3GEO.configura.sid
  348 + + "&funcao=ativaEtiquetas&tema="
  349 + + i3GEOF.etiqueta.tema
  350 + + "&tips="+lista[0].toString(",")
  351 + + "&itens="+lista[1].toString(",")
  352 + //+ "&itensdesc="+i3GEO.util.base64encode(lista[2].toString(","))
  353 + //+ "&itenslink="+i3GEO.util.base64encode(lista[3].toString(","))
  354 + + "&itensdesc="+lista[2].toString(",")
  355 + + "&itenslink="+lista[3].toString(",")
  356 + + "&itembuscarapida="+lista[4]
  357 + + "&utfdata="+lista[5];
  358 + cp.set_response_type("JSON");
  359 + cp.set_transfer_mode('POST');
  360 + cp.call(p,"etiqueta",temp);
  361 + }catch(e){i3GEO.janela.tempoMsg("Erro: "+e);i3GEOF.etiqueta.aguarde.visibility = "hidden";}
  362 + },
  363 + /*
351 364 Function: desativa
352 365  
353 366 Desativa as etiqueta do tema ativo
... ... @@ -355,22 +368,22 @@ i3GEOF.etiqueta = {
355 368 Veja:
356 369  
357 370 <REMOVEETIQUETAS>
358   - */
359   - desativa: function(){
360   - try{
361   - if(i3GEOF.etiqueta.aguarde.visibility === "visible")
362   - {return;}
363   - var cp = new cpaint(),
364   - temp,
365   - p;
366   - i3GEOF.etiqueta.aguarde.visibility = "visible";
367   - temp = function(retorno){
368   - i3GEOF.etiqueta.aguarde.visibility = "hidden";
369   - i3GEO.atualiza(retorno);
370   - };
371   - p = i3GEO.configura.locaplic+"/ferramentas/etiqueta/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=removeEtiquetas&tema="+i3GEOF.etiqueta.tema;
372   - cp.set_response_type("JSON");
373   - cp.call(p,"etiqueta",temp);
374   - }catch(e){i3GEO.janela.tempoMsg("Erro: "+e);i3GEOF.etiqueta.aguarde.visibility = "hidden";}
375   - }
  371 + */
  372 + desativa: function(){
  373 + try{
  374 + if(i3GEOF.etiqueta.aguarde.visibility === "visible")
  375 + {return;}
  376 + var cp = new cpaint(),
  377 + temp,
  378 + p;
  379 + i3GEOF.etiqueta.aguarde.visibility = "visible";
  380 + temp = function(retorno){
  381 + i3GEOF.etiqueta.aguarde.visibility = "hidden";
  382 + i3GEO.atualiza(retorno);
  383 + };
  384 + p = i3GEO.configura.locaplic+"/ferramentas/etiqueta/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=removeEtiquetas&tema="+i3GEOF.etiqueta.tema;
  385 + cp.set_response_type("JSON");
  386 + cp.call(p,"etiqueta",temp);
  387 + }catch(e){i3GEO.janela.tempoMsg("Erro: "+e);i3GEOF.etiqueta.aguarde.visibility = "hidden";}
  388 + }
376 389 };
377 390 \ No newline at end of file
... ...
ferramentas/etiqueta/templateLista_mst.html
... ... @@ -2,16 +2,17 @@
2 2 <table>
3 3 <tr>
4 4 <td>Coluna</td>
5   - <td style="text-align:center">Identifica</td>
6   - <td style="text-align:center">Tip</td>
7   - <td style="text-align:center">Busca</td>
8   - <td style="text-align:center">Alias</td>
9   - <td style="text-align:center;">Link</td>
  5 + <td style="text-align:center;padding: 10px;">Identifica</td>
  6 + <td style="text-align:center;padding: 10px;">Tip (quando clicar)</td>
  7 + <td style="text-align:center;padding: 10px;">Tip (din&acirc;mico)</td>
  8 + <td style="text-align:center;padding: 10px;">Busca</td>
  9 + <td style="text-align:center;padding: 10px;">Alias</td>
  10 + <td style="text-align:center;padding: 10px;;">Link</td>
10 11 <tr>{{#linhas}}
11 12 <tr>
12 13 <td>{{{item}}}</td>
13 14 <td>
14   - <div class="checkbox condensed">
  15 + <div class="checkbox condensed text-center" style="text-align:center;">
15 16 <label>
16 17 <input {{{ckIdentifica}}} value="{{{item}}}" type="checkbox" name="identifica" />
17 18 <span class="checkbox-material noprint">
... ... @@ -21,7 +22,7 @@
21 22 </div>
22 23 </td>
23 24 <td>
24   - <div class="checkbox condensed">
  25 + <div class="checkbox condensed" style="text-align:center;">
25 26 <label>
26 27 <input {{{ckEtiquetaTip}}} type='checkbox' value="{{{item}}}" name='etiquetaTip' />
27 28 <span class="checkbox-material noprint">
... ... @@ -30,10 +31,19 @@
30 31 </label>
31 32 </div>
32 33 </td>
  34 + <td>
  35 + <div class="radio radio-primary condensed" style="text-align:center;">
  36 + <label>
  37 + <input {{{ckUtfdata}}} type='radio' value="{{{item}}}" name='utfdata' onclick='javascript:if(this.checked){this.checked=false;}'/>
  38 + <span class="circle"></span>
  39 + <span class="check"></span>
  40 + </label>
  41 + </div>
  42 + </td>
33 43 <td>
34   - <div class="radio radio-primary condensed">
  44 + <div class="radio radio-primary condensed" style="text-align:center;">
35 45 <label>
36   - <input {{{ckBuscaRapida}}} type='radio' value="{{{item}}}" name='itembuscarapida' />
  46 + <input {{{ckBuscaRapida}}} type='radio' value="{{{item}}}" name='itembuscarapida' onclick='javascript:if(this.checked){this.checked=false;}'/>
37 47 <span class="circle"></span>
38 48 <span class="check"></span>
39 49 </label>
... ...
temas/_lbiomashp.map
... ... @@ -9,29 +9,21 @@ MAP
9 9 DATA "/var/www/i3geo/aplicmap/dados/biomas.shp"
10 10 METADATA
11 11 "cache" "nao"
12   - "TIP" "CD_LEGENDA"
13 12 "CLASSE" "SIM"
14   - "olopacity" ""
15 13 "animagif" ""
16 14 "permitekmz" "SIM"
17   - "gmopacity" ""
18   - "gmstatus" ""
19 15 "ITENSDESC" "Teste de acentuação"
20 16 "editavel" ""
21 17 "ESCALA" "250000"
22 18 "TILES" "SIM"
23   - "arquivotemaoriginal" ""
24 19 "extensao" "-73.990940816816 -33.74827031115 -34.822855820777 5.272224303909"
25   - "nomeoriginal" ""
26   - "olstatus" ""
27 20 "FUNCOESJS" '[{"titulo":"teste fake"},{"titulo":"teste de nome de uma função","script":"../aplicmap/dados/testefuncaojs.js","funcao":"funcao1","parametros":["CD_LEGENDA"]}]'
28 21 "permitedownload" "SIM"
29   - "FILTROORIGINAL" ""
30 22 "permitecomentario" "NAO"
31   - "DATAORIGINAL" ""
32 23 "escondido" "NAO"
33 24 "esquematabelaeditavel" ""
34 25 "download" "SIM"
  26 + "UTFDATA" ""
35 27 "itembuscarapida" "CD_LEGENDA"
36 28 "tme" ""
37 29 "ITENS" "CD_LEGENDA"
... ...