Commit cf4ed60553354ef038d9a3be37e2763d9fa61ddc

Authored by Edmar Moretti
1 parent 3798ac66
Exists in master

Alteração na forma como urls kml são inseridas no mapa

ferramentas/carregakml/index.js
... ... @@ -150,12 +150,19 @@ i3GEOF.carregakml = {
150 150 Adiciona o KML ao mapa
151 151 */
152 152 adiciona: function(){
153   - if(i3GEOF.carregakml.aguarde.visibility === "visible")
154   - {return;}
155   - var url = $i("i3GEOcarregakmlurl").value;
  153 + var url, temp, cp, p;
  154 + if(i3GEOF.carregakml.aguarde.visibility === "visible"){
  155 + return;
  156 + }
  157 + url = $i("i3GEOcarregakmlurl").value;
156 158 if(url !== ""){
157   - i3GEOF.carregakml.aguarde.visibility = "visible";
158   - i3GEO.Interface[i3GEO.Interface.ATUAL].adicionaKml(false,url,url,true);
  159 + temp = function(retorno){
  160 + i3GEO.atualiza();
  161 + };
  162 + cp = new cpaint();
  163 + cp.set_response_type("JSON");
  164 + p = i3GEO.configura.locaplic+"/ferramentas/carregakml/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=crialayer&url="+url;
  165 + cp.call(p,"foo",temp);
159 166 i3GEOF.carregakml.aguarde.visibility = "hidden";
160 167 }
161 168 }
... ...
ferramentas/conectarservicos/index.js
... ... @@ -154,7 +154,7 @@ i3GEOF.conectarservicos =
154 154 * Cria a janela flutuante para controle da ferramenta.
155 155 */
156 156 iniciaJanelaFlutuante : function() {
157   - var minimiza, cabecalho, janela, divid, temp, titulo;
  157 + var minimiza, cabecalho, janela, divid, titulo;
158 158 if($i("i3GEOF.conectarservicos")){
159 159 return;
160 160 }
... ...
ferramentas/cortina/index.js
... ... @@ -188,6 +188,10 @@ i3GEOF.cortina = {
188 188 if(i3GEOF.cortina.tema !== ""){
189 189 if(i3GEO.Interface.ATUAL === "openlayers"){
190 190 layer = i3geoOL.getLayersByName(i3GEOF.cortina.tema)[0];
  191 + //TODO nao funciona no OL3
  192 + if(!layer.div){
  193 + return;
  194 + }
191 195 i3GEOF.cortina.estilo = layer.div.style;
192 196 }
193 197 if(i3GEO.Interface.ATUAL === "googlemaps"){
... ...
ferramentas/geolocal/index.js
... ... @@ -33,26 +33,27 @@ GNU junto com este programa; se não, escreva para a
33 33 Free Software Foundation, Inc., no endereço
34 34 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
35 35 */
36   -if(typeof(i3GEOF) === 'undefined'){
  36 +if (typeof (i3GEOF) === 'undefined') {
37 37 var i3GEOF = {};
38 38 }
39 39 /*
40   -Classe: i3GEOF.geolocal
  40 + * Classe: i3GEOF.geolocal
41 41 */
42   -i3GEOF.geolocal = {
  42 +i3GEOF.geolocal =
  43 + {
43 44 /*
44   - Variavel: posicoes
45   -
46   - Objetos capturados
  45 + * Variavel: posicoes
  46 + *
  47 + * Objetos capturados
47 48 */
48   - posicoes: [],
49   - tempo: null,
  49 + posicoes : [],
  50 + tempo : null,
50 51 /*
51   - Variavel: aguarde
52   -
53   - Estilo do objeto DOM com a imagem de aguarde existente no cabeçalho da janela.
  52 + * Variavel: aguarde
  53 + *
  54 + * Estilo do objeto DOM com a imagem de aguarde existente no cabeçalho da janela.
54 55 */
55   - aguarde: "",
  56 + aguarde : "",
56 57 /**
57 58 * Template no formato mustache. E preenchido na carga do javascript com o programa dependencias.php
58 59 */
... ... @@ -66,124 +67,121 @@ i3GEOF.geolocal = {
66 67 return dicionario;
67 68 },
68 69 /*
69   - Function: inicia
70   -
71   - Inicia a ferramenta. É chamado por criaJanelaFlutuante
72   -
73   - Parametro:
74   -
75   - iddiv {String} - id do div que receberá o conteudo HTML da ferramenta
  70 + * Function: inicia
  71 + *
  72 + * Inicia a ferramenta. É chamado por criaJanelaFlutuante
  73 + *
  74 + * Parametro:
  75 + *
  76 + * iddiv {String} - id do div que receberá o conteudo HTML da ferramenta
76 77 */
77   - inicia: function(iddiv){
78   - var ics,n,i;
79   - //se nao permitir a localizacao, retorna uma mensagem
80   - if(navigator.geolocation){
  78 + inicia : function(iddiv) {
  79 + var ics, n, i;
  80 + // se nao permitir a localizacao, retorna uma mensagem
  81 + if (navigator.geolocation) {
81 82 $i(iddiv).innerHTML = i3GEOF.geolocal.html();
82 83 $i("i3GEOFgeolocalFormTempo").onsubmit = i3GEOF.geolocal.capturaTempo;
83 84 ics = $i(iddiv).getElementsByTagName("button");
84 85 n = ics.length;
85   - for(i=0;i<n;i++){
  86 + for (i = 0; i < n; i++) {
86 87 ics[i].style.backgroundColor = "white";
87 88 ics[i].className = "iconeGuiaMovel iconeGuiaMovelMouseOut";
88   - ics[i].onmouseout = function(){this.className = "iconeGuiaMovel iconeGuiaMovelMouseOut";};
89   - ics[i].onmouseover = function(){this.className = "iconeGuiaMovel iconeGuiaMovelMouseOver";};
  89 + ics[i].onmouseout = function() {
  90 + this.className = "iconeGuiaMovel iconeGuiaMovelMouseOut";
  91 + };
  92 + ics[i].onmouseover = function() {
  93 + this.className = "iconeGuiaMovel iconeGuiaMovelMouseOver";
  94 + };
90 95 }
91 96 i3GEOF.geolocal.capturaCoordenada();
92   - }
93   - else{
94   - $i(iddiv).innerHTML = $trad('msgNavegador',i3GEOF.geolocal.dicionario);
  97 + } else {
  98 + $i(iddiv).innerHTML = $trad('msgNavegador', i3GEOF.geolocal.dicionario);
95 99 }
96 100 },
97 101 /*
98   - Function: html
99   -
100   - Gera o c&oacute;digo html para apresenta&ccedil;&atilde;o das op&ccedil;&otilde;es da ferramenta
101   -
102   - Retorno:
103   -
104   - String com o c&oacute;digo html
  102 + * Function: html
  103 + *
  104 + * Gera o c&oacute;digo html para apresenta&ccedil;&atilde;o das op&ccedil;&otilde;es da ferramenta
  105 + *
  106 + * Retorno:
  107 + *
  108 + * String com o c&oacute;digo html
105 109 */
106   - html:function() {
  110 + html : function() {
107 111 var ins = Mustache.render(i3GEOF.geolocal.MUSTACHE, i3GEOF.geolocal.mustacheHash());
108 112 return ins;
109 113 },
110 114 /*
111   - Function: iniciaJanelaFlutuante
112   -
113   - Cria a janela flutuante para controle da ferramenta.
  115 + * Function: iniciaJanelaFlutuante
  116 + *
  117 + * Cria a janela flutuante para controle da ferramenta.
114 118 */
115   - iniciaJanelaFlutuante: function(){
116   - var janela,divid,temp,titulo,cabecalho,minimiza;
117   - if($i("i3GEOF.geolocal")){
  119 + iniciaJanelaFlutuante : function() {
  120 + var janela, divid, temp, titulo, cabecalho, minimiza;
  121 + if ($i("i3GEOF.geolocal")) {
118 122 return;
119 123 }
120   - cabecalho = function(){};
121   - minimiza = function(){
  124 + cabecalho = function() {
  125 + };
  126 + minimiza = function() {
122 127 i3GEO.janela.minimiza("i3GEOF.geolocal");
123 128 };
124   - //cria a janela flutuante
125   - titulo = "<span class='i3GEOiconeFerramenta i3GEOiconeGeoLocal'></span><div class='i3GeoTituloJanela'>" + $trad('localizaUsuario',i3GEOF.geolocal.dicionario)+"<a class=ajuda_usuario target=_blank href='" + i3GEO.configura.locaplic + "/ajuda_usuario.php?idcategoria=6&idajuda=118' ><b> </b></a></div>";
126   - janela = i3GEO.janela.cria(
127   - "290",
128   - "220",
129   - "",
130   - "",
131   - "",
132   - titulo,
133   - "i3GEOF.geolocal",
134   - false,
135   - "hd",
136   - cabecalho,
137   - minimiza
138   - );
  129 + // cria a janela flutuante
  130 + titulo =
  131 + "<span class='i3GEOiconeFerramenta i3GEOiconeGeoLocal'></span><div class='i3GeoTituloJanela'>" + $trad(
  132 + 'localizaUsuario',
  133 + i3GEOF.geolocal.dicionario)
  134 + + "<a class=ajuda_usuario target=_blank href='"
  135 + + i3GEO.configura.locaplic
  136 + + "/ajuda_usuario.php?idcategoria=6&idajuda=118' ><b> </b></a></div>";
  137 + janela = i3GEO.janela.cria("290", "220", "", "", "", titulo, "i3GEOF.geolocal", false, "hd", cabecalho, minimiza);
139 138 divid = janela[2].id;
140 139 $i("i3GEOF.geolocal_corpo").style.backgroundColor = "white";
141 140 $i("i3GEOF.geolocal_corpo").style.textAlign = "left";
142 141 i3GEOF.geolocal.aguarde = $i("i3GEOF.geolocal_imagemCabecalho").style;
143 142 i3GEOF.geolocal.inicia(divid);
144   - temp = function(){
  143 + temp = function() {
145 144 i3GEOF.geolocal[i3GEO.Interface.ATUAL].removeLayer();
146 145 i3GEOF.geolocal.paraTempo();
147 146 };
148 147 YAHOO.util.Event.addListener(janela[0].close, "click", temp);
149 148 },
150   - capturaCoordenada: function(){
151   - if(i3GEOF.geolocal.aguarde.visibility == "visible"){
  149 + capturaCoordenada : function() {
  150 + if (i3GEOF.geolocal.aguarde.visibility == "visible") {
152 151 return;
153 152 }
154 153 i3GEOF.geolocal.aguarde.visibility = "visible";
155   - var retorno = function(position){
  154 + var retorno = function(position) {
156 155 i3GEOF.geolocal.posicoes.push(position);
157   - var n = parseInt($i("i3GEOFgeolocalMaximo").value,10);
158   - if(n > 0 && i3GEOF.geolocal.posicoes.length > n){
159   - i3GEOF.geolocal.posicoes.splice(0,(i3GEOF.geolocal.posicoes.length - n));
  156 + var n = parseInt($i("i3GEOFgeolocalMaximo").value, 10);
  157 + if (n > 0 && i3GEOF.geolocal.posicoes.length > n) {
  158 + i3GEOF.geolocal.posicoes.splice(0, (i3GEOF.geolocal.posicoes.length - n));
160 159 }
161 160 i3GEOF.geolocal.listaCoord();
162 161 };
163   - navigator.geolocation.getCurrentPosition(retorno,i3GEOF.geolocal.erro);
  162 + navigator.geolocation.getCurrentPosition(retorno, i3GEOF.geolocal.erro);
164 163 },
165   - capturaTempo: function(){
166   - var tempo = parseInt($i("i3GEOFgeolocalTempo").value,10);
167   - if(tempo){
168   - if(tempo > 0){
169   - i3GEOF.geolocal.tempo = setInterval("i3GEOF.geolocal.capturaCoordenada()",tempo*1000);
170   - }
171   - else{
  164 + capturaTempo : function() {
  165 + var tempo = parseInt($i("i3GEOFgeolocalTempo").value, 10);
  166 + if (tempo) {
  167 + if (tempo > 0) {
  168 + i3GEOF.geolocal.tempo = setInterval("i3GEOF.geolocal.capturaCoordenada()", tempo * 1000);
  169 + } else {
172 170 clearInterval(i3GEOF.geolocal.tempo);
173 171 }
174 172 }
175 173 return false;
176 174 },
177   - paraTempo: function(){
178   - if($i("i3GEOFgeolocalTempo")){
  175 + paraTempo : function() {
  176 + if ($i("i3GEOFgeolocalTempo")) {
179 177 $i("i3GEOFgeolocalTempo").value = 0;
180 178 }
181 179 clearInterval(i3GEOF.geolocal.tempo);
182 180 },
183   - erro: function(error){
  181 + erro : function(error) {
184 182 i3GEOF.geolocal.paraTempo();
185 183 var erro = "";
186   - switch(error.code){
  184 + switch (error.code) {
187 185 case error.PERMISSION_DENIED:
188 186 erro = "User denied the request for Geolocation.";
189 187 break;
... ... @@ -200,100 +198,193 @@ i3GEOF.geolocal = {
200 198 i3GEO.janela.tempoMsg(erro);
201 199 i3GEOF.geolocal.aguarde.visibility = "hidden";
202 200 },
203   - listaCoord: function(position){
204   - var ps = i3GEOF.geolocal.posicoes,
205   - n = ps.length,
206   - i,
207   - ins = "",
208   - res = ["<tr><td></td><td></td><td></td><td><b>Latitude</b></td><td><b>Longitude</b></td></tr>"];
209   - for(i=(n-1);i>=0;i--){
210   - ins = "<tr>" +
211   - '<td><img title="' + $trad('limpa',i3GEOF.geolocal.dicionario) + '" src="'+i3GEO.configura.locaplic+'/imagens/x.gif" onclick="i3GEOF.geolocal.excluiLinha('+i+')" style="cursor:pointer"></td>' +
212   - '<td><img onmouseout="i3GEOF.geolocal.escondexy()" onmouseover="i3GEOF.geolocal.mostraxy('+i+')" title="pan" src="'+i3GEO.configura.locaplic+'/imagens/o.gif" onclick="i3GEOF.geolocal.panLinha('+i+')" style="cursor:pointer"></td>' +
213   - '<td><img title="info" src="'+i3GEO.configura.locaplic+'/imagens/oxygen/16x16/help-about.png" onclick="i3GEOF.geolocal.info('+i+')" style="cursor:pointer"></td>' +
214   - "<td>" + ps[i].coords.latitude + "</td><td>" + ps[i].coords.longitude + "</td></tr>";
  201 + listaCoord : function(position) {
  202 + var ps = i3GEOF.geolocal.posicoes, n = ps.length, i, ins = "", res = [
  203 + "<tr><td></td><td></td><td></td><td><b>Latitude</b></td><td><b>Longitude</b></td></tr>"
  204 + ];
  205 + for (i = (n - 1); i >= 0; i--) {
  206 + ins =
  207 + "<tr>" + '<td><img title="' + $trad('limpa', i3GEOF.geolocal.dicionario)
  208 + + '" src="'
  209 + + i3GEO.configura.locaplic
  210 + + '/imagens/x.gif" onclick="i3GEOF.geolocal.excluiLinha('
  211 + + i
  212 + + ')" style="cursor:pointer"></td>'
  213 + + '<td><img onmouseout="i3GEOF.geolocal.escondexy()" onmouseover="i3GEOF.geolocal.mostraxy('
  214 + + i
  215 + + ')" title="pan" src="'
  216 + + i3GEO.configura.locaplic
  217 + + '/imagens/o.gif" onclick="i3GEOF.geolocal.panLinha('
  218 + + i
  219 + + ')" style="cursor:pointer"></td>'
  220 + + '<td><img title="info" src="'
  221 + + i3GEO.configura.locaplic
  222 + + '/imagens/oxygen/16x16/help-about.png" onclick="i3GEOF.geolocal.info('
  223 + + i
  224 + + ')" style="cursor:pointer"></td>'
  225 + + "<td>"
  226 + + ps[i].coords.latitude
  227 + + "</td><td>"
  228 + + ps[i].coords.longitude
  229 + + "</td></tr>";
215 230 res.push(ins);
216 231 }
217 232 $i("i3GEOFgeolocalListaDePontos").innerHTML = "<table class='lista8' >" + res.join("") + "</table>";
218 233 $i("i3GEOFgeolocalNcoord").innerHTML = n;
219   - i3GEOF.geolocal[i3GEO.Interface.ATUAL].desenha();
  234 + if (i3GEO.Interface["ATUAL"] === "openlayers") {
  235 + if (typeof OpenLayers == "undefined") {
  236 + api = "ol3";
  237 + } else {
  238 + api = "openlayers";
  239 + }
  240 + } else {
  241 + api = i3GEO.Interface["ATUAL"];
  242 + }
  243 + i3GEOF.geolocal[api].desenha();
220 244 i3GEOF.geolocal.aguarde.visibility = "hidden";
221 245 },
222   - limpa: function(){
  246 + limpa : function() {
223 247 i3GEOF.geolocal.posicoes = [];
224   - i3GEOF.geolocal[i3GEO.Interface.ATUAL].removeLayer();
  248 + if (i3GEO.Interface["ATUAL"] === "openlayers") {
  249 + if (typeof OpenLayers == "undefined") {
  250 + api = "ol3";
  251 + } else {
  252 + api = "openlayers";
  253 + }
  254 + } else {
  255 + api = i3GEO.Interface["ATUAL"];
  256 + }
  257 + i3GEOF.geolocal[api].removeLayer();
225 258 i3GEOF.geolocal.listaCoord();
226 259 },
227   - excluiLinha: function(i){
228   - i3GEOF.geolocal.posicoes.splice(i,1);
  260 + excluiLinha : function(i) {
  261 + i3GEOF.geolocal.posicoes.splice(i, 1);
229 262 i3GEOF.geolocal.listaCoord();
230 263 },
231   - panLinha: function(i){
  264 + panLinha : function(i) {
232 265 var posicao = i3GEOF.geolocal.posicoes[i];
233   - //@FIXME o pan nao funciona no OSM
234   - if(posicao != undefined && i3GEO.Interface.openlayers.googleLike != true){
235   - i3GEO.navega.pan2ponto((posicao.coords.longitude),(posicao.coords.latitude));
  266 + // @FIXME o pan nao funciona no OSM
  267 + if (posicao != undefined && i3GEO.Interface.openlayers.googleLike != true) {
  268 + i3GEO.navega.pan2ponto((posicao.coords.longitude), (posicao.coords.latitude));
236 269 }
237 270 },
238   - info: function(i){
239   - i3GEO.mapa.dialogo.cliqueIdentificaDefault(i3GEOF.geolocal.posicoes[i].coords.longitude,i3GEOF.geolocal.posicoes[i].coords.latitude);
  271 + info : function(i) {
  272 + i3GEO.mapa.dialogo.cliqueIdentificaDefault(
  273 + i3GEOF.geolocal.posicoes[i].coords.longitude,
  274 + i3GEOF.geolocal.posicoes[i].coords.latitude);
240 275 },
241   - mostraxy: function(i){
242   - if(i3GEO.Interface.ATUAL === "googleearth")
243   - {return;}
  276 + mostraxy : function(i) {
  277 + if (i3GEO.Interface.ATUAL === "googleearth") {
  278 + return;
  279 + }
244 280 var posicao = i3GEOF.geolocal.posicoes[i];
245   - i3GEO.desenho.addPin(posicao.coords.longitude,posicao.coords.latitude,"","",i3GEO.configura.locaplic+'/imagens/google/confluence.png',"pingeolocal");
  281 + i3GEO.desenho.addPin(
  282 + posicao.coords.longitude,
  283 + posicao.coords.latitude,
  284 + "",
  285 + "",
  286 + i3GEO.configura.locaplic + '/imagens/google/confluence.png',
  287 + "pingeolocal");
246 288 },
247   - escondexy: function(){
  289 + escondexy : function() {
248 290 i3GEO.desenho.removePins("pingeolocal");
249 291 },
250   - posicoes2pontos: function(){
251   - var ps = i3GEOF.geolocal.posicoes,
252   - n = ps.length,
253   - i,
254   - pontos = [];
255   - for(i=0;i < n;i++){
  292 + posicoes2pontos : function() {
  293 + var ps = i3GEOF.geolocal.posicoes, n = ps.length, i, pontos = [];
  294 + for (i = 0; i < n; i++) {
256 295 pontos.push((ps[i].coords.longitude) + " " + ps[i].coords.latitude);
257 296 }
258 297 return pontos;
259 298 },
260   - criaShp: function(){
261   - function ativanovotema(retorno){
262   - var pontos = i3GEOF.geolocal.posicoes2pontos(),
263   - temaNovo = retorno.data,
264   - converteParaLinha = function(){
265   - var cp = new cpaint();
266   - cp.set_response_type("JSON");
267   - var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=sphPT2shp&para=linha&tema="+temaNovo;
268   - cp.call(p,"sphPT2shp",i3GEO.atualiza);
269   - };
270   - var p = window.parent.i3GEO.configura.locaplic+"/ferramentas/inserexy2/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=insereSHP&tema="+retorno.data;
  299 + criaShp : function() {
  300 + function ativanovotema(retorno) {
  301 + var pontos = i3GEOF.geolocal.posicoes2pontos(), temaNovo = retorno.data, converteParaLinha =
  302 + function() {
  303 + var cp = new cpaint();
  304 + cp.set_response_type("JSON");
  305 + var p =
  306 + i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid="
  307 + + i3GEO.configura.sid
  308 + + "&funcao=sphPT2shp&para=linha&tema="
  309 + + temaNovo;
  310 + cp.call(p, "sphPT2shp", i3GEO.atualiza);
  311 + };
  312 + var p =
  313 + window.parent.i3GEO.configura.locaplic + "/ferramentas/inserexy2/exec.php?g_sid="
  314 + + i3GEO.configura.sid
  315 + + "&funcao=insereSHP&tema="
  316 + + retorno.data;
271 317 var cp = new cpaint();
272 318 cp.set_response_type("JSON");
273 319 cp.set_transfer_mode('POST');
274   - cp.call(p,"insereSHP",converteParaLinha,"&xy="+pontos.join(" "));
  320 + cp.call(p, "insereSHP", converteParaLinha, "&xy=" + pontos.join(" "));
275 321 }
276 322 var cp = new cpaint();
277 323 cp.set_response_type("JSON");
278 324 cp.set_transfer_mode("POST");
279   - var p = window.parent.i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid;
280   - cp.call(p,"criaSHPvazio",ativanovotema,"&funcao=criashpvazio");
  325 + var p = window.parent.i3GEO.configura.locaplic + "/classesphp/mapa_controle.php?g_sid=" + i3GEO.configura.sid;
  326 + cp.call(p, "criaSHPvazio", ativanovotema, "&funcao=criashpvazio");
281 327 },
282   - openlayers: {
283   - desenha: function(){
  328 + ol3 : {
  329 + desenha : function() {
  330 + if (!i3GEO.desenho.layergrafico) {
  331 + i3GEO.desenho.openlayers.criaLayerGrafico();
  332 + }
  333 + i3GEOF.geolocal.ol3.removeFiguras();
  334 + var ps = i3GEOF.geolocal.posicoes, n = ps.length, i, feature;
  335 + for (i = 0; i < n; i++) {
  336 + feature = new ol.Feature({
  337 + geometry : new ol.geom.Point([
  338 + ps[i].coords.longitude, ps[i].coords.latitude
  339 + ]),
  340 + origem : 'i3GEOFgeolocal'
  341 + });
  342 + i3GEO.desenho.layergrafico.getSource().addFeature(feature);
  343 + // linha
  344 + if (ps[i + 1]) {
  345 + feature = new ol.Feature({
  346 + geometry : new ol.geom.LineString([
  347 + [
  348 + ps[i].coords.longitude, ps[i].coords.latitude
  349 + ], [
  350 + ps[i + 1].coords.longitude, ps[i + 1].coords.latitude
  351 + ]
  352 + ]),
  353 + origem : 'i3GEOFgeolocal'
  354 + });
  355 + i3GEO.desenho.layergrafico.getSource().addFeature(feature);
  356 + }
  357 + }
  358 + },
  359 + removeFiguras : function() {
  360 + var features, n, f, i, remover = [];
  361 + features = i3GEO.desenho.layergrafico.getSource().getFeatures();
  362 + n = features.length;
  363 + for(i = 0; i < n; i++){
  364 + f = features[i];
  365 + if(f.getProperties().origem === "i3GEOFselecao"){
  366 + remover.push(f);
  367 + }
  368 + }
  369 + for(r in remover){
  370 + i3GEO.desenho.layergrafico.getSource().removeFeature(remover[r]);
  371 + }
  372 + },
  373 + removeLayer : function() {
  374 +
  375 + }
  376 + },
  377 + openlayers : {
  378 + desenha : function() {
284 379 // allow testing of specific renderers via "?renderer=Canvas", etc
285   - var renderer = OpenLayers.Util.getParameters(window.location.href).renderer,
286   - layer_style = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']),
287   - style_blue = OpenLayers.Util.extend({}, layer_style),
288   - vectorLayer,
289   - ps = i3GEOF.geolocal.posicoes,
290   - n = ps.length,
291   - i,
292   - point,
293   - pointFeature = [],
294   - pointList = [];
  380 + var renderer = OpenLayers.Util.getParameters(window.location.href).renderer, layer_style =
  381 + OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']), style_blue =
  382 + OpenLayers.Util.extend({}, layer_style), vectorLayer, ps = i3GEOF.geolocal.posicoes, n = ps.length, i, point, pointFeature =
  383 + [], pointList = [];
295 384  
296   - renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers;
  385 + renderer = (renderer) ? [
  386 + renderer
  387 + ] : OpenLayers.Layer.Vector.prototype.renderers;
297 388  
298 389 style_blue.strokeColor = "blue";
299 390 style_blue.fillColor = "yellow";
... ... @@ -302,91 +393,83 @@ i3GEOF.geolocal = {
302 393 style_blue.strokeWidth = 2;
303 394 style_blue.rotation = 0;
304 395 style_blue.strokeLinecap = "butt";
305   - if(i3geoOL.getLayersByName("Coordenadas").length === 0){
  396 + if (i3geoOL.getLayersByName("Coordenadas").length === 0) {
306 397 vectorLayer = new OpenLayers.Layer.Vector("Coordenadas", {
307   - style: layer_style,
308   - renderers: renderer
  398 + style : layer_style,
  399 + renderers : renderer
309 400 });
310   - }
311   - else{
  401 + } else {
312 402 vectorLayer = i3geoOL.getLayersByName("Coordenadas")[0];
313 403 vectorLayer.removeFeatures(vectorLayer.features);
314 404 }
315 405  
316   - for(i=0;i<n;i++){
317   - point = new OpenLayers.Geometry.Point((ps[i].coords.longitude),(ps[i].coords.latitude));
  406 + for (i = 0; i < n; i++) {
  407 + point = new OpenLayers.Geometry.Point((ps[i].coords.longitude), (ps[i].coords.latitude));
318 408 i3GEOF.geolocal.wgs2google(point);
319 409 pointList.push(point);
320   - pointFeature.push(new OpenLayers.Feature.Vector(point,null,style_blue));
  410 + pointFeature.push(new OpenLayers.Feature.Vector(point, null, style_blue));
321 411 }
322 412  
323   - var lineFeature = new OpenLayers.Feature.Vector(
324   - new OpenLayers.Geometry.LineString(pointList),null,style_blue);
  413 + var lineFeature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(pointList), null, style_blue);
325 414  
326 415 i3geoOL.addLayer(vectorLayer);
327   - vectorLayer.addFeatures([lineFeature]);
  416 + vectorLayer.addFeatures([
  417 + lineFeature
  418 + ]);
328 419 vectorLayer.addFeatures(pointFeature);
329   - i3GEOF.geolocal.panLinha(n-1);
  420 + i3GEOF.geolocal.panLinha(n - 1);
330 421 },
331   - removeLayer: function(){
332   - i3geoOL.removeLayer(i3geoOL.getLayersByName("Coordenadas")[0],false);
  422 + removeLayer : function() {
  423 + i3geoOL.removeLayer(i3geoOL.getLayersByName("Coordenadas")[0], false);
333 424 }
334 425 },
335   - googlemaps: {
336   - linhas: null,
337   - marca: null,
338   - desenha: function(){
339   - var ps = i3GEOF.geolocal.posicoes,
340   - n = ps.length,
341   - i,
342   - l,
343   - pointFeature = [];
344   - for(i=0;i<n;i++){
345   - l = new google.maps.LatLng(ps[i].coords.latitude,ps[i].coords.longitude);
346   - pointFeature.push(
347   - l
348   - );
  426 + googlemaps : {
  427 + linhas : null,
  428 + marca : null,
  429 + desenha : function() {
  430 + var ps = i3GEOF.geolocal.posicoes, n = ps.length, i, l, pointFeature = [];
  431 + for (i = 0; i < n; i++) {
  432 + l = new google.maps.LatLng(ps[i].coords.latitude, ps[i].coords.longitude);
  433 + pointFeature.push(l);
349 434 }
350 435 i3GEOF.geolocal.googlemaps.removeLayer();
351 436 i3GEOF.geolocal.googlemaps.marca = new google.maps.Marker({
352   - position: new google.maps.LatLng(ps[0].coords.latitude,ps[0].coords.longitude),
353   - map: i3GeoMap
  437 + position : new google.maps.LatLng(ps[0].coords.latitude, ps[0].coords.longitude),
  438 + map : i3GeoMap
354 439 });
355 440 i3GEOF.geolocal.googlemaps.linhas = new google.maps.Polyline({
356   - path: pointFeature,
357   - geodesic: true,
358   - strokeColor: 'blue',
359   - strokeOpacity: 1.0,
360   - strokeWeight: 2,
361   - name: "Coordenadas"
  441 + path : pointFeature,
  442 + geodesic : true,
  443 + strokeColor : 'blue',
  444 + strokeOpacity : 1.0,
  445 + strokeWeight : 2,
  446 + name : "Coordenadas"
362 447 });
363 448 i3GEOF.geolocal.googlemaps.linhas.setMap(i3GeoMap);
364   - i3GEOF.geolocal.panLinha(n-1);
  449 + i3GEOF.geolocal.panLinha(n - 1);
365 450 },
366   - removeLayer: function(){
367   - if(i3GEOF.geolocal.googlemaps.linhas){
  451 + removeLayer : function() {
  452 + if (i3GEOF.geolocal.googlemaps.linhas) {
368 453 i3GEOF.geolocal.googlemaps.linhas.setMap(null);
369 454 }
370   - if(i3GEOF.geolocal.googlemaps.marca){
  455 + if (i3GEOF.geolocal.googlemaps.marca) {
371 456 i3GEOF.geolocal.googlemaps.marca.setMap(null);
372 457 }
373 458 }
374 459 },
375   - //@TODO implementar desenho dos pontos e linhas
376   - googleearth: {
377   - desenha: function(){
  460 + // @TODO implementar desenho dos pontos e linhas
  461 + googleearth : {
  462 + desenha : function() {
378 463 },
379   - removeLayer: function(){
  464 + removeLayer : function() {
380 465 }
381 466 },
382   - wgs2google: function(obj){
383   - if(i3GEO.Interface.openlayers.googleLike === true || i3GEO.Interface.ATUAL === "googlemaps"){
384   - var projWGS84 = new OpenLayers.Projection("EPSG:4326"),
385   - proj900913 = new OpenLayers.Projection("EPSG:900913");
386   - return obj.transform(projWGS84,proj900913);
387   - }
388   - else{
  467 + wgs2google : function(obj) {
  468 + if (i3GEO.Interface.openlayers.googleLike === true || i3GEO.Interface.ATUAL === "googlemaps") {
  469 + var projWGS84 = new OpenLayers.Projection("EPSG:4326"), proj900913 = new OpenLayers.Projection("EPSG:900913");
  470 + return obj.transform(projWGS84, proj900913);
  471 + } else {
389 472 return obj;
390 473 }
391 474 }
392   -};
  475 + };
... ...
ferramentas/gradecoord/index.js
... ... @@ -26,7 +26,6 @@ i3GEOF.gradeCoord = {
26 26 dicionario["asp"] = '"';
27 27 return dicionario;
28 28 },
29   -
30 29 /*
31 30 Function: inicia
32 31  
... ... @@ -100,12 +99,14 @@ i3GEOF.gradeCoord = {
100 99 <GRADECOORD>
101 100 */
102 101 executa: function(){
103   - if (($i("i3GEOgradeCoordintervalo").value == 0) || ($i("i3GEOgradeCoordintervalo").value == ""))
104   - {i3GEO.janela.tempoMsg($trad('distLinhas',i3GEOF.gradeCoord.dicionario));}
  102 + if (($i("i3GEOgradeCoordintervalo").value == 0) || ($i("i3GEOgradeCoordintervalo").value == "")){
  103 + i3GEO.janela.tempoMsg($trad('distLinhas',i3GEOF.gradeCoord.dicionario));
  104 + }
105 105 else
106 106 {
107   - if(i3GEOF.gradeCoord.aguarde.visibility === "visible")
108   - {return;}
  107 + if(i3GEOF.gradeCoord.aguarde.visibility === "visible"){
  108 + return;
  109 + }
109 110 i3GEOF.gradeCoord.aguarde.visibility = "visible";
110 111 var temp = function(){
111 112 i3GEO.atualiza();
... ...
ferramentas/legenda/template_mst.html
... ... @@ -107,7 +107,7 @@
107 107 <p class='paragrafo'>
108 108 &nbsp;
109 109 <input type='checkbox' onclick='' checked id='i3GEOFlegendaaplicaextent' style='cursor: pointer; border: 0px solid white;' />
110   - <span style='cursor: pointer; position: relative; top: -2px;'>{{{consideraElementosVisisveis}}}</span>
  110 + <span style='cursor: pointer; position: relative; top: -2px;left: 2px;'>{{{consideraElementosVisisveis}}}</span>
111 111 </p>
112 112 <p class='paragrafo'>{{{ignoraValores}}}:</p>
113 113 <div class='styled-select'>
... ...
ferramentas/mascara/index.js
... ... @@ -194,7 +194,7 @@ i3GEOF.mascara = {
194 194 + "&funcao=aplicar"
195 195 + "&tema=" + tema
196 196 + "&mascarar=" + mascarar.join(",");
197   - cp = new cpaint()
  197 + cp = new cpaint();
198 198 fim = function(retorno){
199 199 i3GEO.Interface.atualizaMapa();
200 200 i3GEOF.mascara.aguarde.visibility = "hidden";
... ...
ferramentas/opcoes_fundo/index.js
1   -if(typeof(i3GEOF) === 'undefined'){
  1 +if (typeof (i3GEOF) === 'undefined') {
2 2 var i3GEOF = {};
3 3 }
4 4 /*
5   -Classe: i3GEOF.opcoesFundo
6   -*/
7   -i3GEOF.opcoesFundo = {
8   - /*
9   - Variavel: aguarde
10   -
11   - Estilo do objeto DOM com a imagem de aguarde existente no cabe&ccedil;alho da janela.
12   - */
13   - aguarde: "",
14   - /**
15   - * Template no formato mustache. E preenchido na carga do javascript com o programa dependencias.php
16   - */
17   - MUSTACHE : "",
18   - /**
19   - * Susbtitutos para o template
20   - */
21   - mustacheHash : function() {
22   - var dicionario = i3GEO.idioma.objetoIdioma(i3GEOF.opcoesFundo.dicionario);
23   - dicionario["locaplic"] = i3GEO.configura.locaplic;
24   - dicionario["asp"] = '"';
25   - return dicionario;
26   - },
27   - /*
28   - Function: inicia
29   -
30   - Inicia a ferramenta. &Eacute; chamado por criaJanelaFlutuante
31   -
32   - Parametro:
33   -
34   - iddiv {String} - id do div que receber&aacute; o conteudo HTML da ferramenta
35   - */
36   - inicia: function(iddiv){
37   - try{
38   - i3GEOF.opcoesFundo.aguarde.visibility = "visible";
39   - $i(iddiv).innerHTML += i3GEOF.opcoesFundo.html();
40   - var b = new YAHOO.widget.Button(
41   - "i3GEOopcoesFundobotao1",
42   - {onclick:{fn: i3GEOF.opcoesFundo.executa}}
43   - );
44   - b.addClass("rodar150");
45   - i3GEO.util.aplicaAquarela("i3GEOF.opcoesFundo_corpo");
46   - var p = i3GEO.configura.locaplic+"/ferramentas/opcoes_fundo/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=pegacorfundo",
47   - cp = new cpaint(),
48   - retorno = function(retorno){
  5 + * Classe: i3GEOF.opcoesFundo
  6 + */
  7 +i3GEOF.opcoesFundo =
  8 + {
  9 + /*
  10 + * Variavel: aguarde
  11 + *
  12 + * Estilo do objeto DOM com a imagem de aguarde existente no cabe&ccedil;alho da janela.
  13 + */
  14 + aguarde : "",
  15 + /**
  16 + * Template no formato mustache. E preenchido na carga do javascript com o programa dependencias.php
  17 + */
  18 + MUSTACHE : "",
  19 + /**
  20 + * Susbtitutos para o template
  21 + */
  22 + mustacheHash : function() {
  23 + var dicionario = i3GEO.idioma.objetoIdioma(i3GEOF.opcoesFundo.dicionario);
  24 + dicionario["locaplic"] = i3GEO.configura.locaplic;
  25 + dicionario["asp"] = '"';
  26 + return dicionario;
  27 + },
  28 + /*
  29 + * Function: inicia
  30 + *
  31 + * Inicia a ferramenta. &Eacute; chamado por criaJanelaFlutuante
  32 + *
  33 + * Parametro:
  34 + *
  35 + * iddiv {String} - id do div que receber&aacute; o conteudo HTML da ferramenta
  36 + */
  37 + inicia : function(iddiv) {
  38 + try {
  39 + i3GEOF.opcoesFundo.aguarde.visibility = "visible";
  40 + $i(iddiv).innerHTML += i3GEOF.opcoesFundo.html();
  41 + var b = new YAHOO.widget.Button("i3GEOopcoesFundobotao1", {
  42 + onclick : {
  43 + fn : i3GEOF.opcoesFundo.executa
  44 + }
  45 + });
  46 + b.addClass("rodar150");
  47 + i3GEO.util.aplicaAquarela("i3GEOF.opcoesFundo_corpo");
  48 + var p =
  49 + i3GEO.configura.locaplic + "/ferramentas/opcoes_fundo/exec.php?g_sid=" + i3GEO.configura.sid + "&funcao=pegacorfundo", cp =
  50 + new cpaint(), retorno = function(retorno) {
49 51 i3GEOF.opcoesFundo.aguarde.visibility = "hidden";
50   - if(retorno.data.erro){i3GEO.janela.tempoMsg("Erro");return;}
  52 + if (retorno.data.erro) {
  53 + i3GEO.janela.tempoMsg("Erro");
  54 + return;
  55 + }
51 56 $i("i3GEOopcoesFundocor").value = retorno.data;
52 57 };
53   - cp.set_response_type("JSON");
54   - cp.call(p,"corQM",retorno);
55   - }
56   - catch(erro){i3GEO.janela.tempoMsg(erro);}
57   - if(i3GEO.Interface.ATUAL === "googlemaps" || i3GEO.Interface.ATUAL === "googleearth")
58   - {i3GEO.janela.tempoMsg($trad('ajuda',i3GEOF.opcoesFundo.dicionario));}
59   - },
60   - /*
61   - Function: html
62   -
63   - Gera o c&oacute;digo html para apresenta&ccedil;&atilde;o das op&ccedil;&otilde;es da ferramenta
64   -
65   - Retorno:
66   -
67   - String com o c&oacute;digo html
68   - */
69   - html:function() {
70   - var ins = Mustache.render(i3GEOF.opcoesFundo.MUSTACHE, i3GEOF.opcoesFundo.mustacheHash());
71   - return ins;
72   - },
73   - /*
74   - Function: iniciaJanelaFlutuante
75   -
76   - Cria a janela flutuante para controle da ferramenta.
77   - */
78   - iniciaJanelaFlutuante: function(){
79   - var janela,divid,titulo,cabecalho,minimiza;
80   - if ($i("i3GEOF.opcoesFundo")) {
81   - return;
82   - }
83   - cabecalho = function(){};
84   - minimiza = function(){
85   - i3GEO.janela.minimiza("i3GEOF.opcoesFundo");
86   - };
87   - //cria a janela flutuante
88   - titulo = "<div class='i3GeoTituloJanela'>" + $trad("p9")+"<a class=ajuda_usuario target=_blank href='" + i3GEO.configura.locaplic + "/ajuda_usuario.php?idcategoria=1&idajuda=6' ><b> </b></a></div>";
89   - janela = i3GEO.janela.cria(
90   - "210px",
91   - "80px",
92   - "",
93   - "",
94   - "",
95   - titulo,
96   - "i3GEOF.opcoesFundo",
97   - false,
98   - "hd",
99   - cabecalho,
100   - ""
101   - );
102   - divid = janela[2].id;
103   - $i("i3GEOF.opcoesFundo_corpo").style.backgroundColor = "white";
104   - $i("i3GEOF.opcoesFundo_corpo").style.textAlign = "left";
105   - i3GEOF.opcoesFundo.aguarde = $i("i3GEOF.opcoesFundo_imagemCabecalho").style;
106   - i3GEOF.opcoesFundo.inicia(divid);
107   - },
108   - /*
109   - Function: corj
110   -
111   - Abre a janela para o usu&aacute;rio selecionar uma cor interativamente
112   - */
113   - corj: function(obj)
114   - {i3GEO.util.abreCor("",obj);},
115   - /*
116   - Function: executa
117   -
118   - Aplica a nova cor
119   -
120   - A cor do fundo na interface Openlayers &eacute; definida por meio de estilo, mas &eacute; necess&aacute;rio persistir a cor no mapfile existente no servidor.
121   - */
122   - executa: function(){
123   - if(i3GEOF.opcoesFundo.aguarde.visibility === "visible")
124   - {return;}
125   - i3GEOF.opcoesFundo.aguarde.visibility = "visible";
126   - var temp = function(){
  58 + cp.set_response_type("JSON");
  59 + cp.call(p, "corQM", retorno);
  60 + } catch (erro) {
  61 + i3GEO.janela.tempoMsg(erro);
  62 + }
  63 + if (i3GEO.Interface.ATUAL === "googlemaps" || i3GEO.Interface.ATUAL === "googleearth") {
  64 + i3GEO.janela.tempoMsg($trad('ajuda', i3GEOF.opcoesFundo.dicionario));
  65 + }
  66 + },
  67 + /*
  68 + * Function: html
  69 + *
  70 + * Gera o c&oacute;digo html para apresenta&ccedil;&atilde;o das op&ccedil;&otilde;es da ferramenta
  71 + *
  72 + * Retorno:
  73 + *
  74 + * String com o c&oacute;digo html
  75 + */
  76 + html : function() {
  77 + var ins = Mustache.render(i3GEOF.opcoesFundo.MUSTACHE, i3GEOF.opcoesFundo.mustacheHash());
  78 + return ins;
  79 + },
  80 + /*
  81 + * Function: iniciaJanelaFlutuante
  82 + *
  83 + * Cria a janela flutuante para controle da ferramenta.
  84 + */
  85 + iniciaJanelaFlutuante : function() {
  86 + var janela, divid, titulo, cabecalho, minimiza;
  87 + if ($i("i3GEOF.opcoesFundo")) {
  88 + return;
  89 + }
  90 + cabecalho = function() {
  91 + };
  92 + minimiza = function() {
  93 + i3GEO.janela.minimiza("i3GEOF.opcoesFundo");
  94 + };
  95 + // cria a janela flutuante
  96 + titulo =
  97 + "<div class='i3GeoTituloJanela'>" + $trad("p9")
  98 + + "<a class=ajuda_usuario target=_blank href='"
  99 + + i3GEO.configura.locaplic
  100 + + "/ajuda_usuario.php?idcategoria=1&idajuda=6' ><b> </b></a></div>";
  101 + janela = i3GEO.janela.cria("210px", "80px", "", "", "", titulo, "i3GEOF.opcoesFundo", false, "hd", cabecalho, "");
  102 + divid = janela[2].id;
  103 + $i("i3GEOF.opcoesFundo_corpo").style.backgroundColor = "white";
  104 + $i("i3GEOF.opcoesFundo_corpo").style.textAlign = "left";
  105 + i3GEOF.opcoesFundo.aguarde = $i("i3GEOF.opcoesFundo_imagemCabecalho").style;
  106 + i3GEOF.opcoesFundo.inicia(divid);
  107 + },
  108 + /*
  109 + * Function: corj
  110 + *
  111 + * Abre a janela para o usu&aacute;rio selecionar uma cor interativamente
  112 + */
  113 + corj : function(obj) {
  114 + i3GEO.util.abreCor("", obj);
  115 + },
  116 + /*
  117 + * Function: executa
  118 + *
  119 + * Aplica a nova cor
  120 + *
  121 + * A cor do fundo na interface Openlayers &eacute; definida por meio de estilo, mas &eacute; necess&aacute;rio persistir a cor no
  122 + * mapfile existente no servidor.
  123 + */
  124 + executa : function() {
  125 + if (i3GEOF.opcoesFundo.aguarde.visibility === "visible") {
  126 + return;
  127 + }
  128 + i3GEOF.opcoesFundo.aguarde.visibility = "visible";
  129 + var temp, cor, p, cp;
  130 + temp = function() {
127 131 i3GEOF.opcoesFundo.aguarde.visibility = "hidden";
128   - if(i3GEO.Interface.ATUAL === "openlayers"){
129   - //var layer = i3geoOL.getLayersByName("Nenhum")[0];
130   - //layer.mergeNewParams({"DESLIGACACHE":"sim"});
131   - //layer.mergeNewParams({r:Math.random()});
132   - if($i(i3geoOL.id+"_events")){
133   - $i(i3geoOL.id+"_events").style.backgroundColor = "rgb("+$i("i3GEOopcoesFundocor").value+")";
  132 + if (i3GEO.Interface.ATUAL === "openlayers") {
  133 + if (i3geoOL.id && $i(i3geoOL.id + "_events")) {
  134 + $i(i3geoOL.id + "_events").style.backgroundColor = "rgb(" + $i("i3GEOopcoesFundocor").value + ")";
134 135 }
135   - if ($i(i3geoOL.id + "_OpenLayers_ViewPort")) {
136   - $i(i3geoOL.id + "_OpenLayers_ViewPort").style.backgroundColor = "rgb("+$i("i3GEOopcoesFundocor").value+")";
  136 + if (i3geoOL.id && $i(i3geoOL.id + "_OpenLayers_ViewPort")) {
  137 + $i(i3geoOL.id + "_OpenLayers_ViewPort").style.backgroundColor = "rgb(" + $i("i3GEOopcoesFundocor").value + ")";
137 138 }
138   - //para OL3
139   - if($i("openlayers")){
  139 + // para OL3
  140 + if ($i("openlayers")) {
140 141 $i("openlayers").style.backgroundColor = "rgb(" + $i("i3GEOopcoesFundocor").value + ")";
  142 + i3GEO.parametros.cordefundo = $i("i3GEOopcoesFundocor").value;
141 143 }
142 144 }
143 145 i3GEO.atualiza();
144   - },
145   - cor = $i("i3GEOopcoesFundocor").value,
146   - p = i3GEO.configura.locaplic+"/ferramentas/opcoes_fundo/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=corfundo&cor="+cor,
  146 + };
  147 + cor = $i("i3GEOopcoesFundocor").value;
  148 + p =
  149 + i3GEO.configura.locaplic + "/ferramentas/opcoes_fundo/exec.php?g_sid="
  150 + + i3GEO.configura.sid
  151 + + "&funcao=corfundo&cor="
  152 + + cor;
147 153 cp = new cpaint();
148   - cp.set_response_type("JSON");
149   - cp.call(p,"corQM",temp);
150   - }
151   -};
152 154 \ No newline at end of file
  155 + cp.set_response_type("JSON");
  156 + cp.call(p, "corQM", temp);
  157 + }
  158 + };
153 159 \ No newline at end of file
... ...
ferramentas/selecao/index.js
... ... @@ -34,475 +34,584 @@ Free Software Foundation, Inc., no endere&amp;ccedil;o
34 34 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
35 35 */
36 36  
37   -if(typeof(i3GEOF) === 'undefined'){
  37 +if (typeof (i3GEOF) === 'undefined') {
38 38 var i3GEOF = {};
39 39 }
40 40 /*
41   -Classe: i3GEOF.selecao
  41 + * Classe: i3GEOF.selecao
42 42 */
43   -i3GEOF.selecao = {
44   - tipoSel: "",
  43 +i3GEOF.selecao =
  44 + {
  45 + tipoSel : "",
45 46 /*
46   - Variavel: aguarde
47   -
48   - Estilo do objeto DOM com a imagem de aguarde existente no cabe&ccedil;alho da janela.
  47 + * Variavel: aguarde
  48 + *
  49 + * Estilo do objeto DOM com a imagem de aguarde existente no cabe&ccedil;alho da janela.
49 50 */
50   - aguarde: "",
  51 + aguarde : "",
51 52 /*
52   - Para efeitos de compatibilidade antes da vers&atilde;o 4.7 que n&atilde;o tinha dicion&aacute;rio
  53 + * Para efeitos de compatibilidade antes da vers&atilde;o 4.7 que n&atilde;o tinha dicion&aacute;rio
53 54 */
54   - criaJanelaFlutuante: function(){
  55 + criaJanelaFlutuante : function() {
55 56 i3GEOF.selecao.iniciaDicionario();
56 57 },
57 58 /*
58   - Function: iniciaDicionario
59   -
60   - Carrega o dicion&aacute;rio e chama a fun&ccedil;&atilde;o que inicia a ferramenta
61   -
62   - O Javascript &eacute; carregado com o id i3GEOF.nomedaferramenta.dicionario_script
  59 + * Function: iniciaDicionario
  60 + *
  61 + * Carrega o dicion&aacute;rio e chama a fun&ccedil;&atilde;o que inicia a ferramenta
  62 + *
  63 + * O Javascript &eacute; carregado com o id i3GEOF.nomedaferramenta.dicionario_script
63 64 */
64   - iniciaDicionario: function(){
65   - if(typeof(i3GEOF.selecao.dicionario) === 'undefined'){
  65 + iniciaDicionario : function() {
  66 + if (typeof (i3GEOF.selecao.dicionario) === 'undefined') {
66 67 i3GEO.util.scriptTag(
67   - i3GEO.configura.locaplic+"/ferramentas/selecao/dicionario.js",
68   - "i3GEOF.selecao.iniciaJanelaFlutuante()",
69   - "i3GEOF.selecao.dicionario_script"
70   - );
71   - }
72   - else{
  68 + i3GEO.configura.locaplic + "/ferramentas/selecao/dicionario.js",
  69 + "i3GEOF.selecao.iniciaJanelaFlutuante()",
  70 + "i3GEOF.selecao.dicionario_script");
  71 + } else {
73 72 i3GEOF.selecao.iniciaJanelaFlutuante();
74 73 }
75 74 },
76 75 /*
77   - Function: inicia
78   -
79   - Inicia a ferramenta. &Eacute; chamado por criaJanelaFlutuante
80   -
81   - Parametro:
82   -
83   - iddiv {String} - id do div que receber&aacute; o conteudo HTML da ferramenta
  76 + * Function: inicia
  77 + *
  78 + * Inicia a ferramenta. &Eacute; chamado por criaJanelaFlutuante
  79 + *
  80 + * Parametro:
  81 + *
  82 + * iddiv {String} - id do div que receber&aacute; o conteudo HTML da ferramenta
84 83 */
85   - inicia: function(iddiv){
86   - var b,i,n,ics;
87   - try{
  84 + inicia : function(iddiv) {
  85 + var b, i, n, ics;
  86 + try {
88 87 $i(iddiv).innerHTML += i3GEOF.selecao.html();
89   - i3GEO.guias.mostraGuiaFerramenta("i3GEOselecaoguia1","i3GEOselecaoguia");
90   - //eventos das guias
91   - $i("i3GEOselecaoguia4").onclick = function(){
92   - i3GEO.guias.mostraGuiaFerramenta("i3GEOselecaoguia4","i3GEOselecaoguia");
  88 + i3GEO.guias.mostraGuiaFerramenta("i3GEOselecaoguia1", "i3GEOselecaoguia");
  89 + // eventos das guias
  90 + $i("i3GEOselecaoguia4").onclick = function() {
  91 + i3GEO.guias.mostraGuiaFerramenta("i3GEOselecaoguia4", "i3GEOselecaoguia");
93 92 };
94   - $i("i3GEOselecaoguia1").onclick = function(){
95   - i3GEO.guias.mostraGuiaFerramenta("i3GEOselecaoguia1","i3GEOselecaoguia");
  93 + $i("i3GEOselecaoguia1").onclick = function() {
  94 + i3GEO.guias.mostraGuiaFerramenta("i3GEOselecaoguia1", "i3GEOselecaoguia");
96 95 };
97   - $i("i3GEOselecaoguia2").onclick = function(){
98   - if($i("i3GEOselecaotemasLigados")){
99   - if($i("i3GEOselecaotemasLigados").value === "")
100   - {i3GEO.janela.tempoMsg($trad('selecionaTema',i3GEOF.selecao.dicionario));return;}
  96 + $i("i3GEOselecaoguia2").onclick = function() {
  97 + if ($i("i3GEOselecaotemasLigados")) {
  98 + if ($i("i3GEOselecaotemasLigados").value === "") {
  99 + i3GEO.janela.tempoMsg($trad('selecionaTema', i3GEOF.selecao.dicionario));
  100 + return;
  101 + }
101 102 i3GEO.mapa.ativaTema($i("i3GEOselecaotemasLigados").value);
102   - i3GEO.guias.mostraGuiaFerramenta("i3GEOselecaoguia2","i3GEOselecaoguia");
103   - try
104   - {$i("i3GEOselecaoparametros").innerHTML = "";}
105   - catch(e){}
  103 + i3GEO.guias.mostraGuiaFerramenta("i3GEOselecaoguia2", "i3GEOselecaoguia");
  104 + try {
  105 + $i("i3GEOselecaoparametros").innerHTML = "";
  106 + } catch (e) {
  107 + }
106 108 i3GEOF.selecao.adicionaLinhaFiltro();
107 109 }
108 110 };
109   - $i("i3GEOselecaoguia3").onclick = function(){
110   - i3GEO.guias.mostraGuiaFerramenta("i3GEOselecaoguia3","i3GEOselecaoguia");
111   - i3GEO.util.comboTemas(
112   - "i3GEOselecaoTemaoverlay",
113   - function(retorno){
114   - $i("i3GEOselecaooverlay").innerHTML = retorno.dados;
115   - },
116   - "i3GEOselecaooverlay",
117   - "",
118   - false,
119   - "naolinearSelecionados",
120   - "display:block"
121   - );
  111 + $i("i3GEOselecaoguia3").onclick = function() {
  112 + i3GEO.guias.mostraGuiaFerramenta("i3GEOselecaoguia3", "i3GEOselecaoguia");
  113 + i3GEO.util.comboTemas("i3GEOselecaoTemaoverlay", function(retorno) {
  114 + $i("i3GEOselecaooverlay").innerHTML = retorno.dados;
  115 + }, "i3GEOselecaooverlay", "", false, "naolinearSelecionados", "display:block");
122 116 };
123 117 i3GEOF.selecao.criaCombosTemas();
124 118  
125   - i3GEO.util.mensagemAjuda("i3GEOselecaomen1",$i("i3GEOselecaomen1").innerHTML);
126   - i3GEO.util.mensagemAjuda("i3GEOselecaomen2",$i("i3GEOselecaomen2").innerHTML);
127   - b = new YAHOO.widget.Button(
128   - "i3GEOselecaobotao1",
129   - {onclick:{fn: i3GEOF.selecao.atributo}}
130   - );
  119 + i3GEO.util.mensagemAjuda("i3GEOselecaomen1", $i("i3GEOselecaomen1").innerHTML);
  120 + i3GEO.util.mensagemAjuda("i3GEOselecaomen2", $i("i3GEOselecaomen2").innerHTML);
  121 + b = new YAHOO.widget.Button("i3GEOselecaobotao1", {
  122 + onclick : {
  123 + fn : i3GEOF.selecao.atributo
  124 + }
  125 + });
131 126 b.addClass("rodar");
132   - b = new YAHOO.widget.Button(
133   - "i3GEOselecaobotao2",
134   - {onclick:{fn: i3GEOF.selecao.aplicaselecaoTema}}
135   - );
  127 + b = new YAHOO.widget.Button("i3GEOselecaobotao2", {
  128 + onclick : {
  129 + fn : i3GEOF.selecao.aplicaselecaoTema
  130 + }
  131 + });
136 132 b.addClass("rodar");
137 133  
138   - b = new YAHOO.widget.Button(
139   - "i3GEOFSelecaoQuery",
140   - {onclick:{fn: i3GEO.mapa.dialogo.queryMap}}
141   - );
  134 + b = new YAHOO.widget.Button("i3GEOFSelecaoQuery", {
  135 + onclick : {
  136 + fn : i3GEO.mapa.dialogo.queryMap
  137 + }
  138 + });
142 139 b.addClass("abrir");
143 140  
144 141 i3GEOF.selecao.ativaFoco();
145 142 ics = $i("i3GEOselecaoguia1obj").getElementsByTagName("button");
146 143 n = ics.length;
147   - for(i=0;i<n;i++){
  144 + for (i = 0; i < n; i++) {
148 145 ics[i].style.backgroundColor = "white";
149 146 ics[i].className = "iconeGuiaMovel";
150   - ics[i].onmouseout = function(){this.className = "iconeGuiaMovel iconeGuiaMovelMouseOut";};
151   - ics[i].onmouseover = function(){this.className = "iconeGuiaMovel iconeGuiaMovelMouseOver";};
  147 + ics[i].onmouseout = function() {
  148 + this.className = "iconeGuiaMovel iconeGuiaMovelMouseOut";
  149 + };
  150 + ics[i].onmouseover = function() {
  151 + this.className = "iconeGuiaMovel iconeGuiaMovelMouseOver";
  152 + };
152 153 }
  154 + } catch (erro) {
  155 + i3GEO.janela.tempoMsg(erro);
153 156 }
154   - catch(erro){i3GEO.janela.tempoMsg(erro);}
155 157 },
156 158 /*
157   - Function: html
158   -
159   - Gera o c&oacute;digo html para apresenta&ccedil;&atilde;o das op&ccedil;&otilde;es da ferramenta
160   -
161   - Retorno:
162   -
163   - String com o c&oacute;digo html
  159 + * Function: html
  160 + *
  161 + * Gera o c&oacute;digo html para apresenta&ccedil;&atilde;o das op&ccedil;&otilde;es da ferramenta
  162 + *
  163 + * Retorno:
  164 + *
  165 + * String com o c&oacute;digo html
164 166 */
165   - html:function(){
166   - var ins = '' +
167   - '<div id=i3GEOselecaoguiasYUI class="yui-navset" style="top:0px;cursor:pointer;left:0px;">' +
168   - ' <ul class="yui-nav" style="border-width:0pt 0pt 0px;border-color:rgb(240,240,240);border-bottom-color:white;">' +
169   - ' <li><div id="i3GEOselecaoguia4" style="text-align: center; left: 0px;"><a><em><img class="ticPropriedades2" style="height: 14px" src="' + i3GEO.configura.locaplic + '/imagens/branco.gif"></em></a></div></li>' +
170   - ' <li><a ><em><div id="i3GEOselecaoguia1" style="text-align:center;left:0px;" >'+$trad('mapa',i3GEOF.selecao.dicionario)+'</div></em></a></li>' +
171   - ' <li><a ><em><div id="i3GEOselecaoguia2" style="text-align:center;left:0px;" >'+$trad('atributos',i3GEOF.selecao.dicionario)+'</div></em></a></li>' +
172   - ' <li><a ><em><div id="i3GEOselecaoguia3" style="text-align:center;left:0px;" >'+$trad('cruzamento',i3GEOF.selecao.dicionario)+'</div></em></a></li>' +
173   - ' </ul>' +
174   - '</div><br>' +
175   - '<div class=guiaobj id="i3GEOselecaoguia4obj" style="left:1px;display:none;">' +
176   - ' <p class="paragrafo">' +
177   - ' <input type="checkbox" onclick="" id="i3GEOFselecaoMantemFigura" style="cursor: pointer; border: 0px solid white;" />' +
178   - ' <span style="cursor: pointer; position: relative; top: -2px;">' + $trad('mantemfigura',i3GEOF.selecao.dicionario) + '</span>' +
179   - ' </p>' +
180   - ' <br><p class=paragrafo >'+$trad('distanciaSelecao',i3GEOF.selecao.dicionario) +
181   - ' <div class="styled-select">' +
182   - ' <input type=text id=i3GEOselecaotoleranciapt value=0 /></div>' +
183   - ' <br><p class=paragrafo ><input id=i3GEOFSelecaoQuery type=button value="' + $trad("p8") + '" /></p>' +
184   - ' <br><div id=i3GEOselecaomen1 style=left:0px;width:95%; >' +
185   - ' <p class=paragrafo >'+$trad('ajuda',i3GEOF.selecao.dicionario) +
186   - ' </p></div>' +
187   - '</div>' +
188   - '<div class=guiaobj id="i3GEOselecaoguia1obj" style="left:1px;display:none;top:-5px">' +
189   - ' <p class=paragrafo style=font-size:0px; ><button title="Clique no mapa para selecionar" value="i3GEOselecaopt" onclick="i3GEO.util.animaClique(this);i3GEOF.selecao.tiposel(this)"><img id=i3GEOselecaopt src="'+i3GEO.configura.locaplic+'/imagens/gisicons/select-one.png" /></button>';
190   - if(i3GEO.Interface.ATUAL != "googleearth"){
191   - ins += ' <button title="'+$trad('desenhaPoligono',i3GEOF.selecao.dicionario)+'" onclick="i3GEO.util.animaClique(this);i3GEOF.selecao.tiposel(this)" value="i3GEOselecaopoli"><img id=i3GEOselecaopoli src="'+i3GEO.configura.locaplic+'/imagens/gisicons/select-polygon.png" /></button>';
  167 + html : function() {
  168 + var ins =
  169 + '' + '<div id=i3GEOselecaoguiasYUI class="yui-navset" style="top:0px;cursor:pointer;left:0px;">'
  170 + + ' <ul class="yui-nav" style="border-width:0pt 0pt 0px;border-color:rgb(240,240,240);border-bottom-color:white;">'
  171 + + ' <li><div id="i3GEOselecaoguia4" style="text-align: center; left: 0px;"><a><em><img class="ticPropriedades2" style="height: 14px" src="' + i3GEO.configura.locaplic
  172 + + '/imagens/branco.gif"></em></a></div></li>'
  173 + + ' <li><a ><em><div id="i3GEOselecaoguia1" style="text-align:center;left:0px;" >'
  174 + + $trad('mapa', i3GEOF.selecao.dicionario)
  175 + + '</div></em></a></li>'
  176 + + ' <li><a ><em><div id="i3GEOselecaoguia2" style="text-align:center;left:0px;" >'
  177 + + $trad('atributos', i3GEOF.selecao.dicionario)
  178 + + '</div></em></a></li>'
  179 + + ' <li><a ><em><div id="i3GEOselecaoguia3" style="text-align:center;left:0px;" >'
  180 + + $trad('cruzamento', i3GEOF.selecao.dicionario)
  181 + + '</div></em></a></li>'
  182 + + ' </ul>'
  183 + + '</div><br>'
  184 + + '<div class=guiaobj id="i3GEOselecaoguia4obj" style="left:1px;display:none;">'
  185 + + ' <p class="paragrafo">'
  186 + + ' <input type="checkbox" onclick="" id="i3GEOFselecaoMantemFigura" style="cursor: pointer; border: 0px solid white;" />'
  187 + + ' <span style="cursor: pointer; position: relative; top: -2px;">'
  188 + + $trad('mantemfigura', i3GEOF.selecao.dicionario)
  189 + + '</span>'
  190 + + ' </p>'
  191 + + ' <br><p class=paragrafo >'
  192 + + $trad('distanciaSelecao', i3GEOF.selecao.dicionario)
  193 + + ' <div class="styled-select">'
  194 + + ' <input type=text id=i3GEOselecaotoleranciapt value=0 /></div>'
  195 + + ' <br><p class=paragrafo ><input id=i3GEOFSelecaoQuery type=button value="'
  196 + + $trad("p8")
  197 + + '" /></p>'
  198 + + ' <br><div id=i3GEOselecaomen1 style=left:0px;width:95%; >'
  199 + + ' <p class=paragrafo >'
  200 + + $trad('ajuda', i3GEOF.selecao.dicionario)
  201 + + ' </p></div>'
  202 + + '</div>'
  203 + + '<div class=guiaobj id="i3GEOselecaoguia1obj" style="left:1px;display:none;top:-5px">'
  204 + + ' <p class=paragrafo style=font-size:0px; ><button title="Clique no mapa para selecionar" value="i3GEOselecaopt" onclick="i3GEO.util.animaClique(this);i3GEOF.selecao.tiposel(this)"><img id=i3GEOselecaopt src="'
  205 + + i3GEO.configura.locaplic
  206 + + '/imagens/gisicons/select-one.png" /></button>';
  207 + if (i3GEO.Interface.ATUAL != "googleearth") {
  208 + ins +=
  209 + ' <button title="' + $trad('desenhaPoligono', i3GEOF.selecao.dicionario)
  210 + + '" onclick="i3GEO.util.animaClique(this);i3GEOF.selecao.tiposel(this)" value="i3GEOselecaopoli"><img id=i3GEOselecaopoli src="'
  211 + + i3GEO.configura.locaplic
  212 + + '/imagens/gisicons/select-polygon.png" /></button>';
192 213 }
193   - ins += ' <button title="'+$trad('selecionaVisivel',i3GEOF.selecao.dicionario)+'" onclick="i3GEO.util.animaClique(this);i3GEOF.selecao.tiposel(this)" value="i3GEOselecaoext" ><img id=i3GEOselecaoext src="'+i3GEO.configura.locaplic+'/imagens/gisicons/map.png" /></button>';
194   - ins += ' <button title="'+$trad('utilizaFiguraDesenhada',i3GEOF.selecao.dicionario)+'" onclick="i3GEO.util.animaClique(this);i3GEOF.selecao.tiposel(this)" value="i3GEOselecaofigura"><img id=i3GEOselecaoFigura src="'+i3GEO.configura.locaplic+'/imagens/gisicons/select.png" /></button>';
195   -
196   - if(i3GEO.Interface.ATUAL === "openlayers"){
197   - ins += ' <button title="'+$trad('selecionaRetangulo',i3GEOF.selecao.dicionario)+'" onclick="i3GEO.util.animaClique(this);i3GEOF.selecao.tiposel(this)" value="i3GEOselecaobox" ><img id=i3GEOselecaobox src="'+i3GEO.configura.locaplic+'/imagens/gisicons/select-rectangle.png" /></button>';
  214 + ins +=
  215 + ' <button title="' + $trad('selecionaVisivel', i3GEOF.selecao.dicionario)
  216 + + '" onclick="i3GEO.util.animaClique(this);i3GEOF.selecao.tiposel(this)" value="i3GEOselecaoext" ><img id=i3GEOselecaoext src="'
  217 + + i3GEO.configura.locaplic
  218 + + '/imagens/gisicons/map.png" /></button>';
  219 + ins +=
  220 + ' <button title="' + $trad('utilizaFiguraDesenhada', i3GEOF.selecao.dicionario)
  221 + + '" onclick="i3GEO.util.animaClique(this);i3GEOF.selecao.tiposel(this)" value="i3GEOselecaofigura"><img id=i3GEOselecaoFigura src="'
  222 + + i3GEO.configura.locaplic
  223 + + '/imagens/gisicons/select.png" /></button>';
  224 +
  225 + if (i3GEO.Interface.ATUAL === "openlayers") {
  226 + ins +=
  227 + ' <button title="' + $trad('selecionaRetangulo', i3GEOF.selecao.dicionario)
  228 + + '" onclick="i3GEO.util.animaClique(this);i3GEOF.selecao.tiposel(this)" value="i3GEOselecaobox" ><img id=i3GEOselecaobox src="'
  229 + + i3GEO.configura.locaplic
  230 + + '/imagens/gisicons/select-rectangle.png" /></button>';
198 231 }
199   - ins += ' <button title="'+$trad('inverteSelecao',i3GEOF.selecao.dicionario)+'" onclick="i3GEO.util.animaClique(this);i3GEOF.selecao.operacao(\'inverte\')"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/selection-invert.png" /></button>' +
200   - ' <button title="'+$trad('limpaSelecao',i3GEOF.selecao.dicionario)+'" onclick="i3GEO.util.animaClique(this);i3GEOF.selecao.operacao(\'limpa\')"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/selected-delete.png" /></button>' +
201   - ' <button title="'+$trad('salvaSelecao',i3GEOF.selecao.dicionario)+'" onclick="i3GEO.util.animaClique(this);i3GEOF.selecao.criatema()"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/save1.png" /></button>' +
202   - ' <button title="'+$trad('grafico',i3GEOF.selecao.dicionario)+'" onclick="i3GEO.util.animaClique(this);i3GEOF.selecao.grafico()"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/layer-vector-chart-add.png" /></button>' +
203   - ' <button title="'+$trad('perfil',i3GEOF.selecao.dicionario)+'" onclick="i3GEO.util.animaClique(this);i3GEOF.selecao.graficoPerfil()"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/grafico-perfil.png" /></button>' +
204   - ' <button title="'+$trad('editor',i3GEOF.selecao.dicionario)+'" onclick="i3GEO.util.animaClique(this);i3GEO.barraDeBotoes.editor.inicia()"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/edit.png" /></button>' +
205   - ' <div style=margin-left:8px;text-align:left; >' +
206   - ' <div class="styled-select">' +
207   - ' <select title="'+$trad('tipoOperacao',i3GEOF.selecao.dicionario)+'" id=i3GEOselecaotipoOperacao >' +
208   - ' <option value="adiciona" >'+$trad('adicionaASelecao',i3GEOF.selecao.dicionario)+'</option>' +
209   - ' <option value="novo" >'+$trad('novaSelecao',i3GEOF.selecao.dicionario)+'</option>' +
210   - ' <option value="retira" >'+$trad('retiraDaSelecao',i3GEOF.selecao.dicionario)+'</option>' +
211   - ' </select></div>' +
212   - ' <span id=i3GEOselecaoNsel class=paragrafo >0</span>' +
213   - ' <br><p class=paragrafo >'+$trad('temas',i3GEOF.selecao.dicionario)+'<div id=i3GEOselecaoComboTemas style=text-align:left; ></div>' +
214   - ' </div> '+
215   - ' </div>' +
216   - '</div>' +
217   - '<div class=guiaobj id="i3GEOselecaoguia2obj" style="left:1px;display:none;">' +
218   - ' <p class=paragrafo ><input id=i3GEOselecaobotao1 size=18 type="button" value="'+$trad('seleciona',i3GEOF.selecao.dicionario)+'" /></p>'+
219   - ' <table summary="" id="i3GEOselecaoparametros" style="width:380px" >'+
220   - ' <tbody><tr><td></td><td></td>'+
221   - ' <td style=background-color:yellow >'+$trad('item',i3GEOF.selecao.dicionario)+'</td>'+
222   - ' <td style=background-color:yellow >'+$trad('operador',i3GEOF.selecao.dicionario)+'</td>'+
223   - ' <td style=background-color:yellow >'+$trad('valor',i3GEOF.selecao.dicionario)+'</td>'+
224   - ' <td style=background-color:yellow ></td>'+
225   - ' <td style=background-color:yellow >'+$trad('conector',i3GEOF.selecao.dicionario)+'</td>'+
226   - ' </tr>'+
227   - ' <tr><td>&nbsp;</td><td></td><td></td><td></td><td></td><td></td></tr></tbody>'+
228   - ' </table>'+
229   - ' <div id=i3GEOselecaoresultado style="position:relative;top:5px;left:0px">'+
230   - ' </div>'+
231   - ' <div id=i3GEOselecaovalores style="position:relative;top:5px;left:0px">'+
232   - ' </div>'+
233   - ' <div id=i3GEOselecaomen2 style=top:15px;left:0px; ><p class=paragrafo >'+$trad('separaComVirgula',i3GEOF.selecao.dicionario)+'</div>'+
234   - '</div> '+
235   - '<div class=guiaobj id="i3GEOselecaoguia3obj" style="left:1px;display:none;">' +
236   - ' <p class=paragrafo >'+$trad('temaSelecaoMapa',i3GEOF.selecao.dicionario)+'</p>'+
237   - ' <div id="i3GEOselecaooverlay" class="styled-select" >' +
238   - ' </div>' +
239   - ' <br><p class=paragrafo ><input id=i3GEOselecaobotao2 size=10 type=button value="'+$trad('aplica',i3GEOF.selecao.dicionario)+'">' +
240   - '</div>';
  232 + ins +=
  233 + ' <button title="' + $trad('inverteSelecao', i3GEOF.selecao.dicionario)
  234 + + '" onclick="i3GEO.util.animaClique(this);i3GEOF.selecao.operacao(\'inverte\')"><img src="'
  235 + + i3GEO.configura.locaplic
  236 + + '/imagens/gisicons/selection-invert.png" /></button>'
  237 + + ' <button title="'
  238 + + $trad('limpaSelecao', i3GEOF.selecao.dicionario)
  239 + + '" onclick="i3GEO.util.animaClique(this);i3GEOF.selecao.operacao(\'limpa\')"><img src="'
  240 + + i3GEO.configura.locaplic
  241 + + '/imagens/gisicons/selected-delete.png" /></button>'
  242 + + ' <button title="'
  243 + + $trad('salvaSelecao', i3GEOF.selecao.dicionario)
  244 + + '" onclick="i3GEO.util.animaClique(this);i3GEOF.selecao.criatema()"><img src="'
  245 + + i3GEO.configura.locaplic
  246 + + '/imagens/gisicons/save1.png" /></button>'
  247 + + ' <button title="'
  248 + + $trad('grafico', i3GEOF.selecao.dicionario)
  249 + + '" onclick="i3GEO.util.animaClique(this);i3GEOF.selecao.grafico()"><img src="'
  250 + + i3GEO.configura.locaplic
  251 + + '/imagens/gisicons/layer-vector-chart-add.png" /></button>'
  252 + + ' <button title="'
  253 + + $trad('perfil', i3GEOF.selecao.dicionario)
  254 + + '" onclick="i3GEO.util.animaClique(this);i3GEOF.selecao.graficoPerfil()"><img src="'
  255 + + i3GEO.configura.locaplic
  256 + + '/imagens/gisicons/grafico-perfil.png" /></button>'
  257 + + ' <button title="'
  258 + + $trad('editor', i3GEOF.selecao.dicionario)
  259 + + '" onclick="i3GEO.util.animaClique(this);i3GEO.barraDeBotoes.editor.inicia()"><img src="'
  260 + + i3GEO.configura.locaplic
  261 + + '/imagens/gisicons/edit.png" /></button>'
  262 + + ' <div style=margin-left:8px;text-align:left; >'
  263 + + ' <div class="styled-select">'
  264 + + ' <select title="'
  265 + + $trad('tipoOperacao', i3GEOF.selecao.dicionario)
  266 + + '" id=i3GEOselecaotipoOperacao >'
  267 + + ' <option value="adiciona" >'
  268 + + $trad('adicionaASelecao', i3GEOF.selecao.dicionario)
  269 + + '</option>'
  270 + + ' <option value="novo" >'
  271 + + $trad('novaSelecao', i3GEOF.selecao.dicionario)
  272 + + '</option>'
  273 + + ' <option value="retira" >'
  274 + + $trad('retiraDaSelecao', i3GEOF.selecao.dicionario)
  275 + + '</option>'
  276 + + ' </select></div>'
  277 + + ' <span id=i3GEOselecaoNsel class=paragrafo >0</span>'
  278 + + ' <br><p class=paragrafo >'
  279 + + $trad('temas', i3GEOF.selecao.dicionario)
  280 + + '<div id=i3GEOselecaoComboTemas style=text-align:left; ></div>'
  281 + + ' </div> '
  282 + + ' </div>'
  283 + + '</div>'
  284 + + '<div class=guiaobj id="i3GEOselecaoguia2obj" style="left:1px;display:none;">'
  285 + + ' <p class=paragrafo ><input id=i3GEOselecaobotao1 size=18 type="button" value="'
  286 + + $trad('seleciona', i3GEOF.selecao.dicionario)
  287 + + '" /></p>'
  288 + + ' <table summary="" id="i3GEOselecaoparametros" style="width:380px" >'
  289 + + ' <tbody><tr><td></td><td></td>'
  290 + + ' <td style=background-color:yellow >'
  291 + + $trad('item', i3GEOF.selecao.dicionario)
  292 + + '</td>'
  293 + + ' <td style=background-color:yellow >'
  294 + + $trad('operador', i3GEOF.selecao.dicionario)
  295 + + '</td>'
  296 + + ' <td style=background-color:yellow >'
  297 + + $trad('valor', i3GEOF.selecao.dicionario)
  298 + + '</td>'
  299 + + ' <td style=background-color:yellow ></td>'
  300 + + ' <td style=background-color:yellow >'
  301 + + $trad('conector', i3GEOF.selecao.dicionario)
  302 + + '</td>'
  303 + + ' </tr>'
  304 + + ' <tr><td>&nbsp;</td><td></td><td></td><td></td><td></td><td></td></tr></tbody>'
  305 + + ' </table>'
  306 + + ' <div id=i3GEOselecaoresultado style="position:relative;top:5px;left:0px">'
  307 + + ' </div>'
  308 + + ' <div id=i3GEOselecaovalores style="position:relative;top:5px;left:0px">'
  309 + + ' </div>'
  310 + + ' <div id=i3GEOselecaomen2 style=top:15px;left:0px; ><p class=paragrafo >'
  311 + + $trad('separaComVirgula', i3GEOF.selecao.dicionario)
  312 + + '</div>'
  313 + + '</div> '
  314 + + '<div class=guiaobj id="i3GEOselecaoguia3obj" style="left:1px;display:none;">'
  315 + + ' <p class=paragrafo >'
  316 + + $trad('temaSelecaoMapa', i3GEOF.selecao.dicionario)
  317 + + '</p>'
  318 + + ' <div id="i3GEOselecaooverlay" class="styled-select" >'
  319 + + ' </div>'
  320 + + ' <br><p class=paragrafo ><input id=i3GEOselecaobotao2 size=10 type=button value="'
  321 + + $trad('aplica', i3GEOF.selecao.dicionario)
  322 + + '">'
  323 + + '</div>';
241 324 return ins;
242 325 },
243 326 /*
244   - Function: iniciaJanelaFlutuante
245   -
246   - Cria a janela flutuante para controle da ferramenta.
  327 + * Function: iniciaJanelaFlutuante
  328 + *
  329 + * Cria a janela flutuante para controle da ferramenta.
247 330 */
248   - iniciaJanelaFlutuante: function(){
249   - var minimiza,cabecalho,janela,divid,temp,titulo;
250   - if($i("i3GEOF.selecao")){
  331 + iniciaJanelaFlutuante : function() {
  332 + var minimiza, cabecalho, janela, divid, temp, titulo;
  333 + if ($i("i3GEOF.selecao")) {
251 334 return;
252 335 }
253   - //cria a janela flutuante
254   - cabecalho = function(){
  336 + // cria a janela flutuante
  337 + cabecalho = function() {
255 338 i3GEOF.selecao.ativaFoco();
256 339 };
257   - minimiza = function(){
258   - var t = i3GEO.janela.minimiza("i3GEOF.selecao","100px");
259   - if(t === "min"){
  340 + minimiza = function() {
  341 + var t = i3GEO.janela.minimiza("i3GEOF.selecao", "100px");
  342 + if (t === "min") {
260 343 $i("i3GEOFSelecaoCabecalhoI").style.display = "none";
261 344 } else {
262 345 $i("i3GEOFSelecaoCabecalhoI").style.display = "block";
263 346 }
264 347 };
265 348 titulo =
266   - "<span class='i3GEOiconeFerramenta i3GEOiconeSelecao' title='"+$trad("x51")+"'></span>"
267   - + "<div id='i3GEOFSelecaoCabecalhoI' style='left:10px;'>"
268   - + "<div class='i3GeoTituloJanela'>" + $trad("x51")
269   - + "<a class=ajuda_usuario target=_blank href='" + i3GEO.configura.locaplic
270   - + "/ajuda_usuario.php?idcategoria=5&idajuda=48a' ><b> </b></a></div></div></div>";
271   - janela = i3GEO.janela.cria(
272   - "510px",
273   - "210px",
274   - "",
275   - "",
276   - "",
277   - titulo,
278   - "i3GEOF.selecao",
279   - false,
280   - "hd",
281   - cabecalho,
282   - minimiza
283   - );
  349 + "<span class='i3GEOiconeFerramenta i3GEOiconeSelecao' title='" + $trad("x51")
  350 + + "'></span>"
  351 + + "<div id='i3GEOFSelecaoCabecalhoI' style='left:10px;'>"
  352 + + "<div class='i3GeoTituloJanela'>"
  353 + + $trad("x51")
  354 + + "<a class=ajuda_usuario target=_blank href='"
  355 + + i3GEO.configura.locaplic
  356 + + "/ajuda_usuario.php?idcategoria=5&idajuda=48a' ><b> </b></a></div></div></div>";
  357 + janela = i3GEO.janela.cria("510px", "210px", "", "", "", titulo, "i3GEOF.selecao", false, "hd", cabecalho, minimiza);
284 358 divid = janela[2].id;
285 359 i3GEOF.selecao.aguarde = $i("i3GEOF.selecao_imagemCabecalho").style;
286 360 $i("i3GEOF.selecao_corpo").style.backgroundColor = "white";
287 361 i3GEOF.selecao.inicia(divid);
288   - i3GEO.eventos.adicionaEventos("ATUALIZAARVORECAMADAS",["i3GEOF.selecao.criaCombosTemas()"]);
  362 + i3GEO.eventos.adicionaEventos("ATUALIZAARVORECAMADAS", [
  363 + "i3GEOF.selecao.criaCombosTemas()"
  364 + ]);
289 365 i3GEO.eventos.cliquePerm.desativa();
290 366  
291   - temp = function(){
  367 + temp = function() {
  368 + var api;
292 369 i3GEO.eventos.cliquePerm.ativa();
293   - i3GEO.eventos.removeEventos("ATUALIZAARVORECAMADAS",["i3GEOF.selecao.criaCombosTemas()"]);
  370 + i3GEO.eventos.removeEventos("ATUALIZAARVORECAMADAS", [
  371 + "i3GEOF.selecao.criaCombosTemas()"
  372 + ]);
294 373 i3GEO.barraDeBotoes.ativaPadrao();
295   - i3GEOF.selecao.removeFiguras[i3GEO.Interface["ATUAL"]]();
  374 + if(i3GEO.Interface["ATUAL"] === "openlayers"){
  375 + if (typeof OpenLayers == "undefined") {
  376 + api = "ol3";
  377 + i3GEO.Interface.openlayers.interacoes[0].setActive(true);//duplo clique
  378 + } else {
  379 + api = "openlayers";
  380 + }
  381 + }
  382 + else{
  383 + api = i3GEO.Interface["ATUAL"];
  384 + }
  385 + i3GEOF.selecao.removeFiguras[api]();
296 386 };
297 387 YAHOO.util.Event.addListener(janela[0].close, "click", temp);
298   - i3GEO.util.mudaCursor(i3GEO.configura.cursores,"crosshair",i3GEO.Interface.IDMAPA,i3GEO.configura.locaplic);
  388 + i3GEO.util.mudaCursor(i3GEO.configura.cursores, "crosshair", i3GEO.Interface.IDMAPA, i3GEO.configura.locaplic);
299 389 },
300 390 /*
301   - Function: ativaFoco
302   -
303   - Refaz a interface da ferramenta quando a janela flutuante tem seu foco ativado
  391 + * Function: ativaFoco
  392 + *
  393 + * Refaz a interface da ferramenta quando a janela flutuante tem seu foco ativado
304 394 */
305   - ativaFoco: function(){
  395 + ativaFoco : function() {
306 396 i3GEO.eventos.cliquePerm.desativa();
307   - i3GEO.util.mudaCursor(i3GEO.configura.cursores,"crosshair",i3GEO.Interface.IDMAPA,i3GEO.configura.locaplic);
  397 + i3GEO.util.mudaCursor(i3GEO.configura.cursores, "crosshair", i3GEO.Interface.IDMAPA, i3GEO.configura.locaplic);
308 398 i3GEO.barraDeBotoes.ativaIcone("selecao");
309 399 i3GEOF.selecao.pegaTemasSel();
310 400 i3GEOF.selecao.mudaicone();
311 401 var i = $i("i3GEOF.selecao_c").style;
312 402 i3GEO.janela.ULTIMOZINDEX++;
313 403 i.zIndex = 21000 + i3GEO.janela.ULTIMOZINDEX;
314   - if(i3GEO.Interface.ATUAL != "openlayers"){
  404 + if (i3GEO.Interface.ATUAL != "openlayers") {
315 405 i3GEO.Interface[i3GEO.Interface.ATUAL].recalcPar();
316 406 }
317 407 },
318 408 /*
319   - Function: criaCombosTemas
320   -
321   - Cria os combos de sele&ccedil;&atilde;o de temas
  409 + * Function: criaCombosTemas
  410 + *
  411 + * Cria os combos de sele&ccedil;&atilde;o de temas
322 412 */
323   - criaCombosTemas: function(){
324   - i3GEO.util.comboTemas(
325   - "i3GEOselecaotemasLigados",
326   - function(retorno){
327   - var nsel,temp;
328   - temp = $i("i3GEOselecaoComboTemas");
329   - if(!temp){return;}
330   - temp.innerHTML = retorno.dados;
331   - if($i("i3GEOselecaotemasLigados")){
332   - $i("i3GEOselecaotemasLigados").value = i3GEO.temaAtivo;
333   - //verifica qts elementos selecionados
334   - if(i3GEO.temaAtivo != ""){
335   - nsel = i3GEO.arvoreDeCamadas.pegaTema(i3GEO.temaAtivo);
336   - $i("i3GEOselecaoNsel").innerHTML = $trad('selecionados',i3GEOF.selecao.dicionario)+": "+(nsel.nsel) + "<br>";
337   - }
338   - $i("i3GEOselecaotemasLigados").onchange = function(){i3GEOF.selecao.pegaTemasSel();};
339   - }
340   - },
341   - "i3GEOselecaoComboTemas",
342   - "",
343   - true,
344   - "ligados",
345   - "width:440px;font-size:12px"
346   - );
  413 + criaCombosTemas : function() {
  414 + i3GEO.util.comboTemas("i3GEOselecaotemasLigados", function(retorno) {
  415 + var nsel, temp;
  416 + temp = $i("i3GEOselecaoComboTemas");
  417 + if (!temp) {
  418 + return;
  419 + }
  420 + temp.innerHTML = retorno.dados;
  421 + if ($i("i3GEOselecaotemasLigados")) {
  422 + $i("i3GEOselecaotemasLigados").value = i3GEO.temaAtivo;
  423 + // verifica qts elementos selecionados
  424 + if (i3GEO.temaAtivo != "") {
  425 + nsel = i3GEO.arvoreDeCamadas.pegaTema(i3GEO.temaAtivo);
  426 + $i("i3GEOselecaoNsel").innerHTML = $trad('selecionados', i3GEOF.selecao.dicionario) + ": " + (nsel.nsel) + "<br>";
  427 + }
  428 + $i("i3GEOselecaotemasLigados").onchange = function() {
  429 + i3GEOF.selecao.pegaTemasSel();
  430 + };
  431 + }
  432 + }, "i3GEOselecaoComboTemas", "", true, "ligados", "width:440px;font-size:12px");
347 433 },
348 434 /*
349   - Function: mudaicone
350   -
351   - Altera as bordas dos &iacute;cones
  435 + * Function: mudaicone
  436 + *
  437 + * Altera as bordas dos &iacute;cones
352 438 */
353   - mudaicone: function(){
  439 + mudaicone : function() {
354 440 $i("i3GEOselecaopt").parentNode.style.backgroundColor = "#F5F5F5";
355 441 $i("i3GEOselecaoext").parentNode.style.backgroundColor = "#F5F5F5";
356   - if($i("i3GEOselecaobox")){
  442 + if ($i("i3GEOselecaobox")) {
357 443 $i("i3GEOselecaobox").parentNode.style.backgroundColor = "#F5F5F5";
358 444 }
359   - if($i("i3GEOselecaopoli")){
  445 + if ($i("i3GEOselecaopoli")) {
360 446 $i("i3GEOselecaopoli").parentNode.style.backgroundColor = "#F5F5F5";
361 447 }
362   - if($i("i3GEOselecaoFigura")){
  448 + if ($i("i3GEOselecaoFigura")) {
363 449 $i("i3GEOselecaoFigura").parentNode.style.backgroundColor = "#F5F5F5";
364 450 }
365 451 },
366 452 /*
367   - Function: pegaTemasSel
368   -
369   - Pega a lista de temas escolhidos pelo usu&aacute;rio
  453 + * Function: pegaTemasSel
  454 + *
  455 + * Pega a lista de temas escolhidos pelo usu&aacute;rio
370 456 */
371   - pegaTemasSel: function(){
372   - var selObj = $i("i3GEOselecaotemasLigados"),
373   - selectedArray = [],
374   - i,
375   - nsel;
376   - if(selObj){
377   - for (i=0; i<selObj.options.length; i++) {
  457 + pegaTemasSel : function() {
  458 + var selObj = $i("i3GEOselecaotemasLigados"), selectedArray = [], i, nsel;
  459 + if (selObj) {
  460 + for (i = 0; i < selObj.options.length; i++) {
378 461 if (selObj.options[i].selected) {
379 462 selectedArray.push(selObj.options[i].value);
380 463 }
381 464 }
382 465 i3GEO.mapa.ativaTema(selectedArray[0]);
383   - if(i3GEO.temaAtivo != ""){
  466 + if (i3GEO.temaAtivo != "") {
384 467 nsel = i3GEO.arvoreDeCamadas.pegaTema(i3GEO.temaAtivo);
385   - $i("i3GEOselecaoNsel").innerHTML = $trad('selecionados',i3GEOF.selecao.dicionario)+": "+(nsel.nsel) + "<br>";
  468 + $i("i3GEOselecaoNsel").innerHTML = $trad('selecionados', i3GEOF.selecao.dicionario) + ": " + (nsel.nsel) + "<br>";
386 469 }
387 470 }
388 471 return selectedArray.toString();
389 472 },
390 473 /*
391   - Function: fimSelecao
392   -
393   - Funcoes executadas quando uma operacao de selecao e concluida
394   -
395   - */
396   - fimSelecao: function(retorno){
397   - var nsel,
398   - tema = i3GEO.temaAtivo;
  474 + * Function: fimSelecao
  475 + *
  476 + * Funcoes executadas quando uma operacao de selecao e concluida
  477 + *
  478 + */
  479 + fimSelecao : function(retorno) {
  480 + var nsel, tema = i3GEO.temaAtivo;
399 481 i3GEOF.selecao.aguarde.visibility = "hidden";
400 482 i3GEO.janela.fechaAguarde("i3GEO.atualiza");
401   - i3GEO.Interface.atualizaTema(retorno,tema);
402   - nsel = i3GEO.arvoreDeCamadas.pegaTema(tema,retorno.data.temas);
403   - $i("i3GEOselecaoNsel").innerHTML = $trad('selecionados',i3GEOF.selecao.dicionario)+": "+(nsel.nsel);
404   - i3GEO.eventos.adicionaEventos("SELECAO",["i3GEOF.tabela.atualizaListaDeRegistros()"]);
  483 + i3GEO.Interface.atualizaTema(retorno, tema);
  484 + nsel = i3GEO.arvoreDeCamadas.pegaTema(tema, retorno.data.temas);
  485 + $i("i3GEOselecaoNsel").innerHTML = $trad('selecionados', i3GEOF.selecao.dicionario) + ": " + (nsel.nsel);
  486 + i3GEO.eventos.adicionaEventos("SELECAO", [
  487 + "i3GEOF.tabela.atualizaListaDeRegistros()"
  488 + ]);
405 489 i3GEO.eventos.executaEventos(i3GEO.eventos.SELECAO);
406 490 },
407 491 /*
408   - Function: operacao
409   -
410   - Executa uma opera&ccedil;&atilde;o sobre o conjunto de elementos selecionados
411   -
412   - Veja:
413   -
414   - <i3GEO.php.selecaopt>
415   -
416   - Parametro:
417   -
418   - tipo {String} - tipo de opera&ccedil;&atilde;o inverte|limpa
  492 + * Function: operacao
  493 + *
  494 + * Executa uma opera&ccedil;&atilde;o sobre o conjunto de elementos selecionados
  495 + *
  496 + * Veja:
  497 + *
  498 + * <i3GEO.php.selecaopt>
  499 + *
  500 + * Parametro:
  501 + *
  502 + * tipo {String} - tipo de opera&ccedil;&atilde;o inverte|limpa
419 503 */
420   - operacao: function(tipo){
421   - if(i3GEOF.selecao.aguarde.visibility === "visible"){
  504 + operacao : function(tipo) {
  505 + if (i3GEOF.selecao.aguarde.visibility === "visible") {
422 506 return;
423 507 }
424   - try{
425   - if($i("i3GEOselecaotemasLigados").value === ""){
  508 + try {
  509 + if ($i("i3GEOselecaotemasLigados").value === "") {
426 510 i3GEO.janela.tempoMsg("Escolha um tema");
427 511 return;
428 512 }
429 513 i3GEOF.selecao.aguarde.visibility = "visible";
430 514 i3GEO.mapa.ativaTema($i("i3GEOselecaotemasLigados").value);
431   - var tema = i3GEO.temaAtivo,
432   - fim = function(retorno){
  515 + var tema = i3GEO.temaAtivo, fim = function(retorno) {
433 516 i3GEOF.selecao.fimSelecao(retorno);
434 517 };
435   - i3GEO.php.selecaopt(fim,tema,"",tipo,0);
  518 + i3GEO.php.selecaopt(fim, tema, "", tipo, 0);
  519 + } catch (e) {
  520 + i3GEO.janela.tempoMsg("Erro: " + e);
  521 + i3GEOF.selecao.aguarde.visibility = "hidden";
436 522 }
437   - catch(e){i3GEO.janela.tempoMsg("Erro: "+e);i3GEOF.selecao.aguarde.visibility = "hidden";}
438 523 },
439 524 /*
440   - Function: tiposel
441   -
442   - Executa um tipo de sele&ccedil;&atilde;o interativa
443   -
444   - Parameter:
445   -
446   - obj {objeto dom) - objeto que foi clicado para disparar a opera&ccedil;&atilde;o. O valor identifica o tipo de opera&ccedil;&atilde;o
  525 + * Function: tiposel
  526 + *
  527 + * Executa um tipo de sele&ccedil;&atilde;o interativa
  528 + *
  529 + * Parameter:
  530 + *
  531 + * obj {objeto dom) - objeto que foi clicado para disparar a opera&ccedil;&atilde;o. O valor identifica o tipo de
  532 + * opera&ccedil;&atilde;o
447 533 */
448   - tiposel: function(obj){
449   - if(i3GEOF.selecao.aguarde.visibility === "visible"){
  534 + tiposel : function(obj) {
  535 + if (i3GEOF.selecao.aguarde.visibility === "visible") {
450 536 return;
451 537 }
452   - try{
453   - if($i("i3GEOselecaotemasLigados").value === ""){
  538 + // try {
  539 + if ($i("i3GEOselecaotemasLigados").value === "") {
454 540 i3GEO.janela.tempoMsg("Escolha um tema");
455 541 return;
456 542 }
457   - var fim = function(retorno){
  543 + var api, fim = function(retorno) {
458 544 i3GEOF.selecao.fimSelecao(retorno);
459   - },
460   - tema = i3GEOF.selecao.pegaTemasSel();
461   - if (obj.value == "i3GEOselecaoext"){
  545 + }, tema = i3GEOF.selecao.pegaTemasSel();
  546 + if (i3GEO.Interface["ATUAL"] === "openlayers") {
  547 + if (typeof OpenLayers == "undefined") {
  548 + api = "ol3";
  549 + } else {
  550 + api = "openlayers";
  551 + }
  552 + } else {
  553 + api = i3GEO.Interface["ATUAL"];
  554 + }
  555 + if (obj.value == "i3GEOselecaoext") {
462 556 i3GEOF.selecao.tipoSel = obj.value;
463 557 i3GEOF.selecao.aguarde.visibility = "visible";
464   - i3GEO.php.selecaobox(fim,tema,$i("i3GEOselecaotipoOperacao").value,i3GEO.parametros.mapexten);
  558 + i3GEO.php.selecaobox(fim, tema, $i("i3GEOselecaotipoOperacao").value, i3GEO.parametros.mapexten);
465 559 }
466   - if (obj.value == "i3GEOselecaobox"){
  560 + if (obj.value == "i3GEOselecaobox") {
467 561 i3GEOF.selecao.tipoSel = obj.value;
468 562 i3GEOF.selecao.mudaicone();
469 563 obj.style.backgroundColor = "#cedff2";
470 564 i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia();
471   - i3GEOF.selecao.box[i3GEO.Interface["ATUAL"]].inicia();
  565 + i3GEOF.selecao.box[api].inicia();
472 566 }
473   - if (obj.value == "i3GEOselecaopt"){
  567 + if (obj.value == "i3GEOselecaopt") {
474 568 i3GEOF.selecao.tipoSel = obj.value;
475 569 i3GEOF.selecao.mudaicone();
476 570 obj.style.backgroundColor = "#cedff2";
477 571 i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia();
478   - i3GEOF.selecao.clique[i3GEO.Interface["ATUAL"]].inicia();
  572 + i3GEOF.selecao.clique[api].inicia();
479 573 }
480   - if (obj.value == "i3GEOselecaopoli"){
  574 + if (obj.value == "i3GEOselecaopoli") {
481 575 i3GEOF.selecao.tipoSel = obj.value;
482 576 i3GEOF.selecao.mudaicone();
483 577 obj.style.backgroundColor = "#cedff2";
484 578 i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia();
485   - i3GEOF.selecao.poligono[i3GEO.Interface["ATUAL"]].inicia();
  579 + i3GEOF.selecao.poligono[api].inicia();
486 580 }
487   - if (obj.value == "i3GEOselecaofigura"){
  581 + if (obj.value == "i3GEOselecaofigura") {
488 582 i3GEOF.selecao.tipoSel = obj.value;
489 583 i3GEOF.selecao.mudaicone();
490 584 obj.style.backgroundColor = "#cedff2";
491 585 i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia();
492   - i3GEOF.selecao.figura[i3GEO.Interface["ATUAL"]].inicia();
  586 + i3GEOF.selecao.figura[api].inicia();
493 587 }
494   - }
495   - catch(e){i3GEO.janela.tempoMsg("Erro: "+e);i3GEOF.selecao.aguarde.visibility = "hidden";}
  588 + // } catch (e) {
  589 + // i3GEO.janela.tempoMsg("Erro: " + e);
  590 + // i3GEOF.selecao.aguarde.visibility = "hidden";
  591 + // }
496 592 },
497 593 /*
498   - Function: removeFiguras
499   - Remove as figuras marcadas como origem igual a i3GEOFselecao
500   - */
501   - removeFiguras:{
502   - openlayers: function(){
503   - if(i3GEO.desenho.layergrafico){
  594 + * Function: removeFiguras Remove as figuras marcadas como origem igual a i3GEOFselecao
  595 + */
  596 + removeFiguras : {
  597 + ol3 : function(){
  598 + var features, n, f, i, remover = [];
  599 + features = i3GEO.desenho.layergrafico.getSource().getFeatures();
  600 + n = features.length;
  601 + for(i = 0; i < n; i++){
  602 + f = features[i];
  603 + if(f.getProperties().origem === "i3GEOFselecao"){
  604 + remover.push(f);
  605 + }
  606 + }
  607 + for(r in remover){
  608 + i3GEO.desenho.layergrafico.getSource().removeFeature(remover[r]);
  609 + }
  610 + },
  611 + openlayers : function() {
  612 + if (i3GEO.desenho.layergrafico) {
504 613 var temp, f = i3GEO.desenho.layergrafico.getFeaturesByAttribute("origem", "i3GEOFselecao");
505   - if(f && f.length > 0){
  614 + if (f && f.length > 0) {
506 615 temp = window.confirm($trad("x94"));
507 616 if (temp) {
508 617 i3GEO.desenho.layergrafico.destroyFeatures(f);
... ... @@ -510,9 +619,9 @@ i3GEOF.selecao = {
510 619 }
511 620 }
512 621 },
513   - googlemaps: function(){
514   - var temp, f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem","i3GEOFselecao");
515   - if(f && f.length > 0){
  622 + googlemaps : function() {
  623 + var temp, f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem", "i3GEOFselecao");
  624 + if (f && f.length > 0) {
516 625 temp = window.confirm($trad("x94"));
517 626 if (temp) {
518 627 i3GEO.desenho.googlemaps.destroyFeatures(f);
... ... @@ -521,378 +630,497 @@ i3GEOF.selecao = {
521 630 }
522 631 },
523 632 /*
524   - Classe: i3GEOF.selecao.box
525   -
526   - Controla o desenho do box para a sele&ccedil;&atilde;o e executa a opera&ccedil;&atilde;o de sele&ccedil;&atilde;o
  633 + * Classe: i3GEOF.selecao.box
  634 + *
  635 + * Controla o desenho do box para a sele&ccedil;&atilde;o e executa a opera&ccedil;&atilde;o de sele&ccedil;&atilde;o
527 636 */
528   - box:{
529   - openlayers: {
530   - inicia: function(){
  637 + box : {
  638 + ol3 : {
  639 + draw : "",
  640 + inicia : function() {
  641 + i3GEO.eventos.cliquePerm.desativa();
  642 + i3GEOF.selecao.box.ol3.removeControle();
  643 + i3GEOF.selecao.box.ol3.draw = new ol.interaction.DragBox({
  644 + //condition: ol.events.condition.shiftKeyOnly,
  645 + style: new ol.style.Style({
  646 + stroke: new ol.style.Stroke({
  647 + color: [0, 0, 255, 1]
  648 + })
  649 + })
  650 + });
  651 + i3GEOF.selecao.box.ol3.draw.on("boxend",function(evt){
  652 + var feature, geo, pol = i3GEOF.selecao.box.ol3.draw.getGeometry();
  653 + if ($i("i3GEOFselecaoMantemFigura").checked === true) {
  654 + feature = new ol.Feature({
  655 + geometry: pol,
  656 + origem: 'i3GEOFselecao'
  657 + });
  658 + //i3GEOF.selecao.box.ol3.draw.feature.setProperties({origem : "i3GEOFselecao"});
  659 + i3GEO.desenho.layergrafico.getSource().addFeature(feature);
  660 + }
  661 + i3GEOF.selecao.box.ol3.removeControle();
  662 + i3GEO.eventos.cliquePerm.ativa();
  663 + pol = i3GEO.util.projOSM2Geo(pol);
  664 + geo = pol.getExtent();
  665 + i3GEOF.selecao.box.termina(
  666 + i3GEO.temaAtivo,
  667 + $i("i3GEOselecaotipoOperacao").value,
  668 + geo.join(" "));
  669 + });
  670 + i3geoOL.addInteraction(i3GEOF.selecao.box.ol3.draw);
  671 + },
  672 + removeControle : function() {
  673 + i3geoOL.removeInteraction(i3GEOF.selecao.box.ol3.draw);
  674 + i3GEOF.selecao.box.ol3.draw = "";
  675 + }
  676 + },
  677 + openlayers : {
  678 + inicia : function() {
531 679 i3GEO.eventos.cliquePerm.desativa();
532 680 i3GEOF.selecao.box.openlayers.removeControle();
533   - var box = new OpenLayers.Control.DrawFeature(
534   - i3GEO.desenho.layergrafico,
535   - OpenLayers.Handler.Box,
536   - {
537   - autoActivate: true,
538   - id: "i3GEOFselecaoBox",
539   - type: OpenLayers.Control.TYPE_TOOL,
540   - callbacks:{
541   - done: function(feature){
542   - i3GEOF.selecao.box.openlayers.removeControle();
543   - var g,f,xminymin = i3geoOL.getLonLatFromPixel({
544   - x: feature.left,
545   - y: feature.bottom
546   - }),
547   - xmaxymax = i3geoOL.getLonLatFromPixel({
548   - x: feature.right,
549   - y: feature.top
  681 + var box =
  682 + new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico, OpenLayers.Handler.Box, {
  683 + autoActivate : true,
  684 + id : "i3GEOFselecaoBox",
  685 + type : OpenLayers.Control.TYPE_TOOL,
  686 + callbacks : {
  687 + done : function(feature) {
  688 + i3GEOF.selecao.box.openlayers.removeControle();
  689 + var g, f, xminymin = i3geoOL.getLonLatFromPixel({
  690 + x : feature.left,
  691 + y : feature.bottom
  692 + }), xmaxymax = i3geoOL.getLonLatFromPixel({
  693 + x : feature.right,
  694 + y : feature.top
  695 + });
  696 + i3GEOF.selecao.box.termina(i3GEO.temaAtivo, $i("i3GEOselecaotipoOperacao").value, xminymin.lon + " "
  697 + + xminymin.lat
  698 + + " "
  699 + + xmaxymax.lon
  700 + + " "
  701 + + xmaxymax.lat);
  702 + if ($i("i3GEOFselecaoMantemFigura").checked === true) {
  703 + g = new OpenLayers.Bounds(xminymin.lon, xminymin.lat, xmaxymax.lon, xmaxymax.lat);
  704 + f = new OpenLayers.Feature.Vector(g.toGeometry(), {
  705 + origem : "i3GEOFselecao"
  706 + }, {
  707 + fillColor : "orange",
  708 + fillOpacity : 0.4,
  709 + strokeColor : "orange",
  710 + strokeOpacity : 1,
  711 + strokeWidth : 2
550 712 });
551   - i3GEOF.selecao.box.termina(
552   - i3GEO.temaAtivo,
553   - $i("i3GEOselecaotipoOperacao").value,
554   - xminymin.lon+" "+xminymin.lat+" "+xmaxymax.lon+" "+xmaxymax.lat
555   - );
556   - if($i("i3GEOFselecaoMantemFigura").checked === true){
557   - g = new OpenLayers.Bounds(xminymin.lon,xminymin.lat,xmaxymax.lon,xmaxymax.lat);
558   - f = new OpenLayers.Feature.Vector(g.toGeometry(), {
559   - origem : "i3GEOFselecao"
560   - }, {
561   - fillColor: "orange",
562   - fillOpacity: 0.4,
563   - strokeColor: "orange",
564   - strokeOpacity: 1,
565   - strokeWidth: 2
566   - });
567 713  
568   - i3GEO.desenho.layergrafico.addFeatures([f]);
569   - if (i3GEO.Interface) {
570   - i3GEO.Interface.openlayers.sobeLayersGraficos();
571   - }
  714 + i3GEO.desenho.layergrafico.addFeatures([
  715 + f
  716 + ]);
  717 + if (i3GEO.Interface) {
  718 + i3GEO.Interface.openlayers.sobeLayersGraficos();
572 719 }
573 720 }
574 721 }
575   - });
  722 + }
  723 + });
576 724 i3geoOL.addControl(box);
577 725 },
578   - removeControle: function(){
579   - var controle = i3geoOL.getControlsBy("id","i3GEOFselecaoBox");
580   - if(controle.length > 0){
  726 + removeControle : function() {
  727 + var controle = i3geoOL.getControlsBy("id", "i3GEOFselecaoBox");
  728 + if (controle.length > 0) {
581 729 controle[0].deactivate();
582 730 i3geoOL.removeControl(controle[0]);
583 731 }
584 732 }
585 733 },
586   - termina: function(tema,tipo,box){
587   - var retorna = function(retorno){
  734 + termina : function(tema, tipo, box) {
  735 + var retorna = function(retorno) {
588 736 i3GEOF.selecao.fimSelecao(retorno);
589 737 };
590   - i3GEO.janela.abreAguarde("i3GEO.atualiza",$trad("o1"));
  738 + i3GEO.janela.abreAguarde("i3GEO.atualiza", $trad("o1"));
591 739 i3GEO.eventos.cliquePerm.ativa();
592   - i3GEO.php.selecaobox(retorna,tema,tipo,box);
  740 + i3GEO.php.selecaobox(retorna, tema, tipo, box);
  741 + i3GEOF.selecao.mudaicone();
593 742 }
594 743 },
595 744 /*
596   - Function: clique
597   -
598   - Seleciona elementos clicando no mapa
  745 + * Function: clique
  746 + *
  747 + * Seleciona elementos clicando no mapa
599 748 */
600   - clique: {
601   - openlayers: {
602   - inicia: function(){
  749 + clique : {
  750 + ol3 : {
  751 + draw : "",
  752 + inicia : function() {
  753 + i3GEO.eventos.cliquePerm.desativa();
  754 + i3GEOF.selecao.clique.ol3.removeControle();
  755 + i3GEOF.selecao.clique.ol3.draw = new ol.interaction.Draw({
  756 + // features : i3GEO.desenho.layergrafico.getFeatures(),
  757 + type : "Point",
  758 + maxPoints : 1
  759 + });
  760 + i3GEOF.selecao.clique.ol3.draw.on("drawend",function(evt){
  761 + var geo, ponto = evt.feature.getGeometry();
  762 + if ($i("i3GEOFselecaoMantemFigura").checked === true) {
  763 + evt.feature.setProperties({origem : "i3GEOFselecao"});
  764 + i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature);
  765 + }
  766 + i3GEOF.selecao.clique.ol3.removeControle();
  767 + i3GEO.eventos.cliquePerm.ativa();
  768 + ponto = i3GEO.util.projOSM2Geo(ponto);
  769 + geo = ponto.getCoordinates();
  770 + i3GEOF.selecao.clique.termina(
  771 + i3GEO.temaAtivo,
  772 + $i("i3GEOselecaotipoOperacao").value,
  773 + $i("i3GEOselecaotoleranciapt").value,
  774 + geo[0],
  775 + geo[1]);
  776 + });
  777 + i3geoOL.addInteraction(i3GEOF.selecao.clique.ol3.draw);
  778 + },
  779 + removeControle : function() {
  780 + i3geoOL.removeInteraction(i3GEOF.selecao.clique.ol3.draw);
  781 + i3GEOF.selecao.clique.ol3.draw = "";
  782 + }
  783 + },
  784 + // versao 2 do openlayers
  785 + openlayers : {
  786 + inicia : function() {
603 787 i3GEO.eventos.cliquePerm.desativa();
604 788 i3GEOF.selecao.clique.openlayers.removeControle();
605   - var ponto = new OpenLayers.Control.DrawFeature(
606   - i3GEO.desenho.layergrafico,
607   - OpenLayers.Handler.Point,
608   - {
609   - autoActivate: true,
610   - id: "i3GEOFselecaoPonto",
611   - type: OpenLayers.Control.TYPE_TOOL,
612   - callbacks:{
613   - done: function(feature){
614   - i3GEOF.selecao.clique.openlayers.removeControle();
615   - feature = i3GEO.util.projOSM2Geo(feature);
616   - i3GEOF.selecao.clique.termina(
617   - i3GEO.temaAtivo,
618   - $i("i3GEOselecaotipoOperacao").value,
619   - $i("i3GEOselecaotoleranciapt").value,
620   - feature.x,
621   - feature.y
622   - );
623   - if($i("i3GEOFselecaoMantemFigura").checked === true){
624   - feature = i3GEO.util.projGeo2OSM(feature);
625   - f = new OpenLayers.Feature.Vector(feature, {
626   - origem : "i3GEOFselecao"
627   - }, {
628   - fillColor: "orange",
629   - fillOpacity: 0.4,
630   - strokeColor: "orange",
631   - strokeOpacity: 1,
632   - strokeWidth: 2,
633   - graphicName : "square",
634   - pointRadius : 6
635   - });
  789 + var ponto =
  790 + new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico, OpenLayers.Handler.Point, {
  791 + autoActivate : true,
  792 + id : "i3GEOFselecaoPonto",
  793 + type : OpenLayers.Control.TYPE_TOOL,
  794 + callbacks : {
  795 + done : function(feature) {
  796 + i3GEOF.selecao.clique.openlayers.removeControle();
  797 + feature = i3GEO.util.projOSM2Geo(feature);
  798 + i3GEOF.selecao.clique.termina(
  799 + i3GEO.temaAtivo,
  800 + $i("i3GEOselecaotipoOperacao").value,
  801 + $i("i3GEOselecaotoleranciapt").value,
  802 + feature.x,
  803 + feature.y);
  804 + if ($i("i3GEOFselecaoMantemFigura").checked === true) {
  805 + feature = i3GEO.util.projGeo2OSM(feature);
  806 + f = new OpenLayers.Feature.Vector(feature, {
  807 + origem : "i3GEOFselecao"
  808 + }, {
  809 + fillColor : "orange",
  810 + fillOpacity : 0.4,
  811 + strokeColor : "orange",
  812 + strokeOpacity : 1,
  813 + strokeWidth : 2,
  814 + graphicName : "square",
  815 + pointRadius : 6
  816 + });
636 817  
637   - i3GEO.desenho.layergrafico.addFeatures([f]);
638   - if (i3GEO.Interface) {
639   - i3GEO.Interface.openlayers.sobeLayersGraficos();
640   - }
  818 + i3GEO.desenho.layergrafico.addFeatures([
  819 + f
  820 + ]);
  821 + if (i3GEO.Interface) {
  822 + i3GEO.Interface.openlayers.sobeLayersGraficos();
641 823 }
642 824 }
643 825 }
644   - });
  826 + }
  827 + });
645 828 i3geoOL.addControl(ponto);
646 829 },
647   - removeControle: function(){
648   - var controle = i3geoOL.getControlsBy("id","i3GEOFselecaoPonto");
649   - if(controle.length > 0){
  830 + removeControle : function() {
  831 + var controle = i3geoOL.getControlsBy("id", "i3GEOFselecaoPonto");
  832 + if (controle.length > 0) {
650 833 controle[0].deactivate();
651 834 i3geoOL.removeControl(controle[0]);
652 835 }
653 836 }
654 837 },
655   - googlemaps: {
656   - inicia: function(){
  838 + googlemaps : {
  839 + inicia : function() {
657 840 var evtclick = null;
658 841 i3GEO.eventos.cliquePerm.desativa();
659   - evtclick = google.maps.event.addListener(i3GeoMap, "click", function(evt) {
660   - if(i3GEOF.selecao.tipoSel === "i3GEOselecaopt"){
661   - i3GEOF.selecao.clique.termina(
  842 + evtclick =
  843 + google.maps.event.addListener(i3GeoMap, "click", function(evt) {
  844 + if (i3GEOF.selecao.tipoSel === "i3GEOselecaopt") {
  845 + i3GEOF.selecao.clique.termina(
662 846 i3GEO.temaAtivo,
663 847 $i("i3GEOselecaotipoOperacao").value,
664 848 $i("i3GEOselecaotoleranciapt").value,
665 849 evt.latLng.lng(),
666   - evt.latLng.lat()
667   - );
668   - if($i("i3GEOFselecaoMantemFigura").checked === true){
669   - i3GEO.desenho.googlemaps.shapes.push(
670   - new google.maps.Marker({
671   - map: i3GeoMap,
672   - fillOpacity: 0,
673   - clickable: false,
674   - position:evt.latLng,
675   - icon: {
676   - path: google.maps.SymbolPath.CIRCLE,
677   - scale: 4,
678   - strokeColor: "orange"
  850 + evt.latLng.lat());
  851 + if ($i("i3GEOFselecaoMantemFigura").checked === true) {
  852 + i3GEO.desenho.googlemaps.shapes.push(new google.maps.Marker({
  853 + map : i3GeoMap,
  854 + fillOpacity : 0,
  855 + clickable : false,
  856 + position : evt.latLng,
  857 + icon : {
  858 + path : google.maps.SymbolPath.CIRCLE,
  859 + scale : 4,
  860 + strokeColor : "orange"
679 861 },
680   - origem: "i3GEOFselecao"
681   - })
682   - );
683   - }
  862 + origem : "i3GEOFselecao"
  863 + }));
  864 + }
684 865  
685   - }
686   - google.maps.event.removeListener(evtclick);
687   - });
  866 + }
  867 + google.maps.event.removeListener(evtclick);
  868 + });
688 869 }
689 870 },
690   - termina: function(tema,tipo,tolerancia,x,y){
691   - if(typeof(console) !== 'undefined'){console.info("i3GEO.selecao.porxy()");}
692   - var retorna = function(retorno){
  871 + termina : function(tema, tipo, tolerancia, x, y) {
  872 + if (typeof (console) !== 'undefined') {
  873 + console.info("i3GEO.selecao.porxy()");
  874 + }
  875 + var retorna = function(retorno) {
693 876 i3GEOF.selecao.fimSelecao(retorno);
694 877 };
695 878 i3GEO.eventos.cliquePerm.ativa();
696   - i3GEO.php.selecaopt(retorna,tema,x+" "+y,tipo,tolerancia);
  879 + i3GEO.php.selecaopt(retorna, tema, x + " " + y, tipo, tolerancia);
  880 + i3GEOF.selecao.mudaicone();
697 881 }
698 882 },
699 883 /*
700   - Function: figura
701   -
702   - Seleciona elementos com base em uma figura existente no mapa
  884 + * Function: figura
  885 + *
  886 + * Seleciona elementos com base em uma figura existente no mapa
703 887 */
704   - figura: {
705   - openlayers: {
706   - executa: function(feature){
  888 + figura : {
  889 + ol3 : {
  890 + draw : "",
  891 + inicia : function() {
  892 + var features = i3GEO.desenho.layergrafico.getFeatures();
  893 + if(features.getLength() === 0){
  894 + return;
  895 + }
  896 + i3GEO.eventos.cliquePerm.desativa();
  897 + i3GEOF.selecao.figura.ol3.removeControle();
  898 + i3GEOF.selecao.figura.ol3.draw = new ol.interaction.Select();
  899 + i3GEOF.selecao.figura.ol3.draw.on("select",function(evt){
  900 + var wkt, geo, i, n, f, format = new ol.format.WKT();
  901 + geo = i3GEOF.selecao.figura.ol3.draw.getFeatures();
  902 + n = geo.getLength();
  903 + for(i=0; i<n; i++){
  904 + f = geo.item(i);
  905 + f = i3GEO.util.projOSM2Geo(f);
  906 + wkt = format.writeFeature(f);
  907 + i3GEOF.selecao.figura.termina(i3GEO.temaAtivo, $i("i3GEOselecaotipoOperacao").value, wkt);
  908 + }
  909 + i3GEO.eventos.cliquePerm.ativa();
  910 + i3GEOF.selecao.figura.ol3.removeControle();
  911 + });
  912 + i3geoOL.addInteraction(i3GEOF.selecao.figura.ol3.draw);
  913 + },
  914 + removeControle : function() {
  915 + i3geoOL.removeInteraction(i3GEOF.selecao.figura.ol3.draw);
  916 + i3GEOF.selecao.figura.ol3.draw = "";
  917 + }
  918 + },
  919 + openlayers : {
  920 + executa : function(feature) {
707 921 i3GEOF.selecao.figura.openlayers.removeControle();
708 922 var wkt = i3GEO.util.projOSM2Geo(feature.geometry);
709   - //var wkt = feature.geometry;
710   - i3GEOF.selecao.figura.termina(
711   - i3GEO.temaAtivo,
712   - $i("i3GEOselecaotipoOperacao").value,
713   - wkt
714   - );
  923 + // var wkt = feature.geometry;
  924 + i3GEOF.selecao.figura.termina(i3GEO.temaAtivo, $i("i3GEOselecaotipoOperacao").value, wkt);
715 925 },
716   - inicia: function(){
717   - var ponto,f;
  926 + inicia : function() {
  927 + var ponto, f;
718 928 i3GEO.eventos.cliquePerm.desativa();
719 929 i3GEOF.selecao.figura.openlayers.removeControle();
720   - //verifica se ja tem uma figura selecionada
  930 + // verifica se ja tem uma figura selecionada
721 931 f = i3GEO.desenho.layergrafico.selectedFeatures;
722   - if(f && f.length > 0){
  932 + if (f && f.length > 0) {
723 933 i3GEOF.selecao.figura.openlayers.executa(f[0]);
724 934 return;
725 935 }
726   - ponto = new OpenLayers.Control.SelectFeature(
727   - i3GEO.desenho.layergrafico,
728   - {
729   - clickout: true,
730   - toggle: true,
731   - multiple: false,
732   - hover: false,
733   - toggleKey: "ctrlKey", // ctrl key removes from selection
734   - box: false,
735   - autoActivate: true,
736   - id: "i3GEOFselecaoFigura",
737   - type: OpenLayers.Control.TYPE_TOOL,
738   - onSelect: function(feature){
739   - i3GEOF.selecao.figura.openlayers.executa(feature);
740   - }
741   - });
  936 + ponto = new OpenLayers.Control.SelectFeature(i3GEO.desenho.layergrafico, {
  937 + clickout : true,
  938 + toggle : true,
  939 + multiple : false,
  940 + hover : false,
  941 + toggleKey : "ctrlKey", // ctrl key removes from selection
  942 + box : false,
  943 + autoActivate : true,
  944 + id : "i3GEOFselecaoFigura",
  945 + type : OpenLayers.Control.TYPE_TOOL,
  946 + onSelect : function(feature) {
  947 + i3GEOF.selecao.figura.openlayers.executa(feature);
  948 + }
  949 + });
742 950 i3geoOL.addControl(ponto);
743 951 },
744   - removeControle: function(){
745   - var controle = i3geoOL.getControlsBy("id","i3GEOFselecaoFigura");
746   - if(controle.length > 0){
  952 + removeControle : function() {
  953 + var controle = i3geoOL.getControlsBy("id", "i3GEOFselecaoFigura");
  954 + if (controle.length > 0) {
747 955 controle[0].deactivate();
748 956 i3geoOL.removeControl(controle[0]);
749 957 }
750 958 }
751 959 },
752   - //FIXME nao funciona no googlemaps
753   - googlemaps: {
754   - inicia: function(){
755   - var n,i,
756   - evtclick = null;
  960 + // FIXME nao funciona no googlemaps
  961 + googlemaps : {
  962 + inicia : function() {
  963 + var n, i, evtclick = null;
757 964 i3GEO.eventos.cliquePerm.desativa();
758   - i3GEO.util.mudaCursor(i3GEO.configura.cursores,"pointer",i3GEO.Interface.IDMAPA,i3GEO.configura.locaplic);
  965 + i3GEO.util.mudaCursor(i3GEO.configura.cursores, "pointer", i3GEO.Interface.IDMAPA, i3GEO.configura.locaplic);
759 966 i3GEO.editorGM.drawingManager.setOptions({
760   - drawingMode: null
  967 + drawingMode : null
761 968 });
762 969 n = i3GEO.desenho.googlemaps.shapes.length;
763   - for(i=0;i<n;i++){
  970 + for (i = 0; i < n; i++) {
764 971 evtclick = google.maps.event.addListener(i3GEO.desenho.googlemaps.shapes[i], "click", function(evt) {
765   - if(i3GEOF.selecao.tipoSel === "i3GEOselecaofigura"){
766   - var i,s = [],
767   - wkt = new Wkt.Wkt(),
768   - n = i3GEO.desenho.googlemaps.shapes.length;
769   - for(i=0;i<n;i++){
770   - if(i3GEO.desenho.googlemaps.shapes[i] != "" && i3GEO.desenho.googlemaps.shapes[i].editable === true){
  972 + if (i3GEOF.selecao.tipoSel === "i3GEOselecaofigura") {
  973 + var i, s = [], wkt = new Wkt.Wkt(), n = i3GEO.desenho.googlemaps.shapes.length;
  974 + for (i = 0; i < n; i++) {
  975 + if (i3GEO.desenho.googlemaps.shapes[i] != "" && i3GEO.desenho.googlemaps.shapes[i].editable === true) {
771 976 s = i3GEO.desenho.googlemaps.shapes[i];
772 977 }
773 978 }
774 979 wkt.fromObject(s);
775 980 wkt = wkt.write();
776   - i3GEOF.selecao.figura.termina(
777   - i3GEO.temaAtivo,
778   - $i("i3GEOselecaotipoOperacao").value,
779   - wkt
780   - );
  981 + i3GEOF.selecao.figura.termina(i3GEO.temaAtivo, $i("i3GEOselecaotipoOperacao").value, wkt);
781 982 }
782 983 google.maps.event.removeListener(evtclick);
783 984 });
784 985 }
785 986 }
786 987 },
787   - termina: function(tema,tipo,wkt){
788   - var retorna = function(retorno){
  988 + termina : function(tema, tipo, wkt) {
  989 + var retorna = function(retorno) {
789 990 i3GEOF.selecao.fimSelecao(retorno);
790 991 };
791 992 i3GEO.eventos.cliquePerm.ativa();
792   - i3GEO.php.selecaoWkt(
793   - retorna,
794   - tema,
795   - tipo,
796   - wkt,
797   - $i("i3GEOselecaotoleranciapt").value
798   - );
  993 + i3GEO.php.selecaoWkt(retorna, tema, tipo, wkt, $i("i3GEOselecaotoleranciapt").value);
  994 + i3GEOF.selecao.mudaicone();
799 995 }
800 996 },
801 997 /*
802   - Classe: i3GEOF.selecao.poligono
803   -
804   - Realiza a sele&ccedil;&atilde;o desenhando um pol&iacute;gono no mapa
  998 + * Classe: i3GEOF.selecao.poligono
  999 + *
  1000 + * Realiza a sele&ccedil;&atilde;o desenhando um pol&iacute;gono no mapa
805 1001 */
806   - poligono:{
807   - openlayers: {
808   - inicia: function(){
  1002 + poligono : {
  1003 + ol3 : {
  1004 + draw : "",
  1005 + inicia : function() {
  1006 + i3GEO.eventos.cliquePerm.desativa();
  1007 + i3GEOF.selecao.poligono.ol3.removeControle();
  1008 + i3GEOF.selecao.poligono.ol3.draw = new ol.interaction.Draw({
  1009 + // features : i3GEO.desenho.layergrafico.getFeatures(),
  1010 + type : "Polygon"
  1011 + });
  1012 + i3GEO.Interface.openlayers.interacoes[0].setActive(false);
  1013 + i3GEOF.selecao.poligono.ol3.draw.on("drawend",function(evt){
  1014 + var n, i, x = [],y =[],geo, pol = evt.feature.getGeometry();
  1015 + if ($i("i3GEOFselecaoMantemFigura").checked === true) {
  1016 + evt.feature.setProperties({origem : "i3GEOFselecao"});
  1017 + i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature);
  1018 + }
  1019 + i3GEOF.selecao.poligono.ol3.removeControle();
  1020 + i3GEO.eventos.cliquePerm.ativa();
  1021 + pol = i3GEO.util.projOSM2Geo(pol);
  1022 + geo = pol.getCoordinates()[0];
  1023 + n = geo.length;
  1024 + for(i=0; i<n; i++){
  1025 + x.push(geo[i][0]);
  1026 + y.push(geo[i][1]);
  1027 + }
  1028 + i3GEOF.selecao.poligono.termina({
  1029 + xpt : x,
  1030 + ypt : y
  1031 + });
  1032 + });
  1033 + i3geoOL.addInteraction(i3GEOF.selecao.poligono.ol3.draw);
  1034 + },
  1035 + removeControle : function() {
  1036 + i3geoOL.removeInteraction(i3GEOF.selecao.poligono.ol3.draw);
  1037 + i3GEOF.selecao.poligono.ol3.draw = "";
  1038 + }
  1039 + },
  1040 + openlayers : {
  1041 + inicia : function() {
809 1042 var poligono;
810 1043 i3GEO.eventos.cliquePerm.desativa();
811 1044 i3GEOF.selecao.poligono.openlayers.removeControle();
812   - poligono = new OpenLayers.Control.DrawFeature(
813   - i3GEO.desenho.layergrafico,
814   - OpenLayers.Handler.Polygon,
815   - {
816   - autoActivate: true,
817   - id: "i3GEOFselecaoPoli",
818   - type: OpenLayers.Control.TYPE_TOOL,
819   - callbacks:{
820   - done: function(feature){
821   - i3GEOF.selecao.poligono.openlayers.removeControle();
822   - feature = i3GEO.util.projOSM2Geo(feature);
823   - //pega as coordenadas
824   - var i,
825   - x = [],
826   - y = [],
827   - vertices = feature.components[0].components,
828   - n = vertices.length;
829   - for(i=0;i<n;i++){
830   - x.push(vertices[i].x);
831   - y.push(vertices[i].y);
832   - }
833   - i3GEOF.selecao.poligono.termina({
834   - xpt: x,
835   - ypt: y
836   - });
837   - if($i("i3GEOFselecaoMantemFigura").checked === true){
838   - feature = i3GEO.util.projGeo2OSM(feature);
839   - f = new OpenLayers.Feature.Vector(feature, {
840   - origem : "i3GEOFselecao"
841   - }, {
842   - fillColor: "orange",
843   - fillOpacity: 0.4,
844   - strokeColor: "orange",
845   - strokeOpacity: 1,
846   - strokeWidth: 2
847   - });
848   -
849   - i3GEO.desenho.layergrafico.addFeatures([f]);
850   - if (i3GEO.Interface) {
851   - i3GEO.Interface.openlayers.sobeLayersGraficos();
852   - }
853   - }
  1045 + poligono = new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico, OpenLayers.Handler.Polygon, {
  1046 + autoActivate : true,
  1047 + id : "i3GEOFselecaoPoli",
  1048 + type : OpenLayers.Control.TYPE_TOOL,
  1049 + callbacks : {
  1050 + done : function(feature) {
  1051 + i3GEOF.selecao.poligono.openlayers.removeControle();
  1052 + feature = i3GEO.util.projOSM2Geo(feature);
  1053 + // pega as coordenadas
  1054 + var i, x = [], y = [], vertices = feature.components[0].components, n = vertices.length;
  1055 + for (i = 0; i < n; i++) {
  1056 + x.push(vertices[i].x);
  1057 + y.push(vertices[i].y);
  1058 + }
  1059 + i3GEOF.selecao.poligono.termina({
  1060 + xpt : x,
  1061 + ypt : y
  1062 + });
  1063 + if ($i("i3GEOFselecaoMantemFigura").checked === true) {
  1064 + feature = i3GEO.util.projGeo2OSM(feature);
  1065 + f = new OpenLayers.Feature.Vector(feature, {
  1066 + origem : "i3GEOFselecao"
  1067 + }, {
  1068 + fillColor : "orange",
  1069 + fillOpacity : 0.4,
  1070 + strokeColor : "orange",
  1071 + strokeOpacity : 1,
  1072 + strokeWidth : 2
  1073 + });
  1074 +
  1075 + i3GEO.desenho.layergrafico.addFeatures([
  1076 + f
  1077 + ]);
  1078 + if (i3GEO.Interface) {
  1079 + i3GEO.Interface.openlayers.sobeLayersGraficos();
854 1080 }
855 1081 }
856   - });
  1082 + }
  1083 + }
  1084 + });
857 1085 i3geoOL.addControl(poligono);
858 1086 },
859   - removeControle: function(){
860   - var controle = i3geoOL.getControlsBy("id","i3GEOFselecaoPoli");
861   - if(controle.length > 0){
  1087 + removeControle : function() {
  1088 + var controle = i3geoOL.getControlsBy("id", "i3GEOFselecaoPoli");
  1089 + if (controle.length > 0) {
862 1090 controle[0].deactivate();
863 1091 i3geoOL.removeControl(controle[0]);
864 1092 }
865 1093 }
866 1094 },
867   - googlemaps: {
868   - inicia: function(){
  1095 + googlemaps : {
  1096 + inicia : function() {
869 1097 i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia();
870   - i3GeoMap.setOptions({disableDoubleClickZoom:true});
871   - i3GeoMap.setOptions({draggableCursor:'crosshair'});
872   - var evtdblclick = null,
873   - evtclick = null,
874   - evtmousemove = null,
875   - pontos = {
876   - mvcLine: new google.maps.MVCArray(),
877   - line: null,
878   - polygon: null,
879   - x: [],
880   - y: []
881   - },
882   - termina = function(){
  1098 + i3GeoMap.setOptions({
  1099 + disableDoubleClickZoom : true
  1100 + });
  1101 + i3GeoMap.setOptions({
  1102 + draggableCursor : 'crosshair'
  1103 + });
  1104 + var evtdblclick = null, evtclick = null, evtmousemove = null, pontos = {
  1105 + mvcLine : new google.maps.MVCArray(),
  1106 + line : null,
  1107 + polygon : null,
  1108 + x : [],
  1109 + y : []
  1110 + }, termina = function() {
883 1111 google.maps.event.removeListener(evtdblclick);
884 1112 google.maps.event.removeListener(evtclick);
885 1113 google.maps.event.removeListener(evtmousemove);
886   - var f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem","i3GEOFselecao");
  1114 + var f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem", "i3GEOFselecao");
887 1115 i3GEOF.selecao.poligono.termina({
888   - xpt: pontos.x,
889   - ypt: pontos.y
  1116 + xpt : pontos.x,
  1117 + ypt : pontos.y
890 1118 });
891   - if(f && f.length > 0 && $i("i3GEOFselecaoMantemFigura").checked === false){
  1119 + if (f && f.length > 0 && $i("i3GEOFselecaoMantemFigura").checked === false) {
892 1120 i3GEO.desenho.googlemaps.destroyFeatures(f);
893 1121 }
894   - f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem","i3GEOFselecaoMarcas");
895   - if(f && f.length > 0){
  1122 + f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem", "i3GEOFselecaoMarcas");
  1123 + if (f && f.length > 0) {
896 1124 i3GEO.desenho.googlemaps.destroyFeatures(f);
897 1125 }
898 1126 };
... ... @@ -900,21 +1128,19 @@ i3GEOF.selecao = {
900 1128 pontos.mvcLine.push(evt.latLng);
901 1129 pontos.x.push(evt.latLng.lng());
902 1130 pontos.y.push(evt.latLng.lat());
903   - i3GEO.desenho.googlemaps.shapes.push(
904   - new google.maps.Marker({
905   - map: i3GeoMap,
906   - fillOpacity: 0,
907   - clickable: false,
908   - position:evt.latLng,
909   - icon: {
910   - path: google.maps.SymbolPath.CIRCLE,
911   - scale: 2.5,
912   - strokeColor: "#ffffff"
913   - },
914   - origem: "i3GEOFselecaoMarcas"
915   - })
916   - );
917   - //mais um ponto para criar uma linha movel
  1131 + i3GEO.desenho.googlemaps.shapes.push(new google.maps.Marker({
  1132 + map : i3GeoMap,
  1133 + fillOpacity : 0,
  1134 + clickable : false,
  1135 + position : evt.latLng,
  1136 + icon : {
  1137 + path : google.maps.SymbolPath.CIRCLE,
  1138 + scale : 2.5,
  1139 + strokeColor : "#ffffff"
  1140 + },
  1141 + origem : "i3GEOFselecaoMarcas"
  1142 + }));
  1143 + // mais um ponto para criar uma linha movel
918 1144 pontos.mvcLine.push(evt.latLng);
919 1145 });
920 1146 evtmousemove = google.maps.event.addListener(i3GeoMap, "mousemove", function(evt) {
... ... @@ -922,13 +1148,13 @@ i3GEOF.selecao = {
922 1148 if (!pontos.line) {
923 1149 // Create the line (google.maps.Polyline)
924 1150 pontos.line = new google.maps.Polygon({
925   - map: i3GeoMap,
926   - clickable: false,
927   - strokeColor: "#000000",
928   - strokeOpacity: 1,
929   - strokeWeight: 2,
930   - path: pontos.mvcLine,
931   - origem: "i3GEOFselecao"
  1151 + map : i3GeoMap,
  1152 + clickable : false,
  1153 + strokeColor : "#000000",
  1154 + strokeOpacity : 1,
  1155 + strokeWeight : 2,
  1156 + path : pontos.mvcLine,
  1157 + origem : "i3GEOFselecao"
932 1158 });
933 1159 i3GEO.desenho.googlemaps.shapes.push(pontos.line);
934 1160 }
... ... @@ -942,107 +1168,109 @@ i3GEOF.selecao = {
942 1168 }
943 1169 },
944 1170 /*
945   - Function: termina
946   -
947   - Termina o desenho do pol&iacute;gono e executa a opera&ccedil;&atilde;o de sele&ccedil;&atilde;o
  1171 + * Function: termina
  1172 + *
  1173 + * Termina o desenho do pol&iacute;gono e executa a opera&ccedil;&atilde;o de sele&ccedil;&atilde;o
948 1174 */
949   - termina: function(pontos){
950   - var xs,ys,retorna,p,cp,tema=i3GEO.temaAtivo;
  1175 + termina : function(pontos) {
  1176 + var xs, ys, retorna, p, cp, tema = i3GEO.temaAtivo;
951 1177 n = pontos.xpt.length;
952 1178 xs = pontos.xpt.toString(",");
953 1179 ys = pontos.ypt.toString(",");
954   - retorna = function(retorno){
  1180 + retorna = function(retorno) {
955 1181 i3GEOF.selecao.fimSelecao(retorno);
956 1182 };
957   - i3GEO.janela.abreAguarde("i3GEO.atualiza",$trad("o1"));
  1183 + i3GEO.janela.abreAguarde("i3GEO.atualiza", $trad("o1"));
958 1184 i3GEO.eventos.cliquePerm.ativa();
959   - p = i3GEO.configura.locaplic+"/ferramentas/selecao/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=selecaoPoli";
  1185 + i3GEOF.selecao.mudaicone();
  1186 + p = i3GEO.configura.locaplic + "/ferramentas/selecao/exec.php?g_sid=" + i3GEO.configura.sid + "&funcao=selecaoPoli";
960 1187 cp = new cpaint();
961   - //cp.set_debug(2)
  1188 + // cp.set_debug(2)
962 1189 cp.set_transfer_mode('POST');
963 1190 cp.set_response_type("JSON");
964 1191 cp.call(
965 1192 p,
966 1193 "selecaoPoli",
967 1194 retorna,
968   - "xs="+xs,
969   - "ys="+ys,
970   - "tema="+tema,
971   - "tipo="+$i("i3GEOselecaotipoOperacao").value,
972   - "buffer="+$i("i3GEOselecaotoleranciapt").value
973   - );
  1195 + "xs=" + xs,
  1196 + "ys=" + ys,
  1197 + "tema=" + tema,
  1198 + "tipo=" + $i("i3GEOselecaotipoOperacao").value,
  1199 + "buffer=" + $i("i3GEOselecaotoleranciapt").value);
974 1200 }
975 1201 },
976 1202 /*
977   - Function: criatema
978   -
979   - Cria um novo tema com a sele&ccedil;&atilde;o atual
  1203 + * Function: criatema
  1204 + *
  1205 + * Cria um novo tema com a sele&ccedil;&atilde;o atual
980 1206 */
981   - criatema: function(){
982   - if(i3GEOF.selecao.aguarde.visibility === "visible")
983   - {return;}
984   - try{
985   - if($i("i3GEOselecaotemasLigados").value === "")
986   - {i3GEO.janela.tempoMsg("Escolha um tema");return;}
  1207 + criatema : function() {
  1208 + if (i3GEOF.selecao.aguarde.visibility === "visible") {
  1209 + return;
  1210 + }
  1211 + try {
  1212 + if ($i("i3GEOselecaotemasLigados").value === "") {
  1213 + i3GEO.janela.tempoMsg("Escolha um tema");
  1214 + return;
  1215 + }
987 1216 i3GEOF.selecao.aguarde.visibility = "visible";
988   - var fim = function(){
  1217 + var fim = function() {
989 1218 i3GEOF.selecao.aguarde.visibility = "hidden";
990 1219 i3GEO.atualiza();
991 1220 };
992   - i3GEO.php.criatemaSel(fim,$i("i3GEOselecaotemasLigados").value);
  1221 + i3GEO.php.criatemaSel(fim, $i("i3GEOselecaotemasLigados").value);
  1222 + } catch (e) {
  1223 + i3GEO.janela.tempoMsg("Erro: " + e);
  1224 + i3GEOF.selecao.aguarde.visibility = "hidden";
993 1225 }
994   - catch(e){i3GEO.janela.tempoMsg("Erro: "+e);i3GEOF.selecao.aguarde.visibility = "hidden";}
995 1226 },
996 1227 /*
997   - Function: adicionaLinhaFiltro
998   -
999   - Adiciona uma nova linha de filtro
  1228 + * Function: adicionaLinhaFiltro
  1229 + *
  1230 + * Adiciona uma nova linha de filtro
1000 1231 */
1001   - adicionaLinhaFiltro: function(){
1002   - var add,xis,interrogacao,operador,conector,valor,ntr,ntad,ntd,ntd1,ntd2,ntd3,ntd4,ntd5,tabela;
1003   - try{
  1232 + adicionaLinhaFiltro : function() {
  1233 + var add, xis, interrogacao, operador, conector, valor, ntr, ntad, ntd, ntd1, ntd2, ntd3, ntd4, ntd5, tabela;
  1234 + try {
1004 1235 add = document.createElement("img");
1005   - add.src = i3GEO.configura.locaplic+'/imagens/oxygen/16x16/list-add.png';
1006   - add.style.cursor="pointer";
1007   - add.onclick = function(){
  1236 + add.src = i3GEO.configura.locaplic + '/imagens/oxygen/16x16/list-add.png';
  1237 + add.style.cursor = "pointer";
  1238 + add.onclick = function() {
1008 1239 i3GEOF.selecao.adicionaLinhaFiltro();
1009 1240 };
1010 1241  
1011 1242 xis = document.createElement("img");
1012   - xis.src = i3GEO.configura.locaplic+'/imagens/oxygen/16x16/edit-delete.png';
1013   - xis.style.cursor="pointer";
1014   - xis.onclick = function(){
1015   - var p = this.parentNode.parentNode.parentNode,
1016   - i;
1017   - for (i = 0; i < p.childNodes.length;i++){
  1243 + xis.src = i3GEO.configura.locaplic + '/imagens/oxygen/16x16/edit-delete.png';
  1244 + xis.style.cursor = "pointer";
  1245 + xis.onclick = function() {
  1246 + var p = this.parentNode.parentNode.parentNode, i;
  1247 + for (i = 0; i < p.childNodes.length; i++) {
1018 1248 p.removeChild(p.childNodes[i]);
1019 1249 }
1020 1250 };
1021 1251 interrogacao = document.createElement("img");
1022   - interrogacao.src = i3GEO.configura.locaplic+'/imagens/oxygen/16x16/format-line-spacing-normal.png';
1023   - interrogacao.title='mostra valores';
1024   - interrogacao.style.cursor="pointer";
1025   - interrogacao.style.margin="5px";
1026   - interrogacao.onclick = function(){
1027   - var obj = (this.parentNode.parentNode.getElementsByTagName("input"))[0],
1028   - itemTema = (this.parentNode.parentNode.getElementsByTagName("select"))[0].value;
1029   - i3GEO.util.comboValoresItem(
1030   - "i3GEOselecaocbitens",
1031   - i3GEO.temaAtivo,
1032   - itemTema,
1033   - function(retorno){
1034   - $i("i3GEOselecaovalores").innerHTML = "<br><p class=paragrafo >" + $trad('selecionaValor',i3GEOF.selecao.dicionario) + ":</p>"
1035   - + "<div class='styled-select' >" + retorno.dados + "</div>";
1036   - if ($i("i3GEOselecaocbitens")){
1037   - $i("i3GEOselecaocbitens").onchange = function(){
1038   - obj.value = this.value;
1039   - };
1040   - }
1041   - },
1042   - "i3GEOselecaovalores",
1043   - "display:block"
1044   - );
1045   - };
  1252 + interrogacao.src = i3GEO.configura.locaplic + '/imagens/oxygen/16x16/format-line-spacing-normal.png';
  1253 + interrogacao.title = 'mostra valores';
  1254 + interrogacao.style.cursor = "pointer";
  1255 + interrogacao.style.margin = "5px";
  1256 + interrogacao.onclick =
  1257 + function() {
  1258 + var obj = (this.parentNode.parentNode.getElementsByTagName("input"))[0], itemTema =
  1259 + (this.parentNode.parentNode.getElementsByTagName("select"))[0].value;
  1260 + i3GEO.util.comboValoresItem("i3GEOselecaocbitens", i3GEO.temaAtivo, itemTema, function(retorno) {
  1261 + $i("i3GEOselecaovalores").innerHTML =
  1262 + "<br><p class=paragrafo >" + $trad('selecionaValor', i3GEOF.selecao.dicionario)
  1263 + + ":</p>"
  1264 + + "<div class='styled-select' >"
  1265 + + retorno.dados
  1266 + + "</div>";
  1267 + if ($i("i3GEOselecaocbitens")) {
  1268 + $i("i3GEOselecaocbitens").onchange = function() {
  1269 + obj.value = this.value;
  1270 + };
  1271 + }
  1272 + }, "i3GEOselecaovalores", "display:block");
  1273 + };
1046 1274 operador = "<div class='styled-select' style='width:95px;margin-left:5px;'><select>";
1047 1275 operador += "<option value='='>=</option>";
1048 1276 operador += "<option value='!='> != </option>";
... ... @@ -1062,10 +1290,9 @@ i3GEOF.selecao = {
1062 1290  
1063 1291 valor = document.createElement("div");
1064 1292 valor.className = 'i3geoForm100 i3geoFormIconeEdita';
1065   - valor.style.marginLeft="5px";
  1293 + valor.style.marginLeft = "5px";
1066 1294 valor.innerHTML = "<input type=text value='' />";
1067 1295  
1068   -
1069 1296 ntr = document.createElement("tr");
1070 1297 ntad = document.createElement("td");
1071 1298 ntad.appendChild(add);
... ... @@ -1076,16 +1303,12 @@ i3GEOF.selecao = {
1076 1303 ntr.appendChild(ntd);
1077 1304  
1078 1305 ntd1 = document.createElement("td");
1079   - i3GEO.util.comboItens(
1080   - "i3GEOselecaoItensAtrib",
1081   - i3GEO.temaAtivo,
1082   - function(retorno){
1083   - ntd1.innerHTML = "<div class='styled-select' style='width:95px;margin-left:5px;' >" + retorno.dados + "</div>";
1084   - $i("i3GEOselecaoItensAtrib").onchange = function(){
1085   - $i("i3GEOselecaovalores").innerHTML = "";
1086   - };
1087   - }
1088   - );
  1306 + i3GEO.util.comboItens("i3GEOselecaoItensAtrib", i3GEO.temaAtivo, function(retorno) {
  1307 + ntd1.innerHTML = "<div class='styled-select' style='width:95px;margin-left:5px;' >" + retorno.dados + "</div>";
  1308 + $i("i3GEOselecaoItensAtrib").onchange = function() {
  1309 + $i("i3GEOselecaovalores").innerHTML = "";
  1310 + };
  1311 + });
1089 1312 ntr.appendChild(ntd1);
1090 1313  
1091 1314 ntd2 = document.createElement("td");
... ... @@ -1104,37 +1327,43 @@ i3GEOF.selecao = {
1104 1327 ntd5.innerHTML = conector;
1105 1328 ntr.appendChild(ntd5);
1106 1329  
1107   - //ntb = document.createElement("tbody");
1108   - //ntb.appendChild(ntr);
1109   - if(navm)
1110   - {tabela = $i("i3GEOselecaoparametros").getElementsByTagName("tbody")[0];}
1111   - else
1112   - {tabela = $i("i3GEOselecaoparametros");}
  1330 + // ntb = document.createElement("tbody");
  1331 + // ntb.appendChild(ntr);
  1332 + if (navm) {
  1333 + tabela = $i("i3GEOselecaoparametros").getElementsByTagName("tbody")[0];
  1334 + } else {
  1335 + tabela = $i("i3GEOselecaoparametros");
  1336 + }
1113 1337 tabela.appendChild(ntr);
  1338 + } catch (e) {
  1339 + i3GEO.janela.tempoMsg("Erro: " + e);
1114 1340 }
1115   - catch(e){i3GEO.janela.tempoMsg("Erro: "+e);}
1116 1341 },
1117 1342 /*
1118   - Function: atributo
1119   -
1120   - Seleciona por atributo
  1343 + * Function: atributo
  1344 + *
  1345 + * Seleciona por atributo
1121 1346 */
1122   - atributo: function(){
1123   - if(i3GEOF.selecao.aguarde.visibility === "visible")
1124   - {return;}
1125   - if($i("i3GEOselecaotemasLigados").value === "")
1126   - {i3GEO.janela.tempoMsg($trad('selecionaTema',i3GEOF.selecao.dicionario));return;}
1127   - try{
  1347 + atributo : function() {
  1348 + if (i3GEOF.selecao.aguarde.visibility === "visible") {
  1349 + return;
  1350 + }
  1351 + if ($i("i3GEOselecaotemasLigados").value === "") {
  1352 + i3GEO.janela.tempoMsg($trad('selecionaTema', i3GEOF.selecao.dicionario));
  1353 + return;
  1354 + }
  1355 + try {
1128 1356 i3GEOF.selecao.aguarde.visibility = "visible";
1129   - var filtro = "",
1130   - g,ipt,i,ii,nos,s,itemsel,valor,operador,conector,temp;
1131   - if(navm){ii = 2;}
1132   - else
1133   - {ii = 0;}
  1357 + var filtro = "", g, ipt, i, ii, nos, s, itemsel, valor, operador, conector, temp;
  1358 + if (navm) {
  1359 + ii = 2;
  1360 + } else {
  1361 + ii = 0;
  1362 + }
1134 1363 g = $i("i3GEOselecaoparametros");
1135 1364 ipt = g.getElementsByTagName("tr");
1136   - if (ipt.length > 0){
1137   - for (i=ii;i<ipt.length; i++){
  1365 + if (ipt.length > 0) {
  1366 + for (i = ii; i < ipt.length; i++) {
1138 1367 nos = ipt[i].childNodes;
1139 1368 s = nos[2].getElementsByTagName("select");
1140 1369 itemsel = s[0].value;
... ... @@ -1144,46 +1373,49 @@ i3GEOF.selecao = {
1144 1373 valor = s[0].value;
1145 1374 s = nos[6].getElementsByTagName("select");
1146 1375 conector = s[0].value;
1147   - if (valor*1)
1148   - {filtro = filtro + "(["+itemsel+"] "+operador+" "+valor+")";}
1149   - else
1150   - {filtro = filtro + "(|["+itemsel+"]| "+operador+" |"+valor+"|)";}
1151   - if ((i + 1) != ipt.length) //tem conector
1152   - {filtro = filtro + conector;}
1153   - else
1154   - {filtro = "("+filtro+")";}
  1376 + if (valor * 1) {
  1377 + filtro = filtro + "([" + itemsel + "] " + operador + " " + valor + ")";
  1378 + } else {
  1379 + filtro = filtro + "(|[" + itemsel + "]| " + operador + " |" + valor + "|)";
  1380 + }
  1381 + if ((i + 1) != ipt.length) // tem conector
  1382 + {
  1383 + filtro = filtro + conector;
  1384 + } else {
  1385 + filtro = "(" + filtro + ")";
  1386 + }
1155 1387 }
1156 1388 }
1157   - if (filtro === ""){
  1389 + if (filtro === "") {
1158 1390 i3GEOF.selecao.aguarde.visibility = "hidden";
1159 1391 return;
1160 1392 }
1161   - temp = function(retorno){
  1393 + temp = function(retorno) {
1162 1394 i3GEOF.selecao.fimSelecao(retorno);
1163 1395 };
1164   - i3GEO.php.selecaoatrib2(temp,i3GEO.temaAtivo,filtro,$i("i3GEOselecaotipoOperacao").value);
1165   - }
1166   - catch(e){
1167   - i3GEO.janela.tempoMsg("Erro: "+e);
  1396 + i3GEO.php.selecaoatrib2(temp, i3GEO.temaAtivo, filtro, $i("i3GEOselecaotipoOperacao").value);
  1397 + } catch (e) {
  1398 + i3GEO.janela.tempoMsg("Erro: " + e);
1168 1399 i3GEOF.selecao.aguarde.visibility = "hidden";
1169 1400 }
1170 1401 },
1171 1402 /*
1172   - Function: aplicaselecaoTema
1173   -
1174   - Realiza a sele&ccedil;&atilde;o cruzando um tema com outro
  1403 + * Function: aplicaselecaoTema
  1404 + *
  1405 + * Realiza a sele&ccedil;&atilde;o cruzando um tema com outro
1175 1406 */
1176   - aplicaselecaoTema: function(){
1177   - if(i3GEOF.selecao.aguarde.visibility === "visible")
1178   - {return;}
1179   - if($i("i3GEOselecaotemasLigados").value === ""){
1180   - i3GEO.janela.tempoMsg($trad('selecionaTema',i3GEOF.selecao.dicionario));
  1407 + aplicaselecaoTema : function() {
  1408 + if (i3GEOF.selecao.aguarde.visibility === "visible") {
  1409 + return;
  1410 + }
  1411 + if ($i("i3GEOselecaotemasLigados").value === "") {
  1412 + i3GEO.janela.tempoMsg($trad('selecionaTema', i3GEOF.selecao.dicionario));
1181 1413 i3GEOF.selecao.aguarde.visibility = "hidden";
1182 1414 return;
1183 1415 }
1184   - try{
  1416 + try {
1185 1417 i3GEOF.selecao.aguarde.visibility = "visible";
1186   - var temp = function(retorno){
  1418 + var temp = function(retorno) {
1187 1419 i3GEOF.selecao.fimSelecao(retorno);
1188 1420 };
1189 1421 i3GEO.php.selecaotema(
... ... @@ -1191,64 +1423,66 @@ i3GEOF.selecao = {
1191 1423 $i("i3GEOselecaoTemaoverlay").value,
1192 1424 i3GEO.temaAtivo,
1193 1425 $i("i3GEOselecaotipoOperacao").value,
1194   - $i("i3GEOselecaotoleranciapt").value
1195   - );
1196   - }
1197   - catch(e){
1198   - i3GEO.janela.tempoMsg("Erro: "+e);
  1426 + $i("i3GEOselecaotoleranciapt").value);
  1427 + } catch (e) {
  1428 + i3GEO.janela.tempoMsg("Erro: " + e);
1199 1429 i3GEOF.selecao.aguarde.visibility = "hidden";
1200 1430 }
1201 1431 },
1202 1432 /*
1203   - Function: grafico
1204   -
1205   - Abre uma janela flutuante para criar gr&aacute;ficos
  1433 + * Function: grafico
  1434 + *
  1435 + * Abre uma janela flutuante para criar gr&aacute;ficos
1206 1436 */
1207   - grafico: function(){
  1437 + grafico : function() {
1208 1438 i3GEO.analise.dialogo.graficoInterativo1();
1209 1439 },
1210 1440 /*
1211   - Function: graficoPerfil
1212   -
1213   - Abre uma janela flutuante para criar gr&aacute;ficos de perfil
  1441 + * Function: graficoPerfil
  1442 + *
  1443 + * Abre uma janela flutuante para criar gr&aacute;ficos de perfil
1214 1444 */
1215   - graficoPerfil: function(){
1216   - var cp,p;
1217   - if(i3GEOF.selecao.aguarde.visibility === "visible")
1218   - {return;}
1219   - if($i("i3GEOselecaotemasLigados").value === "")
1220   - {i3GEO.janela.tempoMsg("Escolha um tema");return;}
1221   - try{
  1445 + graficoPerfil : function() {
  1446 + var cp, p;
  1447 + if (i3GEOF.selecao.aguarde.visibility === "visible") {
  1448 + return;
  1449 + }
  1450 + if ($i("i3GEOselecaotemasLigados").value === "") {
  1451 + i3GEO.janela.tempoMsg("Escolha um tema");
  1452 + return;
  1453 + }
  1454 + try {
1222 1455 i3GEOF.selecao.aguarde.visibility = "visible";
1223   - var temp = function(retorno){
  1456 + var temp = function(retorno) {
1224 1457 i3GEOF.selecao.aguarde.visibility = "hidden";
1225   - if (retorno.data != undefined){
1226   - var x = [],
1227   - y = [],
1228   - i,
1229   - n = retorno.data.length,
1230   - js = i3GEO.configura.locaplic+"/ferramentas/perfil/index.js";
1231   - for (i=0;i<n; i++){
  1458 + if (retorno.data != undefined) {
  1459 + var x = [], y = [], i, n = retorno.data.length, js = i3GEO.configura.locaplic + "/ferramentas/perfil/index.js";
  1460 + for (i = 0; i < n; i++) {
1232 1461 x.push(retorno.data[i].x);
1233 1462 y.push(retorno.data[i].y);
1234 1463 }
1235   - if(x.length == 0)
1236   - {i3GEO.janela.tempoMsg($trad('msgNenhumPontoEncontrado',i3GEOF.selecao.dicionario));return;}
  1464 + if (x.length == 0) {
  1465 + i3GEO.janela.tempoMsg($trad('msgNenhumPontoEncontrado', i3GEOF.selecao.dicionario));
  1466 + return;
  1467 + }
1237 1468 pontosdistobj = {
1238   - xpt: x,
1239   - ypt: y
  1469 + xpt : x,
  1470 + ypt : y
1240 1471 };
1241   - i3GEO.util.scriptTag(js,"i3GEOF.perfil.criaJanelaFlutuante(pontosdistobj)","i3GEOF.perfil_script");
  1472 + i3GEO.util.scriptTag(js, "i3GEOF.perfil.criaJanelaFlutuante(pontosdistobj)", "i3GEOF.perfil_script");
1242 1473 }
1243 1474 };
1244 1475 cp = new cpaint();
1245 1476 cp.set_response_type("JSON");
1246   - p = i3GEO.configura.locaplic+"/ferramentas/selecao/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=listaPontosShapeSel&tema="+i3GEO.temaAtivo;
1247   - cp.call(p,"listaPontosShape",temp);
1248   - }
1249   - catch(e){
1250   - i3GEO.janela.tempoMsg("Erro: "+e);
  1477 + p =
  1478 + i3GEO.configura.locaplic + "/ferramentas/selecao/exec.php?g_sid="
  1479 + + i3GEO.configura.sid
  1480 + + "&funcao=listaPontosShapeSel&tema="
  1481 + + i3GEO.temaAtivo;
  1482 + cp.call(p, "listaPontosShape", temp);
  1483 + } catch (e) {
  1484 + i3GEO.janela.tempoMsg("Erro: " + e);
1251 1485 i3GEOF.selecao.aguarde.visibility = "hidden";
1252 1486 }
1253 1487 }
1254   -};
  1488 + };
... ...