Commit 08cf2a604b9f91ff370a4412fae8d13a72b0ec03
1 parent
512d5080
Exists in
master
and in
7 other branches
Inclusão de formulário para definição dos parâmetros de construção automática de…
… classes na ferramenta legenda.
Showing
9 changed files
with
246 additions
and
70 deletions
Show diff stats
admin/admin.db
No preview for this file type
admin1/catalogo/mapfile/conexao/ogc/exec.php
... | ... | @@ -61,13 +61,7 @@ switch ($funcao) { |
61 | 61 | |
62 | 62 | outros |
63 | 63 | |
64 | - $dados["classesitem"] = $layer->getmetadata("classesitem"); | |
65 | - $dados["classesnome"] = $layer->getmetadata("classesnome"); | |
66 | - $dados["classescor"] = $layer->getmetadata("classescor"); | |
67 | - $dados["classessimbolo"] = $layer->getmetadata("classessimbolo"); | |
68 | - $dados["classestamanho"] = $layer->getmetadata("classestamanho"); | |
69 | - $dados["palletefile"] = $layer->getmetadata("palletefile"); | |
70 | - $dados["palletestep"] = $layer->getmetadata("palletestep"); | |
64 | + | |
71 | 65 | $dados["description_template"] = $layer->getmetadata("description_template"); |
72 | 66 | $dados["editorsql"] = $layer->getmetadata("editorsql"); |
73 | 67 | */ | ... | ... |
admin1/catalogo/mapfile/editor/funcoes.php
... | ... | @@ -23,9 +23,10 @@ function textoMapfile($codigo) { |
23 | 23 | // isso e necessario para manter a consistencia caso o usuario altere manualmente os valores |
24 | 24 | // cria o objeto map |
25 | 25 | $mapa = ms_newMapObj ( $mapfile ); |
26 | - $layer = $mapa->getlayerbyname ( $codigo ); | |
26 | + $layer = @$mapa->getlayerbyname ( $codigo ); | |
27 | + $erro = ""; | |
27 | 28 | if ($layer == "") { |
28 | - return "<br><span style='color:red;'>Atenção: não existe nenhum LAYER com NAME igual a " . $codigo . "</span><br>"; | |
29 | + $erro = "Atenção: não existe nenhum LAYER com NAME igual a " . $codigo; | |
29 | 30 | } else { |
30 | 31 | // pega o metadata |
31 | 32 | $meta = $layer->getmetadata ( "permitedownload" ); |
... | ... | @@ -53,10 +54,12 @@ function textoMapfile($codigo) { |
53 | 54 | } |
54 | 55 | $texto = file_get_contents ( $mapfile ); |
55 | 56 | if (mb_detect_encoding ( $texto, 'UTF-8, ISO-8859-1' ) == "ISO-8859-1") { |
56 | - return utf8_encode ( $texto ); | |
57 | - } else { | |
58 | - return $texto; | |
57 | + $texto = utf8_encode ( $texto ); | |
59 | 58 | } |
59 | + return array ( | |
60 | + "texto" => $texto, | |
61 | + "erro"=> $erro | |
62 | + ); | |
60 | 63 | } |
61 | 64 | function salvaMapfile() { |
62 | 65 | global $dbhw, $codigo, $gravarTexto; | ... | ... |
admin1/catalogo/mapfile/editor/index.php
... | ... | @@ -94,13 +94,14 @@ $textoMapfile = \admin\catalogo\mapfile\editor\textoMapfile ( $codigo ); |
94 | 94 | </div> |
95 | 95 | <div class="row center-block"> |
96 | 96 | <div class="col-md-12 well"> |
97 | + <span style="color:red;"><?php echo $textoMapfile["erro"]; ?></span> | |
97 | 98 | <form action="index.php?codigo=<?php echo $codigo;?>&id_tema=<?php echo $id_tema;?>" method="post"> |
98 | 99 | <TEXTAREA id=editor name=texto style='font-size: 16px; width: 100%; float: left; border: 2px dotted lightgray;'> |
99 | - <?php echo $textoMapfile; ?> | |
100 | + <?php echo $textoMapfile["texto"]; ?> | |
100 | 101 | </TEXTAREA> |
101 | 102 | </form> |
102 | 103 | <!-- para calcular a altura do textarea --> |
103 | - <pre id="editortemp" style="font-size: 16px; display: block; visibility: hidden;"><?php echo $textoMapfile; ?></pre> | |
104 | + <pre id="editortemp" style="font-size: 16px; display: block; visibility: hidden;"><?php echo $textoMapfile["texto"]; ?></pre> | |
104 | 105 | </div> |
105 | 106 | </div> |
106 | 107 | </div> | ... | ... |
ferramentas/legenda/dicionario.js
... | ... | @@ -856,5 +856,50 @@ i3GEOF.legenda.dicionario = |
856 | 856 | en : "", |
857 | 857 | es : "" |
858 | 858 | } |
859 | - ] | |
859 | + ], | |
860 | + 'autoClasses' : [ { | |
861 | + pt : "É possível a geração de classes automaticamente por meio da definição de colunas na tabela de atributos do tema que armazenam as informações sobre cor, tamanho, etc.", | |
862 | + en : "", | |
863 | + es : "" | |
864 | + } ], | |
865 | + 'classesitem' : [ { | |
866 | + pt : "Qual a coluna da tabela que identifica unicamente cada classe. Para cada valor será criada uma classe. O tema que utiliza a geração de classes de forma automática, deve ter definido apenas uma classe. Essa classe será utilizada como padrão para geração das demais.", | |
867 | + en : "", | |
868 | + es : "" | |
869 | + } ], | |
870 | + 'classesnome' : [ { | |
871 | + pt : "Nome da coluna que será utilizada para compor o nome das classes geradas automaticamente.", | |
872 | + en : "", | |
873 | + es : "" | |
874 | + } ], | |
875 | + 'classescor' : [ { | |
876 | + pt : "Nome da coluna que definirá a cor do símbolo utilizado em cada classe. As cores devem ser definidas em RGB.", | |
877 | + en : "", | |
878 | + es : "" | |
879 | + } ], | |
880 | + 'classessimbolo' : [ { | |
881 | + pt : "Nome da coluna que definirá o símbolo utilizado em cada classe.", | |
882 | + en : "", | |
883 | + es : "" | |
884 | + } ], | |
885 | + 'classestamanho' : [ { | |
886 | + pt : "Nome da coluna que definirá o tamanho de cada símbolo.", | |
887 | + en : "", | |
888 | + es : "" | |
889 | + } ], | |
890 | + 'palletefile' : [ { | |
891 | + pt : "Palete de cores. Endereço do arquivo no servidor (opcional)", | |
892 | + en : "", | |
893 | + es : "" | |
894 | + } ], | |
895 | + 'palletestep' : [ { | |
896 | + pt : "Quantas cores em cada nível da palete (opcional)", | |
897 | + en : "", | |
898 | + es : "" | |
899 | + } ], | |
900 | + "colunasTxt" : [ { | |
901 | + pt : "Itens disponíveis", | |
902 | + en : "", | |
903 | + es : "" | |
904 | + } ] | |
860 | 905 | }; | ... | ... |
ferramentas/legenda/exec.php
... | ... | @@ -7,6 +7,39 @@ verificaBlFerramentas(basename(dirname(__FILE__)),$i3geoBlFerramentas,false); |
7 | 7 | $retorno = ""; //string que será retornada ao browser via JSON |
8 | 8 | switch (strtoupper($funcao)) |
9 | 9 | { |
10 | + case "PARAMETROSAUTO": | |
11 | + $map = ms_newMapObj($map_file); | |
12 | + $layer = $map->getlayerbyname($tema); | |
13 | + $retorno = array(); | |
14 | + $retorno["classesitem"] = $layer->getmetadata("classesitem"); | |
15 | + $retorno["classesnome"] = $layer->getmetadata("classesnome"); | |
16 | + $retorno["classescor"] = $layer->getmetadata("classescor"); | |
17 | + $retorno["classessimbolo"] = $layer->getmetadata("classessimbolo"); | |
18 | + $retorno["classestamanho"] = $layer->getmetadata("classestamanho"); | |
19 | + $retorno["palletefile"] = $layer->getmetadata("palletefile"); | |
20 | + $retorno["palletestep"] = $layer->getmetadata("palletestep"); | |
21 | + $sopen = $layer->open(); | |
22 | + if($sopen != MS_FAILURE){ | |
23 | + $items = $layer->getItems(); | |
24 | + } | |
25 | + else{ | |
26 | + $items = array(); | |
27 | + } | |
28 | + $retorno["colunas"] = implode(",",$items); | |
29 | + break; | |
30 | + case "SALVAPARAMETROSAUTO": | |
31 | + $map = ms_newMapObj($map_file); | |
32 | + $layer = $map->getlayerbyname($tema); | |
33 | + $layer->setmetadata("classesitem",$_GET["classesitem"]); | |
34 | + $layer->setmetadata("classesnome",$_GET["classesnome"]); | |
35 | + $layer->setmetadata("classescor",$_GET["classescor"]); | |
36 | + $layer->setmetadata("classessimbolo",$_GET["classessimbolo"]); | |
37 | + $layer->setmetadata("classestamanho",$_GET["classestamanho"]); | |
38 | + $layer->setmetadata("palletefile",$_GET["palletefile"]); | |
39 | + $layer->setmetadata("palletestep",$_GET["palletestep"]); | |
40 | + $map->save($map_file); | |
41 | + $retorno = "ok"; | |
42 | + break; | |
10 | 43 | /* |
11 | 44 | Valor: TEMA2SLD |
12 | 45 | ... | ... |
ferramentas/legenda/index.js
... | ... | @@ -135,6 +135,11 @@ i3GEOF.legenda = |
135 | 135 | $i(iddiv).innerHTML += i3GEOF.legenda.html(); |
136 | 136 | i3GEO.guias.mostraGuiaFerramenta("i3GEOlegendaguia1", "i3GEOlegendaguia"); |
137 | 137 | // eventos das guias |
138 | + $i("i3GEOlegendaguia8").onclick = function() { | |
139 | + i3GEOF.legenda.ativaAplicar("none"); | |
140 | + i3GEO.guias.mostraGuiaFerramenta("i3GEOlegendaguia8", "i3GEOlegendaguia"); | |
141 | + i3GEOF.legenda.parametrosAuto(); | |
142 | + }; | |
138 | 143 | $i("i3GEOlegendaguia7").onclick = function() { |
139 | 144 | i3GEOF.legenda.ativaAplicar("none"); |
140 | 145 | i3GEO.guias.mostraGuiaFerramenta("i3GEOlegendaguia7", "i3GEOlegendaguia"); |
... | ... | @@ -192,6 +197,13 @@ i3GEOF.legenda = |
192 | 197 | }); |
193 | 198 | b.addClass("rodar"); |
194 | 199 | |
200 | + var b = new YAHOO.widget.Button("i3GEOlegendabotaoAplicarAuto", { | |
201 | + onclick : { | |
202 | + fn : i3GEOF.legenda.salvaParametrosAuto | |
203 | + } | |
204 | + }); | |
205 | + b.addClass("rodar"); | |
206 | + | |
195 | 207 | var b = new YAHOO.widget.Button("i3GEOlegendabotao1", { |
196 | 208 | onclick : { |
197 | 209 | fn : i3GEOF.legenda.mudaLegenda |
... | ... | @@ -456,7 +468,7 @@ i3GEOF.legenda = |
456 | 468 | + i3GEO.configura.locaplic |
457 | 469 | + "/ajuda_usuario.php?idcategoria=5&idajuda=41' ><b> </b></a></div></div></div>"; |
458 | 470 | janela = |
459 | - i3GEO.janela.cria("540px", "350px", "", "", "", titulo, "i3GEOF.legenda", false, "hd", cabecalho, minimiza, function() { | |
471 | + i3GEO.janela.cria("590px", "350px", "", "", "", titulo, "i3GEOF.legenda", false, "hd", cabecalho, minimiza, function() { | |
460 | 472 | i3GEO.guias.ajustaGuiaFerramenta("i3GEOF.legenda", "i3GEOlegenda"); |
461 | 473 | }, true, "", "", "nao"); |
462 | 474 | divid = janela[2].id; |
... | ... | @@ -2429,5 +2441,55 @@ i3GEOF.legenda = |
2429 | 2441 | $i("i3GEOlegendaitensValorQuartil").innerHTML = retorno.dados; |
2430 | 2442 | } |
2431 | 2443 | }); |
2444 | + }, | |
2445 | + parametrosAuto : function() { | |
2446 | + i3GEOF.legenda.aguarde.visibility = "visible"; | |
2447 | + var p = i3GEO.configura.locaplic+"/ferramentas/legenda/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=parametrosauto&tema=" + i3GEOF.legenda.tema, | |
2448 | + cp = new cpaint(), | |
2449 | + temp = function(retorno){ | |
2450 | + try{ | |
2451 | + if(retorno.data !== ""){ | |
2452 | + $i("i3GEOlegendaAutocolunas").innerHTML = retorno.data.colunas; | |
2453 | + $i("i3GEOlegendaAutoclassesitem").value = retorno.data.classesitem; | |
2454 | + $i("i3GEOlegendaAutoclassesnome").value = retorno.data.classesnome; | |
2455 | + $i("i3GEOlegendaAutoclassescor").value = retorno.data.classescor; | |
2456 | + $i("i3GEOlegendaAutoclassessimbolo").value = retorno.data.classessimbolo; | |
2457 | + $i("i3GEOlegendaAutoclassestamanho").value = retorno.data.classestamanho; | |
2458 | + $i("i3GEOlegendaAutopalletefile").value = retorno.data.palletefile; | |
2459 | + $i("i3GEOlegendaAutopalletestep").value = retorno.data.palletestep; | |
2460 | + } | |
2461 | + i3GEOF.legenda.aguarde.visibility = "hidden"; | |
2462 | + }catch(e){ | |
2463 | + i3GEO.janela.tempoMsg("Erro. "+e); | |
2464 | + i3GEOF.legenda.aguarde.visibility = "hidden"; | |
2465 | + } | |
2466 | + }; | |
2467 | + cp.set_response_type("JSON"); | |
2468 | + cp.call(p,"foo",temp); | |
2469 | + }, | |
2470 | + salvaParametrosAuto: function(){ | |
2471 | + if(i3GEOF.legenda.aguarde.visibility === "visible"){ | |
2472 | + return; | |
2473 | + } | |
2474 | + i3GEOF.legenda.aguarde.visibility = "visible"; | |
2475 | + var temp, | |
2476 | + p, | |
2477 | + cp; | |
2478 | + temp = function(){ | |
2479 | + i3GEOF.legenda.aguarde.visibility = "hidden"; | |
2480 | + i3GEOF.legenda.aposAlterarLegenda(); | |
2481 | + }; | |
2482 | + p = i3GEO.configura.locaplic+"/ferramentas/legenda/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=salvaparametrosauto&tema=" + i3GEOF.legenda.tema | |
2483 | + + "&classesitem=" + $i("i3GEOlegendaAutoclassesitem").value | |
2484 | + + "&classesnome=" + $i("i3GEOlegendaAutoclassesnome").value | |
2485 | + + "&classescor=" + $i("i3GEOlegendaAutoclassescor").value | |
2486 | + + "&classessimbolo=" + $i("i3GEOlegendaAutoclassessimbolo").value | |
2487 | + + "&classestamanho=" + $i("i3GEOlegendaAutoclassestamanho").value | |
2488 | + + "&palletefile=" + $i("i3GEOlegendaAutopalletefile").value | |
2489 | + + "&palletestep=" + $i("i3GEOlegendaAutopalletestep").value; | |
2490 | + | |
2491 | + cp = new cpaint(); | |
2492 | + cp.set_response_type("JSON"); | |
2493 | + cp.call(p,"foo",temp); | |
2432 | 2494 | } |
2433 | 2495 | }; |
2434 | 2496 | \ No newline at end of file | ... | ... |
ferramentas/legenda/template_mst.html
... | ... | @@ -50,9 +50,63 @@ |
50 | 50 | </a> |
51 | 51 | </div> |
52 | 52 | </li> |
53 | + <li> | |
54 | + <div id='i3GEOlegendaguia8' style='text-align: center; left: 0px;'> | |
55 | + <a> | |
56 | + <em>Auto</em> | |
57 | + </a> | |
58 | + </div> | |
59 | + </li> | |
53 | 60 | </ul> |
54 | 61 | </div> |
55 | 62 | <br> |
63 | +<div id='i3GEOlegendaguia8obj' style='width: 99%; text-align: left;'> | |
64 | + <p class='paragrafo'>{{{colunasTxt}}}:</p> | |
65 | + <div id="i3GEOlegendaAutocolunas"> | |
66 | + </div> | |
67 | + <br> | |
68 | + <p class='paragrafo'>{{{autoClasses}}}</p> | |
69 | + <br> | |
70 | + <p class='paragrafo'>{{{classesitem}}}:</p> | |
71 | + <div class='styled-select'> | |
72 | + <input type='text' id='i3GEOlegendaAutoclassesitem' value='' /> | |
73 | + </div> | |
74 | + <br> | |
75 | + <p class='paragrafo'>{{{classesnome}}}:</p> | |
76 | + <div class='styled-select'> | |
77 | + <input type='text' id='i3GEOlegendaAutoclassesnome' value='' /> | |
78 | + </div> | |
79 | + <br> | |
80 | + <p class='paragrafo'>{{{classescor}}}:</p> | |
81 | + <div class='styled-select'> | |
82 | + <input type='text' id='i3GEOlegendaAutoclassescor' value='' /> | |
83 | + </div> | |
84 | + <br> | |
85 | + <p class='paragrafo'>{{{classessimbolo}}}:</p> | |
86 | + <div class='styled-select'> | |
87 | + <input type='text' id='i3GEOlegendaAutoclassessimbolo' value='' /> | |
88 | + </div> | |
89 | + <br> | |
90 | + <p class='paragrafo'>{{{classestamanho}}}:</p> | |
91 | + <div class='styled-select'> | |
92 | + <input type='text' id='i3GEOlegendaAutoclassestamanho' value='' /> | |
93 | + </div> | |
94 | + <br> | |
95 | + <p class='paragrafo'>{{{palletefile}}}:</p> | |
96 | + <div class='styled-select'> | |
97 | + <input type='text' id='i3GEOlegendaAutopalletefile' value='' /> | |
98 | + </div> | |
99 | + <br> | |
100 | + <p class='paragrafo'>{{{palletestep}}}:</p> | |
101 | + <div class='styled-select'> | |
102 | + <input type='text' id='i3GEOlegendaAutopalletestep' value='' /> | |
103 | + </div> | |
104 | + <br> | |
105 | + <p class='paragrafo'> | |
106 | + <input id='i3GEOlegendabotaoAplicarAuto' size='35' type='button' value='{{{aplicar}}}'> | |
107 | + </p> | |
108 | + <br> | |
109 | +</div> | |
56 | 110 | <div id='i3GEOlegendaguia7obj' style='width: 99%; text-align: left;'> |
57 | 111 | <p class='paragrafo'>{{{ClusterMaxdistance}}}:</p> |
58 | 112 | <div class='i3geoForm i3geoFormIconeNumero'> | ... | ... |
temas/_lautolegenda_exemplo.map
1 | -MAP | |
2 | - FONTSET "../symbols/fontes.txt" | |
3 | - SYMBOLSET "../symbols/simbolos.sym" | |
4 | - LAYER | |
5 | - DATA "/var/www/i3geo/aplicmap/dados/biomas.shp" | |
6 | - METADATA | |
7 | - "METAESTAT_ID_MEDIDA_VARIAVEL" "" | |
8 | - "ltempoitemimagem" "" | |
9 | - "cache" "SIM" | |
10 | - "ltempoitemdescricao" "" | |
11 | - "CLASSE" "SIM" | |
12 | - "ltempoiteminicio" "" | |
13 | - "palletestep" "" | |
14 | - "ltempoitemtip" "" | |
15 | - "permitekmz" "nao" | |
16 | - "iconetema" "" | |
17 | - "ltempoitemtitulo" "" | |
18 | - "description_template" "" | |
19 | - "ITENSDESC" "Nome" | |
20 | - "ltempoitemlink" "" | |
21 | - "CLASSESNOME" "CD_LEGENDA" | |
22 | - "METAESTAT_CODIGO_TIPO_REGIAO" "" | |
23 | - "palletefile" "" | |
24 | - "ltempoformatodata" "" | |
25 | - "permitedownload" "sim" | |
26 | - "ltempoitemicone" "" | |
27 | - "CLASSESITEM" "ID" | |
28 | - "metaestat" "" | |
29 | - "CLASSESCOR" "COR" | |
30 | - "arquivodownload" "" | |
31 | - "ITENS" "CD_LEGENDA" | |
32 | - "permiteogc" "sim" | |
33 | - "permitekml" "sim" | |
34 | - "TEMA" "_Teste de geração automática de classes em dados vetoriais" | |
35 | - "editorsql" "" | |
36 | - "ltempoitemfim" "" | |
37 | - END # METADATA | |
38 | - NAME "_wautolegenda_exemplo" | |
39 | - STATUS OFF | |
40 | - TEMPLATE "none.htm" | |
41 | - TILEITEM "location" | |
42 | - TYPE POLYGON | |
43 | - UNITS METERS | |
44 | - CLASS | |
45 | - STYLE | |
46 | - ANGLE 0 | |
47 | - OFFSET 0 0 | |
48 | - OUTLINECOLOR 250 50 50 | |
49 | - END # STYLE | |
50 | - END # CLASS | |
51 | - END # LAYER | |
52 | - | |
53 | -END # MAP | |
54 | - | |
1 | + MAP | |
2 | + FONTSET "../symbols/fontes.txt" | |
3 | + SYMBOLSET "../symbols/simbolos.sym" | |
4 | + LAYER | |
5 | + DATA "/var/www/i3geo/aplicmap/dados/biomas.shp" | |
6 | + METADATA | |
7 | + "cache" "SIM" | |
8 | + "ltempoitemdescricao" "" | |
9 | + "CLASSE" "SIM" | |
10 | + "ltempoiteminicio" "" | |
11 | + "ltempoitemtip" "" | |
12 | + "permitekmz" "nao" | |
13 | + "ITENSDESC" "Nome" | |
14 | + "CLASSESNOME" "CD_LEGENDA" | |
15 | + "permitedownload" "sim" | |
16 | + "CLASSESITEM" "ID" | |
17 | + "CLASSESCOR" "COR" | |
18 | + "ITENS" "CD_LEGENDA" | |
19 | + "permiteogc" "sim" | |
20 | + "permitekml" "sim" | |
21 | + "TEMA" "_Teste de geração automática de classes em dados vetoriais" | |
22 | + END # METADATA | |
23 | + NAME "_lautolegenda_exemplo" | |
24 | + STATUS OFF | |
25 | + TEMPLATE "none.htm" | |
26 | + TILEITEM "location" | |
27 | + TYPE POLYGON | |
28 | + UNITS METERS | |
29 | + CLASS | |
30 | + STYLE | |
31 | + ANGLE 0 | |
32 | + OFFSET 0 0 | |
33 | + OUTLINECOLOR 250 50 50 | |
34 | + END # STYLE | |
35 | + END # CLASS | |
36 | + END # LAYER | |
37 | +END # MAP | |
38 | + | |
55 | 39 | \ No newline at end of file | ... | ... |