Commit cad328a447ea553a8fb587251e286c80444f1b91
1 parent
8075909f
Exists in
master
and in
7 other branches
Inclusão da ferramenta para cálculo de centro médio e centro médio ponderado
Showing
10 changed files
with
378 additions
and
1 deletions
Show diff stats
admin/admin.db
No preview for this file type
classesjs/classe_analise.js
| @@ -153,6 +153,15 @@ i3GEO.analise = { | @@ -153,6 +153,15 @@ i3GEO.analise = { | ||
| 153 | {i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.pontoempoligono()","pontoempoligono","pontoEmPoligono");} | 153 | {i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.pontoempoligono()","pontoempoligono","pontoEmPoligono");} |
| 154 | }, | 154 | }, |
| 155 | /* | 155 | /* |
| 156 | + Function: centromassa | ||
| 157 | + | ||
| 158 | + Abre a janela de diálogo da ferramenta centro médio | ||
| 159 | + */ | ||
| 160 | + centromassa: function(){ | ||
| 161 | + if(typeof(i3GEOF.centromassa) === 'undefined') | ||
| 162 | + {i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.centromassa()","centromassa","centromassa");} | ||
| 163 | + }, | ||
| 164 | + /* | ||
| 156 | Function: nptPol | 165 | Function: nptPol |
| 157 | 166 | ||
| 158 | Abre a janela de diálogo da ferramenta nptpol | 167 | Abre a janela de diálogo da ferramenta nptpol |
classesjs/classe_configura.js
| @@ -131,6 +131,7 @@ i3GEO.configura = { | @@ -131,6 +131,7 @@ i3GEO.configura = { | ||
| 131 | { id:"omenudataAnalise7",text: $trad("u12"), url: "javascript:i3GEO.analise.dialogo.nptPol()" }, | 131 | { id:"omenudataAnalise7",text: $trad("u12"), url: "javascript:i3GEO.analise.dialogo.nptPol()" }, |
| 132 | { id:"omenudataAnalise8",text: $trad("u13"), url: "javascript:i3GEO.analise.dialogo.pontoempoligono()" }, | 132 | { id:"omenudataAnalise8",text: $trad("u13"), url: "javascript:i3GEO.analise.dialogo.pontoempoligono()" }, |
| 133 | { id:"omenudataAnalise9",text: $trad("u14"), url: "javascript:i3GEO.analise.dialogo.pontosdistri()" }, | 133 | { id:"omenudataAnalise9",text: $trad("u14"), url: "javascript:i3GEO.analise.dialogo.pontosdistri()" }, |
| 134 | + { id:"omenudataAnalise9a",text: $trad("u28"), url: "javascript:i3GEO.analise.dialogo.centromassa()" }, | ||
| 134 | { id:"omenudataAnalise10",text: '<span style=color:gray;text-decoration:underline; ><b>'+$trad("u24")+'</b></span>',url: "#"}, | 135 | { id:"omenudataAnalise10",text: '<span style=color:gray;text-decoration:underline; ><b>'+$trad("u24")+'</b></span>',url: "#"}, |
| 135 | { id:"omenudataAnalise11",text: $trad("u25"), url: "javascript:i3GEO.analise.dialogo.dissolve()" }, | 136 | { id:"omenudataAnalise11",text: $trad("u25"), url: "javascript:i3GEO.analise.dialogo.dissolve()" }, |
| 136 | { id:"omenudataAnalise12",text: '<span style=color:gray;text-decoration:underline; ><b>'+$trad("u27")+'</b></span>',url: "#"}, | 137 | { id:"omenudataAnalise12",text: '<span style=color:gray;text-decoration:underline; ><b>'+$trad("u27")+'</b></span>',url: "#"}, |
classesjs/dicionario.js
| @@ -395,6 +395,13 @@ en:"Others", | @@ -395,6 +395,13 @@ en:"Others", | ||
| 395 | es:"Otros", | 395 | es:"Otros", |
| 396 | it:"Altri" | 396 | it:"Altri" |
| 397 | }], | 397 | }], |
| 398 | +"u28": [ | ||
| 399 | +{ | ||
| 400 | +pt: "Centro médio", | ||
| 401 | +en:"Centro médio", | ||
| 402 | +es:"Centro médio", | ||
| 403 | +it:"Centro médio" | ||
| 404 | +}], | ||
| 398 | //arvore com a lista de temas | 405 | //arvore com a lista de temas |
| 399 | "t1": [ | 406 | "t1": [ |
| 400 | { | 407 | { |
classesjs/dicionario_ajuda.js
| @@ -794,6 +794,15 @@ g_traducao_ajuda = { | @@ -794,6 +794,15 @@ g_traducao_ajuda = { | ||
| 794 | pt:"Mostra os comentários existentes sobre o tema e permite ao usuário inserir novos", | 794 | pt:"Mostra os comentários existentes sobre o tema e permite ao usuário inserir novos", |
| 795 | complemento:"Para entar com um comentário, o usuário precisa ser autenticado em alguma das redes sociais compatíveis com a rotina de login disponível no i3Geo", | 795 | complemento:"Para entar com um comentário, o usuário precisa ser autenticado em alguma das redes sociais compatíveis com a rotina de login disponível no i3Geo", |
| 796 | apijs:"i3GEO.tema.dialogo.comentario()" | 796 | apijs:"i3GEO.tema.dialogo.comentario()" |
| 797 | + }, | ||
| 798 | + "94": { | ||
| 799 | + titulo: "Centro médio", | ||
| 800 | + diretorio:"i3geo/ferramentas/centromassa", | ||
| 801 | + categoria:"3", | ||
| 802 | + pt:"O centro médio é uma medida da distribuição de um conjunto de pontos. Sendo definido por Gerardi & Silva (1980) como: o ponto que minimiza a soma das distâncias quadráticas a todos os outros pontos do plano", | ||
| 803 | + complemento:"Mais detalhes em http://www.criminologia-rsm.org/LinkClick.aspx?fileticket=XT%2BDy%2BNyrZM%3D&tabid=484&mid=1614", | ||
| 804 | + tela:"ferramentas/nptpol/exemplo.htm", | ||
| 805 | + apijs:"i3GEO.analise.dialogo.centromassa()" | ||
| 797 | } | 806 | } |
| 798 | } | 807 | } |
| 799 | }; | 808 | }; |
classesphp/classe_analise.php
| @@ -1314,6 +1314,90 @@ nome do layer criado com o buffer. | @@ -1314,6 +1314,90 @@ nome do layer criado com o buffer. | ||
| 1314 | return($novolayer->name); | 1314 | return($novolayer->name); |
| 1315 | } | 1315 | } |
| 1316 | /* | 1316 | /* |
| 1317 | +function: centroMassa | ||
| 1318 | + | ||
| 1319 | +Calcula o centro médio. | ||
| 1320 | + | ||
| 1321 | +Se "item" for diferente de vazio, calcula o centro médio ponderado baseado no item | ||
| 1322 | + | ||
| 1323 | +Parametros: | ||
| 1324 | + | ||
| 1325 | +$item {string} - (opcional) Item q será utilizado para ponderar os valores. | ||
| 1326 | +*/ | ||
| 1327 | + function centroMassa($item="") | ||
| 1328 | + { | ||
| 1329 | + if(!$this->layer){return "erro";} | ||
| 1330 | + set_time_limit(180); | ||
| 1331 | + //para manipular dbf | ||
| 1332 | + if(file_exists($this->locaplic."/pacotes/phpxbase/api_conversion.php")) | ||
| 1333 | + include_once($this->locaplic."/pacotes/phpxbase/api_conversion.php"); | ||
| 1334 | + else | ||
| 1335 | + include_once "../pacotes/phpxbase/api_conversion.php"; | ||
| 1336 | + error_reporting(E_ALL); | ||
| 1337 | + $nomeCentro = nomeRandomico(); | ||
| 1338 | + $nomeshp = $this->diretorio."/".$nomeCentro; | ||
| 1339 | + //pega os shapes selecionados | ||
| 1340 | + carregaquery($this->arquivo,&$this->layer,&$this->mapa); | ||
| 1341 | + if($this->layer->getNumresults() == 0) | ||
| 1342 | + {$this->layer->querybyrect($this->mapa->extent);} | ||
| 1343 | + $sopen = $this->layer->open(); | ||
| 1344 | + if($sopen == MS_FAILURE){return "erro";} | ||
| 1345 | + $this->layer->open(); | ||
| 1346 | + $res_count = $this->layer->getNumresults(); | ||
| 1347 | + $shapes = array(); | ||
| 1348 | + $pondera = 1; | ||
| 1349 | + $xs = 0; | ||
| 1350 | + $ys = 0; | ||
| 1351 | + for ($i = 0; $i < $res_count; ++$i) | ||
| 1352 | + { | ||
| 1353 | + $result = $this->layer->getResult($i); | ||
| 1354 | + $shp_index = $result->shapeindex; | ||
| 1355 | + $shape = $this->layer->getfeature($shp_index,-1); | ||
| 1356 | + if($item != "") | ||
| 1357 | + {$pondera = $shape->values[$item];} | ||
| 1358 | + $pt = $shape->line(0)->point(0); | ||
| 1359 | + $xs += ($pt->x * $pondera); | ||
| 1360 | + $ys += ($pt->y * $pondera); | ||
| 1361 | + } | ||
| 1362 | + $fechou = $this->layer->close(); | ||
| 1363 | + //gera o novo arquivo shape file | ||
| 1364 | + // cria o shapefile | ||
| 1365 | + $novoshpf = ms_newShapefileObj($nomeshp, MS_SHP_POINT); | ||
| 1366 | + // cria o dbf | ||
| 1367 | + $def[] = array("id","C","254"); | ||
| 1368 | + if(!function_exists("dbase_create")) | ||
| 1369 | + {$db = xbase_create($nomeshp.".dbf", $def);xbase_close($db);} | ||
| 1370 | + else | ||
| 1371 | + {$db = dbase_create($nomeshp.".dbf", $def);dbase_close($db);} | ||
| 1372 | + //acrescenta os pontos no novo shapefile | ||
| 1373 | + $dbname = $nomeshp.".dbf"; | ||
| 1374 | + $db=xbase_open($dbname,2); | ||
| 1375 | + $reg[] = ""; | ||
| 1376 | + | ||
| 1377 | + $shp = ms_newShapeObj(MS_SHP_POINT); | ||
| 1378 | + $linha = ms_newLineObj(); | ||
| 1379 | + $linha->addXY(($xs / $res_count),($ys / $res_count)); | ||
| 1380 | + $shp->add($linha); | ||
| 1381 | + $novoshpf->addShape($shp); | ||
| 1382 | + | ||
| 1383 | + xbase_add_record($db,$reg); | ||
| 1384 | + $novoshpf->free(); | ||
| 1385 | + xbase_close($db); | ||
| 1386 | + //adiciona no mapa atual o novo tema | ||
| 1387 | + $novolayer = criaLayer($this->mapa,MS_LAYER_POINT,MS_DEFAULT,("Centróide (".$nomeCentro.")"),$metaClasse="SIM"); | ||
| 1388 | + $novolayer->set("data",$nomeshp.".shp"); | ||
| 1389 | + $novolayer->setmetadata("DOWNLOAD","SIM"); | ||
| 1390 | + $novolayer->set("template","none.htm"); | ||
| 1391 | + $novolayer->setmetadata("TEMALOCAL","SIM"); | ||
| 1392 | + $classe = $novolayer->getclass(0); | ||
| 1393 | + $estilo = $classe->getstyle(0); | ||
| 1394 | + $estilo->set("size","12"); | ||
| 1395 | + //limpa selecao | ||
| 1396 | + if (file_exists($this->qyfile)) | ||
| 1397 | + {unlink ($this->qyfile);} | ||
| 1398 | + return("ok"); | ||
| 1399 | + } | ||
| 1400 | +/* | ||
| 1317 | function: criaCentroide | 1401 | function: criaCentroide |
| 1318 | 1402 | ||
| 1319 | Gera centroide dos elementos selecionados de um tema. | 1403 | Gera centroide dos elementos selecionados de um tema. |
| @@ -1394,6 +1478,7 @@ $locaplic - Localização do I3geo. | @@ -1394,6 +1478,7 @@ $locaplic - Localização do I3geo. | ||
| 1394 | {unlink ($this->qyfile);} | 1478 | {unlink ($this->qyfile);} |
| 1395 | return("ok"); | 1479 | return("ok"); |
| 1396 | } | 1480 | } |
| 1481 | + | ||
| 1397 | /* | 1482 | /* |
| 1398 | function: gradeDePontos | 1483 | function: gradeDePontos |
| 1399 | 1484 |
classesphp/mapa_controle.php
| @@ -484,7 +484,7 @@ Salva o mapa acrescentando um novo layer com os pontos. | @@ -484,7 +484,7 @@ Salva o mapa acrescentando um novo layer com os pontos. | ||
| 484 | case "CRIACENTROIDE": | 484 | case "CRIACENTROIDE": |
| 485 | include_once("classe_analise.php"); | 485 | include_once("classe_analise.php"); |
| 486 | copiaSeguranca($map_file); | 486 | copiaSeguranca($map_file); |
| 487 | - $m = new Analise($map_file,$tema,$locaplic); | 487 | + $m = new Analise($map_file,$tema,$locaplic,$ext); |
| 488 | if($interface == "googlemaps") | 488 | if($interface == "googlemaps") |
| 489 | { | 489 | { |
| 490 | $projMapa = $m->mapa->getProjection(); | 490 | $projMapa = $m->mapa->getProjection(); |
| @@ -496,6 +496,29 @@ Salva o mapa acrescentando um novo layer com os pontos. | @@ -496,6 +496,29 @@ Salva o mapa acrescentando um novo layer com os pontos. | ||
| 496 | $m->salva(); | 496 | $m->salva(); |
| 497 | break; | 497 | break; |
| 498 | /* | 498 | /* |
| 499 | +Valor: CENTROMASSA | ||
| 500 | + | ||
| 501 | +Calcula o centro médio de uma distribuição de pontos. | ||
| 502 | + | ||
| 503 | +Salva o mapa acrescentando um novo layer com o ponto. | ||
| 504 | + | ||
| 505 | +<Analise->centroMassa> | ||
| 506 | +*/ | ||
| 507 | + case "CENTROMASSA": | ||
| 508 | + include_once("classe_analise.php"); | ||
| 509 | + copiaSeguranca($map_file); | ||
| 510 | + $m = new Analise($map_file,$tema,$locaplic,$ext); | ||
| 511 | + if($interface == "googlemaps") | ||
| 512 | + { | ||
| 513 | + $projMapa = $m->mapa->getProjection(); | ||
| 514 | + $m->mapa->setProjection("init=epsg:4291"); | ||
| 515 | + } | ||
| 516 | + $retorno = $m->centroMassa($item); | ||
| 517 | + if($interface == "googlemaps") | ||
| 518 | + {$m->mapa->setProjection($projMapa);} | ||
| 519 | + $m->salva(); | ||
| 520 | + break; | ||
| 521 | +/* | ||
| 499 | Valor: ANALISEDISTRIPT | 522 | Valor: ANALISEDISTRIPT |
| 500 | 523 | ||
| 501 | Gera análise de distribuição de pontos. | 524 | Gera análise de distribuição de pontos. |
| @@ -0,0 +1,13 @@ | @@ -0,0 +1,13 @@ | ||
| 1 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | ||
| 2 | +<html> | ||
| 3 | +<head> | ||
| 4 | +<script type="text/javascript" src="../../classesjs/i3geo.js"></script> | ||
| 5 | +</head> | ||
| 6 | +<body name="ancora" id="i3geo" class=yui-skin-sam > | ||
| 7 | +<script type="text/javascript"> | ||
| 8 | +i3GEO.configura.locaplic = i3GEO.util.protocolo()+"://"+window.location.host+"/i3geo"; | ||
| 9 | +i3GEO.parametros.mapfile = "x" | ||
| 10 | +i3GEO.analise.dialogo.nptPol() | ||
| 11 | +</script> | ||
| 12 | +</body> | ||
| 13 | +</html> | ||
| 0 | \ No newline at end of file | 14 | \ No newline at end of file |
| @@ -0,0 +1,230 @@ | @@ -0,0 +1,230 @@ | ||
| 1 | +<?php error_reporting(0);if(extension_loaded('zlib')){ob_start('ob_gzhandler');} header("Content-type: text/javascript"); ?> | ||
| 2 | +/*jslint plusplus:false,white:false,undef: false, rhino: true, onevar: true, evil: true */ | ||
| 3 | +/* | ||
| 4 | +Title: Centro de massa | ||
| 5 | + | ||
| 6 | +Calcula o centro médio e centro médio ponderado de um conjunto de pontos | ||
| 7 | + | ||
| 8 | +Veja: | ||
| 9 | + | ||
| 10 | +<i3GEO.analise.centromassa> | ||
| 11 | + | ||
| 12 | +Arquivo: | ||
| 13 | + | ||
| 14 | +i3geo/ferramentas/centromassa/index.js.php | ||
| 15 | + | ||
| 16 | +Licenca: | ||
| 17 | + | ||
| 18 | +GPL2 | ||
| 19 | + | ||
| 20 | +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | ||
| 21 | + | ||
| 22 | +Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | ||
| 23 | +Desenvolvedor: Edmar Moretti edmar.moretti@mma.gov.br | ||
| 24 | + | ||
| 25 | +Este programa é software livre; você pode redistribuí-lo | ||
| 26 | +e/ou modificá-lo sob os termos da Licença Pública Geral | ||
| 27 | +GNU conforme publicada pela Free Software Foundation; | ||
| 28 | + | ||
| 29 | +Este programa é distribuído na expectativa de que seja útil, | ||
| 30 | +porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | ||
| 31 | +de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | ||
| 32 | +Consulte a Licença Pública Geral do GNU para mais detalhes. | ||
| 33 | +Você deve ter recebido uma cópia da Licença Pública Geral do | ||
| 34 | +GNU junto com este programa; se não, escreva para a | ||
| 35 | +Free Software Foundation, Inc., no endereço | ||
| 36 | +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | ||
| 37 | +*/ | ||
| 38 | +if(typeof(i3GEOF) === 'undefined'){ | ||
| 39 | + i3GEOF = []; | ||
| 40 | +} | ||
| 41 | +/* | ||
| 42 | +Classe: i3GEOF.centromassa | ||
| 43 | +*/ | ||
| 44 | +i3GEOF.centromassa = { | ||
| 45 | + /* | ||
| 46 | + Variavel: aguarde | ||
| 47 | + | ||
| 48 | + Estilo do objeto DOM com a imagem de aguarde existente no cabeçalho da janela. | ||
| 49 | + */ | ||
| 50 | + aguarde: "", | ||
| 51 | + /* | ||
| 52 | + Function: inicia | ||
| 53 | + | ||
| 54 | + Inicia a ferramenta. É chamado por criaJanelaFlutuante | ||
| 55 | + | ||
| 56 | + Parametro: | ||
| 57 | + | ||
| 58 | + iddiv {String} - id do div que receberá o conteudo HTML da ferramenta | ||
| 59 | + */ | ||
| 60 | + inicia: function(iddiv){ | ||
| 61 | + try{ | ||
| 62 | + $i(iddiv).innerHTML += i3GEOF.centromassa.html(); | ||
| 63 | + i3GEOF.centromassa.t0(); | ||
| 64 | + } | ||
| 65 | + catch(erro){alert(erro);} | ||
| 66 | + }, | ||
| 67 | + /* | ||
| 68 | + Function: html | ||
| 69 | + | ||
| 70 | + Gera o código html para apresentação das opções da ferramenta | ||
| 71 | + | ||
| 72 | + Retorno: | ||
| 73 | + | ||
| 74 | + String com o código html | ||
| 75 | + */ | ||
| 76 | + html:function(){ | ||
| 77 | + var ins = ''; | ||
| 78 | + ins += '<div style="background-color:#F2F2F2;top:0px;left:0px;display:block;width:98%;" id="i3GEOcentromassaresultado" >'; | ||
| 79 | + ins += '</div>'; | ||
| 80 | + ins += '<div style="top:10px;left:0px;display:block;width:98%;color:red" id="i3GEOcentromassafim" >'; | ||
| 81 | + ins += '</div>'; | ||
| 82 | + return ins; | ||
| 83 | + }, | ||
| 84 | + /* | ||
| 85 | + Function: criaJanelaFlutuante | ||
| 86 | + | ||
| 87 | + Cria a janela flutuante para controle da ferramenta. | ||
| 88 | + */ | ||
| 89 | + criaJanelaFlutuante: function(){ | ||
| 90 | + var minimiza,cabecalho,janela,divid,temp,titulo; | ||
| 91 | + //cria a janela flutuante | ||
| 92 | + titulo = "Centro de massa <a class=ajuda_usuario target=_blank href='" + i3GEO.configura.locaplic + "/ajuda_usuario.php?idcategoria=3&idajuda=94' > </a>"; | ||
| 93 | + cabecalho = function(){}; | ||
| 94 | + minimiza = function(){ | ||
| 95 | + i3GEO.janela.minimiza("i3GEOF.centromassa"); | ||
| 96 | + }; | ||
| 97 | + janela = i3GEO.janela.cria( | ||
| 98 | + "400px", | ||
| 99 | + "250px", | ||
| 100 | + "", | ||
| 101 | + "", | ||
| 102 | + "", | ||
| 103 | + titulo, | ||
| 104 | + "i3GEOF.centromassa", | ||
| 105 | + false, | ||
| 106 | + "hd", | ||
| 107 | + cabecalho, | ||
| 108 | + minimiza | ||
| 109 | + ); | ||
| 110 | + divid = janela[2].id; | ||
| 111 | + i3GEOF.centromassa.aguarde = $i("i3GEOF.centromassa_imagemCabecalho").style; | ||
| 112 | + i3GEOF.centromassa.inicia(divid); | ||
| 113 | + }, | ||
| 114 | + t0: function() | ||
| 115 | + { | ||
| 116 | + var ins = "<p class='paragrafo'>O centro médio é uma operação que resulta em um novo tema contendo o ponto que indica o centro de equilíbrio de uma distribuição.</p>"; | ||
| 117 | + ins += "<p class='paragrafo'>Para gerar o cálculo é necessário que no mapa exista pelo menos um tema de pontos. Se não houverem elementos selecionados, será considerada a extensão geográfica.</p>"; | ||
| 118 | + i3GEO.util.proximoAnterior("","i3GEOF.centromassa.t1()",ins,"i3GEOFgradeDePontost0","i3GEOcentromassaresultado"); | ||
| 119 | + }, | ||
| 120 | + t1: function(){ | ||
| 121 | + var ins = "<p class='paragrafo' >Tema contendo os pontos:<br>"; | ||
| 122 | + ins += "<div style='text-align:left;' id='i3GEOcentromassaDivPontos' ></div><br>"; | ||
| 123 | + ins += "<p class='paragrafo' >Utilizar o seguinte item para ponderar os valores:<br>"; | ||
| 124 | + ins += "<div id=i3GEOondeItens style='text-align:left;display:block' ></div>" | ||
| 125 | + i3GEO.util.proximoAnterior("i3GEOF.centromassa.t0()","i3GEOF.centromassa.t2()",ins,"i3GEOF.centromassa.t1","i3GEOcentromassaresultado"); | ||
| 126 | + i3GEOF.centromassa.comboTemasPontos(); | ||
| 127 | + }, | ||
| 128 | + t2: function(){ | ||
| 129 | + var ins = "<p class='paragrafo'>O tema com o centro será adicionado ao mapa atual."; | ||
| 130 | + ins += "<br><br><input id=i3GEOcentromassabotao1 type='buttom' value='Calcular' />"; | ||
| 131 | + i3GEO.util.proximoAnterior("i3GEOF.centromassa.t1()","",ins,"i3GEOF.centromassa.t2","i3GEOcentromassaresultado"); | ||
| 132 | + new YAHOO.widget.Button( | ||
| 133 | + "i3GEOcentromassabotao1", | ||
| 134 | + {onclick:{fn: i3GEOF.centromassa.calcula}} | ||
| 135 | + ); | ||
| 136 | + }, | ||
| 137 | + /* | ||
| 138 | + Function: calcula | ||
| 139 | + | ||
| 140 | + Faz o cálculo | ||
| 141 | + | ||
| 142 | + Veja: | ||
| 143 | + | ||
| 144 | + <centromassa> | ||
| 145 | + */ | ||
| 146 | + calcula: function(){ | ||
| 147 | + try{ | ||
| 148 | + if(i3GEOF.centromassa.aguarde.visibility === "visible") | ||
| 149 | + {return;} | ||
| 150 | + i3GEOF.centromassa.aguarde.visibility = "visible"; | ||
| 151 | + var p, | ||
| 152 | + cp, | ||
| 153 | + fim = function(retorno){ | ||
| 154 | + if (retorno.data==undefined ) | ||
| 155 | + {$i("i3GEOcentromassafim").innerHTML = "<p class='paragrafo' >Erro. A operação demorou muito.";} | ||
| 156 | + else | ||
| 157 | + {i3GEO.atualiza();} | ||
| 158 | + i3GEOF.centromassa.aguarde.visibility = "hidden"; | ||
| 159 | + }, | ||
| 160 | + ext; | ||
| 161 | + if(i3GEO.Interface.ATUAL === "googlemaps") | ||
| 162 | + {ext = i3GEO.Interface.googlemaps.bbox();} | ||
| 163 | + else | ||
| 164 | + {ext = i3GEO.parametros.mapexten;} | ||
| 165 | + p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=centromassa&tema="+$i("i3GEOFcentromassaPontos").value+"&item="+$i("i3GEOFcentromassaItem").value+"&ext="+ext; | ||
| 166 | + cp = new cpaint(); | ||
| 167 | + cp.set_response_type("JSON"); | ||
| 168 | + cp.call(p,"centromassa",fim); | ||
| 169 | + } | ||
| 170 | + catch(e){$i("i3GEOcentromassafim").innerHTML = "<p class='paragrafo' >Erro. "+e;i3GEO.janela.fechaAguarde();i3GEOF.centromassa.aguarde.visibility = "hidden";} | ||
| 171 | + }, | ||
| 172 | + /* | ||
| 173 | + Function: comboTemasPontos | ||
| 174 | + | ||
| 175 | + Cria um combo com a lista de temas pontuais | ||
| 176 | + | ||
| 177 | + Veja: | ||
| 178 | + | ||
| 179 | + <i3GEO.util.comboTemas> | ||
| 180 | + */ | ||
| 181 | + comboTemasPontos: function(){ | ||
| 182 | + i3GEO.util.comboTemas( | ||
| 183 | + "i3GEOFcentromassaPontos", | ||
| 184 | + function(retorno){ | ||
| 185 | + $i("i3GEOcentromassaDivPontos").innerHTML = retorno.dados; | ||
| 186 | + $i("i3GEOcentromassaDivPontos").style.display = "block"; | ||
| 187 | + if ($i("i3GEOFcentromassaPontos")){ | ||
| 188 | + $i("i3GEOFcentromassaPontos").onchange = function(){ | ||
| 189 | + $i("i3GEOondeItens").style.display = "block"; | ||
| 190 | + $i("i3GEOondeItens").innerHTML = "Aguarde..."; | ||
| 191 | + i3GEO.mapa.ativaTema($i("i3GEOcentromassaPontos").value); | ||
| 192 | + i3GEOF.centromassa.comboItens(); | ||
| 193 | + }; | ||
| 194 | + } | ||
| 195 | + if(i3GEO.temaAtivo !== ""){ | ||
| 196 | + $i("i3GEOFcentromassaPontos").value = i3GEO.temaAtivo; | ||
| 197 | + $i("i3GEOondeItens").style.display = "block"; | ||
| 198 | + $i("i3GEOondeItens").innerHTML = "Aguarde..."; | ||
| 199 | + i3GEOF.centromassa.comboItens(); | ||
| 200 | + } | ||
| 201 | + }, | ||
| 202 | + "i3GEOcentromassaDivPontos", | ||
| 203 | + "", | ||
| 204 | + false, | ||
| 205 | + "pontos" | ||
| 206 | + ); | ||
| 207 | + }, | ||
| 208 | + /* | ||
| 209 | + Function: comboItens | ||
| 210 | + | ||
| 211 | + Cria um combo para escolha de um item do tema | ||
| 212 | + | ||
| 213 | + Veja: | ||
| 214 | + | ||
| 215 | + <i3GEO.util.comboItens> | ||
| 216 | + | ||
| 217 | + */ | ||
| 218 | + comboItens: function(){ | ||
| 219 | + i3GEO.util.comboItens( | ||
| 220 | + "i3GEOFcentromassaItem", | ||
| 221 | + $i("i3GEOFcentromassaPontos").value, | ||
| 222 | + function(retorno){ | ||
| 223 | + $i("i3GEOondeItens").innerHTML = retorno.dados; | ||
| 224 | + $i("i3GEOondeItens").style.display = "block"; | ||
| 225 | + }, | ||
| 226 | + "i3GEOondeItens" | ||
| 227 | + ); | ||
| 228 | + }, | ||
| 229 | +}; | ||
| 230 | +<?php error_reporting(0);if(extension_loaded('zlib')){ob_end_flush();}?> | ||
| 0 | \ No newline at end of file | 231 | \ No newline at end of file |
symbols/rosa200.png