diff --git a/admin/admin.db b/admin/admin.db index 5479ddc..f6e0d27 100644 Binary files a/admin/admin.db and b/admin/admin.db differ diff --git a/css/geral.css b/css/geral.css index c4b54a4..44cd0c0 100644 --- a/css/geral.css +++ b/css/geral.css @@ -9,15 +9,52 @@ para nao selecionar user-select: none; } /* -.olPopupCloseBox { - background: url("img/edit-delete.png") no-repeat scroll 0 0 rgba(0, 0, 0, 0); - cursor: pointer; - padding: 3px; - background-position: 7px 0px; - margin-right: -5px; - margin-top: -5px; -} +Popup do identifica no openlayers 3 */ +.ol-popup { + position: absolute; + background-color: white; + -webkit-filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2)); + filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2)); + padding: 8px; + border-radius: 10px; + border: 1px solid #cccccc; + bottom: 12px; + left: -50px; +} +.ol-popup:after, .ol-popup:before { + top: 100%; + border: solid transparent; + content: " "; + height: 0; + width: 0; + position: absolute; + pointer-events: none; +} +.ol-popup:after { + border-top-color: white; + border-width: 10px; + left: 48px; + margin-left: -10px; +} +.ol-popup:before { + border-top-color: #cccccc; + border-width: 11px; + left: 48px; + margin-left: -11px; +} +.ol-popup-closer { + text-decoration: none; + position: absolute; + top: 2px; + right: 1px; + cursor:pointer; +} +.ol-popup-closer:after { + content: "\2716"; + color: red; + font-size: 16px; +} /* Ajusta altura dos controles do googlemaps */ @@ -262,10 +299,12 @@ Utilizado na janela do buscador INDE } .toolTipBalaoTitulo { - text-decoration: underline; + text-decoration: none; text-align: left; font-size: 8pt; font-weight: normal; + margin-top: 8px; + margin-bottom: 2px; } .toolTipBalaoTexto { @@ -273,13 +312,21 @@ Utilizado na janela do buscador INDE font-size: 8pt; background-color: #E0E0E0; color: black; + padding: 3px; + -webkit-filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2)); + filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2)); + border-radius: 6px; } .toolTipBalaoTexto1 { text-align: left; font-size: 8pt; - background-color: #F8F8F8; + background-color: #e5e5e5; color: black; + padding: 3px; + -webkit-filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2)); + filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2)); + border-radius: 6px; } fieldset { diff --git a/css/i3geo6.css b/css/i3geo6.css index e0cd926..158d5b4 100755 --- a/css/i3geo6.css +++ b/css/i3geo6.css @@ -9,15 +9,52 @@ para nao selecionar user-select: none; } /* -.olPopupCloseBox { -background: url("img/edit-delete.png") no-repeat scroll 0 0 rgba(0, 0, 0, 0); -cursor: pointer; -padding: 3px; -background-position: 7px 0px; -margin-right: -5px; -margin-top: -5px; -} +Popup do identifica no openlayers 3 */ +.ol-popup { +position: absolute; +background-color: white; +-webkit-filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2)); +filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2)); +padding: 8px; +border-radius: 10px; +border: 1px solid #cccccc; +bottom: 12px; +left: -50px; +} +.ol-popup:after, .ol-popup:before { +top: 100%; +border: solid transparent; +content: " "; +height: 0; +width: 0; +position: absolute; +pointer-events: none; +} +.ol-popup:after { +border-top-color: white; +border-width: 10px; +left: 48px; +margin-left: -10px; +} +.ol-popup:before { +border-top-color: #cccccc; +border-width: 11px; +left: 48px; +margin-left: -11px; +} +.ol-popup-closer { +text-decoration: none; +position: absolute; +top: 2px; +right: 1px; +cursor:pointer; +} +.ol-popup-closer:after { +content: "\2716"; +color: red; +font-size: 16px; +} /* Ajusta altura dos controles do googlemaps */ @@ -235,22 +272,32 @@ width: 40px; border: 0px solid white; } .toolTipBalaoTitulo { -text-decoration: underline; +text-decoration: none; text-align: left; font-size: 8pt; font-weight: normal; +margin-top: 8px; +margin-bottom: 2px; } .toolTipBalaoTexto { text-align: left; font-size: 8pt; background-color: #E0E0E0; color: black; +padding: 3px; +-webkit-filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2)); +filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2)); +border-radius: 6px; } .toolTipBalaoTexto1 { text-align: left; font-size: 8pt; -background-color: #F8F8F8; +background-color: #e5e5e5; color: black; +padding: 3px; +-webkit-filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2)); +filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2)); +border-radius: 6px; } fieldset { text-align: left; diff --git a/css/i3geo6.css.php b/css/i3geo6.css.php index 0957662..7af9ce1 100755 --- a/css/i3geo6.css.php +++ b/css/i3geo6.css.php @@ -9,15 +9,52 @@ para nao selecionar user-select: none; } /* -.olPopupCloseBox { -background: url("img/edit-delete.png") no-repeat scroll 0 0 rgba(0, 0, 0, 0); -cursor: pointer; -padding: 3px; -background-position: 7px 0px; -margin-right: -5px; -margin-top: -5px; -} +Popup do identifica no openlayers 3 */ +.ol-popup { +position: absolute; +background-color: white; +-webkit-filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2)); +filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2)); +padding: 8px; +border-radius: 10px; +border: 1px solid #cccccc; +bottom: 12px; +left: -50px; +} +.ol-popup:after, .ol-popup:before { +top: 100%; +border: solid transparent; +content: " "; +height: 0; +width: 0; +position: absolute; +pointer-events: none; +} +.ol-popup:after { +border-top-color: white; +border-width: 10px; +left: 48px; +margin-left: -10px; +} +.ol-popup:before { +border-top-color: #cccccc; +border-width: 11px; +left: 48px; +margin-left: -11px; +} +.ol-popup-closer { +text-decoration: none; +position: absolute; +top: 2px; +right: 1px; +cursor:pointer; +} +.ol-popup-closer:after { +content: "\2716"; +color: red; +font-size: 16px; +} /* Ajusta altura dos controles do googlemaps */ @@ -235,22 +272,32 @@ width: 40px; border: 0px solid white; } .toolTipBalaoTitulo { -text-decoration: underline; +text-decoration: none; text-align: left; font-size: 8pt; font-weight: normal; +margin-top: 8px; +margin-bottom: 2px; } .toolTipBalaoTexto { text-align: left; font-size: 8pt; background-color: #E0E0E0; color: black; +padding: 3px; +-webkit-filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2)); +filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2)); +border-radius: 6px; } .toolTipBalaoTexto1 { text-align: left; font-size: 8pt; -background-color: #F8F8F8; +background-color: #e5e5e5; color: black; +padding: 3px; +-webkit-filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2)); +filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2)); +border-radius: 6px; } fieldset { text-align: left; diff --git a/css/i3geo_ferramentas6.css b/css/i3geo_ferramentas6.css index 9f1e658..c5704b5 100755 --- a/css/i3geo_ferramentas6.css +++ b/css/i3geo_ferramentas6.css @@ -9,15 +9,52 @@ para nao selecionar user-select: none; } /* -.olPopupCloseBox { - background: url("img/edit-delete.png") no-repeat scroll 0 0 rgba(0, 0, 0, 0); - cursor: pointer; - padding: 3px; - background-position: 7px 0px; - margin-right: -5px; - margin-top: -5px; -} +Popup do identifica no openlayers 3 */ +.ol-popup { + position: absolute; + background-color: white; + -webkit-filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2)); + filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2)); + padding: 8px; + border-radius: 10px; + border: 1px solid #cccccc; + bottom: 12px; + left: -50px; +} +.ol-popup:after, .ol-popup:before { + top: 100%; + border: solid transparent; + content: " "; + height: 0; + width: 0; + position: absolute; + pointer-events: none; +} +.ol-popup:after { + border-top-color: white; + border-width: 10px; + left: 48px; + margin-left: -10px; +} +.ol-popup:before { + border-top-color: #cccccc; + border-width: 11px; + left: 48px; + margin-left: -11px; +} +.ol-popup-closer { + text-decoration: none; + position: absolute; + top: 2px; + right: 1px; + cursor:pointer; +} +.ol-popup-closer:after { + content: "\2716"; + color: red; + font-size: 16px; +} /* Ajusta altura dos controles do googlemaps */ @@ -262,10 +299,12 @@ Utilizado na janela do buscador INDE } .toolTipBalaoTitulo { - text-decoration: underline; + text-decoration: none; text-align: left; font-size: 8pt; font-weight: normal; + margin-top: 8px; + margin-bottom: 2px; } .toolTipBalaoTexto { @@ -273,13 +312,21 @@ Utilizado na janela do buscador INDE font-size: 8pt; background-color: #E0E0E0; color: black; + padding: 3px; + -webkit-filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2)); + filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2)); + border-radius: 6px; } .toolTipBalaoTexto1 { text-align: left; font-size: 8pt; - background-color: #F8F8F8; + background-color: #e5e5e5; color: black; + padding: 3px; + -webkit-filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2)); + filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2)); + border-radius: 6px; } fieldset { diff --git a/ferramentas/cortina/index.js b/ferramentas/cortina/index.js index f6af0d0..5d72e4b 100644 --- a/ferramentas/cortina/index.js +++ b/ferramentas/cortina/index.js @@ -188,6 +188,10 @@ i3GEOF.cortina = { if(i3GEOF.cortina.tema !== ""){ if(i3GEO.Interface.ATUAL === "openlayers"){ layer = i3geoOL.getLayersByName(i3GEOF.cortina.tema)[0]; + //TODO nao funciona no OL3 + if(!layer.div){ + return; + } i3GEOF.cortina.estilo = layer.div.style; } if(i3GEO.Interface.ATUAL === "googlemaps"){ diff --git a/ferramentas/legenda/template_mst.html b/ferramentas/legenda/template_mst.html index b1266fc..b8a157b 100644 --- a/ferramentas/legenda/template_mst.html +++ b/ferramentas/legenda/template_mst.html @@ -107,7 +107,7 @@

  - {{{consideraElementosVisisveis}}} + {{{consideraElementosVisisveis}}}

{{{ignoraValores}}}:

diff --git a/ferramentas/selecao/index.js b/ferramentas/selecao/index.js index 36efefa..2d4f983 100644 --- a/ferramentas/selecao/index.js +++ b/ferramentas/selecao/index.js @@ -34,475 +34,580 @@ Free Software Foundation, Inc., no endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. */ -if(typeof(i3GEOF) === 'undefined'){ +if (typeof (i3GEOF) === 'undefined') { var i3GEOF = {}; } /* -Classe: i3GEOF.selecao + * Classe: i3GEOF.selecao */ -i3GEOF.selecao = { - tipoSel: "", +i3GEOF.selecao = + { + tipoSel : "", /* - Variavel: aguarde - - Estilo do objeto DOM com a imagem de aguarde existente no cabeçalho da janela. + * Variavel: aguarde + * + * Estilo do objeto DOM com a imagem de aguarde existente no cabeçalho da janela. */ - aguarde: "", + aguarde : "", /* - Para efeitos de compatibilidade antes da versão 4.7 que não tinha dicionário + * Para efeitos de compatibilidade antes da versão 4.7 que não tinha dicionário */ - criaJanelaFlutuante: function(){ + criaJanelaFlutuante : function() { i3GEOF.selecao.iniciaDicionario(); }, /* - Function: iniciaDicionario - - Carrega o dicionário e chama a função que inicia a ferramenta - - O Javascript é carregado com o id i3GEOF.nomedaferramenta.dicionario_script + * Function: iniciaDicionario + * + * Carrega o dicionário e chama a função que inicia a ferramenta + * + * O Javascript é carregado com o id i3GEOF.nomedaferramenta.dicionario_script */ - iniciaDicionario: function(){ - if(typeof(i3GEOF.selecao.dicionario) === 'undefined'){ + iniciaDicionario : function() { + if (typeof (i3GEOF.selecao.dicionario) === 'undefined') { i3GEO.util.scriptTag( - i3GEO.configura.locaplic+"/ferramentas/selecao/dicionario.js", - "i3GEOF.selecao.iniciaJanelaFlutuante()", - "i3GEOF.selecao.dicionario_script" - ); - } - else{ + i3GEO.configura.locaplic + "/ferramentas/selecao/dicionario.js", + "i3GEOF.selecao.iniciaJanelaFlutuante()", + "i3GEOF.selecao.dicionario_script"); + } else { i3GEOF.selecao.iniciaJanelaFlutuante(); } }, /* - Function: inicia - - Inicia a ferramenta. É chamado por criaJanelaFlutuante - - Parametro: - - iddiv {String} - id do div que receberá o conteudo HTML da ferramenta + * Function: inicia + * + * Inicia a ferramenta. É chamado por criaJanelaFlutuante + * + * Parametro: + * + * iddiv {String} - id do div que receberá o conteudo HTML da ferramenta */ - inicia: function(iddiv){ - var b,i,n,ics; - try{ + inicia : function(iddiv) { + var b, i, n, ics; + try { $i(iddiv).innerHTML += i3GEOF.selecao.html(); - i3GEO.guias.mostraGuiaFerramenta("i3GEOselecaoguia1","i3GEOselecaoguia"); - //eventos das guias - $i("i3GEOselecaoguia4").onclick = function(){ - i3GEO.guias.mostraGuiaFerramenta("i3GEOselecaoguia4","i3GEOselecaoguia"); + i3GEO.guias.mostraGuiaFerramenta("i3GEOselecaoguia1", "i3GEOselecaoguia"); + // eventos das guias + $i("i3GEOselecaoguia4").onclick = function() { + i3GEO.guias.mostraGuiaFerramenta("i3GEOselecaoguia4", "i3GEOselecaoguia"); }; - $i("i3GEOselecaoguia1").onclick = function(){ - i3GEO.guias.mostraGuiaFerramenta("i3GEOselecaoguia1","i3GEOselecaoguia"); + $i("i3GEOselecaoguia1").onclick = function() { + i3GEO.guias.mostraGuiaFerramenta("i3GEOselecaoguia1", "i3GEOselecaoguia"); }; - $i("i3GEOselecaoguia2").onclick = function(){ - if($i("i3GEOselecaotemasLigados")){ - if($i("i3GEOselecaotemasLigados").value === "") - {i3GEO.janela.tempoMsg($trad('selecionaTema',i3GEOF.selecao.dicionario));return;} + $i("i3GEOselecaoguia2").onclick = function() { + if ($i("i3GEOselecaotemasLigados")) { + if ($i("i3GEOselecaotemasLigados").value === "") { + i3GEO.janela.tempoMsg($trad('selecionaTema', i3GEOF.selecao.dicionario)); + return; + } i3GEO.mapa.ativaTema($i("i3GEOselecaotemasLigados").value); - i3GEO.guias.mostraGuiaFerramenta("i3GEOselecaoguia2","i3GEOselecaoguia"); - try - {$i("i3GEOselecaoparametros").innerHTML = "";} - catch(e){} + i3GEO.guias.mostraGuiaFerramenta("i3GEOselecaoguia2", "i3GEOselecaoguia"); + try { + $i("i3GEOselecaoparametros").innerHTML = ""; + } catch (e) { + } i3GEOF.selecao.adicionaLinhaFiltro(); } }; - $i("i3GEOselecaoguia3").onclick = function(){ - i3GEO.guias.mostraGuiaFerramenta("i3GEOselecaoguia3","i3GEOselecaoguia"); - i3GEO.util.comboTemas( - "i3GEOselecaoTemaoverlay", - function(retorno){ - $i("i3GEOselecaooverlay").innerHTML = retorno.dados; - }, - "i3GEOselecaooverlay", - "", - false, - "naolinearSelecionados", - "display:block" - ); + $i("i3GEOselecaoguia3").onclick = function() { + i3GEO.guias.mostraGuiaFerramenta("i3GEOselecaoguia3", "i3GEOselecaoguia"); + i3GEO.util.comboTemas("i3GEOselecaoTemaoverlay", function(retorno) { + $i("i3GEOselecaooverlay").innerHTML = retorno.dados; + }, "i3GEOselecaooverlay", "", false, "naolinearSelecionados", "display:block"); }; i3GEOF.selecao.criaCombosTemas(); - i3GEO.util.mensagemAjuda("i3GEOselecaomen1",$i("i3GEOselecaomen1").innerHTML); - i3GEO.util.mensagemAjuda("i3GEOselecaomen2",$i("i3GEOselecaomen2").innerHTML); - b = new YAHOO.widget.Button( - "i3GEOselecaobotao1", - {onclick:{fn: i3GEOF.selecao.atributo}} - ); + i3GEO.util.mensagemAjuda("i3GEOselecaomen1", $i("i3GEOselecaomen1").innerHTML); + i3GEO.util.mensagemAjuda("i3GEOselecaomen2", $i("i3GEOselecaomen2").innerHTML); + b = new YAHOO.widget.Button("i3GEOselecaobotao1", { + onclick : { + fn : i3GEOF.selecao.atributo + } + }); b.addClass("rodar"); - b = new YAHOO.widget.Button( - "i3GEOselecaobotao2", - {onclick:{fn: i3GEOF.selecao.aplicaselecaoTema}} - ); + b = new YAHOO.widget.Button("i3GEOselecaobotao2", { + onclick : { + fn : i3GEOF.selecao.aplicaselecaoTema + } + }); b.addClass("rodar"); - b = new YAHOO.widget.Button( - "i3GEOFSelecaoQuery", - {onclick:{fn: i3GEO.mapa.dialogo.queryMap}} - ); + b = new YAHOO.widget.Button("i3GEOFSelecaoQuery", { + onclick : { + fn : i3GEO.mapa.dialogo.queryMap + } + }); b.addClass("abrir"); i3GEOF.selecao.ativaFoco(); ics = $i("i3GEOselecaoguia1obj").getElementsByTagName("button"); n = ics.length; - for(i=0;i' + - ' ' + - '

' + - '' + - '' + - ' '+ - ''; + ins += + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '
' + + '
' + + '
' + + ' 0' + + '

' + + $trad('temas', i3GEOF.selecao.dicionario) + + '

' + + '
' + + ' ' + + '' + + ' ' + + ''; return ins; }, /* - Function: iniciaJanelaFlutuante - - Cria a janela flutuante para controle da ferramenta. + * Function: iniciaJanelaFlutuante + * + * Cria a janela flutuante para controle da ferramenta. */ - iniciaJanelaFlutuante: function(){ - var minimiza,cabecalho,janela,divid,temp,titulo; - if($i("i3GEOF.selecao")){ + iniciaJanelaFlutuante : function() { + var minimiza, cabecalho, janela, divid, temp, titulo; + if ($i("i3GEOF.selecao")) { return; } - //cria a janela flutuante - cabecalho = function(){ + // cria a janela flutuante + cabecalho = function() { i3GEOF.selecao.ativaFoco(); }; - minimiza = function(){ - var t = i3GEO.janela.minimiza("i3GEOF.selecao","100px"); - if(t === "min"){ + minimiza = function() { + var t = i3GEO.janela.minimiza("i3GEOF.selecao", "100px"); + if (t === "min") { $i("i3GEOFSelecaoCabecalhoI").style.display = "none"; } else { $i("i3GEOFSelecaoCabecalhoI").style.display = "block"; } }; titulo = - "" - + "
" - + "
" + $trad("x51") - + "
"; - janela = i3GEO.janela.cria( - "510px", - "210px", - "", - "", - "", - titulo, - "i3GEOF.selecao", - false, - "hd", - cabecalho, - minimiza - ); + "" + + "
" + + "
" + + $trad("x51") + + "
"; + janela = i3GEO.janela.cria("510px", "210px", "", "", "", titulo, "i3GEOF.selecao", false, "hd", cabecalho, minimiza); divid = janela[2].id; i3GEOF.selecao.aguarde = $i("i3GEOF.selecao_imagemCabecalho").style; $i("i3GEOF.selecao_corpo").style.backgroundColor = "white"; i3GEOF.selecao.inicia(divid); - i3GEO.eventos.adicionaEventos("ATUALIZAARVORECAMADAS",["i3GEOF.selecao.criaCombosTemas()"]); + i3GEO.eventos.adicionaEventos("ATUALIZAARVORECAMADAS", [ + "i3GEOF.selecao.criaCombosTemas()" + ]); i3GEO.eventos.cliquePerm.desativa(); - temp = function(){ + temp = function() { + var api; i3GEO.eventos.cliquePerm.ativa(); - i3GEO.eventos.removeEventos("ATUALIZAARVORECAMADAS",["i3GEOF.selecao.criaCombosTemas()"]); + i3GEO.eventos.removeEventos("ATUALIZAARVORECAMADAS", [ + "i3GEOF.selecao.criaCombosTemas()" + ]); i3GEO.barraDeBotoes.ativaPadrao(); - i3GEOF.selecao.removeFiguras[i3GEO.Interface["ATUAL"]](); + if(i3GEO.Interface["ATUAL"] === "openlayers"){ + if (typeof OpenLayers == "undefined") { + api = "ol3"; + } else { + api = "openlayers"; + } + } + else{ + api = i3GEO.Interface["ATUAL"]; + } + i3GEOF.selecao.removeFiguras[api](); }; YAHOO.util.Event.addListener(janela[0].close, "click", temp); - i3GEO.util.mudaCursor(i3GEO.configura.cursores,"crosshair",i3GEO.Interface.IDMAPA,i3GEO.configura.locaplic); + i3GEO.util.mudaCursor(i3GEO.configura.cursores, "crosshair", i3GEO.Interface.IDMAPA, i3GEO.configura.locaplic); }, /* - Function: ativaFoco - - Refaz a interface da ferramenta quando a janela flutuante tem seu foco ativado + * Function: ativaFoco + * + * Refaz a interface da ferramenta quando a janela flutuante tem seu foco ativado */ - ativaFoco: function(){ + ativaFoco : function() { i3GEO.eventos.cliquePerm.desativa(); - i3GEO.util.mudaCursor(i3GEO.configura.cursores,"crosshair",i3GEO.Interface.IDMAPA,i3GEO.configura.locaplic); + i3GEO.util.mudaCursor(i3GEO.configura.cursores, "crosshair", i3GEO.Interface.IDMAPA, i3GEO.configura.locaplic); i3GEO.barraDeBotoes.ativaIcone("selecao"); i3GEOF.selecao.pegaTemasSel(); i3GEOF.selecao.mudaicone(); var i = $i("i3GEOF.selecao_c").style; i3GEO.janela.ULTIMOZINDEX++; i.zIndex = 21000 + i3GEO.janela.ULTIMOZINDEX; - if(i3GEO.Interface.ATUAL != "openlayers"){ + if (i3GEO.Interface.ATUAL != "openlayers") { i3GEO.Interface[i3GEO.Interface.ATUAL].recalcPar(); } }, /* - Function: criaCombosTemas - - Cria os combos de seleção de temas + * Function: criaCombosTemas + * + * Cria os combos de seleção de temas */ - criaCombosTemas: function(){ - i3GEO.util.comboTemas( - "i3GEOselecaotemasLigados", - function(retorno){ - var nsel,temp; - temp = $i("i3GEOselecaoComboTemas"); - if(!temp){return;} - temp.innerHTML = retorno.dados; - if($i("i3GEOselecaotemasLigados")){ - $i("i3GEOselecaotemasLigados").value = i3GEO.temaAtivo; - //verifica qts elementos selecionados - if(i3GEO.temaAtivo != ""){ - nsel = i3GEO.arvoreDeCamadas.pegaTema(i3GEO.temaAtivo); - $i("i3GEOselecaoNsel").innerHTML = $trad('selecionados',i3GEOF.selecao.dicionario)+": "+(nsel.nsel) + "
"; - } - $i("i3GEOselecaotemasLigados").onchange = function(){i3GEOF.selecao.pegaTemasSel();}; - } - }, - "i3GEOselecaoComboTemas", - "", - true, - "ligados", - "width:440px;font-size:12px" - ); + criaCombosTemas : function() { + i3GEO.util.comboTemas("i3GEOselecaotemasLigados", function(retorno) { + var nsel, temp; + temp = $i("i3GEOselecaoComboTemas"); + if (!temp) { + return; + } + temp.innerHTML = retorno.dados; + if ($i("i3GEOselecaotemasLigados")) { + $i("i3GEOselecaotemasLigados").value = i3GEO.temaAtivo; + // verifica qts elementos selecionados + if (i3GEO.temaAtivo != "") { + nsel = i3GEO.arvoreDeCamadas.pegaTema(i3GEO.temaAtivo); + $i("i3GEOselecaoNsel").innerHTML = $trad('selecionados', i3GEOF.selecao.dicionario) + ": " + (nsel.nsel) + "
"; + } + $i("i3GEOselecaotemasLigados").onchange = function() { + i3GEOF.selecao.pegaTemasSel(); + }; + } + }, "i3GEOselecaoComboTemas", "", true, "ligados", "width:440px;font-size:12px"); }, /* - Function: mudaicone - - Altera as bordas dos ícones + * Function: mudaicone + * + * Altera as bordas dos ícones */ - mudaicone: function(){ + mudaicone : function() { $i("i3GEOselecaopt").parentNode.style.backgroundColor = "#F5F5F5"; $i("i3GEOselecaoext").parentNode.style.backgroundColor = "#F5F5F5"; - if($i("i3GEOselecaobox")){ + if ($i("i3GEOselecaobox")) { $i("i3GEOselecaobox").parentNode.style.backgroundColor = "#F5F5F5"; } - if($i("i3GEOselecaopoli")){ + if ($i("i3GEOselecaopoli")) { $i("i3GEOselecaopoli").parentNode.style.backgroundColor = "#F5F5F5"; } - if($i("i3GEOselecaoFigura")){ + if ($i("i3GEOselecaoFigura")) { $i("i3GEOselecaoFigura").parentNode.style.backgroundColor = "#F5F5F5"; } }, /* - Function: pegaTemasSel - - Pega a lista de temas escolhidos pelo usuário + * Function: pegaTemasSel + * + * Pega a lista de temas escolhidos pelo usuário */ - pegaTemasSel: function(){ - var selObj = $i("i3GEOselecaotemasLigados"), - selectedArray = [], - i, - nsel; - if(selObj){ - for (i=0; i"; + $i("i3GEOselecaoNsel").innerHTML = $trad('selecionados', i3GEOF.selecao.dicionario) + ": " + (nsel.nsel) + "
"; } } return selectedArray.toString(); }, /* - Function: fimSelecao - - Funcoes executadas quando uma operacao de selecao e concluida - - */ - fimSelecao: function(retorno){ - var nsel, - tema = i3GEO.temaAtivo; + * Function: fimSelecao + * + * Funcoes executadas quando uma operacao de selecao e concluida + * + */ + fimSelecao : function(retorno) { + var nsel, tema = i3GEO.temaAtivo; i3GEOF.selecao.aguarde.visibility = "hidden"; i3GEO.janela.fechaAguarde("i3GEO.atualiza"); - i3GEO.Interface.atualizaTema(retorno,tema); - nsel = i3GEO.arvoreDeCamadas.pegaTema(tema,retorno.data.temas); - $i("i3GEOselecaoNsel").innerHTML = $trad('selecionados',i3GEOF.selecao.dicionario)+": "+(nsel.nsel); - i3GEO.eventos.adicionaEventos("SELECAO",["i3GEOF.tabela.atualizaListaDeRegistros()"]); + i3GEO.Interface.atualizaTema(retorno, tema); + nsel = i3GEO.arvoreDeCamadas.pegaTema(tema, retorno.data.temas); + $i("i3GEOselecaoNsel").innerHTML = $trad('selecionados', i3GEOF.selecao.dicionario) + ": " + (nsel.nsel); + i3GEO.eventos.adicionaEventos("SELECAO", [ + "i3GEOF.tabela.atualizaListaDeRegistros()" + ]); i3GEO.eventos.executaEventos(i3GEO.eventos.SELECAO); }, /* - Function: operacao - - Executa uma operação sobre o conjunto de elementos selecionados - - Veja: - - - - Parametro: - - tipo {String} - tipo de operação inverte|limpa + * Function: operacao + * + * Executa uma operação sobre o conjunto de elementos selecionados + * + * Veja: + * + * + * + * Parametro: + * + * tipo {String} - tipo de operação inverte|limpa */ - operacao: function(tipo){ - if(i3GEOF.selecao.aguarde.visibility === "visible"){ + operacao : function(tipo) { + if (i3GEOF.selecao.aguarde.visibility === "visible") { return; } - try{ - if($i("i3GEOselecaotemasLigados").value === ""){ + try { + if ($i("i3GEOselecaotemasLigados").value === "") { i3GEO.janela.tempoMsg("Escolha um tema"); return; } i3GEOF.selecao.aguarde.visibility = "visible"; i3GEO.mapa.ativaTema($i("i3GEOselecaotemasLigados").value); - var tema = i3GEO.temaAtivo, - fim = function(retorno){ + var tema = i3GEO.temaAtivo, fim = function(retorno) { i3GEOF.selecao.fimSelecao(retorno); }; - i3GEO.php.selecaopt(fim,tema,"",tipo,0); + i3GEO.php.selecaopt(fim, tema, "", tipo, 0); + } catch (e) { + i3GEO.janela.tempoMsg("Erro: " + e); + i3GEOF.selecao.aguarde.visibility = "hidden"; } - catch(e){i3GEO.janela.tempoMsg("Erro: "+e);i3GEOF.selecao.aguarde.visibility = "hidden";} }, /* - Function: tiposel - - Executa um tipo de seleção interativa - - Parameter: - - obj {objeto dom) - objeto que foi clicado para disparar a operação. O valor identifica o tipo de operação + * Function: tiposel + * + * Executa um tipo de seleção interativa + * + * Parameter: + * + * obj {objeto dom) - objeto que foi clicado para disparar a operação. O valor identifica o tipo de + * operação */ - tiposel: function(obj){ - if(i3GEOF.selecao.aguarde.visibility === "visible"){ + tiposel : function(obj) { + if (i3GEOF.selecao.aguarde.visibility === "visible") { return; } - try{ - if($i("i3GEOselecaotemasLigados").value === ""){ + //try { + if ($i("i3GEOselecaotemasLigados").value === "") { i3GEO.janela.tempoMsg("Escolha um tema"); return; } - var fim = function(retorno){ + var api, fim = function(retorno) { i3GEOF.selecao.fimSelecao(retorno); - }, - tema = i3GEOF.selecao.pegaTemasSel(); - if (obj.value == "i3GEOselecaoext"){ + }, tema = i3GEOF.selecao.pegaTemasSel(); + if (i3GEO.Interface["ATUAL"] === "openlayers") { + if (typeof OpenLayers == "undefined") { + api = "ol3"; + } else { + api = "openlayers"; + } + } else { + api = i3GEO.Interface["ATUAL"]; + } + if (obj.value == "i3GEOselecaoext") { i3GEOF.selecao.tipoSel = obj.value; i3GEOF.selecao.aguarde.visibility = "visible"; - i3GEO.php.selecaobox(fim,tema,$i("i3GEOselecaotipoOperacao").value,i3GEO.parametros.mapexten); + i3GEO.php.selecaobox(fim, tema, $i("i3GEOselecaotipoOperacao").value, i3GEO.parametros.mapexten); } - if (obj.value == "i3GEOselecaobox"){ + if (obj.value == "i3GEOselecaobox") { i3GEOF.selecao.tipoSel = obj.value; i3GEOF.selecao.mudaicone(); obj.style.backgroundColor = "#cedff2"; i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia(); - i3GEOF.selecao.box[i3GEO.Interface["ATUAL"]].inicia(); + i3GEOF.selecao.box[api].inicia(); } - if (obj.value == "i3GEOselecaopt"){ + if (obj.value == "i3GEOselecaopt") { i3GEOF.selecao.tipoSel = obj.value; i3GEOF.selecao.mudaicone(); obj.style.backgroundColor = "#cedff2"; i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia(); - i3GEOF.selecao.clique[i3GEO.Interface["ATUAL"]].inicia(); + i3GEOF.selecao.clique[api].inicia(); } - if (obj.value == "i3GEOselecaopoli"){ + if (obj.value == "i3GEOselecaopoli") { i3GEOF.selecao.tipoSel = obj.value; i3GEOF.selecao.mudaicone(); obj.style.backgroundColor = "#cedff2"; i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia(); - i3GEOF.selecao.poligono[i3GEO.Interface["ATUAL"]].inicia(); + i3GEOF.selecao.poligono[api].inicia(); } - if (obj.value == "i3GEOselecaofigura"){ + if (obj.value == "i3GEOselecaofigura") { i3GEOF.selecao.tipoSel = obj.value; i3GEOF.selecao.mudaicone(); obj.style.backgroundColor = "#cedff2"; i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia(); - i3GEOF.selecao.figura[i3GEO.Interface["ATUAL"]].inicia(); + i3GEOF.selecao.figura[api].inicia(); } - } - catch(e){i3GEO.janela.tempoMsg("Erro: "+e);i3GEOF.selecao.aguarde.visibility = "hidden";} + //} catch (e) { + //i3GEO.janela.tempoMsg("Erro: " + e); + //i3GEOF.selecao.aguarde.visibility = "hidden"; + //} }, /* - Function: removeFiguras - Remove as figuras marcadas como origem igual a i3GEOFselecao - */ - removeFiguras:{ - openlayers: function(){ - if(i3GEO.desenho.layergrafico){ + * Function: removeFiguras Remove as figuras marcadas como origem igual a i3GEOFselecao + */ + removeFiguras : { + ol3 : function(){ + var features, n, f, i; + features = i3GEO.desenho.layergrafico.getFeatures(); + n = features.getLength(); + for(i=0; i< n; i++){ + f = features.item(i); + if(f.getGeometryName() === "i3GEOFselecao"){ + i3GEO.desenho.layergrafico.getFeatures().removeAt(i); + } + } + }, + openlayers : function() { + if (i3GEO.desenho.layergrafico) { var temp, f = i3GEO.desenho.layergrafico.getFeaturesByAttribute("origem", "i3GEOFselecao"); - if(f && f.length > 0){ + if (f && f.length > 0) { temp = window.confirm($trad("x94")); if (temp) { i3GEO.desenho.layergrafico.destroyFeatures(f); @@ -510,9 +615,9 @@ i3GEOF.selecao = { } } }, - googlemaps: function(){ - var temp, f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem","i3GEOFselecao"); - if(f && f.length > 0){ + googlemaps : function() { + var temp, f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem", "i3GEOFselecao"); + if (f && f.length > 0) { temp = window.confirm($trad("x94")); if (temp) { i3GEO.desenho.googlemaps.destroyFeatures(f); @@ -521,378 +626,388 @@ i3GEOF.selecao = { } }, /* - Classe: i3GEOF.selecao.box - - Controla o desenho do box para a seleção e executa a operação de seleção + * Classe: i3GEOF.selecao.box + * + * Controla o desenho do box para a seleção e executa a operação de seleção */ - box:{ - openlayers: { - inicia: function(){ + box : { + openlayers : { + inicia : function() { i3GEO.eventos.cliquePerm.desativa(); i3GEOF.selecao.box.openlayers.removeControle(); - var box = new OpenLayers.Control.DrawFeature( - i3GEO.desenho.layergrafico, - OpenLayers.Handler.Box, - { - autoActivate: true, - id: "i3GEOFselecaoBox", - type: OpenLayers.Control.TYPE_TOOL, - callbacks:{ - done: function(feature){ - i3GEOF.selecao.box.openlayers.removeControle(); - var g,f,xminymin = i3geoOL.getLonLatFromPixel({ - x: feature.left, - y: feature.bottom - }), - xmaxymax = i3geoOL.getLonLatFromPixel({ - x: feature.right, - y: feature.top + var box = + new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico, OpenLayers.Handler.Box, { + autoActivate : true, + id : "i3GEOFselecaoBox", + type : OpenLayers.Control.TYPE_TOOL, + callbacks : { + done : function(feature) { + i3GEOF.selecao.box.openlayers.removeControle(); + var g, f, xminymin = i3geoOL.getLonLatFromPixel({ + x : feature.left, + y : feature.bottom + }), xmaxymax = i3geoOL.getLonLatFromPixel({ + x : feature.right, + y : feature.top + }); + i3GEOF.selecao.box.termina(i3GEO.temaAtivo, $i("i3GEOselecaotipoOperacao").value, xminymin.lon + " " + + xminymin.lat + + " " + + xmaxymax.lon + + " " + + xmaxymax.lat); + if ($i("i3GEOFselecaoMantemFigura").checked === true) { + g = new OpenLayers.Bounds(xminymin.lon, xminymin.lat, xmaxymax.lon, xmaxymax.lat); + f = new OpenLayers.Feature.Vector(g.toGeometry(), { + origem : "i3GEOFselecao" + }, { + fillColor : "orange", + fillOpacity : 0.4, + strokeColor : "orange", + strokeOpacity : 1, + strokeWidth : 2 }); - i3GEOF.selecao.box.termina( - i3GEO.temaAtivo, - $i("i3GEOselecaotipoOperacao").value, - xminymin.lon+" "+xminymin.lat+" "+xmaxymax.lon+" "+xmaxymax.lat - ); - if($i("i3GEOFselecaoMantemFigura").checked === true){ - g = new OpenLayers.Bounds(xminymin.lon,xminymin.lat,xmaxymax.lon,xmaxymax.lat); - f = new OpenLayers.Feature.Vector(g.toGeometry(), { - origem : "i3GEOFselecao" - }, { - fillColor: "orange", - fillOpacity: 0.4, - strokeColor: "orange", - strokeOpacity: 1, - strokeWidth: 2 - }); - i3GEO.desenho.layergrafico.addFeatures([f]); - if (i3GEO.Interface) { - i3GEO.Interface.openlayers.sobeLayersGraficos(); - } + i3GEO.desenho.layergrafico.addFeatures([ + f + ]); + if (i3GEO.Interface) { + i3GEO.Interface.openlayers.sobeLayersGraficos(); } } } - }); + } + }); i3geoOL.addControl(box); }, - removeControle: function(){ - var controle = i3geoOL.getControlsBy("id","i3GEOFselecaoBox"); - if(controle.length > 0){ + removeControle : function() { + var controle = i3geoOL.getControlsBy("id", "i3GEOFselecaoBox"); + if (controle.length > 0) { controle[0].deactivate(); i3geoOL.removeControl(controle[0]); } } }, - termina: function(tema,tipo,box){ - var retorna = function(retorno){ + termina : function(tema, tipo, box) { + var retorna = function(retorno) { i3GEOF.selecao.fimSelecao(retorno); }; - i3GEO.janela.abreAguarde("i3GEO.atualiza",$trad("o1")); + i3GEO.janela.abreAguarde("i3GEO.atualiza", $trad("o1")); i3GEO.eventos.cliquePerm.ativa(); - i3GEO.php.selecaobox(retorna,tema,tipo,box); + i3GEO.php.selecaobox(retorna, tema, tipo, box); } }, /* - Function: clique - - Seleciona elementos clicando no mapa + * Function: clique + * + * Seleciona elementos clicando no mapa */ - clique: { - openlayers: { - inicia: function(){ + clique : { + ol3 : { + draw : "", + inicia : function() { + i3GEO.eventos.cliquePerm.desativa(); + i3GEOF.selecao.clique.ol3.removeControle(); + i3GEOF.selecao.clique.ol3.draw = new ol.interaction.Draw({ + //features : i3GEO.desenho.layergrafico.getFeatures(), + type : "Point", + maxPoints : 1 + }); + i3GEOF.selecao.clique.ol3.draw.on("drawend",function(evt){ + var geo, ponto = evt.feature.getGeometry(); + if ($i("i3GEOFselecaoMantemFigura").checked === true) { + evt.feature.setProperties({origem : "i3GEOFselecao"}); + i3GEO.desenho.layergrafico.addFeature(evt.feature); + } + i3GEOF.selecao.clique.ol3.removeControle(); + i3GEO.eventos.cliquePerm.ativa(); + ponto = i3GEO.util.projOSM2Geo(ponto); + geo = ponto.getCoordinates(); + i3GEOF.selecao.clique.termina( + i3GEO.temaAtivo, + $i("i3GEOselecaotipoOperacao").value, + $i("i3GEOselecaotoleranciapt").value, + geo[0], + geo[1]); + }); + i3geoOL.addInteraction(i3GEOF.selecao.clique.ol3.draw); + }, + removeControle : function() { + i3geoOL.removeInteraction(i3GEOF.selecao.clique.ol3.draw); + i3GEOF.selecao.clique.ol3.draw = ""; + } + }, + //versao 2 do openlayers + openlayers : { + inicia : function() { i3GEO.eventos.cliquePerm.desativa(); i3GEOF.selecao.clique.openlayers.removeControle(); - var ponto = new OpenLayers.Control.DrawFeature( - i3GEO.desenho.layergrafico, - OpenLayers.Handler.Point, - { - autoActivate: true, - id: "i3GEOFselecaoPonto", - type: OpenLayers.Control.TYPE_TOOL, - callbacks:{ - done: function(feature){ - i3GEOF.selecao.clique.openlayers.removeControle(); - feature = i3GEO.util.projOSM2Geo(feature); - i3GEOF.selecao.clique.termina( - i3GEO.temaAtivo, - $i("i3GEOselecaotipoOperacao").value, - $i("i3GEOselecaotoleranciapt").value, - feature.x, - feature.y - ); - if($i("i3GEOFselecaoMantemFigura").checked === true){ - feature = i3GEO.util.projGeo2OSM(feature); - f = new OpenLayers.Feature.Vector(feature, { - origem : "i3GEOFselecao" - }, { - fillColor: "orange", - fillOpacity: 0.4, - strokeColor: "orange", - strokeOpacity: 1, - strokeWidth: 2, - graphicName : "square", - pointRadius : 6 - }); + var ponto = + new OpenLayers.Control.DrawFeature(i3GEO.desenho.layergrafico, OpenLayers.Handler.Point, { + autoActivate : true, + id : "i3GEOFselecaoPonto", + type : OpenLayers.Control.TYPE_TOOL, + callbacks : { + done : function(feature) { + i3GEOF.selecao.clique.openlayers.removeControle(); + feature = i3GEO.util.projOSM2Geo(feature); + i3GEOF.selecao.clique.termina( + i3GEO.temaAtivo, + $i("i3GEOselecaotipoOperacao").value, + $i("i3GEOselecaotoleranciapt").value, + feature.x, + feature.y); + if ($i("i3GEOFselecaoMantemFigura").checked === true) { + feature = i3GEO.util.projGeo2OSM(feature); + f = new OpenLayers.Feature.Vector(feature, { + origem : "i3GEOFselecao" + }, { + fillColor : "orange", + fillOpacity : 0.4, + strokeColor : "orange", + strokeOpacity : 1, + strokeWidth : 2, + graphicName : "square", + pointRadius : 6 + }); - i3GEO.desenho.layergrafico.addFeatures([f]); - if (i3GEO.Interface) { - i3GEO.Interface.openlayers.sobeLayersGraficos(); - } + i3GEO.desenho.layergrafico.addFeatures([ + f + ]); + if (i3GEO.Interface) { + i3GEO.Interface.openlayers.sobeLayersGraficos(); } } } - }); + } + }); i3geoOL.addControl(ponto); }, - removeControle: function(){ - var controle = i3geoOL.getControlsBy("id","i3GEOFselecaoPonto"); - if(controle.length > 0){ + removeControle : function() { + var controle = i3geoOL.getControlsBy("id", "i3GEOFselecaoPonto"); + if (controle.length > 0) { controle[0].deactivate(); i3geoOL.removeControl(controle[0]); } } }, - googlemaps: { - inicia: function(){ + googlemaps : { + inicia : function() { var evtclick = null; i3GEO.eventos.cliquePerm.desativa(); - evtclick = google.maps.event.addListener(i3GeoMap, "click", function(evt) { - if(i3GEOF.selecao.tipoSel === "i3GEOselecaopt"){ - i3GEOF.selecao.clique.termina( + evtclick = + google.maps.event.addListener(i3GeoMap, "click", function(evt) { + if (i3GEOF.selecao.tipoSel === "i3GEOselecaopt") { + i3GEOF.selecao.clique.termina( i3GEO.temaAtivo, $i("i3GEOselecaotipoOperacao").value, $i("i3GEOselecaotoleranciapt").value, evt.latLng.lng(), - evt.latLng.lat() - ); - if($i("i3GEOFselecaoMantemFigura").checked === true){ - i3GEO.desenho.googlemaps.shapes.push( - new google.maps.Marker({ - map: i3GeoMap, - fillOpacity: 0, - clickable: false, - position:evt.latLng, - icon: { - path: google.maps.SymbolPath.CIRCLE, - scale: 4, - strokeColor: "orange" + evt.latLng.lat()); + if ($i("i3GEOFselecaoMantemFigura").checked === true) { + i3GEO.desenho.googlemaps.shapes.push(new google.maps.Marker({ + map : i3GeoMap, + fillOpacity : 0, + clickable : false, + position : evt.latLng, + icon : { + path : google.maps.SymbolPath.CIRCLE, + scale : 4, + strokeColor : "orange" }, - origem: "i3GEOFselecao" - }) - ); - } + origem : "i3GEOFselecao" + })); + } - } - google.maps.event.removeListener(evtclick); - }); + } + google.maps.event.removeListener(evtclick); + }); } }, - termina: function(tema,tipo,tolerancia,x,y){ - if(typeof(console) !== 'undefined'){console.info("i3GEO.selecao.porxy()");} - var retorna = function(retorno){ + termina : function(tema, tipo, tolerancia, x, y) { + if (typeof (console) !== 'undefined') { + console.info("i3GEO.selecao.porxy()"); + } + var retorna = function(retorno) { i3GEOF.selecao.fimSelecao(retorno); }; i3GEO.eventos.cliquePerm.ativa(); - i3GEO.php.selecaopt(retorna,tema,x+" "+y,tipo,tolerancia); + i3GEO.php.selecaopt(retorna, tema, x + " " + y, tipo, tolerancia); } }, /* - Function: figura - - Seleciona elementos com base em uma figura existente no mapa + * Function: figura + * + * Seleciona elementos com base em uma figura existente no mapa */ - figura: { - openlayers: { - executa: function(feature){ + figura : { + openlayers : { + executa : function(feature) { i3GEOF.selecao.figura.openlayers.removeControle(); var wkt = i3GEO.util.projOSM2Geo(feature.geometry); - //var wkt = feature.geometry; - i3GEOF.selecao.figura.termina( - i3GEO.temaAtivo, - $i("i3GEOselecaotipoOperacao").value, - wkt - ); + // var wkt = feature.geometry; + i3GEOF.selecao.figura.termina(i3GEO.temaAtivo, $i("i3GEOselecaotipoOperacao").value, wkt); }, - inicia: function(){ - var ponto,f; + inicia : function() { + var ponto, f; i3GEO.eventos.cliquePerm.desativa(); i3GEOF.selecao.figura.openlayers.removeControle(); - //verifica se ja tem uma figura selecionada + // verifica se ja tem uma figura selecionada f = i3GEO.desenho.layergrafico.selectedFeatures; - if(f && f.length > 0){ + if (f && f.length > 0) { i3GEOF.selecao.figura.openlayers.executa(f[0]); return; } - ponto = new OpenLayers.Control.SelectFeature( - i3GEO.desenho.layergrafico, - { - clickout: true, - toggle: true, - multiple: false, - hover: false, - toggleKey: "ctrlKey", // ctrl key removes from selection - box: false, - autoActivate: true, - id: "i3GEOFselecaoFigura", - type: OpenLayers.Control.TYPE_TOOL, - onSelect: function(feature){ - i3GEOF.selecao.figura.openlayers.executa(feature); - } - }); + ponto = new OpenLayers.Control.SelectFeature(i3GEO.desenho.layergrafico, { + clickout : true, + toggle : true, + multiple : false, + hover : false, + toggleKey : "ctrlKey", // ctrl key removes from selection + box : false, + autoActivate : true, + id : "i3GEOFselecaoFigura", + type : OpenLayers.Control.TYPE_TOOL, + onSelect : function(feature) { + i3GEOF.selecao.figura.openlayers.executa(feature); + } + }); i3geoOL.addControl(ponto); }, - removeControle: function(){ - var controle = i3geoOL.getControlsBy("id","i3GEOFselecaoFigura"); - if(controle.length > 0){ + removeControle : function() { + var controle = i3geoOL.getControlsBy("id", "i3GEOFselecaoFigura"); + if (controle.length > 0) { controle[0].deactivate(); i3geoOL.removeControl(controle[0]); } } }, - //FIXME nao funciona no googlemaps - googlemaps: { - inicia: function(){ - var n,i, - evtclick = null; + // FIXME nao funciona no googlemaps + googlemaps : { + inicia : function() { + var n, i, evtclick = null; i3GEO.eventos.cliquePerm.desativa(); - i3GEO.util.mudaCursor(i3GEO.configura.cursores,"pointer",i3GEO.Interface.IDMAPA,i3GEO.configura.locaplic); + i3GEO.util.mudaCursor(i3GEO.configura.cursores, "pointer", i3GEO.Interface.IDMAPA, i3GEO.configura.locaplic); i3GEO.editorGM.drawingManager.setOptions({ - drawingMode: null + drawingMode : null }); n = i3GEO.desenho.googlemaps.shapes.length; - for(i=0;i 0){ + removeControle : function() { + var controle = i3geoOL.getControlsBy("id", "i3GEOFselecaoPoli"); + if (controle.length > 0) { controle[0].deactivate(); i3geoOL.removeControl(controle[0]); } } }, - googlemaps: { - inicia: function(){ + googlemaps : { + inicia : function() { i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia(); - i3GeoMap.setOptions({disableDoubleClickZoom:true}); - i3GeoMap.setOptions({draggableCursor:'crosshair'}); - var evtdblclick = null, - evtclick = null, - evtmousemove = null, - pontos = { - mvcLine: new google.maps.MVCArray(), - line: null, - polygon: null, - x: [], - y: [] - }, - termina = function(){ + i3GeoMap.setOptions({ + disableDoubleClickZoom : true + }); + i3GeoMap.setOptions({ + draggableCursor : 'crosshair' + }); + var evtdblclick = null, evtclick = null, evtmousemove = null, pontos = { + mvcLine : new google.maps.MVCArray(), + line : null, + polygon : null, + x : [], + y : [] + }, termina = function() { google.maps.event.removeListener(evtdblclick); google.maps.event.removeListener(evtclick); google.maps.event.removeListener(evtmousemove); - var f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem","i3GEOFselecao"); + var f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem", "i3GEOFselecao"); i3GEOF.selecao.poligono.termina({ - xpt: pontos.x, - ypt: pontos.y + xpt : pontos.x, + ypt : pontos.y }); - if(f && f.length > 0 && $i("i3GEOFselecaoMantemFigura").checked === false){ + if (f && f.length > 0 && $i("i3GEOFselecaoMantemFigura").checked === false) { i3GEO.desenho.googlemaps.destroyFeatures(f); } - f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem","i3GEOFselecaoMarcas"); - if(f && f.length > 0){ + f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem", "i3GEOFselecaoMarcas"); + if (f && f.length > 0) { i3GEO.desenho.googlemaps.destroyFeatures(f); } }; @@ -900,21 +1015,19 @@ i3GEOF.selecao = { pontos.mvcLine.push(evt.latLng); pontos.x.push(evt.latLng.lng()); pontos.y.push(evt.latLng.lat()); - i3GEO.desenho.googlemaps.shapes.push( - new google.maps.Marker({ - map: i3GeoMap, - fillOpacity: 0, - clickable: false, - position:evt.latLng, - icon: { - path: google.maps.SymbolPath.CIRCLE, - scale: 2.5, - strokeColor: "#ffffff" - }, - origem: "i3GEOFselecaoMarcas" - }) - ); - //mais um ponto para criar uma linha movel + i3GEO.desenho.googlemaps.shapes.push(new google.maps.Marker({ + map : i3GeoMap, + fillOpacity : 0, + clickable : false, + position : evt.latLng, + icon : { + path : google.maps.SymbolPath.CIRCLE, + scale : 2.5, + strokeColor : "#ffffff" + }, + origem : "i3GEOFselecaoMarcas" + })); + // mais um ponto para criar uma linha movel pontos.mvcLine.push(evt.latLng); }); evtmousemove = google.maps.event.addListener(i3GeoMap, "mousemove", function(evt) { @@ -922,13 +1035,13 @@ i3GEOF.selecao = { if (!pontos.line) { // Create the line (google.maps.Polyline) pontos.line = new google.maps.Polygon({ - map: i3GeoMap, - clickable: false, - strokeColor: "#000000", - strokeOpacity: 1, - strokeWeight: 2, - path: pontos.mvcLine, - origem: "i3GEOFselecao" + map : i3GeoMap, + clickable : false, + strokeColor : "#000000", + strokeOpacity : 1, + strokeWeight : 2, + path : pontos.mvcLine, + origem : "i3GEOFselecao" }); i3GEO.desenho.googlemaps.shapes.push(pontos.line); } @@ -942,107 +1055,108 @@ i3GEOF.selecao = { } }, /* - Function: termina - - Termina o desenho do polígono e executa a operação de seleção + * Function: termina + * + * Termina o desenho do polígono e executa a operação de seleção */ - termina: function(pontos){ - var xs,ys,retorna,p,cp,tema=i3GEO.temaAtivo; + termina : function(pontos) { + var xs, ys, retorna, p, cp, tema = i3GEO.temaAtivo; n = pontos.xpt.length; xs = pontos.xpt.toString(","); ys = pontos.ypt.toString(","); - retorna = function(retorno){ + retorna = function(retorno) { i3GEOF.selecao.fimSelecao(retorno); }; - i3GEO.janela.abreAguarde("i3GEO.atualiza",$trad("o1")); + i3GEO.janela.abreAguarde("i3GEO.atualiza", $trad("o1")); i3GEO.eventos.cliquePerm.ativa(); - p = i3GEO.configura.locaplic+"/ferramentas/selecao/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=selecaoPoli"; + p = i3GEO.configura.locaplic + "/ferramentas/selecao/exec.php?g_sid=" + i3GEO.configura.sid + "&funcao=selecaoPoli"; cp = new cpaint(); - //cp.set_debug(2) + // cp.set_debug(2) cp.set_transfer_mode('POST'); cp.set_response_type("JSON"); cp.call( p, "selecaoPoli", retorna, - "xs="+xs, - "ys="+ys, - "tema="+tema, - "tipo="+$i("i3GEOselecaotipoOperacao").value, - "buffer="+$i("i3GEOselecaotoleranciapt").value - ); + "xs=" + xs, + "ys=" + ys, + "tema=" + tema, + "tipo=" + $i("i3GEOselecaotipoOperacao").value, + "buffer=" + $i("i3GEOselecaotoleranciapt").value); } }, /* - Function: criatema - - Cria um novo tema com a seleção atual + * Function: criatema + * + * Cria um novo tema com a seleção atual */ - criatema: function(){ - if(i3GEOF.selecao.aguarde.visibility === "visible") - {return;} - try{ - if($i("i3GEOselecaotemasLigados").value === "") - {i3GEO.janela.tempoMsg("Escolha um tema");return;} + criatema : function() { + if (i3GEOF.selecao.aguarde.visibility === "visible") { + return; + } + try { + if ($i("i3GEOselecaotemasLigados").value === "") { + i3GEO.janela.tempoMsg("Escolha um tema"); + return; + } i3GEOF.selecao.aguarde.visibility = "visible"; - var fim = function(){ + var fim = function() { i3GEOF.selecao.aguarde.visibility = "hidden"; i3GEO.atualiza(); }; - i3GEO.php.criatemaSel(fim,$i("i3GEOselecaotemasLigados").value); + i3GEO.php.criatemaSel(fim, $i("i3GEOselecaotemasLigados").value); + } catch (e) { + i3GEO.janela.tempoMsg("Erro: " + e); + i3GEOF.selecao.aguarde.visibility = "hidden"; } - catch(e){i3GEO.janela.tempoMsg("Erro: "+e);i3GEOF.selecao.aguarde.visibility = "hidden";} }, /* - Function: adicionaLinhaFiltro - - Adiciona uma nova linha de filtro + * Function: adicionaLinhaFiltro + * + * Adiciona uma nova linha de filtro */ - adicionaLinhaFiltro: function(){ - var add,xis,interrogacao,operador,conector,valor,ntr,ntad,ntd,ntd1,ntd2,ntd3,ntd4,ntd5,tabela; - try{ + adicionaLinhaFiltro : function() { + var add, xis, interrogacao, operador, conector, valor, ntr, ntad, ntd, ntd1, ntd2, ntd3, ntd4, ntd5, tabela; + try { add = document.createElement("img"); - add.src = i3GEO.configura.locaplic+'/imagens/oxygen/16x16/list-add.png'; - add.style.cursor="pointer"; - add.onclick = function(){ + add.src = i3GEO.configura.locaplic + '/imagens/oxygen/16x16/list-add.png'; + add.style.cursor = "pointer"; + add.onclick = function() { i3GEOF.selecao.adicionaLinhaFiltro(); }; xis = document.createElement("img"); - xis.src = i3GEO.configura.locaplic+'/imagens/oxygen/16x16/edit-delete.png'; - xis.style.cursor="pointer"; - xis.onclick = function(){ - var p = this.parentNode.parentNode.parentNode, - i; - for (i = 0; i < p.childNodes.length;i++){ + xis.src = i3GEO.configura.locaplic + '/imagens/oxygen/16x16/edit-delete.png'; + xis.style.cursor = "pointer"; + xis.onclick = function() { + var p = this.parentNode.parentNode.parentNode, i; + for (i = 0; i < p.childNodes.length; i++) { p.removeChild(p.childNodes[i]); } }; interrogacao = document.createElement("img"); - interrogacao.src = i3GEO.configura.locaplic+'/imagens/oxygen/16x16/format-line-spacing-normal.png'; - interrogacao.title='mostra valores'; - interrogacao.style.cursor="pointer"; - interrogacao.style.margin="5px"; - interrogacao.onclick = function(){ - var obj = (this.parentNode.parentNode.getElementsByTagName("input"))[0], - itemTema = (this.parentNode.parentNode.getElementsByTagName("select"))[0].value; - i3GEO.util.comboValoresItem( - "i3GEOselecaocbitens", - i3GEO.temaAtivo, - itemTema, - function(retorno){ - $i("i3GEOselecaovalores").innerHTML = "

" + $trad('selecionaValor',i3GEOF.selecao.dicionario) + ":

" - + "
" + retorno.dados + "
"; - if ($i("i3GEOselecaocbitens")){ - $i("i3GEOselecaocbitens").onchange = function(){ - obj.value = this.value; - }; - } - }, - "i3GEOselecaovalores", - "display:block" - ); - }; + interrogacao.src = i3GEO.configura.locaplic + '/imagens/oxygen/16x16/format-line-spacing-normal.png'; + interrogacao.title = 'mostra valores'; + interrogacao.style.cursor = "pointer"; + interrogacao.style.margin = "5px"; + interrogacao.onclick = + function() { + var obj = (this.parentNode.parentNode.getElementsByTagName("input"))[0], itemTema = + (this.parentNode.parentNode.getElementsByTagName("select"))[0].value; + i3GEO.util.comboValoresItem("i3GEOselecaocbitens", i3GEO.temaAtivo, itemTema, function(retorno) { + $i("i3GEOselecaovalores").innerHTML = + "

" + $trad('selecionaValor', i3GEOF.selecao.dicionario) + + ":

" + + "
" + + retorno.dados + + "
"; + if ($i("i3GEOselecaocbitens")) { + $i("i3GEOselecaocbitens").onchange = function() { + obj.value = this.value; + }; + } + }, "i3GEOselecaovalores", "display:block"); + }; operador = "
"; - ntr = document.createElement("tr"); ntad = document.createElement("td"); ntad.appendChild(add); @@ -1076,16 +1189,12 @@ i3GEOF.selecao = { ntr.appendChild(ntd); ntd1 = document.createElement("td"); - i3GEO.util.comboItens( - "i3GEOselecaoItensAtrib", - i3GEO.temaAtivo, - function(retorno){ - ntd1.innerHTML = "
" + retorno.dados + "
"; - $i("i3GEOselecaoItensAtrib").onchange = function(){ - $i("i3GEOselecaovalores").innerHTML = ""; - }; - } - ); + i3GEO.util.comboItens("i3GEOselecaoItensAtrib", i3GEO.temaAtivo, function(retorno) { + ntd1.innerHTML = "
" + retorno.dados + "
"; + $i("i3GEOselecaoItensAtrib").onchange = function() { + $i("i3GEOselecaovalores").innerHTML = ""; + }; + }); ntr.appendChild(ntd1); ntd2 = document.createElement("td"); @@ -1104,37 +1213,43 @@ i3GEOF.selecao = { ntd5.innerHTML = conector; ntr.appendChild(ntd5); - //ntb = document.createElement("tbody"); - //ntb.appendChild(ntr); - if(navm) - {tabela = $i("i3GEOselecaoparametros").getElementsByTagName("tbody")[0];} - else - {tabela = $i("i3GEOselecaoparametros");} + // ntb = document.createElement("tbody"); + // ntb.appendChild(ntr); + if (navm) { + tabela = $i("i3GEOselecaoparametros").getElementsByTagName("tbody")[0]; + } else { + tabela = $i("i3GEOselecaoparametros"); + } tabela.appendChild(ntr); + } catch (e) { + i3GEO.janela.tempoMsg("Erro: " + e); } - catch(e){i3GEO.janela.tempoMsg("Erro: "+e);} }, /* - Function: atributo - - Seleciona por atributo + * Function: atributo + * + * Seleciona por atributo */ - atributo: function(){ - if(i3GEOF.selecao.aguarde.visibility === "visible") - {return;} - if($i("i3GEOselecaotemasLigados").value === "") - {i3GEO.janela.tempoMsg($trad('selecionaTema',i3GEOF.selecao.dicionario));return;} - try{ + atributo : function() { + if (i3GEOF.selecao.aguarde.visibility === "visible") { + return; + } + if ($i("i3GEOselecaotemasLigados").value === "") { + i3GEO.janela.tempoMsg($trad('selecionaTema', i3GEOF.selecao.dicionario)); + return; + } + try { i3GEOF.selecao.aguarde.visibility = "visible"; - var filtro = "", - g,ipt,i,ii,nos,s,itemsel,valor,operador,conector,temp; - if(navm){ii = 2;} - else - {ii = 0;} + var filtro = "", g, ipt, i, ii, nos, s, itemsel, valor, operador, conector, temp; + if (navm) { + ii = 2; + } else { + ii = 0; + } g = $i("i3GEOselecaoparametros"); ipt = g.getElementsByTagName("tr"); - if (ipt.length > 0){ - for (i=ii;i 0) { + for (i = ii; i < ipt.length; i++) { nos = ipt[i].childNodes; s = nos[2].getElementsByTagName("select"); itemsel = s[0].value; @@ -1144,46 +1259,49 @@ i3GEOF.selecao = { valor = s[0].value; s = nos[6].getElementsByTagName("select"); conector = s[0].value; - if (valor*1) - {filtro = filtro + "(["+itemsel+"] "+operador+" "+valor+")";} - else - {filtro = filtro + "(|["+itemsel+"]| "+operador+" |"+valor+"|)";} - if ((i + 1) != ipt.length) //tem conector - {filtro = filtro + conector;} - else - {filtro = "("+filtro+")";} + if (valor * 1) { + filtro = filtro + "([" + itemsel + "] " + operador + " " + valor + ")"; + } else { + filtro = filtro + "(|[" + itemsel + "]| " + operador + " |" + valor + "|)"; + } + if ((i + 1) != ipt.length) // tem conector + { + filtro = filtro + conector; + } else { + filtro = "(" + filtro + ")"; + } } } - if (filtro === ""){ + if (filtro === "") { i3GEOF.selecao.aguarde.visibility = "hidden"; return; } - temp = function(retorno){ + temp = function(retorno) { i3GEOF.selecao.fimSelecao(retorno); }; - i3GEO.php.selecaoatrib2(temp,i3GEO.temaAtivo,filtro,$i("i3GEOselecaotipoOperacao").value); - } - catch(e){ - i3GEO.janela.tempoMsg("Erro: "+e); + i3GEO.php.selecaoatrib2(temp, i3GEO.temaAtivo, filtro, $i("i3GEOselecaotipoOperacao").value); + } catch (e) { + i3GEO.janela.tempoMsg("Erro: " + e); i3GEOF.selecao.aguarde.visibility = "hidden"; } }, /* - Function: aplicaselecaoTema - - Realiza a seleção cruzando um tema com outro + * Function: aplicaselecaoTema + * + * Realiza a seleção cruzando um tema com outro */ - aplicaselecaoTema: function(){ - if(i3GEOF.selecao.aguarde.visibility === "visible") - {return;} - if($i("i3GEOselecaotemasLigados").value === ""){ - i3GEO.janela.tempoMsg($trad('selecionaTema',i3GEOF.selecao.dicionario)); + aplicaselecaoTema : function() { + if (i3GEOF.selecao.aguarde.visibility === "visible") { + return; + } + if ($i("i3GEOselecaotemasLigados").value === "") { + i3GEO.janela.tempoMsg($trad('selecionaTema', i3GEOF.selecao.dicionario)); i3GEOF.selecao.aguarde.visibility = "hidden"; return; } - try{ + try { i3GEOF.selecao.aguarde.visibility = "visible"; - var temp = function(retorno){ + var temp = function(retorno) { i3GEOF.selecao.fimSelecao(retorno); }; i3GEO.php.selecaotema( @@ -1191,64 +1309,66 @@ i3GEOF.selecao = { $i("i3GEOselecaoTemaoverlay").value, i3GEO.temaAtivo, $i("i3GEOselecaotipoOperacao").value, - $i("i3GEOselecaotoleranciapt").value - ); - } - catch(e){ - i3GEO.janela.tempoMsg("Erro: "+e); + $i("i3GEOselecaotoleranciapt").value); + } catch (e) { + i3GEO.janela.tempoMsg("Erro: " + e); i3GEOF.selecao.aguarde.visibility = "hidden"; } }, /* - Function: grafico - - Abre uma janela flutuante para criar gráficos + * Function: grafico + * + * Abre uma janela flutuante para criar gráficos */ - grafico: function(){ + grafico : function() { i3GEO.analise.dialogo.graficoInterativo1(); }, /* - Function: graficoPerfil - - Abre uma janela flutuante para criar gráficos de perfil + * Function: graficoPerfil + * + * Abre uma janela flutuante para criar gráficos de perfil */ - graficoPerfil: function(){ - var cp,p; - if(i3GEOF.selecao.aguarde.visibility === "visible") - {return;} - if($i("i3GEOselecaotemasLigados").value === "") - {i3GEO.janela.tempoMsg("Escolha um tema");return;} - try{ + graficoPerfil : function() { + var cp, p; + if (i3GEOF.selecao.aguarde.visibility === "visible") { + return; + } + if ($i("i3GEOselecaotemasLigados").value === "") { + i3GEO.janela.tempoMsg("Escolha um tema"); + return; + } + try { i3GEOF.selecao.aguarde.visibility = "visible"; - var temp = function(retorno){ + var temp = function(retorno) { i3GEOF.selecao.aguarde.visibility = "hidden"; - if (retorno.data != undefined){ - var x = [], - y = [], - i, - n = retorno.data.length, - js = i3GEO.configura.locaplic+"/ferramentas/perfil/index.js"; - for (i=0;i" + lista[i] + ""; + } + caixa += ""; + return caixa; }, - "verde" : { - fillcolor : '#3CCC2F', - linecolor : '#0C6642', - linewidth : '1', - circcolor : '#C7D9D2', - textcolor : '#787A78' - } - }, - // @TODO remover apos refatorar codigo - estilosOld : { - "normal" : { - fillcolor : 'red', - linecolor : 'black', - linewidth : '1', - circcolor : 'white', - textcolor : 'gray' + /** + * Function: addBox + * + * Adiciona um retangulo + * + * Parameter: + * + * {numeric} - novo xmin + * + * {numeric} - novo ymin + * + * {numeric} - novo xmax + * + * {numeric} - novo ymax + * + * {string} - namespace que identifica o elemento grafico, permitindo busca + * + * {string} - cor do contorno + * + * {string} - expessura do contorno + */ + addBox : function(xmin, ymin, xmax, ymax, namespace, strokeColor, strokeWidth) { + if (i3GEO.Interface.ATUAL != "googleearth") { + return i3GEO.desenho[i3GEO.Interface.ATUAL].addBox(xmin, ymin, xmax, ymax, namespace, strokeColor, strokeWidth); + } else { + return false; + } }, - "palido" : { - fillcolor : 'gray', - linecolor : 'gray', - linewidth : '1', - circcolor : 'gray', - textcolor : 'gray' + /** + * Function: moveBox + * + * Reposiciona um retangulo + * + * Parameter: + * + * {object} - box + * + * {numeric} - novo xmin + * + * {numeric} - novo ymin + * + * {numeric} - novo xmax + * + * {numeric} - novo ymax + */ + moveBox : function(box, xmin, ymin, xmax, ymax) { + if (i3GEO.Interface.ATUAL != "googleearth") { + return i3GEO.desenho[i3GEO.Interface.ATUAL].moveBox(box, xmin, ymin, xmax, ymax); + } else { + return false; + } }, - "vermelho" : { - fillcolor : 'gray', - linecolor : 'red', - linewidth : '1', - circcolor : 'pink', - textcolor : 'brown' + /** + * Function: removeBox + * + * Remove box do mapa (apenas alias para removePins) + * + * Parameter: + * + * {string} - namespace que identifica o grupo de marcas que serao removidas + */ + removeBox : function(namespace) { + i3GEO.desenho.removePins(namespace); }, - "verde" : { - fillcolor : 'gray', - linecolor : 'green', - linewidth : '1', - circcolor : 'DarkGreen', - textcolor : 'GreenYellow' - } - }, - /** - * Propriedade: estiloPadrao - * - * Estilo utilizado como padrão - */ - estiloPadrao : "normal", - /** - * Cria uma caixa de seleção para escolha do estilo a ser - * utilizado - */ - caixaEstilos : function() { - var lista = i3GEO.util.listaChaves(i3GEO.desenho.estilos), n = lista.length, i, caixa, sel; - caixa = ""; - return caixa; - }, - /** - * Function: addBox - * - * Adiciona um retangulo - * - * Parameter: - * - * {numeric} - novo xmin - * - * {numeric} - novo ymin - * - * {numeric} - novo xmax - * - * {numeric} - novo ymax - * - * {string} - namespace que identifica o elemento grafico, permitindo busca - * - * {string} - cor do contorno - * - * {string} - expessura do contorno - */ - addBox : function(xmin, ymin, xmax, ymax, namespace, strokeColor, strokeWidth) { - if (i3GEO.Interface.ATUAL != "googleearth") { - return i3GEO.desenho[i3GEO.Interface.ATUAL].addBox( - xmin, - ymin, - xmax, - ymax, - namespace, - strokeColor, - strokeWidth); - } else { - return false; - } - }, - /** - * Function: moveBox - * - * Reposiciona um retangulo - * - * Parameter: - * - * {object} - box - * - * {numeric} - novo xmin - * - * {numeric} - novo ymin - * - * {numeric} - novo xmax - * - * {numeric} - novo ymax - */ - moveBox : function(box, xmin, ymin, xmax, ymax) { - if (i3GEO.Interface.ATUAL != "googleearth") { - return i3GEO.desenho[i3GEO.Interface.ATUAL].moveBox( - box, - xmin, - ymin, - xmax, - ymax); - } else { - return false; - } - }, - /** - * Function: removeBox - * - * Remove box do mapa (apenas alias para removePins) - * - * Parameter: - * - * {string} - namespace que identifica o grupo de marcas que serao removidas - */ - removeBox : function(namespace) { - i3GEO.desenho.removePins(namespace); - }, - /** - * Function: addPin - * - * Adiciona uma marca no mapa em uma determinada coordenada - * - * Parameters: - * - * {numeric} - longitude - * - * {numeric} - latitude - * - * {numeric} - largura da imagem - * - * {numeric} - altura da imagem - * - * {string} - namespace utilizado para agrupar a marca, permitindo sua - * remocao - * - * {boolean} - posiciona a marca no centro do ponto - * - * {function} - função disparada no evento onclick - * - * Return: - * - * {objeto} - * - */ - addPin : function(x, y, w, h, imagem, namespace, centro, funcaoclick) { - if (i3GEO.Interface.ATUAL != "googleearth") { - return i3GEO.desenho[i3GEO.Interface.ATUAL].addPin( - x, - y, - w, - h, - imagem, - namespace, - centro); - } else { - return false; - } - }, - /** - * Function: removePins - * - * Remove marcas do mapa - * - * Parameter: - * - * {string} - namespace que identifica o grupo de marcas que serao removidas - */ - removePins : function(namespace) { - if (i3GEO.Interface.ATUAL != "googleearth") { - i3GEO.desenho[i3GEO.Interface.ATUAL].removePins(namespace); - } - }, - /** - * Function: movePin - * - * Reposiciona uma marca - * - * Parameter: - * - * {object} - marca - * - * {numeric} - novo x - * - * {numeric} - novo y - */ - movePin : function(pin, x, y) { - if (i3GEO.Interface.ATUAL != "googleearth") { - i3GEO.desenho[i3GEO.Interface.ATUAL].movePin( - pin, - x, - y); - } - }, - /** - * Section: i3GEO.desenho.openlayers - * - * Funções utilizadas quando o mapa baseia-se na interface - * OpenLayers - */ - openlayers : { /** - * Function: inicia - * - * Cria o layer onde os desenhos serao inseridos + * Function: addPin + * + * Adiciona uma marca no mapa em uma determinada coordenada + * + * Parameters: + * + * {numeric} - longitude + * + * {numeric} - latitude + * + * {numeric} - largura da imagem + * + * {numeric} - altura da imagem + * + * {string} - namespace utilizado para agrupar a marca, permitindo sua remocao + * + * {boolean} - posiciona a marca no centro do ponto + * + * {function} - função disparada no evento onclick + * + * Return: + * + * {objeto} + * */ - inicia : function() { - if (!i3GEO.desenho.layergrafico) { - i3GEO.desenho.openlayers.criaLayerGrafico(); + addPin : function(x, y, w, h, imagem, namespace, centro, funcaoclick) { + if (i3GEO.Interface.ATUAL != "googleearth") { + return i3GEO.desenho[i3GEO.Interface.ATUAL].addPin(x, y, w, h, imagem, namespace, centro); + } else { + return false; } }, - addBox : function(xmin, ymin, xmax, ymax, namespace, strokeColor, strokeWidth) { - var bounds, f; - if (!namespace) { - namespace = "box"; - } - if (!strokeColor) { - strokeColor = "#FF0000"; + /** + * Function: removePins + * + * Remove marcas do mapa + * + * Parameter: + * + * {string} - namespace que identifica o grupo de marcas que serao removidas + */ + removePins : function(namespace) { + if (i3GEO.Interface.ATUAL != "googleearth") { + i3GEO.desenho[i3GEO.Interface.ATUAL].removePins(namespace); } - if (!strokeWidth) { - strokeWidth = 2; + }, + /** + * Function: movePin + * + * Reposiciona uma marca + * + * Parameter: + * + * {object} - marca + * + * {numeric} - novo x + * + * {numeric} - novo y + */ + movePin : function(pin, x, y) { + if (i3GEO.Interface.ATUAL != "googleearth") { + i3GEO.desenho[i3GEO.Interface.ATUAL].movePin(pin, x, y); } - i3GEO.desenho.openlayers.inicia(); - bounds = OpenLayers.Bounds.fromArray([ - xmin, - ymin, - xmax, - ymax - ]); - bounds = bounds.toGeometry(); - bounds = i3GEO.util.extGeo2OSM(bounds); - f = new OpenLayers.Feature.Vector( - bounds, { + }, + /** + * Section: i3GEO.desenho.openlayers + * + * Funções utilizadas quando o mapa baseia-se na interface OpenLayers + */ + openlayers : { + /** + * Function: inicia + * + * Cria o layer onde os desenhos serao inseridos + */ + inicia : function() { + if (!i3GEO.desenho.layergrafico) { + i3GEO.desenho.openlayers.criaLayerGrafico(); + } + }, + addBox : function(xmin, ymin, xmax, ymax, namespace, strokeColor, strokeWidth) { + var bounds, f; + if (!namespace) { + namespace = "box"; + } + if (!strokeColor) { + strokeColor = "#FF0000"; + } + if (!strokeWidth) { + strokeWidth = 2; + } + i3GEO.desenho.openlayers.inicia(); + bounds = OpenLayers.Bounds.fromArray([ + xmin, ymin, xmax, ymax + ]); + bounds = bounds.toGeometry(); + bounds = i3GEO.util.extGeo2OSM(bounds); + f = new OpenLayers.Feature.Vector(bounds, { origem : namespace }, { fill : false, strokeColor : strokeColor, strokeWidth : strokeWidth }); - i3GEO.desenho.layergrafico.addFeatures([ - f - ]); - return f; - }, - moveBox : function(box, xmin, ymin, xmax, ymax) { - i3GEO.desenho.layergrafico.removeFeatures(box); - var namespace = box["attributes"].origem, strokeWidth = box["style"].strokeWidth, strokeColor = box["style"].strokeColor; - box = i3GEO.desenho.addBox( - xmin, - ymin, - xmax, - ymax, - namespace, - strokeColor, - strokeWidth); - return box; - }, - addPin : function(x, y, w, h, imagem, namespace, centro, funcaoclick) { - return; - if (!imagem - || imagem === "") { - imagem = i3GEO.configura.locaplic - + "/imagens/google/confluence.png"; - } - if (!namespace) { - namespace = "pin"; - } - if (!w - || w === "") { - w = 27; - } - if (!h - || h === "") { - h = 27; - } - if (!funcaoclick) { - funcaoclick = function() { - i3GEO.desenho.openlayers.removePins(namespace); - }; - } - if (!centro) { - centro = false; - } - i3GEO.desenho.openlayers.inicia(); - var point, f, ox, oy; - if (centro === true) { - ox = parseInt( - w / 2, - 10) - * -1; - oy = parseInt( - h / 2, - 10) - * -1; - } else { - ox = parseInt( - w / 2, - 10) - * -1; - oy = h - * -1; - } - point = new OpenLayers.Geometry.Point( - x, y); - point = i3GEO.util.extGeo2OSM(point); - f = new OpenLayers.Feature.Vector( - point, { + i3GEO.desenho.layergrafico.addFeatures([ + f + ]); + return f; + }, + moveBox : function(box, xmin, ymin, xmax, ymax) { + i3GEO.desenho.layergrafico.removeFeatures(box); + var namespace = box["attributes"].origem, strokeWidth = box["style"].strokeWidth, strokeColor = box["style"].strokeColor; + box = i3GEO.desenho.addBox(xmin, ymin, xmax, ymax, namespace, strokeColor, strokeWidth); + return box; + }, + addPin : function(x, y, w, h, imagem, namespace, centro, funcaoclick) { + return; + if (!imagem || imagem === "") { + imagem = i3GEO.configura.locaplic + "/imagens/google/confluence.png"; + } + if (!namespace) { + namespace = "pin"; + } + if (!w || w === "") { + w = 27; + } + if (!h || h === "") { + h = 27; + } + if (!funcaoclick) { + funcaoclick = function() { + i3GEO.desenho.openlayers.removePins(namespace); + }; + } + if (!centro) { + centro = false; + } + i3GEO.desenho.openlayers.inicia(); + var point, f, ox, oy; + if (centro === true) { + ox = parseInt(w / 2, 10) * -1; + oy = parseInt(h / 2, 10) * -1; + } else { + ox = parseInt(w / 2, 10) * -1; + oy = h * -1; + } + point = new OpenLayers.Geometry.Point(x, y); + point = i3GEO.util.extGeo2OSM(point); + f = new OpenLayers.Feature.Vector(point, { origem : namespace, click : funcaoclick }, { @@ -431,70 +368,85 @@ i3GEO.desenho = { graphicYOffset : oy, externalGraphic : imagem }); - i3GEO.desenho.layergrafico.addFeatures([ - f - ]); - return f; - }, - removePins : function(namespace) { - return; - if (!namespace) { - namespace = "pin"; - } - if (i3GEO.desenho.layergrafico) { - var f = i3GEO.desenho.layergrafico.getFeaturesByAttribute( - "origem", - namespace); - if (f - && f.length > 0) { - i3GEO.desenho.layergrafico.destroyFeatures(f); + i3GEO.desenho.layergrafico.addFeatures([ + f + ]); + return f; + }, + removePins : function(namespace) { + return; + if (!namespace) { + namespace = "pin"; } - } - }, - movePin : function(pin, x, y) { - return; - var point = new OpenLayers.LonLat( - x, y); - point = i3GEO.util.extGeo2OSM(point); - pin.move(point); - }, - criaLayerGrafico : function() { - return; - if (!i3GEO.desenho.layergrafico) { - var sketchSymbolizers = { - "Point" : { - fillColor : "rgb(${fillColor})", - fillOpacity : "${opacidade}", - strokeWidth : "${strokeWidth}", - strokeOpacity : "${opacidade}", - strokeColor : "rgb(${strokeColor})", - label : "${texto}", - pointRadius : "${pointRadius}", - graphicName : "${graphicName}", - fontSize : "${fontSize}", - fontColor : "rgb(${fontColor})", - fontFamily : "Arial", - fontWeight : "normal", - labelAlign : "lb", - labelXOffset : "3", - labelYOffset : "3", - externalGraphic : "${externalGraphic}" - }, - "Line" : { - strokeWidth : "${strokeWidth}", - strokeOpacity : "${opacidade}", - strokeColor : "rgb(${strokeColor})" - }, - "Polygon" : { - strokeWidth : "${strokeWidth}", - strokeOpacity : "${opacidade}", - strokeColor : "rgb(${strokeColor})", - fillColor : "rgb(${fillColor})", - fillOpacity : "${opacidade}", - zIndex : 5000 + if (i3GEO.desenho.layergrafico) { + var f = i3GEO.desenho.layergrafico.getFeaturesByAttribute("origem", namespace); + if (f && f.length > 0) { + i3GEO.desenho.layergrafico.destroyFeatures(f); } - }, style = new OpenLayers.Style(), styleMap1 = new OpenLayers.StyleMap( - { + } + }, + movePin : function(pin, x, y) { + return; + var point = new OpenLayers.LonLat(x, y); + point = i3GEO.util.extGeo2OSM(point); + pin.move(point); + }, + criaLayerGrafico : function() { + if (!i3GEO.desenho.layergrafico) { + i3GEO.desenho.layergrafico = new ol.FeatureOverlay({ + style : new ol.style.Style({ + fill : new ol.style.Fill({ + color : 'rgba(255, 255, 255, 0.2)' + }), + stroke : new ol.style.Stroke({ + color : '#ffcc33', + width : 2 + }), + image : new ol.style.Circle({ + radius : 7, + fill : new ol.style.Fill({ + color : '#ffcc33' + }) + }) + }) + }); + i3GEO.desenho.layergrafico.setMap(i3geoOL); + } + return; + if (!i3GEO.desenho.layergrafico) { + var sketchSymbolizers = { + "Point" : { + fillColor : "rgb(${fillColor})", + fillOpacity : "${opacidade}", + strokeWidth : "${strokeWidth}", + strokeOpacity : "${opacidade}", + strokeColor : "rgb(${strokeColor})", + label : "${texto}", + pointRadius : "${pointRadius}", + graphicName : "${graphicName}", + fontSize : "${fontSize}", + fontColor : "rgb(${fontColor})", + fontFamily : "Arial", + fontWeight : "normal", + labelAlign : "lb", + labelXOffset : "3", + labelYOffset : "3", + externalGraphic : "${externalGraphic}" + }, + "Line" : { + strokeWidth : "${strokeWidth}", + strokeOpacity : "${opacidade}", + strokeColor : "rgb(${strokeColor})" + }, + "Polygon" : { + strokeWidth : "${strokeWidth}", + strokeOpacity : "${opacidade}", + strokeColor : "rgb(${strokeColor})", + fillColor : "rgb(${fillColor})", + fillOpacity : "${opacidade}", + zIndex : 5000 + } + }, style = new OpenLayers.Style(), styleMap1 = new OpenLayers.StyleMap({ "default" : style, "vertex" : { strokeOpacity : 1, @@ -506,14 +458,12 @@ i3GEO.desenho = { }, { extendDefault : false }); - style.addRules([ - new OpenLayers.Rule( - { + style.addRules([ + new OpenLayers.Rule({ symbolizer : sketchSymbolizers }) - ]); - i3GEO.desenho.layergrafico = new OpenLayers.Layer.Vector( - "Graf", { + ]); + i3GEO.desenho.layergrafico = new OpenLayers.Layer.Vector("Graf", { styleMap : styleMap1, displayInLayerSwitcher : true, visibility : true, @@ -529,292 +479,238 @@ i3GEO.desenho = { } } }); - // para efeitos de compatibilidade - if (i3GEO.editorOL - && i3GEO.editorOL.mapa) { - i3GEO.editorOL.mapa.addLayers([ - i3GEO.desenho.layergrafico - ]); - } else { - i3geoOL.addLayers([ - i3GEO.desenho.layergrafico - ]); + // para efeitos de compatibilidade + if (i3GEO.editorOL && i3GEO.editorOL.mapa) { + i3GEO.editorOL.mapa.addLayers([ + i3GEO.desenho.layergrafico + ]); + } else { + i3geoOL.addLayers([ + i3GEO.desenho.layergrafico + ]); + } } } - } - }, - /** - * Section: i3GEO.desenho.googlemaps - * - * Funções utilizadas quando o mapa baseia-se na interface - * GoogleMaps - */ - googlemaps : { + }, /** - * Variavel: shapes - * - * Array que guarda todos os objetos que estao atualmente no mapa E - * atualizado toda vez que uma figura e acrescentada ou removida + * Section: i3GEO.desenho.googlemaps + * + * Funções utilizadas quando o mapa baseia-se na interface GoogleMaps */ - shapes : [], - inicia : function() { - }, - addBox : function(xmin, ymin, xmax, ymax, namespace, strokeColor, strokeWidth) { - var f; - if (!namespace) { - namespace = "box"; - } - if (!strokeColor) { - strokeColor = "#FF0000"; - } - if (!strokeWidth) { - strokeWidth = 2; - } - i3GEO.desenho.googlemaps.inicia(); - f = new google.maps.Rectangle( - { + googlemaps : { + /** + * Variavel: shapes + * + * Array que guarda todos os objetos que estao atualmente no mapa E atualizado toda vez que uma figura e acrescentada ou + * removida + */ + shapes : [], + inicia : function() { + }, + addBox : function(xmin, ymin, xmax, ymax, namespace, strokeColor, strokeWidth) { + var f; + if (!namespace) { + namespace = "box"; + } + if (!strokeColor) { + strokeColor = "#FF0000"; + } + if (!strokeWidth) { + strokeWidth = 2; + } + i3GEO.desenho.googlemaps.inicia(); + f = new google.maps.Rectangle({ origem : namespace, strokeColor : strokeColor, strokeWeight : strokeWidth, - fillOpacity: 0, + fillOpacity : 0, map : i3GeoMap, - bounds : new google.maps.LatLngBounds( - new google.maps.LatLng( - ymin, xmin), new google.maps.LatLng( - ymax, xmax)) + bounds : new google.maps.LatLngBounds(new google.maps.LatLng(ymin, xmin), new google.maps.LatLng(ymax, xmax)) }); - i3GEO.desenho.googlemaps.shapes.push(f); - return f; - }, - moveBox : function(box, xmin, ymin, xmax, ymax) { - box.setBounds(new google.maps.LatLngBounds( - new google.maps.LatLng( - ymin, xmin), new google.maps.LatLng( - ymax, xmax))); - return box; - }, - addPin : function(x, y, w, h, imagem, namespace, centro, funcaoclick) { - if (!imagem - || imagem === "") { - imagem = i3GEO.configura.locaplic - + "/imagens/google/confluence.png"; - } - if (!namespace) { - namespace = "pin"; - } - if (!w - || w === "") { - w = 27; - } - if (!h - || h === "") { - h = 27; - } - if (!funcaoclick) { - funcaoclick = function() { - i3GEO.desenho.googlemaps.removePins(namespace); - }; - } - if (!centro) { - centro = false; - } - i3GEO.desenho.googlemaps.inicia(); - var point, f, icon; - if (centro === false) { - icon = { - url : imagem, - size : new google.maps.Size( - w, h) - }; - } else { - icon = { - url : imagem, - size : new google.maps.Size( - w, h), - origin : new google.maps.Point( - 0, 0), - anchor : new google.maps.Point( - w / 2, h / 2) - }; - } - point = new google.maps.LatLng( - y, x); + i3GEO.desenho.googlemaps.shapes.push(f); + return f; + }, + moveBox : function(box, xmin, ymin, xmax, ymax) { + box.setBounds(new google.maps.LatLngBounds(new google.maps.LatLng(ymin, xmin), new google.maps.LatLng(ymax, xmax))); + return box; + }, + addPin : function(x, y, w, h, imagem, namespace, centro, funcaoclick) { + if (!imagem || imagem === "") { + imagem = i3GEO.configura.locaplic + "/imagens/google/confluence.png"; + } + if (!namespace) { + namespace = "pin"; + } + if (!w || w === "") { + w = 27; + } + if (!h || h === "") { + h = 27; + } + if (!funcaoclick) { + funcaoclick = function() { + i3GEO.desenho.googlemaps.removePins(namespace); + }; + } + if (!centro) { + centro = false; + } + i3GEO.desenho.googlemaps.inicia(); + var point, f, icon; + if (centro === false) { + icon = { + url : imagem, + size : new google.maps.Size(w, h) + }; + } else { + icon = { + url : imagem, + size : new google.maps.Size(w, h), + origin : new google.maps.Point(0, 0), + anchor : new google.maps.Point(w / 2, h / 2) + }; + } + point = new google.maps.LatLng(y, x); - f = new google.maps.Marker( - { + f = new google.maps.Marker({ position : point, map : i3GeoMap, origem : namespace, icon : icon }); - i3GEO.desenho.googlemaps.shapes.push(f); - return f; - }, - removePins : function(namespace) { - if (!namespace) { - namespace = "pin"; - } - var f = i3GEO.desenho.googlemaps.getFeaturesByAttribute( - "origem", - namespace); - if (f - && f.length > 0) { - i3GEO.desenho.googlemaps.destroyFeatures(f); - } - }, - movePin : function(pin, x, y) { - var point = new google.maps.LatLng( - y, x); - pin.setPosition(point); - }, - /** - * Function: getFeaturesByAttribute - * - * Obtém uma figura com base em um atributo - * - * {string} - * - * {string} - */ - getFeaturesByAttribute : function(atributo, valor) { - var i, s = [], n = i3GEO.desenho.googlemaps.shapes.length; - for (i = 0; i < n; i++) { - if (i3GEO.desenho.googlemaps.shapes[i] - && i3GEO.desenho.googlemaps.shapes[i] != "") { - if (i3GEO.desenho.googlemaps.shapes[i][atributo] == valor) { - s.push(i3GEO.desenho.googlemaps.shapes[i]); + i3GEO.desenho.googlemaps.shapes.push(f); + return f; + }, + removePins : function(namespace) { + if (!namespace) { + namespace = "pin"; + } + var f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem", namespace); + if (f && f.length > 0) { + i3GEO.desenho.googlemaps.destroyFeatures(f); + } + }, + movePin : function(pin, x, y) { + var point = new google.maps.LatLng(y, x); + pin.setPosition(point); + }, + /** + * Function: getFeaturesByAttribute + * + * Obtém uma figura com base em um atributo + * + * {string} + * + * {string} + */ + getFeaturesByAttribute : function(atributo, valor) { + var i, s = [], n = i3GEO.desenho.googlemaps.shapes.length; + for (i = 0; i < n; i++) { + if (i3GEO.desenho.googlemaps.shapes[i] && i3GEO.desenho.googlemaps.shapes[i] != "") { + if (i3GEO.desenho.googlemaps.shapes[i][atributo] == valor) { + s.push(i3GEO.desenho.googlemaps.shapes[i]); + } + } + } + return s; + }, + /** + * Function: destroyFeatures + * + * Destroi as figuras + * + * {array} - lista de objetos + */ + destroyFeatures : function(f) { + if (f) { + var i, n = f.length; + for (i = 0; i < n; i++) { + f[i].setMap(null); + f[i] = ""; } } } - return s; }, /** - * Function: destroyFeatures - * - * Destroi as figuras - * - * {array} - lista de objetos + * Section: i3GEO.desenho.googleearth + * + * Funções utilizadas quando o mapa baseia-se na interface GoogleEarth */ - destroyFeatures : function(f) { - if (f) { - var i, n = f.length; - for (i = 0; i < n; i++) { - f[i].setMap(null); - f[i] = ""; - } - } - } - }, - /** - * Section: i3GEO.desenho.googleearth - * - * Funções utilizadas quando o mapa baseia-se na interface - * GoogleEarth - */ - googleearth : { - insereMarca : function(description, ddx, ddy, name, snippet) { - if (typeof (console) !== 'undefined') - console.info("i3GEO.Interface.googleearth.insereMarca()"); + googleearth : { + insereMarca : function(description, ddx, ddy, name, snippet) { + if (typeof (console) !== 'undefined') + console.info("i3GEO.Interface.googleearth.insereMarca()"); - var placemark = i3GeoMap.createPlacemark(''), point = i3GeoMap.createPoint(''); - placemark.setName(name); - point.setLatitude(ddy); - point.setLongitude(ddx); - placemark.setGeometry(point); - if (description !== "") { - placemark.setDescription(description); - } - placemark.setSnippet(snippet); - i3GeoMap.getFeatures().appendChild( - placemark); - }, - // - // código obtido em - // http://code.google.com/intl/pt-BR/apis/earth/documentation/geometries.html - // - insereCirculo : function(centerLng, centerLat, radius, name, snippet) { - function makeCircle(centerLat, centerLng, radius) { - var ring = i3GeoMap.createLinearRing(''), steps = 25, i, pi2 = Math.PI * 2, lat, lng; - for (i = 0; i < steps; i++) { - lat = centerLat - + radius - * Math.cos(i - / steps - * pi2); - lng = centerLng - + radius - * Math.sin(i - / steps - * pi2); - ring.getCoordinates().pushLatLngAlt( - lat, - lng, - 0); - } - return ring; - } - var polygonPlacemark = i3GeoMap.createPlacemark(''), poly = i3GeoMap.createPolygon(''), polyStyle; - poly.setAltitudeMode(i3GeoMap.ALTITUDE_RELATIVE_TO_GROUND); - polygonPlacemark.setGeometry(poly); - polygonPlacemark.getGeometry().setOuterBoundary( - makeCircle( - centerLat, - centerLng, - radius)); - polygonPlacemark.setName(name); - polygonPlacemark.setSnippet(snippet); - polygonPlacemark.setStyleSelector(i3GeoMap.createStyle('')); - polyStyle = polygonPlacemark.getStyleSelector().getPolyStyle(); - polyStyle.setFill(0); - i3GeoMap.getFeatures().appendChild( - polygonPlacemark); - }, - insereLinha : function(xi, yi, xf, yf, name, snippet) { - var lineStringPlacemark = i3GeoMap.createPlacemark(''), lineString, lineStyle; - lineStringPlacemark.setName(name); - lineString = i3GeoMap.createLineString(''); - lineString.setAltitudeMode(i3GeoMap.ALTITUDE_RELATIVE_TO_GROUND); - lineStringPlacemark.setGeometry(lineString); - lineString.getCoordinates().pushLatLngAlt( - yi, - xi, - 0); - lineString.getCoordinates().pushLatLngAlt( - yf, - xf, - 0); + var placemark = i3GeoMap.createPlacemark(''), point = i3GeoMap.createPoint(''); + placemark.setName(name); + point.setLatitude(ddy); + point.setLongitude(ddx); + placemark.setGeometry(point); + if (description !== "") { + placemark.setDescription(description); + } + placemark.setSnippet(snippet); + i3GeoMap.getFeatures().appendChild(placemark); + }, + // + // código obtido em + // http://code.google.com/intl/pt-BR/apis/earth/documentation/geometries.html + // + insereCirculo : function(centerLng, centerLat, radius, name, snippet) { + function makeCircle(centerLat, centerLng, radius) { + var ring = i3GeoMap.createLinearRing(''), steps = 25, i, pi2 = Math.PI * 2, lat, lng; + for (i = 0; i < steps; i++) { + lat = centerLat + radius * Math.cos(i / steps * pi2); + lng = centerLng + radius * Math.sin(i / steps * pi2); + ring.getCoordinates().pushLatLngAlt(lat, lng, 0); + } + return ring; + } + var polygonPlacemark = i3GeoMap.createPlacemark(''), poly = i3GeoMap.createPolygon(''), polyStyle; + poly.setAltitudeMode(i3GeoMap.ALTITUDE_RELATIVE_TO_GROUND); + polygonPlacemark.setGeometry(poly); + polygonPlacemark.getGeometry().setOuterBoundary(makeCircle(centerLat, centerLng, radius)); + polygonPlacemark.setName(name); + polygonPlacemark.setSnippet(snippet); + polygonPlacemark.setStyleSelector(i3GeoMap.createStyle('')); + polyStyle = polygonPlacemark.getStyleSelector().getPolyStyle(); + polyStyle.setFill(0); + i3GeoMap.getFeatures().appendChild(polygonPlacemark); + }, + insereLinha : function(xi, yi, xf, yf, name, snippet) { + var lineStringPlacemark = i3GeoMap.createPlacemark(''), lineString, lineStyle; + lineStringPlacemark.setName(name); + lineString = i3GeoMap.createLineString(''); + lineString.setAltitudeMode(i3GeoMap.ALTITUDE_RELATIVE_TO_GROUND); + lineStringPlacemark.setGeometry(lineString); + lineString.getCoordinates().pushLatLngAlt(yi, xi, 0); + lineString.getCoordinates().pushLatLngAlt(yf, xf, 0); - lineStringPlacemark.setStyleSelector(i3GeoMap.createStyle('')); - lineStringPlacemark.setSnippet(snippet); - lineStyle = lineStringPlacemark.getStyleSelector().getLineStyle(); - lineStyle.setWidth(3); + lineStringPlacemark.setStyleSelector(i3GeoMap.createStyle('')); + lineStringPlacemark.setSnippet(snippet); + lineStyle = lineStringPlacemark.getStyleSelector().getLineStyle(); + lineStyle.setWidth(3); - i3GeoMap.getFeatures().appendChild( - lineStringPlacemark); - }, - removePlacemark : function(nome) { - var features = i3GeoMap.getFeatures(), n = features.getChildNodes().getLength(), i, nfeatures = []; - for (i = 0; i < n; i++) { - try { - if (features.getChildNodes().item( - i).getName() === nome - || features.getChildNodes().item( - i).getDescription() === nome - || features.getChildNodes().item( - i).getSnippet() === nome) { - // features.getChildNodes().item(i).setVisibility(false); - nfeatures.push(features.getChildNodes().item( - i)); - // features.removeChild(features.getChildNodes().item(i)); + i3GeoMap.getFeatures().appendChild(lineStringPlacemark); + }, + removePlacemark : function(nome) { + var features = i3GeoMap.getFeatures(), n = features.getChildNodes().getLength(), i, nfeatures = []; + for (i = 0; i < n; i++) { + try { + if (features.getChildNodes().item(i).getName() === nome || features.getChildNodes().item(i).getDescription() === nome + || features.getChildNodes().item(i).getSnippet() === nome) { + // features.getChildNodes().item(i).setVisibility(false); + nfeatures.push(features.getChildNodes().item(i)); + // features.removeChild(features.getChildNodes().item(i)); + } + } catch (e) { } - } catch (e) { } - } - n = nfeatures.length; - for (i = 0; i < n; i++) { - features.removeChild(nfeatures[i]); + n = nfeatures.length; + for (i = 0; i < n; i++) { + features.removeChild(nfeatures[i]); + } } } - } -}; + }; // YAHOO.log("carregou classe desenho", "Classes i3geo"); diff --git a/js/eventos.js b/js/eventos.js index 85dd4f0..29f1725 100644 --- a/js/eventos.js +++ b/js/eventos.js @@ -290,7 +290,8 @@ i3GEO.eventos = } i3GEO.eventos.executaEventos(this.MOUSEUP); } - else if (i3GEO.Interface.ATUAL === "openlayers"){ + else if (i3GEO.Interface.ATUAL === "openlayers" && exy.target && exy.target.tagName === "CANVAS"){ + //para evitar bubble i3GEO.eventos.executaEventos(this.MOUSEUP); } diff --git a/js/ini_i3geo.js b/js/ini_i3geo.js index 7785f79..80a087d 100644 --- a/js/ini_i3geo.js +++ b/js/ini_i3geo.js @@ -780,10 +780,6 @@ var i3GEO = { } i3GEO.eventos.navegaMapa(); - i3GEO.ajuda.mostraJanela( - "Tempo de redesenho em segundos: " - + retorno.data.variaveis.tempo, - ""); // // verifica se deve ser feito o zoom em algum tema // diff --git a/js/interface.js b/js/interface.js index f3f7b36..ef862b4 100755 --- a/js/interface.js +++ b/js/interface.js @@ -723,21 +723,40 @@ i3GEO.Interface = googleLike : false, BALAOPROP : { removeAoAdicionar : true, - classeCadeado : "i3GEOiconeAberto" + classeCadeado : "i3GEOiconeAberto", + autoPan : true, + autoPanAnimation: { + duration: 250 + }, + width: '200px', + baloes: [] }, balao : function(texto, completo, x, y) { - var e, b, c, temp, p = i3GEO.Interface.openlayers.BALAOPROP; + var icone, painel, b, cabecalho, conteudo, p = i3GEO.Interface.openlayers.BALAOPROP, removeBaloes; - // cabecalho de opcoes - c = "
"; - texto = c + texto; - b = new OpenLayers.Popup.FramedCloud(null, i3GEO.util.projGeo2OSM(new OpenLayers.LonLat(x, y)), null, texto, null, true); - b.maxsize = new OpenLayers.Size(parseInt(i3GEO.parametros.w / 2, 10), parseInt(i3GEO.parametros.h / 2, 10)); + removeBaloes = function(){ + var t, n = i3GEO.Interface.openlayers.BALAOPROP.baloes.length, i; + for(i=0; i" + completo + "
", ""); + return false; }; - temp.appendChild(e); + cabecalho.appendChild(icone); + //icone x + icone = document.createElement("div"); + icone.className = "ol-popup-closer"; + icone.onclick = removeBaloes; + cabecalho.appendChild(icone); + + painel.appendChild(cabecalho); + + conteudo = document.createElement("div"); + conteudo.innerHTML = texto; + painel.appendChild(conteudo); + + b = new ol.Overlay({ + element: painel, + stopEvent: true, + autoPan: p.autoPan, + autoPanAnimation: p.autoPanAnimation + }); + p.baloes.push(b); + i3geoOL.addOverlay(b); + b.setPosition([x,y]); }, /** * Redesenha o mapa atual @@ -814,6 +858,12 @@ i3GEO.Interface = ol.layer.Layer.prototype.setVisibility = function(v) { this.setVisible(v); }; + ol.layer.Layer.prototype.getVisibility = function(v) { + this.getVisible(v); + }; + i3geoOL.panTo = function(x,y){ + this.getView().setCenter([x,y]); + }; i3geoOL.getLayersByName = function(nome) { var res = [], layers = this.getLayers(), n = layers.getLength(), i; for (i = 0; i < n; i++) { @@ -847,6 +897,15 @@ i3GEO.Interface = } return res; }; + i3geoOL.getControlsBy = function(chave, valor) { + var res = [], controles = this.getControls(), n = controles.getLength(), i; + for (i = 0; i < n; i++) { + if (controles.item(i).get(chave) && controles.item(i).get(chave) === valor) { + res.push(controles.item(i)); + } + } + return res; + }; i3geoOL.getCenter = function() { var c = this.getView().getCenter(); return { @@ -1010,7 +1069,7 @@ i3GEO.Interface = for (i = nlayers - 1; i >= 0; i--) { camada = i3GEO.arvoreDeCamadas.CAMADAS[i]; l = i3geoOL.getLayersByName(camada.name)[0]; - if (l && l.isBaseLayer === false) { + if (l && l.get("isBaseLayer") === false) { if (layer == "" || layer == camada.name) { l.setOpacity(opacidade); } @@ -1829,7 +1888,7 @@ i3GEO.Interface = y = metrica.lat; } } - i3geoOL.panTo(new OpenLayers.LonLat(x, y)); + i3geoOL.panTo(x,y); } }, /** diff --git a/js/mapa.js b/js/mapa.js index bf1f4c9..3823bd6 100644 --- a/js/mapa.js +++ b/js/mapa.js @@ -1405,113 +1405,113 @@ i3GEO.mapa = } retorna = function(retorno) { - var textoCompleto = "", textoSimples = "", textoTempCompleto = "", textoTempSimples = "", classeCor, temp, n, mostra, res, temas, ntemas, titulo, tips, j, ntips, r, ds, nds, s, configura = - i3GEO.configura, tipotip = configura.tipotip; - i3GEO.eventos.cliquePerm.status = true; - mostra = false; - retorno = retorno.data; - if (retorno !== "") { - res = ""; - temas = retorno; - if (!temas) { - return; + var textoCompleto = "", textoSimples = "", textoTempCompleto = "", textoTempSimples = "", classeCor, temp, n, mostra, res, temas, ntemas, titulo, tips, j, ntips, r, ds, nds, s, configura = + i3GEO.configura, tipotip = configura.tipotip; + i3GEO.eventos.cliquePerm.status = true; + mostra = false; + retorno = retorno.data; + if (retorno !== "") { + res = ""; + temas = retorno; + if (!temas) { + return; + } + ntemas = temas.length; + for (j = 0; j < ntemas; j += 1) { + titulo = temas[j].nome; + if (tipotip != "simples") { + titulo = "
" + titulo + "
"; + } else { + titulo = ""; } - ntemas = temas.length; - for (j = 0; j < ntemas; j += 1) { - titulo = temas[j].nome; - if (tipotip != "simples") { - titulo = "" + titulo + "
"; - } else { - titulo = ""; - } - tips = temas[j].resultado.todosItens; - ntips = tips.length; - ins = ""; - textoTempCompleto = ""; - textoTempSimples = ""; - ds = temas[j].resultado.dados; - if (ds !== " " && ds[0] && ds[0] != " ") { - try { - nds = ds.length; - classeCor = "toolTipBalaoTexto"; - for (s = 0; s < nds; s += 1) { - textoTempCompleto += "
"; - textoTempSimples += "
"; - for (r = 0; r < ntips; r += 1) { - try { - temp = ""; - var alias = ds[s][tips[r]].alias; - var valor = ds[s][tips[r]].valor; - var link = ds[s][tips[r]].link; - var img = ds[s][tips[r]].img; - if (valor !== "" && link === "") { - temp += "" + alias + " :" + valor + "
"; - } - if (valor !== "" && link !== "") { - temp += - "" + alias - + " : " - + valor - + "
"; - } - if (img !== "") { - temp += img + "
"; - } - if (tipotip === "balao" && ds[s][tips[r]].tip.toLowerCase() === "sim") { - textoTempSimples += temp; - } - textoTempCompleto += temp; - mostra = true; - } catch (e) { + tips = temas[j].resultado.todosItens; + ntips = tips.length; + ins = ""; + textoTempCompleto = ""; + textoTempSimples = ""; + ds = temas[j].resultado.dados; + if (ds !== " " && ds[0] && ds[0] != " ") { + try { + nds = ds.length; + classeCor = "toolTipBalaoTexto"; + for (s = 0; s < nds; s += 1) { + textoTempCompleto += "
"; + textoTempSimples += "
"; + for (r = 0; r < ntips; r += 1) { + try { + temp = ""; + var alias = ds[s][tips[r]].alias; + var valor = ds[s][tips[r]].valor; + var link = ds[s][tips[r]].link; + var img = ds[s][tips[r]].img; + if (valor !== "" && link === "") { + temp += "" + alias + " :" + valor + "
"; } + if (valor !== "" && link !== "") { + temp += + "" + alias + + " : " + + valor + + "
"; + } + if (img !== "") { + temp += img + "
"; + } + if (tipotip === "balao" && ds[s][tips[r]].tip.toLowerCase() === "sim") { + textoTempSimples += temp; + } + textoTempCompleto += temp; + mostra = true; + } catch (e) { } - if (classeCor === "toolTipBalaoTexto") { - classeCor = "toolTipBalaoTexto1"; - } else { - classeCor = "toolTipBalaoTexto"; - } - textoTempCompleto += "
"; - textoTempSimples += "
"; } - - } catch (e) { + if (classeCor === "toolTipBalaoTexto") { + classeCor = "toolTipBalaoTexto1"; + } else { + classeCor = "toolTipBalaoTexto"; + } + textoTempCompleto += "
"; + textoTempSimples += "
"; } - } - if (textoTempSimples !== "") { - textoCompleto += titulo + textoTempCompleto; - textoSimples += titulo + textoTempSimples; + + } catch (e) { } } - if (mostra === true) { - if (tipotip != "simples") { - res = textoSimples; - } else { - res = textoCompleto; - } - if (tipotip === "balao") { - i3GEO.Interface[i3GEO.Interface.ATUAL].balao(textoSimples, textoCompleto, x, y); + if (textoTempSimples !== "") { + textoCompleto += titulo + textoTempCompleto; + textoSimples += titulo + textoTempSimples; + } + } + if (mostra === true) { + if (tipotip != "simples") { + res = textoSimples; + } else { + res = textoCompleto; + } + if (tipotip === "balao") { + i3GEO.Interface[i3GEO.Interface.ATUAL].balao(textoSimples, textoCompleto, x, y); + } else { + // tipotip pode ser um elemento DOM + n = $i(tipotip); + if (!n) { + n = i3GEO.janela.tip(); + n = $i(n); + n.style.textAlign = "left"; + n.innerHTML += res; } else { - // tipotip pode ser um elemento DOM - n = $i(tipotip); - if (!n) { - n = i3GEO.janela.tip(); - n = $i(n); - n.style.textAlign = "left"; - n.innerHTML += res; - } else { - n.innerHTML = res; - } + n.innerHTML = res; } } } - if ($i(i3GEO.Interface.IDMAPA)) { - $i(i3GEO.Interface.IDMAPA).title = ""; - temp = "identifica"; - i3GEO.util.mudaCursor(configura.cursores, temp, i3GEO.Interface.IDMAPA, configura.locaplic); - } - }; + } + if ($i(i3GEO.Interface.IDMAPA)) { + $i(i3GEO.Interface.IDMAPA).title = ""; + temp = "identifica"; + i3GEO.util.mudaCursor(configura.cursores, temp, i3GEO.Interface.IDMAPA, configura.locaplic); + } + }; // alert("identifica "+objposicaocursor.ddx+" "+objposicaocursor.ddy) i3GEO.php.identifica3( retorna, diff --git a/js/navega.js b/js/navega.js index d310f1a..fd131d1 100644 --- a/js/navega.js +++ b/js/navega.js @@ -328,6 +328,8 @@ i3GEO.navega = if (sid !== "") { i3GEO.configura.sid = sid; } + i3GEO.php.zoomponto(i3GEO.atualiza,x,y,tamanho,simbolo,cor); + /* var f = "i3GEO.navega.timerNavega = null;" + "i3GEO.php.zoomponto(i3GEO.atualiza," + x + "," + y + "," + tamanho + ",'" + simbolo + "','" + cor + "');"; @@ -335,6 +337,7 @@ i3GEO.navega = clearTimeout(i3GEO.navega.timerNavega); } i3GEO.navega.timerNavega = setTimeout(f, i3GEO.navega.TEMPONAVEGAR); + */ }, /** * Function: zoompontoIMG diff --git a/json.php b/json.php index 6692680..a4d4fab 100755 --- a/json.php +++ b/json.php @@ -91,7 +91,7 @@ copy($base,$nomeMapfileTmp); $oMap = ms_newMapobj($nomeMapfileTmp); $nmap = ms_newMapobj($locaplic."/temas/".$tema.".map"); $l = $nmap->getlayerbyname($tema); - +$l->set("template","none.htm"); if (!empty($postgis_mapa)){ if ($l->connectiontype == MS_POSTGIS){ $lcon = $l->connection; @@ -333,14 +333,17 @@ function carregaCacheArquivo(){ function pegaDadosJ(){ global $oMap, $tema, $versao; + set_time_limit(0); $layer = $oMap->getlayerbyname($tema); + $layer->set("status",MS_DEFAULT); + $layer->set("template","none.htm"); $items = pegaItens($layer,$oMap); $layer->querybyrect($oMap->extent); $layer->open(); - $res_count = $layer->getNumresults(); + $res_count = $layer->getNumresults(); $linhas = array(); - for ($i = 0; $i < $res_count; $i++){ + //echo $i." -
"; if($versao == 6){ $shape = $layer->getShape($layer->getResult($i)); } diff --git a/temas/teste.map b/temas/teste.map index 3726ae7..7b02f23 100644 --- a/temas/teste.map +++ b/temas/teste.map @@ -1,65 +1,53 @@ MAP FONTSET "../symbols/fontes.txt" - SYMBOLSET "../symbols/simbolosv6.sym" + SYMBOLSET "../symbols/simbolos.sym" LAYER CONNECTION "" - DATA "/var/www/temp/localizador_052015.shp" + CONNECTIONTYPE POSTGIS + DATA "geom from ( + SELECT + co_seq_id AS gid, + ST_MakePoint(tb_cep.long::numeric,tb_cep.lat::numeric) AS geom, + tb_cep.lat, + tb_cep.long, + ano_farm_pop_aqt AS ano, + mes_farm_pop_aqt AS mes, + nu_ddd_farmacia AS ddd, + nu_telefone_farmacia, + nu_cep_farmacia, + no_bairro_farmacia, + ds_endereco_farmacia, + no_farmacia, + dbgeral.tb_ibge.cidade_sem_acento, + dbgeral.tb_ibge.uf + FROM + dbacoes_saude.tb_farmacia_pop_aqt + INNER JOIN dbgeral.tb_cep ON dbacoes_saude.tb_farmacia_pop_aqt.nu_cep_farmacia = dbgeral.tb_cep.cep + INNER JOIN dbgeral.tb_ibge ON dbacoes_saude.tb_farmacia_pop_aqt.co_ibge = dbgeral.tb_ibge.ibge + WHERE + 'm'||tb_farmacia_pop_aqt.mes_farm_pop_aqt||'a'||tb_farmacia_pop_aqt.ano_farm_pop_aqt = (SELECT 'm'||tb_farmacia_pop_aqt.mes_farm_pop_aqt||'a'||tb_farmacia_pop_aqt.ano_farm_pop_aqt + FROM dbacoes_saude.tb_farmacia_pop_aqt + ORDER BY tb_farmacia_pop_aqt.ano_farm_pop_aqt DESC, tb_farmacia_pop_aqt.mes_farm_pop_aqt DESC LIMIT 1) + AND + farmacia_apta not LIKE '%N%' AND + nu_cep_farmacia not LIKE '%-%' + ) as foo using unique gid using srid=4674" METADATA - "METAESTAT_ID_MEDIDA_VARIAVEL""" - "ltempoitemimagem""" - "tip""RELATORIO" - "ltempoitemdescricao""" - "CLASSE""SIM" - "ltempoiteminicio""" - "palletestep""" - "ltempoitemtip""" - "temporizador""" - "ltempoitemtitulo""" - "description_template""" - "itensdesc""OBS,PROCESSO,RIP,ORGAO,RELATORIO" - "iconetema""" - "ltempoitemlink""" - "itenslink""[OBS]" - "tiles""" - "METAESTAT_CODIGO_TIPO_REGIAO""" - "palletefile""" - "ltempoformatodata""" - "ltempoitemicone""" - "permitecomentario""SIM" - "PLUGINI3GEO""" - "metaestat""" - "escondido""NAO" - "itembuscarapida""OBS" - "itens""OBS,PROCESSO,RIP,ORGAO,RELATORIO" - "transitioneffect""SIM" - "TEMA""localizador" - "convcaracter""" - "cortepixels""0" - "ltempoconvencode""" - "editorsql""" - "identifica""SIM" - "aplicaextensao""SIM" - "ltempoitemfim""" - END # METADATA + "CLASSE" "SIM" + "TEMA" "loc" + "IDENTIFICA" "SIM" + END NAME "teste" - PROJECTION - "init=epsg:29194" - END # PROJECTION STATUS DEFAULT - TEMPLATE "none.htm" - TILEITEM "location" TYPE POINT UNITS METERS CLASS - NAME "" + NAME " " STYLE - ANGLE 0 - COLOR 166 16 16 - OFFSET 0 0 - SIZE 20 + COLOR 255 0 0 SYMBOL "ponto" - END # STYLE - END # CLASS - END # LAYER - -END # MAP \ No newline at end of file + SIZE 10 + END + END + END +END -- libgit2 0.21.2