Commit 73168f6928fa7d5305cfb1f9bb8ab34e6900c935

Authored by Edmar Moretti
1 parent 3c8b91b7

Inclusão de opção para remoção de toponimia

classesphp/classe_temas.php
... ... @@ -1161,6 +1161,11 @@ Adiciona LABEL em uma classe de um tema
1161 1161 $s = "CLASS LABEL WRAP '$wrap' END END";
1162 1162 $novac->updateFromString($s);
1163 1163 }
  1164 + if($texto != ""){
  1165 + $s = "CLASS LABEL TEXT '[".$texto."]' END END";
  1166 + $novac->updateFromString($s);
  1167 + }
  1168 +
1164 1169 if($this->vi >= 60200){
1165 1170 $label = $novac->getLabel($indiceLabel);
1166 1171 }
... ... @@ -1201,25 +1206,29 @@ Adiciona LABEL em uma classe de um tema
1201 1206 $label->set("partials",$partials);
1202 1207 $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);
1203 1208 $label->set("position",$p[$position]);
1204   - if($texto != ""){
1205   - $label->setText($texto);
  1209 + if ($this->layer){
  1210 + $this->layer->setMetaData("cache","");
1206 1211 }
1207   - if ($this->layer)
1208   - {$this->layer->setMetaData("cache","");}
1209 1212 }
1210 1213 function removeLabel($iclasse){
1211 1214 $classe = $this->layer->getclass($iclasse);
1212   - if($this->vi >= 60200){
1213   - $label = $classe->getLabel(0);
  1215 + $nlabel = $classe->numlabels;
  1216 + for($i=0;$i<$nlabel;$i++){
  1217 + if($this->vi >= 60200){
  1218 + $label = $classe->getLabel($i);
  1219 + }
  1220 + else{
  1221 + $label = $classe->label;
  1222 + }
  1223 + $label->set("type",MS_TRUETYPE);
  1224 + $label->set("font","arial");
  1225 + $label->set("size",0);
  1226 + $s = "CLASS LABEL TEXT '' END END";
  1227 + $classe->updateFromString($s);
1214 1228 }
1215   - else{
1216   - $label = $classe->label;
  1229 + if ($this->layer){
  1230 + $this->layer->setMetaData("cache","");
1217 1231 }
1218   - $label->set("type",MS_TRUETYPE);
1219   - $label->set("font","arial");
1220   - $label->set("size",0);
1221   - if ($this->layer)
1222   - {$this->layer->setMetaData("cache","");}
1223 1232 }
1224 1233 }
1225 1234 ?>
... ...
classesphp/classe_toponimia.php
... ... @@ -197,13 +197,13 @@ Retorno:
197 197 $novolayer->setmetadata("tema","texto de ".$nome);
198 198 $novolayer->setmetadata("tip","");
199 199 $novolayer->setmetadata("identifica","nao");
  200 + $novolayer->set("labelitem",$item);
200 201 }
201 202 else{
202 203 $nomer = $this->layer->name;
203 204 $novolayer = $this->mapa->getlayerbyname($nomer);
204 205 }
205 206 $novolayer->setmetadata("cache","");
206   - $novolayer->set("labelitem",$item);
207 207 $this->layer = $novolayer;
208 208 }
209 209 else
... ... @@ -215,7 +215,9 @@ Retorno:
215 215 for ($i=0; $i < $nclasses; ++$i){
216 216 $novac = $this->layer->getclass($i);
217 217 if($this->vi >= 60200){
218   - $indiceLabel = $novac->addLabel(new labelObj());
  218 + //$indiceLabel = $novac->addLabel(new labelObj());
  219 + $s = "CLASS LABEL TEXT '[".$item."]' END END";
  220 + $novac->updateFromString($s);
219 221 $label = $novac->getLabel($indiceLabel);
220 222 }
221 223 else{
... ... @@ -286,6 +288,29 @@ Retorno:
286 288 else
287 289 {return($nomer);}
288 290 }
  291 + function removeToponimia(){
  292 + $nclasses = $this->layer->numclasses;
  293 + for ($i=0; $i < $nclasses; ++$i){
  294 + $classe = $this->layer->getclass($i);
  295 + $nlabel = $classe->numlabels;
  296 + for($i=0;$i<$nlabel;$i++){
  297 + if($this->vi >= 60200){
  298 + $label = $classe->getLabel($i);
  299 + }
  300 + else{
  301 + $label = $classe->label;
  302 + }
  303 + $label->set("type",MS_TRUETYPE);
  304 + $label->set("font","arial");
  305 + $label->set("size",0);
  306 + $s = "CLASS LABEL TEXT '' END END";
  307 + $classe->updateFromString($s);
  308 + }
  309 + }
  310 + if ($this->layer){
  311 + $this->layer->setMetaData("cache","");
  312 + }
  313 + }
289 314 /*
290 315 function: ativaEtiquetas
291 316  
... ...
ferramentas/legenda/dicionario.js
... ... @@ -504,5 +504,10 @@ i3GEOF.legenda.dicionario = {
504 504 pt : "(Opcional) Item que ser&aacute; utilizado para obter os nomes das classes",
505 505 en : "",
506 506 es : ""
  507 + } ],
  508 + 'aplicar' : [ {
  509 + pt : "aplicar",
  510 + en : "",
  511 + es : ""
507 512 } ]
508 513 };
... ...
ferramentas/legenda/exec.php
... ... @@ -36,9 +36,9 @@ Adiciona LABEL em uma classe de um layer
36 36 if(empty($item))
37 37 {$retorno = "erro";}
38 38 else{
39   - $l->set("labelitem",$item);
  39 + //$l->set("labelitem",$item);
40 40 $novac = $l->getclass($classe);
41   - $m->adicionaLabel($novac,$wrap,$fonte,$tamanho,$angulo,$fundo,$sombra,$cor,$outlinecolor,$shadowcolor,$shadowsizex,$shadowsizey,$force,$mindistance,$minfeaturesize,$offsetx,$offsety,$partials,$position);
  41 + $m->adicionaLabel($novac,$wrap,$fonte,$tamanho,$angulo,$fundo,$sombra,$cor,$outlinecolor,$shadowcolor,$shadowsizex,$shadowsizey,$force,$mindistance,$minfeaturesize,$offsetx,$offsety,$partials,$position,$item);
42 42 $m->salva();
43 43 $retorno = "ok";
44 44 }
... ...
ferramentas/legenda/template_mst.html
... ... @@ -194,7 +194,7 @@
194 194 <br>
195 195 <p class='paragrafo' style='font-size: 10px;'>
196 196 <input id='i3GEOlegendabotaoExcluirLabel' size='10' type='button' value='{{{exclui}}}' />
197   - <input id='i3GEOlegendabotaoIncluirLabel' size='10' type='button' value='{{{adiciona}}}' />
  197 + <input id='i3GEOlegendabotaoIncluirLabel' size='10' type='button' value='{{{aplicar}}}' />
198 198 <input id='i3GEOlegendabotaoPropriedadeLabel' size='10' type='button' value='{{{propriedades2}}}' />
199 199 </p>
200 200 </fieldset>
... ...
ferramentas/toponimia/dicionario.js
... ... @@ -120,23 +120,8 @@ i3GEOF.toponimia.dicionario = {
120 120 en : "",
121 121 es : ""
122 122 } ],
123   - 25 : [ {
124   - pt : "",
125   - en : "",
126   - es : ""
127   - } ],
128   - 26 : [ {
129   - pt : "",
130   - en : "",
131   - es : ""
132   - } ],
133   - 27 : [ {
134   - pt : "",
135   - en : "",
136   - es : ""
137   - } ],
138   - 28 : [ {
139   - pt : "",
  123 + 'removeToponimia' : [ {
  124 + pt : "Remover",
140 125 en : "",
141 126 es : ""
142 127 } ]
... ...
ferramentas/toponimia/exec.php
... ... @@ -26,6 +26,15 @@ Cria um novo tema com a topon&amp;iacute;mia do tema atual.
26 26 if ($tipo != "teste")
27 27 {$m->salva();$_SESSION["contadorsalva"]++;}
28 28 break;
  29 + case "REMOVETOPONIMIA":
  30 + include_once(dirname(__FILE__)."/../../classesphp/classe_toponimia.php");
  31 + copiaSeguranca($map_file);
  32 + $m = new Toponimia($map_file,$tema);
  33 + $tipo="";
  34 + $retorno = $m->removeToponimia();
  35 + $m->salva();
  36 + $_SESSION["contadorsalva"]++;
  37 + break;
29 38 }
30 39 if (!connection_aborted()){
31 40 if(isset($map_file) && isset($postgis_mapa) && $map_file != "")
... ...
ferramentas/toponimia/index.js
... ... @@ -6,7 +6,6 @@ if(typeof(i3GEOF) === &#39;undefined&#39;){
6 6 Classe: i3GEOF.toponimia
7 7  
8 8 */
9   -//TODO incluir opcao para remover a toponimia de um LAYER
10 9 //TODO incluir opcao de minscale e maxscale
11 10 i3GEOF.toponimia = {
12 11 /*
... ... @@ -67,7 +66,12 @@ i3GEOF.toponimia = {
67 66 "i3GEOtoponimiabotao1",
68 67 {onclick:{fn: i3GEOF.toponimia.cria}}
69 68 );
70   - b.addClass("rodar");
  69 + b.addClass("rodar150");
  70 + var b = new YAHOO.widget.Button(
  71 + "i3GEOtoponimiabotao2",
  72 + {onclick:{fn: i3GEOF.toponimia.remove}}
  73 + );
  74 + b.addClass("rodar150");
71 75 //
72 76 //pega a lista de itens e chama a fun&ccedil;&atilde;o de montagem das op&ccedil;&otilde;es de escolha
73 77 //
... ... @@ -223,6 +227,25 @@ i3GEOF.toponimia = {
223 227 cp.call(p,"criaToponimia",monta);
224 228 }catch(e){i3GEO.janela.tempoMsg("Erro: "+e);i3GEOF.toponimia.aguarde.visibility = "hidden";}
225 229 },
  230 + remove: function(){
  231 + try{
  232 + if(i3GEOF.toponimia.aguarde.visibility === "visible")
  233 + {return;}
  234 + i3GEOF.toponimia.aguarde.visibility = "visible";
  235 + var monta = function(){
  236 + i3GEOF.toponimia.aguarde.visibility = "hidden";
  237 + i3GEO.Interface.atualizaTema("",i3GEO.temaAtivo);
  238 + },
  239 + p = i3GEO.configura.locaplic+"/ferramentas/toponimia/exec.php?g_sid="+i3GEO.configura.sid+
  240 + "&funcao=removetoponimia&tema="+i3GEO.temaAtivo;
  241 +
  242 + cp = new cpaint();
  243 + cp.set_response_type("JSON");
  244 + cp.call(p,"removeToponimia",monta);
  245 + }catch(e){
  246 + i3GEO.janela.tempoMsg("Erro: "+e);i3GEOF.toponimia.aguarde.visibility = "hidden";
  247 + }
  248 + },
226 249 /*
227 250 Function:
228 251  
... ...
ferramentas/toponimia/template_mst.html
... ... @@ -27,10 +27,11 @@
27 27 <div id='i3GEOtoponimiaDivListaItens' class='styled-select'></div>
28 28 <br>
29 29 <p class='paragrafo'>
30   - <input style='cursor: pointer' type='checkbox' id='i3GEOtoponimianovotema' />
  30 + <input style='cursor: pointer' type='checkbox' checked id='i3GEOtoponimianovotema' />
31 31 &nbsp;{{{adicionaToponimia}}} <br>
32 32 <p class='paragrafo'>
33 33 <input id='i3GEOtoponimiabotao1' size='35' type='button' value='{{{criaToponimia}}}' />
  34 + <input id='i3GEOtoponimiabotao2' size='35' type='button' value='{{{removeToponimia}}}' />
34 35 </div>
35 36 <div class='guiaobj' id='i3GEOtoponimiaguia2obj' style='left: 1px; display: none;'>
36 37  
... ...