Commit e70a89794b7d64fecf73cef2ae6024db300ecb23
1 parent
37e3821c
Exists in
master
and in
7 other branches
Adaptação da ferramenta de conversão de wkt em camada para Bootstrap
Showing
4 changed files
with
208 additions
and
227 deletions
Show diff stats
css/default.css
ferramentas/wkt2layer/dicionario.js
ferramentas/wkt2layer/index.js
... | ... | @@ -6,208 +6,206 @@ if (typeof (i3GEOF) === 'undefined') { |
6 | 6 | */ |
7 | 7 | i3GEOF.wkt2layer = |
8 | 8 | { |
9 | - /* | |
9 | + /* | |
10 | 10 | Variavel: aguarde |
11 | 11 | |
12 | 12 | Estilo do objeto DOM com a imagem de aguarde existente no cabeçalho da janela. |
13 | - */ | |
14 | - aguarde: "", | |
15 | - /* | |
13 | + */ | |
14 | + aguarde: "", | |
15 | + /* | |
16 | 16 | Variavel: parDefault |
17 | 17 | |
18 | 18 | parametros padrão utilizados para formatar texto |
19 | - */ | |
20 | - parDefault: "position=MS_UR&partials=1&offsetx=0&offsety=0&minfeaturesize=auto&mindistance=auto&force=0&shadowsizex=1&shadowsizey=1&cor=0 0 0&sombray=1&sombrax=1&angulo=0&tamanho=12&fonte=arial&fundo=off&sombra=off&outlinecolor=255,255,255&shadowcolor=off&wrap=", | |
21 | - /** | |
22 | - * Template no formato mustache. E preenchido na carga do javascript com o programa dependencias.php | |
23 | - */ | |
24 | - MUSTACHE : "", | |
25 | - /** | |
26 | - * Susbtitutos para o template | |
27 | - */ | |
28 | - mustacheHash : function(wkt,texto) { | |
29 | - var dicionario = i3GEO.idioma.objetoIdioma(i3GEOF.wkt2layer.dicionario); | |
30 | - dicionario["locaplic"] = i3GEO.configura.locaplic; | |
31 | - dicionario["wkt"] = wkt; | |
32 | - dicionario["valortexto"] = texto; | |
33 | - return dicionario; | |
34 | - }, | |
35 | - /* | |
36 | - * Function: inicia | |
37 | - * | |
38 | - * Inicia a ferramenta. É chamado por criaJanelaFlutuante | |
39 | - * | |
40 | - * Parametro: | |
41 | - * | |
42 | - * iddiv {String} - id do div que receberá o conteudo HTML da ferramenta | |
43 | - */ | |
44 | - inicia : function(iddiv,wkt,texto) { | |
45 | - if(i3GEOF.wkt2layer.MUSTACHE == ""){ | |
46 | - $.get(i3GEO.configura.locaplic + "/ferramentas/wkt2layer/template_mst.html", function(template) { | |
47 | - i3GEOF.wkt2layer.MUSTACHE = template; | |
48 | - i3GEOF.wkt2layer.inicia(iddiv,wkt,texto); | |
49 | - }); | |
50 | - return; | |
51 | - } | |
52 | - $i(iddiv).innerHTML = i3GEOF.wkt2layer.html(wkt,texto); | |
53 | - $i("i3GEOFwkt2layerWkt").value = wkt; | |
54 | - | |
55 | - new YAHOO.widget.Button("i3GEOFwkt2layerShp", { | |
56 | - onclick : { | |
57 | - fn : function() { | |
58 | - var wkt = $i("i3GEOFwkt2layerWkt").value; | |
59 | - wkt = $.trim(wkt.replace(/[\t\n]+/g,' ')); | |
60 | - if(wkt.length < 5){ | |
61 | - i3GEO.janela.tempoMsg($trad("mensagem",i3GEOF.wkt2layer.dicionario)); | |
62 | - } | |
63 | - else{ | |
64 | - i3GEOF.wkt2layer.shapefile(); | |
65 | - } | |
66 | - } | |
19 | + */ | |
20 | + parDefault: "position=MS_UR&partials=1&offsetx=0&offsety=0&minfeaturesize=auto&mindistance=auto&force=0&shadowsizex=1&shadowsizey=1&cor=0 0 0&sombray=1&sombrax=1&angulo=0&tamanho=12&fonte=arial&fundo=off&sombra=off&outlinecolor=255,255,255&shadowcolor=off&wrap=", | |
21 | + /** | |
22 | + * Template no formato mustache. E preenchido na carga do javascript com o programa dependencias.php | |
23 | + */ | |
24 | + MUSTACHE : "", | |
25 | + /** | |
26 | + * Susbtitutos para o template | |
27 | + */ | |
28 | + mustacheHash : function(wkt,texto) { | |
29 | + var dicionario = i3GEO.idioma.objetoIdioma(i3GEOF.wkt2layer.dicionario); | |
30 | + dicionario["locaplic"] = i3GEO.configura.locaplic; | |
31 | + dicionario["wkt"] = wkt; | |
32 | + dicionario["valortexto"] = texto; | |
33 | + return dicionario; | |
34 | + }, | |
35 | + /* | |
36 | + * Function: inicia | |
37 | + * | |
38 | + * Inicia a ferramenta. É chamado por criaJanelaFlutuante | |
39 | + * | |
40 | + * Parametro: | |
41 | + * | |
42 | + * iddiv {String} - id do div que receberá o conteudo HTML da ferramenta | |
43 | + */ | |
44 | + inicia : function(iddiv,wkt,texto) { | |
45 | + if(i3GEOF.wkt2layer.MUSTACHE == ""){ | |
46 | + $.get(i3GEO.configura.locaplic + "/ferramentas/wkt2layer/template_mst.html", function(template) { | |
47 | + i3GEOF.wkt2layer.MUSTACHE = template; | |
48 | + i3GEOF.wkt2layer.inicia(iddiv,wkt,texto); | |
49 | + }); | |
50 | + return; | |
67 | 51 | } |
68 | - }); | |
69 | - new YAHOO.widget.Button("i3GEOFwkt2layerInterno", { | |
70 | - onclick : { | |
71 | - fn : function() { | |
72 | - var wkt = $i("i3GEOFwkt2layerWkt").value; | |
73 | - wkt = $.trim(wkt.replace(/[\t\n]+/g,' ')); | |
74 | - if(wkt.length < 5){ | |
75 | - i3GEO.janela.tempoMsg($trad("mensagem",i3GEOF.wkt2layer.dicionario)); | |
76 | - } | |
77 | - else{ | |
78 | - i3GEOF.wkt2layer.insere(); | |
79 | - } | |
80 | - } | |
52 | + if(wkt == undefined){ | |
53 | + wkt = $trad("wkt",i3GEOF.wkt2layer.dicionario); | |
81 | 54 | } |
82 | - }); | |
83 | - }, | |
84 | - /* | |
85 | - * Function: html | |
86 | - * | |
87 | - * Gera o código html para apresentação das opções da ferramenta | |
88 | - * | |
89 | - * Retorno: | |
90 | - * | |
91 | - * String com o código html | |
92 | - */ | |
93 | - html : function(wkt,texto) { | |
94 | - var ins = Mustache.render(i3GEOF.wkt2layer.MUSTACHE, i3GEOF.wkt2layer.mustacheHash(wkt,texto)); | |
95 | - return ins; | |
96 | - }, | |
97 | - /* | |
98 | - * Function: criaJanelaFlutuante | |
99 | - * | |
100 | - * Cria a janela flutuante para controle da ferramenta. | |
101 | - */ | |
102 | - iniciaJanelaFlutuante : function(wkt,texto) { | |
103 | - var cabecalho, janela, divid, titulo; | |
104 | - if ($i("i3GEOF.wkt2layer")) { | |
105 | - return; | |
106 | - } | |
107 | - cabecalho = function() { | |
108 | - }; | |
109 | - // cria a janela flutuante | |
110 | - titulo = "<span class='i3GeoTituloJanelaBsNolink' >" + $trad("wkt2layer",i3GEOF.wkt2layer.dicionario) + "</span></div>"; | |
111 | - janela = | |
112 | - i3GEO.janela.cria( | |
113 | - "280px", | |
114 | - "180px", | |
115 | - "", | |
116 | - "", | |
117 | - "", | |
118 | - titulo, | |
119 | - "i3GEOF.wkt2layer", | |
120 | - false, | |
121 | - "hd", | |
122 | - cabecalho, | |
123 | - "", | |
124 | - "", | |
125 | - true | |
126 | - ); | |
127 | - divid = janela[2].id; | |
128 | - janela[0].moveTo(150,150); | |
129 | - $i("i3GEOF.wkt2layer_corpo").style.backgroundColor = "white"; | |
130 | - i3GEOF.wkt2layer.aguarde = $i("i3GEOF.wkt2layer_imagemCabecalho").style; | |
131 | - i3GEOF.wkt2layer.inicia(divid,wkt,texto); | |
132 | - }, | |
133 | - pegaPar: function(){ | |
134 | - var par,nometema,temp; | |
135 | - try{ | |
136 | - par = i3GEOF.proplabel.pegaPar(); | |
137 | - i3GEOF.wkt2layer.parDefault = par; | |
138 | - } | |
139 | - catch(e){ | |
140 | - par = i3GEOF.wkt2layer.parDefault; | |
141 | - } | |
142 | - if($i("i3GEOFwkt2layerTitulo").value !== ""){ | |
143 | - nometema = $i("i3GEOFwkt2layerTitulo").value; | |
144 | - } | |
145 | - else{ | |
146 | - temp = Math.random() + "_wkt2raster"; | |
147 | - temp = temp.split("."); | |
148 | - nometema = temp[1]; | |
149 | - } | |
150 | - if($i("i3GEOFwkt2layerTexto").value !== ""){ | |
151 | - texto = $i("i3GEOFwkt2layerTexto").value; | |
152 | - } | |
153 | - else{ | |
154 | - texto = ""; | |
155 | - } | |
156 | - par += "&nometema=" + nometema | |
55 | + $i(iddiv).innerHTML = i3GEOF.wkt2layer.html(wkt,texto); | |
56 | + $i("i3GEOFwkt2layerWkt").value = wkt; | |
57 | + }, | |
58 | + feature: function() { | |
59 | + var wkt = $i("i3GEOFwkt2layerWkt").value; | |
60 | + wkt = $.trim(wkt.replace(/[\t\n]+/g,' ')); | |
61 | + if(wkt.length < 5){ | |
62 | + i3GEO.janela.tempoMsg($trad("mensagem",i3GEOF.wkt2layer.dicionario)); | |
63 | + } | |
64 | + else{ | |
65 | + i3GEOF.wkt2layer.insere(); | |
66 | + } | |
67 | + }, | |
68 | + layer: function() { | |
69 | + var wkt = $i("i3GEOFwkt2layerWkt").value; | |
70 | + wkt = $.trim(wkt.replace(/[\t\n]+/g,' ')); | |
71 | + if(wkt.length < 5){ | |
72 | + i3GEO.janela.tempoMsg($trad("mensagem",i3GEOF.wkt2layer.dicionario)); | |
73 | + } | |
74 | + else{ | |
75 | + i3GEOF.wkt2layer.shapefile(); | |
76 | + } | |
77 | + }, | |
78 | + /* | |
79 | + * Function: html | |
80 | + * | |
81 | + * Gera o código html para apresentação das opções da ferramenta | |
82 | + * | |
83 | + * Retorno: | |
84 | + * | |
85 | + * String com o código html | |
86 | + */ | |
87 | + html : function(wkt,texto) { | |
88 | + var ins = Mustache.render(i3GEOF.wkt2layer.MUSTACHE, i3GEOF.wkt2layer.mustacheHash(wkt,texto)); | |
89 | + return ins; | |
90 | + }, | |
91 | + /* | |
92 | + * Function: criaJanelaFlutuante | |
93 | + * | |
94 | + * Cria a janela flutuante para controle da ferramenta. | |
95 | + */ | |
96 | + iniciaJanelaFlutuante : function(wkt,texto) { | |
97 | + var cabecalho, janela, divid, titulo; | |
98 | + if ($i("i3GEOF.wkt2layer")) { | |
99 | + return; | |
100 | + } | |
101 | + cabecalho = function() { | |
102 | + }; | |
103 | + // cria a janela flutuante | |
104 | + titulo = "<span class='i3GeoTituloJanelaBsNolink' >" + $trad("wkt2layer",i3GEOF.wkt2layer.dicionario) + "</span></div>"; | |
105 | + janela = | |
106 | + i3GEO.janela.cria( | |
107 | + "280px", | |
108 | + "210px", | |
109 | + "", | |
110 | + "", | |
111 | + "", | |
112 | + titulo, | |
113 | + "i3GEOF.wkt2layer", | |
114 | + false, | |
115 | + "hd", | |
116 | + cabecalho, | |
117 | + "", | |
118 | + "", | |
119 | + true, | |
120 | + "", | |
121 | + "", | |
122 | + "", | |
123 | + "" | |
124 | + ); | |
125 | + divid = janela[2].id; | |
126 | + janela[0].moveTo(150,150); | |
127 | + $i("i3GEOF.wkt2layer_corpo").style.backgroundColor = "white"; | |
128 | + i3GEOF.wkt2layer.aguarde = $i("i3GEOF.wkt2layer_imagemCabecalho").style; | |
129 | + i3GEOF.wkt2layer.inicia(divid,wkt,texto); | |
130 | + }, | |
131 | + pegaPar: function(){ | |
132 | + var par,nometema,temp; | |
133 | + try{ | |
134 | + par = i3GEOF.proplabel.pegaPar(); | |
135 | + i3GEOF.wkt2layer.parDefault = par; | |
136 | + } | |
137 | + catch(e){ | |
138 | + par = i3GEOF.wkt2layer.parDefault; | |
139 | + } | |
140 | + if($i("i3GEOFwkt2layerTitulo").value !== ""){ | |
141 | + nometema = $i("i3GEOFwkt2layerTitulo").value; | |
142 | + } | |
143 | + else{ | |
144 | + temp = Math.random() + "_wkt2raster"; | |
145 | + temp = temp.split("."); | |
146 | + nometema = temp[1]; | |
147 | + } | |
148 | + if($i("i3GEOFwkt2layerTexto").value !== ""){ | |
149 | + texto = $i("i3GEOFwkt2layerTexto").value; | |
150 | + } | |
151 | + else{ | |
152 | + texto = ""; | |
153 | + } | |
154 | + par += "&nometema=" + nometema | |
157 | 155 | + "&texto=" + texto; |
158 | - return par; | |
159 | - }, | |
160 | - /* | |
156 | + return par; | |
157 | + }, | |
158 | + /* | |
161 | 159 | Function: insere |
162 | 160 | |
163 | 161 | Insere no mapa |
164 | 162 | |
165 | - */ | |
166 | - insere: function(){ | |
167 | - if(i3GEOF.wkt2layer.aguarde.visibility === "visible") | |
168 | - {return;} | |
169 | - i3GEOF.wkt2layer.aguarde.visibility = "visible"; | |
170 | - var wkt,monta,par,p,cp; | |
171 | - monta = function(){ | |
172 | - i3GEOF.wkt2layer.aguarde.visibility = "hidden"; | |
173 | - i3GEO.atualiza(); | |
174 | - i3GEO.janela.tempoMsg($trad('fim',i3GEOF.wkt2layer.dicionario)); | |
175 | - }; | |
176 | - par = i3GEOF.wkt2layer.pegaPar(); | |
177 | - wkt = $i("i3GEOFwkt2layerWkt").value; | |
178 | - wkt = wkt.split("\n").join("|"); | |
179 | - p = i3GEO.configura.locaplic+"/ferramentas/wkt2layer/exec.php?g_sid="+i3GEO.configura.sid+ | |
180 | - "&funcao=feature&"+par; | |
181 | - cp = new cpaint(); | |
182 | - cp.set_transfer_mode('POST'); | |
183 | - cp.set_response_type("JSON"); | |
184 | - cp.call(p,"foo",monta,"xy="+wkt); | |
185 | - }, | |
186 | - /* | |
163 | + */ | |
164 | + insere: function(){ | |
165 | + if(i3GEOF.wkt2layer.aguarde.visibility === "visible") | |
166 | + {return;} | |
167 | + i3GEOF.wkt2layer.aguarde.visibility = "visible"; | |
168 | + var wkt,monta,par,p,cp; | |
169 | + monta = function(){ | |
170 | + i3GEOF.wkt2layer.aguarde.visibility = "hidden"; | |
171 | + i3GEO.atualiza(); | |
172 | + i3GEO.janela.tempoMsg($trad('fim',i3GEOF.wkt2layer.dicionario)); | |
173 | + }; | |
174 | + par = i3GEOF.wkt2layer.pegaPar(); | |
175 | + wkt = $i("i3GEOFwkt2layerWkt").value; | |
176 | + wkt = wkt.split("\n").join("|"); | |
177 | + p = i3GEO.configura.locaplic+"/ferramentas/wkt2layer/exec.php?g_sid="+i3GEO.configura.sid+ | |
178 | + "&funcao=feature&"+par; | |
179 | + cp = new cpaint(); | |
180 | + cp.set_transfer_mode('POST'); | |
181 | + cp.set_response_type("JSON"); | |
182 | + cp.call(p,"foo",monta,"xy="+wkt); | |
183 | + }, | |
184 | + /* | |
187 | 185 | Function: shapefile |
188 | 186 | |
189 | 187 | Insere no mapa |
190 | 188 | |
191 | - */ | |
192 | - shapefile: function(){ | |
193 | - if(i3GEOF.wkt2layer.aguarde.visibility === "visible") | |
194 | - {return;} | |
195 | - i3GEOF.wkt2layer.aguarde.visibility = "visible"; | |
196 | - var wkt,monta,par,p,cp; | |
197 | - monta = function(){ | |
198 | - i3GEOF.wkt2layer.aguarde.visibility = "hidden"; | |
199 | - i3GEO.atualiza(); | |
200 | - i3GEO.janela.tempoMsg($trad('fim',i3GEOF.wkt2layer.dicionario)); | |
201 | - }; | |
202 | - par = i3GEOF.wkt2layer.pegaPar(); | |
203 | - wkt = $i("i3GEOFwkt2layerWkt").value; | |
204 | - wkt = $.trim(wkt.replace(/[\t]+/g,' ')); | |
205 | - wkt = wkt.split("\n").join("|"); | |
206 | - p = i3GEO.configura.locaplic+"/ferramentas/wkt2layer/exec.php?g_sid="+i3GEO.configura.sid+ | |
207 | - "&funcao=shapefile&"+par; | |
208 | - cp = new cpaint(); | |
209 | - cp.set_transfer_mode('POST'); | |
210 | - cp.set_response_type("JSON"); | |
211 | - cp.call(p,"foo",monta,"xy="+wkt); | |
212 | - } | |
189 | + */ | |
190 | + shapefile: function(){ | |
191 | + if(i3GEOF.wkt2layer.aguarde.visibility === "visible") | |
192 | + {return;} | |
193 | + i3GEOF.wkt2layer.aguarde.visibility = "visible"; | |
194 | + var wkt,monta,par,p,cp; | |
195 | + monta = function(){ | |
196 | + i3GEOF.wkt2layer.aguarde.visibility = "hidden"; | |
197 | + i3GEO.atualiza(); | |
198 | + i3GEO.janela.tempoMsg($trad('fim',i3GEOF.wkt2layer.dicionario)); | |
199 | + }; | |
200 | + par = i3GEOF.wkt2layer.pegaPar(); | |
201 | + wkt = $i("i3GEOFwkt2layerWkt").value; | |
202 | + wkt = $.trim(wkt.replace(/[\t]+/g,' ')); | |
203 | + wkt = wkt.split("\n").join("|"); | |
204 | + p = i3GEO.configura.locaplic+"/ferramentas/wkt2layer/exec.php?g_sid="+i3GEO.configura.sid+ | |
205 | + "&funcao=shapefile&"+par; | |
206 | + cp = new cpaint(); | |
207 | + cp.set_transfer_mode('POST'); | |
208 | + cp.set_response_type("JSON"); | |
209 | + cp.call(p,"foo",monta,"xy="+wkt); | |
210 | + } | |
213 | 211 | }; | ... | ... |
ferramentas/wkt2layer/template_mst.html
1 | -<style> | |
2 | -.yui-button#i3GEOFwkt2layerShp button { | |
3 | - background: url('../imagens/gisicons/shape.png') 5% 50% no-repeat; | |
4 | - width: 200px; | |
5 | -} | |
6 | - | |
7 | -.yui-button#i3GEOFwkt2layerInterno button { | |
8 | - background: url('../imagens/gisicons/layer-vector-create.png') 5% 50% | |
9 | - no-repeat; | |
10 | - width: 200px; | |
11 | -} | |
12 | -</style> | |
13 | -<div style='margin-left: 5px'> | |
14 | - <p class='paragrafo'> | |
15 | - <b>WKT: </b> | |
16 | - </p> | |
17 | - <p class='paragrafo'> | |
18 | - <textarea id='i3GEOFwkt2layerWkt' cols='30' rows='3'> | |
19 | - {{{wkt}}} </textarea> | |
20 | - </p> | |
21 | - <br> | |
22 | - <p class='paragrafo'>{{{nometema}}}</p> | |
23 | - <div class='i3geoForm i3geoFormIconeEdita'> | |
24 | - <input type='text' value='' title='' id='i3GEOFwkt2layerTitulo' /> | |
1 | +<div class='container-fluid'> | |
2 | + <div class='form-group label-fixed condensed'> | |
3 | + <label class="control-label" for="">WKT</label> | |
4 | + <textarea class="form-control input-lg" id='i3GEOFwkt2layerWkt' rows='3'>{{{wkt}}}</textarea> | |
25 | 5 | </div> |
26 | - <br> | |
27 | - <p class='paragrafo'>{{{shapefile}}}</p> | |
28 | - <p class='paragrafo'> | |
29 | - <input id='i3GEOFwkt2layerShp' type='button' value='Shape File' /> | |
30 | - </p> | |
31 | - <br> | |
32 | - <p class='paragrafo'>{{{feature}}}</p> | |
33 | - | |
34 | - <p class='paragrafo'> | |
35 | - <input id='i3GEOFwkt2layerInterno' type='button' value='Feature' /> | |
36 | - </p> | |
37 | - <br><p class='paragrafo'>{{{texto}}}</p> | |
38 | - <div class='i3geoForm i3geoFormIconeEdita'> | |
39 | - <input type='text' value='{{{valortexto}}}' title='' id='i3GEOFwkt2layerTexto' /> | |
6 | + <div class='form-group label-fixed condensed'> | |
7 | + <label class="control-label" for="">{{{nometema}}}</label> | |
8 | + <input class="form-control input-lg" type='text' id='i3GEOFwkt2layerTitulo' value='' /> | |
9 | + </div> | |
10 | + <h5>{{{shapefile}}}</h5> | |
11 | + <button onclick="i3GEOF.wkt2layer.layer()" class='btn btn-primary btn-sm btn-raised'>Shape File</button> | |
12 | + <h5>{{{feature}}}</h5> | |
13 | + <button onclick="i3GEOF.wkt2layer.feature()" class='btn btn-primary btn-sm btn-raised'>Feature</button> | |
14 | + <h5>{{{texto}}}</h5> | |
15 | + <div class='form-group label-fixed condensed' > | |
16 | + <input class="form-control input-lg" type='text' id='i3GEOFwkt2layerTexto' value='{{{valortexto}}}' /> | |
40 | 17 | </div> |
41 | - <br><br> | |
42 | 18 | </div> | ... | ... |