Commit ef7d1b108b69db61c3ae3c31e79da42f35f9215f

Authored by Edmar Moretti
1 parent 5d8e5b4d

Incluida função de localização do usuário por meio da identificação do IP.

Essa opção pode ser habilitada ou não na interface do I3Geo utilizando-se um div específico. Veja a documentação em aplicmap/geral.htm
aplicmap/geral.htm
... ... @@ -80,6 +80,10 @@ arquivos não compactados, bastando substituir por i3geonaocompacto -->
80 80 <td class=tdbranca ><div id=lugarquadros ></div></td>
81 81 <td class=tdbranca ><div id=localizarxy >Aguarde...</div></td>
82 82 <td class=tdbranca ><div id=escala ></div></td>
  83 + <!-- A opção de localização 'onde estou?' baseia-se na identificação do IP do usuário. Para
  84 + que esta opção funcione corretamente, deve estar instalado no I3Geo o pacote geoIP. Veja no
  85 + SVN do portal do software público o diretório arquivos_versões/pacotes para maiores informações -->
  86 + <td class=tdbranca ><div id=ondeestou ><img title="Onde estou?" src='../imagens/world_map_saint_.png'/></div></td>
83 87 </tr></table>
84 88 </td>
85 89 </tr>
... ...
classesjs/funcoes.js
... ... @@ -1611,6 +1611,35 @@ function zoomboxf (tipo)
1611 1611 }
1612 1612 }
1613 1613 /*
  1614 +Function: zoomIP
  1615 +
  1616 +Localiza no mapa o usuário baseado em seu número IP.
  1617 +*/
  1618 +function zoomIP()
  1619 +{
  1620 + var xxx = convdmsddf($i("xg").value,$i("xm").value,$i("xs").value);
  1621 + var yyy = convdmsddf($i("yg").value,$i("ym").value,$i("ys").value);
  1622 + var mostraIP = function(retorno)
  1623 + {
  1624 + if (retorno.data.latitude != null)
  1625 + {
  1626 + objaguarde.abre("ajaxredesenha","Aguarde...");
  1627 + var p = g_locaplic+"/classesphp/mapa_controle.php?funcao=zoomponto&pin=pin&xy="+retorno.data.longitude+" "+retorno.data.latitude+"&g_sid="+g_sid;
  1628 + var cp = new cpaint();
  1629 + //cp.set_debug(2)
  1630 + cp.set_response_type("JSON");
  1631 + cp.call(p,"zoomPonto",ajaxredesenha);
  1632 + }
  1633 + else
  1634 + {alert("Nao foi possivel identificar a localizacao.");}
  1635 + }
  1636 + var p = g_locaplic+"/classesphp/mapa_controle.php?funcao=localizaIP&g_sid="+g_sid;
  1637 + var cp = new cpaint();
  1638 + //cp.set_debug(2)
  1639 + cp.set_response_type("JSON");
  1640 + cp.call(p,"localizaIP",mostraIP);
  1641 +}
  1642 +/*
1614 1643 Function: zoomPonto
1615 1644  
1616 1645 Localiza uma coordenada no mapa.
... ...
classesjs/funcoes_compacto.js
... ... @@ -177,6 +177,9 @@ function zoomboxf(tipo){ var bx=$i(&quot;box1&quot;); switch(tipo){ case &quot;desloca&quot;: ppx=ob
177 177 if((tipo !="limpa")&&(tipo !="inverte")){ objaguarde.abre("ajaxredesenha","Aguarde..."); var p=g_locaplic+"/classesphp/mapa_controle.php?funcao=selecaobox&ext="+v+"&g_sid="+g_sid+"&tipo="+tipo+"&tema="+objmapa.temaAtivo; var cp=new cpaint(); cp.set_response_type("JSON"); cp.call(p,"selecaobox",ajaxredesenha);}}}
178 178 with(bx.style){visibility="hidden";width=0;height=0;}
179 179 document.getElementById("imgh").style.display="block"; break;}}
  180 +function zoomIP(){ var xxx=convdmsddf($i("xg").value,$i("xm").value,$i("xs").value); var yyy=convdmsddf($i("yg").value,$i("ym").value,$i("ys").value); var mostraIP=function(retorno){ if(retorno.data.latitude !=null){ objaguarde.abre("ajaxredesenha","Aguarde..."); var p=g_locaplic+"/classesphp/mapa_controle.php?funcao=zoomponto&pin=pin&xy="+retorno.data.longitude+" "+retorno.data.latitude+"&g_sid="+g_sid; var cp=new cpaint(); cp.set_response_type("JSON"); cp.call(p,"zoomPonto",ajaxredesenha);}
  181 + else{alert("Nao foi possivel identificar a localizacao.");}}
  182 + var p=g_locaplic+"/classesphp/mapa_controle.php?funcao=localizaIP&g_sid="+g_sid; var cp=new cpaint(); cp.set_response_type("JSON"); cp.call(p,"localizaIP",mostraIP);}
180 183 function zoomPonto(){ if($i("xg")){ var xxx=convdmsddf($i("xg").value,$i("xm").value,$i("xs").value); var yyy=convdmsddf($i("yg").value,$i("ym").value,$i("ys").value); objaguarde.abre("ajaxredesenha","Aguarde..."); var p=g_locaplic+"/classesphp/mapa_controle.php?funcao=zoomponto&pin=pin&xy="+xxx+" "+yyy+"&g_sid="+g_sid; var cp=new cpaint(); cp.set_response_type("JSON"); cp.call(p,"zoomPonto",ajaxredesenha);}}
181 184 function clicouRef(){ objposicaocursor.refx=objposicaocursor.refx-parseInt(YAHOO.janelaRef.xp.panel.element.style.left)-5; objposicaocursor.refy=objposicaocursor.refy-parseInt(YAHOO.janelaRef.xp.panel.element.style.top)-25; var p=g_locaplic+"/classesphp/mapa_controle.php?funcao=pan&escala="+objmapa.scale+"&tipo=ref&x="+objposicaocursor.refx+"&y="+objposicaocursor.refy+"&g_sid="+g_sid; var cp=new cpaint(); cp.set_response_type("JSON"); cp.call(p,"pan",ajaxredesenha);}
182 185 function movimentoRef(obj){ obj.onmousemove=function(exy){ if(navm){capturaposicao(obj);}
... ...
classesjs/i3geo_tudo_compacto.js
... ... @@ -937,6 +937,9 @@ function zoomboxf(tipo){ var bx=$i(&quot;box1&quot;); switch(tipo){ case &quot;desloca&quot;: ppx=ob
937 937 if((tipo !="limpa")&&(tipo !="inverte")){ objaguarde.abre("ajaxredesenha","Aguarde..."); var p=g_locaplic+"/classesphp/mapa_controle.php?funcao=selecaobox&ext="+v+"&g_sid="+g_sid+"&tipo="+tipo+"&tema="+objmapa.temaAtivo; var cp=new cpaint(); cp.set_response_type("JSON"); cp.call(p,"selecaobox",ajaxredesenha);}}}
938 938 with(bx.style){visibility="hidden";width=0;height=0;}
939 939 document.getElementById("imgh").style.display="block"; break;}}
  940 +function zoomIP(){ var xxx=convdmsddf($i("xg").value,$i("xm").value,$i("xs").value); var yyy=convdmsddf($i("yg").value,$i("ym").value,$i("ys").value); var mostraIP=function(retorno){ if(retorno.data.latitude !=null){ objaguarde.abre("ajaxredesenha","Aguarde..."); var p=g_locaplic+"/classesphp/mapa_controle.php?funcao=zoomponto&pin=pin&xy="+retorno.data.longitude+" "+retorno.data.latitude+"&g_sid="+g_sid; var cp=new cpaint(); cp.set_response_type("JSON"); cp.call(p,"zoomPonto",ajaxredesenha);}
  941 + else{alert("Nao foi possivel identificar a localizacao.");}}
  942 + var p=g_locaplic+"/classesphp/mapa_controle.php?funcao=localizaIP&g_sid="+g_sid; var cp=new cpaint(); cp.set_response_type("JSON"); cp.call(p,"localizaIP",mostraIP);}
940 943 function zoomPonto(){ if($i("xg")){ var xxx=convdmsddf($i("xg").value,$i("xm").value,$i("xs").value); var yyy=convdmsddf($i("yg").value,$i("ym").value,$i("ys").value); objaguarde.abre("ajaxredesenha","Aguarde..."); var p=g_locaplic+"/classesphp/mapa_controle.php?funcao=zoomponto&pin=pin&xy="+xxx+" "+yyy+"&g_sid="+g_sid; var cp=new cpaint(); cp.set_response_type("JSON"); cp.call(p,"zoomPonto",ajaxredesenha);}}
941 944 function clicouRef(){ objposicaocursor.refx=objposicaocursor.refx-parseInt(YAHOO.janelaRef.xp.panel.element.style.left)-5; objposicaocursor.refy=objposicaocursor.refy-parseInt(YAHOO.janelaRef.xp.panel.element.style.top)-25; var p=g_locaplic+"/classesphp/mapa_controle.php?funcao=pan&escala="+objmapa.scale+"&tipo=ref&x="+objposicaocursor.refx+"&y="+objposicaocursor.refy+"&g_sid="+g_sid; var cp=new cpaint(); cp.set_response_type("JSON"); cp.call(p,"pan",ajaxredesenha);}
942 945 function movimentoRef(obj){ obj.onmousemove=function(exy){ if(navm){capturaposicao(obj);}
... ... @@ -1262,7 +1265,7 @@ g_autoRedesenha=0;if(window.location.href.split(&quot;?&quot;)[1]){g_sid=window.location.h
1262 1265 else{g_sid="";}
1263 1266 imagemxi=0;imagemyi=0;atuaLeg="nao";g_mashuppar="";g_operacao="";g_nomepin="";g_arvoreClick="";g_arvoreClicks="";g_movedoca=0;g_movedocac=0;g_movedocar=0;g_tipoacao="zoomli";g_realca="nao";g_destaca="";g_lenteaberta="nao";g_hlpt="";g_panM="nao";quadrosfilme=new Array();g_quadrooriginal="";wd=0;navm=false;navn=false;g_r="nao";g_embedLegenda="nao";oMenuData="";g_3dmap="";g_opcoesTemas="sim";g_mostraRosa="sim";g_visual="default";g_janelaMen="sim";g_downloadbase="sim";g_conectargeorss="sim";g_uploadlocal="sim";g_conectarwms="sim";g_docaguias="nao";g_barraFerramentas1="sim";g_barraFerramentas2="sim";g_fatordezoom=0;g_diminuixM=20;g_diminuixN=25;g_diminuiyM=106;g_diminuiyN=103;g_mapaRefDisplay="block";g_funcaoTip="verificaTipDefault()";g_tempotip=4500;g_tipotip="completo";g_tipoimagem="nenhum";g_sistemas="";destacaTamanho=75;g_mensagempadrao="O I3Geo é software livre! Para download clique <a href='http://mapas.mma.gov.br/download' target=blanck >aqui</a>";g_entorno="nao";g_guiaativa="guia1";var app=navigator.appName.substring(0,1);if(app=='N')navn=true;else navm=true;if(navm){ g_postpx=""; g_tipotop="pixelTop"; g_tipoleft="pixelLeft";}
1264 1267 else{ g_postpx="px"; g_tipotop="top"; g_tipoleft="left";}window.onresize=function(){window.status="Após alterar o tamanho da janela, clique no botão de refresh do navegador";}
1265   -function cria(){var mashup=function(retorno){ g_sid=retorno.data; objmapa.inicializa();}
  1268 +function cria(){ var mashup=function(retorno){ g_sid=retorno.data; objmapa.inicializa();}
1266 1269 var cp=new cpaint(); cp.set_async(true); cp.set_response_type("JSON"); var p=g_locaplic+"/classesphp/mapa_controle.php?funcao=criaMapa"; cp.call(p,"",mashup);}
1267 1270 function Mapa(e,m){ objaguarde=new aguarde(); objposicaocursor=new posicaocursor(); objposicaomouse=new posicaomouse(); imgBranco=new Image(); imgBranco.src=g_locaplic+"/imagens/branco.gif"; var icache=new Array("foldermapa.gif","extent.gif","tic.png","maisvermelho.png","maisverde.png","maisamarelo.png","temas.png","x.gif","sobe.gif","desce.gif","quadro.png","quadro1.png","excluir.png"); for(i=0;icache.lenght;i++){ var temp=new Image(); temp.src=g_locaplic+"/imagens/"+icache[i];}
1268 1271 var temp=new Image(); temp.src=g_locaplic+"/classesjs/jsobjects/jsUI-Treeview/plus.gif"; temp.src=g_locaplic+"/classesjs/jsobjects/jsUI-Treeview/minus.gif"; var diminuix=(navm)? g_diminuixM : g_diminuixN; var diminuiy=(navm)? g_diminuiyM : g_diminuiyN; if(e==undefined){ var menos=0; if($i("contemFerramentas")){menos=menos+parseInt($i("contemFerramentas").style.width);}
... ... @@ -1300,7 +1303,7 @@ function Mapa(e,m){ objaguarde=new aguarde(); objposicaocursor=new posicaocursor
1300 1303 document.body.appendChild(novoel);}
1301 1304 gerafilmef(10); if(g_barraFerramentas1=="sim"){initJanelaZoom(1);}
1302 1305 if(g_barraFerramentas2=="sim"){initJanelaZoom(2);}
1303   - objmapa.atualizaListaTemas(temas); objmapa.atualizaReferencia(mapexten); objmapa.scale=parseInt(mapscale); objmapa.temas=temas; objmapa.cellsize=g_celula; objmapa.extent=mapexten; objmapa.extentTotal=mapexten; objmapa.criaCorpoMapa(); ajaxCorpoMapa(retorno); objmapa.criaEscalaGrafica(); objmapa.atualizaEscalaGrafica(); objmapa.ativaLocallizarXY("localizarxy"); objmapa.ativaBuscaRapida("buscaRapida"); objmapa.ativaListaPropriedades("listaPropriedades"); objmapa.ativaRealce("realca"); objmapa.ativaGoogle("google"); objmapa.ativaScielo("scielo"); objmapa.ativaConfluence("confluence"); objmapa.ativaZoomtot("zoomtot"); objmapa.ativaZoomli("zoomli"); objmapa.ativaPan("pan"); objmapa.ativaZoomiauto("zoomiauto"); objmapa.ativaZoomoauto("zoomoauto"); objmapa.ativaIdentifica("identifica"); objmapa.ativaLente("lentei"); objmapa.ativaExten("exten"); objmapa.ativaReferencia("referencia"); objmapa.ativaEscalanum("escala"); objmapa.ativaWiki("wiki"); objmapa.ativaReinicia("reinicia"); objmapa.ativaMede("mede"); objmapa.ativaInserexy("inserexy"); objmapa.ativaInsereGrafico("inseregrafico"); objmapa.ativaSelecao("selecao"); objmapa.ativaTextofid("textofid"); objmapa.ativa3D("v3d"); objmapa.ativaImpressao("imprimir"); objmapa.ativaVisual("visual"); ativaGuias(); if(($i("encolheFerramentas"))&&($i("contemFerramentas"))){ $i("encolheFerramentas").onclick=function(){docaguias();}}
  1306 + objmapa.atualizaListaTemas(temas); objmapa.atualizaReferencia(mapexten); objmapa.scale=parseInt(mapscale); objmapa.temas=temas; objmapa.cellsize=g_celula; objmapa.extent=mapexten; objmapa.extentTotal=mapexten; objmapa.criaCorpoMapa(); ajaxCorpoMapa(retorno); objmapa.criaEscalaGrafica(); objmapa.atualizaEscalaGrafica(); objmapa.ativaLocallizarXY("localizarxy"); objmapa.ativaBuscaRapida("buscaRapida"); objmapa.ativaListaPropriedades("listaPropriedades"); objmapa.ativaRealce("realca"); objmapa.ativaGoogle("google"); objmapa.ativaScielo("scielo"); objmapa.ativaConfluence("confluence"); objmapa.ativaZoomtot("zoomtot"); objmapa.ativaZoomli("zoomli"); objmapa.ativaPan("pan"); objmapa.ativaZoomiauto("zoomiauto"); objmapa.ativaZoomoauto("zoomoauto"); objmapa.ativaIdentifica("identifica"); objmapa.ativaLente("lentei"); objmapa.ativaExten("exten"); objmapa.ativaReferencia("referencia"); objmapa.ativaEscalanum("escala"); objmapa.ativaWiki("wiki"); objmapa.ativaReinicia("reinicia"); objmapa.ativaMede("mede"); objmapa.ativaInserexy("inserexy"); objmapa.ativaInsereGrafico("inseregrafico"); objmapa.ativaSelecao("selecao"); objmapa.ativaTextofid("textofid"); objmapa.ativa3D("v3d"); objmapa.ativaImpressao("imprimir"); objmapa.ativaVisual("visual"); objmapa.ativaOndeEstou("ondeestou"); ativaGuias(); if(($i("encolheFerramentas"))&&($i("contemFerramentas"))){ $i("encolheFerramentas").onclick=function(){docaguias();}}
1304 1307 calcposf(); g_leftinicial=imagemxi; if($i("corpoMapa")){ $i("img").style.width=objmapa.w+"px"; $i("img").style.height=objmapa.h+"px"; $i("corpoMapa").style.width=objmapa.w+"px"; $i("corpoMapa").style.height=objmapa.h+"px"; $i("corpoMapa").style.clip='rect('+0+" "+(objmapa.w)+" "+(objmapa.h)+" "+0+')';}
1305 1308 var temp=0; if($i("contemFerramentas")){temp=temp+parseInt($i("contemFerramentas").style.width);}
1306 1309 if($i("encolheFerramentas")){temp=temp+parseInt($i("encolheFerramentas").style.width);}
... ... @@ -1409,6 +1412,10 @@ function Mapa(e,m){ objaguarde=new aguarde(); objposicaocursor=new posicaocursor
1409 1412 this.ativaImpressao=function(id){ if($i(id)){ $i(id).onclick=function imprimir(){wdocaf("320px","180px",g_locaplic+"/ferramentas/imprimir/index.htm","","","Imprimir");}
1410 1413 $i(id).onmouseover=function(){mostradicasf(this,'Imprime o mapa','imprimir');}
1411 1414 $i(id).onmouseout=function(){mostradicasf(this,'');}}}
  1415 + this.ativaOndeEstou=function(id){ if($i(id)){ if(objmapa.geoip=="nao"){$i(id).style.display="none";}
  1416 + else{ $i(id).onclick=function(){zoomIP();}
  1417 + $i(id).onmouseover=function(){mostradicasf(this,'Localiza o IP do usuario no mapa','');}
  1418 + $i(id).onmouseout=function(){mostradicasf(this,'');}}}}
1412 1419 this.criaEscalaGrafica=function(){ if(($i("escalaGrafica"))&&(!$i("imagemEscalaGrafica"))){$i("escalaGrafica").innerHTML="<img src=\""+g_localimg+"/icon_menuarrow.gif\" title='op&ccedil;&otilde;es' onclick='opcoesEscala()' style='cursor:pointer'/><img id=imagemEscalaGrafica src=''/>";}}
1413 1420 this.atualizaEscalaGrafica=function(){ if($i("escalaGrafica")){ var p=g_locaplic+"/classesphp/mapa_controle.php?funcao=escalagrafica&g_sid="+g_sid; var cp=new cpaint(); cp.set_response_type("JSON"); cp.call(p,"retornaBarraEscala",ajaxEscalaGrafica);}}
1414 1421 this.atualizaReferencia=function(mapexten){ if($i("mapaReferencia")&& objmapa.extent !=mapexten){ var p=g_locaplic+"/classesphp/mapa_controle.php?funcao=referencia&g_sid="+g_sid; var cp=new cpaint(); cp.set_response_type("JSON"); cp.call(p,"retornaReferencia",ajaxReferencia);}
... ...
classesjs/iniciamma.js
... ... @@ -501,11 +501,11 @@ window.onresize = function(){window.status = &quot;Após alterar o tamanho da janela,
501 501  
502 502 function cria()
503 503 {
504   -var mashup = function (retorno)
505   -{
506   - g_sid = retorno.data;
507   - objmapa.inicializa();
508   -}
  504 + var mashup = function (retorno)
  505 + {
  506 + g_sid = retorno.data;
  507 + objmapa.inicializa();
  508 + }
509 509 var cp = new cpaint();
510 510 cp.set_async(true);
511 511 cp.set_response_type("JSON");
... ... @@ -966,6 +966,7 @@ function Mapa(e,m)
966 966 objmapa.ativa3D("v3d");
967 967 objmapa.ativaImpressao("imprimir");
968 968 objmapa.ativaVisual("visual");
  969 + objmapa.ativaOndeEstou("ondeestou");
969 970 ativaGuias();
970 971 //esconde guias
971 972 if(($i("encolheFerramentas")) && ($i("contemFerramentas")))
... ... @@ -1770,6 +1771,33 @@ function Mapa(e,m)
1770 1771 }
1771 1772 }
1772 1773 /*
  1774 + Function: ativaOndeEstou
  1775 +
  1776 + Ativa o botão de localização do usuário pelo IP.
  1777 +
  1778 + Essa opção só é ativada se a variável objmapa.geoip for igual a "sim" e se existir o div com id=ondeestou.
  1779 +
  1780 + O valor dessa variável é obtida na inicialização.
  1781 +
  1782 + Parameters:
  1783 +
  1784 + id - id do elemento que ativa a operação
  1785 + */
  1786 + this.ativaOndeEstou = function(id)
  1787 + {
  1788 + if ($i(id))
  1789 + {
  1790 + if (objmapa.geoip == "nao")
  1791 + {$i(id).style.display="none";}
  1792 + else
  1793 + {
  1794 + $i(id).onclick = function(){zoomIP();}
  1795 + $i(id).onmouseover = function(){mostradicasf(this,'Localiza o IP do usuario no mapa','');}
  1796 + $i(id).onmouseout = function(){mostradicasf(this,'');}
  1797 + }
  1798 + }
  1799 + }
  1800 + /*
1773 1801 Function: criaEscalaGrafica
1774 1802  
1775 1803 Cria a escala gráfica como um lemento HTML se existir o id escalaGrafica
... ...
classesjs/iniciamma_compacto.js
... ... @@ -2,7 +2,7 @@ g_autoRedesenha=0;if(window.location.href.split(&quot;?&quot;)[1]){g_sid=window.location.h
2 2 else{g_sid="";}
3 3 imagemxi=0;imagemyi=0;atuaLeg="nao";g_mashuppar="";g_operacao="";g_nomepin="";g_arvoreClick="";g_arvoreClicks="";g_movedoca=0;g_movedocac=0;g_movedocar=0;g_tipoacao="zoomli";g_realca="nao";g_destaca="";g_lenteaberta="nao";g_hlpt="";g_panM="nao";quadrosfilme=new Array();g_quadrooriginal="";wd=0;navm=false;navn=false;g_r="nao";g_embedLegenda="nao";oMenuData="";g_3dmap="";g_opcoesTemas="sim";g_mostraRosa="sim";g_visual="default";g_janelaMen="sim";g_downloadbase="sim";g_conectargeorss="sim";g_uploadlocal="sim";g_conectarwms="sim";g_docaguias="nao";g_barraFerramentas1="sim";g_barraFerramentas2="sim";g_fatordezoom=0;g_diminuixM=20;g_diminuixN=25;g_diminuiyM=106;g_diminuiyN=103;g_mapaRefDisplay="block";g_funcaoTip="verificaTipDefault()";g_tempotip=4500;g_tipotip="completo";g_tipoimagem="nenhum";g_sistemas="";destacaTamanho=75;g_mensagempadrao="O I3Geo é software livre! Para download clique <a href='http://mapas.mma.gov.br/download' target=blanck >aqui</a>";g_entorno="nao";g_guiaativa="guia1";var app=navigator.appName.substring(0,1);if(app=='N')navn=true;else navm=true;if(navm){ g_postpx=""; g_tipotop="pixelTop"; g_tipoleft="pixelLeft";}
4 4 else{ g_postpx="px"; g_tipotop="top"; g_tipoleft="left";}window.onresize=function(){window.status="Após alterar o tamanho da janela, clique no botão de refresh do navegador";}
5   -function cria(){var mashup=function(retorno){ g_sid=retorno.data; objmapa.inicializa();}
  5 +function cria(){ var mashup=function(retorno){ g_sid=retorno.data; objmapa.inicializa();}
6 6 var cp=new cpaint(); cp.set_async(true); cp.set_response_type("JSON"); var p=g_locaplic+"/classesphp/mapa_controle.php?funcao=criaMapa"; cp.call(p,"",mashup);}
7 7 function Mapa(e,m){ objaguarde=new aguarde(); objposicaocursor=new posicaocursor(); objposicaomouse=new posicaomouse(); imgBranco=new Image(); imgBranco.src=g_locaplic+"/imagens/branco.gif"; var icache=new Array("foldermapa.gif","extent.gif","tic.png","maisvermelho.png","maisverde.png","maisamarelo.png","temas.png","x.gif","sobe.gif","desce.gif","quadro.png","quadro1.png","excluir.png"); for(i=0;icache.lenght;i++){ var temp=new Image(); temp.src=g_locaplic+"/imagens/"+icache[i];}
8 8 var temp=new Image(); temp.src=g_locaplic+"/classesjs/jsobjects/jsUI-Treeview/plus.gif"; temp.src=g_locaplic+"/classesjs/jsobjects/jsUI-Treeview/minus.gif"; var diminuix=(navm)? g_diminuixM : g_diminuixN; var diminuiy=(navm)? g_diminuiyM : g_diminuiyN; if(e==undefined){ var menos=0; if($i("contemFerramentas")){menos=menos+parseInt($i("contemFerramentas").style.width);}
... ... @@ -40,7 +40,7 @@ function Mapa(e,m){ objaguarde=new aguarde(); objposicaocursor=new posicaocursor
40 40 document.body.appendChild(novoel);}
41 41 gerafilmef(10); if(g_barraFerramentas1=="sim"){initJanelaZoom(1);}
42 42 if(g_barraFerramentas2=="sim"){initJanelaZoom(2);}
43   - objmapa.atualizaListaTemas(temas); objmapa.atualizaReferencia(mapexten); objmapa.scale=parseInt(mapscale); objmapa.temas=temas; objmapa.cellsize=g_celula; objmapa.extent=mapexten; objmapa.extentTotal=mapexten; objmapa.criaCorpoMapa(); ajaxCorpoMapa(retorno); objmapa.criaEscalaGrafica(); objmapa.atualizaEscalaGrafica(); objmapa.ativaLocallizarXY("localizarxy"); objmapa.ativaBuscaRapida("buscaRapida"); objmapa.ativaListaPropriedades("listaPropriedades"); objmapa.ativaRealce("realca"); objmapa.ativaGoogle("google"); objmapa.ativaScielo("scielo"); objmapa.ativaConfluence("confluence"); objmapa.ativaZoomtot("zoomtot"); objmapa.ativaZoomli("zoomli"); objmapa.ativaPan("pan"); objmapa.ativaZoomiauto("zoomiauto"); objmapa.ativaZoomoauto("zoomoauto"); objmapa.ativaIdentifica("identifica"); objmapa.ativaLente("lentei"); objmapa.ativaExten("exten"); objmapa.ativaReferencia("referencia"); objmapa.ativaEscalanum("escala"); objmapa.ativaWiki("wiki"); objmapa.ativaReinicia("reinicia"); objmapa.ativaMede("mede"); objmapa.ativaInserexy("inserexy"); objmapa.ativaInsereGrafico("inseregrafico"); objmapa.ativaSelecao("selecao"); objmapa.ativaTextofid("textofid"); objmapa.ativa3D("v3d"); objmapa.ativaImpressao("imprimir"); objmapa.ativaVisual("visual"); ativaGuias(); if(($i("encolheFerramentas"))&&($i("contemFerramentas"))){ $i("encolheFerramentas").onclick=function(){docaguias();}}
  43 + objmapa.atualizaListaTemas(temas); objmapa.atualizaReferencia(mapexten); objmapa.scale=parseInt(mapscale); objmapa.temas=temas; objmapa.cellsize=g_celula; objmapa.extent=mapexten; objmapa.extentTotal=mapexten; objmapa.criaCorpoMapa(); ajaxCorpoMapa(retorno); objmapa.criaEscalaGrafica(); objmapa.atualizaEscalaGrafica(); objmapa.ativaLocallizarXY("localizarxy"); objmapa.ativaBuscaRapida("buscaRapida"); objmapa.ativaListaPropriedades("listaPropriedades"); objmapa.ativaRealce("realca"); objmapa.ativaGoogle("google"); objmapa.ativaScielo("scielo"); objmapa.ativaConfluence("confluence"); objmapa.ativaZoomtot("zoomtot"); objmapa.ativaZoomli("zoomli"); objmapa.ativaPan("pan"); objmapa.ativaZoomiauto("zoomiauto"); objmapa.ativaZoomoauto("zoomoauto"); objmapa.ativaIdentifica("identifica"); objmapa.ativaLente("lentei"); objmapa.ativaExten("exten"); objmapa.ativaReferencia("referencia"); objmapa.ativaEscalanum("escala"); objmapa.ativaWiki("wiki"); objmapa.ativaReinicia("reinicia"); objmapa.ativaMede("mede"); objmapa.ativaInserexy("inserexy"); objmapa.ativaInsereGrafico("inseregrafico"); objmapa.ativaSelecao("selecao"); objmapa.ativaTextofid("textofid"); objmapa.ativa3D("v3d"); objmapa.ativaImpressao("imprimir"); objmapa.ativaVisual("visual"); objmapa.ativaOndeEstou("ondeestou"); ativaGuias(); if(($i("encolheFerramentas"))&&($i("contemFerramentas"))){ $i("encolheFerramentas").onclick=function(){docaguias();}}
44 44 calcposf(); g_leftinicial=imagemxi; if($i("corpoMapa")){ $i("img").style.width=objmapa.w+"px"; $i("img").style.height=objmapa.h+"px"; $i("corpoMapa").style.width=objmapa.w+"px"; $i("corpoMapa").style.height=objmapa.h+"px"; $i("corpoMapa").style.clip='rect('+0+" "+(objmapa.w)+" "+(objmapa.h)+" "+0+')';}
45 45 var temp=0; if($i("contemFerramentas")){temp=temp+parseInt($i("contemFerramentas").style.width);}
46 46 if($i("encolheFerramentas")){temp=temp+parseInt($i("encolheFerramentas").style.width);}
... ... @@ -149,6 +149,10 @@ function Mapa(e,m){ objaguarde=new aguarde(); objposicaocursor=new posicaocursor
149 149 this.ativaImpressao=function(id){ if($i(id)){ $i(id).onclick=function imprimir(){wdocaf("320px","180px",g_locaplic+"/ferramentas/imprimir/index.htm","","","Imprimir");}
150 150 $i(id).onmouseover=function(){mostradicasf(this,'Imprime o mapa','imprimir');}
151 151 $i(id).onmouseout=function(){mostradicasf(this,'');}}}
  152 + this.ativaOndeEstou=function(id){ if($i(id)){ if(objmapa.geoip=="nao"){$i(id).style.display="none";}
  153 + else{ $i(id).onclick=function(){zoomIP();}
  154 + $i(id).onmouseover=function(){mostradicasf(this,'Localiza o IP do usuario no mapa','');}
  155 + $i(id).onmouseout=function(){mostradicasf(this,'');}}}}
152 156 this.criaEscalaGrafica=function(){ if(($i("escalaGrafica"))&&(!$i("imagemEscalaGrafica"))){$i("escalaGrafica").innerHTML="<img src=\""+g_localimg+"/icon_menuarrow.gif\" title='op&ccedil;&otilde;es' onclick='opcoesEscala()' style='cursor:pointer'/><img id=imagemEscalaGrafica src=''/>";}}
153 157 this.atualizaEscalaGrafica=function(){ if($i("escalaGrafica")){ var p=g_locaplic+"/classesphp/mapa_controle.php?funcao=escalagrafica&g_sid="+g_sid; var cp=new cpaint(); cp.set_response_type("JSON"); cp.call(p,"retornaBarraEscala",ajaxEscalaGrafica);}}
154 158 this.atualizaReferencia=function(mapexten){ if($i("mapaReferencia")&& objmapa.extent !=mapexten){ var p=g_locaplic+"/classesphp/mapa_controle.php?funcao=referencia&g_sid="+g_sid; var cp=new cpaint(); cp.set_response_type("JSON"); cp.call(p,"retornaReferencia",ajaxReferencia);}
... ...
classesphp/funcoes_gerais.php
... ... @@ -1013,6 +1013,40 @@ function buscaRapida($servico,$palavra)
1013 1013 Section: coordenadas
1014 1014 */
1015 1015 /*
  1016 +function: ip2geo
  1017 +
  1018 +Localiza a coordenada geográfica de um endereço IP.
  1019 +
  1020 +Essa função baseia-se no pacote geoIP, que deve estar instalado em pacotes/geoip.
  1021 +
  1022 +parameters:
  1023 +
  1024 +$ip - Número do IP.
  1025 +*/
  1026 +function ip2geo($ip)
  1027 +{
  1028 + //$ip="200.252.111.1";
  1029 + $resultado = array();
  1030 + if (file_exists("../pacotes/geoip/geoipcity.inc"))
  1031 + {
  1032 + require_once("../pacotes/geoip/geoipcity.inc");
  1033 + require_once("../pacotes/geoip/geoipregionvars.php");
  1034 + $gi = geoip_open("../pacotes/geoip/GeoLiteCity.dat",GEOIP_STANDARD);
  1035 + $record = geoip_record_by_addr($gi,$ip);
  1036 + $resultado["country_code"] = $record->country_code . " " . $record->country_code3 . " " . $record->country_name;
  1037 + $resultado["region"] = $record->region . " " . $GEOIP_REGION_NAME[$record->country_code][$record->region];
  1038 + $resultado["city"] = $record->city;
  1039 + $resultado["postal_code"] = $record->postal_code;
  1040 + $resultado["latitude"] = $record->latitude;
  1041 + $resultado["longitude"] = $record->longitude;
  1042 + $resultado["dma_code"] = $record->dma_code;
  1043 + $resultado["area_code"] = $record->area_code;
  1044 + $resultado["ip"] = $ip;
  1045 + geoip_close($gi);
  1046 + }
  1047 + return($resultado);
  1048 +}
  1049 +/*
1016 1050 function: xy2imagem
1017 1051  
1018 1052 Converte coordenadas geograficas em coordenadas de imagem e retorna um ponto.
... ... @@ -1425,4 +1459,17 @@ function pegaIPcliente()
1425 1459 else $ip = "UNKNOWN";
1426 1460 return $ip;
1427 1461 }
  1462 +/*
  1463 +function: pegaIPcliente2
  1464 +
  1465 +Pega o IP do cliente sem REMOTE_ADDR
  1466 +*/
  1467 +function pegaIPcliente2()
  1468 +{
  1469 + $ip = "UNKNOWN";
  1470 + if(getenv("HTTP_X_FORWARDED_FOR")) $ip = getenv("HTTP_X_FORWARDED_FOR");
  1471 + else if(getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR");
  1472 + else $ip = "UNKNOWN";
  1473 + return $ip;
  1474 +}
1428 1475 ?>
1429 1476 \ No newline at end of file
... ...
classesphp/mapa_controle.php
... ... @@ -1642,6 +1642,27 @@ Include:
1642 1642 $cp->set_data(($m->mapa->width).",".($m->mapa->height).",".$m->gravaImagemCorpo());
1643 1643 break;
1644 1644 /*
  1645 +Property: localizaIP
  1646 +
  1647 +Localiza as coordenadas geográficas do usuário atual.
  1648 +
  1649 +Baseia-se na identificação do IP e no pacote geoip
  1650 +
  1651 +Include:
  1652 +<pacotes/geoip/geoipcity.php>
  1653 +*/
  1654 + case "localizaIP":
  1655 + $ip = pegaIPcliente();
  1656 + $r = ip2geo($ip);
  1657 + if($r["latitude"] == null)
  1658 + {
  1659 + $ip = pegaIPcliente2();
  1660 + $r = ip2geo($ip);
  1661 + }
  1662 + $cp->set_data($r);
  1663 + break;
  1664 +
  1665 +/*
1645 1666 Property: zoomponto
1646 1667  
1647 1668 Desloca o centro do mapa para um ponto específico.
... ...
classesphp/mapa_inicia.php
... ... @@ -178,7 +178,15 @@ function iniciaMapa()
178 178 {$visual = implode(",",listaDiretorios($locaplic."/imagens/visual"));}
179 179 $res .= ";objmapa.listavisual='".$visual."'";
180 180 //pega os usuários navegadores
181   - $res .= ";objmapa.navegacaoDir='".$navegadoresLocais."';";
  181 + $res .= ";objmapa.navegacaoDir='".$navegadoresLocais."'";
  182 + //
  183 + //verifica se o pacote geoip está instalado ou não
  184 + //
  185 + $geoip = "nao";
  186 + if (file_exists($locaplic."/pacotes/geoip"))
  187 + {$geoip = "sim";}
  188 + $res .= ";objmapa.geoip='".$geoip."';";
  189 +
182 190 if (function_exists("mb_convert_encoding"))
183 191 {$res = mb_convert_encoding($res,"UTF-8","ISO-8859-1");}
184 192 //
... ...
imagens/world_map_saint_.png 0 → 100644

416 Bytes

imagens/world_map_saint_.svg 0 → 100644
... ... @@ -0,0 +1,116 @@
  1 +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2 +<!-- Creator: CorelDRAW -->
  3 +<svg
  4 + xmlns:dc="http://purl.org/dc/elements/1.1/"
  5 + xmlns:cc="http://web.resource.org/cc/"
  6 + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  7 + xmlns:svg="http://www.w3.org/2000/svg"
  8 + xmlns="http://www.w3.org/2000/svg"
  9 + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
  10 + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
  11 + height="8"
  12 + space="preserve"
  13 + style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality"
  14 + viewBox="-2794 0 3818 1880"
  15 + width="17"
  16 + x="-251.451"
  17 + y="479.15729"
  18 + id="svg2"
  19 + sodipodi:version="0.32"
  20 + inkscape:version="0.45.1"
  21 + sodipodi:docname="world_map_saint_.svg"
  22 + inkscape:output_extension="org.inkscape.output.svg.inkscape"
  23 + sodipodi:docbase="C:\ms4w\Apache\htdocs\i3geo\imagens"
  24 + version="1.0"
  25 + inkscape:export-filename="C:\ms4w\Apache\htdocs\i3geo\imagens\world_map_saint_.png"
  26 + inkscape:export-xdpi="90"
  27 + inkscape:export-ydpi="90">
  28 + <sodipodi:namedview
  29 + inkscape:window-height="579"
  30 + inkscape:window-width="758"
  31 + inkscape:pageshadow="2"
  32 + inkscape:pageopacity="0.0"
  33 + guidetolerance="10.0"
  34 + gridtolerance="10.0"
  35 + objecttolerance="10.0"
  36 + borderopacity="1.0"
  37 + bordercolor="#666666"
  38 + pagecolor="#ffffff"
  39 + id="base"
  40 + width="17px"
  41 + height="8px"
  42 + inkscape:zoom="15.594017"
  43 + inkscape:cx="9.925682"
  44 + inkscape:cy="4.0720747"
  45 + inkscape:window-x="154"
  46 + inkscape:window-y="154"
  47 + inkscape:current-layer="svg2" />
  48 + <metadata
  49 + id="metadata4">
  50 + <rdf:RDF>
  51 + <cc:Work
  52 + rdf:about="">
  53 + <dc:title>world map</dc:title>
  54 + <dc:description />
  55 + <dc:subject>
  56 + <rdf:Bag>
  57 + <rdf:li>map</rdf:li>
  58 + <rdf:li>mercator</rdf:li>
  59 + <rdf:li>world</rdf:li>
  60 + </rdf:Bag>
  61 + </dc:subject>
  62 + <dc:publisher>
  63 + <cc:Agent
  64 + rdf:about="http://www.openclipart.org/">
  65 + <dc:title>Open Clip Art Library</dc:title>
  66 + </cc:Agent>
  67 + </dc:publisher>
  68 + <dc:creator>
  69 + <cc:Agent>
  70 + <dc:title>saint</dc:title>
  71 + </cc:Agent>
  72 + </dc:creator>
  73 + <dc:rights>
  74 + <cc:Agent>
  75 + <dc:title>saint</dc:title>
  76 + </cc:Agent>
  77 + </dc:rights>
  78 + <dc:date />
  79 + <dc:format>image/svg+xml</dc:format>
  80 + <dc:type
  81 + rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
  82 + <cc:license
  83 + rdf:resource="http://web.resource.org/cc/PublicDomain" />
  84 + <dc:language>en</dc:language>
  85 + </cc:Work>
  86 + <cc:License
  87 + rdf:about="http://web.resource.org/cc/PublicDomain">
  88 + <cc:permits
  89 + rdf:resource="http://web.resource.org/cc/Reproduction" />
  90 + <cc:permits
  91 + rdf:resource="http://web.resource.org/cc/Distribution" />
  92 + <cc:permits
  93 + rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
  94 + </cc:License>
  95 + </rdf:RDF>
  96 + </metadata>
  97 + <defs
  98 + id="defs6">
  99 + <style
  100 + type="text/css"
  101 + id="style8">
  102 + .fil0 {fill:#1F1A17}
  103 + </style>
  104 + </defs>
  105 + <g
  106 + id="Layer 1"
  107 + transform="matrix(1.0028833,0,0,0.9713068,8.055748,53.943304)">
  108 + <g
  109 + id="g11" />
  110 + <path
  111 + class="fil0"
  112 + d="M 814,679 L 738,711 L 719,688 L 788,656 L 814,679 z M 710,738 L 651,834 L 556,883 L 529,851 L 624,798 L 656,705 L 710,738 z M 696,942 L 665,965 L 637,878 L 656,883 L 696,942 z M 747,1320 L 556,1280 L 550,1212 L 729,1257 L 747,1320 z M 1019,1690 L 952,1772 L 920,1768 L 911,1721 L 994,1631 L 960,1580 L 979,1552 L 1011,1599 L 1019,1690 z M 505,1202 L 469,1265 L 438,1261 L 469,1189 L 505,1202 z M 438,1189 L 400,1261 L 332,1243 L 337,1189 L 396,1130 L 438,1189 z M 1024,487 L 897,501 L 901,546 L 825,646 L 810,555 L 852,501 L 706,515 L 620,560 L 609,597 L 670,583 L 674,669 L 633,673 L 620,715 L 537,770 L 550,806 L 497,842 L 478,779 L 442,798 L 451,925 L 296,1015 L 337,1075 L 269,1115 L 241,1062 L 227,1066 L 241,1125 L 296,1161 L 277,1180 L 241,1170 L 250,1198 L 282,1202 L 300,1257 L 383,1288 L 387,1316 L 292,1299 L 159,1153 L 214,1157 L 136,988 L 136,942 L 114,942 L 104,984 L 28,1043 L 28,1098 L -32,1115 L -69,1011 L -95,1003 L -91,942 L -310,902 L -274,961 L -237,948 L -196,988 L -237,1039 L -333,1075 L -433,883 L -460,883 L -464,920 L -397,1056 L -346,1094 L -268,1088 L -409,1293 L -392,1311 L -386,1379 L -428,1411 L -433,1462 L -542,1594 L -629,1589 L -706,1379 L -682,1347 L -682,1293 L -747,1216 L -720,1198 L -783,1157 L -910,1153 L -984,1088 L -988,948 L -824,806 L -733,798 L -710,824 L -715,847 L -642,870 L -606,838 L -578,861 L -479,866 L -460,847 L -460,792 L -501,847 L -555,774 L -546,847 L -597,810 L -606,756 L -667,685 L -678,697 L -629,765 L -661,810 L -674,756 L -729,715 L -760,743 L -779,733 L -883,830 L -920,728 L -847,733 L -834,701 L -861,673 L -815,637 L -788,633 L -737,587 L -751,551 L -724,538 L -706,565 L -614,560 L -610,534 L -510,496 L -528,474 L -591,496 L -610,456 L -564,420 L -591,392 L -650,469 L -629,487 L -633,534 L -692,551 L -706,515 L -769,523 L -765,469 L -661,329 L -546,301 L -374,341 L -405,388 L -473,382 L -428,428 L -296,341 L -209,341 L -268,274 L -200,204 L -105,164 L -91,196 L -181,228 L -232,282 L -128,346 L -145,314 L -82,259 L 32,287 L 49,251 L 255,173 L 396,204 L 292,264 L 615,297 L 670,242 L 696,291 L 852,305 L 897,329 L 1024,314 L 1024,487 z M 797,1508 L 719,1653 L 656,1648 L 533,1557 L 529,1580 L 378,1611 L 396,1548 L 364,1535 L 364,1457 L 561,1330 L 651,1389 L 656,1339 L 683,1335 L 797,1508 z M -807,587 L -811,625 L -875,625 L -855,587 L -897,542 L -866,510 L -847,555 L -807,587 z M -934,415 L -1016,474 L -1065,401 L -974,378 L -934,415 z M -676,809 L -704,799 L -687,772 L -676,809 z M -952,82 L -1006,128 L -1016,242 L -1098,369 L -1229,409 L -1261,487 L -1320,483 L -1388,378 L -1415,237 L -1470,196 L -1530,215 L -1561,173 L -1462,50 L -1052,0 L -952,82 z M -887,602 L -915,633 L -946,605 L -920,560 L -887,602 z M -282,1358 L -323,1489 L -382,1448 L -365,1389 L -306,1343 L -282,1358 z M -1576,956 L -1612,938 L -1612,906 L -1576,956 z M -1443,1043 L -1466,1052 L -1580,1011 L -1572,988 L -1443,1043 z M -1603,975 L -1612,1003 L -1682,988 L -1675,954 L -1603,975 z M -1175,1293 L -1211,1335 L -1221,1417 L -1498,1713 C -1488,1730 -1485,1750 -1489,1772 L -1525,1808 L -1493,1848 L -1521,1880 L -1593,1799 L -1593,1667 L -1548,1407 L -1608,1379 L -1671,1221 L -1644,1180 L -1644,1134 L -1707,1134 L -1735,1079 L -1771,1083 L -1899,1011 L -1940,961 L -1990,961 L -2127,779 L -2121,688 L -2168,620 L -2199,629 L -2222,583 L -2195,587 L -2263,515 L -2353,501 L -2573,610 L -2495,534 L -2550,492 L -2573,337 L -2482,291 L -2045,337 L -2127,278 L -2108,200 L -1671,33 L -1502,41 L -1652,210 L -1453,373 L -1516,441 L -1635,420 L -1620,346 L -1662,346 L -1680,397 L -1667,441 L -1757,433 L -1804,496 L -1771,523 L -1707,542 L -1648,610 L -1626,542 L -1639,528 L -1639,460 L -1498,483 L -1384,620 L -1544,711 L -1544,760 L -1572,756 L -1599,783 L -1593,819 L -1658,874 L -1639,934 L -1671,934 L -1698,893 L -1798,893 L -1836,961 L -1798,997 L -1781,997 L -1745,975 L -1721,988 L -1730,1039 L -1694,1043 L -1685,1098 L -1620,1098 L -1557,1071 L -1512,1088 L -1427,1091 L -1421,1147 L -1352,1147 L -1344,1212 L -1297,1212 L -1175,1293 z M -2586,424 L -2723,420 L -2755,433 L -2719,469 L -2794,487 L -2794,314 L -2609,388 L -2586,424 z M -2395,1003 L -2413,1035 L -2476,993 L -2518,1015 L -2618,956 L -2609,929 L -2495,975 L -2451,952 L -2395,1003 z M -2650,897 L -2700,929 L -2727,870 L -2650,897 z M -2136,1485 L -2163,1512 L -2204,1485 L -2176,1457 L -2136,1485 z M -2208,1444 L -2240,1462 L -2282,1434 L -2250,1394 L -2208,1444 z M -158,746 L -163,709 L -186,712 L -183,749 L -158,746 z M -240,805 L -270,746 L -245,712 L -258,698 L -284,718 L -278,815 L -240,805 z M -381,744 L -414,691 L -445,685 L -443,709 L -470,712 L -493,682 L -534,733 L -526,765 L -490,737 L -462,737 L -381,744 z "
  113 + id="43381528"
  114 + style="fill:#1f1a17" />
  115 + </g>
  116 +</svg>
... ...