Commit 6789cb55308ba5c5ef8ff876e09fa6bc9364c2aa

Authored by Edmar Moretti
1 parent e8a0b621

Correção na identação e documentação do código

Showing 2 changed files with 2021 additions and 1473 deletions   Show diff stats
classesjs/classe_ajuda.js
1   -/*
2   -Title: Ajuda
3   -
4   -i3GEO.ajuda
5   -
6   -Manipulação das mensagens de ajuda.
7   -
8   -Permite definir a mensagem padrão da janela de mensagens. Abrir a janela e definir seu conteúdo.
9   -Controla também o letreiro móvel que mostra mensagens especiais definidas em cada layer adicionado ao mapa.
10   -
11   -Exemplos:
12   -
13   - Se vc não quiser que a janela de ajuda seja aberta, inclua em seu HTML ou javascript
14   -
15   - i3GEO.ajuda.ATIVAJANELA = false;
16   -
17   - Para enviar uma mensagem para a janela, utilize
18   -
19   - i3GEO.ajuda.mostraJanela("texto");
20   -
21   -
22   -Arquivo:
23   -
24   -i3geo/classesjs/classe_ajuda.js
25   -
26   -Licença:
27   -
28   -GPL2
29   -
30   -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
31   -
32   -Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil
33   -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com
34   -
35   -Este programa é software livre; você pode redistribuí-lo
36   -e/ou modificá-lo sob os termos da Licença Pública Geral
37   -GNU conforme publicada pela Free Software Foundation;
38   -
39   -Este programa é distribuído na expectativa de que seja útil,
40   -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita
41   -de COMERCIABILIDADE OU ADEQUACÃO A UMA FINALIDADE ESPECÍFICA.
42   -Consulte a Licença Pública Geral do GNU para mais detalhes.
43   -Você deve ter recebido uma cópia da Licença Pública Geral do
44   -GNU junto com este programa; se não, escreva para a
45   -Free Software Foundation, Inc., no endereço
46   -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
47   -*/
48   -if(typeof(i3GEO) === 'undefined'){
  1 +/**
  2 + * Title: Ajuda
  3 + *
  4 + * i3GEO.ajuda
  5 + *
  6 + * Manipulação das mensagens de ajuda.
  7 + *
  8 + * Permite definir a mensagem padrão da janela de mensagens. Abrir a
  9 + * janela e definir seu conteúdo. Controla também o letreiro
  10 + * móvel que mostra mensagens especiais definidas em cada layer
  11 + * adicionado ao mapa.
  12 + *
  13 + * Exemplos:
  14 + *
  15 + * Se vc não quiser que a janela de ajuda seja aberta, inclua em seu HTML
  16 + * ou javascript
  17 + *
  18 + * i3GEO.ajuda.ATIVAJANELA = false;
  19 + *
  20 + * Para enviar uma mensagem para a janela (quando estiver aberta), utilize
  21 + *
  22 + * i3GEO.ajuda.mostraJanela("texto");
  23 + *
  24 + * Para enviar uma mensagem temporária utilize:
  25 + *
  26 + *
  27 + * Arquivo:
  28 + *
  29 + * i3geo/classesjs/classe_ajuda.js
  30 + *
  31 + * Licença:
  32 + *
  33 + * GPL2
  34 + *
  35 + * i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
  36 + *
  37 + * Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente
  38 + * Brasil Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com
  39 + *
  40 + * Este programa é software livre; você pode redistribuí-lo
  41 + * e/ou modificá-lo sob os termos da Licença Pública Geral
  42 + * GNU conforme publicada pela Free Software Foundation;
  43 + *
  44 + * Este programa é distribuído na expectativa de que seja
  45 + * útil, porém, SEM NENHUMA GARANTIA; nem mesmo a garantia
  46 + * implícita de COMERCIABILIDADE OU ADEQUACÃO A UMA FINALIDADE
  47 + * ESPECÍFICA. Consulte a Licença Pública Geral do GNU para
  48 + * mais detalhes. Você deve ter recebido uma cópia da
  49 + * Licença Pública Geral do GNU junto com este programa; se
  50 + * não, escreva para a Free Software Foundation, Inc., no endereço
  51 + * 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  52 + */
  53 +if (typeof (i3GEO) === 'undefined') {
49 54 var i3GEO = {};
50 55 }
51 56 i3GEO.ajuda = {
52   - /*
53   - Propriedade: ATIVAJANELA
54   -
55   - Define se a janela de mensagens pode ou não ser aberta.
56   -
57   - Default:
58   -
59   - {true}
60   -
61   - Tipo:
62   - {Boolean}
63   - */
64   - ATIVAJANELA: true,
65   - /*
66   - Propriedade: DIVAJUDA
67   -
68   - Nome do elemento HTML, do tipo DIV, que irá conter os textos de ajuda.
69   -
70   - Se esse DIV for encontrado no mapa, os textos serão mostrados em seu interior.
71   -
72   - Default:
73   -
74   - {"i3geo_ajuda"}
75   -
76   - Tipo:
77   - {String}
78   - */
79   - DIVAJUDA: "i3geo_ajuda",
80   - /*
81   - Propriedade: DIVLETREIRO
82   -
83   - Id do elemento HTML onde será incluído o banner (letreiro) de mensagens.
84   -
85   - Esse tipo de mensagem é obtida do METADATA "MENSAGEM" que pode ser incluído em um layer.
86   -
87   - Default:
88   -
89   - {"i3geo_letreiro"}
90   -
91   - Tipo:
92   - {String}
93   - */
94   - DIVLETREIRO: "i3geo_letreiro",
95   - /*
96   - Propriedade: MENSAGEMPADRAO
97   -
98   - Mensagem que será incluída ao iniciar a janela de mensagens ou quando não houver
99   - mensagem definida para o elemento sobre o qual o mouse estaciona.
100   -
101   - Default:
102   - {$trad("p1")}
103   -
104   - Tipo:
105   - {String}
106   - */
107   - MENSAGEMPADRAO: $trad("p1"),
108   - /*
109   - Propriedade: TRANSICAOSUAVE
110   -
111   - Altera a transparência quando o mouse sobrepõe � janela e quando sai
112   -
113   - Tipo:
114   - {boolean}
115   -
116   - Default:
117   - {true}
118   - */
119   - TRANSICAOSUAVE: true,
120   - /*
121   - Propriedade: OPACIDADE
122   -
123   - Valor da opacidade mínima utilizada quando TRANSICAOSUAVE for igual a true.
124   -
125   - Varia de 0 a 100
126   -
127   - Tipo:
128   - {numeric}
129   -
130   - Default:
131   - {20}
132   - */
133   - OPACIDADE: 20,
134   - /*
135   - Function: abreDoc
136   -
137   - Abre a documentacao do i3geo em uma nova janela do navegador
138   -
139   - Parametro:
140   -
141   - url - url que será adicionada a i3GEO.configura.locaplic
142   - */
143   - abreDoc: function(url){
144   - if(!url)
145   - {url = "/documentacao/index.html";}
146   - window.open(i3GEO.configura.locaplic+url);
  57 + /**
  58 + * Propriedade: ATIVAJANELA
  59 + *
  60 + * Define se a janela de mensagens pode ou não ser aberta.
  61 + *
  62 + * Tipo {Boolean} - true
  63 + */
  64 + ATIVAJANELA : true,
  65 + /**
  66 + * Propriedade: DIVAJUDA
  67 + *
  68 + * Nome do elemento HTML, do tipo DIV, que irá conter os textos de
  69 + * ajuda.
  70 + *
  71 + * Se esse DIV for encontrado no mapa, os textos serão mostrados em
  72 + * seu interior.
  73 + *
  74 + * Tipo {String} - i3geo_ajuda
  75 + */
  76 + DIVAJUDA : "i3geo_ajuda",
  77 + /**
  78 + * Propriedade: DIVLETREIRO
  79 + *
  80 + * Id do elemento HTML onde será incluído o banner (letreiro)
  81 + * de mensagens.
  82 + *
  83 + * Esse tipo de mensagem é obtida do METADATA "MENSAGEM" que pode ser
  84 + * incluído em um layer.
  85 + *
  86 + * Tipo {String} - i3geo_letreir
  87 + */
  88 + DIVLETREIRO : "i3geo_letreiro",
  89 + /**
  90 + * Propriedade: MENSAGEMPADRAO
  91 + *
  92 + * Mensagem que será incluída ao iniciar a janela de mensagens
  93 + * ou quando não houver mensagem definida para o elemento sobre o
  94 + * qual o mouse estaciona.
  95 + *
  96 + * Tipo {String} - $trad("p1")
  97 + */
  98 + MENSAGEMPADRAO : $trad("p1"),
  99 + /**
  100 + * Propriedade: TRANSICAOSUAVE
  101 + *
  102 + * Altera a transparência quando o mouse sobrepõe a janela e
  103 + * quando sai
  104 + *
  105 + * Tipo {boolean} - true
  106 + */
  107 + TRANSICAOSUAVE : true,
  108 + /**
  109 + * Propriedade: OPACIDADE
  110 + *
  111 + * Valor da opacidade mínima utilizada quando TRANSICAOSUAVE for
  112 + * igual a true.
  113 + *
  114 + * Varia de 0 a 100
  115 + *
  116 + * Tipo {numeric} - 20
  117 + */
  118 + OPACIDADE : 20,
  119 + /**
  120 + * Function: abreDoc
  121 + *
  122 + * Abre a documentacao do i3geo em uma nova janela do navegador
  123 + *
  124 + * Parametro:
  125 + *
  126 + * url {string} - url que será adicionada a i3GEO.configura.locaplic
  127 + */
  128 + abreDoc : function(url) {
  129 + if (!url) {
  130 + url = "/documentacao/index.html";
  131 + }
  132 + window.open(i3GEO.configura.locaplic
  133 + + url);
147 134 },
148   - /*
149   - Function: abreJanela
150   -
151   - Abre a janela flutuante para mostrar as mensagens de ajuda.
152   -
153   - Essa função é executada na inicialização do i3GEO
154   - */
155   - abreJanela: function(){
156   - if(typeof(console) !== 'undefined'){console.info("i3GEO.ajuda.abreJanela()");}
157   - try {
158   - var nx,ny,corpo,texto,janela,temp,
159   - largura=262,
160   - YU = YAHOO.util,
161   - pos = [20,i3GEO.parametros.h / 2];
162   - if(this.ATIVAJANELA === false){return;}
  135 + /**
  136 + * Function: abreJanela
  137 + *
  138 + * Abre a janela flutuante para mostrar as mensagens de ajuda.
  139 + *
  140 + * Essa função é executada na
  141 + * inicialização do i3GEO
  142 + */
  143 + abreJanela : function() {
  144 + try {
  145 + var nx, ny, corpo, texto, janela, temp, largura = 262, YU = YAHOO.util, pos = [
  146 + 20, i3GEO.parametros.h / 2
  147 + ];
  148 + if (this.ATIVAJANELA === false) {
  149 + return;
  150 + }
163 151 temp = $i("contemFerramentas");
164   - if(temp){
165   - largura = parseInt(temp.style.width,10) - 5;
  152 + if (temp) {
  153 + largura = parseInt(
  154 + temp.style.width,
  155 + 10) - 5;
166 156 }
167   - if(!$i("janelaMenTexto")){
  157 + if (!$i("janelaMenTexto")) {
168 158 corpo = $i(i3GEO.Interface.IDCORPO);
169   - if(corpo){pos = YU.Dom.getXY(corpo);}
170   - else{
  159 + if (corpo) {
  160 + pos = YU.Dom.getXY(corpo);
  161 + } else {
171 162 corpo = $i(i3GEO.Interface.IDMAPA);
172   - if(corpo){pos = YU.Dom.getXY(corpo);}
  163 + if (corpo) {
  164 + pos = YU.Dom.getXY(corpo);
  165 + }
173 166 }
174   - nx = pos[0] - largura - 3;
  167 + nx = pos[0]
  168 + - largura
  169 + - 3;
175 170 ny = i3GEO.parametros.h - 78;
176   - texto = '<div id="janelaMenTexto" style="text-align:left;font-size:10px;color:rgb(80,80,80)">'+i3GEO.ajuda.MENSAGEMPADRAO+'</div>';
177   - if(nx < 0)
178   - {nx = 10;ny = ny - 50;}
179   - janela = i3GEO.janela.cria(largura - 3,70,"",nx,ny,"&nbsp;","i3geo_janelaMensagens",false,"hd","","",true);
  171 + texto = '<div id="janelaMenTexto" style="text-align:left;font-size:10px;color:rgb(80,80,80)">'
  172 + + i3GEO.ajuda.MENSAGEMPADRAO
  173 + + '</div>';
  174 + if (nx < 0) {
  175 + nx = 10;
  176 + ny = ny - 50;
  177 + }
  178 + janela = i3GEO.janela.cria(
  179 + largura - 3,
  180 + 70,
  181 + "",
  182 + nx,
  183 + ny,
  184 + "&nbsp;",
  185 + "i3geo_janelaMensagens",
  186 + false,
  187 + "hd",
  188 + "",
  189 + "",
  190 + true);
180 191 janela[2].innerHTML = texto;
181   - YU.Event.addListener(janela[0].close, "click", i3GEO.ajuda.fechaJanela);
  192 + YU.Event.addListener(
  193 + janela[0].close,
  194 + "click",
  195 + i3GEO.ajuda.fechaJanela);
182 196 this.ativaCookie();
183 197  
184 198 }
185   - }
186   - catch(e){
187   - if(typeof(console) !== 'undefined'){console.error("i3GEO.ajuda.abreJanela "+e);}
  199 + } catch (e) {
  200 + if (typeof (console) !== 'undefined') {
  201 + console.error("i3GEO.ajuda.abreJanela "
  202 + + e);
  203 + }
188 204 }
189 205 },
190   - /*
191   - Ativa o cookie g_janelaMen e inclui o valor "sim".
192   -
193   - Toda a vez que a janela &eacute; aberta, o cookie &eacute; ativado.
194   -
195   - Ativando-se o cookie, a janela de mensagens ser&aacute; aberta automaticamente a pr&oacute;xima vez que o i3geo for iniciado
196   - */
197   - ativaCookie: function(){
  206 + /**
  207 + * Ativa o cookie g_janelaMen e inclui o valor "sim".
  208 + *
  209 + * Toda a vez que a janela &eacute; aberta, o cookie &eacute; ativado.
  210 + *
  211 + * Ativando-se o cookie, a janela de mensagens ser&aacute; aberta
  212 + * automaticamente a pr&oacute;xima vez que o i3geo for iniciado
  213 + */
  214 + ativaCookie : function() {
198 215 var i = i3GEO.util.insereCookie;
199   - i("g_janelaMen","sim");
200   - i("botoesAjuda","sim");
  216 + i(
  217 + "g_janelaMen",
  218 + "sim");
  219 + i(
  220 + "botoesAjuda",
  221 + "sim");
201 222 },
202   - /*
203   - Busca mensagens no metadata "MENSAGEM" existentes nos layers do mapa.
204   -
205   - Se existirem mensagens, as mesmas s&atilde;o inclu&iacute;das no letreiro.
206   -
207   - O letreiro deve ser um elemento do tipo INPUT (text).
208   -
209   - Parametro:
210   -
211   - mensagem {String} - (opcional) texto que ser&aacute; mostrado no letreiro. Se n&atilde;o for informado
212   - ser&aacute; utilizado a vari&aacute;vel i3GEO.parametros.mensagens
213   - */
214   - ativaLetreiro: function(mensagem){
215   - if(typeof(console) !== 'undefined'){console.info("i3GEO.ajuda.ativaLetreiro()");}
  223 + /**
  224 + * Busca mensagens no metadata "MENSAGEM" existentes nos layers do mapa.
  225 + *
  226 + * Se existirem mensagens, as mesmas s&atilde;o inclu&iacute;das no
  227 + * letreiro.
  228 + *
  229 + * O letreiro deve ser um elemento do tipo INPUT (text).
  230 + *
  231 + * Parametro:
  232 + *
  233 + * mensagem {String} - (opcional) texto que ser&aacute; mostrado no
  234 + * letreiro. Se n&atilde;o for informado ser&aacute; utilizado a
  235 + * vari&aacute;vel i3GEO.parametros.mensagens
  236 + */
  237 + ativaLetreiro : function(mensagem) {
216 238 var l;
217   - if($i(i3GEO.ajuda.DIVLETREIRO))
218   - {
219   - if(arguments.length === 0)
220   - {mensagem = i3GEO.parametros.mensagens;}
221   - if(i3GEO.eventos.NAVEGAMAPA.toString().search("i3GEO.ajuda.ativaLetreiro()") < 0)
222   - {i3GEO.eventos.NAVEGAMAPA.push("i3GEO.ajuda.ativaLetreiro()");}
223   - try
224   - {clearTimeout(i3GEO.ajuda.tempoLetreiro);}
225   - catch(e){i3GEO.ajuda.tempoLetreiro = "";}
  239 + if ($i(i3GEO.ajuda.DIVLETREIRO)) {
  240 + if (arguments.length === 0) {
  241 + mensagem = i3GEO.parametros.mensagens;
  242 + }
  243 + if (i3GEO.eventos.NAVEGAMAPA.toString().search(
  244 + "i3GEO.ajuda.ativaLetreiro()") < 0) {
  245 + i3GEO.eventos.NAVEGAMAPA.push("i3GEO.ajuda.ativaLetreiro()");
  246 + }
  247 + try {
  248 + clearTimeout(i3GEO.ajuda.tempoLetreiro);
  249 + } catch (e) {
  250 + i3GEO.ajuda.tempoLetreiro = "";
  251 + }
226 252 l = $i(i3GEO.ajuda.DIVLETREIRO);
227   - if(l.style.display==="none"){return;}
228   - l.style.cursor="pointer";
229   - if(mensagem === ""){
  253 + if (l.style.display === "none") {
  254 + return;
  255 + }
  256 + l.style.cursor = "pointer";
  257 + if (mensagem === "") {
230 258 l.value = "";
231 259 return;
232 260 }
233   - if (l.size === 1)
234   - {l.size = i3GEO.parametros.w / 8;}
235   - BMessage = mensagem + " ---Clique para parar--- ";
236   - l.onclick = function()
237   - {l.style.display = "none";};
238   - if (BMessage !== " ---Clique para parar--- "){
  261 + if (l.size === 1) {
  262 + l.size = i3GEO.parametros.w / 8;
  263 + }
  264 + BMessage = mensagem
  265 + + " ---Clique para parar--- ";
  266 + l.onclick = function() {
  267 + l.style.display = "none";
  268 + };
  269 + if (BMessage !== " ---Clique para parar--- ") {
239 270 BQuantas = 0;
240 271 BSize = l.size;
241   - BPos=BSize;
  272 + BPos = BSize;
242 273 BSpeed = 1;
243 274 BSpaces = "";
244 275 i3GEO.ajuda.mostraLetreiro();
... ... @@ -246,87 +277,132 @@ i3GEO.ajuda = {
246 277 i3GEO.ajuda.mostraLetreiro(mensagem);
247 278 }
248 279 },
249   - /*
250   - Desativa o cookie g_janelaMen.
251   -
252   - Toda a vez que a janela &eacute; fechada, o cookie &eacute; desativado.
253   -
254   - Desativando-se o cookie, a janela de mensagens n&atilde;o ser&aacute; aberta automaticamente a pr&oacute;xima vez que o i3geo for iniciado
255   - */
256   - desativaCookie: function(){
257   - i3GEO.util.insereCookie("g_janelaMen","nao");
  280 + /**
  281 + * Desativa o cookie g_janelaMen.
  282 + *
  283 + * Toda a vez que a janela &eacute; fechada, o cookie &eacute; desativado.
  284 + *
  285 + * Desativando-se o cookie, a janela de mensagens n&atilde;o ser&aacute;
  286 + * aberta automaticamente a pr&oacute;xima vez que o i3geo for iniciado
  287 + */
  288 + desativaCookie : function() {
  289 + i3GEO.util.insereCookie(
  290 + "g_janelaMen",
  291 + "nao");
258 292 },
259   - /*
260   - Function: fechaJanela.
261   -
262   - Fecha a janela de ajuda.
263   - */
264   - fechaJanela: function(){
265   - if(typeof(console) !== 'undefined'){console.info("i3GEO.ajuda.fechaJanela()");}
  293 + /**
  294 + * Function: fechaJanela.
  295 + *
  296 + * Fecha a janela de ajuda.
  297 + */
  298 + fechaJanela : function() {
266 299 i3GEO.ajuda.desativaCookie();
267   - i3GEO.util.removeChild("i3geo_janelaMensagens_c",document.body);
  300 + i3GEO.util.removeChild(
  301 + "i3geo_janelaMensagens_c",
  302 + document.body);
268 303 },
269   - /*
270   - Function: mostraJanela
271   -
272   - Mostra um texto dentro da janela de mensagens padr&atilde;o.
273   -
274   - Parametro:
275   -
276   - texto {String} - texto a ser mostrado
277   - */
278   - mostraJanela: function(texto){
279   - var j = $i(this.DIVAJUDA),
280   - k = $i("janelaMenTexto"),
281   - jm = $i("i3geo_janelaMensagens"),
282   - Dom = YAHOO.util.Dom,
283   - h = parseInt(Dom.getStyle(jm,"height"),10);
284   - if(j){
  304 + /**
  305 + * Function: mostraJanela
  306 + *
  307 + * Mostra um texto dentro da janela de mensagens padr&atilde;o.
  308 + *
  309 + * Parametro:
  310 + *
  311 + * texto {String} - texto a ser mostrado
  312 + */
  313 + mostraJanela : function(texto) {
  314 + var j = $i(this.DIVAJUDA), k = $i("janelaMenTexto"), jm = $i("i3geo_janelaMensagens"), Dom = YAHOO.util.Dom, h = parseInt(
  315 + Dom.getStyle(
  316 + jm,
  317 + "height"),
  318 + 10);
  319 + if (j) {
285 320 j.innerHTML = texto === "" ? "-" : texto;
286   - }
287   - else{
288   - if(h)
289   - {Dom.setY("i3geo_janelaMensagens",Dom.getY(jm) + h);}
290   - if(k)
291   - {k.innerHTML = texto;}
292   - if(this.TRANSICAOSUAVE){
293   - texto !== "" ? Dom.setStyle(jm,"opacity","1") : Dom.setStyle(jm,"opacity",(this.OPACIDADE / 100));
  321 + } else {
  322 + if (h) {
  323 + Dom.setY(
  324 + "i3geo_janelaMensagens",
  325 + Dom.getY(jm)
  326 + + h);
  327 + }
  328 + if (k) {
  329 + k.innerHTML = texto;
  330 + }
  331 + if (this.TRANSICAOSUAVE) {
  332 + texto !== "" ? Dom.setStyle(
  333 + jm,
  334 + "opacity",
  335 + "1") : Dom.setStyle(
  336 + jm,
  337 + "opacity",
  338 + (this.OPACIDADE / 100));
  339 + }
  340 + h = parseInt(
  341 + Dom.getStyle(
  342 + jm,
  343 + "height"),
  344 + 10);
  345 + if (h) {
  346 + Dom.setY(
  347 + jm,
  348 + Dom.getY(jm)
  349 + - h);
294 350 }
295   - h = parseInt(Dom.getStyle(jm,"height"),10);
296   - if(h)
297   - {Dom.setY(jm,Dom.getY(jm) - h);}
298 351 }
299 352 },
300   - /*
301   - Function: mostraLetreiro
302   -
303   - Preenche o elemento INPUT com a mensagem de texto e faz a movimenta&ccedil;&atilde;o das letras.
304   -
305   - O aparecimento das letras &eacute; controlado por um temporizador e asmensagens s&atilde;o mostradas apenas duas vezes,
306   - desde o in&iacute;cio do redesenho do mapa.
307   - */
308   - mostraLetreiro: function(){
309   - if(typeof(console) !== 'undefined'){console.info("i3GEO.ajuda.mostraLetreiro()");}
310   - for (var count=0; count<BPos; count += 1)
311   - {BSpaces+= " ";}
312   - if (BPos < 1){
313   - $i(i3GEO.ajuda.DIVLETREIRO).value = BMessage.substring(Math.abs(BPos), BMessage.length);
314   - if (BPos+BMessage.length < 1)
315   - {BPos = BSize;BQuantas = BQuantas + 1;}
  353 + /**
  354 + * Function: mostraLetreiro
  355 + *
  356 + * Preenche o elemento INPUT com a mensagem de texto e faz a
  357 + * movimenta&ccedil;&atilde;o das letras.
  358 + *
  359 + * O aparecimento das letras &eacute; controlado por um temporizador e as
  360 + * mensagens s&atilde;o mostradas apenas duas vezes, desde o in&iacute;cio
  361 + * do redesenho do mapa.
  362 + */
  363 + mostraLetreiro : function() {
  364 + for (var count = 0; count < BPos; count += 1) {
  365 + BSpaces += " ";
  366 + }
  367 + if (BPos < 1) {
  368 + $i(i3GEO.ajuda.DIVLETREIRO).value = BMessage.substring(
  369 + Math.abs(BPos),
  370 + BMessage.length);
  371 + if (BPos
  372 + + BMessage.length < 1) {
  373 + BPos = BSize;
  374 + BQuantas = BQuantas + 1;
  375 + }
  376 + } else {
  377 + $i(i3GEO.ajuda.DIVLETREIRO).value = BSpaces
  378 + + BMessage;
  379 + }
  380 + BPos -= BSpeed;
  381 + if (BQuantas < 2) {
  382 + i3GEO.ajuda.tempoLetreiro = setTimeout(
  383 + function() {
  384 + i3GEO.ajuda.mostraLetreiro();
  385 + },
  386 + 140);
316 387 }
317   - else
318   - {$i(i3GEO.ajuda.DIVLETREIRO).value = BSpaces + BMessage;}
319   - BPos-=BSpeed;
320   - if (BQuantas < 2)
321   - {i3GEO.ajuda.tempoLetreiro = setTimeout(function(){i3GEO.ajuda.mostraLetreiro();}, 140);}
322 388 },
323   - /*
324   - Function: redesSociais
325   -
326   - Abre uma janela com informa&ccedil;&otilde;es sobre a presen&ccedil;a do i3Geo em redes sociais
327   - */
328   - redesSociais: function(){
329   - if(typeof(console) !== 'undefined'){console.info("i3GEO.ajuda.redesSociais()");}
330   - i3GEO.janela.cria("400px","400px",i3GEO.configura.locaplic+"/ferramentas/redessociais/index.php","","",$trad("u5c"),YAHOO.util.Dom.generateId(null,"redes"));
  389 + /**
  390 + * Function: redesSociais
  391 + *
  392 + * Abre uma janela com informa&ccedil;&otilde;es sobre a presen&ccedil;a do
  393 + * i3Geo em redes sociais
  394 + */
  395 + redesSociais : function() {
  396 + i3GEO.janela.cria(
  397 + "400px",
  398 + "400px",
  399 + i3GEO.configura.locaplic
  400 + + "/ferramentas/redessociais/index.php",
  401 + "",
  402 + "",
  403 + $trad("u5c"),
  404 + YAHOO.util.Dom.generateId(
  405 + null,
  406 + "redes"));
331 407 }
332 408 };
333 409 \ No newline at end of file
... ...
classesjs/classe_analise.js
... ... @@ -33,1309 +33,1781 @@ GNU junto com este programa; se n&amp;atilde;o, escreva para a
33 33 Free Software Foundation, Inc., no endere&ccedil;o
34 34 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
35 35 */
36   -if(typeof(i3GEO) === 'undefined'){
  36 +if (typeof (i3GEO) === 'undefined') {
37 37 var i3GEO = {};
38 38 }
39 39 i3GEO.analise = {
40   - /*
41   - Classe: i3GEO.analise.dialogo
42   -
43   - Abre as telas de dialogo das opcoes de analise
44   -
45   - Exemplo:
46   -
47   - Para abrir a mensagem de dialogo de geracao de buffer, utilize
48   -
49   - i3GEO.analise.dialogo.buffer()
  40 + /**
  41 + * Classe: i3GEO.analise.dialogo
  42 + *
  43 + * Abre as telas de di&aacute;logo das op&ccedil;&otilde;es de an&aacute;lise
  44 + *
  45 + * Exemplo:
  46 + *
  47 + * Para abrir a mensagem de di&aacute;logo de gera&ccedil;&atilde;o de buffer, utilize
  48 + *
  49 + * i3GEO.analise.dialogo.buffer()
  50 + */
  51 + dialogo : {
  52 + /**
  53 + * Function: heatmap
  54 + *
  55 + * Ferramenta mapa de calor
50 56 */
51   - dialogo:{
52   - /*
53   - Function: heatmap
54   -
55   - Abre a janela de dialogo da ferramenta mapa de calor
56   - */
57   - heatmap: function(){
58   - i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.heatmap()","heatmap","heatmap");
59   - },
60   - /*
61   - Function: saiku
62   -
63   - Abre a janela de dialogo da ferramenta SAIKU
64   - */
65   - saiku: function(){
66   - i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.saiku()","saiku","saiku");
67   - },
68   - /*
69   - Function: graficoInterativo
70   -
71   - Abre a janela de dialogo da ferramenta graficointerativo versao flash
72   - */
73   - graficoInterativo: function(){
74   - i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.graficoInterativo()","graficointerativo","graficointerativo");
75   - },
76   - /*
77   - Function: graficoInterativo1
78   -
79   - Abre a janela de dialogo da ferramenta graficointerativo
80   - */
81   - graficoInterativo1: function(){
82   - i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.graficoInterativo1()","graficointerativo1","graficointerativo1");
83   - },
84   - /*
85   - Function: linhaDoTempo
86   -
87   - Abre a janela de dialogo da ferramenta linhadotempo
88   - */
89   - linhaDoTempo: function(){
90   - if(typeof(console) !== 'undefined'){console.info("i3GEO.analise.dialogo.linhaDoTempo()");}
91   - i3GEO.janela.cria(
92   - "450px",
93   - "350px",
94   - i3GEO.configura.locaplic+"/ferramentas/linhadotempo/index.php",
95   - "",
96   - "",
97   - "Linha do tempo <a class=ajuda_usuario target=_blank href='"+i3GEO.configura.locaplic+"/ajuda_usuario.php?idcategoria=3&idajuda=88' >&nbsp;&nbsp;&nbsp;</a>",
98   - "i3GEOF.linhaDoTempo",
99   - false,
100   - "hd",
101   - "",
102   - "",
103   - "",
104   - true,
105   - i3GEO.configura.locaplic+"/imagens/oxygen/16x16/clock.png"
106   - );
107   - atualizaLinhaDoTempo = function(){
108   - var doc = "", ifr = "";
109   - try{
110   - ifr = $i("wdocai");
111   - if (navn){
112   - if (ifr){
113   - doc = ifr.contentDocument;
114   - }
  57 + heatmap : function() {
  58 + i3GEO.util.dialogoFerramenta(
  59 + "i3GEO.analise.dialogo.heatmap()",
  60 + "heatmap",
  61 + "heatmap");
  62 + },
  63 + /**
  64 + * Function: saiku
  65 + *
  66 + * Ferramenta SAIKU
  67 + */
  68 + saiku : function() {
  69 + i3GEO.util.dialogoFerramenta(
  70 + "i3GEO.analise.dialogo.saiku()",
  71 + "saiku",
  72 + "saiku");
  73 + },
  74 + /**
  75 + *
  76 + * Ferramenta graficointerativo versao flash
  77 + */
  78 + graficoInterativo : function() {
  79 + i3GEO.util.dialogoFerramenta(
  80 + "i3GEO.analise.dialogo.graficoInterativo()",
  81 + "graficointerativo",
  82 + "graficointerativo");
  83 + },
  84 + /**
  85 + * Function: graficoInterativo1
  86 + *
  87 + * Ferramenta gr&aacute;fico interativo
  88 + */
  89 + graficoInterativo1 : function() {
  90 + i3GEO.util.dialogoFerramenta(
  91 + "i3GEO.analise.dialogo.graficoInterativo1()",
  92 + "graficointerativo1",
  93 + "graficointerativo1");
  94 + },
  95 + /**
  96 + * Function: linhaDoTempo
  97 + *
  98 + * Ferramenta linha do tempo
  99 + */
  100 + linhaDoTempo : function() {
  101 + i3GEO.janela.cria(
  102 + "450px",
  103 + "350px",
  104 + i3GEO.configura.locaplic
  105 + + "/ferramentas/linhadotempo/index.php",
  106 + "",
  107 + "",
  108 + "Linha do tempo <a class=ajuda_usuario target=_blank href='"
  109 + + i3GEO.configura.locaplic
  110 + + "/ajuda_usuario.php?idcategoria=3&idajuda=88' >&nbsp;&nbsp;&nbsp;</a>",
  111 + "i3GEOF.linhaDoTempo",
  112 + false,
  113 + "hd",
  114 + "",
  115 + "",
  116 + "",
  117 + true,
  118 + i3GEO.configura.locaplic
  119 + + "/imagens/oxygen/16x16/clock.png");
  120 + atualizaLinhaDoTempo = function() {
  121 + var doc = "", ifr = "";
  122 + try {
  123 + ifr = $i("wdocai");
  124 + if (navn) {
  125 + if (ifr) {
  126 + doc = ifr.contentDocument;
115 127 }
116   - else{
117   - if(document.frames("wdocai")){
118   - doc = document.frames("wdocai").document;
119   - }
  128 + } else {
  129 + if (document.frames("wdocai")) {
  130 + doc = document.frames("wdocai").document;
120 131 }
121   - doc.getElementById("tl") ? window.parent.wdocai.carregaDados() : i3GEO.eventos.NAVEGAMAPA.remove("atualizaLinhaDoTempo()");
122 132 }
123   - catch(e){
124   - i3GEO.eventos.NAVEGAMAPA.remove("atualizaLinhaDoTempo()");
125   - if(typeof(console) !== 'undefined'){console.error("i3GEO.analise.linhaDoTempo "+e);}
126   - }
127   - };
128   - if(i3GEO.eventos.NAVEGAMAPA.toString().search("atualizaLinhaDoTempo()") < 0)
129   - {i3GEO.eventos.NAVEGAMAPA.push("atualizaLinhaDoTempo()");}
130   - var ifr = $i("wdocai");
131   - //ifr.style.height = "75%";
132   - ifr.style.width = "100%";
133   - },
134   - /*
135   - Function: perfil
136   -
137   - Abre a janela de dialogo da ferramenta perfil
138   - */
139   - perfil: function(){
140   - i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.perfil()","perfil","perfil");
141   - },
142   - /*
143   - Function: gradePontos
144   -
145   - Abre a janela de dialogo da ferramenta gradepontos
146   - */
147   - gradePontos: function(){
148   - i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.gradePontos()","gradepontos","gradeDePontos");
149   - },
150   - /*
151   - Function: gradePol
152   -
153   - Abre a janela de dialogo da ferramenta gradepol
154   - */
155   - gradePol: function(){
156   - i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.gradePol()","gradepol","gradeDePoligonos");
157   - },
158   - /*
159   - Function: gradeHex
160   -
161   - Abre a janela de dialogo da ferramenta gradehex
162   - */
163   - gradeHex: function(){
164   - i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.gradeHex()","gradehex","gradeDeHex");
165   - },
166   - /*
167   - Function: analisaGeometrias
168   -
169   - Abre a janela de dialogo da ferramenta analisageometrias
170   - */
171   - analisaGeometrias: function(){
172   - i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.analisaGeometrias()","analisageometrias","analisaGeometrias");
173   - },
174   - /*
175   - Function: pontosdistri
176   -
177   - Abre a janela de dialogo da ferramenta pontosdistri
178   - */
179   - pontosdistri: function(){
180   - i3GEO.parametros.r === "nao" ? i3GEO.janela.tempoMsg($trad("x22")) : i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.pontosdistri()","pontosdistri","pontosDistri");
181   - },
182   - /*
183   - Function: pontoempoligono
184   -
185   - Abre a janela de dialogo da ferramenta pontoempoligono
186   - */
187   - pontoempoligono: function(){
188   - i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.pontoempoligono()","pontoempoligono","pontoEmPoligono");
189   - },
190   - /*
191   - Function: centromassa
192   -
193   - Abre a janela de dialogo da ferramenta centro medio
194   - */
195   - centromassa: function(){
196   - i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.centromassa()","centromassa","centromassa");
197   - },
198   - /*
199   - Function: nptPol
200   -
201   - Abre a janela de dialogo da ferramenta nptpol
202   - */
203   - nptPol: function(){
204   - i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.nptPol()","nptpol","nptpol");
205   - },
206   - /*
207   - Function: buffer
208   -
209   - Abre a janela de dialogo da ferramenta buffer
210   - */
211   - buffer: function(){
212   - i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.buffer()","buffer","buffer");
213   - },
214   - /*
215   - Function: distanciaptpt
216   -
217   - Abre a janela de dialogo da ferramenta distanciaptpt
218   - */
219   - distanciaptpt: function(){
220   - i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.distanciaptpt()","distanciaptpt","distanciaptpt");
221   - },
222   - /*
223   - Function: centroide
224   -
225   - Abre a janela de dialogo da ferramenta centroide
226   - */
227   - centroide: function(){
228   - i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.centroide()","centroide","centroide");
229   - },
230   - /*
231   - Function: dissolve
232   -
233   - Abre a janela de dialogo da ferramenta dissolve
234   - */
235   - dissolve: function(){
236   - i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.dissolve()","dissolve","dissolve");
237   - },
238   - /*
239   - Function: agrupaElementos
240   -
241   - Abre a janela de dialogo da ferramenta agrupaelementos
242   - */
243   - agrupaElementos: function(){
244   - i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.agrupaElementos()","agrupaelementos","agrupaElementos");
  133 + doc.getElementById("tl") ? window.parent.wdocai.carregaDados() : i3GEO.eventos.NAVEGAMAPA.remove("atualizaLinhaDoTempo()");
  134 + } catch (e) {
  135 + i3GEO.eventos.NAVEGAMAPA.remove("atualizaLinhaDoTempo()");
  136 + }
  137 + };
  138 + if (i3GEO.eventos.NAVEGAMAPA.toString().search(
  139 + "atualizaLinhaDoTempo()") < 0) {
  140 + i3GEO.eventos.NAVEGAMAPA.push("atualizaLinhaDoTempo()");
245 141 }
  142 + var ifr = $i("wdocai");
  143 + // ifr.style.height = "75%";
  144 + ifr.style.width = "100%";
246 145 },
247 146 /**
248   - * i3GEO.analise.medeDistancia
249   - * Ativa e controla a opcao de medicao de distancias.
250   - * A medida e feita quando o usuario clica no mapa com esta opcao ativa
251   - * Quando o botao e acionado, abre-se a janela que mostra o resultado da medida, o icone que segue o mouse e alterado.
252   - * Para mostrar o resultado do calculo, e incluido um div especifico.
  147 + * Function: perfil
  148 + *
  149 + * Ferramenta perfil
253 150 */
254   - medeDistancia:{
255   - /**
256   - * Armazena os pontos clicados para realizar os calculos
  151 + perfil : function() {
  152 + i3GEO.util.dialogoFerramenta(
  153 + "i3GEO.analise.dialogo.perfil()",
  154 + "perfil",
  155 + "perfil");
  156 + },
  157 + /**
  158 + * Function: gradePontos
  159 + *
  160 + * Ferramenta grade de pontos
  161 + */
  162 + gradePontos : function() {
  163 + i3GEO.util.dialogoFerramenta(
  164 + "i3GEO.analise.dialogo.gradePontos()",
  165 + "gradepontos",
  166 + "gradeDePontos");
  167 + },
  168 + /**
  169 + * Function: gradePol
  170 + *
  171 + * Ferramenta grade de pol&iacute;gonos
  172 + */
  173 + gradePol : function() {
  174 + i3GEO.util.dialogoFerramenta(
  175 + "i3GEO.analise.dialogo.gradePol()",
  176 + "gradepol",
  177 + "gradeDePoligonos");
  178 + },
  179 + /**
  180 + * Function: gradeHex
  181 + *
  182 + * Ferramenta grade de hex&aacute;gonos
  183 + */
  184 + gradeHex : function() {
  185 + i3GEO.util.dialogoFerramenta(
  186 + "i3GEO.analise.dialogo.gradeHex()",
  187 + "gradehex",
  188 + "gradeDeHex");
  189 + },
  190 + /**
  191 + * Function: analisaGeometrias
  192 + *
  193 + * Ferramenta de an&aacute;lise de geometrias
  194 + */
  195 + analisaGeometrias : function() {
  196 + i3GEO.util.dialogoFerramenta(
  197 + "i3GEO.analise.dialogo.analisaGeometrias()",
  198 + "analisageometrias",
  199 + "analisaGeometrias");
  200 + },
  201 + /**
  202 + * Function: pontosdistri
  203 + *
  204 + * Ferramenta de c&aacute;lculo de distribui&ccedil;&atilde;o de pontos
  205 + */
  206 + pontosdistri : function() {
  207 + i3GEO.parametros.r === "nao" ? i3GEO.janela.tempoMsg($trad("x22")) : i3GEO.util.dialogoFerramenta(
  208 + "i3GEO.analise.dialogo.pontosdistri()",
  209 + "pontosdistri",
  210 + "pontosDistri");
  211 + },
  212 + /**
  213 + * Function: pontoempoligono
  214 + *
  215 + * Ferramenta ponto em pol&iacute;gono
  216 + */
  217 + pontoempoligono : function() {
  218 + i3GEO.util.dialogoFerramenta(
  219 + "i3GEO.analise.dialogo.pontoempoligono()",
  220 + "pontoempoligono",
  221 + "pontoEmPoligono");
  222 + },
  223 + /**
  224 + * Function: centromassa
  225 + *
  226 + * Ferramenta centro m&eacute;dio
  227 + */
  228 + centromassa : function() {
  229 + i3GEO.util.dialogoFerramenta(
  230 + "i3GEO.analise.dialogo.centromassa()",
  231 + "centromassa",
  232 + "centromassa");
  233 + },
  234 + /**
  235 + * Function: nptPol
  236 + *
  237 + * Ferramenta n&uacute;mero de pontos em pol&iacute;gono
  238 + */
  239 + nptPol : function() {
  240 + i3GEO.util.dialogoFerramenta(
  241 + "i3GEO.analise.dialogo.nptPol()",
  242 + "nptpol",
  243 + "nptpol");
  244 + },
  245 + /**
  246 + * Function: buffer
  247 + *
  248 + * Ferramenta buffer
  249 + */
  250 + buffer : function() {
  251 + i3GEO.util.dialogoFerramenta(
  252 + "i3GEO.analise.dialogo.buffer()",
  253 + "buffer",
  254 + "buffer");
  255 + },
  256 + /**
  257 + * Function: distanciaptpt
  258 + *
  259 + * Ferramenta dist&acirc;ncia entre pontos
  260 + */
  261 + distanciaptpt : function() {
  262 + i3GEO.util.dialogoFerramenta(
  263 + "i3GEO.analise.dialogo.distanciaptpt()",
  264 + "distanciaptpt",
  265 + "distanciaptpt");
  266 + },
  267 + /**
  268 + * Function: centroide
  269 + *
  270 + * Ferramenta centr&oacute;ide
  271 + */
  272 + centroide : function() {
  273 + i3GEO.util.dialogoFerramenta(
  274 + "i3GEO.analise.dialogo.centroide()",
  275 + "centroide",
  276 + "centroide");
  277 + },
  278 + /**
  279 + * Function: dissolve
  280 + *
  281 + * Ferramenta dissolve bordas comuns
  282 + */
  283 + dissolve : function() {
  284 + i3GEO.util.dialogoFerramenta(
  285 + "i3GEO.analise.dialogo.dissolve()",
  286 + "dissolve",
  287 + "dissolve");
  288 + },
  289 + /**
  290 + * Function: agrupaElementos
  291 + *
  292 + * Ferramenta agrupa elementos
  293 + */
  294 + agrupaElementos : function() {
  295 + i3GEO.util.dialogoFerramenta(
  296 + "i3GEO.analise.dialogo.agrupaElementos()",
  297 + "agrupaelementos",
  298 + "agrupaElementos");
  299 + }
  300 + },
  301 + /***************************************************************************
  302 + * Class: medeDistancia
  303 + *
  304 + * Ativa e controla a op&ccedil;&atilde;o de medi&ccedil;&atilde;o de
  305 + * dist&acirc;ncias. A medida &eacute; feita quando o usu&aacute;rio clica no mapa com esta
  306 + * op&ccedil;&atilde;o ativa. Quando o bot&atilde;o e acionado, abre-se a janela que mostra o
  307 + * resultado da medida, o &iacute;cone que segue o mouse &eacute; alterado. Para mostrar o
  308 + * resultado do c&aacute;lculo, &eacute; incluido um div espec&iacute;fico.
  309 + */
  310 + medeDistancia : {
  311 + /***********************************************************************
  312 + * Armazena os pontos clicados para realizar os calculos
  313 + */
  314 + pontos : {},
  315 + /***********************************************************************
  316 + * Function: inicia
  317 + *
  318 + * Inicia a opera&ccedil;&atilde;o de medi&ccedil;&atilde;o, abrindo a janela de resultados e
  319 + * criando os componentes necess&aacute;rios. S&atilde;o registrados os eventos de
  320 + * clique sobre o mapa e fechamento da janela de resultados
  321 + */
  322 + inicia : function() {
  323 + i3GEO.eventos.cliquePerm.desativa();
  324 + i3GEO.analise.medeDistancia.criaJanela();
  325 + i3GEO.analise.medeDistancia[i3GEO.Interface["ATUAL"]].inicia();
  326 + },
  327 + /***********************************************************************
  328 + * Cria a janela para mostrar os resultados da medicao
  329 + */
  330 + criaJanela : function() {
  331 + var novoel, ins, imagemxy, janela;
  332 + if (!$i("mostradistancia")) {
  333 + novoel = document.createElement("div");
  334 + novoel.id = "mostradistancia";
  335 + ins = '<div class="hd" style="font-size:11px">&nbsp;Dist&acirc;ncia aproximada <a class=ajuda_usuario target=_blank href="'
  336 + + i3GEO.configura.locaplic
  337 + + '/ajuda_usuario.php?idcategoria=6&idajuda=50" >&nbsp;&nbsp;&nbsp;</a></div>'
  338 + + '<div class="bd" style="text-align:left;padding:3px;" >'
  339 + + '<div style="text-align:left;padding:3px;" id="mostradistancia_calculo" ></div>'
  340 + + '<div style="text-align:left;padding:3px;" id="mostradistancia_calculo_movel" ></div>'
  341 + + '<div style="text-align:left;font-size:10px" >'
  342 + + '<span style="color:navy;cursor:pointer;text-align:left;" >'
  343 + + '<table class=lista7 ><tr><td><input style="cursor:pointer" type="checkbox" id="pararraios" checked /></td><td>Raios</td><td>&nbsp;</td>'
  344 + + '<td>'
  345 + + '<input style="cursor:pointer" type="checkbox" id="parartextos" checked />'
  346 + + '</td><td>Textos<td>'
  347 + + '<td>&nbsp;Estilo:</td><td>'
  348 + + i3GEO.desenho.caixaEstilos()
  349 + + '</td>'
  350 + + '<td>&nbsp;<input id=i3GEObotaoPerfil size="22" type="button" value="perfil"></td>'
  351 + + '</tr></table></span>'
  352 + + '</div>'
  353 + + '</div>';
  354 + novoel.innerHTML = ins;
  355 + novoel.style.borderColor = "gray";
  356 + document.body.appendChild(novoel);
  357 + janela = new YAHOO.widget.Panel(
  358 + "mostradistancia",
  359 + {
  360 + iframe : true,
  361 + width : "330px",
  362 + fixedcenter : false,
  363 + constraintoviewport : true,
  364 + underlay : "none",
  365 + close : true,
  366 + visible : true,
  367 + draggable : true,
  368 + modal : false
  369 + });
  370 + YAHOO.i3GEO.janela.manager.register(janela);
  371 + janela.render();
  372 + YAHOO.util.Event.addListener(
  373 + janela.close,
  374 + "click",
  375 + i3GEO.analise.medeDistancia.fechaJanela);
  376 + } else {
  377 + i3GEO.util.defineValor(
  378 + "mostradistancia_calculo",
  379 + "innerHTML",
  380 + "");
  381 + janela = YAHOO.i3GEO.janela.manager.find("mostradistancia");
  382 + }
  383 + janela.show();
  384 + imagemxy = i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO));
  385 + janela.moveTo(
  386 + imagemxy[0] + 150,
  387 + imagemxy[1]);
  388 + //
  389 + // botao que abre a ferramenta de calculo de perfis.
  390 + // pontosdistobj contem as coordenadas dos pontos
  391 + //
  392 + new YAHOO.widget.Button(
  393 + "i3GEObotaoPerfil",
  394 + {
  395 + onclick : {
  396 + fn : function() {
  397 + var js = i3GEO.configura.locaplic
  398 + + "/ferramentas/perfil/index.js";
  399 + i3GEO.util.scriptTag(
  400 + js,
  401 + "i3GEOF.perfil.criaJanelaFlutuante(i3GEO.analise.pontosdistobj)",
  402 + "i3GEOF.perfil_script");
  403 + }
  404 + }
  405 + });
  406 + },
  407 + /***********************************************************************
  408 + * Fecha a janela e os elementos graficos criados para a ferramenta de
  409 + * medicao Chama a funcao de cada interface que complementam o processo
  410 + * de fechamento da janela
  411 + */
  412 + fechaJanela : function() {
  413 + var janela;
  414 + i3GEO.eventos.cliquePerm.ativa();
  415 + janela = YAHOO.i3GEO.janela.manager.find("mostradistancia");
  416 + if (janela) {
  417 + YAHOO.i3GEO.janela.manager.remove(janela);
  418 + janela.destroy();
  419 + }
  420 + i3GEO.barraDeBotoes.ativaIcone("pointer");
  421 + i3GEO.analise.medeDistancia[i3GEO.Interface["ATUAL"]].fechaJanela();
  422 + },
  423 + /***********************************************************************
  424 + * Funcoes especificas da interface openlayers
  425 + */
  426 + openlayers : {
  427 + /*******************************************************************
  428 + * Inicializa o processo Cria a variavel para guardar os pontos
  429 + * Executa a funcao de inicializacao do desenho, que cria o layer
  430 + * para receber os graficos
257 431 */
258   - pontos: {},
259   - /**
260   - * Inicia a operacao de medicao, abrindo a janela de resultados e criando os componentes necessorios
261   - * Sao registrados os eventos de clique sobre o mapa e fechamento da janela de resultados
  432 + inicia : function() {
  433 + var linha, estilo = i3GEO.desenho.estilos[i3GEO.desenho.estiloPadrao], controle = i3geoOL.getControlsBy(
  434 + "id",
  435 + "i3GeoMedeDistancia");
  436 + i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia();
  437 + i3GEO.analise.medeDistancia.pontos = {
  438 + xpt : [],
  439 + ypt : [],
  440 + dist : []
  441 + };
  442 + if (controle.length === 0) {
  443 + linha = new OpenLayers.Control.DrawFeature(
  444 + i3GEO.desenho.layergrafico,
  445 + OpenLayers.Handler.Path,
  446 + {
  447 + autoActivate : true,
  448 + id : "i3GeoMedeDistancia",
  449 + type : OpenLayers.Control.TYPE_TOOL,
  450 + callbacks : {
  451 + done : function(feature) {
  452 + var f = new OpenLayers.Feature.Vector(
  453 + feature,
  454 + {
  455 + origem : "medeDistancia"
  456 + },
  457 + {
  458 + graphicName : "square",
  459 + pointRadius : 10,
  460 + graphicOpacity : 1,
  461 + strokeWidth : estilo.linewidth,
  462 + strokeColor : estilo.linecolor
  463 + });
  464 + i3GEO.desenho.layergrafico.addFeatures([
  465 + f
  466 + ]);
  467 + if (i3GEO.Interface) {
  468 + i3GEO.Interface.openlayers.sobeLayersGraficos();
  469 + }
  470 + i3GEO.analise.medeDistancia.openlayers.mostraParcial(
  471 + 0,
  472 + 0,
  473 + 0);
  474 + i3GEO.analise.medeDistancia.openlayers.inicia();
  475 + },
  476 + modify : function(point) {
  477 + var n, x1, y1, x2, y2, trecho, parcial, direcao;
  478 + n = i3GEO.analise.medeDistancia.pontos.ypt.length;
  479 + if (n > 0) {
  480 + x1 = i3GEO.analise.medeDistancia.pontos.xpt[n - 1];
  481 + y1 = i3GEO.analise.medeDistancia.pontos.ypt[n - 1];
  482 + x2 = point.x;
  483 + y2 = point.y;
  484 + // projeta
  485 + if (i3GEO.Interface.openlayers.googleLike) {
  486 + temp = i3GEO.util.extOSM2Geo(x1
  487 + + " "
  488 + + y1
  489 + + " "
  490 + + x2
  491 + + " "
  492 + + y2);
  493 + temp = temp.split(" ");
  494 + x1 = temp[0];
  495 + y1 = temp[1];
  496 + x2 = temp[2];
  497 + y2 = temp[3];
  498 + }
  499 + trecho = i3GEO.calculo.distancia(
  500 + x1,
  501 + y1,
  502 + x2,
  503 + y2);
  504 + parcial = i3GEO.analise.medeDistancia.openlayers.somaDist();
  505 + direcao = i3GEO.calculo.direcao(
  506 + x1,
  507 + y1,
  508 + x2,
  509 + y2);
  510 + direcao = i3GEO.calculo.dd2dms(
  511 + direcao,
  512 + direcao);
  513 + direcao = direcao[0];
  514 + i3GEO.analise.medeDistancia.openlayers.mostraParcial(
  515 + trecho,
  516 + parcial,
  517 + direcao);
  518 + }
  519 + },
  520 + point : function(point) {
  521 + var n, x1, y1, x2, y2, trecho, temp, circ, label, raio, pontoRaio,
  522 + // registra os pontos e calcula a distancia
  523 + total = 0;
  524 + i3GEO.analise.medeDistancia.pontos.xpt.push(point.x);
  525 + i3GEO.analise.medeDistancia.pontos.ypt.push(point.y);
  526 + n = i3GEO.analise.medeDistancia.pontos.ypt.length;
  527 + if (n > 1) {
  528 + x1 = i3GEO.analise.medeDistancia.pontos.xpt[n - 2];
  529 + y1 = i3GEO.analise.medeDistancia.pontos.ypt[n - 2];
  530 + x2 = point.x;
  531 + y2 = point.y;
  532 + raio = point.distanceTo(new OpenLayers.Geometry.Point(
  533 + x1,
  534 + y1));
  535 + pontoRaio = new OpenLayers.Geometry.Point(
  536 + x1,
  537 + y1);
  538 + // projeta
  539 + if (i3GEO.Interface.openlayers.googleLike) {
  540 + temp = i3GEO.util.extOSM2Geo(x1
  541 + + " "
  542 + + y1
  543 + + " "
  544 + + x2
  545 + + " "
  546 + + y2);
  547 + temp = temp.split(" ");
  548 + x1 = temp[0];
  549 + y1 = temp[1];
  550 + x2 = temp[2];
  551 + y2 = temp[3];
  552 + }
  553 + trecho = i3GEO.calculo.distancia(
  554 + x1,
  555 + y1,
  556 + x2,
  557 + y2);
  558 + i3GEO.analise.medeDistancia.pontos.dist.push(trecho);
  559 + total = i3GEO.analise.medeDistancia.openlayers.somaDist();
  560 + i3GEO.analise.medeDistancia.openlayers.mostraTotal(
  561 + trecho,
  562 + total);
  563 + // raio
  564 + if ($i("pararraios")
  565 + && $i("pararraios").checked === true) {
  566 + circ = new OpenLayers.Feature.Vector(
  567 + OpenLayers.Geometry.Polygon.createRegularPolygon(
  568 + pontoRaio,
  569 + raio,
  570 + 30),
  571 + {
  572 + origem : "medeDistanciaExcluir"
  573 + },
  574 + {
  575 + fill : false,
  576 + strokeColor : estilo.circcolor,
  577 + strokeWidth : 1
  578 + });
  579 + i3GEO.desenho.layergrafico.addFeatures([
  580 + circ
  581 + ]);
  582 + }
  583 + // desenha ponto
  584 + if ($i("parartextos")
  585 + && $i("parartextos").checked === true) {
  586 + label = new OpenLayers.Feature.Vector(
  587 + new OpenLayers.Geometry.Point(
  588 + point.x,
  589 + point.y),
  590 + {
  591 + origem : "medeDistanciaExcluir"
  592 + },
  593 + {
  594 + graphicName : "square",
  595 + pointRadius : 3,
  596 + strokeColor : "black",
  597 + graphicOpacity : 1,
  598 + strokeWidth : 1,
  599 + fillColor : "white",
  600 + label : trecho.toFixed(3),
  601 + labelAlign : "rb",
  602 + fontColor : estilo.textcolor,
  603 + fontSize : 12,
  604 + fontWeight : "bold"
  605 + });
  606 + i3GEO.desenho.layergrafico.addFeatures([
  607 + label
  608 + ]);
  609 + }
  610 + }
  611 + }
  612 + }
  613 + });
  614 + i3geoOL.addControl(linha);
  615 + }
  616 + },
  617 + /*******************************************************************
  618 + * Soma os valores de distancia guardados em pontos.dist
262 619 */
263   - inicia: function(){
264   - if(typeof(console) !== 'undefined'){console.info("i3GEO.analise.medeDistancia.inicia()");}
265   - i3GEO.eventos.cliquePerm.desativa();
266   - i3GEO.analise.medeDistancia.criaJanela();
267   - i3GEO.analise.medeDistancia[i3GEO.Interface["ATUAL"]].inicia();
  620 + somaDist : function() {
  621 + var n, i, total = 0;
  622 + n = i3GEO.analise.medeDistancia.pontos.dist.length;
  623 + for (i = 0; i < n; i++) {
  624 + total += i3GEO.analise.medeDistancia.pontos.dist[i];
  625 + }
  626 + return total;
268 627 },
269   - /**
270   - * Cria a janela para mostrar os resultados da medicao
  628 + /*******************************************************************
  629 + * Fecha a janela que mostra os dados Pergunta ao usuario se os
  630 + * graficos devem ser removidos Os graficos sao marcados com o
  631 + * atributo "origem" Os raios e pontos sao sempre removidos
271 632 */
272   - criaJanela: function(){
273   - var novoel,ins,imagemxy,janela;
274   - if (!$i("mostradistancia")){
275   - novoel = document.createElement("div");
276   - novoel.id = "mostradistancia";
277   - ins = '<div class="hd" style="font-size:11px">&nbsp;Dist&acirc;ncia aproximada <a class=ajuda_usuario target=_blank href="'+i3GEO.configura.locaplic+'/ajuda_usuario.php?idcategoria=6&idajuda=50" >&nbsp;&nbsp;&nbsp;</a></div>' +
278   - '<div class="bd" style="text-align:left;padding:3px;" >' +
279   - '<div style="text-align:left;padding:3px;" id="mostradistancia_calculo" ></div>' +
280   - '<div style="text-align:left;padding:3px;" id="mostradistancia_calculo_movel" ></div>' +
281   - '<div style="text-align:left;font-size:10px" >' +
282   - '<span style="color:navy;cursor:pointer;text-align:left;" >' +
283   - '<table class=lista7 ><tr><td><input style="cursor:pointer" type="checkbox" id="pararraios" checked /></td><td>Raios</td><td>&nbsp;</td>' +
284   - '<td>' +
285   - '<input style="cursor:pointer" type="checkbox" id="parartextos" checked />' +
286   - '</td><td>Textos<td>' +
287   - '<td>&nbsp;Estilo:</td><td>'+i3GEO.desenho.caixaEstilos()+'</td>' +
288   - '<td>&nbsp;<input id=i3GEObotaoPerfil size="22" type="button" value="perfil"></td>' +
289   - '</tr></table></span>' +
290   - '</div>' +
291   - '</div>';
292   - novoel.innerHTML = ins;
293   - novoel.style.borderColor="gray";
294   - document.body.appendChild(novoel);
295   - janela = new YAHOO.widget.Panel("mostradistancia", {iframe:true,width:"330px",fixedcenter: false, constraintoviewport: true, underlay:"none", close:true, visible:true, draggable:true, modal:false } );
296   - YAHOO.i3GEO.janela.manager.register(janela);
297   - janela.render();
298   - YAHOO.util.Event.addListener(janela.close, "click", i3GEO.analise.medeDistancia.fechaJanela);
  633 + fechaJanela : function() {
  634 + var temp, controle = i3geoOL.getControlsBy(
  635 + "id",
  636 + "i3GeoMedeDistancia"), f = i3GEO.desenho.layergrafico.getFeaturesByAttribute(
  637 + "origem",
  638 + "medeDistancia");
  639 + if (controle.length > 0) {
  640 + controle[0].deactivate();
  641 + i3geoOL.removeControl(controle[0]);
299 642 }
300   - else{
301   - i3GEO.util.defineValor("mostradistancia_calculo","innerHTML","");
302   - janela = YAHOO.i3GEO.janela.manager.find("mostradistancia");
  643 + if (f
  644 + && f.length > 0) {
  645 + temp = window.confirm($trad("x94"));
  646 + if (temp) {
  647 + i3GEO.desenho.layergrafico.destroyFeatures(f);
  648 + }
  649 + }
  650 + f = i3GEO.desenho.layergrafico.getFeaturesByAttribute(
  651 + "origem",
  652 + "medeDistanciaExcluir");
  653 + if (f
  654 + && f.length > 0) {
  655 + i3GEO.desenho.layergrafico.destroyFeatures(f);
303 656 }
304   - janela.show();
305   - imagemxy = i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO));
306   - janela.moveTo(imagemxy[0]+150,imagemxy[1]);
307   - //
308   - //botao que abre a ferramenta de calculo de perfis.
309   - //pontosdistobj contem as coordenadas dos pontos
310   - //
311   - new YAHOO.widget.Button(
312   - "i3GEObotaoPerfil",
313   - {onclick:{fn: function(){
314   - var js = i3GEO.configura.locaplic+"/ferramentas/perfil/index.js";
315   - i3GEO.util.scriptTag(js,"i3GEOF.perfil.criaJanelaFlutuante(i3GEO.analise.pontosdistobj)","i3GEOF.perfil_script");
316   - }}}
317   - );
318 657 },
319   - /**
320   - *Fecha a janela e os elementos graficos criados para a ferramenta de medicao
321   - *Chama a funcao de cada interface que complementam o processo de fechamento da janela
  658 + /*******************************************************************
  659 + * Mostra a totalizacao das linhas ja digitalizadas
322 660 */
323   - fechaJanela: function(){
324   - var janela;
325   - i3GEO.eventos.cliquePerm.ativa();
326   - janela = YAHOO.i3GEO.janela.manager.find("mostradistancia");
327   - if(janela){
328   - YAHOO.i3GEO.janela.manager.remove(janela);
329   - janela.destroy();
  661 + mostraTotal : function(trecho, total) {
  662 + var mostra = $i("mostradistancia_calculo"), texto;
  663 + if (mostra) {
  664 + texto = "<b>"
  665 + + $trad("x96")
  666 + + ":</b> "
  667 + + total.toFixed(3)
  668 + + " km"
  669 + + "<br><b>"
  670 + + $trad("x96")
  671 + + ":</b> "
  672 + + (total * 1000).toFixed(2)
  673 + + " m"
  674 + + "<br>"
  675 + + $trad("x25")
  676 + + ": "
  677 + + i3GEO.calculo.metododistancia;
  678 + mostra.innerHTML = texto;
330 679 }
331   - i3GEO.barraDeBotoes.ativaIcone("pointer");
332   - i3GEO.analise.medeDistancia[i3GEO.Interface["ATUAL"]].fechaJanela();
333 680 },
334   - /**
335   - * Funcoes especificas da interface openlayers
  681 + /*******************************************************************
  682 + * Mostra o valor do trecho entre o ultimo ponto clicado e a posicao
  683 + * do mouse
336 684 */
337   - openlayers:{
338   - /**
339   - * Inicializa o processo
340   - * Cria a variavel para guardar os pontos
341   - * Executa a funcao de inicializacao do desenho, que cria o layer para receber os graficos
342   - */
343   - inicia: function(){
344   - var linha,
345   - estilo = i3GEO.desenho.estilos[i3GEO.desenho.estiloPadrao],
346   - controle = i3geoOL.getControlsBy("id","i3GeoMedeDistancia");
347   - i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia();
348   - i3GEO.analise.medeDistancia.pontos = {
349   - xpt: [],
350   - ypt: [],
351   - dist: []
352   - };
353   - if(controle.length === 0){
354   - linha = new OpenLayers.Control.DrawFeature(
355   - i3GEO.desenho.layergrafico,
356   - OpenLayers.Handler.Path,
357   - {
358   - autoActivate: true,
359   - id: "i3GeoMedeDistancia",
360   - type: OpenLayers.Control.TYPE_TOOL,
361   - callbacks:{
362   - done: function(feature){
363   - var f = new OpenLayers.Feature.Vector(
364   - feature,
365   - {
366   - origem: "medeDistancia"
367   - },
368   - {
369   - graphicName: "square",
370   - pointRadius: 10,
371   - graphicOpacity: 1,
372   - strokeWidth: estilo.linewidth,
373   - strokeColor: estilo.linecolor
374   - }
375   - );
376   - i3GEO.desenho.layergrafico.addFeatures([f]);
377   - if(i3GEO.Interface){
378   - i3GEO.Interface.openlayers.sobeLayersGraficos();
379   - }
380   - i3GEO.analise.medeDistancia.openlayers.mostraParcial(0,0,0);
381   - i3GEO.analise.medeDistancia.openlayers.inicia();
382   - },
383   - modify: function(point){
384   - var n,x1,y1,x2,y2,trecho,parcial,direcao;
385   - n = i3GEO.analise.medeDistancia.pontos.ypt.length;
386   - if(n > 0){
387   - x1 = i3GEO.analise.medeDistancia.pontos.xpt[n-1];
388   - y1 = i3GEO.analise.medeDistancia.pontos.ypt[n-1];
389   - x2 = point.x;
390   - y2 = point.y;
391   - //projeta
392   - if(i3GEO.Interface.openlayers.googleLike){
393   - temp = i3GEO.util.extOSM2Geo(x1+" "+y1+" "+x2+" "+y2);
394   - temp = temp.split(" ");
395   - x1 = temp[0];
396   - y1 = temp[1];
397   - x2 = temp[2];
398   - y2 = temp[3];
399   - }
400   - trecho = i3GEO.calculo.distancia(x1,y1,x2,y2);
401   - parcial = i3GEO.analise.medeDistancia.openlayers.somaDist();
402   - direcao = i3GEO.calculo.direcao(x1,y1,x2,y2);
403   - direcao = i3GEO.calculo.dd2dms(direcao,direcao);
404   - direcao = direcao[0];
405   - i3GEO.analise.medeDistancia.openlayers.mostraParcial(trecho,parcial,direcao);
406   - }
407   - },
408   - point: function(point){
409   - var n,x1,y1,x2,y2,trecho,temp,circ,label,raio,pontoRaio,
410   - //registra os pontos e calcula a distancia
411   - total = 0;
412   - i3GEO.analise.medeDistancia.pontos.xpt.push(point.x);
413   - i3GEO.analise.medeDistancia.pontos.ypt.push(point.y);
414   - n = i3GEO.analise.medeDistancia.pontos.ypt.length;
415   - if(n > 1){
416   - x1 = i3GEO.analise.medeDistancia.pontos.xpt[n-2];
417   - y1 = i3GEO.analise.medeDistancia.pontos.ypt[n-2];
418   - x2 = point.x;
419   - y2 = point.y;
420   - raio = point.distanceTo(new OpenLayers.Geometry.Point(x1,y1));
421   - pontoRaio = new OpenLayers.Geometry.Point(x1,y1);
422   - //projeta
423   - if(i3GEO.Interface.openlayers.googleLike){
424   - temp = i3GEO.util.extOSM2Geo(x1+" "+y1+" "+x2+" "+y2);
425   - temp = temp.split(" ");
426   - x1 = temp[0];
427   - y1 = temp[1];
428   - x2 = temp[2];
429   - y2 = temp[3];
430   - }
431   - trecho = i3GEO.calculo.distancia(x1,y1,x2,y2);
432   - i3GEO.analise.medeDistancia.pontos.dist.push(trecho);
433   - total = i3GEO.analise.medeDistancia.openlayers.somaDist();
434   - i3GEO.analise.medeDistancia.openlayers.mostraTotal(trecho,total);
435   - //raio
436   - if($i("pararraios") && $i("pararraios").checked === true ){
437   - circ = new OpenLayers.Feature.Vector(
438   - OpenLayers.Geometry.Polygon.createRegularPolygon(
439   - pontoRaio,
440   - raio,
441   - 30
442   - ),
443   - {
444   - origem: "medeDistanciaExcluir"
445   - },
446   - {
447   - fill: false,
448   - strokeColor: estilo.circcolor,
449   - strokeWidth: 1
450   - }
451   - );
452   - i3GEO.desenho.layergrafico.addFeatures([circ]);
453   - }
454   - //desenha ponto
455   - if($i("parartextos") && $i("parartextos").checked === true ){
456   - label = new OpenLayers.Feature.Vector(
457   - new OpenLayers.Geometry.Point(point.x,point.y),
458   - {
459   - origem: "medeDistanciaExcluir"
460   - },
461   - {
462   - graphicName: "square",
463   - pointRadius: 3,
464   - strokeColor: "black",
465   - graphicOpacity: 1,
466   - strokeWidth: 1,
467   - fillColor: "white",
468   - label: trecho.toFixed(3),
469   - labelAlign: "rb",
470   - fontColor: estilo.textcolor,
471   - fontSize: 12,
472   - fontWeight: "bold"
473   - }
474   - );
475   - i3GEO.desenho.layergrafico.addFeatures([label]);
476   - }
477   - }
478   - }
479   - }
480   - }
481   - );
482   - i3geoOL.addControl(linha);
483   - }
484   - },
485   - /**
486   - * Soma os valores de distancia guardados em pontos.dist
487   - */
488   - somaDist: function(){
489   - var n,i,
490   - total = 0;
491   - n = i3GEO.analise.medeDistancia.pontos.dist.length;
492   - for(i=0;i<n;i++){
493   - total += i3GEO.analise.medeDistancia.pontos.dist[i];
494   - }
495   - return total;
496   - },
497   - /**
498   - * Fecha a janela que mostra os dados
499   - * Pergunta ao usuario se os graficos devem ser removidos
500   - * Os graficos sao marcados com o atributo "origem"
501   - * Os raios e pontos sao sempre removidos
502   - */
503   - fechaJanela: function(){
504   - var temp,
505   - controle = i3geoOL.getControlsBy("id","i3GeoMedeDistancia"),
506   - f = i3GEO.desenho.layergrafico.getFeaturesByAttribute("origem","medeDistancia");
507   - if(controle.length > 0){
508   - controle[0].deactivate();
509   - i3geoOL.removeControl(controle[0]);
510   - }
511   - if(f && f.length > 0){
512   - temp = window.confirm($trad("x94"));
513   - if(temp){
514   - i3GEO.desenho.layergrafico.destroyFeatures(f);
515   - }
516   - }
517   - f = i3GEO.desenho.layergrafico.getFeaturesByAttribute("origem","medeDistanciaExcluir");
518   - if(f && f.length > 0){
519   - i3GEO.desenho.layergrafico.destroyFeatures(f);
520   - }
521   - },
522   - /**
523   - * Mostra a totalizacao das linhas ja digitalizadas
524   - */
525   - mostraTotal: function(trecho,total){
526   - var mostra = $i("mostradistancia_calculo"),
527   - texto;
528   - if (mostra){
529   - texto = "<b>"+$trad("x96")+":</b> "+total.toFixed(3)+" km"+
530   - "<br><b>"+$trad("x96")+":</b> "+(total*1000).toFixed(2)+" m"+
531   - "<br>"+$trad("x25")+": "+i3GEO.calculo.metododistancia;
532   - mostra.innerHTML = texto;
533   - }
534   - },
535   - /**
536   - * Mostra o valor do trecho entre o ultimo ponto clicado e a posicao do mouse
537   - */
538   - mostraParcial: function(trecho,parcial,direcao){
539   - var mostra = $i("mostradistancia_calculo_movel"),
540   - texto;
541   - if (mostra){
542   - texto = "<b>"+$trad("x95")+":</b> "+trecho.toFixed(3)+" km"+
543   - "<br><b>"+$trad("x97")+":</b> "+(parcial + trecho).toFixed(3)+" km" +
544   - "<br><b>"+$trad("x23")+" (DMS):</b> "+direcao;
545   - mostra.innerHTML = texto;
546   - }
  685 + mostraParcial : function(trecho, parcial, direcao) {
  686 + var mostra = $i("mostradistancia_calculo_movel"), texto;
  687 + if (mostra) {
  688 + texto = "<b>"
  689 + + $trad("x95")
  690 + + ":</b> "
  691 + + trecho.toFixed(3)
  692 + + " km"
  693 + + "<br><b>"
  694 + + $trad("x97")
  695 + + ":</b> "
  696 + + (parcial + trecho).toFixed(3)
  697 + + " km"
  698 + + "<br><b>"
  699 + + $trad("x23")
  700 + + " (DMS):</b> "
  701 + + direcao;
  702 + mostra.innerHTML = texto;
547 703 }
548   - },
549   - googlemaps:{
550   - /**
551   - * Inicializa o processo
552   - * Cria a variavel para guardar os pontos
553   - * Executa a funcao de inicializacao do desenho, que cria o layer para receber os graficos
554   - */
555   - inicia: function(){
556   - i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia();
557   - i3GeoMap.setOptions({disableDoubleClickZoom:true});
558   - i3GeoMap.setOptions({draggableCursor:'crosshair'});
559   - var evtdblclick = null,evtclick = null,evtmousemove = null,
560   - pontos = {
561   - xpt: [],
562   - ypt: [],
563   - dist: [],
564   - mvcLine: new google.maps.MVCArray(),
565   - mvcMarkers: new google.maps.MVCArray(),
566   - line: null,
567   - polygon: null
568   - },
569   - termina = function(){
570   - google.maps.event.removeListener(evtdblclick);
571   - google.maps.event.removeListener(evtclick);
572   - google.maps.event.removeListener(evtmousemove);
573   - pontos.line.setOptions({clickable: true});
574   - google.maps.event.addListener(pontos.line, 'click', function(shape) {
575   - if(shape.setEditable){
  704 + }
  705 + },
  706 + googlemaps : {
  707 + /*******************************************************************
  708 + * Inicializa o processo Cria a variavel para guardar os pontos
  709 + * Executa a funcao de inicializacao do desenho, que cria o layer
  710 + * para receber os graficos
  711 + */
  712 + inicia : function() {
  713 + i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia();
  714 + i3GeoMap.setOptions({
  715 + disableDoubleClickZoom : true
  716 + });
  717 + i3GeoMap.setOptions({
  718 + draggableCursor : 'crosshair'
  719 + });
  720 + var evtdblclick = null, evtclick = null, evtmousemove = null, pontos = {
  721 + xpt : [],
  722 + ypt : [],
  723 + dist : [],
  724 + mvcLine : new google.maps.MVCArray(),
  725 + mvcMarkers : new google.maps.MVCArray(),
  726 + line : null,
  727 + polygon : null
  728 + }, termina = function() {
  729 + google.maps.event.removeListener(evtdblclick);
  730 + google.maps.event.removeListener(evtclick);
  731 + google.maps.event.removeListener(evtmousemove);
  732 + pontos.line.setOptions({
  733 + clickable : true
  734 + });
  735 + google.maps.event.addListener(
  736 + pontos.line,
  737 + 'click',
  738 + function(shape) {
  739 + if (shape.setEditable) {
576 740 shape.setEditable(!shape.editable);
577 741 }
578 742 });
579   - if(pontos){
580   - i3GEO.desenho.googlemaps.shapes.push(pontos.mvcLine);
581   - i3GEO.desenho.googlemaps.shapes.push(pontos.line);
582   - pontos = null;
583   - }
584   - };
585   - evtclick = google.maps.event.addListener(i3GeoMap, "click", function(evt) {
586   - var x1,x2,y1,y2,trecho=0,total,n,
587   - estilo = i3GEO.desenho.estilos[i3GEO.desenho.estiloPadrao];
588   - // When the map is clicked, pass the LatLng obect to the measureAdd function
  743 + if (pontos) {
  744 + i3GEO.desenho.googlemaps.shapes.push(pontos.mvcLine);
  745 + i3GEO.desenho.googlemaps.shapes.push(pontos.line);
  746 + pontos = null;
  747 + }
  748 + };
  749 + evtclick = google.maps.event.addListener(
  750 + i3GeoMap,
  751 + "click",
  752 + function(evt) {
  753 + var x1, x2, y1, y2, trecho = 0, total, n, estilo = i3GEO.desenho.estilos[i3GEO.desenho.estiloPadrao];
  754 + // When the map is clicked, pass the LatLng obect to the
  755 + // measureAdd function
589 756 pontos.mvcLine.push(evt.latLng);
590 757 pontos.xpt.push(evt.latLng.lng());
591 758 pontos.ypt.push(evt.latLng.lat());
592 759 n = pontos.xpt.length;
593   - //desenha um circulo
  760 + // desenha um circulo
594 761 if (pontos.mvcLine.getLength() > 1) {
595   - x1 = pontos.xpt[n-2];
596   - y1 = pontos.ypt[n-2];
  762 + x1 = pontos.xpt[n - 2];
  763 + y1 = pontos.ypt[n - 2];
597 764 x2 = evt.latLng.lng();
598 765 y2 = evt.latLng.lat();
599   - //raio = google.maps.geometry.spherical.computeDistanceBetween(evt.latLng,new google.maps.LatLng(y1,x1))
600   - trecho = i3GEO.calculo.distancia(x1,y1,x2,y2);
  766 + // raio =
  767 + // google.maps.geometry.spherical.computeDistanceBetween(evt.latLng,new
  768 + // google.maps.LatLng(y1,x1))
  769 + trecho = i3GEO.calculo.distancia(
  770 + x1,
  771 + y1,
  772 + x2,
  773 + y2);
601 774 pontos.dist.push(trecho);
602 775 total = i3GEO.analise.medeDistancia.googlemaps.somaDist(pontos);
603   - i3GEO.analise.medeDistancia.googlemaps.mostraTotal(trecho,total);
604   - if($i("pararraios") && $i("pararraios").checked === true ){
605   - i3GEO.desenho.googlemaps.shapes.push(
606   - new google.maps.Circle({
607   - map: i3GeoMap,
608   - fillOpacity: 0,
609   - clickable: false,
610   - strokeColor: estilo.circcolor,
611   - strokeOpacity: 1,
612   - strokeWeight: estilo.linewidth,
613   - center: new google.maps.LatLng(y1,x1),
614   - radius: trecho*1000,
615   - origem: "medeDistanciaExcluir"
616   - })
617   - );
  776 + i3GEO.analise.medeDistancia.googlemaps.mostraTotal(
  777 + trecho,
  778 + total);
  779 + if ($i("pararraios")
  780 + && $i("pararraios").checked === true) {
  781 + i3GEO.desenho.googlemaps.shapes.push(new google.maps.Circle(
  782 + {
  783 + map : i3GeoMap,
  784 + fillOpacity : 0,
  785 + clickable : false,
  786 + strokeColor : estilo.circcolor,
  787 + strokeOpacity : 1,
  788 + strokeWeight : estilo.linewidth,
  789 + center : new google.maps.LatLng(
  790 + y1,
  791 + x1),
  792 + radius : trecho * 1000,
  793 + origem : "medeDistanciaExcluir"
  794 + }));
618 795 }
619 796 }
620   - //desenha uma marca no ponto
621   - if($i("parartextos") && $i("parartextos").checked === true ){
622   - i3GEO.desenho.googlemaps.shapes.push(
623   - new google.maps.Marker({
624   - map: i3GeoMap,
625   - fillOpacity: 0,
626   - clickable: false,
627   - position:evt.latLng,
628   - icon: {
629   - path: google.maps.SymbolPath.CIRCLE,
630   - scale: 2.5,
631   - strokeColor: "#ffffff",
632   - title: trecho.toFixed(0)+" km"
633   - },
634   - origem: "medeDistanciaExcluir"
635   - })
636   - );
  797 + // desenha uma marca no ponto
  798 + if ($i("parartextos")
  799 + && $i("parartextos").checked === true) {
  800 + i3GEO.desenho.googlemaps.shapes.push(new google.maps.Marker(
  801 + {
  802 + map : i3GeoMap,
  803 + fillOpacity : 0,
  804 + clickable : false,
  805 + position : evt.latLng,
  806 + icon : {
  807 + path : google.maps.SymbolPath.CIRCLE,
  808 + scale : 2.5,
  809 + strokeColor : "#ffffff",
  810 + title : trecho.toFixed(0)
  811 + + " km"
  812 + },
  813 + origem : "medeDistanciaExcluir"
  814 + }));
637 815 }
638   - //mais um ponto para criar uma linha movel
  816 + // mais um ponto para criar uma linha movel
639 817 pontos.mvcLine.push(evt.latLng);
640 818 });
641   - evtmousemove = google.maps.event.addListener(i3GeoMap, "mousemove", function(evt) {
642   - if(!$i("mostradistancia_calculo")){
  819 + evtmousemove = google.maps.event.addListener(
  820 + i3GeoMap,
  821 + "mousemove",
  822 + function(evt) {
  823 + if (!$i("mostradistancia_calculo")) {
643 824 termina.call();
644 825 return;
645 826 }
646   - var x1,y1,x2,y2,direcao,parcial,
647   - estilo = i3GEO.desenho.estilos[i3GEO.desenho.estiloPadrao],
648   - n = pontos.xpt.length;
  827 + var x1, y1, x2, y2, direcao, parcial, estilo = i3GEO.desenho.estilos[i3GEO.desenho.estiloPadrao], n = pontos.xpt.length;
649 828  
650 829 // If there is more than one vertex on the line
651 830 if (pontos.mvcLine.getLength() > 0) {
652 831 // If the line hasn't been created yet
653 832 if (!pontos.line) {
654 833 // Create the line (google.maps.Polyline)
655   - pontos.line = new google.maps.Polyline({
656   - map: i3GeoMap,
657   - clickable: false,
658   - strokeColor: estilo.linecolor,
659   - strokeOpacity: 1,
660   - strokeWeight: estilo.linewidth,
661   - path:pontos.mvcLine,
662   - origem: "medeDistancia"
663   - });
  834 + pontos.line = new google.maps.Polyline(
  835 + {
  836 + map : i3GeoMap,
  837 + clickable : false,
  838 + strokeColor : estilo.linecolor,
  839 + strokeOpacity : 1,
  840 + strokeWeight : estilo.linewidth,
  841 + path : pontos.mvcLine,
  842 + origem : "medeDistancia"
  843 + });
664 844 }
665 845 pontos.mvcLine.pop();
666 846 pontos.mvcLine.push(evt.latLng);
667 847 parcial = i3GEO.analise.medeDistancia.googlemaps.somaDist(pontos);
668   - x1 = pontos.xpt[n-1];
669   - y1 = pontos.ypt[n-1];
  848 + x1 = pontos.xpt[n - 1];
  849 + y1 = pontos.ypt[n - 1];
670 850 x2 = evt.latLng.lng();
671 851 y2 = evt.latLng.lat();
672   - //raio = google.maps.geometry.spherical.computeDistanceBetween(evt.latLng,new google.maps.LatLng(y1,x1))
673   - trecho = i3GEO.calculo.distancia(x1,y1,x2,y2);
674   - direcao = i3GEO.calculo.direcao(x1,y1,x2,y2);
675   - direcao = i3GEO.calculo.dd2dms(direcao,direcao);
  852 + // raio =
  853 + // google.maps.geometry.spherical.computeDistanceBetween(evt.latLng,new
  854 + // google.maps.LatLng(y1,x1))
  855 + trecho = i3GEO.calculo.distancia(
  856 + x1,
  857 + y1,
  858 + x2,
  859 + y2);
  860 + direcao = i3GEO.calculo.direcao(
  861 + x1,
  862 + y1,
  863 + x2,
  864 + y2);
  865 + direcao = i3GEO.calculo.dd2dms(
  866 + direcao,
  867 + direcao);
676 868 direcao = direcao[0];
677   - i3GEO.analise.medeDistancia.googlemaps.mostraParcial(trecho,parcial,direcao);
  869 + i3GEO.analise.medeDistancia.googlemaps.mostraParcial(
  870 + trecho,
  871 + parcial,
  872 + direcao);
678 873 }
679 874 });
680   - evtdblclick = google.maps.event.addListener(i3GeoMap, "dblclick", function(evt) {
  875 + evtdblclick = google.maps.event.addListener(
  876 + i3GeoMap,
  877 + "dblclick",
  878 + function(evt) {
681 879 termina.call();
682 880 });
683   - },
684   - /**
685   - * Soma os valores de distancia guardados em pontos.dist
686   - */
687   - somaDist: function(pontos){
688   - var n,i,
689   - total = 0;
690   - n = pontos.dist.length;
691   - for(i=0;i<n;i++){
692   - total += pontos.dist[i];
693   - }
694   - return total;
695   - },
696   - /**
697   - * Fecha a janela que mostra os dados
698   - * Pergunta ao usuario se os graficos devem ser removidos
699   - * Os graficos sao marcados com o atributo "origem"
700   - * Os raios e pontos sao sempre removidos
701   - */
702   - fechaJanela: function(){
703   - i3GeoMap.setOptions({disableDoubleClickZoom:false});
704   - i3GeoMap.setOptions({draggableCursor:undefined});
705   - var f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem","medeDistancia");
706   - if(f && f.length > 0){
707   - temp = window.confirm($trad("x94"));
708   - if(temp){
709   - i3GEO.desenho.googlemaps.destroyFeatures(f);
710   - }
711   - }
712   - f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem","medeDistanciaExcluir");
713   - if(f && f.length > 0){
714   - i3GEO.desenho.googlemaps.destroyFeatures(f);
715   - }
716   - },
717   - /**
718   - * Mostra a totalizacao das linhas ja digitalizadas
719   - */
720   - mostraTotal: function(trecho,total){
721   - var mostra = $i("mostradistancia_calculo"),
722   - texto;
723   - if (mostra){
724   - texto = "<b>"+$trad("x96")+":</b> "+total.toFixed(3)+" km"+
725   - "<br><b>"+$trad("x96")+":</b> "+(total*1000).toFixed(2)+" m"+
726   - "<br>"+$trad("x25")+": "+i3GEO.calculo.metododistancia;
727   - mostra.innerHTML = texto;
728   - }
729   - },
730   - /**
731   - * Mostra o valor do trecho entre o ultimo ponto clicado e a posicao do mouse
732   - */
733   - mostraParcial: function(trecho,parcial,direcao){
734   - var mostra = $i("mostradistancia_calculo_movel"),
735   - texto;
736   - if (mostra){
737   - texto = "<b>"+$trad("x95")+":</b> "+trecho.toFixed(3)+" km"+
738   - "<br><b>"+$trad("x97")+":</b> "+(parcial + trecho).toFixed(3)+" km" +
739   - "<br><b>"+$trad("x23")+" (DMS):</b> "+direcao;
740   - mostra.innerHTML = texto;
741   - }
  881 + },
  882 + /*******************************************************************
  883 + * Soma os valores de distancia guardados em pontos.dist
  884 + */
  885 + somaDist : function(pontos) {
  886 + var n, i, total = 0;
  887 + n = pontos.dist.length;
  888 + for (i = 0; i < n; i++) {
  889 + total += pontos.dist[i];
742 890 }
  891 + return total;
743 892 },
744   - googleearth:{
745   - pontosdistobj: {
746   - xpt: [],
747   - ypt: [],
748   - dist: [],
749   - distV: [],
750   - xtela: [],
751   - ytela: [],
752   - ximg: [],
753   - yimg: [],
754   - linhas: [],
755   - linhastemp: []
756   - },
757   - inicia: function(){
758   - if(i3GEO.eventos.MOUSECLIQUE.toString().search("i3GEO.analise.medeDistancia.googleearth.clique()") < 0)
759   - {i3GEO.eventos.MOUSECLIQUE.push("i3GEO.analise.medeDistancia.googleearth.clique()");}
760   - if(i3GEO.eventos.MOUSEMOVE.toString().search("i3GEO.analise.medeDistancia.googleearth.movimento()") < 0)
761   - {i3GEO.eventos.MOUSEMOVE.push("i3GEO.analise.medeDistancia.googleearth.movimento()");}
762   - if(i3GEO.eventos.NAVEGAMAPA.toString().search("i3GEO.analise.medeDistancia.fechaJanela()") < 0)
763   - {i3GEO.eventos.NAVEGAMAPA.push("i3GEO.analise.medeDistancia.fechaJanela()");}
764   - },
765   - clique: function(){
766   - var pontosdistobj = i3GEO.analise.medeDistancia.googleearth.pontosdistobj,
767   - n,d,dd;
768   - n = pontosdistobj.xpt.length;
769   - pontosdistobj.xpt[n] = objposicaocursor.ddx;
770   - pontosdistobj.ypt[n] = objposicaocursor.ddy;
771   - pontosdistobj.xtela[n] = objposicaocursor.telax;
772   - pontosdistobj.ytela[n] = objposicaocursor.telay;
773   - pontosdistobj.ximg[n] = objposicaocursor.imgx;
774   - pontosdistobj.yimg[n] = objposicaocursor.imgy;
775   - pontosdistobj.dist[n] = 0;
776   - if (n > 0){
777   - d = i3GEO.calculo.distancia(pontosdistobj.xpt[n-1],pontosdistobj.ypt[n-1],objposicaocursor.ddx,objposicaocursor.ddy);
778   - pontosdistobj.dist[n] = d + pontosdistobj.dist[n-1];
779   - if($i("pararraios") && $i("pararraios").checked === true ){
780   - dd = Math.sqrt(((Math.pow((pontosdistobj.xpt[n] - pontosdistobj.xpt[n-1]),2)) + (Math.pow((pontosdistobj.ypt[n] - pontosdistobj.ypt[n-1]),2)) ));
781   - i3GEO.desenho.googleearth.insereCirculo(pontosdistobj.xpt[n],pontosdistobj.ypt[n],dd,"","divGeometriasTemp");
782   - }
783   - if($i("parartextos") && $i("parartextos").checked === true ){
784   - i3GEO.desenho.googleearth.insereMarca(d+" km",objposicaocursor.ddx,objposicaocursor.ddy,"","divGeometriasTemp");
785   - }
786   - //cria a linha ligando os dois ultimos pontos
787   - i3GEO.desenho.googleearth.insereLinha(pontosdistobj.xpt[n-1],pontosdistobj.ypt[n-1],pontosdistobj.xpt[n],pontosdistobj.ypt[n],"","divGeometriasTemp");
788   - }
789   - },
790   - movimento: function(){
791   - var n,d,r,da,
792   - pontosdistobj = i3GEO.analise.medeDistancia.googleearth.pontosdistobj,
793   - calculo = i3GEO.calculo;
794   - n = pontosdistobj.xpt.length;
795   - if (n > 0){
796   - d = calculo.distancia(pontosdistobj.xpt[n-1],pontosdistobj.ypt[n-1],objposicaocursor.ddx,objposicaocursor.ddy);
797   - r = calculo.direcao(pontosdistobj.xpt[n-1],pontosdistobj.ypt[n-1],objposicaocursor.ddx,objposicaocursor.ddy);
798   - r = calculo.dd2dms(r,r);
799   - r = r[0];
800   - d = d * 1;
801   - da = d + pontosdistobj.dist[n-1];
802   - i3GEO.analise.medeDistancia.googleearth.mostraParcial(d,da,r);
803   - }
804   - },
805   - /**
806   - * Fecha a janela que mostra os dados
807   - * Pergunta ao usuario se os graficos devem ser removidos
808   - * Os graficos sao marcados com o atributo "origem"
809   - * Os raios e pontos sao sempre removidos
810   - */
811   - fechaJanela: function(){
  893 + /*******************************************************************
  894 + * Fecha a janela que mostra os dados Pergunta ao usuario se os
  895 + * graficos devem ser removidos Os graficos sao marcados com o
  896 + * atributo "origem" Os raios e pontos sao sempre removidos
  897 + */
  898 + fechaJanela : function() {
  899 + i3GeoMap.setOptions({
  900 + disableDoubleClickZoom : false
  901 + });
  902 + i3GeoMap.setOptions({
  903 + draggableCursor : undefined
  904 + });
  905 + var f = i3GEO.desenho.googlemaps.getFeaturesByAttribute(
  906 + "origem",
  907 + "medeDistancia");
  908 + if (f
  909 + && f.length > 0) {
812 910 temp = window.confirm($trad("x94"));
813   - if(temp){
814   - i3GEO.desenho.googleearth.removePlacemark("divGeometriasTemp");
815   - }
816   - i3GEO.eventos.MOUSECLIQUE.remove("i3GEO.analise.medeDistancia.googleearth.clique()");
817   - i3GEO.eventos.MOUSEMOVE.remove("i3GEO.analise.medeDistancia.movimento.googleearth()");
818   - i3GEO.eventos.NAVEGAMAPA.remove("i3GEO.analise.medeDistancia.fechaJanela()");
819   - },
820   - /**
821   - * Mostra a totalizacao das linhas ja digitalizadas
822   - */
823   - mostraTotal: function(trecho,total){
824   - var mostra = $i("mostradistancia_calculo"),
825   - texto;
826   - if (mostra){
827   - texto = "<b>"+$trad("x96")+":</b> "+total.toFixed(3)+" km"+
828   - "<br><b>"+$trad("x96")+":</b> "+(total*1000).toFixed(2)+" m"+
829   - "<br>"+$trad("x25")+": "+i3GEO.calculo.metododistancia;
830   - mostra.innerHTML = texto;
831   - }
832   - },
833   - /**
834   - * Mostra o valor do trecho entre o ultimo ponto clicado e a posicao do mouse
835   - */
836   - mostraParcial: function(trecho,parcial,direcao){
837   - var mostra = $i("mostradistancia_calculo_movel"),
838   - texto;
839   - if (mostra){
840   - texto = "<b>"+$trad("x95")+":</b> "+trecho.toFixed(3)+" km"+
841   - "<br><b>"+$trad("x97")+":</b> "+(parcial + trecho).toFixed(3)+" km" +
842   - "<br><b>"+$trad("x23")+" (DMS):</b> "+direcao;
843   - mostra.innerHTML = texto;
  911 + if (temp) {
  912 + i3GEO.desenho.googlemaps.destroyFeatures(f);
844 913 }
845 914 }
846   - }
847   - },
848   - /*
849   - i3GEO.analise.medeArea
850   -
851   - Ativa e controla a opcao de medicao de area.
852   -
853   - A medida e feita quando o usuario clica no mapa com esta opcao ativa
854   -
855   - Quando o botao e acionado, abre-se a janela que mostra o resultado da medida, o icone que segue o mouse e alterado.
856   -
857   - Para mostrar o resultado do calculo, e incluido um div especifico.
858   - */
859   - medeArea:{
860   - /**
861   - * Armazena os pontos clicados para realizar os calculos
862   - */
863   - pontos: {},
864   - /*
865   - Function: inicia
866   -
867   - Inicia a operacao de medicao, abrindo a janela de resultados e criando os componentes necessarios
868   -
869   - Sao registrados os eventos de clique sobre o mapa e fechamento da janela de resultados
  915 + f = i3GEO.desenho.googlemaps.getFeaturesByAttribute(
  916 + "origem",
  917 + "medeDistanciaExcluir");
  918 + if (f
  919 + && f.length > 0) {
  920 + i3GEO.desenho.googlemaps.destroyFeatures(f);
  921 + }
  922 + },
  923 + /*******************************************************************
  924 + * Mostra a totalizacao das linhas ja digitalizadas
870 925 */
871   - inicia: function(){
872   - if(typeof(console) !== 'undefined'){console.info("i3GEO.analise.medeDistancia.inicia()");}
873   - i3GEO.eventos.cliquePerm.desativa();
874   - i3GEO.analise.medeArea.criaJanela();
875   - i3GEO.analise.medeArea[i3GEO.Interface["ATUAL"]].inicia();
  926 + mostraTotal : function(trecho, total) {
  927 + var mostra = $i("mostradistancia_calculo"), texto;
  928 + if (mostra) {
  929 + texto = "<b>"
  930 + + $trad("x96")
  931 + + ":</b> "
  932 + + total.toFixed(3)
  933 + + " km"
  934 + + "<br><b>"
  935 + + $trad("x96")
  936 + + ":</b> "
  937 + + (total * 1000).toFixed(2)
  938 + + " m"
  939 + + "<br>"
  940 + + $trad("x25")
  941 + + ": "
  942 + + i3GEO.calculo.metododistancia;
  943 + mostra.innerHTML = texto;
  944 + }
876 945 },
877   - /*
878   - Cria a janela para mostrar os resultados da medicao
  946 + /*******************************************************************
  947 + * Mostra o valor do trecho entre o ultimo ponto clicado e a posicao
  948 + * do mouse
879 949 */
880   - criaJanela: function(){
881   - var novoel,ins,imagemxy,janela;
882   - if (!$i("mostraarea")){
883   - novoel = document.createElement("div");
884   - novoel.id = "mostraarea";
885   - ins = '<div class="hd" >&Aacute;rea aproximada <a class=ajuda_usuario target=_blank href="'+i3GEO.configura.locaplic+'"/ajuda_usuario.php?idcategoria=6&idajuda=51" >&nbsp;&nbsp;&nbsp;</a></div>' +
886   - '<div class="bd" style="text-align:left;padding:3px;font-size:10px" >' +
887   - 'Estilo: '+i3GEO.desenho.caixaEstilos()+'<br>' +
888   - '<div style="text-align:left;padding:3px;font-size:10px" id="mostraarea_calculo" ></div>' +
889   - '<div style="text-align:left;padding:3px;font-size:10px" id="mostraarea_calculo_parcial" ></div>' +
890   - '</div>';
891   - novoel.innerHTML = ins;
892   - novoel.style.borderColor="gray";
893   - document.body.appendChild(novoel);
894   - janela = new YAHOO.widget.Panel("mostraarea", {width:"220px",fixedcenter: false, constraintoviewport: true, underlay:"none", close:true, visible:true, draggable:true, modal:false } );
895   - YAHOO.i3GEO.janela.manager.register(janela);
896   - janela.render();
897   - YAHOO.util.Event.addListener(janela.close, "click", i3GEO.analise.medeArea.fechaJanela);
  950 + mostraParcial : function(trecho, parcial, direcao) {
  951 + var mostra = $i("mostradistancia_calculo_movel"), texto;
  952 + if (mostra) {
  953 + texto = "<b>"
  954 + + $trad("x95")
  955 + + ":</b> "
  956 + + trecho.toFixed(3)
  957 + + " km"
  958 + + "<br><b>"
  959 + + $trad("x97")
  960 + + ":</b> "
  961 + + (parcial + trecho).toFixed(3)
  962 + + " km"
  963 + + "<br><b>"
  964 + + $trad("x23")
  965 + + " (DMS):</b> "
  966 + + direcao;
  967 + mostra.innerHTML = texto;
898 968 }
899   - else{
900   - janela = YAHOO.i3GEO.janela.manager.find("mostraarea");
  969 + }
  970 + },
  971 + googleearth : {
  972 + pontosdistobj : {
  973 + xpt : [],
  974 + ypt : [],
  975 + dist : [],
  976 + distV : [],
  977 + xtela : [],
  978 + ytela : [],
  979 + ximg : [],
  980 + yimg : [],
  981 + linhas : [],
  982 + linhastemp : []
  983 + },
  984 + inicia : function() {
  985 + if (i3GEO.eventos.MOUSECLIQUE.toString().search(
  986 + "i3GEO.analise.medeDistancia.googleearth.clique()") < 0) {
  987 + i3GEO.eventos.MOUSECLIQUE.push("i3GEO.analise.medeDistancia.googleearth.clique()");
  988 + }
  989 + if (i3GEO.eventos.MOUSEMOVE.toString().search(
  990 + "i3GEO.analise.medeDistancia.googleearth.movimento()") < 0) {
  991 + i3GEO.eventos.MOUSEMOVE.push("i3GEO.analise.medeDistancia.googleearth.movimento()");
  992 + }
  993 + if (i3GEO.eventos.NAVEGAMAPA.toString().search(
  994 + "i3GEO.analise.medeDistancia.fechaJanela()") < 0) {
  995 + i3GEO.eventos.NAVEGAMAPA.push("i3GEO.analise.medeDistancia.fechaJanela()");
901 996 }
902   - janela.show();
903   - imagemxy = i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO));
904   - janela.moveTo(imagemxy[0]+150,imagemxy[1]);
905 997 },
906   - /*
907   - Function: fechaJanela
908   -
909   - Fecha a janela e os elementos graficos criados para a ferramenta de medicao
  998 + clique : function() {
  999 + var pontosdistobj = i3GEO.analise.medeDistancia.googleearth.pontosdistobj, n, d, dd;
  1000 + n = pontosdistobj.xpt.length;
  1001 + pontosdistobj.xpt[n] = objposicaocursor.ddx;
  1002 + pontosdistobj.ypt[n] = objposicaocursor.ddy;
  1003 + pontosdistobj.xtela[n] = objposicaocursor.telax;
  1004 + pontosdistobj.ytela[n] = objposicaocursor.telay;
  1005 + pontosdistobj.ximg[n] = objposicaocursor.imgx;
  1006 + pontosdistobj.yimg[n] = objposicaocursor.imgy;
  1007 + pontosdistobj.dist[n] = 0;
  1008 + if (n > 0) {
  1009 + d = i3GEO.calculo.distancia(
  1010 + pontosdistobj.xpt[n - 1],
  1011 + pontosdistobj.ypt[n - 1],
  1012 + objposicaocursor.ddx,
  1013 + objposicaocursor.ddy);
  1014 + pontosdistobj.dist[n] = d
  1015 + + pontosdistobj.dist[n - 1];
  1016 + if ($i("pararraios")
  1017 + && $i("pararraios").checked === true) {
  1018 + dd = Math.sqrt(((Math.pow(
  1019 + (pontosdistobj.xpt[n] - pontosdistobj.xpt[n - 1]),
  1020 + 2)) + (Math.pow(
  1021 + (pontosdistobj.ypt[n] - pontosdistobj.ypt[n - 1]),
  1022 + 2))));
  1023 + i3GEO.desenho.googleearth.insereCirculo(
  1024 + pontosdistobj.xpt[n],
  1025 + pontosdistobj.ypt[n],
  1026 + dd,
  1027 + "",
  1028 + "divGeometriasTemp");
  1029 + }
  1030 + if ($i("parartextos")
  1031 + && $i("parartextos").checked === true) {
  1032 + i3GEO.desenho.googleearth.insereMarca(
  1033 + d
  1034 + + " km",
  1035 + objposicaocursor.ddx,
  1036 + objposicaocursor.ddy,
  1037 + "",
  1038 + "divGeometriasTemp");
  1039 + }
  1040 + // cria a linha ligando os dois ultimos pontos
  1041 + i3GEO.desenho.googleearth.insereLinha(
  1042 + pontosdistobj.xpt[n - 1],
  1043 + pontosdistobj.ypt[n - 1],
  1044 + pontosdistobj.xpt[n],
  1045 + pontosdistobj.ypt[n],
  1046 + "",
  1047 + "divGeometriasTemp");
  1048 + }
  1049 + },
  1050 + movimento : function() {
  1051 + var n, d, r, da, pontosdistobj = i3GEO.analise.medeDistancia.googleearth.pontosdistobj, calculo = i3GEO.calculo;
  1052 + n = pontosdistobj.xpt.length;
  1053 + if (n > 0) {
  1054 + d = calculo.distancia(
  1055 + pontosdistobj.xpt[n - 1],
  1056 + pontosdistobj.ypt[n - 1],
  1057 + objposicaocursor.ddx,
  1058 + objposicaocursor.ddy);
  1059 + r = calculo.direcao(
  1060 + pontosdistobj.xpt[n - 1],
  1061 + pontosdistobj.ypt[n - 1],
  1062 + objposicaocursor.ddx,
  1063 + objposicaocursor.ddy);
  1064 + r = calculo.dd2dms(
  1065 + r,
  1066 + r);
  1067 + r = r[0];
  1068 + d = d * 1;
  1069 + da = d
  1070 + + pontosdistobj.dist[n - 1];
  1071 + i3GEO.analise.medeDistancia.googleearth.mostraParcial(
  1072 + d,
  1073 + da,
  1074 + r);
  1075 + }
  1076 + },
  1077 + /*******************************************************************
  1078 + * Fecha a janela que mostra os dados Pergunta ao usuario se os
  1079 + * graficos devem ser removidos Os graficos sao marcados com o
  1080 + * atributo "origem" Os raios e pontos sao sempre removidos
910 1081 */
911   - fechaJanela: function(){
912   - var janela;
913   - i3GEO.eventos.cliquePerm.ativa();
914   - janela = YAHOO.i3GEO.janela.manager.find("mostraarea");
915   - if(janela){
916   - YAHOO.i3GEO.janela.manager.remove(janela);
917   - janela.destroy();
  1082 + fechaJanela : function() {
  1083 + temp = window.confirm($trad("x94"));
  1084 + if (temp) {
  1085 + i3GEO.desenho.googleearth.removePlacemark("divGeometriasTemp");
918 1086 }
919   - i3GEO.barraDeBotoes.ativaIcone("pointer");
920   - i3GEO.analise.medeArea[i3GEO.Interface["ATUAL"]].fechaJanela();
  1087 + i3GEO.eventos.MOUSECLIQUE.remove("i3GEO.analise.medeDistancia.googleearth.clique()");
  1088 + i3GEO.eventos.MOUSEMOVE.remove("i3GEO.analise.medeDistancia.movimento.googleearth()");
  1089 + i3GEO.eventos.NAVEGAMAPA.remove("i3GEO.analise.medeDistancia.fechaJanela()");
921 1090 },
922   - /**
923   - * Funcoes especificas da interface openlayers
  1091 + /*******************************************************************
  1092 + * Mostra a totalizacao das linhas ja digitalizadas
924 1093 */
925   - openlayers:{
926   - /**
927   - * Inicializa o processo
928   - * Cria a variavel para guardar os pontos
929   - * Executa a funcao de inicializacao do desenho, que cria o layer para receber os graficos
930   - */
931   - inicia: function(){
932   - var poligono,
933   - estilo = i3GEO.desenho.estilos[i3GEO.desenho.estiloPadrao],
934   - controle = i3geoOL.getControlsBy("id","i3GeoMedeArea");
935   - i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia();
936   - i3GEO.analise.medeArea.pontos = {
937   - xpt: [],
938   - ypt: [],
939   - dist: []
940   - };
941   - if(controle.length === 0){
942   - poligono = new OpenLayers.Control.DrawFeature(
943   - i3GEO.desenho.layergrafico,
944   - OpenLayers.Handler.Polygon,
945   - {
946   - autoActivate: true,
947   - id: "i3GeoMedeArea",
948   - type: OpenLayers.Control.TYPE_TOOL,
949   - callbacks:{
950   - done: function(feature){
951   - var f = new OpenLayers.Feature.Vector(
952   - feature,
953   - {
954   - origem: "medeArea"
955   - },
956   - {
957   - graphicName: "square",
958   - pointRadius: 10,
959   - graphicOpacity: 1,
960   - strokeWidth: estilo.linewidth,
961   - strokeColor: estilo.linecolor,
962   - fillColor: estilo.fillcolor,
963   - fillOpacity: 0.3
964   - }
965   - );
966   - i3GEO.desenho.layergrafico.addFeatures([f]);
967   - if(i3GEO.Interface){
968   - i3GEO.Interface.openlayers.sobeLayersGraficos();
969   - }
970   - i3GEO.analise.medeArea.openlayers.mostraParcial(0,0,0,0);
971   - i3GEO.analise.medeArea.openlayers.inicia();
972   - },
973   - modify: function(point,poligono){
974   - var n,x1,y1,x2,y2,
975   - trecho = 0,
976   - per = 0,
977   - direcao = 0,
978   - area = 0,
979   - proj = new OpenLayers.Projection("EPSG:4326");
980   - n = i3GEO.analise.medeArea.pontos.ypt.length;
981   - if(n > 1){
982   - x1 = i3GEO.analise.medeArea.pontos.xpt[n-1];
983   - y1 = i3GEO.analise.medeArea.pontos.ypt[n-1];
984   - x2 = point.x;
985   - y2 = point.y;
986   - //projeta
987   - if(i3GEO.Interface.openlayers.googleLike){
988   - temp = i3GEO.util.extOSM2Geo(x1+" "+y1+" "+x2+" "+y2);
989   - temp = temp.split(" ");
990   - x1 = temp[0];
991   - y1 = temp[1];
992   - x2 = temp[2];
993   - y2 = temp[3];
994   - proj = new OpenLayers.Projection("EPSG:900913");
995   - }
996   - trecho = i3GEO.calculo.distancia(x1,y1,x2,y2);
997   - direcao = i3GEO.calculo.direcao(x1,y1,x2,y2);
998   - direcao = i3GEO.calculo.dd2dms(direcao,direcao);
999   - direcao = direcao[0];
1000   - per = i3GEO.analise.medeArea.openlayers.somaDist();
1001   - //soma ate o primeiro ponto
1002   - x1 = i3GEO.analise.medeArea.pontos.xpt[0];
1003   - y1 = i3GEO.analise.medeArea.pontos.ypt[0];
1004   - //projeta
1005   - if(i3GEO.Interface.openlayers.googleLike){
1006   - temp = i3GEO.util.extOSM2Geo(x1+" "+y1);
1007   - temp = temp.split(" ");
1008   - x1 = temp[0];
1009   - y1 = temp[1];
1010   - }
1011   - per += i3GEO.calculo.distancia(x1,y1,x2,y2);
1012   - area = poligono.geometry.getGeodesicArea(proj);
1013   - i3GEO.analise.medeArea.openlayers.mostraParcial(trecho,per,area,direcao);
1014   - }
  1094 + mostraTotal : function(trecho, total) {
  1095 + var mostra = $i("mostradistancia_calculo"), texto;
  1096 + if (mostra) {
  1097 + texto = "<b>"
  1098 + + $trad("x96")
  1099 + + ":</b> "
  1100 + + total.toFixed(3)
  1101 + + " km"
  1102 + + "<br><b>"
  1103 + + $trad("x96")
  1104 + + ":</b> "
  1105 + + (total * 1000).toFixed(2)
  1106 + + " m"
  1107 + + "<br>"
  1108 + + $trad("x25")
  1109 + + ": "
  1110 + + i3GEO.calculo.metododistancia;
  1111 + mostra.innerHTML = texto;
  1112 + }
  1113 + },
  1114 + /*******************************************************************
  1115 + * Mostra o valor do trecho entre o ultimo ponto clicado e a posicao
  1116 + * do mouse
  1117 + */
  1118 + mostraParcial : function(trecho, parcial, direcao) {
  1119 + var mostra = $i("mostradistancia_calculo_movel"), texto;
  1120 + if (mostra) {
  1121 + texto = "<b>"
  1122 + + $trad("x95")
  1123 + + ":</b> "
  1124 + + trecho.toFixed(3)
  1125 + + " km"
  1126 + + "<br><b>"
  1127 + + $trad("x97")
  1128 + + ":</b> "
  1129 + + (parcial + trecho).toFixed(3)
  1130 + + " km"
  1131 + + "<br><b>"
  1132 + + $trad("x23")
  1133 + + " (DMS):</b> "
  1134 + + direcao;
  1135 + mostra.innerHTML = texto;
  1136 + }
  1137 + }
  1138 + }
  1139 + },
  1140 + /**
  1141 + * Class: medeArea
  1142 + *
  1143 + * Ativa e controla a op&atilde;o de medi&ccedil;&atilde;o de &aacute;rea.
  1144 + *
  1145 + * A medida &eacute; feita quando o usu&aacute;rio clica no mapa com esta op&ccedil;&atilde;o ativa
  1146 + *
  1147 + * Quando o bot&atilde;o &eacute; acionado, abre-se a janela que mostra o resultado da
  1148 + * medida, o &iacute;cone que segue o mouse &eacute; alterado.
  1149 + *
  1150 + * Para mostrar o resultado do cálculo, é incluido um div específico.
  1151 + */
  1152 + medeArea : {
  1153 + /***********************************************************************
  1154 + * Armazena os pontos clicados para realizar os calculos
  1155 + */
  1156 + pontos : {},
  1157 + /**
  1158 + * Function: inicia
  1159 + *
  1160 + * Inicia a opera&ccedil;&atilde;o de medi&ccedil;&atilde;o, abrindo a janela de resultados e
  1161 + * criando os componentes necess&aacute;rios
  1162 + *
  1163 + * S&atilde;o registrados os eventos de clique sobre o mapa e fechamento da
  1164 + * janela de resultados
  1165 + */
  1166 + inicia : function() {
  1167 + i3GEO.eventos.cliquePerm.desativa();
  1168 + i3GEO.analise.medeArea.criaJanela();
  1169 + i3GEO.analise.medeArea[i3GEO.Interface["ATUAL"]].inicia();
  1170 + },
  1171 + /**
  1172 + * Cria a janela para mostrar os resultados da medicao
  1173 + */
  1174 + criaJanela : function() {
  1175 + var novoel, ins, imagemxy, janela;
  1176 + if (!$i("mostraarea")) {
  1177 + novoel = document.createElement("div");
  1178 + novoel.id = "mostraarea";
  1179 + ins = '<div class="hd" >&Aacute;rea aproximada <a class=ajuda_usuario target=_blank href="'
  1180 + + i3GEO.configura.locaplic
  1181 + + '"/ajuda_usuario.php?idcategoria=6&idajuda=51" >&nbsp;&nbsp;&nbsp;</a></div>'
  1182 + + '<div class="bd" style="text-align:left;padding:3px;font-size:10px" >'
  1183 + + 'Estilo: '
  1184 + + i3GEO.desenho.caixaEstilos()
  1185 + + '<br>'
  1186 + + '<div style="text-align:left;padding:3px;font-size:10px" id="mostraarea_calculo" ></div>'
  1187 + + '<div style="text-align:left;padding:3px;font-size:10px" id="mostraarea_calculo_parcial" ></div>'
  1188 + + '</div>';
  1189 + novoel.innerHTML = ins;
  1190 + novoel.style.borderColor = "gray";
  1191 + document.body.appendChild(novoel);
  1192 + janela = new YAHOO.widget.Panel(
  1193 + "mostraarea",
  1194 + {
  1195 + width : "220px",
  1196 + fixedcenter : false,
  1197 + constraintoviewport : true,
  1198 + underlay : "none",
  1199 + close : true,
  1200 + visible : true,
  1201 + draggable : true,
  1202 + modal : false
  1203 + });
  1204 + YAHOO.i3GEO.janela.manager.register(janela);
  1205 + janela.render();
  1206 + YAHOO.util.Event.addListener(
  1207 + janela.close,
  1208 + "click",
  1209 + i3GEO.analise.medeArea.fechaJanela);
  1210 + } else {
  1211 + janela = YAHOO.i3GEO.janela.manager.find("mostraarea");
  1212 + }
  1213 + janela.show();
  1214 + imagemxy = i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO));
  1215 + janela.moveTo(
  1216 + imagemxy[0] + 150,
  1217 + imagemxy[1]);
  1218 + },
  1219 + /**
  1220 + * Function: fechaJanela
  1221 + *
  1222 + * Fecha a janela e os elementos graficos criados para a ferramenta de
  1223 + * medicao
  1224 + */
  1225 + fechaJanela : function() {
  1226 + var janela;
  1227 + i3GEO.eventos.cliquePerm.ativa();
  1228 + janela = YAHOO.i3GEO.janela.manager.find("mostraarea");
  1229 + if (janela) {
  1230 + YAHOO.i3GEO.janela.manager.remove(janela);
  1231 + janela.destroy();
  1232 + }
  1233 + i3GEO.barraDeBotoes.ativaIcone("pointer");
  1234 + i3GEO.analise.medeArea[i3GEO.Interface["ATUAL"]].fechaJanela();
  1235 + },
  1236 + /***********************************************************************
  1237 + * Funcoes especificas da interface openlayers
  1238 + */
  1239 + openlayers : {
  1240 + /*******************************************************************
  1241 + * Inicializa o processo Cria a variavel para guardar os pontos
  1242 + * Executa a funcao de inicializacao do desenho, que cria o layer
  1243 + * para receber os graficos
  1244 + */
  1245 + inicia : function() {
  1246 + var poligono, estilo = i3GEO.desenho.estilos[i3GEO.desenho.estiloPadrao], controle = i3geoOL.getControlsBy(
  1247 + "id",
  1248 + "i3GeoMedeArea");
  1249 + i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia();
  1250 + i3GEO.analise.medeArea.pontos = {
  1251 + xpt : [],
  1252 + ypt : [],
  1253 + dist : []
  1254 + };
  1255 + if (controle.length === 0) {
  1256 + poligono = new OpenLayers.Control.DrawFeature(
  1257 + i3GEO.desenho.layergrafico,
  1258 + OpenLayers.Handler.Polygon,
  1259 + {
  1260 + autoActivate : true,
  1261 + id : "i3GeoMedeArea",
  1262 + type : OpenLayers.Control.TYPE_TOOL,
  1263 + callbacks : {
  1264 + done : function(feature) {
  1265 + var f = new OpenLayers.Feature.Vector(
  1266 + feature,
  1267 + {
  1268 + origem : "medeArea"
1015 1269 },
1016   - point: function(point,poligono){
1017   - var n,x1,y1,x2,y2,temp,label,
1018   - //registra os pontos e calcula a distancia
1019   - per = 0,
1020   - trecho = 0,
1021   - area = 0,
1022   - proj = new OpenLayers.Projection("EPSG:4326");
1023   - i3GEO.analise.medeArea.pontos.xpt.push(point.x);
1024   - i3GEO.analise.medeArea.pontos.ypt.push(point.y);
1025   - n = i3GEO.analise.medeArea.pontos.ypt.length;
1026   - if(n > 1){
1027   - x1 = i3GEO.analise.medeArea.pontos.xpt[n-2];
1028   - y1 = i3GEO.analise.medeArea.pontos.ypt[n-2];
1029   - x2 = point.x;
1030   - y2 = point.y;
1031   - //projeta
1032   - if(i3GEO.Interface.openlayers.googleLike){
1033   - temp = i3GEO.util.extOSM2Geo(x1+" "+y1+" "+x2+" "+y2);
1034   - temp = temp.split(" ");
1035   - x1 = temp[0];
1036   - y1 = temp[1];
1037   - x2 = temp[2];
1038   - y2 = temp[3];
1039   - proj = new OpenLayers.Projection("EPSG:900913");
1040   - }
1041   - trecho = i3GEO.calculo.distancia(x1,y1,x2,y2);
1042   - i3GEO.analise.medeArea.pontos.dist.push(trecho);
1043   - per = i3GEO.analise.medeArea.openlayers.somaDist();
1044   - //soma ate o primeiro ponto
1045   - x1 = i3GEO.analise.medeArea.pontos.xpt[0];
1046   - y1 = i3GEO.analise.medeArea.pontos.ypt[0];
1047   - //projeta
1048   - if(i3GEO.Interface.openlayers.googleLike){
1049   - temp = i3GEO.util.extOSM2Geo(x1+" "+y1);
1050   - temp = temp.split(" ");
1051   - x1 = temp[0];
1052   - y1 = temp[1];
1053   - }
1054   - per += i3GEO.calculo.distancia(x1,y1,x2,y2);
1055   - //desenha ponto
1056   - //if($i("parartextos") && $i("parartextos").checked === true ){
1057   - label = new OpenLayers.Feature.Vector(
1058   - new OpenLayers.Geometry.Point(point.x,point.y),
1059   - {
1060   - origem: "medeAreaExcluir"
1061   - },
1062   - {
1063   - graphicName: "square",
1064   - pointRadius: 3,
1065   - strokeColor: "black",
1066   - graphicOpacity: 1,
1067   - strokeWidth: 1,
1068   - fillColor: "white",
1069   - label: trecho.toFixed(3),
1070   - labelAlign: "rb",
1071   - fontColor: estilo.textcolor,
1072   - fontSize: 12,
1073   - fontWeight: "bold"
1074   - }
1075   - );
1076   - i3GEO.desenho.layergrafico.addFeatures([label]);
1077   - if(n > 2){
1078   - area = poligono.getGeodesicArea(proj);
1079   - }
1080   - }
1081   - i3GEO.analise.medeArea.openlayers.mostraTotal(per,area);
  1270 + {
  1271 + graphicName : "square",
  1272 + pointRadius : 10,
  1273 + graphicOpacity : 1,
  1274 + strokeWidth : estilo.linewidth,
  1275 + strokeColor : estilo.linecolor,
  1276 + fillColor : estilo.fillcolor,
  1277 + fillOpacity : 0.3
  1278 + });
  1279 + i3GEO.desenho.layergrafico.addFeatures([
  1280 + f
  1281 + ]);
  1282 + if (i3GEO.Interface) {
  1283 + i3GEO.Interface.openlayers.sobeLayersGraficos();
  1284 + }
  1285 + i3GEO.analise.medeArea.openlayers.mostraParcial(
  1286 + 0,
  1287 + 0,
  1288 + 0,
  1289 + 0);
  1290 + i3GEO.analise.medeArea.openlayers.inicia();
  1291 + },
  1292 + modify : function(point, poligono) {
  1293 + var n, x1, y1, x2, y2, trecho = 0, per = 0, direcao = 0, area = 0, proj = new OpenLayers.Projection(
  1294 + "EPSG:4326");
  1295 + n = i3GEO.analise.medeArea.pontos.ypt.length;
  1296 + if (n > 1) {
  1297 + x1 = i3GEO.analise.medeArea.pontos.xpt[n - 1];
  1298 + y1 = i3GEO.analise.medeArea.pontos.ypt[n - 1];
  1299 + x2 = point.x;
  1300 + y2 = point.y;
  1301 + // projeta
  1302 + if (i3GEO.Interface.openlayers.googleLike) {
  1303 + temp = i3GEO.util.extOSM2Geo(x1
  1304 + + " "
  1305 + + y1
  1306 + + " "
  1307 + + x2
  1308 + + " "
  1309 + + y2);
  1310 + temp = temp.split(" ");
  1311 + x1 = temp[0];
  1312 + y1 = temp[1];
  1313 + x2 = temp[2];
  1314 + y2 = temp[3];
  1315 + proj = new OpenLayers.Projection(
  1316 + "EPSG:900913");
  1317 + }
  1318 + trecho = i3GEO.calculo.distancia(
  1319 + x1,
  1320 + y1,
  1321 + x2,
  1322 + y2);
  1323 + direcao = i3GEO.calculo.direcao(
  1324 + x1,
  1325 + y1,
  1326 + x2,
  1327 + y2);
  1328 + direcao = i3GEO.calculo.dd2dms(
  1329 + direcao,
  1330 + direcao);
  1331 + direcao = direcao[0];
  1332 + per = i3GEO.analise.medeArea.openlayers.somaDist();
  1333 + // soma ate o primeiro ponto
  1334 + x1 = i3GEO.analise.medeArea.pontos.xpt[0];
  1335 + y1 = i3GEO.analise.medeArea.pontos.ypt[0];
  1336 + // projeta
  1337 + if (i3GEO.Interface.openlayers.googleLike) {
  1338 + temp = i3GEO.util.extOSM2Geo(x1
  1339 + + " "
  1340 + + y1);
  1341 + temp = temp.split(" ");
  1342 + x1 = temp[0];
  1343 + y1 = temp[1];
  1344 + }
  1345 + per += i3GEO.calculo.distancia(
  1346 + x1,
  1347 + y1,
  1348 + x2,
  1349 + y2);
  1350 + area = poligono.geometry.getGeodesicArea(proj);
  1351 + i3GEO.analise.medeArea.openlayers.mostraParcial(
  1352 + trecho,
  1353 + per,
  1354 + area,
  1355 + direcao);
  1356 + }
  1357 + },
  1358 + point : function(point, poligono) {
  1359 + var n, x1, y1, x2, y2, temp, label,
  1360 + // registra os pontos e calcula a distancia
  1361 + per = 0, trecho = 0, area = 0, proj = new OpenLayers.Projection(
  1362 + "EPSG:4326");
  1363 + i3GEO.analise.medeArea.pontos.xpt.push(point.x);
  1364 + i3GEO.analise.medeArea.pontos.ypt.push(point.y);
  1365 + n = i3GEO.analise.medeArea.pontos.ypt.length;
  1366 + if (n > 1) {
  1367 + x1 = i3GEO.analise.medeArea.pontos.xpt[n - 2];
  1368 + y1 = i3GEO.analise.medeArea.pontos.ypt[n - 2];
  1369 + x2 = point.x;
  1370 + y2 = point.y;
  1371 + // projeta
  1372 + if (i3GEO.Interface.openlayers.googleLike) {
  1373 + temp = i3GEO.util.extOSM2Geo(x1
  1374 + + " "
  1375 + + y1
  1376 + + " "
  1377 + + x2
  1378 + + " "
  1379 + + y2);
  1380 + temp = temp.split(" ");
  1381 + x1 = temp[0];
  1382 + y1 = temp[1];
  1383 + x2 = temp[2];
  1384 + y2 = temp[3];
  1385 + proj = new OpenLayers.Projection(
  1386 + "EPSG:900913");
  1387 + }
  1388 + trecho = i3GEO.calculo.distancia(
  1389 + x1,
  1390 + y1,
  1391 + x2,
  1392 + y2);
  1393 + i3GEO.analise.medeArea.pontos.dist.push(trecho);
  1394 + per = i3GEO.analise.medeArea.openlayers.somaDist();
  1395 + // soma ate o primeiro ponto
  1396 + x1 = i3GEO.analise.medeArea.pontos.xpt[0];
  1397 + y1 = i3GEO.analise.medeArea.pontos.ypt[0];
  1398 + // projeta
  1399 + if (i3GEO.Interface.openlayers.googleLike) {
  1400 + temp = i3GEO.util.extOSM2Geo(x1
  1401 + + " "
  1402 + + y1);
  1403 + temp = temp.split(" ");
  1404 + x1 = temp[0];
  1405 + y1 = temp[1];
  1406 + }
  1407 + per += i3GEO.calculo.distancia(
  1408 + x1,
  1409 + y1,
  1410 + x2,
  1411 + y2);
  1412 + // desenha ponto
  1413 + // if($i("parartextos") &&
  1414 + // $i("parartextos").checked === true ){
  1415 + label = new OpenLayers.Feature.Vector(
  1416 + new OpenLayers.Geometry.Point(
  1417 + point.x,
  1418 + point.y),
  1419 + {
  1420 + origem : "medeAreaExcluir"
  1421 + },
  1422 + {
  1423 + graphicName : "square",
  1424 + pointRadius : 3,
  1425 + strokeColor : "black",
  1426 + graphicOpacity : 1,
  1427 + strokeWidth : 1,
  1428 + fillColor : "white",
  1429 + label : trecho.toFixed(3),
  1430 + labelAlign : "rb",
  1431 + fontColor : estilo.textcolor,
  1432 + fontSize : 12,
  1433 + fontWeight : "bold"
  1434 + });
  1435 + i3GEO.desenho.layergrafico.addFeatures([
  1436 + label
  1437 + ]);
  1438 + if (n > 2) {
  1439 + area = poligono.getGeodesicArea(proj);
1082 1440 }
1083 1441 }
  1442 + i3GEO.analise.medeArea.openlayers.mostraTotal(
  1443 + per,
  1444 + area);
1084 1445 }
1085   - );
1086   - i3geoOL.addControl(poligono);
1087   - }
1088   - },
1089   - /**
1090   - * Soma os valores de distancia guardados em pontos.dist
1091   - */
1092   - somaDist: function(){
1093   - var n,i,
1094   - total = 0;
1095   - n = i3GEO.analise.medeArea.pontos.dist.length;
1096   - for(i=0;i<n;i++){
1097   - total += i3GEO.analise.medeArea.pontos.dist[i];
1098   - }
1099   - return total;
1100   - },
1101   - /**
1102   - * Fecha a janela que mostra os dados
1103   - * Pergunta ao usuario se os graficos devem ser removidos
1104   - * Os graficos sao marcados com o atributo "origem"
1105   - * Os raios e pontos sao sempre removidos
1106   - */
1107   - fechaJanela: function(){
1108   - var temp,
1109   - controle = i3geoOL.getControlsBy("id","i3GeoMedeArea"),
1110   - f = i3GEO.desenho.layergrafico.getFeaturesByAttribute("origem","medeArea");
1111   - if(controle.length > 0){
1112   - controle[0].deactivate();
1113   - i3geoOL.removeControl(controle[0]);
1114   - }
1115   - if(f && f.length > 0){
1116   - temp = window.confirm($trad("x94"));
1117   - if(temp){
1118   - i3GEO.desenho.layergrafico.destroyFeatures(f);
1119   - }
1120   - }
1121   - f = i3GEO.desenho.layergrafico.getFeaturesByAttribute("origem","medeAreaExcluir");
1122   - if(f && f.length > 0){
  1446 + }
  1447 + });
  1448 + i3geoOL.addControl(poligono);
  1449 + }
  1450 + },
  1451 + /*******************************************************************
  1452 + * Soma os valores de distancia guardados em pontos.dist
  1453 + */
  1454 + somaDist : function() {
  1455 + var n, i, total = 0;
  1456 + n = i3GEO.analise.medeArea.pontos.dist.length;
  1457 + for (i = 0; i < n; i++) {
  1458 + total += i3GEO.analise.medeArea.pontos.dist[i];
  1459 + }
  1460 + return total;
  1461 + },
  1462 + /*******************************************************************
  1463 + * Fecha a janela que mostra os dados Pergunta ao usuario se os
  1464 + * graficos devem ser removidos Os graficos sao marcados com o
  1465 + * atributo "origem" Os raios e pontos sao sempre removidos
  1466 + */
  1467 + fechaJanela : function() {
  1468 + var temp, controle = i3geoOL.getControlsBy(
  1469 + "id",
  1470 + "i3GeoMedeArea"), f = i3GEO.desenho.layergrafico.getFeaturesByAttribute(
  1471 + "origem",
  1472 + "medeArea");
  1473 + if (controle.length > 0) {
  1474 + controle[0].deactivate();
  1475 + i3geoOL.removeControl(controle[0]);
  1476 + }
  1477 + if (f
  1478 + && f.length > 0) {
  1479 + temp = window.confirm($trad("x94"));
  1480 + if (temp) {
1123 1481 i3GEO.desenho.layergrafico.destroyFeatures(f);
1124 1482 }
1125   - },
1126   - /**
1127   - * Mostra a totalizacao das linhas ja digitalizadas
1128   - */
1129   - mostraTotal: function(per,area){
1130   - var mostra = $i("mostraarea_calculo"),
1131   - texto;
1132   - if (mostra){
1133   - texto = "<b>"+$trad("d21at")+":</b> "+(area/1000000).toFixed(3)+" km2"+
1134   - "<br><b>"+$trad("d21at")+":</b> "+(area/10000).toFixed(2)+" ha"+
1135   - "<br><b>"+$trad("x98")+":</b> "+(per).toFixed(2)+" km"+
1136   - "<br>"+$trad("x25")+": "+i3GEO.calculo.metododistancia;
1137   - mostra.innerHTML = texto;
1138   - }
1139   - },
1140   - /**
1141   - * Mostra o valor do trecho entre o ultimo ponto clicado e a posicao do mouse
1142   - */
1143   - mostraParcial: function(trecho,per,area,direcao){
1144   - var mostra = $i("mostraarea_calculo_parcial"),
1145   - texto;
1146   - if (mostra){
1147   - texto = "<b>"+$trad("d21at")+":</b> "+(area/1000000).toFixed(3)+" km2"+
1148   - "<br><b>"+$trad("d21at")+":</b> "+(area/10000).toFixed(2)+" ha"+
1149   - "<br><b>"+$trad("x95")+":</b> "+trecho.toFixed(3)+" km"+
1150   - "<br><b>"+$trad("x98")+":</b> "+(per).toFixed(3)+" km" +
1151   - "<br><b>"+$trad("x23")+" (DMS):</b> "+direcao;
1152   - mostra.innerHTML = texto;
1153   - }
  1483 + }
  1484 + f = i3GEO.desenho.layergrafico.getFeaturesByAttribute(
  1485 + "origem",
  1486 + "medeAreaExcluir");
  1487 + if (f
  1488 + && f.length > 0) {
  1489 + i3GEO.desenho.layergrafico.destroyFeatures(f);
1154 1490 }
1155 1491 },
1156   - googlemaps: {
1157   - /**
1158   - * Inicializa o processo
1159   - * Cria a variavel para guardar os pontos
1160   - * Executa a funcao de inicializacao do desenho, que cria o layer para receber os graficos
1161   - */
1162   - inicia: function(){
1163   - if(!google.maps.geometry){
1164   - alert($trad("x99"));
1165   - return;
1166   - }
1167   - i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia();
1168   - i3GeoMap.setOptions({disableDoubleClickZoom:true});
1169   - i3GeoMap.setOptions({draggableCursor:'crosshair'});
1170   - var evtdblclick = null,
1171   - evtclick = null,
1172   - evtmousemove = null,
1173   - pontos = {
1174   - xpt: [],
1175   - ypt: [],
1176   - dist: [],
1177   - mvcLine: new google.maps.MVCArray(),
1178   - mvcMarkers: new google.maps.MVCArray(),
1179   - line: null,
1180   - polygon: null
1181   - },
1182   - termina = function(){
1183   - google.maps.event.removeListener(evtdblclick);
1184   - google.maps.event.removeListener(evtclick);
1185   - google.maps.event.removeListener(evtmousemove);
1186   - pontos.line.setOptions({clickable: true});
1187   - google.maps.event.addListener(pontos.line, 'click', function(shape) {
1188   - if(shape.setEditable){
  1492 + /*******************************************************************
  1493 + * Mostra a totalizacao das linhas ja digitalizadas
  1494 + */
  1495 + mostraTotal : function(per, area) {
  1496 + var mostra = $i("mostraarea_calculo"), texto;
  1497 + if (mostra) {
  1498 + texto = "<b>"
  1499 + + $trad("d21at")
  1500 + + ":</b> "
  1501 + + (area / 1000000).toFixed(3)
  1502 + + " km2"
  1503 + + "<br><b>"
  1504 + + $trad("d21at")
  1505 + + ":</b> "
  1506 + + (area / 10000).toFixed(2)
  1507 + + " ha"
  1508 + + "<br><b>"
  1509 + + $trad("x98")
  1510 + + ":</b> "
  1511 + + (per).toFixed(2)
  1512 + + " km"
  1513 + + "<br>"
  1514 + + $trad("x25")
  1515 + + ": "
  1516 + + i3GEO.calculo.metododistancia;
  1517 + mostra.innerHTML = texto;
  1518 + }
  1519 + },
  1520 + /*******************************************************************
  1521 + * Mostra o valor do trecho entre o ultimo ponto clicado e a posicao
  1522 + * do mouse
  1523 + */
  1524 + mostraParcial : function(trecho, per, area, direcao) {
  1525 + var mostra = $i("mostraarea_calculo_parcial"), texto;
  1526 + if (mostra) {
  1527 + texto = "<b>"
  1528 + + $trad("d21at")
  1529 + + ":</b> "
  1530 + + (area / 1000000).toFixed(3)
  1531 + + " km2"
  1532 + + "<br><b>"
  1533 + + $trad("d21at")
  1534 + + ":</b> "
  1535 + + (area / 10000).toFixed(2)
  1536 + + " ha"
  1537 + + "<br><b>"
  1538 + + $trad("x95")
  1539 + + ":</b> "
  1540 + + trecho.toFixed(3)
  1541 + + " km"
  1542 + + "<br><b>"
  1543 + + $trad("x98")
  1544 + + ":</b> "
  1545 + + (per).toFixed(3)
  1546 + + " km"
  1547 + + "<br><b>"
  1548 + + $trad("x23")
  1549 + + " (DMS):</b> "
  1550 + + direcao;
  1551 + mostra.innerHTML = texto;
  1552 + }
  1553 + }
  1554 + },
  1555 + googlemaps : {
  1556 + /*******************************************************************
  1557 + * Inicializa o processo Cria a variavel para guardar os pontos
  1558 + * Executa a funcao de inicializacao do desenho, que cria o layer
  1559 + * para receber os graficos
  1560 + */
  1561 + inicia : function() {
  1562 + if (!google.maps.geometry) {
  1563 + alert($trad("x99"));
  1564 + return;
  1565 + }
  1566 + i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia();
  1567 + i3GeoMap.setOptions({
  1568 + disableDoubleClickZoom : true
  1569 + });
  1570 + i3GeoMap.setOptions({
  1571 + draggableCursor : 'crosshair'
  1572 + });
  1573 + var evtdblclick = null, evtclick = null, evtmousemove = null, pontos = {
  1574 + xpt : [],
  1575 + ypt : [],
  1576 + dist : [],
  1577 + mvcLine : new google.maps.MVCArray(),
  1578 + mvcMarkers : new google.maps.MVCArray(),
  1579 + line : null,
  1580 + polygon : null
  1581 + }, termina = function() {
  1582 + google.maps.event.removeListener(evtdblclick);
  1583 + google.maps.event.removeListener(evtclick);
  1584 + google.maps.event.removeListener(evtmousemove);
  1585 + pontos.line.setOptions({
  1586 + clickable : true
  1587 + });
  1588 + google.maps.event.addListener(
  1589 + pontos.line,
  1590 + 'click',
  1591 + function(shape) {
  1592 + if (shape.setEditable) {
1189 1593 shape.setEditable(!shape.editable);
1190 1594 }
1191 1595 });
1192   - if(pontos){
1193   - i3GEO.desenho.googlemaps.shapes.push(pontos.mvcLine);
1194   - i3GEO.desenho.googlemaps.shapes.push(pontos.line);
1195   - pontos = null;
1196   - }
1197   - };
1198   - evtclick = google.maps.event.addListener(i3GeoMap, "click", function(evt) {
1199   - var area=0,per;
1200   - // When the map is clicked, pass the LatLng obect to the measureAdd function
  1596 + if (pontos) {
  1597 + i3GEO.desenho.googlemaps.shapes.push(pontos.mvcLine);
  1598 + i3GEO.desenho.googlemaps.shapes.push(pontos.line);
  1599 + pontos = null;
  1600 + }
  1601 + };
  1602 + evtclick = google.maps.event.addListener(
  1603 + i3GeoMap,
  1604 + "click",
  1605 + function(evt) {
  1606 + var area = 0, per;
  1607 + // When the map is clicked, pass the LatLng obect to the
  1608 + // measureAdd function
1201 1609 pontos.mvcLine.push(evt.latLng);
1202 1610 pontos.xpt.push(evt.latLng.lng());
1203 1611 pontos.ypt.push(evt.latLng.lat());
1204   - //desenha um circulo
  1612 + // desenha um circulo
1205 1613 if (pontos.mvcLine.getLength() > 0) {
1206 1614 per = google.maps.geometry.spherical.computeLength(pontos.mvcLine);
1207 1615 area = google.maps.geometry.spherical.computeArea(pontos.mvcLine);
1208   - i3GEO.analise.medeArea.googlemaps.mostraTotal(per,area);
  1616 + i3GEO.analise.medeArea.googlemaps.mostraTotal(
  1617 + per,
  1618 + area);
1209 1619 }
1210   - //desenha uma marca no ponto
1211   - i3GEO.desenho.googlemaps.shapes.push(
1212   - new google.maps.Marker({
1213   - map: i3GeoMap,
1214   - fillOpacity: 0,
1215   - clickable: false,
1216   - position:evt.latLng,
1217   - icon: {
1218   - path: google.maps.SymbolPath.CIRCLE,
1219   - scale: 2.5,
1220   - strokeColor: "#ffffff"
1221   - },
1222   - origem: "medeAreaExcluir"
1223   - })
1224   - );
1225   - //mais um ponto para criar uma linha movel
  1620 + // desenha uma marca no ponto
  1621 + i3GEO.desenho.googlemaps.shapes.push(new google.maps.Marker(
  1622 + {
  1623 + map : i3GeoMap,
  1624 + fillOpacity : 0,
  1625 + clickable : false,
  1626 + position : evt.latLng,
  1627 + icon : {
  1628 + path : google.maps.SymbolPath.CIRCLE,
  1629 + scale : 2.5,
  1630 + strokeColor : "#ffffff"
  1631 + },
  1632 + origem : "medeAreaExcluir"
  1633 + }));
  1634 + // mais um ponto para criar uma linha movel
1226 1635 pontos.mvcLine.push(evt.latLng);
1227 1636 });
1228   - evtmousemove = google.maps.event.addListener(i3GeoMap, "mousemove", function(evt) {
1229   - if(!$i("mostraarea_calculo")){
  1637 + evtmousemove = google.maps.event.addListener(
  1638 + i3GeoMap,
  1639 + "mousemove",
  1640 + function(evt) {
  1641 + if (!$i("mostraarea_calculo")) {
1230 1642 termina.call();
1231 1643 return;
1232 1644 }
1233   - var x1,y1,x2,y2,direcao,per,area,
1234   - estilo = i3GEO.desenho.estilos[i3GEO.desenho.estiloPadrao],
1235   - n = pontos.xpt.length;
  1645 + var x1, y1, x2, y2, direcao, per, area, estilo = i3GEO.desenho.estilos[i3GEO.desenho.estiloPadrao], n = pontos.xpt.length;
1236 1646  
1237 1647 // If there is more than one vertex on the line
1238 1648 if (pontos.mvcLine.getLength() > 0) {
1239 1649 // If the line hasn't been created yet
1240 1650 if (!pontos.line) {
1241 1651 // Create the line (google.maps.Polyline)
1242   - pontos.line = new google.maps.Polygon({
1243   - map: i3GeoMap,
1244   - clickable: false,
1245   - strokeColor: estilo.linecolor,
1246   - strokeOpacity: 1,
1247   - strokeWeight: estilo.linewidth,
1248   - path:pontos.mvcLine,
1249   - origem: "medeArea"
1250   - });
  1652 + pontos.line = new google.maps.Polygon(
  1653 + {
  1654 + map : i3GeoMap,
  1655 + clickable : false,
  1656 + strokeColor : estilo.linecolor,
  1657 + strokeOpacity : 1,
  1658 + strokeWeight : estilo.linewidth,
  1659 + path : pontos.mvcLine,
  1660 + origem : "medeArea"
  1661 + });
1251 1662 }
1252 1663 pontos.mvcLine.pop();
1253 1664 pontos.mvcLine.push(evt.latLng);
1254 1665 per = google.maps.geometry.spherical.computeLength(pontos.mvcLine);
1255   - x1 = pontos.xpt[n-1];
1256   - y1 = pontos.ypt[n-1];
  1666 + x1 = pontos.xpt[n - 1];
  1667 + y1 = pontos.ypt[n - 1];
1257 1668 x2 = evt.latLng.lng();
1258 1669 y2 = evt.latLng.lat();
1259   - trecho = i3GEO.calculo.distancia(x1,y1,x2,y2);
1260   - direcao = i3GEO.calculo.direcao(x1,y1,x2,y2);
1261   - direcao = i3GEO.calculo.dd2dms(direcao,direcao);
  1670 + trecho = i3GEO.calculo.distancia(
  1671 + x1,
  1672 + y1,
  1673 + x2,
  1674 + y2);
  1675 + direcao = i3GEO.calculo.direcao(
  1676 + x1,
  1677 + y1,
  1678 + x2,
  1679 + y2);
  1680 + direcao = i3GEO.calculo.dd2dms(
  1681 + direcao,
  1682 + direcao);
1262 1683 direcao = direcao[0];
1263 1684 area = google.maps.geometry.spherical.computeArea(pontos.mvcLine);
1264   - i3GEO.analise.medeArea.googlemaps.mostraParcial(trecho,per,area,direcao);
  1685 + i3GEO.analise.medeArea.googlemaps.mostraParcial(
  1686 + trecho,
  1687 + per,
  1688 + area,
  1689 + direcao);
1265 1690 }
1266 1691 });
1267   - evtdblclick = google.maps.event.addListener(i3GeoMap, "dblclick", function(evt) {
1268   - pontos.mvcLine.push(new google.maps.LatLng(pontos.ypt[0],pontos.xpt[0]));
1269   - var per = google.maps.geometry.spherical.computeLength(pontos.mvcLine),
1270   - area = google.maps.geometry.spherical.computeArea(pontos.mvcLine);
1271   - i3GEO.analise.medeArea.googlemaps.mostraTotal(per,area);
  1692 + evtdblclick = google.maps.event.addListener(
  1693 + i3GeoMap,
  1694 + "dblclick",
  1695 + function(evt) {
  1696 + pontos.mvcLine.push(new google.maps.LatLng(
  1697 + pontos.ypt[0],
  1698 + pontos.xpt[0]));
  1699 + var per = google.maps.geometry.spherical.computeLength(pontos.mvcLine), area = google.maps.geometry.spherical.computeArea(pontos.mvcLine);
  1700 + i3GEO.analise.medeArea.googlemaps.mostraTotal(
  1701 + per,
  1702 + area);
1272 1703 termina.call();
1273 1704 });
1274   - },
1275   - /**
1276   - * Soma os valores de distancia guardados em pontos.dist
1277   - */
1278   - somaDist: function(pontos){
1279   - var n,i,
1280   - total = 0;
1281   - n = pontos.dist.length;
1282   - for(i=0;i<n;i++){
1283   - total += pontos.dist[i];
1284   - }
1285   - return total;
1286   - },
1287   - /**
1288   - * Fecha a janela que mostra os dados
1289   - * Pergunta ao usuario se os graficos devem ser removidos
1290   - * Os graficos sao marcados com o atributo "origem"
1291   - * Os raios e pontos sao sempre removidos
1292   - */
1293   - fechaJanela: function(){
1294   - i3GeoMap.setOptions({disableDoubleClickZoom:false});
1295   - i3GeoMap.setOptions({draggableCursor:undefined});
1296   - var f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem","medeArea");
1297   - if(f && f.length > 0){
1298   - temp = window.confirm($trad("x94"));
1299   - if(temp){
1300   - i3GEO.desenho.googlemaps.destroyFeatures(f);
1301   - }
1302   - }
1303   - f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem","medeAreaExcluir");
1304   - if(f && f.length > 0){
  1705 + },
  1706 + /***
  1707 + * Soma os valores de distancia guardados em pontos.dist
  1708 + */
  1709 + somaDist : function(pontos) {
  1710 + var n, i, total = 0;
  1711 + n = pontos.dist.length;
  1712 + for (i = 0; i < n; i++) {
  1713 + total += pontos.dist[i];
  1714 + }
  1715 + return total;
  1716 + },
  1717 + /***
  1718 + * Fecha a janela que mostra os dados
  1719 + * Pergunta ao usuario se os graficos devem ser removidos
  1720 + * Os graficos sao marcados com o atributo "origem"
  1721 + * Os raios e pontos sao sempre removidos
  1722 + */
  1723 + fechaJanela : function() {
  1724 + i3GeoMap.setOptions({
  1725 + disableDoubleClickZoom : false
  1726 + });
  1727 + i3GeoMap.setOptions({
  1728 + draggableCursor : undefined
  1729 + });
  1730 + var f = i3GEO.desenho.googlemaps.getFeaturesByAttribute(
  1731 + "origem",
  1732 + "medeArea");
  1733 + if (f
  1734 + && f.length > 0) {
  1735 + temp = window.confirm($trad("x94"));
  1736 + if (temp) {
1305 1737 i3GEO.desenho.googlemaps.destroyFeatures(f);
1306 1738 }
1307   - },
1308   - /**
1309   - * Mostra a totalizacao das linhas ja digitalizadas
1310   - */
1311   - mostraTotal: function(per,area){
1312   - var mostra = $i("mostraarea_calculo"),
1313   - texto;
1314   - if (mostra){
1315   - texto = "<b>"+$trad("d21at")+":</b> "+(area/1000000).toFixed(3)+" km2"+
1316   - "<br><b>"+$trad("d21at")+":</b> "+(area/10000).toFixed(2)+" ha"+
1317   - "<br><b>"+$trad("x98")+":</b> "+(per).toFixed(2)+" km"+
1318   - "<br>"+$trad("x25")+": "+i3GEO.calculo.metododistancia;
1319   - mostra.innerHTML = texto;
1320   - }
1321   - },
1322   - /**
1323   - * Mostra o valor do trecho entre o ultimo ponto clicado e a posicao do mouse
1324   - */
1325   - mostraParcial: function(trecho,per,area,direcao){
1326   - var mostra = $i("mostraarea_calculo_parcial"),
1327   - texto;
1328   - if (mostra){
1329   - texto = "<b>"+$trad("d21at")+":</b> "+(area/1000000).toFixed(3)+" km2"+
1330   - "<br><b>"+$trad("d21at")+":</b> "+(area/10000).toFixed(2)+" ha"+
1331   - "<br><b>"+$trad("x95")+":</b> "+trecho.toFixed(3)+" km"+
1332   - "<br><b>"+$trad("x98")+":</b> "+(per).toFixed(3)+" km" +
1333   - "<br><b>"+$trad("x23")+" (DMS):</b> "+direcao;
1334   - mostra.innerHTML = texto;
1335   - }
  1739 + }
  1740 + f = i3GEO.desenho.googlemaps.getFeaturesByAttribute(
  1741 + "origem",
  1742 + "medeAreaExcluir");
  1743 + if (f
  1744 + && f.length > 0) {
  1745 + i3GEO.desenho.googlemaps.destroyFeatures(f);
  1746 + }
  1747 + },
  1748 + /**
  1749 + * Mostra a totalizacao das linhas ja digitalizadas
  1750 + */
  1751 + mostraTotal : function(per, area) {
  1752 + var mostra = $i("mostraarea_calculo"), texto;
  1753 + if (mostra) {
  1754 + texto = "<b>"
  1755 + + $trad("d21at")
  1756 + + ":</b> "
  1757 + + (area / 1000000).toFixed(3)
  1758 + + " km2"
  1759 + + "<br><b>"
  1760 + + $trad("d21at")
  1761 + + ":</b> "
  1762 + + (area / 10000).toFixed(2)
  1763 + + " ha"
  1764 + + "<br><b>"
  1765 + + $trad("x98")
  1766 + + ":</b> "
  1767 + + (per).toFixed(2)
  1768 + + " km"
  1769 + + "<br>"
  1770 + + $trad("x25")
  1771 + + ": "
  1772 + + i3GEO.calculo.metododistancia;
  1773 + mostra.innerHTML = texto;
1336 1774 }
1337 1775 },
1338   - googleearth: {
  1776 + /***************************************************************
  1777 + * Mostra o valor do trecho entre o ultimo ponto clicado e a
  1778 + * posicao do mouse
  1779 + */
  1780 + mostraParcial : function(trecho, per, area, direcao) {
  1781 + var mostra = $i("mostraarea_calculo_parcial"), texto;
  1782 + if (mostra) {
  1783 + texto = "<b>"
  1784 + + $trad("d21at")
  1785 + + ":</b> "
  1786 + + (area / 1000000).toFixed(3)
  1787 + + " km2"
  1788 + + "<br><b>"
  1789 + + $trad("d21at")
  1790 + + ":</b> "
  1791 + + (area / 10000).toFixed(2)
  1792 + + " ha"
  1793 + + "<br><b>"
  1794 + + $trad("x95")
  1795 + + ":</b> "
  1796 + + trecho.toFixed(3)
  1797 + + " km"
  1798 + + "<br><b>"
  1799 + + $trad("x98")
  1800 + + ":</b> "
  1801 + + (per).toFixed(3)
  1802 + + " km"
  1803 + + "<br><b>"
  1804 + + $trad("x23")
  1805 + + " (DMS):</b> "
  1806 + + direcao;
  1807 + mostra.innerHTML = texto;
  1808 + }
1339 1809 }
1340   - }
  1810 + },
  1811 + googleearth : {}
  1812 + }
1341 1813 };
... ...