Commit 6cc3a621d24bba70cd60a96af5bf2170dd84e05a
1 parent
0310a661
Exists in
master
and in
6 other branches
Posicionamento dos botões de edição vetorial na árvore de camadas. Refatoração d…
…o código do editor vetorial. Remoção da opção Editor Vetorial da caixa de ferramentas
Showing
47 changed files
with
2403 additions
and
3046 deletions
Show diff stats
30.2 KB
ferramentas/area/index.js
| 1 | 1 | if (typeof (i3GEOF) === 'undefined') { |
| 2 | - var i3GEOF = {}; | |
| 2 | + var i3GEOF = {}; | |
| 3 | 3 | } |
| 4 | 4 | i3GEOF.area = |
| 5 | - { | |
| 6 | - position: [150,0], | |
| 7 | - /** | |
| 8 | - * Armazena os pontos clicados para realizar os calculos | |
| 9 | - */ | |
| 10 | - pontos : {}, | |
| 11 | - /** | |
| 12 | - * Armazena o WKT da ultima linha | |
| 13 | - */ | |
| 14 | - ultimoWkt : "", | |
| 15 | - /** | |
| 16 | - * Armazena a ultima medida | |
| 17 | - */ | |
| 18 | - ultimaMedida : "", | |
| 19 | - MUSTACHE : "", | |
| 20 | - /** | |
| 21 | - * Susbtitutos para o template | |
| 22 | - */ | |
| 23 | - mustacheHash : function() { | |
| 24 | - var dicionario = i3GEO.idioma.objetoIdioma(i3GEOF.area.dicionario); | |
| 25 | - dicionario["sid"] = i3GEO.configura.sid; | |
| 26 | - dicionario["locaplic"] = i3GEO.configura.locaplic; | |
| 27 | - return dicionario; | |
| 28 | - }, | |
| 29 | - inicia : function(iddiv) { | |
| 30 | - if(i3GEOF.area.MUSTACHE == ""){ | |
| 31 | - $.get(i3GEO.configura.locaplic + "/ferramentas/area/template_mst.html", function(template) { | |
| 32 | - i3GEOF.area.MUSTACHE = template; | |
| 33 | - i3GEOF.area.inicia(iddiv); | |
| 34 | - }); | |
| 35 | - return; | |
| 36 | - } | |
| 37 | - i3GEO.eventos.cliquePerm.desativa(); | |
| 38 | - $i(iddiv).innerHTML = i3GEOF.area.html(); | |
| 39 | - i3GEOF.area[i3GEO.Interface["ATUAL"]].inicia(); | |
| 40 | - }, | |
| 41 | - isOn : function() { | |
| 42 | - if($i("i3GEOF.area")){ | |
| 43 | - return true; | |
| 44 | - } else { | |
| 45 | - return false; | |
| 46 | - } | |
| 47 | - }, | |
| 48 | - /* | |
| 49 | - * Function: html | |
| 50 | - * | |
| 51 | - * Gera o código html para apresentação das opções da ferramenta | |
| 52 | - * | |
| 53 | - * Retorno: | |
| 54 | - * | |
| 55 | - * String com o código html | |
| 56 | - */ | |
| 57 | - html : function() { | |
| 58 | - var ins = Mustache.render(i3GEOF.area.MUSTACHE, i3GEOF.area.mustacheHash()); | |
| 59 | - return ins; | |
| 60 | - }, | |
| 61 | - /* | |
| 62 | - * Function: iniciaJanelaFlutuante | |
| 63 | - * | |
| 64 | - * Cria a janela flutuante para controle da ferramenta. | |
| 65 | - */ | |
| 66 | - iniciaJanelaFlutuante : function() { | |
| 67 | - var minimiza, cabecalho, janela, divid, temp, titulo,imagemxy; | |
| 68 | - if ($i("i3GEOF.area")) { | |
| 69 | - return; | |
| 5 | +{ | |
| 6 | + position: [150,0], | |
| 7 | + /** | |
| 8 | + * Armazena os pontos clicados para realizar os calculos | |
| 9 | + */ | |
| 10 | + pontos : {}, | |
| 11 | + /** | |
| 12 | + * Armazena o WKT da ultima linha | |
| 13 | + */ | |
| 14 | + ultimoWkt : "", | |
| 15 | + /** | |
| 16 | + * Armazena a ultima medida | |
| 17 | + */ | |
| 18 | + ultimaMedida : "", | |
| 19 | + MUSTACHE : "", | |
| 20 | + /** | |
| 21 | + * Susbtitutos para o template | |
| 22 | + */ | |
| 23 | + mustacheHash : function() { | |
| 24 | + var dicionario = i3GEO.idioma.objetoIdioma(i3GEOF.area.dicionario); | |
| 25 | + dicionario["sid"] = i3GEO.configura.sid; | |
| 26 | + dicionario["locaplic"] = i3GEO.configura.locaplic; | |
| 27 | + return dicionario; | |
| 28 | + }, | |
| 29 | + inicia : function(iddiv) { | |
| 30 | + if(i3GEOF.area.MUSTACHE == ""){ | |
| 31 | + $.get(i3GEO.configura.locaplic + "/ferramentas/area/template_mst.html", function(template) { | |
| 32 | + i3GEOF.area.MUSTACHE = template; | |
| 33 | + i3GEOF.area.inicia(iddiv); | |
| 34 | + }); | |
| 35 | + return; | |
| 36 | + } | |
| 37 | + i3GEO.eventos.cliquePerm.desativa(); | |
| 38 | + $i(iddiv).innerHTML = i3GEOF.area.html(); | |
| 39 | + i3GEOF.area[i3GEO.Interface["ATUAL"]].inicia(); | |
| 40 | + }, | |
| 41 | + isOn : function() { | |
| 42 | + if($i("i3GEOF.area")){ | |
| 43 | + return true; | |
| 44 | + } else { | |
| 45 | + return false; | |
| 46 | + } | |
| 47 | + }, | |
| 48 | + /* | |
| 49 | + * Function: html | |
| 50 | + * | |
| 51 | + * Gera o código html para apresentação das opções da ferramenta | |
| 52 | + * | |
| 53 | + * Retorno: | |
| 54 | + * | |
| 55 | + * String com o código html | |
| 56 | + */ | |
| 57 | + html : function() { | |
| 58 | + var ins = Mustache.render(i3GEOF.area.MUSTACHE, i3GEOF.area.mustacheHash()); | |
| 59 | + return ins; | |
| 60 | + }, | |
| 61 | + /* | |
| 62 | + * Function: iniciaJanelaFlutuante | |
| 63 | + * | |
| 64 | + * Cria a janela flutuante para controle da ferramenta. | |
| 65 | + */ | |
| 66 | + iniciaJanelaFlutuante : function() { | |
| 67 | + var minimiza, cabecalho, janela, divid, temp, titulo,imagemxy; | |
| 68 | + if ($i("i3GEOF.area")) { | |
| 69 | + return; | |
| 70 | + } | |
| 71 | + cabecalho = ""; | |
| 72 | + minimiza = ""; | |
| 73 | + // cria a janela flutuante | |
| 74 | + titulo = "<span class='i3GeoTituloJanelaBsNolink' >" + $trad("areaAprox") + "</span></div>"; | |
| 75 | + janela = | |
| 76 | + i3GEO.janela.cria( | |
| 77 | + "250px", | |
| 78 | + "auto", | |
| 79 | + "", | |
| 80 | + "", | |
| 81 | + "", | |
| 82 | + titulo, | |
| 83 | + "i3GEOF.area", | |
| 84 | + false, | |
| 85 | + "hd", | |
| 86 | + cabecalho, | |
| 87 | + minimiza, | |
| 88 | + "", | |
| 89 | + true, | |
| 90 | + "", | |
| 91 | + "", | |
| 92 | + "nao", | |
| 93 | + "", | |
| 94 | + "51" | |
| 95 | + ); | |
| 96 | + divid = janela[2].id; | |
| 97 | + i3GEOF.area.inicia(divid); | |
| 98 | + temp = | |
| 99 | + function() { | |
| 100 | + i3GEOF.area.pontos = {}; | |
| 101 | + var janela; | |
| 102 | + i3GEO.eventos.cliquePerm.ativa(); | |
| 103 | + janela = YAHOO.i3GEO.janela.manager.find("area"); | |
| 104 | + if (janela) { | |
| 105 | + YAHOO.i3GEO.janela.manager.remove(janela); | |
| 106 | + janela.destroy(); | |
| 107 | + } | |
| 108 | + i3GEOF.area[i3GEO.Interface["ATUAL"]].fechaJanela(); | |
| 109 | + i3GEO.analise.pontos = {}; | |
| 110 | + }; | |
| 111 | + YAHOO.util.Event.addListener(janela[0].close, "click", temp); | |
| 112 | + imagemxy = i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO)); | |
| 113 | + janela[0].moveTo(i3GEOF.area.position[0],i3GEOF.area.position[1]); | |
| 114 | + }, | |
| 115 | + /* | |
| 116 | + * Function: ativaFoco | |
| 117 | + * | |
| 118 | + * Refaz a interface da ferramenta quando a janela flutuante tem seu foco ativado | |
| 119 | + */ | |
| 120 | + ativaFoco : function() { | |
| 121 | + }, | |
| 122 | + /** | |
| 123 | + * Converte a lista de pontos em WKT | |
| 124 | + */ | |
| 125 | + pontos2wkt : function() { | |
| 126 | + var pontos = [], x = i3GEOF.area.pontos.xpt, y = i3GEOF.area.pontos.ypt, n = x.length, i; | |
| 127 | + for (i = 0; i < n; i++) { | |
| 128 | + pontos.push(x[i] + " " + y[i]); | |
| 129 | + } | |
| 130 | + pontos.push(x[0] + " " + y[0]); | |
| 131 | + return "POLYGON((" + pontos.join(",") + "))"; | |
| 132 | + }, | |
| 133 | + removeFiguras : function(){ | |
| 134 | + i3GEOF.area[i3GEO.Interface["ATUAL"]].removeFiguras(); | |
| 135 | + }, | |
| 136 | + /** | |
| 137 | + * Funcoes especificas da interface openlayers | |
| 138 | + */ | |
| 139 | + openlayers : { | |
| 140 | + draw : "", | |
| 141 | + estilo: "", | |
| 142 | + featureListener : null, | |
| 143 | + //numero de pontos da geometria atual | |
| 144 | + //utilizado para saber se houve um clique ou nao | |
| 145 | + numpontos : 0, | |
| 146 | + removeControle : function() { | |
| 147 | + i3geoOL.removeInteraction(i3GEOF.area.openlayers.draw); | |
| 148 | + i3GEOF.area.openlayers.draw = ""; | |
| 149 | + }, | |
| 150 | + /** | |
| 151 | + * Inicializa o processo Cria a variavel para guardar os pontos Executa a funcao de inicializacao do desenho, que cria o | |
| 152 | + * layer para receber os graficos | |
| 153 | + */ | |
| 154 | + inicia : function() { | |
| 155 | + var m = i3GEOF.area.openlayers; | |
| 156 | + | |
| 157 | + i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia(); | |
| 158 | + m.removeControle(); | |
| 159 | + m.draw = new ol.interaction.Draw({ | |
| 160 | + type : "Polygon" | |
| 161 | + }); | |
| 162 | + i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 163 | + m.draw.on("drawend", function(evt) { | |
| 164 | + evt.feature.setProperties({ | |
| 165 | + origem : "i3GeoMedeArea" | |
| 166 | + }); | |
| 167 | + evt.feature.setStyle(new ol.style.Style({ | |
| 168 | + stroke: new ol.style.Stroke({ | |
| 169 | + color: '#ffcc33', | |
| 170 | + width: 2 | |
| 171 | + }), | |
| 172 | + fill: new ol.style.Fill({ | |
| 173 | + color: 'rgba(255, 153, 0, 0.4)' | |
| 174 | + }) | |
| 175 | + } )); | |
| 176 | + evt.feature.setId(i3GEO.util.uid()); | |
| 177 | + var m = i3GEOF.area.openlayers; | |
| 178 | + i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature); | |
| 179 | + }); | |
| 180 | + m.draw.on('drawstart', function(evt) { | |
| 181 | + i3GEOF.area.pontos = { | |
| 182 | + xpt : [], | |
| 183 | + ypt : [], | |
| 184 | + dist : [] | |
| 185 | + }; | |
| 186 | + i3GEO.analise.pontos = { | |
| 187 | + xpt : [], | |
| 188 | + ypt : [] | |
| 189 | + }; | |
| 190 | + var m = i3GEOF.area.openlayers, | |
| 191 | + sketch = evt.feature; | |
| 192 | + m.estilo = sketch.getStyle(); | |
| 193 | + m.numpontos = 2; | |
| 194 | + m.featureListener = sketch.getGeometry().on('change', function(evt) { | |
| 195 | + var ponto, | |
| 196 | + geom = evt.target, | |
| 197 | + coords = geom.getLinearRing(0).getCoordinates(), | |
| 198 | + n = coords.length, | |
| 199 | + m = i3GEOF.area.openlayers; | |
| 200 | + ponto = new ol.geom.Point(coords[n-2]); | |
| 201 | + //console.info(coords) | |
| 202 | + if(m.numpontos === n-1){ | |
| 203 | + //clicou | |
| 204 | + m.numpontos = n; | |
| 205 | + m.point(ponto,geom); | |
| 70 | 206 | } |
| 71 | - cabecalho = ""; | |
| 72 | - minimiza = ""; | |
| 73 | - // cria a janela flutuante | |
| 74 | - titulo = "<span class='i3GeoTituloJanelaBsNolink' >" + $trad("areaAprox") + "</span></div>"; | |
| 75 | - janela = | |
| 76 | - i3GEO.janela.cria( | |
| 77 | - "250px", | |
| 78 | - "auto", | |
| 79 | - "", | |
| 80 | - "", | |
| 81 | - "", | |
| 82 | - titulo, | |
| 83 | - "i3GEOF.area", | |
| 84 | - false, | |
| 85 | - "hd", | |
| 86 | - cabecalho, | |
| 87 | - minimiza, | |
| 88 | - "", | |
| 89 | - true, | |
| 90 | - "", | |
| 91 | - "", | |
| 92 | - "nao", | |
| 93 | - "", | |
| 94 | - "51" | |
| 95 | - ); | |
| 96 | - divid = janela[2].id; | |
| 97 | - i3GEOF.area.inicia(divid); | |
| 98 | - temp = | |
| 99 | - function() { | |
| 100 | - i3GEOF.area.pontos = {}; | |
| 101 | - var janela; | |
| 102 | - i3GEO.eventos.cliquePerm.ativa(); | |
| 103 | - janela = YAHOO.i3GEO.janela.manager.find("area"); | |
| 104 | - if (janela) { | |
| 105 | - YAHOO.i3GEO.janela.manager.remove(janela); | |
| 106 | - janela.destroy(); | |
| 107 | - } | |
| 108 | - i3GEOF.area[i3GEO.Interface["ATUAL"]].fechaJanela(); | |
| 109 | - i3GEO.analise.pontos = {}; | |
| 110 | - }; | |
| 111 | - YAHOO.util.Event.addListener(janela[0].close, "click", temp); | |
| 112 | - imagemxy = i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO)); | |
| 113 | - janela[0].moveTo(i3GEOF.area.position[0],i3GEOF.area.position[1]); | |
| 114 | - }, | |
| 115 | - /* | |
| 116 | - * Function: ativaFoco | |
| 117 | - * | |
| 118 | - * Refaz a interface da ferramenta quando a janela flutuante tem seu foco ativado | |
| 119 | - */ | |
| 120 | - ativaFoco : function() { | |
| 121 | - }, | |
| 122 | - /** | |
| 123 | - * Converte a lista de pontos em WKT | |
| 124 | - */ | |
| 125 | - pontos2wkt : function() { | |
| 126 | - var pontos = [], x = i3GEOF.area.pontos.xpt, y = i3GEOF.area.pontos.ypt, n = x.length, i; | |
| 127 | - for (i = 0; i < n; i++) { | |
| 128 | - pontos.push(x[i] + " " + y[i]); | |
| 207 | + else{ | |
| 208 | + m.modify(ponto,geom); | |
| 129 | 209 | } |
| 130 | - pontos.push(x[0] + " " + y[0]); | |
| 131 | - return "POLYGON((" + pontos.join(",") + "))"; | |
| 132 | - }, | |
| 133 | - removeFiguras : function(){ | |
| 134 | - i3GEOF.area[i3GEO.Interface["ATUAL"]].removeFiguras(); | |
| 135 | - }, | |
| 136 | - /** | |
| 137 | - * Funcoes especificas da interface openlayers | |
| 138 | - */ | |
| 139 | - openlayers : { | |
| 140 | - draw : "", | |
| 141 | - estilo: "", | |
| 142 | - featureListener : null, | |
| 143 | - //numero de pontos da geometria atual | |
| 144 | - //utilizado para saber se houve um clique ou nao | |
| 145 | - numpontos : 0, | |
| 146 | - removeControle : function() { | |
| 147 | - i3geoOL.removeInteraction(i3GEOF.area.openlayers.draw); | |
| 148 | - i3GEOF.area.openlayers.draw = ""; | |
| 149 | - }, | |
| 150 | - /** | |
| 151 | - * Inicializa o processo Cria a variavel para guardar os pontos Executa a funcao de inicializacao do desenho, que cria o | |
| 152 | - * layer para receber os graficos | |
| 153 | - */ | |
| 154 | - inicia : function() { | |
| 155 | - var m = i3GEOF.area.openlayers; | |
| 156 | - m.estilo = new ol.style.Style({ | |
| 157 | - stroke: new ol.style.Stroke({ | |
| 158 | - color: '#ffcc33', | |
| 159 | - width: 5 | |
| 160 | - }), | |
| 161 | - fill: new ol.style.Fill({ | |
| 162 | - color: 'rgba(255, 153, 0, 0.8)' | |
| 163 | - }) | |
| 164 | - }); | |
| 165 | - i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia(); | |
| 166 | - m.removeControle(); | |
| 167 | - m.draw = new ol.interaction.Draw({ | |
| 168 | - type : "Polygon" | |
| 169 | - }); | |
| 170 | - i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 171 | - m.draw.on("drawend", function(evt) { | |
| 172 | - evt.feature.setProperties({ | |
| 173 | - origem : "i3GeoMedeArea" | |
| 174 | - }); | |
| 175 | - var m = i3GEOF.area.openlayers; | |
| 176 | - i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature); | |
| 177 | - m.draw.setActive(false); | |
| 178 | - m.draw.setActive(true); | |
| 179 | - }); | |
| 180 | - m.draw.on('drawstart', function(evt) { | |
| 181 | - i3GEOF.area.pontos = { | |
| 182 | - xpt : [], | |
| 183 | - ypt : [], | |
| 184 | - dist : [] | |
| 185 | - }; | |
| 186 | - i3GEO.analise.pontos = { | |
| 187 | - xpt : [], | |
| 188 | - ypt : [] | |
| 189 | - }; | |
| 190 | - var m = i3GEOF.area.openlayers, | |
| 191 | - sketch = evt.feature; | |
| 192 | - m.estilo = sketch.getStyle(); | |
| 193 | - m.numpontos = 2; | |
| 194 | - m.featureListener = sketch.getGeometry().on('change', function(evt) { | |
| 195 | - var ponto, | |
| 196 | - geom = evt.target, | |
| 197 | - coords = geom.getLinearRing(0).getCoordinates(), | |
| 198 | - n = coords.length, | |
| 199 | - m = i3GEOF.area.openlayers; | |
| 200 | - ponto = new ol.geom.Point(coords[n-2]); | |
| 201 | - //console.info(coords) | |
| 202 | - if(m.numpontos === n-1){ | |
| 203 | - //clicou | |
| 204 | - m.numpontos = n; | |
| 205 | - m.point(ponto,geom); | |
| 206 | - } | |
| 207 | - else{ | |
| 208 | - m.modify(ponto,geom); | |
| 209 | - } | |
| 210 | - }); | |
| 211 | - }); | |
| 212 | - i3geoOL.addInteraction(m.draw); | |
| 213 | - }, | |
| 214 | - modify : function(point,geom) { | |
| 215 | - var temp,sourceProj,coordinates,wgs84Sphere, per, area, n, x1, y1, x2, y2, trecho, direcao, | |
| 216 | - coord = point.getCoordinates(); | |
| 210 | + }); | |
| 211 | + }); | |
| 212 | + i3geoOL.addInteraction(m.draw); | |
| 213 | + }, | |
| 214 | + modify : function(point,geom) { | |
| 215 | + var temp,sourceProj,coordinates,wgs84Sphere, per, area, n, x1, y1, x2, y2, trecho, direcao, | |
| 216 | + coord = point.getCoordinates(); | |
| 217 | 217 | |
| 218 | - n = i3GEOF.area.pontos.ypt.length; | |
| 219 | - if (n > 1) { | |
| 220 | - x1 = i3GEOF.area.pontos.xpt[n - 1]; | |
| 221 | - y1 = i3GEOF.area.pontos.ypt[n - 1]; | |
| 222 | - x2 = coord[0]; | |
| 223 | - y2 = coord[1]; | |
| 224 | - // projeta | |
| 225 | - if (i3GEO.Interface.openlayers.googleLike) { | |
| 226 | - temp = i3GEO.util.extOSM2Geo(x1 + " " + y1 + " " + x2 + " " + y2); | |
| 227 | - temp = temp.split(" "); | |
| 228 | - x1 = temp[0]; | |
| 229 | - y1 = temp[1]; | |
| 230 | - x2 = temp[2]; | |
| 231 | - y2 = temp[3]; | |
| 232 | - } | |
| 233 | - trecho = i3GEO.calculo.distancia(x1, y1, x2, y2); | |
| 234 | - //parcial = i3GEOF.area.openlayers.somaDist(); | |
| 235 | - direcao = i3GEO.calculo.direcao(x1, y1, x2, y2); | |
| 236 | - direcao = i3GEO.calculo.dd2dms(direcao, direcao); | |
| 237 | - direcao = direcao[0]; | |
| 238 | - per = i3GEOF.area.openlayers.somaDist(); | |
| 239 | - // soma ate o primeiro ponto | |
| 240 | - x1 = i3GEOF.area.pontos.xpt[0]; | |
| 241 | - y1 = i3GEOF.area.pontos.ypt[0]; | |
| 242 | - // projeta | |
| 243 | - if (i3GEO.Interface.openlayers.googleLike) { | |
| 244 | - temp = i3GEO.util.extOSM2Geo(x1 + " " + y1); | |
| 245 | - temp = temp.split(" "); | |
| 246 | - x1 = temp[0]; | |
| 247 | - y1 = temp[1]; | |
| 248 | - } | |
| 218 | + n = i3GEOF.area.pontos.ypt.length; | |
| 219 | + if (n > 1) { | |
| 220 | + x1 = i3GEOF.area.pontos.xpt[n - 1]; | |
| 221 | + y1 = i3GEOF.area.pontos.ypt[n - 1]; | |
| 222 | + x2 = coord[0]; | |
| 223 | + y2 = coord[1]; | |
| 224 | + // projeta | |
| 225 | + if (i3GEO.Interface.openlayers.googleLike) { | |
| 226 | + temp = i3GEO.util.extOSM2Geo(x1 + " " + y1 + " " + x2 + " " + y2); | |
| 227 | + temp = temp.split(" "); | |
| 228 | + x1 = temp[0]; | |
| 229 | + y1 = temp[1]; | |
| 230 | + x2 = temp[2]; | |
| 231 | + y2 = temp[3]; | |
| 232 | + } | |
| 233 | + trecho = i3GEO.calculo.distancia(x1, y1, x2, y2); | |
| 234 | + //parcial = i3GEOF.area.openlayers.somaDist(); | |
| 235 | + direcao = i3GEO.calculo.direcao(x1, y1, x2, y2); | |
| 236 | + direcao = i3GEO.calculo.dd2dms(direcao, direcao); | |
| 237 | + direcao = direcao[0]; | |
| 238 | + per = i3GEOF.area.openlayers.somaDist(); | |
| 239 | + // soma ate o primeiro ponto | |
| 240 | + x1 = i3GEOF.area.pontos.xpt[0]; | |
| 241 | + y1 = i3GEOF.area.pontos.ypt[0]; | |
| 242 | + // projeta | |
| 243 | + if (i3GEO.Interface.openlayers.googleLike) { | |
| 244 | + temp = i3GEO.util.extOSM2Geo(x1 + " " + y1); | |
| 245 | + temp = temp.split(" "); | |
| 246 | + x1 = temp[0]; | |
| 247 | + y1 = temp[1]; | |
| 248 | + } | |
| 249 | 249 | |
| 250 | - per += i3GEO.calculo.distancia(x1, y1, x2, y2); | |
| 250 | + per += i3GEO.calculo.distancia(x1, y1, x2, y2); | |
| 251 | 251 | |
| 252 | - //getGeodesicArea | |
| 253 | - sourceProj = i3geoOL.getView().getProjection(); | |
| 254 | - geom = (geom.clone().transform(sourceProj, 'EPSG:4326')); | |
| 255 | - coordinates = geom.getLinearRing(0).getCoordinates(); | |
| 256 | - wgs84Sphere = new ol.Sphere(6378137); | |
| 257 | - area = Math.abs(wgs84Sphere.geodesicArea(coordinates)); | |
| 258 | - i3GEOF.area.openlayers.mostraParcial(trecho, per, area, direcao); | |
| 259 | - } | |
| 252 | + //getGeodesicArea | |
| 253 | + sourceProj = i3geoOL.getView().getProjection(); | |
| 254 | + geom = (geom.clone().transform(sourceProj, 'EPSG:4326')); | |
| 255 | + coordinates = geom.getLinearRing(0).getCoordinates(); | |
| 256 | + wgs84Sphere = new ol.Sphere(6378137); | |
| 257 | + area = Math.abs(wgs84Sphere.geodesicArea(coordinates)); | |
| 258 | + i3GEOF.area.openlayers.mostraParcial(trecho, per, area, direcao); | |
| 259 | + } | |
| 260 | 260 | |
| 261 | - }, | |
| 262 | - point : function(point,geom) { | |
| 263 | - i3GEO.eventos.cliquePerm.desativa(); | |
| 264 | - var wgs84Sphere,area,coordinates,sourceProj,n, x1, y1, x2, y2, trecho, temp, | |
| 265 | - coord = point.getCoordinates(), | |
| 266 | - total = 0; | |
| 267 | - i3GEOF.area.pontos.xpt.push(coord[0]); | |
| 268 | - i3GEOF.area.pontos.ypt.push(coord[1]); | |
| 269 | - i3GEO.analise.pontos.xpt.push(coord[0]); | |
| 270 | - i3GEO.analise.pontos.ypt.push(coord[1]); | |
| 271 | - n = i3GEOF.area.pontos.ypt.length; | |
| 272 | - if (n > 1) { | |
| 273 | - x1 = i3GEOF.area.pontos.xpt[n - 2]; | |
| 274 | - y1 = i3GEOF.area.pontos.ypt[n - 2]; | |
| 275 | - x2 = coord[0]; | |
| 276 | - y2 = coord[1]; | |
| 277 | - raio = new ol.geom.LineString([[x1, y1],[x2, y2]]).getLength(); | |
| 278 | - // projeta | |
| 279 | - if (i3GEO.Interface.openlayers.googleLike) { | |
| 280 | - temp = i3GEO.util.extOSM2Geo(x1 + " " + y1 + " " + x2 + " " + y2); | |
| 281 | - temp = temp.split(" "); | |
| 282 | - x1 = temp[0]; | |
| 283 | - y1 = temp[1]; | |
| 284 | - x2 = temp[2]; | |
| 285 | - y2 = temp[3]; | |
| 286 | - } | |
| 287 | - trecho = i3GEO.calculo.distancia(x1, y1, x2, y2); | |
| 288 | - i3GEOF.area.pontos.dist.push(trecho); | |
| 289 | - total = i3GEOF.area.openlayers.somaDist(); | |
| 261 | + }, | |
| 262 | + point : function(point,geom) { | |
| 263 | + i3GEO.eventos.cliquePerm.desativa(); | |
| 264 | + var wgs84Sphere,area,coordinates,sourceProj,n, x1, y1, x2, y2, trecho, temp, | |
| 265 | + coord = point.getCoordinates(), | |
| 266 | + total = 0; | |
| 267 | + i3GEOF.area.pontos.xpt.push(coord[0]); | |
| 268 | + i3GEOF.area.pontos.ypt.push(coord[1]); | |
| 269 | + i3GEO.analise.pontos.xpt.push(coord[0]); | |
| 270 | + i3GEO.analise.pontos.ypt.push(coord[1]); | |
| 271 | + n = i3GEOF.area.pontos.ypt.length; | |
| 272 | + if (n > 1) { | |
| 273 | + x1 = i3GEOF.area.pontos.xpt[n - 2]; | |
| 274 | + y1 = i3GEOF.area.pontos.ypt[n - 2]; | |
| 275 | + x2 = coord[0]; | |
| 276 | + y2 = coord[1]; | |
| 277 | + raio = new ol.geom.LineString([[x1, y1],[x2, y2]]).getLength(); | |
| 278 | + // projeta | |
| 279 | + if (i3GEO.Interface.openlayers.googleLike) { | |
| 280 | + temp = i3GEO.util.extOSM2Geo(x1 + " " + y1 + " " + x2 + " " + y2); | |
| 281 | + temp = temp.split(" "); | |
| 282 | + x1 = temp[0]; | |
| 283 | + y1 = temp[1]; | |
| 284 | + x2 = temp[2]; | |
| 285 | + y2 = temp[3]; | |
| 286 | + } | |
| 287 | + trecho = i3GEO.calculo.distancia(x1, y1, x2, y2); | |
| 288 | + i3GEOF.area.pontos.dist.push(trecho); | |
| 289 | + total = i3GEOF.area.openlayers.somaDist(); | |
| 290 | 290 | |
| 291 | - sourceProj = i3geoOL.getView().getProjection(); | |
| 292 | - geom = (geom.clone().transform(sourceProj, 'EPSG:4326')); | |
| 293 | - coordinates = geom.getLinearRing(0).getCoordinates(); | |
| 294 | - wgs84Sphere = new ol.Sphere(6378137); | |
| 295 | - area = Math.abs(wgs84Sphere.geodesicArea(coordinates)); | |
| 291 | + sourceProj = i3geoOL.getView().getProjection(); | |
| 292 | + geom = (geom.clone().transform(sourceProj, 'EPSG:4326')); | |
| 293 | + coordinates = geom.getLinearRing(0).getCoordinates(); | |
| 294 | + wgs84Sphere = new ol.Sphere(6378137); | |
| 295 | + area = Math.abs(wgs84Sphere.geodesicArea(coordinates)); | |
| 296 | 296 | |
| 297 | - i3GEOF.area.openlayers.mostraTotal(total, area); | |
| 298 | - i3GEOF.area.ultimoWkt = i3GEOF.area.pontos2wkt(); | |
| 299 | - } | |
| 300 | - }, | |
| 301 | - /** | |
| 302 | - * Soma os valores de distancia guardados em pontos.dist | |
| 303 | - */ | |
| 304 | - somaDist : function() { | |
| 305 | - var n, i, total = 0; | |
| 306 | - n = i3GEOF.area.pontos.dist.length; | |
| 307 | - for (i = 0; i < n; i++) { | |
| 308 | - total += i3GEOF.area.pontos.dist[i]; | |
| 309 | - } | |
| 310 | - return total; | |
| 311 | - }, | |
| 312 | - /** | |
| 313 | - * Fecha a janela que mostra os dados Pergunta ao usuario se os graficos devem ser removidos Os graficos sao marcados com o | |
| 314 | - * atributo "origem" Os raios e pontos sao sempre removidos | |
| 315 | - */ | |
| 316 | - fechaJanela : function() { | |
| 317 | - i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(true); | |
| 318 | - var m = i3GEOF.area.openlayers; | |
| 319 | - ol.Observable.unByKey(m.featureListener); | |
| 320 | - m.featureListener = null; | |
| 321 | - m.removeControle(); | |
| 322 | - m.numpontos = 0; | |
| 323 | - i3GEO.eventos.cliquePerm.ativa(); | |
| 324 | - i3GEOF.area.openlayers.removeFiguras(); | |
| 325 | - }, | |
| 326 | - removeFiguras : function(){ | |
| 327 | - var features, n, f, i, remover = [], temp; | |
| 328 | - features = i3GEO.desenho.layergrafico.getSource().getFeatures(); | |
| 329 | - n = features.length; | |
| 330 | - for (i = 0; i < n; i++) { | |
| 331 | - f = features[i]; | |
| 332 | - if (f.getProperties().origem === "i3GeoMedeArea" || f.getProperties().origem === "medeAreaExcluir") { | |
| 333 | - remover.push(f); | |
| 334 | - } | |
| 335 | - } | |
| 336 | - if (remover.length > 0) { | |
| 337 | - temp = window.confirm($trad("x94")); | |
| 338 | - if (temp) { | |
| 339 | - for (r in remover) { | |
| 340 | - i3GEO.desenho.layergrafico.getSource().removeFeature(remover[r]); | |
| 341 | - } | |
| 342 | - } | |
| 343 | - } | |
| 344 | - }, | |
| 345 | - /** | |
| 346 | - * Mostra a totalizacao das linhas ja digitalizadas | |
| 347 | - */ | |
| 348 | - mostraTotal : function(per, area) { | |
| 349 | - var mostra = $i("mostraarea_calculo"), texto; | |
| 350 | - if (mostra) { | |
| 351 | - texto = | |
| 352 | - "total <br>" + $trad("d21at") | |
| 353 | - + " km2: " | |
| 354 | - + format("#.###,000", (area / 1000000).toFixed(3)) | |
| 355 | - + "<br>" | |
| 356 | - + $trad("d21at") | |
| 357 | - + " ha: " | |
| 358 | - + format("#.###,00",(area / 10000).toFixed(2)) | |
| 359 | - + "<br>" | |
| 360 | - + $trad("x98") | |
| 361 | - + " km: " | |
| 362 | - + format("#.###,00",(per).toFixed(2)) | |
| 363 | - + "<br>" | |
| 364 | - + $trad("x25") | |
| 365 | - + ": " | |
| 366 | - + i3GEO.calculo.metododistancia; | |
| 367 | - mostra.innerHTML = texto + "<hr>"; | |
| 368 | - i3GEOF.area.ultimaMedida = format("#.###,000",(area / 1000000).toFixed(3)) + " km2"; | |
| 369 | - } | |
| 297 | + i3GEOF.area.openlayers.mostraTotal(total, area); | |
| 298 | + i3GEOF.area.ultimoWkt = i3GEOF.area.pontos2wkt(); | |
| 299 | + } | |
| 300 | + }, | |
| 301 | + /** | |
| 302 | + * Soma os valores de distancia guardados em pontos.dist | |
| 303 | + */ | |
| 304 | + somaDist : function() { | |
| 305 | + var n, i, total = 0; | |
| 306 | + n = i3GEOF.area.pontos.dist.length; | |
| 307 | + for (i = 0; i < n; i++) { | |
| 308 | + total += i3GEOF.area.pontos.dist[i]; | |
| 309 | + } | |
| 310 | + return total; | |
| 311 | + }, | |
| 312 | + /** | |
| 313 | + * Fecha a janela que mostra os dados Pergunta ao usuario se os graficos devem ser removidos Os graficos sao marcados com o | |
| 314 | + * atributo "origem" Os raios e pontos sao sempre removidos | |
| 315 | + */ | |
| 316 | + fechaJanela : function() { | |
| 317 | + i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(true); | |
| 318 | + var m = i3GEOF.area.openlayers; | |
| 319 | + ol.Observable.unByKey(m.featureListener); | |
| 320 | + m.featureListener = null; | |
| 321 | + m.removeControle(); | |
| 322 | + m.numpontos = 0; | |
| 323 | + i3GEO.eventos.cliquePerm.ativa(); | |
| 324 | + i3GEOF.area.openlayers.removeFiguras(); | |
| 325 | + }, | |
| 326 | + removeFiguras : function(){ | |
| 327 | + var features, n, f, i, remover = [], temp; | |
| 328 | + features = i3GEO.desenho.layergrafico.getSource().getFeatures(); | |
| 329 | + n = features.length; | |
| 330 | + for (i = 0; i < n; i++) { | |
| 331 | + f = features[i]; | |
| 332 | + if (f.getProperties().origem === "i3GeoMedeArea" || f.getProperties().origem === "medeAreaExcluir") { | |
| 333 | + remover.push(f); | |
| 334 | + } | |
| 335 | + } | |
| 336 | + if (remover.length > 0) { | |
| 337 | + temp = window.confirm($trad("x94")); | |
| 338 | + if (temp) { | |
| 339 | + for (r in remover) { | |
| 340 | + i3GEO.desenho.layergrafico.getSource().removeFeature(remover[r]); | |
| 341 | + } | |
| 342 | + } | |
| 343 | + } | |
| 344 | + }, | |
| 345 | + /** | |
| 346 | + * Mostra a totalizacao das linhas ja digitalizadas | |
| 347 | + */ | |
| 348 | + mostraTotal : function(per, area) { | |
| 349 | + var mostra = $i("mostraarea_calculo"), texto; | |
| 350 | + if (mostra) { | |
| 351 | + texto = | |
| 352 | + "total <br>" + $trad("d21at") | |
| 353 | + + " km2: " | |
| 354 | + + format("#.###,000", (area / 1000000).toFixed(3)) | |
| 355 | + + "<br>" | |
| 356 | + + $trad("d21at") | |
| 357 | + + " ha: " | |
| 358 | + + format("#.###,00",(area / 10000).toFixed(2)) | |
| 359 | + + "<br>" | |
| 360 | + + $trad("x98") | |
| 361 | + + " km: " | |
| 362 | + + format("#.###,00",(per).toFixed(2)) | |
| 363 | + + "<br>" | |
| 364 | + + $trad("x25") | |
| 365 | + + ": " | |
| 366 | + + i3GEO.calculo.metododistancia; | |
| 367 | + mostra.innerHTML = texto + "<hr>"; | |
| 368 | + i3GEOF.area.ultimaMedida = format("#.###,000",(area / 1000000).toFixed(3)) + " km2"; | |
| 369 | + } | |
| 370 | + }, | |
| 371 | + /** | |
| 372 | + * Mostra o valor do trecho entre o ultimo ponto clicado e a posicao do mouse | |
| 373 | + */ | |
| 374 | + mostraParcial : function(trecho, per, area, direcao) { | |
| 375 | + var mostra = $i("mostraarea_calculo_parcial"), texto; | |
| 376 | + if (mostra) { | |
| 377 | + texto = | |
| 378 | + "parcial <br>" + $trad("d21at") | |
| 379 | + + " km2:" | |
| 380 | + + format("#.###,000",(area / 1000000).toFixed(3)) | |
| 381 | + + "<br>" | |
| 382 | + + $trad("d21at") | |
| 383 | + + " ha: " | |
| 384 | + + format("#.###,00",(area / 10000).toFixed(2)) | |
| 385 | + + "<br>" | |
| 386 | + + $trad("x95") | |
| 387 | + + " km: " | |
| 388 | + + format("#.###,000",trecho.toFixed(3)) | |
| 389 | + + "<br>" | |
| 390 | + + $trad("x98") | |
| 391 | + + " km: " | |
| 392 | + + format("#.###,000",(per).toFixed(3)) | |
| 393 | + + "<br>" | |
| 394 | + + $trad("x23") | |
| 395 | + + " (DMS):" | |
| 396 | + + direcao; | |
| 397 | + mostra.innerHTML = texto; | |
| 398 | + } | |
| 399 | + } | |
| 400 | + }, | |
| 401 | + googlemaps : { | |
| 402 | + /** | |
| 403 | + * Inicializa o processo Cria a variavel para guardar os pontos Executa a funcao de inicializacao do desenho, que cria o | |
| 404 | + * layer para receber os graficos | |
| 405 | + */ | |
| 406 | + inicia : function() { | |
| 407 | + i3GEOF.area.pontos = { | |
| 408 | + xpt : [], | |
| 409 | + ypt : [], | |
| 410 | + dist : [] | |
| 411 | + }; | |
| 412 | + if (!google.maps.geometry) { | |
| 413 | + alert($trad("x99")); | |
| 414 | + return; | |
| 415 | + } | |
| 416 | + i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia(); | |
| 417 | + i3GeoMap.setOptions({ | |
| 418 | + disableDoubleClickZoom : true | |
| 419 | + }); | |
| 420 | + i3GeoMap.setOptions({ | |
| 421 | + draggableCursor : 'crosshair' | |
| 422 | + }); | |
| 423 | + var evtdblclick = null, evtclick = null, evtmousemove = null, pontos = { | |
| 424 | + xpt : [], | |
| 425 | + ypt : [], | |
| 426 | + dist : [], | |
| 427 | + mvcLine : new google.maps.MVCArray(), | |
| 428 | + mvcMarkers : new google.maps.MVCArray(), | |
| 429 | + line : null, | |
| 430 | + polygon : null | |
| 431 | + }, termina = function() { | |
| 432 | + google.maps.event.removeListener(evtdblclick); | |
| 433 | + google.maps.event.removeListener(evtclick); | |
| 434 | + google.maps.event.removeListener(evtmousemove); | |
| 435 | + pontos.line.setOptions({ | |
| 436 | + clickable : true | |
| 437 | + }); | |
| 438 | + google.maps.event.addListener(pontos.line, 'click', function(shape) { | |
| 439 | + if (shape.setEditable) { | |
| 440 | + shape.setEditable(!shape.editable); | |
| 441 | + } | |
| 442 | + }); | |
| 443 | + if (pontos) { | |
| 444 | + i3GEO.desenho.googlemaps.shapes.push(pontos.mvcLine); | |
| 445 | + i3GEO.desenho.googlemaps.shapes.push(pontos.line); | |
| 446 | + pontos = null; | |
| 447 | + } | |
| 448 | + i3GEOF.area.ultimoWkt = i3GEOF.area.pontos2wkt(); | |
| 449 | + }; | |
| 450 | + evtclick = google.maps.event.addListener(i3GeoMap, "click", function(evt) { | |
| 451 | + i3GEO.eventos.cliquePerm.desativa(); | |
| 452 | + var area = 0, per; | |
| 453 | + // When the map is clicked, pass the LatLng obect to the | |
| 454 | + // measureAdd function | |
| 455 | + pontos.mvcLine.push(evt.latLng); | |
| 456 | + pontos.xpt.push(evt.latLng.lng()); | |
| 457 | + pontos.ypt.push(evt.latLng.lat()); | |
| 458 | + i3GEOF.area.pontos.xpt.push(evt.latLng.lng()); | |
| 459 | + i3GEOF.area.pontos.ypt.push(evt.latLng.lat()); | |
| 460 | + // desenha um circulo | |
| 461 | + if (pontos.mvcLine.getLength() > 0) { | |
| 462 | + per = google.maps.geometry.spherical.computeLength(pontos.mvcLine); | |
| 463 | + area = google.maps.geometry.spherical.computeArea(pontos.mvcLine); | |
| 464 | + i3GEOF.area.googlemaps.mostraTotal(per, area); | |
| 465 | + } | |
| 466 | + // desenha uma marca no ponto | |
| 467 | + i3GEO.desenho.googlemaps.shapes.push(new google.maps.Marker({ | |
| 468 | + map : i3GeoMap, | |
| 469 | + fillOpacity : 0, | |
| 470 | + clickable : false, | |
| 471 | + position : evt.latLng, | |
| 472 | + icon : { | |
| 473 | + path : google.maps.SymbolPath.CIRCLE, | |
| 474 | + scale : 2.5, | |
| 475 | + strokeColor : "#ffffff" | |
| 370 | 476 | }, |
| 371 | - /** | |
| 372 | - * Mostra o valor do trecho entre o ultimo ponto clicado e a posicao do mouse | |
| 373 | - */ | |
| 374 | - mostraParcial : function(trecho, per, area, direcao) { | |
| 375 | - var mostra = $i("mostraarea_calculo_parcial"), texto; | |
| 376 | - if (mostra) { | |
| 377 | - texto = | |
| 378 | - "parcial <br>" + $trad("d21at") | |
| 379 | - + " km2:" | |
| 380 | - + format("#.###,000",(area / 1000000).toFixed(3)) | |
| 381 | - + "<br>" | |
| 382 | - + $trad("d21at") | |
| 383 | - + " ha: " | |
| 384 | - + format("#.###,00",(area / 10000).toFixed(2)) | |
| 385 | - + "<br>" | |
| 386 | - + $trad("x95") | |
| 387 | - + " km: " | |
| 388 | - + format("#.###,000",trecho.toFixed(3)) | |
| 389 | - + "<br>" | |
| 390 | - + $trad("x98") | |
| 391 | - + " km: " | |
| 392 | - + format("#.###,000",(per).toFixed(3)) | |
| 393 | - + "<br>" | |
| 394 | - + $trad("x23") | |
| 395 | - + " (DMS):" | |
| 396 | - + direcao; | |
| 397 | - mostra.innerHTML = texto; | |
| 398 | - } | |
| 477 | + origem : "medeAreaExcluir" | |
| 478 | + })); | |
| 479 | + // mais um ponto para criar uma linha movel | |
| 480 | + pontos.mvcLine.push(evt.latLng); | |
| 481 | + }); | |
| 482 | + evtmousemove = | |
| 483 | + google.maps.event.addListener(i3GeoMap, "mousemove", function(evt) { | |
| 484 | + if (!$i("mostraarea_calculo")) { | |
| 485 | + termina.call(); | |
| 486 | + return; | |
| 399 | 487 | } |
| 400 | - }, | |
| 401 | - googlemaps : { | |
| 402 | - /** | |
| 403 | - * Inicializa o processo Cria a variavel para guardar os pontos Executa a funcao de inicializacao do desenho, que cria o | |
| 404 | - * layer para receber os graficos | |
| 405 | - */ | |
| 406 | - inicia : function() { | |
| 407 | - i3GEOF.area.pontos = { | |
| 408 | - xpt : [], | |
| 409 | - ypt : [], | |
| 410 | - dist : [] | |
| 411 | - }; | |
| 412 | - if (!google.maps.geometry) { | |
| 413 | - alert($trad("x99")); | |
| 414 | - return; | |
| 415 | - } | |
| 416 | - i3GEO.desenho[i3GEO.Interface["ATUAL"]].inicia(); | |
| 417 | - i3GeoMap.setOptions({ | |
| 418 | - disableDoubleClickZoom : true | |
| 419 | - }); | |
| 420 | - i3GeoMap.setOptions({ | |
| 421 | - draggableCursor : 'crosshair' | |
| 422 | - }); | |
| 423 | - var evtdblclick = null, evtclick = null, evtmousemove = null, pontos = { | |
| 424 | - xpt : [], | |
| 425 | - ypt : [], | |
| 426 | - dist : [], | |
| 427 | - mvcLine : new google.maps.MVCArray(), | |
| 428 | - mvcMarkers : new google.maps.MVCArray(), | |
| 429 | - line : null, | |
| 430 | - polygon : null | |
| 431 | - }, termina = function() { | |
| 432 | - google.maps.event.removeListener(evtdblclick); | |
| 433 | - google.maps.event.removeListener(evtclick); | |
| 434 | - google.maps.event.removeListener(evtmousemove); | |
| 435 | - pontos.line.setOptions({ | |
| 436 | - clickable : true | |
| 437 | - }); | |
| 438 | - google.maps.event.addListener(pontos.line, 'click', function(shape) { | |
| 439 | - if (shape.setEditable) { | |
| 440 | - shape.setEditable(!shape.editable); | |
| 441 | - } | |
| 442 | - }); | |
| 443 | - if (pontos) { | |
| 444 | - i3GEO.desenho.googlemaps.shapes.push(pontos.mvcLine); | |
| 445 | - i3GEO.desenho.googlemaps.shapes.push(pontos.line); | |
| 446 | - pontos = null; | |
| 447 | - } | |
| 448 | - i3GEOF.area.ultimoWkt = i3GEOF.area.pontos2wkt(); | |
| 449 | - }; | |
| 450 | - evtclick = google.maps.event.addListener(i3GeoMap, "click", function(evt) { | |
| 451 | - i3GEO.eventos.cliquePerm.desativa(); | |
| 452 | - var area = 0, per; | |
| 453 | - // When the map is clicked, pass the LatLng obect to the | |
| 454 | - // measureAdd function | |
| 455 | - pontos.mvcLine.push(evt.latLng); | |
| 456 | - pontos.xpt.push(evt.latLng.lng()); | |
| 457 | - pontos.ypt.push(evt.latLng.lat()); | |
| 458 | - i3GEOF.area.pontos.xpt.push(evt.latLng.lng()); | |
| 459 | - i3GEOF.area.pontos.ypt.push(evt.latLng.lat()); | |
| 460 | - // desenha um circulo | |
| 461 | - if (pontos.mvcLine.getLength() > 0) { | |
| 462 | - per = google.maps.geometry.spherical.computeLength(pontos.mvcLine); | |
| 463 | - area = google.maps.geometry.spherical.computeArea(pontos.mvcLine); | |
| 464 | - i3GEOF.area.googlemaps.mostraTotal(per, area); | |
| 465 | - } | |
| 466 | - // desenha uma marca no ponto | |
| 467 | - i3GEO.desenho.googlemaps.shapes.push(new google.maps.Marker({ | |
| 468 | - map : i3GeoMap, | |
| 469 | - fillOpacity : 0, | |
| 470 | - clickable : false, | |
| 471 | - position : evt.latLng, | |
| 472 | - icon : { | |
| 473 | - path : google.maps.SymbolPath.CIRCLE, | |
| 474 | - scale : 2.5, | |
| 475 | - strokeColor : "#ffffff" | |
| 476 | - }, | |
| 477 | - origem : "medeAreaExcluir" | |
| 478 | - })); | |
| 479 | - // mais um ponto para criar uma linha movel | |
| 480 | - pontos.mvcLine.push(evt.latLng); | |
| 481 | - }); | |
| 482 | - evtmousemove = | |
| 483 | - google.maps.event.addListener(i3GeoMap, "mousemove", function(evt) { | |
| 484 | - if (!$i("mostraarea_calculo")) { | |
| 485 | - termina.call(); | |
| 486 | - return; | |
| 487 | - } | |
| 488 | - var x1, y1, x2, y2, direcao, per, area, estilo = i3GEO.desenho.estilos[i3GEO.desenho.estiloPadrao], n = | |
| 489 | - pontos.xpt.length; | |
| 488 | + var x1, y1, x2, y2, direcao, per, area, estilo = i3GEO.desenho.estilos[i3GEO.desenho.estiloPadrao], n = | |
| 489 | + pontos.xpt.length; | |
| 490 | 490 | |
| 491 | - // If there is more than one vertex on the line | |
| 492 | - if (pontos.mvcLine.getLength() > 0) { | |
| 493 | - // If the line hasn't been created yet | |
| 494 | - if (!pontos.line) { | |
| 495 | - // Create the line (google.maps.Polyline) | |
| 496 | - pontos.line = new google.maps.Polygon({ | |
| 497 | - map : i3GeoMap, | |
| 498 | - clickable : false, | |
| 499 | - strokeColor : estilo.linecolor, | |
| 500 | - strokeOpacity : 1, | |
| 501 | - strokeWeight : estilo.linewidth, | |
| 502 | - path : pontos.mvcLine, | |
| 503 | - origem : "medeArea" | |
| 504 | - }); | |
| 505 | - } | |
| 506 | - pontos.mvcLine.pop(); | |
| 507 | - pontos.mvcLine.push(evt.latLng); | |
| 508 | - per = google.maps.geometry.spherical.computeLength(pontos.mvcLine); | |
| 509 | - x1 = pontos.xpt[n - 1]; | |
| 510 | - y1 = pontos.ypt[n - 1]; | |
| 511 | - x2 = evt.latLng.lng(); | |
| 512 | - y2 = evt.latLng.lat(); | |
| 513 | - trecho = i3GEO.calculo.distancia(x1, y1, x2, y2); | |
| 514 | - direcao = i3GEO.calculo.direcao(x1, y1, x2, y2); | |
| 515 | - direcao = i3GEO.calculo.dd2dms(direcao, direcao); | |
| 516 | - direcao = direcao[0]; | |
| 517 | - area = google.maps.geometry.spherical.computeArea(pontos.mvcLine); | |
| 518 | - i3GEOF.area.googlemaps.mostraParcial(trecho, per, area, direcao); | |
| 519 | - } | |
| 520 | - }); | |
| 521 | - evtdblclick = | |
| 522 | - google.maps.event.addListener(i3GeoMap, "dblclick", function(evt) { | |
| 523 | - pontos.mvcLine.push(new google.maps.LatLng(pontos.ypt[0], pontos.xpt[0])); | |
| 524 | - var per = google.maps.geometry.spherical.computeLength(pontos.mvcLine), area = | |
| 525 | - google.maps.geometry.spherical.computeArea(pontos.mvcLine); | |
| 526 | - i3GEOF.area.googlemaps.mostraTotal(per, area); | |
| 527 | - termina.call(); | |
| 528 | - }); | |
| 529 | - }, | |
| 530 | - /** | |
| 531 | - * Soma os valores de distancia guardados em pontos.dist | |
| 532 | - */ | |
| 533 | - somaDist : function(pontos) { | |
| 534 | - var n, i, total = 0; | |
| 535 | - n = pontos.dist.length; | |
| 536 | - for (i = 0; i < n; i++) { | |
| 537 | - total += pontos.dist[i]; | |
| 538 | - } | |
| 539 | - return total; | |
| 540 | - }, | |
| 541 | - /** | |
| 542 | - * Fecha a janela que mostra os dados Pergunta ao usuario se os graficos devem ser removidos Os graficos sao marcados com o | |
| 543 | - * atributo "origem" Os raios e pontos sao sempre removidos | |
| 544 | - */ | |
| 545 | - fechaJanela : function() { | |
| 546 | - i3GeoMap.setOptions({ | |
| 547 | - disableDoubleClickZoom : false | |
| 548 | - }); | |
| 549 | - i3GeoMap.setOptions({ | |
| 550 | - draggableCursor : undefined | |
| 491 | + // If there is more than one vertex on the line | |
| 492 | + if (pontos.mvcLine.getLength() > 0) { | |
| 493 | + // If the line hasn't been created yet | |
| 494 | + if (!pontos.line) { | |
| 495 | + // Create the line (google.maps.Polyline) | |
| 496 | + pontos.line = new google.maps.Polygon({ | |
| 497 | + map : i3GeoMap, | |
| 498 | + clickable : false, | |
| 499 | + strokeColor : estilo.linecolor, | |
| 500 | + strokeOpacity : 1, | |
| 501 | + strokeWeight : estilo.linewidth, | |
| 502 | + path : pontos.mvcLine, | |
| 503 | + origem : "medeArea" | |
| 551 | 504 | }); |
| 552 | - i3GEOF.area.googlemaps.removeFiguras(); | |
| 553 | - }, | |
| 554 | - removeFiguras: function(){ | |
| 555 | - var temp, f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem", "medeArea"); | |
| 556 | - if (f && f.length > 0) { | |
| 557 | - temp = window.confirm($trad("x94")); | |
| 558 | - if (temp) { | |
| 559 | - i3GEO.desenho.googlemaps.destroyFeatures(f); | |
| 560 | - } | |
| 561 | - } | |
| 562 | - f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem", "medeAreaExcluir"); | |
| 563 | - if (f && f.length > 0) { | |
| 564 | - i3GEO.desenho.googlemaps.destroyFeatures(f); | |
| 565 | - } | |
| 566 | - }, | |
| 567 | - /** | |
| 568 | - * Mostra a totalizacao das linhas ja digitalizadas | |
| 569 | - */ | |
| 570 | - mostraTotal : function(per, area) { | |
| 571 | - var mostra = $i("mostraarea_calculo"), texto; | |
| 572 | - if (mostra) { | |
| 573 | - texto = | |
| 574 | - "total<br>" + $trad("d21at") | |
| 575 | - + " km2: " | |
| 576 | - + (area / 1000000).toFixed(3) | |
| 577 | - + "<br>" | |
| 578 | - + $trad("d21at") | |
| 579 | - + " ha: " | |
| 580 | - + (area / 10000).toFixed(2) | |
| 581 | - + "<br>" | |
| 582 | - + $trad("x98") | |
| 583 | - + " km: " | |
| 584 | - + (per).toFixed(2) | |
| 585 | - + "<br>" | |
| 586 | - + $trad("x25") | |
| 587 | - + ": " | |
| 588 | - + i3GEO.calculo.metododistancia; | |
| 589 | - mostra.innerHTML = texto + "<hr>"; | |
| 590 | - i3GEOF.area.ultimaMedida = (area / 1000000).toFixed(3) + " km2"; | |
| 591 | - } | |
| 592 | - }, | |
| 593 | - /** | |
| 594 | - * Mostra o valor do trecho entre o ultimo ponto clicado e a posicao do mouse | |
| 595 | - */ | |
| 596 | - mostraParcial : function(trecho, per, area, direcao) { | |
| 597 | - var mostra = $i("mostraarea_calculo_parcial"), texto; | |
| 598 | - if (mostra) { | |
| 599 | - texto = | |
| 600 | - "parcial<br>" + $trad("d21at") | |
| 601 | - + " km2: " | |
| 602 | - + (area / 1000000).toFixed(3) | |
| 603 | - + "<br>" | |
| 604 | - + $trad("d21at") | |
| 605 | - + " ha: " | |
| 606 | - + (area / 10000).toFixed(2) | |
| 607 | - + "<br>" | |
| 608 | - + $trad("x95") | |
| 609 | - + " km: " | |
| 610 | - + trecho.toFixed(3) | |
| 611 | - + "<br>" | |
| 612 | - + $trad("x98") | |
| 613 | - + " km: " | |
| 614 | - + (per).toFixed(3) | |
| 615 | - + "<br>" | |
| 616 | - + $trad("x23") | |
| 617 | - + " (DMS): " | |
| 618 | - + direcao; | |
| 619 | - mostra.innerHTML = texto; | |
| 620 | - } | |
| 505 | + } | |
| 506 | + pontos.mvcLine.pop(); | |
| 507 | + pontos.mvcLine.push(evt.latLng); | |
| 508 | + per = google.maps.geometry.spherical.computeLength(pontos.mvcLine); | |
| 509 | + x1 = pontos.xpt[n - 1]; | |
| 510 | + y1 = pontos.ypt[n - 1]; | |
| 511 | + x2 = evt.latLng.lng(); | |
| 512 | + y2 = evt.latLng.lat(); | |
| 513 | + trecho = i3GEO.calculo.distancia(x1, y1, x2, y2); | |
| 514 | + direcao = i3GEO.calculo.direcao(x1, y1, x2, y2); | |
| 515 | + direcao = i3GEO.calculo.dd2dms(direcao, direcao); | |
| 516 | + direcao = direcao[0]; | |
| 517 | + area = google.maps.geometry.spherical.computeArea(pontos.mvcLine); | |
| 518 | + i3GEOF.area.googlemaps.mostraParcial(trecho, per, area, direcao); | |
| 621 | 519 | } |
| 520 | + }); | |
| 521 | + evtdblclick = | |
| 522 | + google.maps.event.addListener(i3GeoMap, "dblclick", function(evt) { | |
| 523 | + pontos.mvcLine.push(new google.maps.LatLng(pontos.ypt[0], pontos.xpt[0])); | |
| 524 | + var per = google.maps.geometry.spherical.computeLength(pontos.mvcLine), area = | |
| 525 | + google.maps.geometry.spherical.computeArea(pontos.mvcLine); | |
| 526 | + i3GEOF.area.googlemaps.mostraTotal(per, area); | |
| 527 | + termina.call(); | |
| 528 | + }); | |
| 529 | + }, | |
| 530 | + /** | |
| 531 | + * Soma os valores de distancia guardados em pontos.dist | |
| 532 | + */ | |
| 533 | + somaDist : function(pontos) { | |
| 534 | + var n, i, total = 0; | |
| 535 | + n = pontos.dist.length; | |
| 536 | + for (i = 0; i < n; i++) { | |
| 537 | + total += pontos.dist[i]; | |
| 538 | + } | |
| 539 | + return total; | |
| 540 | + }, | |
| 541 | + /** | |
| 542 | + * Fecha a janela que mostra os dados Pergunta ao usuario se os graficos devem ser removidos Os graficos sao marcados com o | |
| 543 | + * atributo "origem" Os raios e pontos sao sempre removidos | |
| 544 | + */ | |
| 545 | + fechaJanela : function() { | |
| 546 | + i3GeoMap.setOptions({ | |
| 547 | + disableDoubleClickZoom : false | |
| 548 | + }); | |
| 549 | + i3GeoMap.setOptions({ | |
| 550 | + draggableCursor : undefined | |
| 551 | + }); | |
| 552 | + i3GEOF.area.googlemaps.removeFiguras(); | |
| 553 | + }, | |
| 554 | + removeFiguras: function(){ | |
| 555 | + var temp, f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem", "medeArea"); | |
| 556 | + if (f && f.length > 0) { | |
| 557 | + temp = window.confirm($trad("x94")); | |
| 558 | + if (temp) { | |
| 559 | + i3GEO.desenho.googlemaps.destroyFeatures(f); | |
| 560 | + } | |
| 561 | + } | |
| 562 | + f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem", "medeAreaExcluir"); | |
| 563 | + if (f && f.length > 0) { | |
| 564 | + i3GEO.desenho.googlemaps.destroyFeatures(f); | |
| 565 | + } | |
| 566 | + }, | |
| 567 | + /** | |
| 568 | + * Mostra a totalizacao das linhas ja digitalizadas | |
| 569 | + */ | |
| 570 | + mostraTotal : function(per, area) { | |
| 571 | + var mostra = $i("mostraarea_calculo"), texto; | |
| 572 | + if (mostra) { | |
| 573 | + texto = | |
| 574 | + "total<br>" + $trad("d21at") | |
| 575 | + + " km2: " | |
| 576 | + + (area / 1000000).toFixed(3) | |
| 577 | + + "<br>" | |
| 578 | + + $trad("d21at") | |
| 579 | + + " ha: " | |
| 580 | + + (area / 10000).toFixed(2) | |
| 581 | + + "<br>" | |
| 582 | + + $trad("x98") | |
| 583 | + + " km: " | |
| 584 | + + (per).toFixed(2) | |
| 585 | + + "<br>" | |
| 586 | + + $trad("x25") | |
| 587 | + + ": " | |
| 588 | + + i3GEO.calculo.metododistancia; | |
| 589 | + mostra.innerHTML = texto + "<hr>"; | |
| 590 | + i3GEOF.area.ultimaMedida = (area / 1000000).toFixed(3) + " km2"; | |
| 591 | + } | |
| 592 | + }, | |
| 593 | + /** | |
| 594 | + * Mostra o valor do trecho entre o ultimo ponto clicado e a posicao do mouse | |
| 595 | + */ | |
| 596 | + mostraParcial : function(trecho, per, area, direcao) { | |
| 597 | + var mostra = $i("mostraarea_calculo_parcial"), texto; | |
| 598 | + if (mostra) { | |
| 599 | + texto = | |
| 600 | + "parcial<br>" + $trad("d21at") | |
| 601 | + + " km2: " | |
| 602 | + + (area / 1000000).toFixed(3) | |
| 603 | + + "<br>" | |
| 604 | + + $trad("d21at") | |
| 605 | + + " ha: " | |
| 606 | + + (area / 10000).toFixed(2) | |
| 607 | + + "<br>" | |
| 608 | + + $trad("x95") | |
| 609 | + + " km: " | |
| 610 | + + trecho.toFixed(3) | |
| 611 | + + "<br>" | |
| 612 | + + $trad("x98") | |
| 613 | + + " km: " | |
| 614 | + + (per).toFixed(3) | |
| 615 | + + "<br>" | |
| 616 | + + $trad("x23") | |
| 617 | + + " (DMS): " | |
| 618 | + + direcao; | |
| 619 | + mostra.innerHTML = texto; | |
| 622 | 620 | } |
| 623 | - }; | |
| 621 | + } | |
| 622 | + } | |
| 623 | +}; | |
| 624 | 624 | //aplica ao codigo i3GEOF definicoes feitas na interface do mapa |
| 625 | 625 | //isso permite a substituicao de funcoes e parametros |
| 626 | 626 | if(i3GEO.configura.ferramentas.hasOwnProperty("area")){ |
| 627 | -jQuery.each( i3GEO.configura.ferramentas.area, function(index, value) { | |
| 628 | - i3GEOF.area[index] = i3GEO.configura.ferramentas.area[index]; | |
| 629 | -}); | |
| 627 | + jQuery.each( i3GEO.configura.ferramentas.area, function(index, value) { | |
| 628 | + i3GEOF.area[index] = i3GEO.configura.ferramentas.area[index]; | |
| 629 | + }); | |
| 630 | 630 | } |
| 631 | 631 | \ No newline at end of file | ... | ... |
ferramentas/editorol/editorol.js
| ... | ... | @@ -237,52 +237,6 @@ i3GEO.editorOL = { |
| 237 | 237 | }); |
| 238 | 238 | } |
| 239 | 239 | }, |
| 240 | - criaJanelaBusca : function() { | |
| 241 | - var layers = i3GEO.editorOL.layersLigados(), nlayers = layers.length, i, ins, combo = | |
| 242 | - "<select id=i3GEOOLlistaTemasBusca ><option value=''>----</option>"; | |
| 243 | - for (i = 0; i < nlayers; i++) { | |
| 244 | - combo += "<option value='" + i + "' >" + layers[i].getProperties().name + "</option>"; | |
| 245 | - } | |
| 246 | - combo += "</select>"; | |
| 247 | - ins = "<div class=paragrafo >" + $trad("a7") + ":<br>" + combo; | |
| 248 | - ins += "<br>" + $trad("x64") + ":<br><span id=i3GEOOLcomboitens ></span>"; | |
| 249 | - ins += "<br>" + $trad("t23") + ":<br><input type=text size=20 id=i3GEOOLpalavraBusca >"; | |
| 250 | - ins += "<br><br><input type=button value='" + $trad("t23") + "' id='i3GEOOLbotaoBusca' ></div>"; | |
| 251 | - ins += "<br>'" + $trad("result") + "':<br><span id=i3GEOOLcomboresultado ></span>"; | |
| 252 | - | |
| 253 | - YAHOO.namespace("procura.container"); | |
| 254 | - YAHOO.procura.container.panel = new YAHOO.widget.Panel("panelprocura", { | |
| 255 | - zIndex : 2000, | |
| 256 | - iframe : false, | |
| 257 | - width : "250px", | |
| 258 | - visible : false, | |
| 259 | - draggable : true, | |
| 260 | - close : true, | |
| 261 | - strings: {close: "<span class='material-icons'>cancel</span>"} | |
| 262 | - }); | |
| 263 | - YAHOO.procura.container.panel.setHeader("Encontre no mapa"); | |
| 264 | - YAHOO.procura.container.panel.setBody(ins); | |
| 265 | - YAHOO.procura.container.panel.setFooter(""); | |
| 266 | - YAHOO.procura.container.panel.render(document.body); | |
| 267 | - YAHOO.procura.container.panel.center(); | |
| 268 | - | |
| 269 | - document.getElementById("i3GEOOLbotaoBusca").onclick = | |
| 270 | - function() { | |
| 271 | - var layer = i3GEO.editorOL.layerAtivo(), item = document.getElementById("i3GEOOLbuscaItem").value, palavra = | |
| 272 | - document.getElementById("i3GEOOLpalavraBusca").value; | |
| 273 | - if (item === "" || palavra === "") { | |
| 274 | - alert("Escolha o item e o texto de busca"); | |
| 275 | - return; | |
| 276 | - } | |
| 277 | - i3GEO.editorOL.busca(layer, item, palavra, "i3GEOOLcomboresultado"); | |
| 278 | - }; | |
| 279 | - document.getElementById("i3GEOOLlistaTemasBusca").onchange = function() { | |
| 280 | - i3GEO.editorOL.ativaTema(this.value); | |
| 281 | - document.getElementById("i3GEOOLcomboitens").innerHTML = "..."; | |
| 282 | - i3GEO.editorOL.listaItens(i3GEO.editorOL.layerAtivo(), "i3GEOOLcomboitens", "i3GEOOLbuscaItem"); | |
| 283 | - }; | |
| 284 | - | |
| 285 | - }, | |
| 286 | 240 | criaComboTemas : function() { |
| 287 | 241 | var layers = i3GEO.editorOL.layersLigados(), nlayers = layers.length, i, nometema = "", combo = |
| 288 | 242 | "<select id=i3GEOOLlistaTemasAtivos style=width:235px; >"; |
| ... | ... | @@ -785,531 +739,7 @@ i3GEO.editorOL = { |
| 785 | 739 | ); |
| 786 | 740 | } |
| 787 | 741 | }, |
| 788 | - //muda a classe do botao para marca-lo como ativo | |
| 789 | - marcaBotao : function(classeBotao){ | |
| 790 | - //desmarca todos os botoes | |
| 791 | - if($i("i3GEObarraEdicao")){ | |
| 792 | - var i, n, botoes = $i("i3GEObarraEdicao").getElementsByTagName("div"); | |
| 793 | - n = botoes.length; | |
| 794 | - for(i = 0; i < n; i++){ | |
| 795 | - botoes[i].className = botoes[i].className.replace("ItemActive","ItemInactive"); | |
| 796 | - if(classeBotao){ | |
| 797 | - botoes[i].className = botoes[i].className.replace(classeBotao+"ItemInactive",classeBotao+"ItemActive"); | |
| 798 | - } | |
| 799 | - } | |
| 800 | - } | |
| 801 | - i3GEO.editorOL.removeInteracoes(); | |
| 802 | - }, | |
| 803 | - removeInteracoes: function(){ | |
| 804 | - i3geoOL.removeInteraction(i3GEO.editorOL.interacoes); | |
| 805 | - i3GEO.editorOL.interacoes = ""; | |
| 806 | - }, | |
| 807 | - botaoProcura : function(){ | |
| 808 | - var temp = document.createElement("div"); | |
| 809 | - temp.className = "editorOLprocuraItemInactive olButton"; | |
| 810 | - temp.title = $trad("t23"); | |
| 811 | - temp.onclick = function(){ | |
| 812 | - i3GEO.editorOL.criaJanelaBusca(); | |
| 813 | - YAHOO.procura.container.panel.show(); | |
| 814 | - }; | |
| 815 | - return temp; | |
| 816 | - }, | |
| 817 | - botaoPan : function(){ | |
| 818 | - var temp = document.createElement("div"); | |
| 819 | - temp.className = "editorOLpanItemInactive olButton"; | |
| 820 | - temp.title = "pan"; | |
| 821 | - temp.onclick = function(){ | |
| 822 | - i3GEO.editorOL.marcaBotao("editorOLpan"); | |
| 823 | - }; | |
| 824 | - return temp; | |
| 825 | - }, | |
| 826 | - botaoZoomBox : function(){ | |
| 827 | - var temp = document.createElement("div"); | |
| 828 | - temp.className = "editorOLzoomboxItemInactive olButton"; | |
| 829 | - temp.title = "zoombox"; | |
| 830 | - temp.onclick = function(){ | |
| 831 | - i3GEO.navega.zoomli(); | |
| 832 | - }; | |
| 833 | - return temp; | |
| 834 | - }, | |
| 835 | - botaoZoomTot : function(){ | |
| 836 | - var temp = document.createElement("div"); | |
| 837 | - temp.className = "editorOLzoomtotItemInactive olButton"; | |
| 838 | - temp.title = $trad("d2t"); | |
| 839 | - temp.onclick = function(){ | |
| 840 | - if (i3GEO.editorOL.mapext && i3GEO.editorOL.mapext != "") { | |
| 841 | - i3GEO.Interface.openlayers.zoom2ext(i3GEO.editorOL.mapext.join(" ")); | |
| 842 | - } else { | |
| 843 | - i3GEO.Interface.openlayers.zoom2ext(i3GEO.parametros.extentTotal); | |
| 844 | - } | |
| 845 | - }; | |
| 846 | - return temp; | |
| 847 | - }, | |
| 848 | - botaoZoomIn : function(){ | |
| 849 | - var temp = document.createElement("div"); | |
| 850 | - temp.className = "editorOLzoominItemInactive olButton"; | |
| 851 | - temp.title = $trad("d5t"); | |
| 852 | - temp.onclick = function(){ | |
| 853 | - var v = i3GEO.editorOL.mapa.getView(); | |
| 854 | - v.setZoom(v.getZoom() + 1); | |
| 855 | - }; | |
| 856 | - return temp; | |
| 857 | - }, | |
| 858 | - botaoZoomOut : function(){ | |
| 859 | - var temp = document.createElement("div"); | |
| 860 | - temp.className = "editorOLzoomoutItemInactive olButton"; | |
| 861 | - temp.title = $trad("d5t"); | |
| 862 | - temp.onclick = function(){ | |
| 863 | - var v = i3GEO.editorOL.mapa.getView(); | |
| 864 | - v.setZoom(v.getZoom() - 1); | |
| 865 | - }; | |
| 866 | - return temp; | |
| 867 | - }, | |
| 868 | - botaoLegenda : function(){ | |
| 869 | - var temp = document.createElement("div"); | |
| 870 | - temp.className = "editorOLlegendaItemInactive olButton"; | |
| 871 | - temp.title = $trad("p3"); | |
| 872 | - temp.onclick = function(){ | |
| 873 | - i3GEO.editorOL.mostraLegenda(); | |
| 874 | - }; | |
| 875 | - return temp; | |
| 876 | - }, | |
| 877 | - botaoDistancia : function(){ | |
| 878 | - var temp = document.createElement("div"); | |
| 879 | - temp.className = "editorOLdistanciaItemInactive olButton"; | |
| 880 | - temp.onclick = function(){ | |
| 881 | - i3GEO.editorOL.marcaBotao("editorOLdistancia"); | |
| 882 | - i3GEO.analise.medeDistancia.inicia(); | |
| 883 | - }; | |
| 884 | - return temp; | |
| 885 | - }, | |
| 886 | - botaoArea: function(){ | |
| 887 | - var temp = document.createElement("div"); | |
| 888 | - temp.className = "editorOLareaItemInactive olButton"; | |
| 889 | - temp.onclick = function(){ | |
| 890 | - i3GEO.editorOL.marcaBotao("editorOLarea"); | |
| 891 | - i3GEO.analise.medeArea.inicia(); | |
| 892 | - }; | |
| 893 | - return temp; | |
| 894 | - }, | |
| 895 | - desenhaLinha: function(drawendcallback){ | |
| 896 | - i3GEO.editorOL.removeInteracoes(); | |
| 897 | - var draw = new ol.interaction.Draw({ | |
| 898 | - type : "LineString" | |
| 899 | - }); | |
| 900 | - //adiciona a interacao para poder ser removida | |
| 901 | - i3GEO.editorOL.interacoes = draw; | |
| 902 | - //desativa ol.interaction.DoubleClickZoom | |
| 903 | - i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 904 | - draw.on("drawend", function(evt) { | |
| 905 | - evt.feature.setStyle( | |
| 906 | - new ol.style.Style({ | |
| 907 | - stroke: new ol.style.Stroke({ | |
| 908 | - color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')', | |
| 909 | - width: i3GEO.editorOL.simbologia.strokeWidth | |
| 910 | - }), | |
| 911 | - fill: new ol.style.Fill({ | |
| 912 | - color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')' | |
| 913 | - }) | |
| 914 | - }) | |
| 915 | - ); | |
| 916 | - evt.feature.setId(i3GEO.util.uid()); | |
| 917 | - i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature); | |
| 918 | - draw.setActive(false); | |
| 919 | - draw.setActive(true); | |
| 920 | - if (document.getElementById("panellistagEditor")) { | |
| 921 | - i3GEO.editorOL.listaGeometrias(); | |
| 922 | - } | |
| 923 | - }); | |
| 924 | - if(drawendcallback){ | |
| 925 | - draw.on("drawend",drawendcallback); | |
| 926 | - } | |
| 927 | - i3geoOL.addInteraction(draw); | |
| 928 | - }, | |
| 929 | - botaoLinha: function(){ | |
| 930 | - var temp = document.createElement("div"); | |
| 931 | - temp.className = "editorOLlinhaItemInactive olButton"; | |
| 932 | - temp.title = $trad("dlinha"); | |
| 933 | - temp.onclick = function(){ | |
| 934 | - i3GEO.eventos.cliquePerm.desativa(); | |
| 935 | - i3GEO.editorOL.marcaBotao("editorOLlinha"); | |
| 936 | - i3GEO.editorOL.desenhaLinha(); | |
| 937 | - }; | |
| 938 | - return temp; | |
| 939 | - }, | |
| 940 | - desenhaPonto: function(drawendcallback){ | |
| 941 | - i3GEO.editorOL.removeInteracoes(); | |
| 942 | - var draw = new ol.interaction.Draw({ | |
| 943 | - type : "Point" | |
| 944 | - }); | |
| 945 | - //adiciona a interacao para poder ser removida | |
| 946 | - i3GEO.editorOL.interacoes = draw; | |
| 947 | - i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 948 | - draw.on("drawend", function(evt) { | |
| 949 | - var simbolo, url; | |
| 950 | - url = i3GEO.editorOL.simbologia.externalGraphic; | |
| 951 | 742 | |
| 952 | - if(url === ""){ | |
| 953 | - simbolo = new ol.style.Circle({ | |
| 954 | - radius: i3GEO.editorOL.simbologia.pointRadius, | |
| 955 | - fill: new ol.style.Fill({ | |
| 956 | - color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')' | |
| 957 | - }), | |
| 958 | - stroke: new ol.style.Stroke({ | |
| 959 | - color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')', | |
| 960 | - width: i3GEO.editorOL.simbologia.pointRadius / 3 | |
| 961 | - }) | |
| 962 | - }); | |
| 963 | - } | |
| 964 | - else{ | |
| 965 | - simbolo = new ol.style.Icon({ | |
| 966 | - src : url, | |
| 967 | - size : [i3GEO.editorOL.simbologia.graphicWidth,i3GEO.editorOL.simbologia.graphicHeight] | |
| 968 | - }); | |
| 969 | - } | |
| 970 | - evt.feature.setStyle( | |
| 971 | - new ol.style.Style({ | |
| 972 | - image: simbolo | |
| 973 | - }) | |
| 974 | - ); | |
| 975 | - | |
| 976 | - evt.feature.setId(i3GEO.util.uid()); | |
| 977 | - i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature); | |
| 978 | - draw.setActive(false); | |
| 979 | - draw.setActive(true); | |
| 980 | - if (document.getElementById("panellistagEditor")) { | |
| 981 | - i3GEO.editorOL.listaGeometrias(); | |
| 982 | - } | |
| 983 | - }); | |
| 984 | - if(drawendcallback){ | |
| 985 | - draw.on("drawend",drawendcallback); | |
| 986 | - } | |
| 987 | - i3geoOL.addInteraction(draw); | |
| 988 | - }, | |
| 989 | - botaoPonto: function(){ | |
| 990 | - i3GEO.eventos.cliquePerm.desativa(); | |
| 991 | - var temp = document.createElement("div"); | |
| 992 | - temp.className = "editorOLpontoItemInactive olButton"; | |
| 993 | - temp.title = $trad("dponto"); | |
| 994 | - temp.onclick = function(){ | |
| 995 | - i3GEO.editorOL.marcaBotao("editorOLponto"); | |
| 996 | - i3GEO.editorOL.desenhaPonto(); | |
| 997 | - }; | |
| 998 | - return temp; | |
| 999 | - }, | |
| 1000 | - desenhaPoligono: function(drawendcallback){ | |
| 1001 | - i3GEO.editorOL.removeInteracoes(); | |
| 1002 | - var draw = new ol.interaction.Draw({ | |
| 1003 | - type : "Polygon" | |
| 1004 | - }); | |
| 1005 | - //adiciona a interacao para poder ser removida | |
| 1006 | - i3GEO.editorOL.interacoes = draw; | |
| 1007 | - i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 1008 | - draw.on("drawend", function(evt) { | |
| 1009 | - evt.feature.setStyle( | |
| 1010 | - new ol.style.Style({ | |
| 1011 | - stroke: new ol.style.Stroke({ | |
| 1012 | - color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')', | |
| 1013 | - width: i3GEO.editorOL.simbologia.strokeWidth | |
| 1014 | - }), | |
| 1015 | - fill: new ol.style.Fill({ | |
| 1016 | - color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')' | |
| 1017 | - }) | |
| 1018 | - }) | |
| 1019 | - ); | |
| 1020 | - evt.feature.setId(i3GEO.util.uid()); | |
| 1021 | - i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature); | |
| 1022 | - draw.setActive(false); | |
| 1023 | - draw.setActive(true); | |
| 1024 | - if (document.getElementById("panellistagEditor")) { | |
| 1025 | - i3GEO.editorOL.listaGeometrias(); | |
| 1026 | - } | |
| 1027 | - }); | |
| 1028 | - if(drawendcallback){ | |
| 1029 | - draw.on("drawend",drawendcallback); | |
| 1030 | - } | |
| 1031 | - i3geoOL.addInteraction(draw); | |
| 1032 | - }, | |
| 1033 | - botaoPoligono: function(){ | |
| 1034 | - i3GEO.eventos.cliquePerm.desativa(); | |
| 1035 | - var temp = document.createElement("div"); | |
| 1036 | - temp.className = "editorOLpoligonoItemInactive olButton"; | |
| 1037 | - temp.title = $trad("dpol"); | |
| 1038 | - temp.onclick = function(){ | |
| 1039 | - i3GEO.editorOL.marcaBotao("editorOLpoligono"); | |
| 1040 | - i3GEO.editorOL.desenhaPoligono(); | |
| 1041 | - }; | |
| 1042 | - return temp; | |
| 1043 | - }, | |
| 1044 | - botaoTexto: function(){ | |
| 1045 | - i3GEO.eventos.cliquePerm.desativa(); | |
| 1046 | - var temp = document.createElement("div"); | |
| 1047 | - temp.className = "editorOLtextoItemInactive olButton"; | |
| 1048 | - temp.title = $trad("dtexto"); | |
| 1049 | - temp.onclick = function(){ | |
| 1050 | - i3GEO.eventos.cliquePerm.desativa(); | |
| 1051 | - i3GEO.editorOL.removeInteracoes(); | |
| 1052 | - i3GEO.editorOL.marcaBotao("editorOLtexto"); | |
| 1053 | - var draw = new ol.interaction.Draw({ | |
| 1054 | - type : "Point" | |
| 1055 | - }); | |
| 1056 | - //adiciona a interacao para poder ser removida | |
| 1057 | - i3GEO.editorOL.interacoes = draw; | |
| 1058 | - i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 1059 | - draw.on("drawend", function(evt) { | |
| 1060 | - var texto = window.prompt("Texto", ""); | |
| 1061 | - evt.feature.setStyle( | |
| 1062 | - new ol.style.Style({ | |
| 1063 | - text: new ol.style.Text({ | |
| 1064 | - text: texto, | |
| 1065 | - font: 'Bold ' + parseInt(i3GEO.editorOL.simbologia.fontSize,10) + 'px Arial', | |
| 1066 | - textAlign: 'left', | |
| 1067 | - stroke: new ol.style.Stroke({ | |
| 1068 | - color: 'white', | |
| 1069 | - width: i3GEO.editorOL.simbologia.strokeWidth | |
| 1070 | - }), | |
| 1071 | - fill: new ol.style.Fill({ | |
| 1072 | - color: i3GEO.editorOL.simbologia.fontColor | |
| 1073 | - }), | |
| 1074 | - zIndex: 2000 | |
| 1075 | - }) | |
| 1076 | - }) | |
| 1077 | - ); | |
| 1078 | - evt.feature.setId(i3GEO.util.uid()); | |
| 1079 | - i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature); | |
| 1080 | - draw.setActive(false); | |
| 1081 | - draw.setActive(true); | |
| 1082 | - i3GEO.editorOL.marcaBotao(); | |
| 1083 | - }); | |
| 1084 | - i3geoOL.addInteraction(draw); | |
| 1085 | - }; | |
| 1086 | - return temp; | |
| 1087 | - }, | |
| 1088 | - botaoSelecao: function(){ | |
| 1089 | - i3GEO.eventos.cliquePerm.desativa(); | |
| 1090 | - var temp = document.createElement("div"); | |
| 1091 | - temp.className = "editorOLselecaoItemInactive olButton"; | |
| 1092 | - temp.title = $trad("d24t"); | |
| 1093 | - temp.onclick = function(){ | |
| 1094 | - i3GEO.editorOL.marcaBotao("editorOLselecao"); | |
| 1095 | - i3GEO.editorOL.removeInteracoes(); | |
| 1096 | - var sel = new ol.interaction.Select(); | |
| 1097 | - //adiciona a interacao para poder ser removida | |
| 1098 | - i3GEO.editorOL.interacoes = sel; | |
| 1099 | - i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 1100 | - sel.on("select", function(evt) { | |
| 1101 | - var s,i, n, id, f; | |
| 1102 | - n = evt.selected.length; | |
| 1103 | - for(i=0; i<n; i++){ | |
| 1104 | - f = evt.selected[i]; | |
| 1105 | - id = f.getId(); | |
| 1106 | - if(id && i3GEO.util.in_array(id,i3GEO.editorOL.idsSelecionados)){ | |
| 1107 | - i3GEO.editorOL.unselFeature(id); | |
| 1108 | - } | |
| 1109 | - else{ | |
| 1110 | - id = i3GEO.util.uid(); | |
| 1111 | - i3GEO.editorOL.idsSelecionados.push(id); | |
| 1112 | - f.setId(id); | |
| 1113 | - s = f.getStyle(); | |
| 1114 | - | |
| 1115 | - if(s.getImage()){ | |
| 1116 | - f.setStyle( | |
| 1117 | - new ol.style.Style({ | |
| 1118 | - image: new ol.style.Circle({ | |
| 1119 | - radius: i3GEO.editorOL.simbologia.pointRadius, | |
| 1120 | - fill: new ol.style.Fill({ | |
| 1121 | - color: 'rgba(255, 255, 255, 0.5)' | |
| 1122 | - }), | |
| 1123 | - stroke: new ol.style.Stroke({ | |
| 1124 | - color: 'blue', | |
| 1125 | - width: i3GEO.editorOL.simbologia.pointRadius / 3 | |
| 1126 | - }) | |
| 1127 | - }) | |
| 1128 | - }) | |
| 1129 | - ); | |
| 1130 | - if(!s.getImage().getSrc){ | |
| 1131 | - f.setProperties({ | |
| 1132 | - fillColor: s.getImage().getFill().getColor(), | |
| 1133 | - strokeColor: s.getImage().getStroke().getColor(), | |
| 1134 | - externalGraphic: "", | |
| 1135 | - graphicHeight : 25, | |
| 1136 | - graphicWidth : 25 | |
| 1137 | - }); | |
| 1138 | - } | |
| 1139 | - else{ | |
| 1140 | - f.setProperties({ | |
| 1141 | - fillColor: "", | |
| 1142 | - strokeColor: "", | |
| 1143 | - externalGraphic: s.getImage().getSrc(), | |
| 1144 | - graphicHeight : s.getImage().getSize()[1], | |
| 1145 | - graphicWidth : s.getImage().getSize()[0] | |
| 1146 | - }); | |
| 1147 | - } | |
| 1148 | - } | |
| 1149 | - else{ | |
| 1150 | - f.setProperties({ | |
| 1151 | - externalGraphic: "", | |
| 1152 | - graphicHeight : 25, | |
| 1153 | - graphicWidth : 25 | |
| 1154 | - }); | |
| 1155 | - if(s.getFill()){ | |
| 1156 | - f.setProperties({fillColor: s.getFill().getColor()}); | |
| 1157 | - s.getFill().setColor('rgba(255, 255, 255, 0.5)'); | |
| 1158 | - } | |
| 1159 | - if(s.getStroke()){ | |
| 1160 | - f.setProperties({strokeColor: s.getStroke().getColor()}); | |
| 1161 | - s.getStroke().setColor('blue'); | |
| 1162 | - } | |
| 1163 | - } | |
| 1164 | - } | |
| 1165 | - } | |
| 1166 | - if (n === 0){ | |
| 1167 | - i3GEO.editorOL.unselTodos(); | |
| 1168 | - } | |
| 1169 | - }); | |
| 1170 | - i3geoOL.addInteraction(sel); | |
| 1171 | - }; | |
| 1172 | - return temp; | |
| 1173 | - }, | |
| 1174 | - botaoSelecaoTudo: function(){ | |
| 1175 | - var temp = document.createElement("div"); | |
| 1176 | - temp.className = "editorOLselecaoTudoItemInactive olButton"; | |
| 1177 | - temp.title = $trad("studo"); | |
| 1178 | - temp.onclick = function(){ | |
| 1179 | - i3GEO.editorOL.marcaBotao(); | |
| 1180 | - i3GEO.editorOL.selTodos(); | |
| 1181 | - }; | |
| 1182 | - return temp; | |
| 1183 | - }, | |
| 1184 | - botaoUnselTodos: function(){ | |
| 1185 | - var temp = document.createElement("div"); | |
| 1186 | - temp.className = "editorOLunselecaoTudoItemInactive olButton"; | |
| 1187 | - temp.title = $trad("ustudo"); | |
| 1188 | - temp.onclick = function(){ | |
| 1189 | - i3GEO.editorOL.marcaBotao(); | |
| 1190 | - i3GEO.editorOL.unselTodos(); | |
| 1191 | - }; | |
| 1192 | - return temp; | |
| 1193 | - }, | |
| 1194 | - botaoApaga: function(){ | |
| 1195 | - var temp = document.createElement("div"); | |
| 1196 | - temp.className = "editorOLapagaItemInactive olButton"; | |
| 1197 | - temp.title = $trad("excsel"); | |
| 1198 | - temp.onclick = function(){ | |
| 1199 | - var x, nsel = i3GEO.editorOL.idsSelecionados.length; | |
| 1200 | - i3GEO.editorOL.featuresBackup = []; | |
| 1201 | - i3GEO.editorOL.marcaBotao(); | |
| 1202 | - if(nsel > 0){ | |
| 1203 | - x = window.confirm($trad("excsel") + "?"); | |
| 1204 | - if(x){ | |
| 1205 | - i3GEO.editorOL.removeFeaturesSel(); | |
| 1206 | - i3GEO.desenho.layergrafico.getSource().changed(); | |
| 1207 | - } | |
| 1208 | - } | |
| 1209 | - else{ | |
| 1210 | - i3GEO.janela.tempoMsg($trad("selum")); | |
| 1211 | - } | |
| 1212 | - }; | |
| 1213 | - return temp; | |
| 1214 | - }, | |
| 1215 | - botaoFrente: function(){ | |
| 1216 | - var temp = document.createElement("div"); | |
| 1217 | - temp.className = "editorOLfrenteItemInactive olButton"; | |
| 1218 | - temp.title = $trad("frente"); | |
| 1219 | - temp.onclick = function(){ | |
| 1220 | - var nsel = i3GEO.editorOL.idsSelecionados.length; | |
| 1221 | - if(nsel > 0){ | |
| 1222 | - i3GEO.editorOL.marcaBotao(); | |
| 1223 | - i3GEO.editorOL.trazParaFrente(); | |
| 1224 | - } | |
| 1225 | - else{ | |
| 1226 | - i3GEO.janela.tempoMsg($trad("selum")); | |
| 1227 | - } | |
| 1228 | - }; | |
| 1229 | - return temp; | |
| 1230 | - }, | |
| 1231 | - //FIXME Translate nao funciona nessa versao do openlayers 3x precisa atualizar | |
| 1232 | - botaoEdita: function(){ | |
| 1233 | - i3GEO.eventos.cliquePerm.desativa(); | |
| 1234 | - var temp = document.createElement("div"); | |
| 1235 | - temp.className = "editorOLeditaItemInactive olButton"; | |
| 1236 | - temp.title = $trad("modf"); | |
| 1237 | - temp.onclick = function(){ | |
| 1238 | - i3GEO.editorOL.featuresBackup = []; | |
| 1239 | - var draw, nsel, f, c; | |
| 1240 | - nsel = i3GEO.editorOL.idsSelecionados.length; | |
| 1241 | - if(nsel == 1){ | |
| 1242 | - i3GEO.editorOL.removeInteracoes(); | |
| 1243 | - i3GEO.editorOL.marcaBotao("editorOLedita"); | |
| 1244 | - f = i3GEO.desenho.layergrafico.getSource().getFeatureById(i3GEO.editorOL.idsSelecionados[nsel - 1]); | |
| 1245 | - i3GEO.editorOL.featuresBackup.push(f.clone()); | |
| 1246 | - c = new ol.Collection(); | |
| 1247 | - c.push(f); | |
| 1248 | - draw = new ol.interaction.Modify({ | |
| 1249 | - features: c | |
| 1250 | - }); | |
| 1251 | - //adiciona a interacao para poder ser removida | |
| 1252 | - i3GEO.editorOL.interacoes = draw; | |
| 1253 | - i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 1254 | - i3geoOL.addInteraction(draw); | |
| 1255 | - } | |
| 1256 | - else{ | |
| 1257 | - i3GEO.janela.tempoMsg($trad("seluma")); | |
| 1258 | - } | |
| 1259 | - }; | |
| 1260 | - return temp; | |
| 1261 | - }, | |
| 1262 | - botaoCorta: function(){ | |
| 1263 | - i3GEO.eventos.cliquePerm.desativa(); | |
| 1264 | - var temp = document.createElement("div"); | |
| 1265 | - temp.className = "editorOLcortaItemInactive olButton"; | |
| 1266 | - temp.title = $trad("cortaf"); | |
| 1267 | - temp.onclick = function(){ | |
| 1268 | - var nsel = i3GEO.editorOL.idsSelecionados.length; | |
| 1269 | - if (nsel != 1) { | |
| 1270 | - alert("Selecione primeiro um elemento para ser cortado"); | |
| 1271 | - } else { | |
| 1272 | - i3GEO.editorOL.removeInteracoes(); | |
| 1273 | - i3GEO.janela.tempoMsg("Desenhe um polígono"); | |
| 1274 | - i3GEO.editorOL.marcaBotao("editorOLcorta"); | |
| 1275 | - var draw = new ol.interaction.Draw({ | |
| 1276 | - type : "Polygon" | |
| 1277 | - }); | |
| 1278 | - //adiciona a interacao para poder ser removida | |
| 1279 | - i3GEO.editorOL.interacoes = draw; | |
| 1280 | - i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 1281 | - draw.on("drawend", function(evt) { | |
| 1282 | - var temp, f, c, format, fwkt, cwkt; | |
| 1283 | - f = evt.feature; | |
| 1284 | - c = i3GEO.desenho.layergrafico.getSource().getFeatureById(i3GEO.editorOL.idsSelecionados[nsel - 1]); | |
| 1285 | - i3GEO.editorOL.featuresBackup.push(c.clone()); | |
| 1286 | - i3GEO.editorOL.marcaBotao(); | |
| 1287 | - //corta | |
| 1288 | - format = new ol.format.WKT(); | |
| 1289 | - if(f && c){ | |
| 1290 | - fwkt = format.writeFeatures([f]); | |
| 1291 | - cwkt = format.writeFeatures([c]); | |
| 1292 | - if(fwkt && cwkt){ | |
| 1293 | - temp = function(retorno) { | |
| 1294 | - i3GEO.janela.fechaAguarde("i3GEO.cortador"); | |
| 1295 | - if (retorno != "" && retorno.data && retorno.data != "") { | |
| 1296 | - i3GEO.janela.fechaAguarde("i3GEO.cortador"); | |
| 1297 | - c.setGeometry(format.readGeometry(retorno.data)); | |
| 1298 | - if (document.getElementById("panellistagEditor")) { | |
| 1299 | - i3GEO.editorOL.listaGeometrias(); | |
| 1300 | - } | |
| 1301 | - } | |
| 1302 | - }; | |
| 1303 | - i3GEO.janela.abreAguarde("i3GEO.cortador", "Cortando"); | |
| 1304 | - i3GEO.php.funcoesGeometriasWkt(temp, cwkt + "|" + fwkt, "difference"); | |
| 1305 | - } | |
| 1306 | - } | |
| 1307 | - }); | |
| 1308 | - i3geoOL.addInteraction(draw); | |
| 1309 | - } | |
| 1310 | - }; | |
| 1311 | - return temp; | |
| 1312 | - }, | |
| 1313 | 743 | botaoListaGeometrias: function(){ |
| 1314 | 744 | var temp = document.createElement("div"); |
| 1315 | 745 | temp.className = "editorOLlistagItemInactive olButton"; |
| ... | ... | @@ -1319,43 +749,6 @@ i3GEO.editorOL = { |
| 1319 | 749 | }; |
| 1320 | 750 | return temp; |
| 1321 | 751 | }, |
| 1322 | - botaoNovaaba: function(){ | |
| 1323 | - var temp = document.createElement("div"); | |
| 1324 | - temp.className = "editorOLnovaabaItemInactive olButton"; | |
| 1325 | - temp.title = $trad("novaaba"); | |
| 1326 | - temp.onclick = function(){ | |
| 1327 | - window.open(window.location, '_blank'); | |
| 1328 | - }; | |
| 1329 | - return temp; | |
| 1330 | - }, | |
| 1331 | - botaoAjuda: function(){ | |
| 1332 | - var temp = document.createElement("div"); | |
| 1333 | - temp.className = "editorOLajudaItemInactive olButton"; | |
| 1334 | - temp.title = $trad("s1"); | |
| 1335 | - temp.onclick = function(){ | |
| 1336 | - if(i3GEO.configura && i3GEO.configura.locaplic){ | |
| 1337 | - i3GEO.janela.cria("400px", "200px", i3GEO.configura.locaplic | |
| 1338 | - + "/ferramentas/editorol/openlayers_ajuda.php?completo=none", "", "", "<span class='i3GeoTituloJanelaBsNolink' >"+$trad("s1")+"</span></div>", "editorOlAjuda"); | |
| 1339 | - } | |
| 1340 | - else{ | |
| 1341 | - window.open("openlayers_ajuda.php"); | |
| 1342 | - } | |
| 1343 | - }; | |
| 1344 | - return temp; | |
| 1345 | - }, | |
| 1346 | - botaoFecha: function(){ | |
| 1347 | - var temp = document.createElement("div"); | |
| 1348 | - temp.className = "editorOLfechaItemInactive olButton"; | |
| 1349 | - temp.title = $trad("x74"); | |
| 1350 | - temp.onclick = function(){ | |
| 1351 | - i3GEO.editorOL.unselTodos(); | |
| 1352 | - i3GEO.editorOL.featuresBackup = []; | |
| 1353 | - i3GEO.editorOL.marcaBotao(); | |
| 1354 | - i3GEO.eventos.cliquePerm.ativa(); | |
| 1355 | - $i("i3GEObarraEdicao").style.display = "none"; | |
| 1356 | - }; | |
| 1357 | - return temp; | |
| 1358 | - }, | |
| 1359 | 752 | botaoTools: function(){ |
| 1360 | 753 | var temp = document.createElement("div"); |
| 1361 | 754 | temp.className = "editorOLtoolsItemInactive olButton"; |
| ... | ... | @@ -1379,128 +772,6 @@ i3GEO.editorOL = { |
| 1379 | 772 | }; |
| 1380 | 773 | return temp; |
| 1381 | 774 | }, |
| 1382 | - botaoImprimir: function(){ | |
| 1383 | - var temp = document.createElement("div"); | |
| 1384 | - temp.className = "editorOLimprimirItemInactive olButton"; | |
| 1385 | - temp.onclick = function(){ | |
| 1386 | - window.print(); | |
| 1387 | - }; | |
| 1388 | - return temp; | |
| 1389 | - }, | |
| 1390 | - botaoGrid: function(){ | |
| 1391 | - var temp = document.createElement("div"); | |
| 1392 | - temp.className = "editorOLgridItemInactive olButton"; | |
| 1393 | - temp.onclick = function(){ | |
| 1394 | - var p = {"map": i3GEO.editorOL.mapa,"targetSize": 200}; | |
| 1395 | - if(!i3GEO.editorOL.grid){ | |
| 1396 | - i3GEO.editorOL.grid = new ol.Graticule(p); | |
| 1397 | - } else { | |
| 1398 | - if(i3GEO.editorOL.grid.getMap() == null){ | |
| 1399 | - i3GEO.editorOL.grid.setMap(i3GEO.editorOL.mapa); | |
| 1400 | - } else { | |
| 1401 | - i3GEO.editorOL.grid.setMap(null); | |
| 1402 | - } | |
| 1403 | - } | |
| 1404 | - }; | |
| 1405 | - return temp; | |
| 1406 | - }, | |
| 1407 | - botaoIdentifica: function(){ | |
| 1408 | - i3GEO.eventos.cliquePerm.desativa(); | |
| 1409 | - var temp = document.createElement("div"); | |
| 1410 | - temp.className = "editorOLidentificaItemInactive olButton"; | |
| 1411 | - temp.title = $trad("d7t"); | |
| 1412 | - temp.onclick = function(){ | |
| 1413 | - | |
| 1414 | - if(i3GEO.editorOL.layerDefault == ""){ | |
| 1415 | - i3GEO.editorOL.criaJanelaAtivaTema(); | |
| 1416 | - } | |
| 1417 | - i3GEO.eventos.cliquePerm.desativa(); | |
| 1418 | - i3GEO.editorOL.removeInteracoes(); | |
| 1419 | - i3GEO.editorOL.marcaBotao("editorOLidentifica"); | |
| 1420 | - var draw = new ol.interaction.Draw({ | |
| 1421 | - type : "Point" | |
| 1422 | - }); | |
| 1423 | - //adiciona a interacao para poder ser removida | |
| 1424 | - i3GEO.editorOL.interacoes = draw; | |
| 1425 | - i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 1426 | - draw.on("drawend", function(evt) { | |
| 1427 | - var xy, p, retorno, url, layer, tema = $i("i3GEOOLlistaTemasAtivos"); | |
| 1428 | - if(tema){ | |
| 1429 | - layer = i3geoOL.getLayersByName(tema.value)[0]; | |
| 1430 | - if(layer.getSource().getUrls){ | |
| 1431 | - url = layer.getSource().getUrls()[0]; | |
| 1432 | - } | |
| 1433 | - else{ | |
| 1434 | - url = layer.getSource().getUrl(); | |
| 1435 | - } | |
| 1436 | - | |
| 1437 | - //xy = evt.target.downPx_; | |
| 1438 | - xy = evt.feature.getGeometry().getFirstCoordinate(); | |
| 1439 | - retorno = function(r){ | |
| 1440 | - var valorunico = "", camada = null, texto = "", lonlattexto, xy, temp, temp1, n, i, f = [], textoN = r.split(":"); | |
| 1441 | - if(i3GEO.arvoreDeCamadas){ | |
| 1442 | - camada = i3GEO.arvoreDeCamadas.pegaTema(tema.value, "", "name"); | |
| 1443 | - } | |
| 1444 | - xy = evt.feature.getGeometry().getFirstCoordinate(); | |
| 1445 | - i3GEO.eventos.cliquePerm.ativo = true; | |
| 1446 | - try { | |
| 1447 | - if (textoN.length > 1) { | |
| 1448 | - textoN.shift(); | |
| 1449 | - textoN.shift(); | |
| 1450 | - temp = textoN.join(":"); | |
| 1451 | - temp = temp.replace(/'/g, ""); | |
| 1452 | - temp = temp.replace(/\n/g, "|"); | |
| 1453 | - temp = temp.replace(/_/g, " "); | |
| 1454 | - //temp = temp.replace(/=/g, ":"); | |
| 1455 | - temp = temp.split("|"); | |
| 1456 | - n = temp.length; | |
| 1457 | - for (i = 0; i < n; i++) { | |
| 1458 | - temp1 = temp[i].replace(/^\s+/, ""); | |
| 1459 | - temp1 = temp1.replace(/\s+$/, ""); | |
| 1460 | - if (temp1 != ""){ | |
| 1461 | - //verifica se a coluna eh o idunico e pega o valor | |
| 1462 | - if(camada && camada.colunaidunico != "" && temp1.split("=")[0].trim() == camada.colunaidunico){ | |
| 1463 | - valorunico = temp1.split("=")[1].trim(); | |
| 1464 | - temp1 = "(*) "+temp1; | |
| 1465 | - } | |
| 1466 | - f.push(temp1); | |
| 1467 | - } | |
| 1468 | - } | |
| 1469 | - texto = "<pre>" + f.join("<br>") + "</pre>"; | |
| 1470 | - } | |
| 1471 | - } catch (e) {} | |
| 1472 | - //funcao para capturar a geometria | |
| 1473 | - lonlattexto = | |
| 1474 | - "<span style=font-size:12px;color:blue;cursor:pointer onclick='i3GEO.editorOL.captura(" + xy[0] | |
| 1475 | - + "," | |
| 1476 | - + xy[1] | |
| 1477 | - + ",\"" | |
| 1478 | - + tema.value | |
| 1479 | - + "\"" | |
| 1480 | - + ",\"" | |
| 1481 | - + valorunico | |
| 1482 | - + "\")'>edita geometria</span><br>"; | |
| 1483 | - i3GEO.Interface.openlayers.balao("<div style='text-align:left' >" + lonlattexto + texto + "</div>","", xy[0], xy[1], false, false); | |
| 1484 | - i3GEO.eventos.cliquePerm.ativo = false; | |
| 1485 | - }; | |
| 1486 | - p = i3GEO.configura.locaplic + "/classesphp/proxy.php?" | |
| 1487 | - + url | |
| 1488 | - + "&tipoRetornoProxy=string&REQUEST=GetFeatureInfo&TIPOIMAGEM=nenhum&DESLIGACACHE=sim&STYLES=&SERVICE=WMS&VERSION=1.1.1&FEATURE_COUNT=1" | |
| 1489 | - + "&FORMAT=image/png&INFO_FORMAT=text/plain&SRS=EPSG:4326" | |
| 1490 | - + "&LAYERS=" + tema.value | |
| 1491 | - + "&layer=" + tema.value | |
| 1492 | - + "&QUERY_LAYERS=" + tema.value | |
| 1493 | - + "&HEIGHT=" + i3geoOL.getSize()[1] | |
| 1494 | - + "&WIDTH=" + i3geoOL.getSize()[0] | |
| 1495 | - + "&BBOX=" + i3geoOL.getExtent().toBBOX().split(",").join(" ") | |
| 1496 | - + "&X=" + xy[0] + "&Y=" + xy[1]; | |
| 1497 | - cpJSON.call(p, "foo", retorno, ""); | |
| 1498 | - } | |
| 1499 | - }); | |
| 1500 | - i3geoOL.addInteraction(draw); | |
| 1501 | - }; | |
| 1502 | - return temp; | |
| 1503 | - }, | |
| 1504 | 775 | botaoSalva: function(){ |
| 1505 | 776 | var temp = document.createElement("div"); |
| 1506 | 777 | temp.className = "editorOLsalvaItemInactive olButton"; |
| ... | ... | @@ -1510,126 +781,6 @@ i3GEO.editorOL = { |
| 1510 | 781 | }; |
| 1511 | 782 | return temp; |
| 1512 | 783 | }, |
| 1513 | - criaBotoes : function(botoes,onde) { | |
| 1514 | - if(onde){ | |
| 1515 | - i3GEOpanelEditor = $i(onde); | |
| 1516 | - } else { | |
| 1517 | - if($i("i3GEObarraEdicao")){ | |
| 1518 | - $i("i3GEObarraEdicao").style.display = "block"; | |
| 1519 | - return; | |
| 1520 | - } | |
| 1521 | - //cria o painel onde entrarao os icones | |
| 1522 | - i3GEOpanelEditor = document.createElement("div"); | |
| 1523 | - i3GEOpanelEditor.id = "i3GEObarraEdicao"; | |
| 1524 | - i3GEOpanelEditor.className = "olControlEditingToolbar1 noprint"; | |
| 1525 | - } | |
| 1526 | - //cria os icones | |
| 1527 | - if (botoes.imprimir === true) { | |
| 1528 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoImprimir()); | |
| 1529 | - } | |
| 1530 | - if (botoes.grid === true) { | |
| 1531 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoGrid()); | |
| 1532 | - } | |
| 1533 | - if (botoes.novaaba === true) { | |
| 1534 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoNovaaba()); | |
| 1535 | - } | |
| 1536 | - if (botoes.procura === true) { | |
| 1537 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoProcura()); | |
| 1538 | - } | |
| 1539 | - if (botoes.pan === true) { | |
| 1540 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPan()); | |
| 1541 | - } | |
| 1542 | - if (botoes.zoombox === true) { | |
| 1543 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoZoomBox()); | |
| 1544 | - } | |
| 1545 | - if (botoes.zoomtot === true) { | |
| 1546 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoZoomTot()); | |
| 1547 | - } | |
| 1548 | - if (botoes.zoomin === true) { | |
| 1549 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoZoomIn()); | |
| 1550 | - } | |
| 1551 | - if (botoes.zoomout === true) { | |
| 1552 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoZoomOut()); | |
| 1553 | - } | |
| 1554 | - if (botoes.legenda === true) { | |
| 1555 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoLegenda()); | |
| 1556 | - } | |
| 1557 | - if (botoes.distancia === true) { | |
| 1558 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoDistancia()); | |
| 1559 | - } | |
| 1560 | - if (botoes.area === true) { | |
| 1561 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoArea()); | |
| 1562 | - } | |
| 1563 | - if (botoes.identifica === true) { | |
| 1564 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoIdentifica()); | |
| 1565 | - } | |
| 1566 | - if (botoes.linha === true) { | |
| 1567 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoLinha()); | |
| 1568 | - } | |
| 1569 | - if (botoes.ponto === true) { | |
| 1570 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPonto()); | |
| 1571 | - } | |
| 1572 | - if (botoes.poligono === true) { | |
| 1573 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPoligono()); | |
| 1574 | - } | |
| 1575 | - if (botoes.texto === true) { | |
| 1576 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoTexto()); | |
| 1577 | - } | |
| 1578 | - if (botoes.edita === true) { | |
| 1579 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoEdita()); | |
| 1580 | - } | |
| 1581 | - if (botoes.selecao === true) { | |
| 1582 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoSelecao()); | |
| 1583 | - } | |
| 1584 | - if (botoes.selecaotudo === true) { | |
| 1585 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoSelecaoTudo()); | |
| 1586 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoUnselTodos()); | |
| 1587 | - } | |
| 1588 | - if (botoes.apaga === true) { | |
| 1589 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoApaga()); | |
| 1590 | - } | |
| 1591 | - if (botoes.frente === true) { | |
| 1592 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoFrente()); | |
| 1593 | - } | |
| 1594 | - if (botoes.edita === true && botoes.corta === true && i3GEO.php) { | |
| 1595 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoCorta()); | |
| 1596 | - } | |
| 1597 | - if (botoes.edita === true && botoes.listag === true) { | |
| 1598 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoListaGeometrias()); | |
| 1599 | - } | |
| 1600 | - if (botoes.tools === true) { | |
| 1601 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoTools()); | |
| 1602 | - } | |
| 1603 | - if (botoes.propriedades === true) { | |
| 1604 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPropriedades()); | |
| 1605 | - } | |
| 1606 | - if (botoes.salva === true) { | |
| 1607 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoSalva()); | |
| 1608 | - } | |
| 1609 | - if (botoes.ajuda === true) { | |
| 1610 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoAjuda()); | |
| 1611 | - } | |
| 1612 | - if (botoes.fecha === true) { | |
| 1613 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoFecha()); | |
| 1614 | - } | |
| 1615 | - if(!onde){ | |
| 1616 | - i3GEOpanelEditor.style.width = i3GEOpanelEditor.getElementsByTagName("div").length * 33 + "px"; | |
| 1617 | - i3GEO.editorOL.mapa.getViewport().getElementsByClassName("ol-overlaycontainer-stopevent")[0].appendChild(i3GEOpanelEditor); | |
| 1618 | - } | |
| 1619 | - }, | |
| 1620 | - removeFeaturesSel : function(){ | |
| 1621 | - var s, i, nsel, f; | |
| 1622 | - nsel = i3GEO.editorOL.idsSelecionados.length; | |
| 1623 | - s = i3GEO.desenho.layergrafico.getSource(); | |
| 1624 | - for(i=0; i<nsel; i++){ | |
| 1625 | - f = s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]); | |
| 1626 | - if(f){ | |
| 1627 | - i3GEO.editorOL.featuresBackup.push(f.clone()); | |
| 1628 | - s.removeFeature(f); | |
| 1629 | - } | |
| 1630 | - } | |
| 1631 | - i3GEO.editorOL.idsSelecionados = []; | |
| 1632 | - }, | |
| 1633 | 784 | mudaSimbolo : function(estilo, obj) { |
| 1634 | 785 | var s, i, nsel, f; |
| 1635 | 786 | i3GEO.editorOL.simbologia[estilo] = obj.value; |
| ... | ... | @@ -1687,36 +838,6 @@ i3GEO.editorOL = { |
| 1687 | 838 | }) |
| 1688 | 839 | }); |
| 1689 | 840 | i3geoOL.addLayer(layerkml); |
| 1690 | - /* | |
| 1691 | - temp = function(pixel) { | |
| 1692 | - var feature, chaves, c, i = 0, html = "", prop, g; | |
| 1693 | - feature = i3geoOL.forEachFeatureAtPixel(pixel, function(feature, layer) { | |
| 1694 | - return feature; | |
| 1695 | - }); | |
| 1696 | - if (feature) { | |
| 1697 | - i3GEO.Interface.openlayers.BALAOPROP.removeAoAdicionar = false; | |
| 1698 | - i3GEO.Interface.openlayers.BALAOPROP.classeCadeado = "i3GEOiconeFechado"; | |
| 1699 | - chaves = feature.getKeys(); | |
| 1700 | - prop = feature.getProperties(); | |
| 1701 | - c = chaves.length; | |
| 1702 | - for (i = 0; i < c; i++) { | |
| 1703 | - if (chaves[i] != "geometry" && chaves[i] != "styleUrl") { | |
| 1704 | - html += chaves[i] + ": " + prop[chaves[i]]; | |
| 1705 | - } | |
| 1706 | - } | |
| 1707 | - g = feature.getGeometry().getCoordinates(); | |
| 1708 | - i3GEO.Interface.openlayers.balao(html, "", g[0], g[1], "kml"); | |
| 1709 | - } | |
| 1710 | - }; | |
| 1711 | - i3geoOL.on('click', function(evt) { | |
| 1712 | - evt.stopPropagation(); | |
| 1713 | - evt.preventDefault(); | |
| 1714 | - if (evt.dragging) { | |
| 1715 | - return; | |
| 1716 | - } | |
| 1717 | - temp(i3geoOL.getEventPixel(evt.originalEvent)); | |
| 1718 | - }); | |
| 1719 | - */ | |
| 1720 | 841 | } |
| 1721 | 842 | }, |
| 1722 | 843 | // obtido de openlayers.org |
| ... | ... | @@ -2075,149 +1196,6 @@ i3GEO.editorOL = { |
| 2075 | 1196 | } |
| 2076 | 1197 | return lista; |
| 2077 | 1198 | }, |
| 2078 | - guardaBackup : function() { | |
| 2079 | - return; | |
| 2080 | - // if(!i3GEO.editorOL.backup) | |
| 2081 | - // {i3GEO.editorOL.backup = new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false});} | |
| 2082 | - // else | |
| 2083 | - // {i3GEO.editorOL.backup.removeFeatures(i3GEO.editorOL.backup.features);} | |
| 2084 | - // i3GEO.editorOL.backup.addFeatures(i3GEO.desenho.layergrafico.features); | |
| 2085 | - }, | |
| 2086 | - selTodos : function(idfeature) { | |
| 2087 | - if(!idfeature){ | |
| 2088 | - i3GEO.editorOL.unselTodos(); | |
| 2089 | - } | |
| 2090 | - var features, n, f, i, id, st; | |
| 2091 | - features = i3GEO.desenho.layergrafico.getSource().getFeatures(); | |
| 2092 | - n = features.length; | |
| 2093 | - for (i = 0; i < n; i++) { | |
| 2094 | - f = features[i]; | |
| 2095 | - id = f.getId(); | |
| 2096 | - if(idfeature && idfeature != id){ | |
| 2097 | - continue; | |
| 2098 | - } | |
| 2099 | - if(!id || id == "" || id == undefined ){ | |
| 2100 | - id = i3GEO.util.uid(); | |
| 2101 | - f.setId(id); | |
| 2102 | - } | |
| 2103 | - | |
| 2104 | - if(i3GEO.editorOL.idsSelecionados.indexOf(id) < 0){ | |
| 2105 | - i3GEO.editorOL.idsSelecionados.push(id); | |
| 2106 | - } | |
| 2107 | - st = f.getStyle(); | |
| 2108 | - //para o caso de pontos | |
| 2109 | - if(st && st.getImage()){ | |
| 2110 | - f.setStyle( | |
| 2111 | - new ol.style.Style({ | |
| 2112 | - image: new ol.style.Circle({ | |
| 2113 | - radius: i3GEO.editorOL.simbologia.pointRadius, | |
| 2114 | - fill: new ol.style.Fill({ | |
| 2115 | - color: 'rgba(255, 255, 255, 0.5)' | |
| 2116 | - }), | |
| 2117 | - stroke: new ol.style.Stroke({ | |
| 2118 | - color: 'blue', | |
| 2119 | - width: i3GEO.editorOL.simbologia.pointRadius / 3 | |
| 2120 | - }) | |
| 2121 | - }) | |
| 2122 | - }) | |
| 2123 | - ); | |
| 2124 | - if(st.getImage().getSrc){ | |
| 2125 | - f.setProperties({ | |
| 2126 | - fillColor: "", | |
| 2127 | - strokeColor: "", | |
| 2128 | - externalGraphic: st.getImage().getSrc(), | |
| 2129 | - graphicHeight : st.getImage().getSize()[1], | |
| 2130 | - graphicWidth : st.getImage().getSize()[0] | |
| 2131 | - }); | |
| 2132 | - } | |
| 2133 | - else{ | |
| 2134 | - f.setProperties({ | |
| 2135 | - fillColor: st.getImage().getFill().getColor(), | |
| 2136 | - strokeColor: st.getImage().getStroke().getColor(), | |
| 2137 | - externalGraphic: "", | |
| 2138 | - graphicHeight: "", | |
| 2139 | - graphicWidth: "" | |
| 2140 | - }); | |
| 2141 | - } | |
| 2142 | - } | |
| 2143 | - else if (st){ | |
| 2144 | - if(st.getFill()){ | |
| 2145 | - f.setProperties({ | |
| 2146 | - fillColor: st.getFill().getColor() | |
| 2147 | - }); | |
| 2148 | - } | |
| 2149 | - if(st.getStroke()){ | |
| 2150 | - f.setProperties({ | |
| 2151 | - strokeColor: st.getStroke().getColor() | |
| 2152 | - }); | |
| 2153 | - } | |
| 2154 | - if(st.getFill()){ | |
| 2155 | - st.getFill().setColor('rgba(255, 255, 255, 0.5)'); | |
| 2156 | - } | |
| 2157 | - if(st.getStroke()){ | |
| 2158 | - st.getStroke().setColor('blue'); | |
| 2159 | - } | |
| 2160 | - } | |
| 2161 | - } | |
| 2162 | - i3GEO.desenho.layergrafico.getSource().changed(); | |
| 2163 | - }, | |
| 2164 | - unselTodos : function(id) { | |
| 2165 | - var i, n, f, s, st; | |
| 2166 | - s = i3GEO.desenho.layergrafico.getSource(); | |
| 2167 | - n = i3GEO.editorOL.idsSelecionados.length; | |
| 2168 | - for(i=0; i<n; i++){ | |
| 2169 | - if(id && id != i3GEO.editorOL.idsSelecionados[i]){ | |
| 2170 | - continue; | |
| 2171 | - } | |
| 2172 | - f = s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]); | |
| 2173 | - if(f){ | |
| 2174 | - st = f.getStyle(); | |
| 2175 | - //caso de ponto | |
| 2176 | - if(st && st.getImage()){ | |
| 2177 | - if(st.getImage().getSrc || f.getProperties().externalGraphic != ""){ | |
| 2178 | - f.setStyle( | |
| 2179 | - new ol.style.Style({ | |
| 2180 | - image: new ol.style.Icon({ | |
| 2181 | - src : f.getProperties().externalGraphic, | |
| 2182 | - size : [f.getProperties().graphicWidth,f.getProperties().graphicHeight] | |
| 2183 | - }) | |
| 2184 | - }) | |
| 2185 | - ); | |
| 2186 | - } | |
| 2187 | - else{ | |
| 2188 | - f.setStyle( | |
| 2189 | - new ol.style.Style({ | |
| 2190 | - image: new ol.style.Circle({ | |
| 2191 | - radius: i3GEO.editorOL.simbologia.pointRadius, | |
| 2192 | - fill: new ol.style.Fill({ | |
| 2193 | - color: f.getProperties().fillColor | |
| 2194 | - }), | |
| 2195 | - stroke: new ol.style.Stroke({ | |
| 2196 | - color: f.getProperties().strokeColor, | |
| 2197 | - width: i3GEO.editorOL.simbologia.pointRadius / 3 | |
| 2198 | - }) | |
| 2199 | - }) | |
| 2200 | - }) | |
| 2201 | - ); | |
| 2202 | - } | |
| 2203 | - } | |
| 2204 | - else if(st){ | |
| 2205 | - if(f.getProperties().fillColor){ | |
| 2206 | - st.getFill().setColor(f.getProperties().fillColor); | |
| 2207 | - } | |
| 2208 | - if(f.getProperties().strokeColor){ | |
| 2209 | - st.getStroke().setColor(f.getProperties().strokeColor); | |
| 2210 | - } | |
| 2211 | - } | |
| 2212 | - } | |
| 2213 | - } | |
| 2214 | - if(id){ | |
| 2215 | - i3GEO.editorOL.idsSelecionados.remove(id); | |
| 2216 | - } else { | |
| 2217 | - i3GEO.editorOL.idsSelecionados = []; | |
| 2218 | - } | |
| 2219 | - i3GEO.desenho.layergrafico.getSource().changed(); | |
| 2220 | - }, | |
| 2221 | 1199 | unselTodosBackup : function() { |
| 2222 | 1200 | var n, i; |
| 2223 | 1201 | n = i3GEO.editorOL.backup.features.length; |
| ... | ... | @@ -2226,30 +1204,6 @@ i3GEO.editorOL = { |
| 2226 | 1204 | i3GEO.editorOL.selbutton.unselect(i3GEO.editorOL.backup.features[i]); |
| 2227 | 1205 | } |
| 2228 | 1206 | }, |
| 2229 | - unselFeature : function(id) { | |
| 2230 | - i3GEO.editorOL.unselTodos(id); | |
| 2231 | - /* | |
| 2232 | - var f, s; | |
| 2233 | - s = i3GEO.desenho.layergrafico.getSource(); | |
| 2234 | - f = s.getFeatureById(id); | |
| 2235 | - if(f && f.getStyle()){ | |
| 2236 | - if(f.getStyle().getSrc){ | |
| 2237 | - f.getStyle().setSrc(f.getProperties().externalGraphic); | |
| 2238 | - f.getStyle().setSize([f.getProperties().graphicWidth,f.getProperties().graphicHeight]); | |
| 2239 | - } | |
| 2240 | - else{ | |
| 2241 | - if(f.getStyle().getFill()){ | |
| 2242 | - f.getStyle().getFill().setColor(f.getProperties().fillColor); | |
| 2243 | - } | |
| 2244 | - if(f.getStyle().getStroke()){ | |
| 2245 | - f.getStyle().getStroke().setColor(f.getProperties().strokeColor); | |
| 2246 | - } | |
| 2247 | - } | |
| 2248 | - } | |
| 2249 | - i3GEO.editorOL.idsSelecionados.remove(id); | |
| 2250 | - i3GEO.desenho.layergrafico.getSource().changed(); | |
| 2251 | - */ | |
| 2252 | - }, | |
| 2253 | 1207 | restauraBackup : function() { |
| 2254 | 1208 | if (i3GEO.editorOL.backup.features.length > 0) { |
| 2255 | 1209 | i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.features); |
| ... | ... | @@ -2332,33 +1286,6 @@ i3GEO.editorOL = { |
| 2332 | 1286 | if(i3GEO.editorOL.idsSelecionados.indexOf(id) < 0){ |
| 2333 | 1287 | i3GEO.editorOL.selTodos(id); |
| 2334 | 1288 | } |
| 2335 | - /* | |
| 2336 | - var s,f,st,prop = {externalGraphic: ""}; | |
| 2337 | - s = i3GEO.desenho.layergrafico.getSource(); | |
| 2338 | - f = s.getFeatureById(id); | |
| 2339 | - st = f.getStyle(); | |
| 2340 | - | |
| 2341 | - if(st.getImage()){ | |
| 2342 | - st = st.getImage(); | |
| 2343 | - } | |
| 2344 | - if(!i3GEO.util.in_array(id,i3GEO.editorOL.idsSelecionados)){ | |
| 2345 | - i3GEO.editorOL.idsSelecionados.push(id); | |
| 2346 | - if(st.getFill()){ | |
| 2347 | - prop.fillColor = st.getFill().getColor(); | |
| 2348 | - } | |
| 2349 | - if(st.getStroke()){ | |
| 2350 | - prop.strokeColor = st.getStroke().getColor(); | |
| 2351 | - } | |
| 2352 | - f.setProperties(prop); | |
| 2353 | - if(st.getFill()){ | |
| 2354 | - st.getFill().setColor('rgba(255, 255, 255, 0.5)'); | |
| 2355 | - } | |
| 2356 | - if(st.getStroke()){ | |
| 2357 | - st.getStroke().setColor('blue'); | |
| 2358 | - } | |
| 2359 | - s.changed(); | |
| 2360 | - } | |
| 2361 | - */ | |
| 2362 | 1289 | }, |
| 2363 | 1290 | carregajts : function(funcao) { |
| 2364 | 1291 | if (i3GEO.configura) { |
| ... | ... | @@ -2367,22 +1294,6 @@ i3GEO.editorOL = { |
| 2367 | 1294 | i3GEO.util.scriptTag("../pacotes/jsts/lib/jsts.js", funcao, "i3GEOjts", true); |
| 2368 | 1295 | } |
| 2369 | 1296 | }, |
| 2370 | - trazParaFrente : function() { | |
| 2371 | - var s, i, nsel, id, clone; | |
| 2372 | - s = i3GEO.desenho.layergrafico.getSource(); | |
| 2373 | - nsel = i3GEO.editorOL.idsSelecionados.length; | |
| 2374 | - for(i=0; i<nsel; i++){ | |
| 2375 | - f = s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]); | |
| 2376 | - if(f){ | |
| 2377 | - clone = f.clone(); | |
| 2378 | - id = f.getId(); | |
| 2379 | - s.removeFeature(f); | |
| 2380 | - clone.setId(id); | |
| 2381 | - s.addFeature(clone); | |
| 2382 | - } | |
| 2383 | - } | |
| 2384 | - s.changed(); | |
| 2385 | - }, | |
| 2386 | 1297 | pegaControle : function(classe) { |
| 2387 | 1298 | var n = i3GEO.editorOL.controles.length, i; |
| 2388 | 1299 | for (i = 0; i < n; i++) { |
| ... | ... | @@ -2392,37 +1303,11 @@ i3GEO.editorOL = { |
| 2392 | 1303 | } |
| 2393 | 1304 | return false; |
| 2394 | 1305 | }, |
| 2395 | - ativaLayerSwitcher : function() { | |
| 2396 | - var ls = i3GEO.editorOL.pegaControle("OpenLayers.Control.LayerSwitcher"); | |
| 2397 | - if (ls) { | |
| 2398 | - ls.maximizeDiv.click(); | |
| 2399 | - } | |
| 2400 | - }, | |
| 2401 | - desativaRodaDoMouse : function() { | |
| 2402 | - var controls = i3GEO.editorOL.mapa.getControlsByClass('OpenLayers.Control.Navigation'); | |
| 2403 | - for ( var i = 0; i < controls.length; ++i) { | |
| 2404 | - controls[i].disableZoomWheel(); | |
| 2405 | - } | |
| 2406 | - }, | |
| 2407 | 1306 | google2wgs : function(obj) { |
| 2408 | 1307 | if (i3GEO.Interface.openlayers.googleLike === true) { |
| 2409 | 1308 | return obj.transform("EPSG:900913","EPSG:4326"); |
| 2410 | 1309 | } else { |
| 2411 | 1310 | return obj; |
| 2412 | 1311 | } |
| 2413 | - }, | |
| 2414 | - sobeLayersGraficos : function() { | |
| 2415 | - /* | |
| 2416 | - var nlayers = i3GEO.editorOL.mapa.getNumLayers(), layers = i3GEO.editorOL.mapa.layers, i; | |
| 2417 | - for (i = 0; i < nlayers; i++) { | |
| 2418 | - if (layers[i].CLASS_NAME == "OpenLayers.Layer.Vector" && layers[i].name != "Nenhum") { | |
| 2419 | - i3GEO.editorOL.mapa.raiseLayer(i3GEO.editorOL.mapa.layers[i], nlayers); | |
| 2420 | - } | |
| 2421 | - } | |
| 2422 | - */ | |
| 2423 | 1312 | } |
| 2424 | -}; | |
| 2425 | -//para compatibilidade com OpenLayers 2x | |
| 2426 | -i3GEO.editorOL.backup.getFeatures = function() { | |
| 2427 | - return i3GEO.editorOL.backup.getSource().getFeatures(); | |
| 2428 | 1313 | }; |
| 2429 | 1314 | \ No newline at end of file | ... | ... |
imagens/gisicons/eudock/area-measure.png
2.73 KB
imagens/gisicons/eudock/confluence.png
2.62 KB
imagens/gisicons/eudock/editopen.png
3.11 KB
imagens/gisicons/eudock/fotos.png
3.05 KB
imagens/gisicons/eudock/google-map.png
3.51 KB
imagens/gisicons/eudock/grafico.png
2.94 KB
imagens/gisicons/eudock/identify.png
3.33 KB
imagens/gisicons/eudock/length-measure.png
1.96 KB
imagens/gisicons/eudock/lente.png
1.87 KB
imagens/gisicons/eudock/map-extent-info.png
2.19 KB
imagens/gisicons/eudock/map-reference.png
2.76 KB
imagens/gisicons/eudock/metar.png
2.76 KB
imagens/gisicons/eudock/monitor.png
1.7 KB
imagens/gisicons/eudock/pan.png
1.37 KB
imagens/gisicons/eudock/point-create.png
2.76 KB
imagens/gisicons/eudock/print.png
1.64 KB
imagens/gisicons/eudock/redraw.png
3.46 KB
imagens/gisicons/eudock/search.png
1.96 KB
imagens/gisicons/eudock/select.png
2.06 KB
imagens/gisicons/eudock/show-legend.png
2.45 KB
imagens/gisicons/eudock/sobe1.png
192 Bytes
imagens/gisicons/eudock/text-add.png
1.46 KB
imagens/gisicons/eudock/tips.png
2.58 KB
imagens/gisicons/eudock/v3d.png
3.08 KB
imagens/gisicons/eudock/wiki.png
3.31 KB
imagens/gisicons/eudock/zoom-extent.png
4.32 KB
imagens/gisicons/eudock/zoom-in.png
3.47 KB
imagens/gisicons/eudock/zoom-last.png
2.25 KB
imagens/gisicons/eudock/zoom-next.png
2.18 KB
imagens/gisicons/eudock/zoom-out.png
3.32 KB
imagens/gisicons/eudock/zoom-region.png
3.66 KB
interface/openlayersdebug.htm
| ... | ... | @@ -37,6 +37,7 @@ |
| 37 | 37 | .foraDoMapa+span>span { |
| 38 | 38 | background-color: yellow; |
| 39 | 39 | } |
| 40 | + | |
| 40 | 41 | </style> |
| 41 | 42 | </head> |
| 42 | 43 | <!-- As palavras entre {{{}}} sao utilizadas para a traducao. Veja i3geo/js/dicionario.js |
| ... | ... | @@ -303,7 +304,6 @@ |
| 303 | 304 | <div class="guiaOverflow" style="height: calc(100% - 45px); width: calc(100% - 5px);"> |
| 304 | 305 | <!-- Esta div acrescenta a lista de layers graficos --> |
| 305 | 306 | <div id="listaLayersGr" style="overflow: none;" data-template="templates/camadaGr.html"></div> |
| 306 | - <div id="listaLayersGrBtn" style="overflow: none;"></div> | |
| 307 | 307 | <!-- Esta div acrescenta a lista de camadas disponiveis no mapa atual --> |
| 308 | 308 | <div id="listaTemas" style="overflow: none;" data-template="templates/camada.html"></div> |
| 309 | 309 | <!-- Esta div acrescenta a lista de de camadas de fundo |
| ... | ... | @@ -988,40 +988,6 @@ |
| 988 | 988 | //ver https://openlayers.org/en/latest/apidoc/ol.View.html |
| 989 | 989 | ViewOptions : { |
| 990 | 990 | |
| 991 | - }, | |
| 992 | - //botoes que sao mostrados no editor vetorial | |
| 993 | - editorButtons : { | |
| 994 | - 'imprimir' : false, | |
| 995 | - 'grid' : false, | |
| 996 | - 'pan' : false, | |
| 997 | - 'zoombox' : false, | |
| 998 | - 'zoomtot' : false, | |
| 999 | - 'zoomin' : false, | |
| 1000 | - 'zoomout' : false, | |
| 1001 | - 'distancia' : false, | |
| 1002 | - 'area' : false, | |
| 1003 | - 'identifica' : false, | |
| 1004 | - 'linha' : true, | |
| 1005 | - 'ponto' : true, | |
| 1006 | - 'poligono' : true, | |
| 1007 | - 'texto' : true, | |
| 1008 | - 'edita' : true, | |
| 1009 | - 'listag' : true, | |
| 1010 | - 'corta' : true, | |
| 1011 | - 'apaga' : true, | |
| 1012 | - 'procura' : false, | |
| 1013 | - 'selecao' : true, | |
| 1014 | - 'selecaotudo' : true, | |
| 1015 | - 'salva' : true, | |
| 1016 | - 'ajuda' : true, | |
| 1017 | - 'propriedades' : true, | |
| 1018 | - 'fecha' : true, | |
| 1019 | - 'tools' : true, | |
| 1020 | - 'undo' : false, | |
| 1021 | - 'frente' : false, | |
| 1022 | - 'legenda' : false, | |
| 1023 | - 'rodadomouse' : true, | |
| 1024 | - 'novaaba' : false | |
| 1025 | 991 | } |
| 1026 | 992 | }, |
| 1027 | 993 | //configuracoes especificas para a interface GoogleMaps | ... | ... |
interface/templates/camadaGr.html
| 1 | -<div class="rangeScale{{{rangeScale}}} list-group condensed" style="cursor: move;"> | |
| 1 | +<div class="list-group condensed" style="cursor: move;"> | |
| 2 | 2 | <div class="checkbox text-left"> |
| 3 | - <label class="rangeScale{{{rangeScale}}} {{{classeCss}}}" style="width: 270px"> | |
| 3 | + <label class="{{{classeCss}}}" style="width: 270px"> | |
| 4 | 4 | <input class="noprint" type="checkbox" value="{{{name}}}" name="{{{name}}}" |
| 5 | 5 | {{{checked}}} onclick="i3geoOL.getLayersGrBy('name','{{{name}}}')[0].setVisibility(this.checked);i3geoOL.getLayersGrBy('name','{{{name}}}')[0].changed()"> |
| 6 | - <span class="checkbox-material noprint"><span class="check"></span></span> {{{iconetema}}} {{{tema}}} <small>{{{rangeScaleMsg}}}</small> | |
| 6 | + <span class="checkbox-material noprint"><span class="check"></span></span> {{{tema}}} | |
| 7 | 7 | </label> |
| 8 | + <a data-target=".listaLayersGrBtn" class="pull-right collapsed" style="margin-top: 0px; padding-top: 0px; padding-bottom: 0px;" type="button" data-toggle="collapse"> </a> | |
| 8 | 9 | </div> |
| 9 | 10 | <div class="clearfix"></div> |
| 10 | - <hr> | |
| 11 | -</div> | |
| 12 | 11 | \ No newline at end of file |
| 12 | +</div> | |
| 13 | +<div class="listaLayersGrBtn collapse" style="overflow: none;"> | |
| 14 | + <button title="{{{dlinha}}}" onclick="i3GEO.editor.drawLineString()" class="btn btn-xs" style="margin: 2px; padding: 2px;"> | |
| 15 | + <img src="{{{locaplic}}}/imagens/gisicons/line-edit.png" style="padding: 1px; border: 1px solid rgb(233, 233, 233)" /> | |
| 16 | + </button> | |
| 17 | + <button title="{{{dpol}}}" onclick="i3GEO.editor.drawPolygon()" class="btn btn-xs" style="margin: 2px; padding: 2px;"> | |
| 18 | + <img src="{{{locaplic}}}/imagens/gisicons/polygon-edit.png" style="padding: 1px; border: 1px solid rgb(233, 233, 233)" /> | |
| 19 | + </button> | |
| 20 | + <button title="{{{dponto}}}" onclick="i3GEO.editor.drawPoint()" class="btn btn-xs" style="margin: 2px; padding: 2px;"> | |
| 21 | + <img src="{{{locaplic}}}/imagens/gisicons/point.png" style="padding: 1px; border: 1px solid rgb(233, 233, 233)" /> | |
| 22 | + </button> | |
| 23 | + <button title="{{{dtexto}}}" onclick="i3GEO.editor.drawText()" class="btn btn-xs" style="margin: 2px; padding: 2px;"> | |
| 24 | + <img src="{{{locaplic}}}/imagens/gisicons/text-add.png" style="padding: 1px; border: 1px solid rgb(233, 233, 233)" /> | |
| 25 | + </button> | |
| 26 | + <button title="{{{modf}}}" onclick="i3GEO.editor.edit()" class="btn btn-xs" style="margin: 2px; padding: 2px;"> | |
| 27 | + <img src="{{{locaplic}}}/imagens/gisicons/edit.png" style="padding: 1px; border: 1px solid rgb(233, 233, 233)" /> | |
| 28 | + </button> | |
| 29 | + <button title="{{{d24t}}}" onclick="i3GEO.editor.selectOne()" class="btn btn-xs" style="margin: 2px; padding: 2px;"> | |
| 30 | + <img src="{{{locaplic}}}/imagens/gisicons/select-one.png" style="padding: 1px; border: 1px solid rgb(233, 233, 233)" /> | |
| 31 | + </button> | |
| 32 | + <button title="{{{ustudo}}}" onclick="i3GEO.editor.unselAll()" class="btn btn-xs" style="margin: 2px; padding: 2px;"> | |
| 33 | + <img src="{{{locaplic}}}/imagens/gisicons/select-cancel.png" style="padding: 1px; border: 1px solid rgb(233, 233, 233)" /> | |
| 34 | + </button> | |
| 35 | + <button title="{{{studo}}}" onclick="i3GEO.editor.selAll()" class="btn btn-xs" style="margin: 2px; padding: 2px;"> | |
| 36 | + <img src="{{{locaplic}}}/imagens/gisicons/selectall.png" style="padding: 1px; border: 1px solid rgb(233, 233, 233)" /> | |
| 37 | + </button> | |
| 38 | + <button title="{{{excsel}}}" onclick="i3GEO.editor.selDelete()" class="btn btn-xs" style="margin: 2px; padding: 2px;"> | |
| 39 | + <img src="{{{locaplic}}}/imagens/gisicons/selected-delete.png" style="padding: 1px; border: 1px solid rgb(233, 233, 233)" /> | |
| 40 | + </button> | |
| 41 | + <button title="{{{frente}}}" onclick="i3GEO.editor.orderToFront()" class="btn btn-xs" style="margin: 2px; padding: 2px;"> | |
| 42 | + <img src="{{{locaplic}}}/imagens/gisicons/order-to-front.png" style="padding: 1px; border: 1px solid rgb(233, 233, 233)" /> | |
| 43 | + </button> | |
| 44 | + <button title="{{{cortaf}}}" onclick="i3GEO.editor.editCut()" class="btn btn-xs" style="margin: 2px; padding: 2px;"> | |
| 45 | + <img src="{{{locaplic}}}/imagens/gisicons/edit-cut.png" style="padding: 1px; border: 1px solid rgb(233, 233, 233)" /> | |
| 46 | + </button> | |
| 47 | +</div> | |
| 48 | +<hr> | |
| 13 | 49 | \ No newline at end of file | ... | ... |
js/analise.js
| ... | ... | @@ -185,7 +185,11 @@ i3GEO.analise = |
| 185 | 185 | "i3GEO.analise.atualizaLinhaDoTempo()" |
| 186 | 186 | ]); |
| 187 | 187 | } catch (e) { |
| 188 | - i3GEO.eventos.removeEventos("NAVEGAMAPA", [ | |
| 188 | + | |
| 189 | + if (typeof (console) !== 'undefined') | |
| 190 | + console.error(e.message) | |
| 191 | + | |
| 192 | + i3GEO.eventos.removeEventos("NAVEGAMAPA", [ | |
| 189 | 193 | "i3GEO.analise.atualizaLinhaDoTempo()" |
| 190 | 194 | ]); |
| 191 | 195 | } | ... | ... |
js/arvoredecamadas.js
| ... | ... | @@ -139,7 +139,6 @@ i3GEO.arvoreDeCamadas = |
| 139 | 139 | } |
| 140 | 140 | }); |
| 141 | 141 | } |
| 142 | - | |
| 143 | 142 | if(!i3GEO.template.camada || !i3GEO.template.camadaFundo){ |
| 144 | 143 | i3GEO.arvoreDeCamadas.carregaTemplates(); |
| 145 | 144 | return; |
| ... | ... | @@ -160,9 +159,9 @@ i3GEO.arvoreDeCamadas = |
| 160 | 159 | } |
| 161 | 160 | } |
| 162 | 161 | }, |
| 163 | - atualizaLayersGr : function(){ | |
| 162 | + adicionaLayersGr : function(){ | |
| 164 | 163 | if (typeof (console) !== 'undefined') |
| 165 | - console.info("i3GEO.arvoreDeCamadas.atualizaLayersGr()"); | |
| 164 | + console.info("i3GEO.arvoreDeCamadas.adicionaLayersGr()"); | |
| 166 | 165 | |
| 167 | 166 | if (i3GEO.Interface.ATUAL != "openlayers") { |
| 168 | 167 | return; |
| ... | ... | @@ -174,9 +173,10 @@ i3GEO.arvoreDeCamadas = |
| 174 | 173 | if(temp){ |
| 175 | 174 | $.each( layers, function( i,layer ) { |
| 176 | 175 | var p = layer.getProperties(); |
| 177 | - camada = {}; | |
| 176 | + camada = {...i3GEO.idioma.OBJETOIDIOMA}; | |
| 178 | 177 | camada.name = p.name; |
| 179 | 178 | camada.tema = p.title; |
| 179 | + camada.locaplic = i3GEO.configura.locaplic; | |
| 180 | 180 | //ligado ou desligado |
| 181 | 181 | if(layer.getVisible() == true ){ |
| 182 | 182 | camada.checked = "checked"; |
| ... | ... | @@ -191,7 +191,6 @@ i3GEO.arvoreDeCamadas = |
| 191 | 191 | ); |
| 192 | 192 | |
| 193 | 193 | $(temp).html(t); |
| 194 | - | |
| 195 | 194 | } |
| 196 | 195 | }, |
| 197 | 196 | /** |
| ... | ... | @@ -345,6 +344,7 @@ i3GEO.arvoreDeCamadas = |
| 345 | 344 | }); |
| 346 | 345 | } |
| 347 | 346 | i3GEO.arvoreDeCamadas.adicionaCamadasDeFundo(config); |
| 347 | + i3GEO.arvoreDeCamadas.adicionaLayersGr(); | |
| 348 | 348 | i3GEO.eventos.executaEventos(i3GEO.eventos.ATUALIZAARVORECAMADAS); |
| 349 | 349 | /* |
| 350 | 350 | |
| ... | ... | @@ -899,6 +899,9 @@ i3GEO.arvoreDeCamadas = |
| 899 | 899 | } |
| 900 | 900 | return (true); |
| 901 | 901 | } catch (e) { |
| 902 | + if (typeof (console) !== 'undefined') | |
| 903 | + console.error(e.message) | |
| 904 | + | |
| 902 | 905 | return true; |
| 903 | 906 | } |
| 904 | 907 | }, |
| ... | ... | @@ -1062,6 +1065,9 @@ i3GEO.arvoreDeCamadas = |
| 1062 | 1065 | } while (i < nelementos); |
| 1063 | 1066 | } |
| 1064 | 1067 | } catch (e) { |
| 1068 | + if (typeof (console) !== 'undefined') | |
| 1069 | + console.error(e.message) | |
| 1070 | + | |
| 1065 | 1071 | return ""; |
| 1066 | 1072 | } |
| 1067 | 1073 | return temp; | ... | ... |
js/arvoredetemas.js
js/calculo.js
| ... | ... | @@ -80,7 +80,10 @@ i3GEO.calculo = |
| 80 | 80 | } |
| 81 | 81 | return (dd); |
| 82 | 82 | } catch (e) { |
| 83 | - return (0); | |
| 83 | + if (typeof (console) !== 'undefined') | |
| 84 | + console.error(e.message) | |
| 85 | + | |
| 86 | + return (0); | |
| 84 | 87 | } |
| 85 | 88 | }, |
| 86 | 89 | /** |
| ... | ... | @@ -146,6 +149,9 @@ i3GEO.calculo = |
| 146 | 149 | (vy / c) + pos[1] |
| 147 | 150 | ]; |
| 148 | 151 | } catch (e) { |
| 152 | + if (typeof (console) !== 'undefined') | |
| 153 | + console.error(e.message) | |
| 154 | + | |
| 149 | 155 | return ([]); |
| 150 | 156 | } |
| 151 | 157 | }, |
| ... | ... | @@ -284,6 +290,9 @@ i3GEO.calculo = |
| 284 | 290 | latdd |
| 285 | 291 | ]; |
| 286 | 292 | } catch (e) { |
| 293 | + if (typeof (console) !== 'undefined') | |
| 294 | + console.error(e.message) | |
| 295 | + | |
| 287 | 296 | return (0); |
| 288 | 297 | } |
| 289 | 298 | }, |
| ... | ... | @@ -330,6 +339,10 @@ i3GEO.calculo = |
| 330 | 339 | } |
| 331 | 340 | return $polygon_area * pixel; |
| 332 | 341 | } catch (e) { |
| 342 | + | |
| 343 | + if (typeof (console) !== 'undefined') | |
| 344 | + console.error(e.message) | |
| 345 | + | |
| 333 | 346 | return (0); |
| 334 | 347 | } |
| 335 | 348 | }, | ... | ... |
js/desenho.js
| ... | ... | @@ -38,534 +38,539 @@ |
| 38 | 38 | * 330, Boston, MA 02111-1307 USA. |
| 39 | 39 | */ |
| 40 | 40 | if (typeof (i3GEO) === 'undefined') { |
| 41 | - var i3GEO = {}; | |
| 41 | + var i3GEO = {}; | |
| 42 | 42 | } |
| 43 | 43 | i3GEO.desenho = |
| 44 | - { | |
| 45 | - /** | |
| 46 | - * Constant: layergrafico | |
| 47 | - * | |
| 48 | - * Objeto LAYER para a interface OpenLayers criado com i3GEO.desenho.openlayers.criaLayerGrafico | |
| 49 | - * | |
| 50 | - * Tipo: | |
| 51 | - * | |
| 52 | - * {OpenLayers.Layer.Vector} | |
| 53 | - * | |
| 54 | - */ | |
| 55 | - layergrafico : null, | |
| 56 | - /** | |
| 57 | - * Propriedade: estilos | |
| 58 | - * | |
| 59 | - * Estilos que podem ser utilizados para desenhar os elementos | |
| 60 | - * | |
| 61 | - * Tipo: | |
| 62 | - * | |
| 63 | - * {objeto} | |
| 64 | - */ | |
| 65 | - estilos : { | |
| 66 | - "normal" : { | |
| 67 | - fillcolor : '#ffffff', | |
| 68 | - linecolor : '#ffcc33', | |
| 69 | - linewidth : '2', | |
| 70 | - circcolor : '#ffffff', | |
| 71 | - textcolor : '#787A78' | |
| 72 | - }, | |
| 73 | - "palido" : { | |
| 74 | - fillcolor : '#B5A8A8', | |
| 75 | - linecolor : '#BAA4AE', | |
| 76 | - linewidth : '1', | |
| 77 | - circcolor : '#E0D7DC', | |
| 78 | - textcolor : '#787A78' | |
| 79 | - }, | |
| 80 | - "vermelho" : { | |
| 81 | - fillcolor : '#E8ACAC', | |
| 82 | - linecolor : '#F50707', | |
| 83 | - linewidth : '1', | |
| 84 | - circcolor : '#F09EA6', | |
| 85 | - textcolor : '#787A78' | |
| 86 | - }, | |
| 87 | - "verde" : { | |
| 88 | - fillcolor : '#3CCC2F', | |
| 89 | - linecolor : '#0C6642', | |
| 90 | - linewidth : '1', | |
| 91 | - circcolor : '#C7D9D2', | |
| 92 | - textcolor : '#787A78' | |
| 93 | - } | |
| 94 | - }, | |
| 95 | - // @TODO remover apos refatorar codigo | |
| 96 | - estilosOld : { | |
| 97 | - "normal" : { | |
| 98 | - fillcolor : 'red', | |
| 99 | - linecolor : 'black', | |
| 100 | - linewidth : '1', | |
| 101 | - circcolor : 'white', | |
| 102 | - textcolor : 'gray' | |
| 103 | - }, | |
| 104 | - "palido" : { | |
| 105 | - fillcolor : 'gray', | |
| 106 | - linecolor : 'gray', | |
| 107 | - linewidth : '1', | |
| 108 | - circcolor : 'gray', | |
| 109 | - textcolor : 'gray' | |
| 110 | - }, | |
| 111 | - "vermelho" : { | |
| 112 | - fillcolor : 'gray', | |
| 113 | - linecolor : 'red', | |
| 114 | - linewidth : '1', | |
| 115 | - circcolor : 'pink', | |
| 116 | - textcolor : 'brown' | |
| 117 | - }, | |
| 118 | - "verde" : { | |
| 119 | - fillcolor : 'gray', | |
| 120 | - linecolor : 'green', | |
| 121 | - linewidth : '1', | |
| 122 | - circcolor : 'DarkGreen', | |
| 123 | - textcolor : 'GreenYellow' | |
| 124 | - } | |
| 125 | - }, | |
| 126 | - /** | |
| 127 | - * Propriedade: estiloPadrao | |
| 128 | - * | |
| 129 | - * Estilo utilizado como padrão | |
| 130 | - */ | |
| 131 | - estiloPadrao : "normal", | |
| 132 | - /** | |
| 133 | - * Cria uma caixa de seleção para escolha do estilo a ser utilizado | |
| 134 | - */ | |
| 135 | - caixaEstilos : function() { | |
| 136 | - var lista = i3GEO.util.listaChaves(i3GEO.desenho.estilos), n = lista.length, i, caixa, sel; | |
| 137 | - caixa = "<select class='form-control' onchange='i3GEO.desenho.definePadrao(this.value)'>"; | |
| 138 | - for (i = 0; i < n; i += 1) { | |
| 139 | - sel = ""; | |
| 140 | - if (lista[i] === i3GEO.desenho.estiloPadrao) { | |
| 141 | - sel = "select"; | |
| 142 | - } | |
| 143 | - caixa += "<option value='" + lista[i] + "'" + sel + ">" + lista[i] + "</option>"; | |
| 144 | - } | |
| 145 | - caixa += "</select>"; | |
| 146 | - return caixa; | |
| 147 | - }, | |
| 148 | - definePadrao : function(valor){ | |
| 149 | - i3GEO.desenho.estiloPadrao = valor; | |
| 150 | - }, | |
| 151 | - /** | |
| 152 | - * Function: addBox | |
| 153 | - * | |
| 154 | - * Adiciona um retangulo | |
| 155 | - * | |
| 156 | - * Parameter: | |
| 157 | - * | |
| 158 | - * {numeric} - novo xmin | |
| 159 | - * | |
| 160 | - * {numeric} - novo ymin | |
| 161 | - * | |
| 162 | - * {numeric} - novo xmax | |
| 163 | - * | |
| 164 | - * {numeric} - novo ymax | |
| 165 | - * | |
| 166 | - * {string} - namespace que identifica o elemento grafico, permitindo busca | |
| 167 | - * | |
| 168 | - * {string} - cor do contorno | |
| 169 | - * | |
| 170 | - * {string} - expessura do contorno | |
| 171 | - */ | |
| 172 | - addBox : function(xmin, ymin, xmax, ymax, namespace, strokeColor, strokeWidth) { | |
| 173 | - return i3GEO.desenho[i3GEO.Interface.ATUAL].addBox(xmin, ymin, xmax, ymax, namespace, strokeColor, strokeWidth); | |
| 174 | - }, | |
| 175 | - /** | |
| 176 | - * Function: moveBox | |
| 177 | - * | |
| 178 | - * Reposiciona um retangulo | |
| 179 | - * | |
| 180 | - * Parameter: | |
| 181 | - * | |
| 182 | - * {object} - box | |
| 183 | - * | |
| 184 | - * {numeric} - novo xmin | |
| 185 | - * | |
| 186 | - * {numeric} - novo ymin | |
| 187 | - * | |
| 188 | - * {numeric} - novo xmax | |
| 189 | - * | |
| 190 | - * {numeric} - novo ymax | |
| 191 | - */ | |
| 192 | - moveBox : function(box, xmin, ymin, xmax, ymax) { | |
| 193 | - return i3GEO.desenho[i3GEO.Interface.ATUAL].moveBox(box, xmin, ymin, xmax, ymax); | |
| 194 | - }, | |
| 195 | - /** | |
| 196 | - * Function: removeBox | |
| 197 | - * | |
| 198 | - * Remove box do mapa (apenas alias para removePins) | |
| 199 | - * | |
| 200 | - * Parameter: | |
| 201 | - * | |
| 202 | - * {string} - namespace que identifica o grupo de marcas que serao removidas | |
| 203 | - */ | |
| 204 | - removeBox : function(namespace) { | |
| 205 | - i3GEO.desenho.removePins(namespace); | |
| 206 | - }, | |
| 207 | - /** | |
| 208 | - * Function: addPin | |
| 209 | - * | |
| 210 | - * Adiciona uma marca no mapa em uma determinada coordenada | |
| 211 | - * | |
| 212 | - * Parameters: | |
| 213 | - * | |
| 214 | - * {numeric} - longitude | |
| 215 | - * | |
| 216 | - * {numeric} - latitude | |
| 217 | - * | |
| 218 | - * {numeric} - largura da imagem | |
| 219 | - * | |
| 220 | - * {numeric} - altura da imagem | |
| 221 | - * | |
| 222 | - * {string} - namespace utilizado para agrupar a marca, permitindo sua remocao | |
| 223 | - * | |
| 224 | - * {boolean} - posiciona a marca no centro do ponto | |
| 225 | - * | |
| 226 | - * {function} - função disparada no evento onclick | |
| 227 | - * | |
| 228 | - * Return: | |
| 229 | - * | |
| 230 | - * {objeto} | |
| 231 | - * | |
| 232 | - */ | |
| 233 | - addPin : function(x, y, w, h, imagem, namespace, centro, funcaoclick) { | |
| 234 | - return i3GEO.desenho[i3GEO.Interface.ATUAL].addPin(x, y, w, h, imagem, namespace, centro); | |
| 235 | - }, | |
| 236 | - /** | |
| 237 | - * Function: removePins | |
| 238 | - * | |
| 239 | - * Remove marcas do mapa | |
| 240 | - * | |
| 241 | - * Parameter: | |
| 242 | - * | |
| 243 | - * {string} - namespace que identifica o grupo de marcas que serao removidas | |
| 244 | - */ | |
| 245 | - removePins : function(namespace) { | |
| 246 | - i3GEO.desenho[i3GEO.Interface.ATUAL].removePins(namespace); | |
| 247 | - }, | |
| 248 | - /** | |
| 249 | - * Function: movePin | |
| 250 | - * | |
| 251 | - * Reposiciona uma marca | |
| 252 | - * | |
| 253 | - * Parameter: | |
| 254 | - * | |
| 255 | - * {object} - marca | |
| 256 | - * | |
| 257 | - * {numeric} - novo x | |
| 258 | - * | |
| 259 | - * {numeric} - novo y | |
| 260 | - */ | |
| 261 | - movePin : function(pin, x, y) { | |
| 262 | - i3GEO.desenho[i3GEO.Interface.ATUAL].movePin(pin, x, y); | |
| 263 | - }, | |
| 264 | - /** | |
| 265 | - * Section: i3GEO.desenho.openlayers | |
| 266 | - * | |
| 267 | - * Funções utilizadas quando o mapa baseia-se na interface OpenLayers | |
| 268 | - */ | |
| 269 | - openlayers : { | |
| 270 | - /** | |
| 271 | - * Function: inicia | |
| 272 | - * | |
| 273 | - * Cria o layer onde os desenhos serao inseridos | |
| 274 | - */ | |
| 275 | - inicia : function() { | |
| 276 | - if (!i3GEO.desenho.layergrafico) { | |
| 277 | - i3GEO.desenho.openlayers.criaLayerGrafico(); | |
| 278 | - } | |
| 279 | - }, | |
| 280 | - addBox : function(xmin, ymin, xmax, ymax, namespace, strokeColor, strokeWidth) { | |
| 281 | - var pol, f; | |
| 282 | - if (!namespace) { | |
| 283 | - namespace = "box"; | |
| 284 | - } | |
| 285 | - if (!strokeColor) { | |
| 286 | - strokeColor = "#FF0000"; | |
| 287 | - } | |
| 288 | - if (!strokeWidth) { | |
| 289 | - strokeWidth = 2; | |
| 290 | - } | |
| 291 | - i3GEO.desenho.openlayers.inicia(); | |
| 292 | - xmin = xmin * 1; | |
| 293 | - ymin = ymin * 1; | |
| 294 | - xmax = xmax * 1; | |
| 295 | - ymax = ymax * 1; | |
| 296 | - pol = new ol.geom.Polygon([[[xmin,ymin],[xmin,ymax],[xmax,ymax],[xmax,ymin],[xmin,ymin]]]); | |
| 297 | - pol = i3GEO.util.extGeo2OSM(pol); | |
| 298 | - f = new ol.Feature({ | |
| 299 | - geometry: pol | |
| 300 | - }); | |
| 301 | - f.setStyle( | |
| 302 | - new ol.style.Style({ | |
| 303 | - stroke: new ol.style.Stroke({ | |
| 304 | - color: strokeColor, | |
| 305 | - width: strokeWidth | |
| 306 | - }) | |
| 307 | - }) | |
| 308 | - ); | |
| 309 | - f.setProperties({ | |
| 310 | - origem : namespace | |
| 311 | - }); | |
| 312 | - i3GEO.desenho.layergrafico.getSource().addFeature(f); | |
| 313 | - return f; | |
| 314 | - }, | |
| 315 | - moveBox : function(box, xmin, ymin, xmax, ymax) { | |
| 316 | - box.getGeometry().setCoordinates([[[xmin,ymin],[xmin,ymax],[xmax,ymax],[xmax,ymin],[xmin,ymin]]]); | |
| 317 | - return box; | |
| 318 | - }, | |
| 319 | - addPin : function(x, y, w, h, imagem, namespace, centro, funcaoclick) { | |
| 320 | - if (!imagem || imagem === "") { | |
| 321 | - imagem = i3GEO.configura.locaplic + "/imagens/google/confluence.png"; | |
| 322 | - } | |
| 323 | - if (!namespace) { | |
| 324 | - namespace = "pin"; | |
| 325 | - } | |
| 326 | - if (!w || w === "") { | |
| 327 | - w = 27; | |
| 328 | - } | |
| 329 | - if (!h || h === "") { | |
| 330 | - h = 27; | |
| 331 | - } | |
| 332 | - if (!funcaoclick) { | |
| 333 | - funcaoclick = function() { | |
| 334 | - i3GEO.desenho.openlayers.removePins(namespace); | |
| 335 | - }; | |
| 336 | - } | |
| 337 | - if (!centro) { | |
| 338 | - centro = false; | |
| 339 | - } | |
| 340 | - i3GEO.desenho.openlayers.inicia(); | |
| 341 | - var point, f, ox, oy; | |
| 342 | - if (centro === true) { | |
| 343 | - ox = 0.5; | |
| 344 | - oy = 0.5; | |
| 345 | - } else { | |
| 346 | - ox = 0.5; | |
| 347 | - oy = 1; | |
| 348 | - } | |
| 349 | - point = i3GEO.util.extGeo2OSM(new ol.geom.Point([x, y])); | |
| 350 | - f = new ol.Feature({ | |
| 351 | - geometry: point | |
| 352 | - }); | |
| 353 | - f.setProperties({ | |
| 354 | - origem : namespace | |
| 355 | - }); | |
| 356 | - f.setStyle( | |
| 357 | - new ol.style.Style({ | |
| 358 | - image: new ol.style.Icon({ | |
| 359 | - src : imagem, | |
| 360 | - size: [w,h], | |
| 361 | - anchor: [ox,oy] | |
| 362 | - }) | |
| 363 | - }) | |
| 364 | - ); | |
| 365 | - //FIXME como incluir o evento click? | |
| 366 | - //f.on('click',funcaoclick); | |
| 367 | - i3GEO.desenho.layergrafico.getSource().addFeature(f); | |
| 368 | - return f; | |
| 369 | - }, | |
| 370 | - removePins : function(namespace) { | |
| 371 | - if (!namespace) { | |
| 372 | - namespace = "pin"; | |
| 373 | - } | |
| 374 | - if (i3GEO.desenho.layergrafico) { | |
| 375 | - var features, n, f, i, remover = []; | |
| 376 | - features = i3GEO.desenho.layergrafico.getSource().getFeatures(); | |
| 377 | - n = features.length; | |
| 378 | - for (i = 0; i < n; i++) { | |
| 379 | - if(features[i].get("origem") == namespace){ | |
| 380 | - remover.push(features[i]); | |
| 381 | - } | |
| 382 | - } | |
| 383 | - n = remover.length; | |
| 384 | - for (i = 0; i < n; i++) { | |
| 385 | - i3GEO.desenho.layergrafico.getSource().removeFeature(remover[i]); | |
| 386 | - } | |
| 387 | - } | |
| 388 | - }, | |
| 389 | - movePin : function(pin, x, y) { | |
| 390 | - var point = i3GEO.util.extGeo2OSM(new ol.geom.Point([x, y])); | |
| 391 | - pin.getGeometry().setCoordinates(point.getCoordinates()); | |
| 392 | - }, | |
| 393 | - criaLayerGrafico : function() { | |
| 394 | - if (!i3GEO.desenho.layergrafico) { | |
| 395 | - i3GEO.desenho.layergrafico = new ol.layer.Vector({ | |
| 396 | - source : new ol.source.Vector({ | |
| 397 | - features : new ol.Collection(), | |
| 398 | - useSpatialIndex : false | |
| 399 | - }), | |
| 400 | - style : new ol.style.Style({ | |
| 401 | - fill : new ol.style.Fill({ | |
| 402 | - color : 'rgba(255, 255, 255, 0.2)' | |
| 403 | - }), | |
| 404 | - stroke : new ol.style.Stroke({ | |
| 405 | - color : '#ffcc33', | |
| 406 | - width : 4 | |
| 407 | - }), | |
| 408 | - image : new ol.style.Circle({ | |
| 409 | - radius : 7, | |
| 410 | - fill : new ol.style.Fill({ | |
| 411 | - color : '#ffcc33' | |
| 412 | - }) | |
| 413 | - }) | |
| 414 | - }) | |
| 415 | - }); | |
| 416 | - i3GEO.desenho.layergrafico.setProperties( | |
| 417 | - { | |
| 418 | - "layerGr" : true, | |
| 419 | - "name" : "i3GEOdesenho", | |
| 420 | - "title" : $trad("layerDesenho"), | |
| 421 | - "isBaseLayer" : false | |
| 422 | - }, | |
| 423 | - true); | |
| 424 | - i3GEO.desenho.layergrafico.setMap(i3geoOL); | |
| 425 | - i3GEO.desenho.layergrafico.getFeatures = function(){ | |
| 426 | - return i3GEO.desenho.layergrafico.getSource().getFeatures(); | |
| 427 | - }; | |
| 428 | - i3GEO.arvoreDeCamadas.atualizaLayersGr(); | |
| 429 | - } | |
| 44 | +{ | |
| 45 | + /** | |
| 46 | + * Constant: layergrafico | |
| 47 | + * | |
| 48 | + * Objeto LAYER para a interface OpenLayers criado com i3GEO.desenho.openlayers.criaLayerGrafico | |
| 49 | + * | |
| 50 | + * Tipo: | |
| 51 | + * | |
| 52 | + * {OpenLayers.Layer.Vector} | |
| 53 | + * | |
| 54 | + */ | |
| 55 | + layergrafico : null, | |
| 56 | + /** | |
| 57 | + * Propriedade: estilos | |
| 58 | + * | |
| 59 | + * Estilos que podem ser utilizados para desenhar os elementos | |
| 60 | + * | |
| 61 | + * Tipo: | |
| 62 | + * | |
| 63 | + * {objeto} | |
| 64 | + */ | |
| 65 | + estilos : { | |
| 66 | + "normal" : { | |
| 67 | + fillcolor : '#ffffff', | |
| 68 | + linecolor : '#ffcc33', | |
| 69 | + linewidth : '2', | |
| 70 | + circcolor : '#ffffff', | |
| 71 | + textcolor : '#787A78' | |
| 72 | + }, | |
| 73 | + "palido" : { | |
| 74 | + fillcolor : '#B5A8A8', | |
| 75 | + linecolor : '#BAA4AE', | |
| 76 | + linewidth : '1', | |
| 77 | + circcolor : '#E0D7DC', | |
| 78 | + textcolor : '#787A78' | |
| 79 | + }, | |
| 80 | + "vermelho" : { | |
| 81 | + fillcolor : '#E8ACAC', | |
| 82 | + linecolor : '#F50707', | |
| 83 | + linewidth : '1', | |
| 84 | + circcolor : '#F09EA6', | |
| 85 | + textcolor : '#787A78' | |
| 86 | + }, | |
| 87 | + "verde" : { | |
| 88 | + fillcolor : '#3CCC2F', | |
| 89 | + linecolor : '#0C6642', | |
| 90 | + linewidth : '1', | |
| 91 | + circcolor : '#C7D9D2', | |
| 92 | + textcolor : '#787A78' | |
| 93 | + } | |
| 94 | + }, | |
| 95 | + // @TODO remover apos refatorar codigo | |
| 96 | + estilosOld : { | |
| 97 | + "normal" : { | |
| 98 | + fillcolor : 'red', | |
| 99 | + linecolor : 'black', | |
| 100 | + linewidth : '1', | |
| 101 | + circcolor : 'white', | |
| 102 | + textcolor : 'gray' | |
| 103 | + }, | |
| 104 | + "palido" : { | |
| 105 | + fillcolor : 'gray', | |
| 106 | + linecolor : 'gray', | |
| 107 | + linewidth : '1', | |
| 108 | + circcolor : 'gray', | |
| 109 | + textcolor : 'gray' | |
| 110 | + }, | |
| 111 | + "vermelho" : { | |
| 112 | + fillcolor : 'gray', | |
| 113 | + linecolor : 'red', | |
| 114 | + linewidth : '1', | |
| 115 | + circcolor : 'pink', | |
| 116 | + textcolor : 'brown' | |
| 117 | + }, | |
| 118 | + "verde" : { | |
| 119 | + fillcolor : 'gray', | |
| 120 | + linecolor : 'green', | |
| 121 | + linewidth : '1', | |
| 122 | + circcolor : 'DarkGreen', | |
| 123 | + textcolor : 'GreenYellow' | |
| 124 | + } | |
| 125 | + }, | |
| 126 | + /** | |
| 127 | + * Propriedade: estiloPadrao | |
| 128 | + * | |
| 129 | + * Estilo utilizado como padrão | |
| 130 | + */ | |
| 131 | + estiloPadrao : "normal", | |
| 132 | + /** | |
| 133 | + * Cria uma caixa de seleção para escolha do estilo a ser utilizado | |
| 134 | + */ | |
| 135 | + caixaEstilos : function() { | |
| 136 | + var lista = i3GEO.util.listaChaves(i3GEO.desenho.estilos), n = lista.length, i, caixa, sel; | |
| 137 | + caixa = "<select class='form-control' onchange='i3GEO.desenho.definePadrao(this.value)'>"; | |
| 138 | + for (i = 0; i < n; i += 1) { | |
| 139 | + sel = ""; | |
| 140 | + if (lista[i] === i3GEO.desenho.estiloPadrao) { | |
| 141 | + sel = "select"; | |
| 142 | + } | |
| 143 | + caixa += "<option value='" + lista[i] + "'" + sel + ">" + lista[i] + "</option>"; | |
| 144 | + } | |
| 145 | + caixa += "</select>"; | |
| 146 | + return caixa; | |
| 147 | + }, | |
| 148 | + definePadrao : function(valor){ | |
| 149 | + i3GEO.desenho.estiloPadrao = valor; | |
| 150 | + }, | |
| 151 | + /** | |
| 152 | + * Function: addBox | |
| 153 | + * | |
| 154 | + * Adiciona um retangulo | |
| 155 | + * | |
| 156 | + * Parameter: | |
| 157 | + * | |
| 158 | + * {numeric} - novo xmin | |
| 159 | + * | |
| 160 | + * {numeric} - novo ymin | |
| 161 | + * | |
| 162 | + * {numeric} - novo xmax | |
| 163 | + * | |
| 164 | + * {numeric} - novo ymax | |
| 165 | + * | |
| 166 | + * {string} - namespace que identifica o elemento grafico, permitindo busca | |
| 167 | + * | |
| 168 | + * {string} - cor do contorno | |
| 169 | + * | |
| 170 | + * {string} - expessura do contorno | |
| 171 | + */ | |
| 172 | + addBox : function(xmin, ymin, xmax, ymax, namespace, strokeColor, strokeWidth) { | |
| 173 | + return i3GEO.desenho[i3GEO.Interface.ATUAL].addBox(xmin, ymin, xmax, ymax, namespace, strokeColor, strokeWidth); | |
| 174 | + }, | |
| 175 | + /** | |
| 176 | + * Function: moveBox | |
| 177 | + * | |
| 178 | + * Reposiciona um retangulo | |
| 179 | + * | |
| 180 | + * Parameter: | |
| 181 | + * | |
| 182 | + * {object} - box | |
| 183 | + * | |
| 184 | + * {numeric} - novo xmin | |
| 185 | + * | |
| 186 | + * {numeric} - novo ymin | |
| 187 | + * | |
| 188 | + * {numeric} - novo xmax | |
| 189 | + * | |
| 190 | + * {numeric} - novo ymax | |
| 191 | + */ | |
| 192 | + moveBox : function(box, xmin, ymin, xmax, ymax) { | |
| 193 | + return i3GEO.desenho[i3GEO.Interface.ATUAL].moveBox(box, xmin, ymin, xmax, ymax); | |
| 194 | + }, | |
| 195 | + /** | |
| 196 | + * Function: removeBox | |
| 197 | + * | |
| 198 | + * Remove box do mapa (apenas alias para removePins) | |
| 199 | + * | |
| 200 | + * Parameter: | |
| 201 | + * | |
| 202 | + * {string} - namespace que identifica o grupo de marcas que serao removidas | |
| 203 | + */ | |
| 204 | + removeBox : function(namespace) { | |
| 205 | + i3GEO.desenho.removePins(namespace); | |
| 206 | + }, | |
| 207 | + /** | |
| 208 | + * Function: addPin | |
| 209 | + * | |
| 210 | + * Adiciona uma marca no mapa em uma determinada coordenada | |
| 211 | + * | |
| 212 | + * Parameters: | |
| 213 | + * | |
| 214 | + * {numeric} - longitude | |
| 215 | + * | |
| 216 | + * {numeric} - latitude | |
| 217 | + * | |
| 218 | + * {numeric} - largura da imagem | |
| 219 | + * | |
| 220 | + * {numeric} - altura da imagem | |
| 221 | + * | |
| 222 | + * {string} - namespace utilizado para agrupar a marca, permitindo sua remocao | |
| 223 | + * | |
| 224 | + * {boolean} - posiciona a marca no centro do ponto | |
| 225 | + * | |
| 226 | + * {function} - função disparada no evento onclick | |
| 227 | + * | |
| 228 | + * Return: | |
| 229 | + * | |
| 230 | + * {objeto} | |
| 231 | + * | |
| 232 | + */ | |
| 233 | + addPin : function(x, y, w, h, imagem, namespace, centro, funcaoclick) { | |
| 234 | + return i3GEO.desenho[i3GEO.Interface.ATUAL].addPin(x, y, w, h, imagem, namespace, centro); | |
| 235 | + }, | |
| 236 | + /** | |
| 237 | + * Function: removePins | |
| 238 | + * | |
| 239 | + * Remove marcas do mapa | |
| 240 | + * | |
| 241 | + * Parameter: | |
| 242 | + * | |
| 243 | + * {string} - namespace que identifica o grupo de marcas que serao removidas | |
| 244 | + */ | |
| 245 | + removePins : function(namespace) { | |
| 246 | + i3GEO.desenho[i3GEO.Interface.ATUAL].removePins(namespace); | |
| 247 | + }, | |
| 248 | + /** | |
| 249 | + * Function: movePin | |
| 250 | + * | |
| 251 | + * Reposiciona uma marca | |
| 252 | + * | |
| 253 | + * Parameter: | |
| 254 | + * | |
| 255 | + * {object} - marca | |
| 256 | + * | |
| 257 | + * {numeric} - novo x | |
| 258 | + * | |
| 259 | + * {numeric} - novo y | |
| 260 | + */ | |
| 261 | + movePin : function(pin, x, y) { | |
| 262 | + i3GEO.desenho[i3GEO.Interface.ATUAL].movePin(pin, x, y); | |
| 263 | + }, | |
| 264 | + criaLayerGrafico : function(){ | |
| 265 | + if (!i3GEO.desenho.layergrafico) { | |
| 266 | + i3GEO.desenho[i3GEO.Interface.ATUAL].criaLayerGrafico(); | |
| 267 | + } | |
| 268 | + }, | |
| 269 | + /** | |
| 270 | + * Section: i3GEO.desenho.openlayers | |
| 271 | + * | |
| 272 | + * Funções utilizadas quando o mapa baseia-se na interface OpenLayers | |
| 273 | + */ | |
| 274 | + openlayers : { | |
| 275 | + /** | |
| 276 | + * Function: inicia | |
| 277 | + * | |
| 278 | + * Cria o layer onde os desenhos serao inseridos | |
| 279 | + */ | |
| 280 | + inicia : function() { | |
| 281 | + if (!i3GEO.desenho.layergrafico) { | |
| 282 | + i3GEO.desenho.openlayers.criaLayerGrafico(); | |
| 283 | + } | |
| 284 | + }, | |
| 285 | + addBox : function(xmin, ymin, xmax, ymax, namespace, strokeColor, strokeWidth) { | |
| 286 | + var pol, f; | |
| 287 | + if (!namespace) { | |
| 288 | + namespace = "box"; | |
| 289 | + } | |
| 290 | + if (!strokeColor) { | |
| 291 | + strokeColor = "#FF0000"; | |
| 292 | + } | |
| 293 | + if (!strokeWidth) { | |
| 294 | + strokeWidth = 2; | |
| 295 | + } | |
| 296 | + i3GEO.desenho.openlayers.inicia(); | |
| 297 | + xmin = xmin * 1; | |
| 298 | + ymin = ymin * 1; | |
| 299 | + xmax = xmax * 1; | |
| 300 | + ymax = ymax * 1; | |
| 301 | + pol = new ol.geom.Polygon([[[xmin,ymin],[xmin,ymax],[xmax,ymax],[xmax,ymin],[xmin,ymin]]]); | |
| 302 | + pol = i3GEO.util.extGeo2OSM(pol); | |
| 303 | + f = new ol.Feature({ | |
| 304 | + geometry: pol | |
| 305 | + }); | |
| 306 | + f.setStyle( | |
| 307 | + new ol.style.Style({ | |
| 308 | + stroke: new ol.style.Stroke({ | |
| 309 | + color: strokeColor, | |
| 310 | + width: strokeWidth | |
| 311 | + }) | |
| 312 | + }) | |
| 313 | + ); | |
| 314 | + f.setProperties({ | |
| 315 | + origem : namespace | |
| 316 | + }); | |
| 317 | + i3GEO.desenho.layergrafico.getSource().addFeature(f); | |
| 318 | + return f; | |
| 319 | + }, | |
| 320 | + moveBox : function(box, xmin, ymin, xmax, ymax) { | |
| 321 | + box.getGeometry().setCoordinates([[[xmin,ymin],[xmin,ymax],[xmax,ymax],[xmax,ymin],[xmin,ymin]]]); | |
| 322 | + return box; | |
| 323 | + }, | |
| 324 | + addPin : function(x, y, w, h, imagem, namespace, centro, funcaoclick) { | |
| 325 | + if (!imagem || imagem === "") { | |
| 326 | + imagem = i3GEO.configura.locaplic + "/imagens/google/confluence.png"; | |
| 327 | + } | |
| 328 | + if (!namespace) { | |
| 329 | + namespace = "pin"; | |
| 330 | + } | |
| 331 | + if (!w || w === "") { | |
| 332 | + w = 27; | |
| 333 | + } | |
| 334 | + if (!h || h === "") { | |
| 335 | + h = 27; | |
| 336 | + } | |
| 337 | + if (!funcaoclick) { | |
| 338 | + funcaoclick = function() { | |
| 339 | + i3GEO.desenho.openlayers.removePins(namespace); | |
| 340 | + }; | |
| 341 | + } | |
| 342 | + if (!centro) { | |
| 343 | + centro = false; | |
| 344 | + } | |
| 345 | + i3GEO.desenho.openlayers.inicia(); | |
| 346 | + var point, f, ox, oy; | |
| 347 | + if (centro === true) { | |
| 348 | + ox = 0.5; | |
| 349 | + oy = 0.5; | |
| 350 | + } else { | |
| 351 | + ox = 0.5; | |
| 352 | + oy = 1; | |
| 353 | + } | |
| 354 | + point = i3GEO.util.extGeo2OSM(new ol.geom.Point([x, y])); | |
| 355 | + f = new ol.Feature({ | |
| 356 | + geometry: point | |
| 357 | + }); | |
| 358 | + f.setProperties({ | |
| 359 | + origem : namespace | |
| 360 | + }); | |
| 361 | + f.setStyle( | |
| 362 | + new ol.style.Style({ | |
| 363 | + image: new ol.style.Icon({ | |
| 364 | + src : imagem, | |
| 365 | + size: [w,h], | |
| 366 | + anchor: [ox,oy] | |
| 367 | + }) | |
| 368 | + }) | |
| 369 | + ); | |
| 370 | + //FIXME como incluir o evento click? | |
| 371 | + //f.on('click',funcaoclick); | |
| 372 | + i3GEO.desenho.layergrafico.getSource().addFeature(f); | |
| 373 | + return f; | |
| 374 | + }, | |
| 375 | + removePins : function(namespace) { | |
| 376 | + if (!namespace) { | |
| 377 | + namespace = "pin"; | |
| 378 | + } | |
| 379 | + if (i3GEO.desenho.layergrafico) { | |
| 380 | + var features, n, f, i, remover = []; | |
| 381 | + features = i3GEO.desenho.layergrafico.getSource().getFeatures(); | |
| 382 | + n = features.length; | |
| 383 | + for (i = 0; i < n; i++) { | |
| 384 | + if(features[i].get("origem") == namespace){ | |
| 385 | + remover.push(features[i]); | |
| 430 | 386 | } |
| 431 | - }, | |
| 432 | - /** | |
| 433 | - * Section: i3GEO.desenho.googlemaps | |
| 434 | - * | |
| 435 | - * Funções utilizadas quando o mapa baseia-se na interface GoogleMaps | |
| 436 | - */ | |
| 437 | - googlemaps : { | |
| 438 | - /** | |
| 439 | - * Variavel: shapes | |
| 440 | - * | |
| 441 | - * Array que guarda todos os objetos que estao atualmente no mapa E atualizado toda vez que uma figura e acrescentada ou | |
| 442 | - * removida | |
| 443 | - */ | |
| 444 | - shapes : [], | |
| 445 | - inicia : function() { | |
| 446 | - }, | |
| 447 | - addBox : function(xmin, ymin, xmax, ymax, namespace, strokeColor, strokeWidth) { | |
| 448 | - var f; | |
| 449 | - if (!namespace) { | |
| 450 | - namespace = "box"; | |
| 451 | - } | |
| 452 | - if (!strokeColor) { | |
| 453 | - strokeColor = "#FF0000"; | |
| 454 | - } | |
| 455 | - if (!strokeWidth) { | |
| 456 | - strokeWidth = 2; | |
| 457 | - } | |
| 458 | - i3GEO.desenho.googlemaps.inicia(); | |
| 459 | - f = new google.maps.Rectangle({ | |
| 460 | - origem : namespace, | |
| 461 | - strokeColor : strokeColor, | |
| 462 | - strokeWeight : strokeWidth, | |
| 463 | - fillOpacity : 0, | |
| 464 | - map : i3GeoMap, | |
| 465 | - bounds : new google.maps.LatLngBounds(new google.maps.LatLng(ymin, xmin), new google.maps.LatLng(ymax, xmax)) | |
| 466 | - }); | |
| 467 | - i3GEO.desenho.googlemaps.shapes.push(f); | |
| 468 | - return f; | |
| 469 | - }, | |
| 470 | - moveBox : function(box, xmin, ymin, xmax, ymax) { | |
| 471 | - box.setBounds(new google.maps.LatLngBounds(new google.maps.LatLng(ymin, xmin), new google.maps.LatLng(ymax, xmax))); | |
| 472 | - return box; | |
| 473 | - }, | |
| 474 | - addPin : function(x, y, w, h, imagem, namespace, centro, funcaoclick) { | |
| 475 | - if (!imagem || imagem === "") { | |
| 476 | - imagem = i3GEO.configura.locaplic + "/imagens/google/confluence.png"; | |
| 477 | - } | |
| 478 | - if (!namespace) { | |
| 479 | - namespace = "pin"; | |
| 480 | - } | |
| 481 | - if (!w || w === "") { | |
| 482 | - w = 27; | |
| 483 | - } | |
| 484 | - if (!h || h === "") { | |
| 485 | - h = 27; | |
| 486 | - } | |
| 487 | - if (!funcaoclick) { | |
| 488 | - funcaoclick = function() { | |
| 489 | - i3GEO.desenho.googlemaps.removePins(namespace); | |
| 490 | - }; | |
| 491 | - } | |
| 492 | - if (!centro) { | |
| 493 | - centro = false; | |
| 494 | - } | |
| 495 | - i3GEO.desenho.googlemaps.inicia(); | |
| 496 | - var point, f, icon; | |
| 497 | - if (centro === false) { | |
| 498 | - icon = { | |
| 499 | - url : imagem, | |
| 500 | - size : new google.maps.Size(w, h) | |
| 501 | - }; | |
| 502 | - } else { | |
| 503 | - icon = { | |
| 504 | - url : imagem, | |
| 505 | - size : new google.maps.Size(w, h), | |
| 506 | - origin : new google.maps.Point(0, 0), | |
| 507 | - anchor : new google.maps.Point(w / 2, h / 2) | |
| 508 | - }; | |
| 509 | - } | |
| 510 | - point = new google.maps.LatLng(y, x); | |
| 387 | + } | |
| 388 | + n = remover.length; | |
| 389 | + for (i = 0; i < n; i++) { | |
| 390 | + i3GEO.desenho.layergrafico.getSource().removeFeature(remover[i]); | |
| 391 | + } | |
| 392 | + } | |
| 393 | + }, | |
| 394 | + movePin : function(pin, x, y) { | |
| 395 | + var point = i3GEO.util.extGeo2OSM(new ol.geom.Point([x, y])); | |
| 396 | + pin.getGeometry().setCoordinates(point.getCoordinates()); | |
| 397 | + }, | |
| 398 | + criaLayerGrafico : function() { | |
| 399 | + if (!i3GEO.desenho.layergrafico) { | |
| 400 | + i3GEO.desenho.layergrafico = new ol.layer.Vector({ | |
| 401 | + source : new ol.source.Vector({ | |
| 402 | + features : new ol.Collection(), | |
| 403 | + useSpatialIndex : false | |
| 404 | + }), | |
| 405 | + style : new ol.style.Style({ | |
| 406 | + fill : new ol.style.Fill({ | |
| 407 | + color : 'rgba(255, 255, 255, 0.2)' | |
| 408 | + }), | |
| 409 | + stroke : new ol.style.Stroke({ | |
| 410 | + color : '#ffcc33', | |
| 411 | + width : 4 | |
| 412 | + }), | |
| 413 | + image : new ol.style.Circle({ | |
| 414 | + radius : 7, | |
| 415 | + fill : new ol.style.Fill({ | |
| 416 | + color : '#ffcc33' | |
| 417 | + }) | |
| 418 | + }) | |
| 419 | + }) | |
| 420 | + }); | |
| 421 | + i3GEO.desenho.layergrafico.setProperties( | |
| 422 | + { | |
| 423 | + "layerGr" : true, | |
| 424 | + "name" : "i3GEOdesenho", | |
| 425 | + "title" : $trad("layerDesenho"), | |
| 426 | + "isBaseLayer" : false | |
| 427 | + }, | |
| 428 | + true); | |
| 429 | + i3GEO.desenho.layergrafico.setMap(i3geoOL); | |
| 430 | + i3GEO.desenho.layergrafico.getFeatures = function(){ | |
| 431 | + return i3GEO.desenho.layergrafico.getSource().getFeatures(); | |
| 432 | + }; | |
| 433 | + i3GEO.editor.criaLayerBackup(); | |
| 434 | + } | |
| 435 | + } | |
| 436 | + }, | |
| 437 | + /** | |
| 438 | + * Section: i3GEO.desenho.googlemaps | |
| 439 | + * | |
| 440 | + * Funções utilizadas quando o mapa baseia-se na interface GoogleMaps | |
| 441 | + */ | |
| 442 | + googlemaps : { | |
| 443 | + /** | |
| 444 | + * Variavel: shapes | |
| 445 | + * | |
| 446 | + * Array que guarda todos os objetos que estao atualmente no mapa E atualizado toda vez que uma figura e acrescentada ou | |
| 447 | + * removida | |
| 448 | + */ | |
| 449 | + shapes : [], | |
| 450 | + inicia : function() { | |
| 451 | + }, | |
| 452 | + addBox : function(xmin, ymin, xmax, ymax, namespace, strokeColor, strokeWidth) { | |
| 453 | + var f; | |
| 454 | + if (!namespace) { | |
| 455 | + namespace = "box"; | |
| 456 | + } | |
| 457 | + if (!strokeColor) { | |
| 458 | + strokeColor = "#FF0000"; | |
| 459 | + } | |
| 460 | + if (!strokeWidth) { | |
| 461 | + strokeWidth = 2; | |
| 462 | + } | |
| 463 | + i3GEO.desenho.googlemaps.inicia(); | |
| 464 | + f = new google.maps.Rectangle({ | |
| 465 | + origem : namespace, | |
| 466 | + strokeColor : strokeColor, | |
| 467 | + strokeWeight : strokeWidth, | |
| 468 | + fillOpacity : 0, | |
| 469 | + map : i3GeoMap, | |
| 470 | + bounds : new google.maps.LatLngBounds(new google.maps.LatLng(ymin, xmin), new google.maps.LatLng(ymax, xmax)) | |
| 471 | + }); | |
| 472 | + i3GEO.desenho.googlemaps.shapes.push(f); | |
| 473 | + return f; | |
| 474 | + }, | |
| 475 | + moveBox : function(box, xmin, ymin, xmax, ymax) { | |
| 476 | + box.setBounds(new google.maps.LatLngBounds(new google.maps.LatLng(ymin, xmin), new google.maps.LatLng(ymax, xmax))); | |
| 477 | + return box; | |
| 478 | + }, | |
| 479 | + addPin : function(x, y, w, h, imagem, namespace, centro, funcaoclick) { | |
| 480 | + if (!imagem || imagem === "") { | |
| 481 | + imagem = i3GEO.configura.locaplic + "/imagens/google/confluence.png"; | |
| 482 | + } | |
| 483 | + if (!namespace) { | |
| 484 | + namespace = "pin"; | |
| 485 | + } | |
| 486 | + if (!w || w === "") { | |
| 487 | + w = 27; | |
| 488 | + } | |
| 489 | + if (!h || h === "") { | |
| 490 | + h = 27; | |
| 491 | + } | |
| 492 | + if (!funcaoclick) { | |
| 493 | + funcaoclick = function() { | |
| 494 | + i3GEO.desenho.googlemaps.removePins(namespace); | |
| 495 | + }; | |
| 496 | + } | |
| 497 | + if (!centro) { | |
| 498 | + centro = false; | |
| 499 | + } | |
| 500 | + i3GEO.desenho.googlemaps.inicia(); | |
| 501 | + var point, f, icon; | |
| 502 | + if (centro === false) { | |
| 503 | + icon = { | |
| 504 | + url : imagem, | |
| 505 | + size : new google.maps.Size(w, h) | |
| 506 | + }; | |
| 507 | + } else { | |
| 508 | + icon = { | |
| 509 | + url : imagem, | |
| 510 | + size : new google.maps.Size(w, h), | |
| 511 | + origin : new google.maps.Point(0, 0), | |
| 512 | + anchor : new google.maps.Point(w / 2, h / 2) | |
| 513 | + }; | |
| 514 | + } | |
| 515 | + point = new google.maps.LatLng(y, x); | |
| 511 | 516 | |
| 512 | - f = new google.maps.Marker({ | |
| 513 | - position : point, | |
| 514 | - map : i3GeoMap, | |
| 515 | - origem : namespace, | |
| 516 | - icon : icon | |
| 517 | - }); | |
| 518 | - i3GEO.desenho.googlemaps.shapes.push(f); | |
| 519 | - return f; | |
| 520 | - }, | |
| 521 | - removePins : function(namespace) { | |
| 522 | - if (!namespace) { | |
| 523 | - namespace = "pin"; | |
| 524 | - } | |
| 525 | - var f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem", namespace); | |
| 526 | - if (f && f.length > 0) { | |
| 527 | - i3GEO.desenho.googlemaps.destroyFeatures(f); | |
| 528 | - } | |
| 529 | - }, | |
| 530 | - movePin : function(pin, x, y) { | |
| 531 | - var point = new google.maps.LatLng(y, x); | |
| 532 | - pin.setPosition(point); | |
| 533 | - }, | |
| 534 | - /** | |
| 535 | - * Function: getFeaturesByAttribute | |
| 536 | - * | |
| 537 | - * Obtém uma figura com base em um atributo | |
| 538 | - * | |
| 539 | - * {string} | |
| 540 | - * | |
| 541 | - * {string} | |
| 542 | - */ | |
| 543 | - getFeaturesByAttribute : function(atributo, valor) { | |
| 544 | - var i, s = [], n = i3GEO.desenho.googlemaps.shapes.length; | |
| 545 | - for (i = 0; i < n; i++) { | |
| 546 | - if (i3GEO.desenho.googlemaps.shapes[i] && i3GEO.desenho.googlemaps.shapes[i] != "") { | |
| 547 | - if (i3GEO.desenho.googlemaps.shapes[i][atributo] == valor) { | |
| 548 | - s.push(i3GEO.desenho.googlemaps.shapes[i]); | |
| 549 | - } | |
| 550 | - } | |
| 551 | - } | |
| 552 | - return s; | |
| 553 | - }, | |
| 554 | - /** | |
| 555 | - * Function: destroyFeatures | |
| 556 | - * | |
| 557 | - * Destroi as figuras | |
| 558 | - * | |
| 559 | - * {array} - lista de objetos | |
| 560 | - */ | |
| 561 | - destroyFeatures : function(f) { | |
| 562 | - if (f) { | |
| 563 | - var i, n = f.length; | |
| 564 | - for (i = 0; i < n; i++) { | |
| 565 | - f[i].setMap(null); | |
| 566 | - f[i] = ""; | |
| 567 | - } | |
| 568 | - } | |
| 517 | + f = new google.maps.Marker({ | |
| 518 | + position : point, | |
| 519 | + map : i3GeoMap, | |
| 520 | + origem : namespace, | |
| 521 | + icon : icon | |
| 522 | + }); | |
| 523 | + i3GEO.desenho.googlemaps.shapes.push(f); | |
| 524 | + return f; | |
| 525 | + }, | |
| 526 | + removePins : function(namespace) { | |
| 527 | + if (!namespace) { | |
| 528 | + namespace = "pin"; | |
| 529 | + } | |
| 530 | + var f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem", namespace); | |
| 531 | + if (f && f.length > 0) { | |
| 532 | + i3GEO.desenho.googlemaps.destroyFeatures(f); | |
| 533 | + } | |
| 534 | + }, | |
| 535 | + movePin : function(pin, x, y) { | |
| 536 | + var point = new google.maps.LatLng(y, x); | |
| 537 | + pin.setPosition(point); | |
| 538 | + }, | |
| 539 | + /** | |
| 540 | + * Function: getFeaturesByAttribute | |
| 541 | + * | |
| 542 | + * Obtém uma figura com base em um atributo | |
| 543 | + * | |
| 544 | + * {string} | |
| 545 | + * | |
| 546 | + * {string} | |
| 547 | + */ | |
| 548 | + getFeaturesByAttribute : function(atributo, valor) { | |
| 549 | + var i, s = [], n = i3GEO.desenho.googlemaps.shapes.length; | |
| 550 | + for (i = 0; i < n; i++) { | |
| 551 | + if (i3GEO.desenho.googlemaps.shapes[i] && i3GEO.desenho.googlemaps.shapes[i] != "") { | |
| 552 | + if (i3GEO.desenho.googlemaps.shapes[i][atributo] == valor) { | |
| 553 | + s.push(i3GEO.desenho.googlemaps.shapes[i]); | |
| 569 | 554 | } |
| 555 | + } | |
| 556 | + } | |
| 557 | + return s; | |
| 558 | + }, | |
| 559 | + /** | |
| 560 | + * Function: destroyFeatures | |
| 561 | + * | |
| 562 | + * Destroi as figuras | |
| 563 | + * | |
| 564 | + * {array} - lista de objetos | |
| 565 | + */ | |
| 566 | + destroyFeatures : function(f) { | |
| 567 | + if (f) { | |
| 568 | + var i, n = f.length; | |
| 569 | + for (i = 0; i < n; i++) { | |
| 570 | + f[i].setMap(null); | |
| 571 | + f[i] = ""; | |
| 572 | + } | |
| 570 | 573 | } |
| 571 | - }; | |
| 574 | + } | |
| 575 | + } | |
| 576 | +}; | ... | ... |
js/editor.js
| ... | ... | @@ -3,127 +3,582 @@ if (typeof (i3GEO) === 'undefined') { |
| 3 | 3 | } |
| 4 | 4 | i3GEO.editor = |
| 5 | 5 | { |
| 6 | - //se for vazio, nao cria os botoes | |
| 7 | - //o objeto com os botoes que serao ativados ou nao, pode ser enviado | |
| 8 | - //como um parametro na funcao: | |
| 9 | - //i3GEO.editorOL.criaBotoes(botoes); | |
| 10 | - //caso contrario, utiliza-se i3GEO.editorOL.botoes | |
| 11 | - botoes : { | |
| 12 | - 'zoomin' : false, | |
| 13 | - 'zoomout' : false, | |
| 14 | - 'pan' : false, | |
| 15 | - 'zoombox' : false, | |
| 16 | - 'zoomtot' : false, | |
| 17 | - 'legenda' : false, | |
| 18 | - 'distancia' : false, | |
| 19 | - 'area' : false, | |
| 20 | - 'identifica' : false, | |
| 21 | - 'linha' : true, | |
| 22 | - 'ponto' : true, | |
| 23 | - 'poligono' : true, | |
| 24 | - 'texto' : true, | |
| 25 | - 'corta' : true, | |
| 26 | - 'edita' : true, | |
| 27 | - 'listag' : true, | |
| 28 | - 'selecao' : true, | |
| 29 | - 'selecaotudo' : true,//inclui tambem o botao de unseltodos | |
| 30 | - 'apaga' : true, | |
| 31 | - 'procura' : false, | |
| 32 | - 'propriedades' : true, | |
| 33 | - 'salva' : true, | |
| 34 | - 'ajuda' : true, | |
| 35 | - 'fecha' : true, | |
| 36 | - 'tools' : true, | |
| 37 | - 'undo' : true, | |
| 38 | - 'frente' : true | |
| 39 | - }, | |
| 40 | - /** | |
| 41 | - * Function: inicia | |
| 42 | - * | |
| 43 | - * Abre as opções do editor conforme a interface em uso | |
| 44 | - */ | |
| 45 | - inicia : function() { | |
| 46 | - if(i3GEOF){ | |
| 47 | - if(i3GEOF.area && i3GEOF.area.isOn()){ | |
| 48 | - return; | |
| 49 | - } | |
| 50 | - if(i3GEOF.distancia && i3GEOF.distancia.isOn()){ | |
| 51 | - return; | |
| 52 | - } | |
| 53 | - } | |
| 54 | - i3GEO.eventos.cliquePerm.desativa(); | |
| 55 | - i3GEO.editor[i3GEO.Interface.ATUAL].inicia("janelaEditorVetorial"); | |
| 56 | - }, | |
| 57 | - // carrega as opcoes de edicao se a interface for do googlemaps | |
| 58 | - googlemaps : { | |
| 59 | - //removido em funcao da politica do google de impedir engenharia reversa em sua base de dados | |
| 60 | - inicia : function(idjanela) { | |
| 6 | + interacoes: "", | |
| 7 | + idsSelecionados: [], | |
| 8 | + backup : new ol.layer.Vector({ | |
| 9 | + source : new ol.source.Vector({ | |
| 10 | + features : new ol.Collection(), | |
| 11 | + useSpatialIndex : false, | |
| 12 | + name : "Backup" | |
| 13 | + }), | |
| 14 | + //map : i3geoOL, | |
| 15 | + visible : false | |
| 16 | + }), | |
| 17 | + featuresBackup : [], | |
| 18 | + simbologia : { | |
| 19 | + opacidade : 0.8, | |
| 20 | + texto : "", | |
| 21 | + fillColor : "250,180,15", | |
| 22 | + strokeWidth : 5, | |
| 23 | + strokeColor : "250,150,0", | |
| 24 | + pointRadius : 6, | |
| 25 | + graphicName : "square", | |
| 26 | + fontSize : "12px", | |
| 27 | + fontColor : "0,0,0", | |
| 28 | + externalGraphic : "", | |
| 29 | + graphicHeight : 25, | |
| 30 | + graphicWidth : 25 | |
| 31 | + }, | |
| 32 | + /** | |
| 33 | + * Function: inicia | |
| 34 | + * | |
| 35 | + * Abre as opções do editor conforme a interface em uso | |
| 36 | + */ | |
| 37 | + inicia : function() { | |
| 38 | + if(i3GEOF){ | |
| 39 | + if(i3GEOF.area && i3GEOF.area.isOn()){ | |
| 40 | + return; | |
| 41 | + } | |
| 42 | + if(i3GEOF.distancia && i3GEOF.distancia.isOn()){ | |
| 43 | + return; | |
| 44 | + } | |
| 45 | + } | |
| 46 | + i3GEO.eventos.cliquePerm.desativa(); | |
| 47 | + i3GEO.editor[i3GEO.Interface.ATUAL].inicia("janelaEditorVetorial"); | |
| 48 | + }, | |
| 49 | + removeInteracoes: function(){ | |
| 50 | + i3geoOL.removeInteraction(i3GEO.editor.interacoes); | |
| 51 | + i3GEO.editor.interacoes = ""; | |
| 52 | + }, | |
| 53 | + unselFeature : function(id) { | |
| 54 | + i3GEO.editor.unselAll(id); | |
| 55 | + }, | |
| 56 | + selDelete: function(){ | |
| 57 | + var x, nsel = i3GEO.editor.idsSelecionados.length; | |
| 58 | + i3GEO.editor.featuresBackup = []; | |
| 59 | + if(nsel > 0){ | |
| 60 | + x = window.confirm($trad("excsel") + "?"); | |
| 61 | + if(x){ | |
| 62 | + i3GEO.editor.deleteFeaturesSel(); | |
| 63 | + i3GEO.desenho.layergrafico.getSource().changed(); | |
| 64 | + } | |
| 65 | + } | |
| 66 | + else{ | |
| 67 | + i3GEO.janela.tempoMsg($trad("selum")); | |
| 68 | + } | |
| 69 | + }, | |
| 70 | + deleteFeaturesSel : function(){ | |
| 71 | + var s, i, nsel, f; | |
| 72 | + nsel = i3GEO.editor.idsSelecionados.length; | |
| 73 | + s = i3GEO.desenho.layergrafico.getSource(); | |
| 74 | + for(i=0; i<nsel; i++){ | |
| 75 | + f = s.getFeatureById(i3GEO.editor.idsSelecionados[i]); | |
| 76 | + if(f){ | |
| 77 | + i3GEO.editor.featuresBackup.push(f.clone()); | |
| 78 | + s.removeFeature(f); | |
| 79 | + } | |
| 80 | + } | |
| 81 | + i3GEO.editor.idsSelecionados = []; | |
| 82 | + }, | |
| 83 | + selAll: function(idfeature){ | |
| 84 | + if(!idfeature){ | |
| 85 | + i3GEO.editor.unselAll(); | |
| 86 | + } | |
| 87 | + var features, n, f, i, id, st; | |
| 88 | + features = i3GEO.desenho.layergrafico.getSource().getFeatures(); | |
| 89 | + n = features.length; | |
| 90 | + for (i = 0; i < n; i++) { | |
| 91 | + f = features[i]; | |
| 92 | + id = f.getId(); | |
| 93 | + if(idfeature && idfeature != id){ | |
| 94 | + continue; | |
| 95 | + } | |
| 96 | + if(!id || id == "" || id == undefined ){ | |
| 97 | + id = i3GEO.util.uid(); | |
| 98 | + f.setId(id); | |
| 99 | + } | |
| 61 | 100 | |
| 62 | - } | |
| 63 | - }, | |
| 64 | - openlayers : { | |
| 65 | - inicia : function(idjanela) { | |
| 66 | - if (!i3GEO.editorOL) { | |
| 67 | - i3GEO.util.scriptTag( | |
| 68 | - i3GEO.configura.locaplic + "/ferramentas/editorol/editorol.js", | |
| 69 | - "i3GEO.editor.openlayers.ativaPainel('" + idjanela + "')", | |
| 70 | - "editorol.js", | |
| 71 | - true); | |
| 72 | - } else { | |
| 73 | - if (!i3GEO.desenho.layergrafico) { | |
| 74 | - i3GEO.desenho.openlayers.criaLayerGrafico(); | |
| 75 | - i3GEO.editorOL.mapa.addLayers([i3GEO.desenho.layergrafico]); | |
| 76 | - } | |
| 77 | - if (!i3GEO.editorOL.backup) { | |
| 78 | - i3GEO.editorOL.backup = new ol.layer.Vector({ | |
| 79 | - source : new ol.source.Vector({ | |
| 80 | - features : new ol.Collection(), | |
| 81 | - useSpatialIndex : false, | |
| 82 | - name : "Backup" | |
| 83 | - }), | |
| 84 | - visible: false | |
| 85 | - }); | |
| 86 | - i3GEO.editorOL.backup.setMap(i3geoOL); | |
| 87 | - i3GEO.editorOL.backup.getFeatures = function(){ | |
| 88 | - return i3GEO.editorOL.backup.getSource().getFeatures(); | |
| 89 | - }; | |
| 90 | - } | |
| 91 | - if(jQuery.isEmptyObject(i3GEO.editorOL.botoes)){ | |
| 92 | - i3GEO.editorOL.botoes = i3GEO.editor.botoes; | |
| 93 | - } | |
| 94 | - i3GEO.editorOL.criaBotoes(i3GEO.editorOL.botoes); | |
| 95 | - } | |
| 96 | - }, | |
| 97 | - criaJanela : function() { | |
| 98 | - if ($i("i3GEOjanelaEditor")) { | |
| 99 | - return "i3GEOjanelaEditor"; | |
| 100 | - } | |
| 101 | - var janela, divid, titulo, cabecalho, minimiza; | |
| 102 | - cabecalho = function() { | |
| 103 | - }; | |
| 104 | - minimiza = function() { | |
| 105 | - i3GEO.janela.minimiza("i3GEOjanelaEditor"); | |
| 106 | - }; | |
| 107 | - // cria a janela flutuante | |
| 108 | - titulo = "<div class='i3GeoTituloJanela'>"+$trad("u29")+"</div>"; | |
| 109 | - janela = i3GEO.janela.cria("300px", "200px", "", "", "", titulo, "i3GEOjanelaEditor", false, "hd", cabecalho, minimiza); | |
| 110 | - divid = janela[2].id; | |
| 111 | - $i("i3GEOjanelaEditor_corpo").style.backgroundColor = "white"; | |
| 112 | - $i("i3GEOjanelaEditor_corpo").style.textAlign = "left"; | |
| 113 | - return divid; | |
| 114 | - }, | |
| 115 | - //TODO utilizar uma janela flutuante ao inves de uma fila de icones | |
| 116 | - ativaPainel : function(idjanela) { | |
| 117 | - i3GEO.editorOL.fundo = "";// i3GEO.editorOL é criado pelo script carregado | |
| 118 | - i3GEO.editorOL.mapa = i3geoOL; | |
| 119 | - i3GEO.editorOL.maxext = ""; | |
| 120 | - i3GEO.editorOL.controles = []; | |
| 121 | - if (!i3GEO.desenho.layergrafico) { | |
| 122 | - i3GEO.desenho.openlayers.criaLayerGrafico(); | |
| 123 | - } | |
| 124 | - if (idjanela && i3GEO.editor.botoes != "") { | |
| 125 | - i3GEO.editorOL.criaBotoes(i3GEO.editor.botoes); | |
| 126 | - } | |
| 127 | - } | |
| 128 | - } | |
| 101 | + if(i3GEO.editor.idsSelecionados.indexOf(id) < 0){ | |
| 102 | + i3GEO.editor.idsSelecionados.push(id); | |
| 103 | + } | |
| 104 | + st = f.getStyle(); | |
| 105 | + //para o caso de pontos | |
| 106 | + if(st && st.getImage()){ | |
| 107 | + f.setStyle( | |
| 108 | + new ol.style.Style({ | |
| 109 | + image: new ol.style.Circle({ | |
| 110 | + radius: i3GEO.editor.simbologia.pointRadius, | |
| 111 | + fill: new ol.style.Fill({ | |
| 112 | + color: 'rgba(255, 255, 255, 0.5)' | |
| 113 | + }), | |
| 114 | + stroke: new ol.style.Stroke({ | |
| 115 | + color: 'blue', | |
| 116 | + width: i3GEO.editor.simbologia.pointRadius / 3 | |
| 117 | + }) | |
| 118 | + }) | |
| 119 | + }) | |
| 120 | + ); | |
| 121 | + if(st.getImage().getSrc){ | |
| 122 | + f.setProperties({ | |
| 123 | + fillColor: "", | |
| 124 | + strokeColor: "", | |
| 125 | + externalGraphic: st.getImage().getSrc(), | |
| 126 | + graphicHeight : st.getImage().getSize()[1], | |
| 127 | + graphicWidth : st.getImage().getSize()[0] | |
| 128 | + }); | |
| 129 | + } | |
| 130 | + else{ | |
| 131 | + f.setProperties({ | |
| 132 | + fillColor: st.getImage().getFill().getColor(), | |
| 133 | + strokeColor: st.getImage().getStroke().getColor(), | |
| 134 | + externalGraphic: "", | |
| 135 | + graphicHeight: "", | |
| 136 | + graphicWidth: "" | |
| 137 | + }); | |
| 138 | + } | |
| 139 | + } | |
| 140 | + else if (st){ | |
| 141 | + if(st.getFill()){ | |
| 142 | + f.setProperties({ | |
| 143 | + fillColor: st.getFill().getColor() | |
| 144 | + }); | |
| 145 | + } | |
| 146 | + if(st.getStroke()){ | |
| 147 | + f.setProperties({ | |
| 148 | + strokeColor: st.getStroke().getColor() | |
| 149 | + }); | |
| 150 | + } | |
| 151 | + if(st.getFill()){ | |
| 152 | + st.getFill().setColor('rgba(255, 255, 255, 0.5)'); | |
| 153 | + } | |
| 154 | + if(st.getStroke()){ | |
| 155 | + st.getStroke().setColor('blue'); | |
| 156 | + } | |
| 157 | + } | |
| 158 | + } | |
| 159 | + i3GEO.desenho.layergrafico.getSource().changed(); | |
| 160 | + }, | |
| 161 | + unselAll: function(id){ | |
| 162 | + var i, n, f, s, st; | |
| 163 | + s = i3GEO.desenho.layergrafico.getSource(); | |
| 164 | + n = i3GEO.editor.idsSelecionados.length; | |
| 165 | + for(i=0; i<n; i++){ | |
| 166 | + if(id && id != i3GEO.editor.idsSelecionados[i]){ | |
| 167 | + continue; | |
| 168 | + } | |
| 169 | + f = s.getFeatureById(i3GEO.editor.idsSelecionados[i]); | |
| 170 | + if(f){ | |
| 171 | + st = f.getStyle(); | |
| 172 | + //caso de ponto | |
| 173 | + if(st && st.getImage()){ | |
| 174 | + if(st.getImage().getSrc || f.getProperties().externalGraphic != ""){ | |
| 175 | + f.setStyle( | |
| 176 | + new ol.style.Style({ | |
| 177 | + image: new ol.style.Icon({ | |
| 178 | + src : f.getProperties().externalGraphic, | |
| 179 | + size : [f.getProperties().graphicWidth,f.getProperties().graphicHeight] | |
| 180 | + }) | |
| 181 | + }) | |
| 182 | + ); | |
| 183 | + } | |
| 184 | + else{ | |
| 185 | + f.setStyle( | |
| 186 | + new ol.style.Style({ | |
| 187 | + image: new ol.style.Circle({ | |
| 188 | + radius: i3GEO.editor.simbologia.pointRadius, | |
| 189 | + fill: new ol.style.Fill({ | |
| 190 | + color: f.getProperties().fillColor | |
| 191 | + }), | |
| 192 | + stroke: new ol.style.Stroke({ | |
| 193 | + color: f.getProperties().strokeColor, | |
| 194 | + width: i3GEO.editor.simbologia.pointRadius / 3 | |
| 195 | + }) | |
| 196 | + }) | |
| 197 | + }) | |
| 198 | + ); | |
| 199 | + } | |
| 200 | + } | |
| 201 | + else if(st){ | |
| 202 | + if(f.getProperties().fillColor){ | |
| 203 | + st.getFill().setColor(f.getProperties().fillColor); | |
| 204 | + } | |
| 205 | + if(f.getProperties().strokeColor){ | |
| 206 | + st.getStroke().setColor(f.getProperties().strokeColor); | |
| 207 | + } | |
| 208 | + } | |
| 209 | + } | |
| 210 | + } | |
| 211 | + if(id){ | |
| 212 | + i3GEO.editor.idsSelecionados.remove(id); | |
| 213 | + } else { | |
| 214 | + i3GEO.editor.idsSelecionados = []; | |
| 215 | + } | |
| 216 | + i3GEO.desenho.layergrafico.getSource().changed(); | |
| 217 | + }, | |
| 218 | + selectOne: function(){ | |
| 219 | + i3GEO.eventos.cliquePerm.desativa(); | |
| 220 | + i3GEO.editor.removeInteracoes(); | |
| 221 | + var sel = new ol.interaction.Select(); | |
| 222 | + i3GEO.editor.interacoes = sel; | |
| 223 | + i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 224 | + sel.on("select", function(evt) { | |
| 225 | + var s,i, n, id, f; | |
| 226 | + n = evt.selected.length; | |
| 227 | + for(i=0; i<n; i++){ | |
| 228 | + f = evt.selected[i]; | |
| 229 | + id = f.getId(); | |
| 230 | + if(id && i3GEO.util.in_array(id,i3GEO.editor.idsSelecionados)){ | |
| 231 | + i3GEO.editor.unselFeature(id); | |
| 232 | + } | |
| 233 | + else{ | |
| 234 | + id = i3GEO.util.uid(); | |
| 235 | + i3GEO.editor.idsSelecionados.push(id); | |
| 236 | + f.setId(id); | |
| 237 | + | |
| 238 | + s = f.getStyle(); | |
| 239 | + | |
| 240 | + if(s && s.getImage()){ | |
| 241 | + f.setStyle( | |
| 242 | + new ol.style.Style({ | |
| 243 | + image: new ol.style.Circle({ | |
| 244 | + radius: i3GEO.editor.simbologia.pointRadius, | |
| 245 | + fill: new ol.style.Fill({ | |
| 246 | + color: 'rgba(255, 255, 255, 0.5)' | |
| 247 | + }), | |
| 248 | + stroke: new ol.style.Stroke({ | |
| 249 | + color: 'blue', | |
| 250 | + width: i3GEO.editor.simbologia.pointRadius / 3 | |
| 251 | + }) | |
| 252 | + }) | |
| 253 | + }) | |
| 254 | + ); | |
| 255 | + if(!s.getImage().getSrc){ | |
| 256 | + f.setProperties({ | |
| 257 | + fillColor: s.getImage().getFill().getColor(), | |
| 258 | + strokeColor: s.getImage().getStroke().getColor(), | |
| 259 | + externalGraphic: "", | |
| 260 | + graphicHeight : 25, | |
| 261 | + graphicWidth : 25 | |
| 262 | + }); | |
| 263 | + } | |
| 264 | + else{ | |
| 265 | + f.setProperties({ | |
| 266 | + fillColor: "", | |
| 267 | + strokeColor: "", | |
| 268 | + externalGraphic: s.getImage().getSrc(), | |
| 269 | + graphicHeight : s.getImage().getSize()[1], | |
| 270 | + graphicWidth : s.getImage().getSize()[0] | |
| 271 | + }); | |
| 272 | + } | |
| 273 | + } | |
| 274 | + else{ | |
| 275 | + f.setProperties({ | |
| 276 | + externalGraphic: "", | |
| 277 | + graphicHeight : 25, | |
| 278 | + graphicWidth : 25 | |
| 279 | + }); | |
| 280 | + if(s.getFill()){ | |
| 281 | + f.setProperties({fillColor: s.getFill().getColor()}); | |
| 282 | + s.getFill().setColor('rgba(255, 255, 255, 0.5)'); | |
| 283 | + } | |
| 284 | + if(s.getStroke()){ | |
| 285 | + f.setProperties({strokeColor: s.getStroke().getColor()}); | |
| 286 | + s.getStroke().setColor('blue'); | |
| 287 | + } | |
| 288 | + } | |
| 289 | + } | |
| 290 | + } | |
| 291 | + if (n === 0){ | |
| 292 | + i3GEO.editor.unselAll(); | |
| 293 | + } | |
| 294 | + i3GEO.editor.removeInteracoes(); | |
| 295 | + setTimeout(function() { | |
| 296 | + i3GEO.eventos.cliquePerm.ativa(); | |
| 297 | + },1000); | |
| 298 | + }); | |
| 299 | + i3geoOL.addInteraction(sel); | |
| 300 | + }, | |
| 301 | + edit: function(){ | |
| 302 | + i3GEO.editor.featuresBackup = []; | |
| 303 | + var draw, nsel, f, c; | |
| 304 | + nsel = i3GEO.editor.idsSelecionados.length; | |
| 305 | + if(nsel == 1){ | |
| 306 | + i3GEO.editor.removeInteracoes(); | |
| 307 | + i3GEO.eventos.cliquePerm.desativa(); | |
| 308 | + f = i3GEO.desenho.layergrafico.getSource().getFeatureById(i3GEO.editor.idsSelecionados[nsel - 1]); | |
| 309 | + i3GEO.editor.featuresBackup.push(f.clone()); | |
| 310 | + c = new ol.Collection(); | |
| 311 | + c.push(f); | |
| 312 | + draw = new ol.interaction.Modify({ | |
| 313 | + features: c | |
| 314 | + }); | |
| 315 | + i3GEO.editor.interacoes = draw; | |
| 316 | + i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 317 | + i3geoOL.addInteraction(draw); | |
| 318 | + } | |
| 319 | + else{ | |
| 320 | + i3GEO.janela.tempoMsg($trad("seluma")); | |
| 321 | + } | |
| 322 | + }, | |
| 323 | + orderToFront: function(){ | |
| 324 | + var nsel = i3GEO.editor.idsSelecionados.length; | |
| 325 | + if(nsel > 0){ | |
| 326 | + var s, i, nsel, id, clone; | |
| 327 | + s = i3GEO.desenho.layergrafico.getSource(); | |
| 328 | + nsel = i3GEO.editor.idsSelecionados.length; | |
| 329 | + for(i=0; i<nsel; i++){ | |
| 330 | + f = s.getFeatureById(i3GEO.editor.idsSelecionados[i]); | |
| 331 | + if(f){ | |
| 332 | + clone = f.clone(); | |
| 333 | + id = f.getId(); | |
| 334 | + s.removeFeature(f); | |
| 335 | + clone.setId(id); | |
| 336 | + s.addFeature(clone); | |
| 337 | + } | |
| 338 | + } | |
| 339 | + s.changed(); | |
| 340 | + } | |
| 341 | + else{ | |
| 342 | + i3GEO.janela.tempoMsg($trad("selum")); | |
| 343 | + } | |
| 344 | + }, | |
| 345 | + editCut: function(){ | |
| 346 | + var nsel = i3GEO.editor.idsSelecionados.length; | |
| 347 | + if (nsel != 1) { | |
| 348 | + i3GEO.janela.tempoMsg("Selecione primeiro um elemento para ser cortado"); | |
| 349 | + } else { | |
| 350 | + i3GEO.eventos.cliquePerm.desativa(); | |
| 351 | + i3GEO.editor.removeInteracoes(); | |
| 352 | + i3GEO.janela.tempoMsg("Desenhe um polígono"); | |
| 353 | + var draw = new ol.interaction.Draw({ | |
| 354 | + type : "Polygon" | |
| 355 | + }); | |
| 356 | + //adiciona a interacao para poder ser removida | |
| 357 | + i3GEO.editor.interacoes = draw; | |
| 358 | + i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 359 | + draw.on("drawend", function(evt) { | |
| 360 | + var temp, f, c, format, fwkt, cwkt; | |
| 361 | + f = evt.feature; | |
| 362 | + c = i3GEO.desenho.layergrafico.getSource().getFeatureById(i3GEO.editor.idsSelecionados[nsel - 1]); | |
| 363 | + i3GEO.editor.featuresBackup.push(c.clone()); | |
| 364 | + //corta | |
| 365 | + format = new ol.format.WKT(); | |
| 366 | + if(f && c){ | |
| 367 | + fwkt = format.writeFeatures([f]); | |
| 368 | + cwkt = format.writeFeatures([c]); | |
| 369 | + if(fwkt && cwkt){ | |
| 370 | + temp = function(retorno) { | |
| 371 | + i3GEO.janela.fechaAguarde("i3GEO.cortador"); | |
| 372 | + if (retorno != "" && retorno.data && retorno.data != "") { | |
| 373 | + i3GEO.editor.removeInteracoes(); | |
| 374 | + i3GEO.eventos.cliquePerm.ativa(); | |
| 375 | + i3GEO.janela.fechaAguarde("i3GEO.cortador"); | |
| 376 | + c.setGeometry(format.readGeometry(retorno.data)); | |
| 377 | + if (document.getElementById("panellistagEditor")) { | |
| 378 | + i3GEO.editor.listaGeometrias(); | |
| 379 | + } | |
| 380 | + } | |
| 381 | + }; | |
| 382 | + i3GEO.janela.abreAguarde("i3GEO.cortador", "Cortando"); | |
| 383 | + i3GEO.php.funcoesGeometriasWkt(temp, cwkt + "|" + fwkt, "difference"); | |
| 384 | + } | |
| 385 | + } | |
| 386 | + }); | |
| 387 | + i3geoOL.addInteraction(draw); | |
| 388 | + } | |
| 389 | + }, | |
| 390 | + drawText : function(drawendcallback){ | |
| 391 | + i3GEO.eventos.cliquePerm.desativa(); | |
| 392 | + i3GEO.editor.removeInteracoes(); | |
| 393 | + var draw = new ol.interaction.Draw({ | |
| 394 | + type : "Point" | |
| 395 | + }); | |
| 396 | + //adiciona a interacao para poder ser removida | |
| 397 | + i3GEO.editor.interacoes = draw; | |
| 398 | + i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 399 | + draw.on("drawend", function(evt) { | |
| 400 | + var texto = window.prompt("Texto", ""); | |
| 401 | + evt.feature.setStyle( | |
| 402 | + new ol.style.Style({ | |
| 403 | + text: new ol.style.Text({ | |
| 404 | + text: texto, | |
| 405 | + font: 'Bold ' + parseInt(i3GEO.editor.simbologia.fontSize,10) + 'px Arial', | |
| 406 | + textAlign: 'left', | |
| 407 | + stroke: new ol.style.Stroke({ | |
| 408 | + color: 'white', | |
| 409 | + width: i3GEO.editor.simbologia.strokeWidth | |
| 410 | + }), | |
| 411 | + fill: new ol.style.Fill({ | |
| 412 | + color: i3GEO.editor.simbologia.fontColor | |
| 413 | + }), | |
| 414 | + zIndex: 2000 | |
| 415 | + }) | |
| 416 | + }) | |
| 417 | + ); | |
| 418 | + evt.feature.setId(i3GEO.util.uid()); | |
| 419 | + i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature); | |
| 420 | + i3GEO.editor.removeInteracoes(); | |
| 421 | + setTimeout(function() { | |
| 422 | + i3GEO.eventos.cliquePerm.ativa(); | |
| 423 | + },1000); | |
| 424 | + }); | |
| 425 | + if(drawendcallback){ | |
| 426 | + draw.on("drawend",drawendcallback); | |
| 427 | + } | |
| 428 | + i3geoOL.addInteraction(draw); | |
| 429 | + }, | |
| 430 | + drawPoint : function(drawendcallback){ | |
| 431 | + i3GEO.eventos.cliquePerm.desativa(); | |
| 432 | + i3GEO.editor.removeInteracoes(); | |
| 433 | + var draw = new ol.interaction.Draw({ | |
| 434 | + type : "Point" | |
| 435 | + }); | |
| 436 | + //adiciona a interacao para poder ser removida | |
| 437 | + i3GEO.editor.interacoes = draw; | |
| 438 | + i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 439 | + draw.on("drawend", function(evt) { | |
| 440 | + var simbolo, url; | |
| 441 | + url = i3GEO.editor.simbologia.externalGraphic; | |
| 442 | + if(url === ""){ | |
| 443 | + simbolo = new ol.style.Circle({ | |
| 444 | + radius: i3GEO.editor.simbologia.pointRadius, | |
| 445 | + fill: new ol.style.Fill({ | |
| 446 | + color: 'rgba(' + i3GEO.editor.simbologia.fillColor + ',' + i3GEO.editor.simbologia.opacidade + ')' | |
| 447 | + }), | |
| 448 | + stroke: new ol.style.Stroke({ | |
| 449 | + color: 'rgba(' + i3GEO.editor.simbologia.strokeColor + ',' + i3GEO.editor.simbologia.opacidade + ')', | |
| 450 | + width: i3GEO.editor.simbologia.pointRadius / 3 | |
| 451 | + }) | |
| 452 | + }); | |
| 453 | + } | |
| 454 | + else{ | |
| 455 | + simbolo = new ol.style.Icon({ | |
| 456 | + src : url, | |
| 457 | + size : [i3GEO.editor.simbologia.graphicWidth,i3GEO.editor.simbologia.graphicHeight] | |
| 458 | + }); | |
| 459 | + } | |
| 460 | + evt.feature.setStyle( | |
| 461 | + new ol.style.Style({ | |
| 462 | + image: simbolo | |
| 463 | + }) | |
| 464 | + ); | |
| 465 | + evt.feature.setId(i3GEO.util.uid()); | |
| 466 | + i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature); | |
| 467 | + i3GEO.editor.removeInteracoes(); | |
| 468 | + setTimeout(function() { | |
| 469 | + i3GEO.eventos.cliquePerm.ativa(); | |
| 470 | + },1000); | |
| 471 | + | |
| 472 | + if (document.getElementById("panellistagEditor")) { | |
| 473 | + i3GEO.editor.listaGeometrias(); | |
| 474 | + } | |
| 475 | + }); | |
| 476 | + if(drawendcallback){ | |
| 477 | + draw.on("drawend",drawendcallback); | |
| 478 | + } | |
| 479 | + i3geoOL.addInteraction(draw); | |
| 480 | + }, | |
| 481 | + drawLineString : function(drawendcallback){ | |
| 482 | + i3GEO.eventos.cliquePerm.desativa(); | |
| 483 | + i3GEO.editor.removeInteracoes(); | |
| 484 | + var draw = new ol.interaction.Draw({ | |
| 485 | + type : "LineString" | |
| 486 | + }); | |
| 487 | + //adiciona a interacao para poder ser removida | |
| 488 | + i3GEO.editor.interacoes = draw; | |
| 489 | + //desativa ol.interaction.DoubleClickZoom | |
| 490 | + i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 491 | + draw.on("drawend", function(evt) { | |
| 492 | + evt.feature.setStyle( | |
| 493 | + new ol.style.Style({ | |
| 494 | + stroke: new ol.style.Stroke({ | |
| 495 | + color: 'rgba(' + i3GEO.editor.simbologia.strokeColor + ',' + i3GEO.editor.simbologia.opacidade + ')', | |
| 496 | + width: i3GEO.editor.simbologia.strokeWidth | |
| 497 | + }), | |
| 498 | + fill: new ol.style.Fill({ | |
| 499 | + color: 'rgba(' + i3GEO.editor.simbologia.fillColor + ',' + i3GEO.editor.simbologia.opacidade + ')' | |
| 500 | + }) | |
| 501 | + }) | |
| 502 | + ); | |
| 503 | + evt.feature.setId(i3GEO.util.uid()); | |
| 504 | + i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature); | |
| 505 | + i3GEO.editor.removeInteracoes(); | |
| 506 | + i3GEO.eventos.cliquePerm.ativa(); | |
| 507 | + if (document.getElementById("panellistagEditor")) { | |
| 508 | + i3GEO.editor.listaGeometrias(); | |
| 509 | + } | |
| 510 | + }); | |
| 511 | + if(drawendcallback){ | |
| 512 | + draw.on("drawend",drawendcallback); | |
| 513 | + } | |
| 514 | + i3geoOL.addInteraction(draw); | |
| 515 | + }, | |
| 516 | + drawPolygon : function(drawendcallback){ | |
| 517 | + i3GEO.eventos.cliquePerm.desativa(); | |
| 518 | + i3GEO.editor.removeInteracoes(); | |
| 519 | + var draw = new ol.interaction.Draw({ | |
| 520 | + type : "Polygon" | |
| 521 | + }); | |
| 522 | + //adiciona a interacao para poder ser removida | |
| 523 | + i3GEO.editor.interacoes = draw; | |
| 524 | + i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 525 | + draw.on("drawend", function(evt) { | |
| 526 | + evt.feature.setStyle( | |
| 527 | + new ol.style.Style({ | |
| 528 | + stroke: new ol.style.Stroke({ | |
| 529 | + color: 'rgba(' + i3GEO.editor.simbologia.strokeColor + ',' + i3GEO.editor.simbologia.opacidade + ')', | |
| 530 | + width: i3GEO.editor.simbologia.strokeWidth | |
| 531 | + }), | |
| 532 | + fill: new ol.style.Fill({ | |
| 533 | + color: 'rgba(' + i3GEO.editor.simbologia.fillColor + ',' + i3GEO.editor.simbologia.opacidade + ')' | |
| 534 | + }) | |
| 535 | + }) | |
| 536 | + ); | |
| 537 | + evt.feature.setId(i3GEO.util.uid()); | |
| 538 | + i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature); | |
| 539 | + i3GEO.editor.removeInteracoes(); | |
| 540 | + i3GEO.eventos.cliquePerm.ativa(); | |
| 541 | + if (document.getElementById("panellistagEditor")) { | |
| 542 | + i3GEO.editor.listaGeometrias(); | |
| 543 | + } | |
| 544 | + }); | |
| 545 | + if(drawendcallback){ | |
| 546 | + draw.on("drawend",drawendcallback); | |
| 547 | + } | |
| 548 | + i3geoOL.addInteraction(draw); | |
| 549 | + }, | |
| 550 | + criaLayerBackup : function(){ | |
| 551 | + if (i3GEO.editor && !i3GEO.editor.backup) { | |
| 552 | + i3GEO.editor.backup = new ol.layer.Vector({ | |
| 553 | + source : new ol.source.Vector({ | |
| 554 | + features : new ol.Collection(), | |
| 555 | + useSpatialIndex : false, | |
| 556 | + name : "Backup" | |
| 557 | + }), | |
| 558 | + visible: false | |
| 559 | + }); | |
| 560 | + i3GEO.editor.backup.setMap(i3geoOL); | |
| 561 | + i3GEO.editor.backup.getFeatures = function(){ | |
| 562 | + return i3GEO.editor.backup.getSource().getFeatures(); | |
| 563 | + }; | |
| 564 | + } | |
| 565 | + }, | |
| 566 | + criaJanela : function() { | |
| 567 | + if ($i("i3GEOjanelaEditor")) { | |
| 568 | + return "i3GEOjanelaEditor"; | |
| 569 | + } | |
| 570 | + var janela, divid, titulo, cabecalho, minimiza; | |
| 571 | + cabecalho = function() { | |
| 572 | + }; | |
| 573 | + minimiza = function() { | |
| 574 | + i3GEO.janela.minimiza("i3GEOjanelaEditor"); | |
| 575 | + }; | |
| 576 | + // cria a janela flutuante | |
| 577 | + titulo = "<div class='i3GeoTituloJanela'>"+$trad("u29")+"</div>"; | |
| 578 | + janela = i3GEO.janela.cria("300px", "200px", "", "", "", titulo, "i3GEOjanelaEditor", false, "hd", cabecalho, minimiza); | |
| 579 | + divid = janela[2].id; | |
| 580 | + $i("i3GEOjanelaEditor_corpo").style.backgroundColor = "white"; | |
| 581 | + $i("i3GEOjanelaEditor_corpo").style.textAlign = "left"; | |
| 582 | + return divid; | |
| 583 | + } | |
| 129 | 584 | }; |
| 130 | 585 | \ No newline at end of file | ... | ... |
js/guias.js
| ... | ... | @@ -33,628 +33,628 @@ |
| 33 | 33 | * 330, Boston, MA 02111-1307 USA. |
| 34 | 34 | */ |
| 35 | 35 | if (typeof (i3GEO) === 'undefined') { |
| 36 | - var i3GEO = {}; | |
| 36 | + var i3GEO = {}; | |
| 37 | 37 | } |
| 38 | 38 | i3GEO.guias = |
| 39 | 39 | { |
| 40 | - LARGURAGUIAMOVEL : 350, | |
| 41 | - /** | |
| 42 | - * Propriedade: CONFIGURA | |
| 43 | - * | |
| 44 | - * Define os parâmetros de cada guia que será mostrada no mapa, como título, conteúdo, etc. | |
| 45 | - * | |
| 46 | - * Você pode modificar o nome de uma guia como no exemplo | |
| 47 | - * | |
| 48 | - * i3GEO.guias.CONFIGURA.legenda.titulo = "nome diferente"; | |
| 49 | - * | |
| 50 | - * Por padrão são definidas as guias legenda, temas, adiciona e mapas (links) | |
| 51 | - * | |
| 52 | - * Exemplo: | |
| 53 | - * | |
| 54 | - * (start code) | |
| 55 | - * | |
| 56 | - * i3GEO.guias.CONFIGURA.legenda = { icone : "imagens/gisicons/show-legend.png", titulo : "Legenda", id : "guia4", idconteudo : | |
| 57 | - * "guia4obj", click : function() { i3GEO.guias.mostra("legenda"); i3GEO.mapa.legendaHTML.cria("guia4obj"); } }; | |
| 58 | - * | |
| 59 | - * (end) | |
| 60 | - * | |
| 61 | - * Tipo: | |
| 62 | - * | |
| 63 | - * {objeto} | |
| 64 | - */ | |
| 65 | - CONFIGURA : { | |
| 66 | - "zoomanterior" : { | |
| 67 | - icone : "imagens/gisicons/zoom-last.png", | |
| 68 | - titulo : "", | |
| 69 | - id : "guiaZoomanterior", | |
| 70 | - idconteudo : "", | |
| 71 | - click : function() { | |
| 72 | - i3GEO.navega.extensaoAnterior(); | |
| 73 | - } | |
| 74 | - }, | |
| 75 | - "zoomli" : { | |
| 76 | - icone : "imagens/gisicons/zoom-region.png", | |
| 77 | - titulo : $trad("d3"), | |
| 78 | - id : "guiaZoomli", | |
| 79 | - idconteudo : "", | |
| 80 | - click : function() { | |
| 81 | - if (DetectaMobile("DetectMobileLong")) { | |
| 82 | - i3GEO.janela.tempoMsg($trad("x70")); | |
| 83 | - } else { | |
| 84 | - i3GEO.janela.tempoMsg($trad("x69")); | |
| 85 | - } | |
| 86 | - if (i3GEO.Interface.ATUAL === "googlemaps") { | |
| 87 | - // alert("Pressione a tecla CTRL junto com o botão esquerdo do mouse"); | |
| 88 | - i3GeoMap.setOptions({ | |
| 89 | - draggable : true | |
| 90 | - }); | |
| 91 | - } | |
| 40 | + LARGURAGUIAMOVEL : 350, | |
| 41 | + /** | |
| 42 | + * Propriedade: CONFIGURA | |
| 43 | + * | |
| 44 | + * Define os parâmetros de cada guia que será mostrada no mapa, como título, conteúdo, etc. | |
| 45 | + * | |
| 46 | + * Você pode modificar o nome de uma guia como no exemplo | |
| 47 | + * | |
| 48 | + * i3GEO.guias.CONFIGURA.legenda.titulo = "nome diferente"; | |
| 49 | + * | |
| 50 | + * Por padrão são definidas as guias legenda, temas, adiciona e mapas (links) | |
| 51 | + * | |
| 52 | + * Exemplo: | |
| 53 | + * | |
| 54 | + * (start code) | |
| 55 | + * | |
| 56 | + * i3GEO.guias.CONFIGURA.legenda = { icone : "imagens/gisicons/show-legend.png", titulo : "Legenda", id : "guia4", idconteudo : | |
| 57 | + * "guia4obj", click : function() { i3GEO.guias.mostra("legenda"); i3GEO.mapa.legendaHTML.cria("guia4obj"); } }; | |
| 58 | + * | |
| 59 | + * (end) | |
| 60 | + * | |
| 61 | + * Tipo: | |
| 62 | + * | |
| 63 | + * {objeto} | |
| 64 | + */ | |
| 65 | + CONFIGURA : { | |
| 66 | + "zoomanterior" : { | |
| 67 | + icone : "imagens/gisicons/zoom-last.png", | |
| 68 | + titulo : "", | |
| 69 | + id : "guiaZoomanterior", | |
| 70 | + idconteudo : "", | |
| 71 | + click : function() { | |
| 72 | + i3GEO.navega.extensaoAnterior(); | |
| 73 | + } | |
| 74 | + }, | |
| 75 | + "zoomli" : { | |
| 76 | + icone : "imagens/gisicons/zoom-region.png", | |
| 77 | + titulo : $trad("d3"), | |
| 78 | + id : "guiaZoomli", | |
| 79 | + idconteudo : "", | |
| 80 | + click : function() { | |
| 81 | + if (DetectaMobile("DetectMobileLong")) { | |
| 82 | + i3GEO.janela.tempoMsg($trad("x70")); | |
| 83 | + } else { | |
| 84 | + i3GEO.janela.tempoMsg($trad("x69")); | |
| 85 | + } | |
| 86 | + if (i3GEO.Interface.ATUAL === "googlemaps") { | |
| 87 | + // alert("Pressione a tecla CTRL junto com o botão esquerdo do mouse"); | |
| 88 | + i3GeoMap.setOptions({ | |
| 89 | + draggable : true | |
| 90 | + }); | |
| 91 | + } | |
| 92 | + } | |
| 93 | + }, | |
| 94 | + "zoomproximo" : { | |
| 95 | + icone : "imagens/gisicons/zoom-next.png", | |
| 96 | + titulo : "", | |
| 97 | + id : "guiaZoomproximo", | |
| 98 | + idconteudo : "", | |
| 99 | + click : function() { | |
| 100 | + i3GEO.navega.extensaoProximo(); | |
| 101 | + } | |
| 102 | + }, | |
| 103 | + "zoomtot" : { | |
| 104 | + icone : "imagens/gisicons/zoom-extent.png", | |
| 105 | + titulo : $trad("d2"), | |
| 106 | + id : "guiaZoomtot", | |
| 107 | + idconteudo : "", | |
| 108 | + click : function() { | |
| 109 | + if (i3GEO.Interface.ATUAL === "openlayers") { | |
| 110 | + i3GEO.Interface.openlayers.zoom2ext(i3GEO.parametros.extentTotal); | |
| 111 | + return; | |
| 112 | + } | |
| 113 | + if (i3GEO.Interface.ATUAL === "googlemaps") { | |
| 114 | + i3GEO.Interface.googlemaps.zoom2extent(i3GEO.parametros.extentTotal); | |
| 115 | + return; | |
| 116 | + } | |
| 117 | + } | |
| 118 | + }, | |
| 119 | + "identificaBalao" : { | |
| 120 | + icone : "imagens/gisicons/tips.png", | |
| 121 | + titulo : $trad("d7a"), | |
| 122 | + id : "guiaIdentificaBalao", | |
| 123 | + idconteudo : "", | |
| 124 | + click : function() { | |
| 125 | + if (typeof (console) !== 'undefined') | |
| 126 | + console.info("click no botao identifica balao"); | |
| 127 | + | |
| 128 | + i3GEO.mapa.ativaIdentificaBalao(); | |
| 129 | + } | |
| 130 | + }, | |
| 131 | + "identifica" : { | |
| 132 | + icone : "imagens/gisicons/pointer-info.png", | |
| 133 | + titulo : $trad("d7"), | |
| 134 | + id : "guiaIdentifica", | |
| 135 | + idconteudo : "", | |
| 136 | + click : function() { | |
| 137 | + if (typeof (console) !== 'undefined') | |
| 138 | + console.info("click no botao identifica"); | |
| 139 | + | |
| 140 | + //$('.iconeGuiaMovel').tooltip('destroy'); | |
| 141 | + i3GEO.mapa.ativaIdentifica(); | |
| 142 | + | |
| 143 | + } | |
| 144 | + }, | |
| 145 | + "mapas" : { | |
| 146 | + icone : "imagens/gisicons/show-links.png", | |
| 147 | + titulo : "Links", | |
| 148 | + id : "guia5", | |
| 149 | + idconteudo : "guia5obj", | |
| 150 | + mostraLink : function(id, url) { | |
| 151 | + $i("i3geoMapasLink_" + id).innerHTML = "<a href='" + url + "' target=_blank >" + $trad("abreMapa") + "</a>"; | |
| 152 | + }, | |
| 153 | + click : function(onde) { | |
| 154 | + if (!onde) { | |
| 155 | + onde = i3GEO.guias.CONFIGURA.mapas.idconteudo; | |
| 156 | + } | |
| 157 | + //$('.iconeGuiaMovel').tooltip('destroy'); | |
| 158 | + var pegaMapas = | |
| 159 | + function(retorno) { | |
| 160 | + var ins, mapa, ig1lt, ig1, nome, lkd, link, temp, combo, urlinterface; | |
| 161 | + ins = "<br><div id='banners' style='overflow:auto;text-align:center'>"; | |
| 162 | + | |
| 163 | + ins += "<br>"; | |
| 164 | + mapa = retorno.data.mapas; | |
| 165 | + ig1lt = mapa.length; | |
| 166 | + ig1 = 0; | |
| 167 | + urlinterface = window.location.origin + window.location.pathname; | |
| 168 | + if (ig1lt > 0) { | |
| 169 | + do { | |
| 170 | + temp = mapa[ig1]; | |
| 171 | + nome = temp.NOME; | |
| 172 | + if (temp.PUBLICADO) { | |
| 173 | + if (temp.PUBLICADO.toLowerCase() === "nao") { | |
| 174 | + nome = "<s>" + nome + "</s>"; | |
| 175 | + } | |
| 92 | 176 | } |
| 93 | - }, | |
| 94 | - "zoomproximo" : { | |
| 95 | - icone : "imagens/gisicons/zoom-next.png", | |
| 96 | - titulo : "", | |
| 97 | - id : "guiaZoomproximo", | |
| 98 | - idconteudo : "", | |
| 99 | - click : function() { | |
| 100 | - i3GEO.navega.extensaoProximo(); | |
| 177 | + lkd = temp.LINK; | |
| 178 | + link = i3GEO.configura.locaplic + "/ms_criamapa.php?temasa=" + temp.TEMAS + "&layers=" + temp.LIGADOS; | |
| 179 | + if (temp.EXTENSAO !== "") { | |
| 180 | + link += "&mapext=" + temp.EXTENSAO; | |
| 101 | 181 | } |
| 102 | - }, | |
| 103 | - "zoomtot" : { | |
| 104 | - icone : "imagens/gisicons/zoom-extent.png", | |
| 105 | - titulo : $trad("d2"), | |
| 106 | - id : "guiaZoomtot", | |
| 107 | - idconteudo : "", | |
| 108 | - click : function() { | |
| 109 | - if (i3GEO.Interface.ATUAL === "openlayers") { | |
| 110 | - i3GEO.Interface.openlayers.zoom2ext(i3GEO.parametros.extentTotal); | |
| 111 | - return; | |
| 112 | - } | |
| 113 | - if (i3GEO.Interface.ATUAL === "googlemaps") { | |
| 114 | - i3GEO.Interface.googlemaps.zoom2extent(i3GEO.parametros.extentTotal); | |
| 115 | - return; | |
| 116 | - } | |
| 182 | + if (temp.OUTROS !== "") { | |
| 183 | + link += "&" + temp.OUTROS; | |
| 117 | 184 | } |
| 118 | - }, | |
| 119 | - "identificaBalao" : { | |
| 120 | - icone : "imagens/gisicons/tips.png", | |
| 121 | - titulo : $trad("d7a"), | |
| 122 | - id : "guiaIdentificaBalao", | |
| 123 | - idconteudo : "", | |
| 124 | - click : function() { | |
| 125 | - if (typeof (console) !== 'undefined') | |
| 126 | - console.info("click no botao identifica balao"); | |
| 127 | - | |
| 128 | - i3GEO.mapa.ativaIdentificaBalao(); | |
| 185 | + if (lkd !== "") { | |
| 186 | + link = lkd; | |
| 129 | 187 | } |
| 130 | - }, | |
| 131 | - "identifica" : { | |
| 132 | - icone : "imagens/gisicons/pointer-info.png", | |
| 133 | - titulo : $trad("d7"), | |
| 134 | - id : "guiaIdentifica", | |
| 135 | - idconteudo : "", | |
| 136 | - click : function() { | |
| 137 | - if (typeof (console) !== 'undefined') | |
| 138 | - console.info("click no botao identifica"); | |
| 139 | - | |
| 140 | - //$('.iconeGuiaMovel').tooltip('destroy'); | |
| 141 | - i3GEO.mapa.ativaIdentifica(); | |
| 188 | + ins += | |
| 189 | + "<div style='cursor:pointer; height: 120px;float: left;width:45%;background-color:white;padding:5px;margin:5px;border: 1px solid #F0F0F0;border-radius: 5px;box-shadow: 1px 1px 1px 1px #D3D3D3;' >"; | |
| 142 | 190 | |
| 191 | + if (temp.IMAGEM && temp.IMAGEM != "") { | |
| 192 | + ins += | |
| 193 | + "<div style='float:left;margin:2px' ><a href='" + link | |
| 194 | + + "' style=text-align:center;text-decoration:none; >" | |
| 195 | + + "<img src='" | |
| 196 | + + temp.IMAGEM | |
| 197 | + + "'></a></div>"; | |
| 143 | 198 | } |
| 144 | - }, | |
| 145 | - "mapas" : { | |
| 146 | - icone : "imagens/gisicons/show-links.png", | |
| 147 | - titulo : "Links", | |
| 148 | - id : "guia5", | |
| 149 | - idconteudo : "guia5obj", | |
| 150 | - mostraLink : function(id, url) { | |
| 151 | - $i("i3geoMapasLink_" + id).innerHTML = "<a href='" + url + "' target=_blank >" + $trad("abreMapa") + "</a>"; | |
| 152 | - }, | |
| 153 | - click : function(onde) { | |
| 154 | - if (!onde) { | |
| 155 | - onde = i3GEO.guias.CONFIGURA.mapas.idconteudo; | |
| 156 | - } | |
| 157 | - //$('.iconeGuiaMovel').tooltip('destroy'); | |
| 158 | - var pegaMapas = | |
| 159 | - function(retorno) { | |
| 160 | - var ins, mapa, ig1lt, ig1, nome, lkd, link, temp, combo, urlinterface; | |
| 161 | - ins = "<br><div id='banners' style='overflow:auto;text-align:center'>"; | |
| 162 | - | |
| 163 | - ins += "<br>"; | |
| 164 | - mapa = retorno.data.mapas; | |
| 165 | - ig1lt = mapa.length; | |
| 166 | - ig1 = 0; | |
| 167 | - urlinterface = window.location.origin + window.location.pathname; | |
| 168 | - if (ig1lt > 0) { | |
| 169 | - do { | |
| 170 | - temp = mapa[ig1]; | |
| 171 | - nome = temp.NOME; | |
| 172 | - if (temp.PUBLICADO) { | |
| 173 | - if (temp.PUBLICADO.toLowerCase() === "nao") { | |
| 174 | - nome = "<s>" + nome + "</s>"; | |
| 175 | - } | |
| 176 | - } | |
| 177 | - lkd = temp.LINK; | |
| 178 | - link = i3GEO.configura.locaplic + "/ms_criamapa.php?temasa=" + temp.TEMAS + "&layers=" + temp.LIGADOS; | |
| 179 | - if (temp.EXTENSAO !== "") { | |
| 180 | - link += "&mapext=" + temp.EXTENSAO; | |
| 181 | - } | |
| 182 | - if (temp.OUTROS !== "") { | |
| 183 | - link += "&" + temp.OUTROS; | |
| 184 | - } | |
| 185 | - if (lkd !== "") { | |
| 186 | - link = lkd; | |
| 187 | - } | |
| 188 | - ins += | |
| 189 | - "<div style='cursor:pointer; height: 120px;float: left;width:45%;background-color:white;padding:5px;margin:5px;border: 1px solid #F0F0F0;border-radius: 5px;box-shadow: 1px 1px 1px 1px #D3D3D3;' >"; | |
| 190 | - | |
| 191 | - if (temp.IMAGEM && temp.IMAGEM != "") { | |
| 192 | - ins += | |
| 193 | - "<div style='float:left;margin:2px' ><a href='" + link | |
| 194 | - + "' style=text-align:center;text-decoration:none; >" | |
| 195 | - + "<img src='" | |
| 196 | - + temp.IMAGEM | |
| 197 | - + "'></a></div>"; | |
| 198 | - } | |
| 199 | - // verifica se o mapfile esta salvo no banco | |
| 200 | - // diretamente | |
| 201 | - nome += " (" + temp.ID_MAPA + ")"; | |
| 202 | - if (temp.CONTEMMAPFILE == "nao") { | |
| 203 | - ins += | |
| 204 | - "<div class=paragrafo style='text-align:left;'>" + "<a href='" | |
| 205 | - + link | |
| 206 | - + "' style=text-align:left;text-decoration:none; >" | |
| 207 | - + nome | |
| 208 | - + "</a></div>"; | |
| 209 | - } else { | |
| 210 | - // combo de opcoes para abrir os mapas | |
| 211 | - // salvos | |
| 212 | - // como mapfiles | |
| 213 | - combo = | |
| 214 | - "<select style='width:170px;' onchange='i3GEO.guias.CONFIGURA.mapas.mostraLink(" + ig1 | |
| 215 | - + ",this.value)'>" | |
| 216 | - + "<option value=''>" | |
| 217 | - + $trad("x103") | |
| 218 | - + ":</option>" | |
| 219 | - + "<option value='" | |
| 220 | - + link | |
| 221 | - + "'>Como foi salvo</option>" | |
| 222 | - + "<option value='" | |
| 223 | - + link | |
| 224 | - + "&interface=" | |
| 225 | - + urlinterface | |
| 226 | - + "'>Com a interface atual</option>" | |
| 227 | - + "<option value='" | |
| 228 | - + i3GEO.configura.locaplic | |
| 229 | - + "/mashups/openlayers.php?numzoomlevels=18&restauramapa=" | |
| 230 | - + temp.ID_MAPA | |
| 231 | - + "&fundo=e_wsm'>Openlayers com todos os botoes</option>" | |
| 232 | - + "<option value='" | |
| 233 | - + i3GEO.configura.locaplic | |
| 234 | - + "/mashups/openlayers.php?numzoomlevels=18&restauramapa=" | |
| 235 | - + temp.ID_MAPA | |
| 236 | - + "&fundo=est_wms'>Sem o fundo</option>" | |
| 237 | - + "<option value='" | |
| 238 | - + i3GEO.configura.locaplic | |
| 239 | - + "/mashups/openlayers.php?numzoomlevels=18&restauramapa=" | |
| 240 | - + temp.ID_MAPA | |
| 241 | - + "&fundo=e_wsm&botoes=legenda pan zoombox zoomtot zoomin zoomout distancia area identifica'>Com botoes principais</option>" | |
| 242 | - + "<option value='" | |
| 243 | - + i3GEO.configura.locaplic | |
| 244 | - + "/mashups/osm.php?numzoomlevels=18&restauramapa=" | |
| 245 | - + temp.ID_MAPA | |
| 246 | - + "&fundo=e_wsm&botoes=legenda pan zoombox zoomtot zoomin zoomout distancia area identifica'>Com botoes principais e OSM</option>" | |
| 247 | - + "<option value='" | |
| 248 | - + i3GEO.configura.locaplic | |
| 249 | - + "/mashups/openlayers.php?numzoomlevels=18&restauramapa=" | |
| 250 | - + temp.ID_MAPA | |
| 251 | - + "&botoes=legenda pan zoombox zoomtot zoomin zoomout'>Botoes de navegacao</option>" | |
| 252 | - + "</select>"; | |
| 253 | - ins += | |
| 254 | - "<div style='float:left;margin:2px'>" + "<img src='" | |
| 255 | - + i3GEO.configura.locaplic | |
| 256 | - + "/ferramentas/salvamapa/geraminiatura.php?w=100&h=67&restauramapa=" | |
| 257 | - + temp.ID_MAPA | |
| 258 | - + "'></div><div class=paragrafo style='text-align:left;'><a href='" | |
| 259 | - + link | |
| 260 | - + "' style=text-align:center;text-decoration:none; >" | |
| 261 | - + nome | |
| 262 | - + "</a></div>" | |
| 263 | - + combo | |
| 264 | - + "<br><div style='cursor:pointer;' id='i3geoMapasLink_" | |
| 265 | - + ig1 | |
| 266 | - + "' ></div>"; | |
| 199 | + // verifica se o mapfile esta salvo no banco | |
| 200 | + // diretamente | |
| 201 | + nome += " (" + temp.ID_MAPA + ")"; | |
| 202 | + if (temp.CONTEMMAPFILE == "nao") { | |
| 203 | + ins += | |
| 204 | + "<div class=paragrafo style='text-align:left;'>" + "<a href='" | |
| 205 | + + link | |
| 206 | + + "' style=text-align:left;text-decoration:none; >" | |
| 207 | + + nome | |
| 208 | + + "</a></div>"; | |
| 209 | + } else { | |
| 210 | + // combo de opcoes para abrir os mapas | |
| 211 | + // salvos | |
| 212 | + // como mapfiles | |
| 213 | + combo = | |
| 214 | + "<select style='width:170px;' onchange='i3GEO.guias.CONFIGURA.mapas.mostraLink(" + ig1 | |
| 215 | + + ",this.value)'>" | |
| 216 | + + "<option value=''>" | |
| 217 | + + $trad("x103") | |
| 218 | + + ":</option>" | |
| 219 | + + "<option value='" | |
| 220 | + + link | |
| 221 | + + "'>Como foi salvo</option>" | |
| 222 | + + "<option value='" | |
| 223 | + + link | |
| 224 | + + "&interface=" | |
| 225 | + + urlinterface | |
| 226 | + + "'>Com a interface atual</option>" | |
| 227 | + + "<option value='" | |
| 228 | + + i3GEO.configura.locaplic | |
| 229 | + + "/mashups/openlayers.php?numzoomlevels=18&restauramapa=" | |
| 230 | + + temp.ID_MAPA | |
| 231 | + + "&fundo=e_wsm'>Openlayers com todos os botoes</option>" | |
| 232 | + + "<option value='" | |
| 233 | + + i3GEO.configura.locaplic | |
| 234 | + + "/mashups/openlayers.php?numzoomlevels=18&restauramapa=" | |
| 235 | + + temp.ID_MAPA | |
| 236 | + + "&fundo=est_wms'>Sem o fundo</option>" | |
| 237 | + + "<option value='" | |
| 238 | + + i3GEO.configura.locaplic | |
| 239 | + + "/mashups/openlayers.php?numzoomlevels=18&restauramapa=" | |
| 240 | + + temp.ID_MAPA | |
| 241 | + + "&fundo=e_wsm&botoes=legenda pan zoombox zoomtot zoomin zoomout distancia area identifica'>Com botoes principais</option>" | |
| 242 | + + "<option value='" | |
| 243 | + + i3GEO.configura.locaplic | |
| 244 | + + "/mashups/osm.php?numzoomlevels=18&restauramapa=" | |
| 245 | + + temp.ID_MAPA | |
| 246 | + + "&fundo=e_wsm&botoes=legenda pan zoombox zoomtot zoomin zoomout distancia area identifica'>Com botoes principais e OSM</option>" | |
| 247 | + + "<option value='" | |
| 248 | + + i3GEO.configura.locaplic | |
| 249 | + + "/mashups/openlayers.php?numzoomlevels=18&restauramapa=" | |
| 250 | + + temp.ID_MAPA | |
| 251 | + + "&botoes=legenda pan zoombox zoomtot zoomin zoomout'>Botoes de navegacao</option>" | |
| 252 | + + "</select>"; | |
| 253 | + ins += | |
| 254 | + "<div style='float:left;margin:2px'>" + "<img src='" | |
| 255 | + + i3GEO.configura.locaplic | |
| 256 | + + "/ferramentas/salvamapa/geraminiatura.php?w=100&h=67&restauramapa=" | |
| 257 | + + temp.ID_MAPA | |
| 258 | + + "'></div><div class=paragrafo style='text-align:left;'><a href='" | |
| 259 | + + link | |
| 260 | + + "' style=text-align:center;text-decoration:none; >" | |
| 261 | + + nome | |
| 262 | + + "</a></div>" | |
| 263 | + + combo | |
| 264 | + + "<br><div style='cursor:pointer;' id='i3geoMapasLink_" | |
| 265 | + + ig1 | |
| 266 | + + "' ></div>"; | |
| 267 | 267 | |
| 268 | - } | |
| 269 | - ins += "</div>"; | |
| 270 | - ig1++; | |
| 271 | - } while (ig1 < ig1lt); | |
| 272 | - } | |
| 273 | - $i(onde).innerHTML = ins + "</div>"; | |
| 274 | - }; | |
| 275 | - if ($i(i3GEO.guias.CONFIGURA.mapas.idconteudo)) { | |
| 276 | - $i(i3GEO.guias.CONFIGURA.mapas.idconteudo).innerHTML = "Aguarde..."; | |
| 277 | - } | |
| 278 | - //i3GEO.guias.mostra("mapas"); | |
| 279 | - i3GEO.php.pegaMapas(pegaMapas); | |
| 280 | - i3GEO.navega.removeCookieExtensao(); | |
| 281 | 268 | } |
| 282 | - }, | |
| 283 | - "dobraPagina" : { | |
| 284 | - icone : "imagens/googlemaps.png", | |
| 285 | - titulo : $trad("trocaInterface"), | |
| 286 | - id : "guia6", | |
| 287 | - idconteudo : "", | |
| 288 | - inicializa : function(){ | |
| 289 | - if (i3GEO.Interface.ATUAL === "googlemaps") { | |
| 290 | - i3GEO.guias.CONFIGURA.dobraPagina.icone = "imagens/openlayers.png"; | |
| 291 | - } | |
| 292 | - else{ | |
| 293 | - i3GEO.guias.CONFIGURA.dobraPagina.icone = "imagens/googlemaps.png"; | |
| 294 | - } | |
| 295 | - }, | |
| 296 | - click : function() { | |
| 297 | - if (typeof (console) !== 'undefined') | |
| 298 | - console.info("i3GEO.guias dobraPagina.click"); | |
| 269 | + ins += "</div>"; | |
| 270 | + ig1++; | |
| 271 | + } while (ig1 < ig1lt); | |
| 272 | + } | |
| 273 | + $i(onde).innerHTML = ins + "</div>"; | |
| 274 | + }; | |
| 275 | + if ($i(i3GEO.guias.CONFIGURA.mapas.idconteudo)) { | |
| 276 | + $i(i3GEO.guias.CONFIGURA.mapas.idconteudo).innerHTML = "Aguarde..."; | |
| 277 | + } | |
| 278 | + //i3GEO.guias.mostra("mapas"); | |
| 279 | + i3GEO.php.pegaMapas(pegaMapas); | |
| 280 | + i3GEO.navega.removeCookieExtensao(); | |
| 281 | + } | |
| 282 | + }, | |
| 283 | + "dobraPagina" : { | |
| 284 | + icone : "imagens/googlemaps.png", | |
| 285 | + titulo : $trad("trocaInterface"), | |
| 286 | + id : "guia6", | |
| 287 | + idconteudo : "", | |
| 288 | + inicializa : function(){ | |
| 289 | + if (i3GEO.Interface.ATUAL === "googlemaps") { | |
| 290 | + i3GEO.guias.CONFIGURA.dobraPagina.icone = "imagens/openlayers.png"; | |
| 291 | + } | |
| 292 | + else{ | |
| 293 | + i3GEO.guias.CONFIGURA.dobraPagina.icone = "imagens/googlemaps.png"; | |
| 294 | + } | |
| 295 | + }, | |
| 296 | + click : function() { | |
| 297 | + if (typeof (console) !== 'undefined') | |
| 298 | + console.info("i3GEO.guias dobraPagina.click"); | |
| 299 | 299 | |
| 300 | - //$('.iconeGuiaMovel').tooltip('destroy'); | |
| 301 | - i3GEO.Interface.atual2gm.insereIcone = false; | |
| 302 | - i3GEO.Interface.atual2ol.insereIcone = false; | |
| 303 | - if (i3GEO.Interface.ATUAL === "googlemaps") { | |
| 304 | - if (typeof i3GeoMap.getStreetView != "undefined"){ | |
| 305 | - if(i3GeoMap.getStreetView().getVisible() === true) { | |
| 306 | - i3GeoMap.getStreetView().setVisible(false); | |
| 307 | - } | |
| 308 | - } | |
| 309 | - i3GEO.Interface.atual2ol.inicia(); | |
| 310 | - i3GEO.guias.CONFIGURA.dobraPagina.icone = "imagens/googlemaps.png"; | |
| 311 | - } | |
| 312 | - if (i3GEO.Interface.ATUAL === "openlayers") { | |
| 313 | - i3GEO.Interface.atual2gm.inicia(); | |
| 314 | - i3GEO.guias.CONFIGURA.dobraPagina.icone = "imagens/openlayers.png"; | |
| 315 | - } | |
| 316 | - $i("iconeTrocaInterface").src = i3GEO.configura.locaplic + "/" + i3GEO.guias.CONFIGURA.dobraPagina.icone; | |
| 317 | - } | |
| 318 | - }, | |
| 319 | - "buscaRapida" : { | |
| 320 | - icone : "imagens/gisicons/search.png", | |
| 321 | - titulo : "", | |
| 322 | - id : "guia7", | |
| 323 | - idconteudo : "guia7obj", | |
| 324 | - idBuscaRapida : "buscaRapidaGuia", | |
| 325 | - click : function(obj) { | |
| 326 | - if (typeof (console) !== 'undefined') | |
| 327 | - console.info("click no botao que abre a guia de camadas"); | |
| 300 | + //$('.iconeGuiaMovel').tooltip('destroy'); | |
| 301 | + i3GEO.Interface.atual2gm.insereIcone = false; | |
| 302 | + i3GEO.Interface.atual2ol.insereIcone = false; | |
| 303 | + if (i3GEO.Interface.ATUAL === "googlemaps") { | |
| 304 | + if (typeof i3GeoMap.getStreetView != "undefined"){ | |
| 305 | + if(i3GeoMap.getStreetView().getVisible() === true) { | |
| 306 | + i3GeoMap.getStreetView().setVisible(false); | |
| 307 | + } | |
| 308 | + } | |
| 309 | + i3GEO.Interface.atual2ol.inicia(); | |
| 310 | + i3GEO.guias.CONFIGURA.dobraPagina.icone = "imagens/googlemaps.png"; | |
| 311 | + } | |
| 312 | + if (i3GEO.Interface.ATUAL === "openlayers") { | |
| 313 | + i3GEO.Interface.atual2gm.inicia(); | |
| 314 | + i3GEO.guias.CONFIGURA.dobraPagina.icone = "imagens/openlayers.png"; | |
| 315 | + } | |
| 316 | + $i("iconeTrocaInterface").src = i3GEO.configura.locaplic + "/" + i3GEO.guias.CONFIGURA.dobraPagina.icone; | |
| 317 | + } | |
| 318 | + }, | |
| 319 | + "buscaRapida" : { | |
| 320 | + icone : "imagens/gisicons/search.png", | |
| 321 | + titulo : "", | |
| 322 | + id : "guia7", | |
| 323 | + idconteudo : "guia7obj", | |
| 324 | + idBuscaRapida : "buscaRapidaGuia", | |
| 325 | + click : function(obj) { | |
| 326 | + if (typeof (console) !== 'undefined') | |
| 327 | + console.info("click no botao que abre a guia de camadas"); | |
| 328 | 328 | |
| 329 | - //$('.iconeGuiaMovel').tooltip('destroy'); | |
| 330 | - var f = i3GEO.guias.CONFIGURA.buscaRapida; | |
| 331 | - obj = $(obj); | |
| 332 | - if(obj.attr("data-idconteudo") != undefined){ | |
| 333 | - f.idconteudo = obj.attr("data-idconteudo"); | |
| 334 | - } | |
| 335 | - } | |
| 336 | - }, | |
| 337 | - "legenda" : { | |
| 338 | - icone : "imagens/legenda.png", | |
| 339 | - titulo : $trad("g3"), | |
| 340 | - id : "guia4", | |
| 341 | - idconteudo : "guia4obj", | |
| 342 | - idLegenda: "legendaHtml", | |
| 343 | - click : function(obj) { | |
| 344 | - if (typeof (console) !== 'undefined') | |
| 345 | - console.info("click no botao que abre a guia de camadas"); | |
| 329 | + //$('.iconeGuiaMovel').tooltip('destroy'); | |
| 330 | + var f = i3GEO.guias.CONFIGURA.buscaRapida; | |
| 331 | + obj = $(obj); | |
| 332 | + if(obj.attr("data-idconteudo") != undefined){ | |
| 333 | + f.idconteudo = obj.attr("data-idconteudo"); | |
| 334 | + } | |
| 335 | + } | |
| 336 | + }, | |
| 337 | + "legenda" : { | |
| 338 | + icone : "imagens/legenda.png", | |
| 339 | + titulo : $trad("g3"), | |
| 340 | + id : "guia4", | |
| 341 | + idconteudo : "guia4obj", | |
| 342 | + idLegenda: "legendaHtml", | |
| 343 | + click : function(obj) { | |
| 344 | + if (typeof (console) !== 'undefined') | |
| 345 | + console.info("click no botao que abre a guia de camadas"); | |
| 346 | 346 | |
| 347 | - //$('.iconeGuiaMovel').tooltip('destroy'); | |
| 348 | - var f = i3GEO.guias.CONFIGURA.legenda; | |
| 349 | - obj = $(obj); | |
| 350 | - if(obj.attr("data-idLegenda") != undefined){ | |
| 351 | - f.idLegenda = obj.attr("data-idLegenda"); | |
| 352 | - } | |
| 353 | - //necessario para a legenda nao ser atualizada nos eventos desnecessariamente | |
| 354 | - if($i(f.idLegenda)){ | |
| 355 | - $i(f.idLegenda).style.display = "block"; | |
| 356 | - i3GEO.legenda.CAMADAS = ""; | |
| 357 | - i3GEO.legenda.inicia({ | |
| 358 | - "idLegenda": f.idLegenda, | |
| 359 | - "templateLegenda": $("#" + f.idLegenda).attr("data-template"), | |
| 360 | - "janela": false | |
| 361 | - }); | |
| 362 | - } | |
| 363 | - } | |
| 364 | - }, | |
| 365 | - "temas" : { | |
| 366 | - icone : "imagens/layer.png", | |
| 367 | - titulo : $trad("g4a"), | |
| 368 | - id : "guia1", | |
| 369 | - idconteudo : "guia1obj", | |
| 370 | - idListaDeCamadas : "listaTemas", | |
| 371 | - idListaFundo : "listaFundo", | |
| 372 | - idListaLayersGr : "listaLayersGr", | |
| 373 | - verificaAbrangencia : "", | |
| 374 | - click : function(obj){ | |
| 375 | - if (typeof (console) !== 'undefined') | |
| 376 | - console.info("click no botao que abre a guia de camadas"); | |
| 347 | + //$('.iconeGuiaMovel').tooltip('destroy'); | |
| 348 | + var f = i3GEO.guias.CONFIGURA.legenda; | |
| 349 | + obj = $(obj); | |
| 350 | + if(obj.attr("data-idLegenda") != undefined){ | |
| 351 | + f.idLegenda = obj.attr("data-idLegenda"); | |
| 352 | + } | |
| 353 | + //necessario para a legenda nao ser atualizada nos eventos desnecessariamente | |
| 354 | + if($i(f.idLegenda)){ | |
| 355 | + $i(f.idLegenda).style.display = "block"; | |
| 356 | + i3GEO.legenda.CAMADAS = ""; | |
| 357 | + i3GEO.legenda.inicia({ | |
| 358 | + "idLegenda": f.idLegenda, | |
| 359 | + "templateLegenda": $("#" + f.idLegenda).attr("data-template"), | |
| 360 | + "janela": false | |
| 361 | + }); | |
| 362 | + } | |
| 363 | + } | |
| 364 | + }, | |
| 365 | + "temas" : { | |
| 366 | + icone : "imagens/layer.png", | |
| 367 | + titulo : $trad("g4a"), | |
| 368 | + id : "guia1", | |
| 369 | + idconteudo : "guia1obj", | |
| 370 | + idListaDeCamadas : "listaTemas", | |
| 371 | + idListaFundo : "listaFundo", | |
| 372 | + idListaLayersGr : "listaLayersGr", | |
| 373 | + verificaAbrangencia : "", | |
| 374 | + click : function(obj){ | |
| 375 | + if (typeof (console) !== 'undefined') | |
| 376 | + console.info("click no botao que abre a guia de camadas"); | |
| 377 | 377 | |
| 378 | - //$('.iconeGuiaMovel').tooltip('destroy'); | |
| 379 | - var f = i3GEO.guias.CONFIGURA.temas; | |
| 380 | - obj = $(obj); | |
| 378 | + //$('.iconeGuiaMovel').tooltip('destroy'); | |
| 379 | + var f = i3GEO.guias.CONFIGURA.temas; | |
| 380 | + obj = $(obj); | |
| 381 | 381 | |
| 382 | - if(obj.attr("data-verificaAbrangencia") != undefined){ | |
| 383 | - f.verificaAbrangencia = obj.attr("data-verificaAbrangencia"); | |
| 384 | - } | |
| 385 | - if(obj.attr("data-idconteudo") != undefined){ | |
| 386 | - f.idconteudo = obj.attr("data-idconteudo"); | |
| 387 | - } | |
| 388 | - if(obj.attr("data-idListaDeCamadas") != undefined){ | |
| 389 | - f.idListaDeCamadas = obj.attr("data-idListaDeCamadas"); | |
| 390 | - } | |
| 391 | - if(obj.attr("data-idListaFundo") != undefined){ | |
| 392 | - f.idListaFundo = obj.attr("data-idListaFundo"); | |
| 393 | - } | |
| 394 | - if(obj.attr("data-idListaLayersGr") != undefined){ | |
| 395 | - f.idListaLayersGr = obj.attr("data-idListaLayersGr"); | |
| 396 | - } | |
| 397 | - if($("#" + obj.attr("data-idListaFundo")).attr("data-idTemplateCamada") != undefined){ | |
| 398 | - f.idTemplateCamadaFundo = $("#" + obj.attr("data-idListaFundo")).attr("data-idTemplateCamada"); | |
| 399 | - } | |
| 400 | - if($i(f.idListaDeCamadas)){ | |
| 401 | - i3GEO.arvoreDeCamadas.inicia({ | |
| 402 | - "idOnde" : f.idListaDeCamadas, | |
| 403 | - "templateCamada": $("#" + f.idListaDeCamadas).attr("data-template"), | |
| 404 | - "idListaFundo": f.idListaFundo, | |
| 405 | - "templateCamadaFundo": $("#" + f.idListaFundo).attr("data-template"), | |
| 406 | - "idListaLayersGr": f.idListaLayersGr, | |
| 407 | - "templateCamadaGr": $("#" + f.idListaLayersGr).attr("data-template"), | |
| 408 | - "verificaAbrangencia": f.verificaAbrangencia | |
| 409 | - }); | |
| 410 | - } | |
| 411 | - } | |
| 412 | - }, | |
| 413 | - "adiciona" : { | |
| 414 | - icone : "imagens/catalogo.png", | |
| 415 | - titulo : $trad("g1a"), | |
| 416 | - id : "guia2", | |
| 417 | - idconteudo : "guia2obj", | |
| 418 | - idMenus: "catalogoMenus", //lista de menus | |
| 419 | - idCatalogo: "catalogoPrincipal", //onde vai a lista inicial | |
| 420 | - idNavegacao: "catalogoNavegacao", | |
| 421 | - idMigalha: "catalogoMigalha", | |
| 422 | - click : function(obj) { | |
| 423 | - if (typeof (console) !== 'undefined') | |
| 424 | - console.info("click no botao que abre a guia de adicao de temas"); | |
| 382 | + if(obj.attr("data-verificaAbrangencia") != undefined){ | |
| 383 | + f.verificaAbrangencia = obj.attr("data-verificaAbrangencia"); | |
| 384 | + } | |
| 385 | + if(obj.attr("data-idconteudo") != undefined){ | |
| 386 | + f.idconteudo = obj.attr("data-idconteudo"); | |
| 387 | + } | |
| 388 | + if(obj.attr("data-idListaDeCamadas") != undefined){ | |
| 389 | + f.idListaDeCamadas = obj.attr("data-idListaDeCamadas"); | |
| 390 | + } | |
| 391 | + if(obj.attr("data-idListaFundo") != undefined){ | |
| 392 | + f.idListaFundo = obj.attr("data-idListaFundo"); | |
| 393 | + } | |
| 394 | + if(obj.attr("data-idListaLayersGr") != undefined){ | |
| 395 | + f.idListaLayersGr = obj.attr("data-idListaLayersGr"); | |
| 396 | + } | |
| 397 | + if($("#" + obj.attr("data-idListaFundo")).attr("data-idTemplateCamada") != undefined){ | |
| 398 | + f.idTemplateCamadaFundo = $("#" + obj.attr("data-idListaFundo")).attr("data-idTemplateCamada"); | |
| 399 | + } | |
| 400 | + if($i(f.idListaDeCamadas)){ | |
| 401 | + i3GEO.arvoreDeCamadas.inicia({ | |
| 402 | + "idOnde" : f.idListaDeCamadas, | |
| 403 | + "templateCamada": $("#" + f.idListaDeCamadas).attr("data-template"), | |
| 404 | + "idListaFundo": f.idListaFundo, | |
| 405 | + "templateCamadaFundo": $("#" + f.idListaFundo).attr("data-template"), | |
| 406 | + "idListaLayersGr": f.idListaLayersGr, | |
| 407 | + "templateCamadaGr": $("#" + f.idListaLayersGr).attr("data-template"), | |
| 408 | + "verificaAbrangencia": f.verificaAbrangencia | |
| 409 | + }); | |
| 410 | + } | |
| 411 | + } | |
| 412 | + }, | |
| 413 | + "adiciona" : { | |
| 414 | + icone : "imagens/catalogo.png", | |
| 415 | + titulo : $trad("g1a"), | |
| 416 | + id : "guia2", | |
| 417 | + idconteudo : "guia2obj", | |
| 418 | + idMenus: "catalogoMenus", //lista de menus | |
| 419 | + idCatalogo: "catalogoPrincipal", //onde vai a lista inicial | |
| 420 | + idNavegacao: "catalogoNavegacao", | |
| 421 | + idMigalha: "catalogoMigalha", | |
| 422 | + click : function(obj) { | |
| 423 | + if (typeof (console) !== 'undefined') | |
| 424 | + console.info("click no botao que abre a guia de adicao de temas"); | |
| 425 | 425 | |
| 426 | - //$('.iconeGuiaMovel').tooltip('destroy'); | |
| 427 | - var f = i3GEO.guias.CONFIGURA.adiciona; | |
| 426 | + //$('.iconeGuiaMovel').tooltip('destroy'); | |
| 427 | + var f = i3GEO.guias.CONFIGURA.adiciona; | |
| 428 | 428 | |
| 429 | - if($(obj).attr("data-idconteudo") != undefined){ | |
| 430 | - f.idconteudo = $(obj).attr("data-idconteudo"); | |
| 431 | - } | |
| 432 | - if($(obj).attr("data-idMenus") != undefined){ | |
| 433 | - f.idMenus = $(obj).attr("data-idMenus"); | |
| 434 | - } | |
| 435 | - if($(obj).attr("data-idCatalogo") != undefined){ | |
| 436 | - f.idCatalogo = $(obj).attr("data-idCatalogo"); | |
| 437 | - } | |
| 438 | - if($(obj).attr("data-idNavegacao") != undefined){ | |
| 439 | - f.idNavegacao = $(obj).attr("data-idNavegacao"); | |
| 440 | - } | |
| 441 | - if($(obj).attr("data-idMigalha") != undefined){ | |
| 442 | - f.idMigalha = $(obj).attr("data-idMigalha"); | |
| 443 | - } | |
| 444 | - if($(obj).attr("data-folderFirst") != undefined){ | |
| 445 | - f.folderFirst = $(obj).attr("data-folderFirst"); | |
| 446 | - } else { | |
| 447 | - f.folderFirst = "false"; | |
| 448 | - } | |
| 429 | + if($(obj).attr("data-idconteudo") != undefined){ | |
| 430 | + f.idconteudo = $(obj).attr("data-idconteudo"); | |
| 431 | + } | |
| 432 | + if($(obj).attr("data-idMenus") != undefined){ | |
| 433 | + f.idMenus = $(obj).attr("data-idMenus"); | |
| 434 | + } | |
| 435 | + if($(obj).attr("data-idCatalogo") != undefined){ | |
| 436 | + f.idCatalogo = $(obj).attr("data-idCatalogo"); | |
| 437 | + } | |
| 438 | + if($(obj).attr("data-idNavegacao") != undefined){ | |
| 439 | + f.idNavegacao = $(obj).attr("data-idNavegacao"); | |
| 440 | + } | |
| 441 | + if($(obj).attr("data-idMigalha") != undefined){ | |
| 442 | + f.idMigalha = $(obj).attr("data-idMigalha"); | |
| 443 | + } | |
| 444 | + if($(obj).attr("data-folderFirst") != undefined){ | |
| 445 | + f.folderFirst = $(obj).attr("data-folderFirst"); | |
| 446 | + } else { | |
| 447 | + f.folderFirst = "false"; | |
| 448 | + } | |
| 449 | 449 | |
| 450 | - var ondeMenus = $( "#" + f.idMenus ); | |
| 450 | + var ondeMenus = $( "#" + f.idMenus ); | |
| 451 | 451 | |
| 452 | - i3GEO.catalogoMenus.listaMenus({ | |
| 453 | - "templateDir": ondeMenus.attr("data-templateDir"), | |
| 454 | - "templateTema": ondeMenus.attr("data-templateTema"), | |
| 455 | - "idOndeMenus": f.idMenus, | |
| 456 | - "idCatalogoPrincipal": f.idCatalogo, | |
| 457 | - "idCatalogoNavegacao": f.idNavegacao, | |
| 458 | - "idOndeMigalha": f.idMigalha, | |
| 459 | - "folderFirst": f.folderFirst | |
| 460 | - }); | |
| 461 | - } | |
| 462 | - }, | |
| 463 | - "ferramentas" : { | |
| 464 | - icone : "imagens/gisicons/tools.png", | |
| 465 | - titulo : $trad("u15a"), | |
| 466 | - id : "guia8", | |
| 467 | - idconteudo : "guia8obj", | |
| 468 | - idLista: "listaFerramentas", | |
| 469 | - idMigalha: "migalhaFerramentas", | |
| 470 | - idLinks: "listaFerramentasLinks", | |
| 471 | - status: false, | |
| 472 | - click : function(obj) { | |
| 473 | - if (typeof (console) !== 'undefined') | |
| 474 | - console.info("click no botao que abre a guia das ferramentas"); | |
| 452 | + i3GEO.catalogoMenus.listaMenus({ | |
| 453 | + "templateDir": ondeMenus.attr("data-templateDir"), | |
| 454 | + "templateTema": ondeMenus.attr("data-templateTema"), | |
| 455 | + "idOndeMenus": f.idMenus, | |
| 456 | + "idCatalogoPrincipal": f.idCatalogo, | |
| 457 | + "idCatalogoNavegacao": f.idNavegacao, | |
| 458 | + "idOndeMigalha": f.idMigalha, | |
| 459 | + "folderFirst": f.folderFirst | |
| 460 | + }); | |
| 461 | + } | |
| 462 | + }, | |
| 463 | + "ferramentas" : { | |
| 464 | + icone : "imagens/gisicons/tools.png", | |
| 465 | + titulo : $trad("u15a"), | |
| 466 | + id : "guia8", | |
| 467 | + idconteudo : "guia8obj", | |
| 468 | + idLista: "listaFerramentas", | |
| 469 | + idMigalha: "migalhaFerramentas", | |
| 470 | + idLinks: "listaFerramentasLinks", | |
| 471 | + status: false, | |
| 472 | + click : function(obj) { | |
| 473 | + if (typeof (console) !== 'undefined') | |
| 474 | + console.info("click no botao que abre a guia das ferramentas"); | |
| 475 | 475 | |
| 476 | - //$('.iconeGuiaMovel').tooltip('destroy'); | |
| 477 | - if($(obj).attr("data-idconteudo") != undefined){ | |
| 478 | - i3GEO.guias.CONFIGURA.ferramentas.idconteudo = $(obj).attr("data-idconteudo"); | |
| 479 | - } | |
| 480 | - if($(obj).attr("data-idLista") != undefined){ | |
| 481 | - i3GEO.guias.CONFIGURA.ferramentas.idLista = $(obj).attr("data-idLista"); | |
| 482 | - } | |
| 483 | - if($(obj).attr("data-idMigalha") != undefined){ | |
| 484 | - i3GEO.guias.CONFIGURA.ferramentas.idMigalha = $(obj).attr("data-idMigalha"); | |
| 485 | - } | |
| 486 | - if($(obj).attr("data-idLinks") != undefined){ | |
| 487 | - i3GEO.guias.CONFIGURA.ferramentas.idLinks = $(obj).attr("data-idLinks"); | |
| 488 | - } | |
| 489 | - if(i3GEO.util.checaHtmlVazio(i3GEO.guias.CONFIGURA.ferramentas.idLista) == false || i3GEO.util.checaHtmlVazio(i3GEO.guias.CONFIGURA.ferramentas.idLinks) == false){ | |
| 490 | - return; | |
| 491 | - } | |
| 492 | - var f = i3GEO.guias.CONFIGURA.ferramentas; | |
| 476 | + //$('.iconeGuiaMovel').tooltip('destroy'); | |
| 477 | + if($(obj).attr("data-idconteudo") != undefined){ | |
| 478 | + i3GEO.guias.CONFIGURA.ferramentas.idconteudo = $(obj).attr("data-idconteudo"); | |
| 479 | + } | |
| 480 | + if($(obj).attr("data-idLista") != undefined){ | |
| 481 | + i3GEO.guias.CONFIGURA.ferramentas.idLista = $(obj).attr("data-idLista"); | |
| 482 | + } | |
| 483 | + if($(obj).attr("data-idMigalha") != undefined){ | |
| 484 | + i3GEO.guias.CONFIGURA.ferramentas.idMigalha = $(obj).attr("data-idMigalha"); | |
| 485 | + } | |
| 486 | + if($(obj).attr("data-idLinks") != undefined){ | |
| 487 | + i3GEO.guias.CONFIGURA.ferramentas.idLinks = $(obj).attr("data-idLinks"); | |
| 488 | + } | |
| 489 | + if(i3GEO.util.checaHtmlVazio(i3GEO.guias.CONFIGURA.ferramentas.idLista) == false || i3GEO.util.checaHtmlVazio(i3GEO.guias.CONFIGURA.ferramentas.idLinks) == false){ | |
| 490 | + return; | |
| 491 | + } | |
| 492 | + var f = i3GEO.guias.CONFIGURA.ferramentas; | |
| 493 | 493 | |
| 494 | - i3GEO.caixaDeFerramentas.inicia({ | |
| 495 | - "idOndeFolder": $( "#" + f.idLista ), | |
| 496 | - "idOndeLinks": $( "#" + f.idLinks ), | |
| 497 | - "idOndeMigalha" : f.idMigalha, | |
| 498 | - "templateFolder" : $( "#" + f.idLista ).attr("data-template"), | |
| 499 | - "templateMigalha" : $("#" + f.idMigalha).attr("data-template"), | |
| 500 | - "templateLinks" : $( "#" + f.idLinks ).attr("data-template") | |
| 501 | - }); | |
| 502 | - } | |
| 503 | - } | |
| 504 | - }, | |
| 505 | - /** | |
| 506 | - * Ajusta a altura das guias conforme a altura da imagem do mapa | |
| 507 | - */ | |
| 508 | - ajustaAltura : function() { | |
| 509 | - if (typeof (console) !== 'undefined') | |
| 510 | - console.info("guias.ajustaAltura"); | |
| 494 | + i3GEO.caixaDeFerramentas.inicia({ | |
| 495 | + "idOndeFolder": $( "#" + f.idLista ), | |
| 496 | + "idOndeLinks": $( "#" + f.idLinks ), | |
| 497 | + "idOndeMigalha" : f.idMigalha, | |
| 498 | + "templateFolder" : $( "#" + f.idLista ).attr("data-template"), | |
| 499 | + "templateMigalha" : $("#" + f.idMigalha).attr("data-template"), | |
| 500 | + "templateLinks" : $( "#" + f.idLinks ).attr("data-template") | |
| 501 | + }); | |
| 502 | + } | |
| 503 | + } | |
| 504 | + }, | |
| 505 | + /** | |
| 506 | + * Ajusta a altura das guias conforme a altura da imagem do mapa | |
| 507 | + */ | |
| 508 | + ajustaAltura : function() { | |
| 509 | + if (typeof (console) !== 'undefined') | |
| 510 | + console.info("guias.ajustaAltura"); | |
| 511 | 511 | |
| 512 | - var guia, guias, nguias, temp, temps, n, i, g, altura = 0; | |
| 513 | - guias = i3GEO.util.listaChaves(i3GEO.guias.CONFIGURA); | |
| 514 | - nguias = guias.length; | |
| 515 | - for (g = 0; g < nguias; g++) { | |
| 516 | - guia = $i(this.CONFIGURA[guias[g]].idconteudo); | |
| 517 | - if (guia) { | |
| 518 | - guia.style.overflow = "auto"; | |
| 519 | - if (!guia.style.height) { | |
| 520 | - guia.style.height = i3GEO.parametros.h + "px"; | |
| 521 | - } | |
| 522 | - } | |
| 523 | - } | |
| 524 | - }, | |
| 525 | - /** | |
| 526 | - * Esconde todas as guias | |
| 527 | - */ | |
| 528 | - escondeGuias : function() { | |
| 529 | - if (typeof (console) !== 'undefined') | |
| 530 | - console.info("guias.escondeGuias"); | |
| 512 | + var guia, guias, nguias, temp, temps, n, i, g, altura = 0; | |
| 513 | + guias = i3GEO.util.listaChaves(i3GEO.guias.CONFIGURA); | |
| 514 | + nguias = guias.length; | |
| 515 | + for (g = 0; g < nguias; g++) { | |
| 516 | + guia = $i(this.CONFIGURA[guias[g]].idconteudo); | |
| 517 | + if (guia) { | |
| 518 | + guia.style.overflow = "auto"; | |
| 519 | + if (!guia.style.height) { | |
| 520 | + guia.style.height = i3GEO.parametros.h + "px"; | |
| 521 | + } | |
| 522 | + } | |
| 523 | + } | |
| 524 | + }, | |
| 525 | + /** | |
| 526 | + * Esconde todas as guias | |
| 527 | + */ | |
| 528 | + escondeGuias : function() { | |
| 529 | + if (typeof (console) !== 'undefined') | |
| 530 | + console.info("guias.escondeGuias"); | |
| 531 | 531 | |
| 532 | - var guias, nguias, g, temp, attributes, anim; | |
| 533 | - guias = i3GEO.util.listaChaves(i3GEO.guias.CONFIGURA); | |
| 534 | - nguias = guias.length; | |
| 535 | - for (g = 0; g < nguias; g++) { | |
| 536 | - temp = $i(this.CONFIGURA[guias[g]].idconteudo); | |
| 537 | - if (temp) { | |
| 538 | - temp.style.display = "none"; | |
| 539 | - } | |
| 540 | - } | |
| 541 | - $("#i3GEOguiaMovelConteudo").css("display","none"); | |
| 542 | - }, | |
| 543 | - /** | |
| 544 | - * Mostra no mapa uma determinada guia | |
| 545 | - * | |
| 546 | - * Parametro: | |
| 547 | - * | |
| 548 | - * {String} - nome da guia | |
| 549 | - */ | |
| 550 | - mostra : function(guia) { | |
| 551 | - if (typeof (console) !== 'undefined') | |
| 552 | - console.info("guias.mostra"); | |
| 532 | + var guias, nguias, g, temp, attributes, anim; | |
| 533 | + guias = i3GEO.util.listaChaves(i3GEO.guias.CONFIGURA); | |
| 534 | + nguias = guias.length; | |
| 535 | + for (g = 0; g < nguias; g++) { | |
| 536 | + temp = $i(this.CONFIGURA[guias[g]].idconteudo); | |
| 537 | + if (temp) { | |
| 538 | + temp.style.display = "none"; | |
| 539 | + } | |
| 540 | + } | |
| 541 | + $("#i3GEOguiaMovelConteudo").css("display","none"); | |
| 542 | + }, | |
| 543 | + /** | |
| 544 | + * Mostra no mapa uma determinada guia | |
| 545 | + * | |
| 546 | + * Parametro: | |
| 547 | + * | |
| 548 | + * {String} - nome da guia | |
| 549 | + */ | |
| 550 | + mostra : function(guia) { | |
| 551 | + if (typeof (console) !== 'undefined') | |
| 552 | + console.info("guias.mostra"); | |
| 553 | 553 | |
| 554 | - // fecha o streetview | |
| 555 | - if (i3GEO.Interface.ATUAL === "googlemaps") { | |
| 556 | - if(typeof i3GeoMap.getStreetView != "undefined"){ | |
| 557 | - i3GeoMap.getStreetView().setVisible(false); | |
| 558 | - } | |
| 559 | - } | |
| 560 | - var guias, nguias, g, temp, attributes, anim; | |
| 561 | - guias = i3GEO.util.listaChaves(i3GEO.guias.CONFIGURA); | |
| 562 | - nguias = guias.length; | |
| 563 | - if (!$i(i3GEO.guias.CONFIGURA[guia].idconteudo)) { | |
| 564 | - return; | |
| 565 | - } | |
| 566 | - if (i3GEO.guias.CONFIGURA[guia]) { | |
| 567 | - temp = $i(i3GEO.guias.CONFIGURA[guia].idconteudo); | |
| 568 | - if (temp) { | |
| 569 | - temp.style.display = "block"; | |
| 570 | - $("#i3GEOguiaMovelMolde,#i3GEOguiaMovelConteudo").css("display","block"); | |
| 571 | - } | |
| 572 | - } | |
| 573 | - }, | |
| 574 | - /** | |
| 575 | - * Function: inicia | |
| 576 | - * | |
| 577 | - * Inicializa a guia móvel | |
| 578 | - */ | |
| 579 | - inicia : function() { | |
| 580 | - if (typeof (console) !== 'undefined') | |
| 581 | - console.info("guias.inicia"); | |
| 554 | + // fecha o streetview | |
| 555 | + if (i3GEO.Interface.ATUAL === "googlemaps") { | |
| 556 | + if(typeof i3GeoMap.getStreetView != "undefined"){ | |
| 557 | + i3GeoMap.getStreetView().setVisible(false); | |
| 558 | + } | |
| 559 | + } | |
| 560 | + var guias, nguias, g, temp, attributes, anim; | |
| 561 | + guias = i3GEO.util.listaChaves(i3GEO.guias.CONFIGURA); | |
| 562 | + nguias = guias.length; | |
| 563 | + if (!$i(i3GEO.guias.CONFIGURA[guia].idconteudo)) { | |
| 564 | + return; | |
| 565 | + } | |
| 566 | + if (i3GEO.guias.CONFIGURA[guia]) { | |
| 567 | + temp = $i(i3GEO.guias.CONFIGURA[guia].idconteudo); | |
| 568 | + if (temp) { | |
| 569 | + temp.style.display = "block"; | |
| 570 | + $("#i3GEOguiaMovelMolde,#i3GEOguiaMovelConteudo").css("display","block"); | |
| 571 | + } | |
| 572 | + } | |
| 573 | + }, | |
| 574 | + /** | |
| 575 | + * Function: inicia | |
| 576 | + * | |
| 577 | + * Inicializa a guia móvel | |
| 578 | + */ | |
| 579 | + inicia : function() { | |
| 580 | + if (typeof (console) !== 'undefined') | |
| 581 | + console.info("guias.inicia"); | |
| 582 | 582 | |
| 583 | - if($i("i3GEOguiaMovel")){ | |
| 584 | - i3GEO.guias.LARGURAGUIAMOVEL = parseInt($("#i3GEOguiaMovel").css("width"),10); | |
| 585 | - } | |
| 586 | - if(!$i("i3GEOguiaMovelMolde").style.height){ | |
| 587 | - $("#i3GEOguiaMovelMolde,#i3GEOguiaMovelConteudo").css("height",i3GEO.parametros.h + "px"); | |
| 588 | - } | |
| 589 | - }, | |
| 590 | - /** | |
| 591 | - * Ativa o conteúdo de determinada guia | |
| 592 | - * | |
| 593 | - * Parametro: | |
| 594 | - * | |
| 595 | - * chave {string} - código da guia, definido em i3GEO.guias.CONFIGURA | |
| 596 | - */ | |
| 597 | - ativa : function(chave,obj) { | |
| 598 | - if (typeof (console) !== 'undefined') | |
| 599 | - console.info("guias.ativa"); | |
| 583 | + if($i("i3GEOguiaMovel")){ | |
| 584 | + i3GEO.guias.LARGURAGUIAMOVEL = parseInt($("#i3GEOguiaMovel").css("width"),10); | |
| 585 | + } | |
| 586 | + if(!$i("i3GEOguiaMovelMolde").style.height || $i("i3GEOguiaMovelMolde").style.height == ""){ | |
| 587 | + $("#i3GEOguiaMovelMolde,#i3GEOguiaMovelConteudo").css("height",i3GEO.parametros.h + "px"); | |
| 588 | + } | |
| 589 | + }, | |
| 590 | + /** | |
| 591 | + * Ativa o conteúdo de determinada guia | |
| 592 | + * | |
| 593 | + * Parametro: | |
| 594 | + * | |
| 595 | + * chave {string} - código da guia, definido em i3GEO.guias.CONFIGURA | |
| 596 | + */ | |
| 597 | + ativa : function(chave,obj) { | |
| 598 | + if (typeof (console) !== 'undefined') | |
| 599 | + console.info("guias.ativa"); | |
| 600 | 600 | |
| 601 | - // nao tem conteudo para mostrar | |
| 602 | - var f="" ; | |
| 601 | + // nao tem conteudo para mostrar | |
| 602 | + var f="" ; | |
| 603 | 603 | |
| 604 | - if (!$i(i3GEO.guias.CONFIGURA[chave].idconteudo)) { | |
| 605 | - f = i3GEO.guias.CONFIGURA[chave].click.apply(f,[obj]); | |
| 606 | - return; | |
| 607 | - } | |
| 608 | - i3GEO.guias.escondeGuias(); | |
| 609 | - i3GEO.guias.abreFecha("abre",chave); | |
| 610 | - if (i3GEO.guias.CONFIGURA[chave].click) { | |
| 611 | - f = i3GEO.guias.CONFIGURA[chave].click.apply(f,[obj]); | |
| 612 | - } | |
| 613 | - }, | |
| 614 | - /** | |
| 615 | - * Function: abreFecha | |
| 616 | - * | |
| 617 | - * Abre ou fecha a guia móvel | |
| 618 | - */ | |
| 619 | - abreFecha : function(forca,chave) { | |
| 620 | - if (typeof (console) !== 'undefined') | |
| 621 | - console.info("guias.abreFecha"); | |
| 604 | + if (!$i(i3GEO.guias.CONFIGURA[chave].idconteudo)) { | |
| 605 | + f = i3GEO.guias.CONFIGURA[chave].click.apply(f,[obj]); | |
| 606 | + return; | |
| 607 | + } | |
| 608 | + i3GEO.guias.escondeGuias(); | |
| 609 | + i3GEO.guias.abreFecha("abre",chave); | |
| 610 | + if (i3GEO.guias.CONFIGURA[chave].click) { | |
| 611 | + f = i3GEO.guias.CONFIGURA[chave].click.apply(f,[obj]); | |
| 612 | + } | |
| 613 | + }, | |
| 614 | + /** | |
| 615 | + * Function: abreFecha | |
| 616 | + * | |
| 617 | + * Abre ou fecha a guia móvel | |
| 618 | + */ | |
| 619 | + abreFecha : function(forca,chave) { | |
| 620 | + if (typeof (console) !== 'undefined') | |
| 621 | + console.info("guias.abreFecha"); | |
| 622 | 622 | |
| 623 | - var molde = $("#i3GEOguiaMovelMolde"); | |
| 624 | - if (!forca) { | |
| 625 | - if (parseInt(molde.css("width"),10) <= 10) { | |
| 626 | - forca = "abre"; | |
| 627 | - } else { | |
| 628 | - forca = "fecha"; | |
| 629 | - } | |
| 630 | - } | |
| 631 | - if (forca === "fecha") {// esconde | |
| 632 | - i3GEO.guias.escondeGuias(); | |
| 633 | - molde.animate( | |
| 634 | - { "width": "-10px" }, | |
| 635 | - 400 | |
| 636 | - ); | |
| 637 | - } else { | |
| 638 | - //$("#i3GEOguiaMovelIcones").css("display","block"); | |
| 639 | - var temp = function(){ | |
| 640 | - i3GEO.guias.mostra(chave); | |
| 641 | - }; | |
| 642 | - molde.animate( | |
| 643 | - { "width": i3GEO.guias.LARGURAGUIAMOVEL + "px" }, | |
| 644 | - {duration: 400,always: temp} | |
| 645 | - ); | |
| 646 | - } | |
| 647 | - }, | |
| 648 | - //usado nas ferramentas | |
| 649 | - mostraGuiaFerramenta : function(guia, namespace) { | |
| 650 | - var g, Dom = YAHOO.util.Dom; | |
| 651 | - if (!namespace) { | |
| 652 | - namespace = "guia"; | |
| 653 | - } | |
| 654 | - for (g = 0; g < 12; g++) { | |
| 655 | - Dom.setStyle(namespace + g + "obj", "display", "none"); | |
| 656 | - } | |
| 657 | - Dom.setStyle(guia + "obj", "display", "block"); | |
| 658 | - }, | |
| 659 | - ajustaGuiaFerramenta : function(){} | |
| 623 | + var molde = $("#i3GEOguiaMovelMolde"); | |
| 624 | + if (!forca) { | |
| 625 | + if (parseInt(molde.css("width"),10) <= 10) { | |
| 626 | + forca = "abre"; | |
| 627 | + } else { | |
| 628 | + forca = "fecha"; | |
| 629 | + } | |
| 630 | + } | |
| 631 | + if (forca === "fecha") {// esconde | |
| 632 | + i3GEO.guias.escondeGuias(); | |
| 633 | + molde.animate( | |
| 634 | + { "width": "-10px" }, | |
| 635 | + 400 | |
| 636 | + ); | |
| 637 | + } else { | |
| 638 | + //$("#i3GEOguiaMovelIcones").css("display","block"); | |
| 639 | + var temp = function(){ | |
| 640 | + i3GEO.guias.mostra(chave); | |
| 641 | + }; | |
| 642 | + molde.animate( | |
| 643 | + { "width": i3GEO.guias.LARGURAGUIAMOVEL + "px" }, | |
| 644 | + {duration: 400,always: temp} | |
| 645 | + ); | |
| 646 | + } | |
| 647 | + }, | |
| 648 | + //usado nas ferramentas | |
| 649 | + mostraGuiaFerramenta : function(guia, namespace) { | |
| 650 | + var g, Dom = YAHOO.util.Dom; | |
| 651 | + if (!namespace) { | |
| 652 | + namespace = "guia"; | |
| 653 | + } | |
| 654 | + for (g = 0; g < 12; g++) { | |
| 655 | + Dom.setStyle(namespace + g + "obj", "display", "none"); | |
| 656 | + } | |
| 657 | + Dom.setStyle(guia + "obj", "display", "block"); | |
| 658 | + }, | |
| 659 | + ajustaGuiaFerramenta : function(){} | |
| 660 | 660 | }; |
| 661 | 661 | \ No newline at end of file | ... | ... |
js/i3geonaocompacto.js
| ... | ... | @@ -70,8 +70,6 @@ OpenLayers = { |
| 70 | 70 | "../pacotes/yui290/build/dom/dom-min.js", |
| 71 | 71 | "../pacotes/yui290/build/utilities/utilities.js", |
| 72 | 72 | "../pacotes/yui290/build/container/container_core.js", |
| 73 | - //"../pacotes/yui290/build/menu/menu-min.js", | |
| 74 | - //"../pacotes/yui290/build/logger/logger-min.js", | |
| 75 | 73 | "../pacotes/yui290/build/dragdrop/dragdrop-min.js", |
| 76 | 74 | "../pacotes/yui290/build/slider/slider-min.js", |
| 77 | 75 | "../pacotes/yui290/build/animation/animation-min270.js", //a 290 nao funciona direito |
| ... | ... | @@ -79,11 +77,8 @@ OpenLayers = { |
| 79 | 77 | "../pacotes/yui290/build/element/element-min.js", |
| 80 | 78 | "../pacotes/yui290/build/tabview/tabview-min.js", |
| 81 | 79 | "../pacotes/cpaint/cpaint2.inc.js", |
| 82 | - //"../pacotes/yui290/build/treeview/treeview.js", | |
| 83 | - //"../pacotes/yui290/build/button/button-min.js", | |
| 84 | 80 | "../pacotes/yui290/build/json/json-min.js", |
| 85 | 81 | "../pacotes/yui290/build/resize/resize-min.js", |
| 86 | - //"../pacotes/yui290/build/progressbar/progressbar-min.js", | |
| 87 | 82 | "../pacotes/yui290/build/storage/storage-min.js", |
| 88 | 83 | "../pacotes/yui290/build/selector/selector-min.js", |
| 89 | 84 | "../pacotes/wicket/wicket.js", |
| ... | ... | @@ -91,7 +86,6 @@ OpenLayers = { |
| 91 | 86 | "../pacotes/jquery/dist/jquery.min.js", |
| 92 | 87 | "../pacotes/jquery/jquery-ui/jquery-ui.min.js", |
| 93 | 88 | "../pacotes/jquery/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.concat.min.js", |
| 94 | - //"../pacotes/jquery/jquery-ui/jquery.ui-contextmenu.min.js", | |
| 95 | 89 | "../pacotes/bootstrap/js/bootstrap.min.js", |
| 96 | 90 | "../pacotes/bootstrap-material-design/dist/js/material.min.js", |
| 97 | 91 | "ini_i3geo.js", |
| ... | ... | @@ -117,7 +111,6 @@ OpenLayers = { |
| 117 | 111 | "arvoredetemas.js", |
| 118 | 112 | "editor.js", |
| 119 | 113 | "coordenadas.js", |
| 120 | - //"gadgets.js", | |
| 121 | 114 | "login.js", |
| 122 | 115 | "marcador.js", |
| 123 | 116 | "plugini3geo.js", |
| ... | ... | @@ -146,24 +139,14 @@ OpenLayers = { |
| 146 | 139 | var cssfiles = new Array( |
| 147 | 140 | "../css/input.css", |
| 148 | 141 | "../css/geral.css", |
| 149 | - //"../css/botoes2.css", | |
| 150 | - //"../css/documentation.css", | |
| 151 | - //"../pacotes/yui290/build/logger/assets/skins/sam/logger.css", | |
| 152 | 142 | "../pacotes/yui290/build/fonts/fonts-min.css", |
| 153 | 143 | "../pacotes/yui290/build/reset-fonts-grids/reset-fonts-grids.css", |
| 154 | 144 | "../pacotes/yui290/build/grids/grids-min.css", |
| 155 | - //"../pacotes/yui290/build/menu/assets/skins/sam/menu.css", | |
| 156 | - //"../pacotes/yui290/build/autocomplete/assets/skins/sam/autocomplete.css", | |
| 157 | 145 | "../pacotes/yui290/build/container/assets/skins/sam/container.css", |
| 158 | 146 | "../pacotes/yui290/build/tabview/assets/skins/sam/tabview.css", |
| 159 | - //"../pacotes/yui290/build/treeview/assets/skins/sam/treeview.css", | |
| 160 | - //"../pacotes/yui290/build/button/assets/skins/sam/button.css", | |
| 161 | 147 | "../pacotes/yui290/build/slider/assets/skins/sam/slider.css", |
| 162 | 148 | "../pacotes/yui290/build/resize/assets/skins/sam/resize.css", |
| 163 | 149 | "../pacotes/jquery/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.min.css", |
| 164 | - //"../pacotes/yui290/build/progressbar/assets/skins/sam/progressbar.css", | |
| 165 | - //"../css/corrigeyui_geral.css", | |
| 166 | - //"../css/janelaflutuante.css", | |
| 167 | 150 | "../mashups/openlayers.css" |
| 168 | 151 | ); |
| 169 | 152 | for (i = 0; i < cssfiles.length; i++) | ... | ... |
js/ini_i3geo.js
| ... | ... | @@ -378,9 +378,6 @@ var i3GEO = { |
| 378 | 378 | i3GEO.Interface.openlayers.TILES = (d.hasOwnProperty("singleTile") && d.singleTile != "") ? !d.singleTile:true; |
| 379 | 379 | i3GEO.Interface.openlayers.parametrosMap = d.MapOptions; |
| 380 | 380 | i3GEO.Interface.openlayers.parametrosView = d.ViewOptions; |
| 381 | - if(d.hasOwnProperty("editorButtons") && d.editorButtons != ""){ | |
| 382 | - i3GEO.editor.botoes = d.editorButtons; | |
| 383 | - } | |
| 384 | 381 | } |
| 385 | 382 | if(c.hasOwnProperty("googleMaps") && c.mapType == "GM"){ |
| 386 | 383 | i3GEO.Interface.ATUAL = "googlemaps"; |
| ... | ... | @@ -537,12 +534,6 @@ var i3GEO = { |
| 537 | 534 | cria : function() { |
| 538 | 535 | //calcula a largura da barra de rolagem para adicionar ao tamanho do mapa |
| 539 | 536 | i3GEO.scrollerWidth = i3GEO.util.getScrollerWidth(); |
| 540 | - $('[data-traduzir="true"]').each(function(){ | |
| 541 | - this.innerHTML = Mustache.to_html( | |
| 542 | - this.innerHTML, | |
| 543 | - i3GEO.idioma.OBJETOIDIOMA | |
| 544 | - ); | |
| 545 | - }); | |
| 546 | 537 | var tamanho, temp; |
| 547 | 538 | temp = window.location.href.split("?&"); |
| 548 | 539 | if (temp[1]) { |
| ... | ... | @@ -573,6 +564,14 @@ var i3GEO = { |
| 573 | 564 | || i3GEO.configura.locaplic === "") { |
| 574 | 565 | i3GEO.util.localizai3GEO(); |
| 575 | 566 | } |
| 567 | + //para permitir o uso de {{{locaplic}}} em templates | |
| 568 | + i3GEO.idioma.OBJETOIDIOMA.locaplic = i3GEO.configura.locaplic; | |
| 569 | + $('[data-traduzir="true"]').each(function(){ | |
| 570 | + this.innerHTML = Mustache.to_html( | |
| 571 | + this.innerHTML, | |
| 572 | + i3GEO.idioma.OBJETOIDIOMA | |
| 573 | + ); | |
| 574 | + }); | |
| 576 | 575 | // |
| 577 | 576 | // calcula o tamanho do mapa |
| 578 | 577 | // |
| ... | ... | @@ -738,11 +737,14 @@ var i3GEO = { |
| 738 | 737 | } |
| 739 | 738 | i3GEO.aposIniciar(); |
| 740 | 739 | } catch (e) { |
| 740 | + if (typeof (console) !== 'undefined') | |
| 741 | + console.error(e.message) | |
| 741 | 742 | |
| 742 | 743 | } |
| 743 | 744 | }; |
| 744 | 745 | if (!$i("i3geo")) { |
| 745 | - document.body.id = "i3geo"; | |
| 746 | + | |
| 747 | + document.body.id = "i3geo"; | |
| 746 | 748 | } |
| 747 | 749 | temp = $i("i3geo"); |
| 748 | 750 | temp.className = "yui-skin-sam"; |
| ... | ... | @@ -901,6 +903,8 @@ var i3GEO = { |
| 901 | 903 | return; |
| 902 | 904 | } |
| 903 | 905 | } catch (e) { |
| 906 | + if (typeof (console) !== 'undefined') | |
| 907 | + console.error(e.message) | |
| 904 | 908 | |
| 905 | 909 | } |
| 906 | 910 | erro = function() { |
| ... | ... | @@ -947,6 +951,8 @@ var i3GEO = { |
| 947 | 951 | i3GEO.arvoreDeCamadas.atualizaFarol(i3GEO.parametros.mapscale); |
| 948 | 952 | } |
| 949 | 953 | } catch (e) { |
| 954 | + if (typeof (console) !== 'undefined') | |
| 955 | + console.error(e.message) | |
| 950 | 956 | } |
| 951 | 957 | i3GEO.arvoreDeCamadas.registaCamadas(temp); |
| 952 | 958 | // nesse ponto o layer sera adicionado ao mapa | ... | ... |
js/interface.js
| ... | ... | @@ -380,6 +380,7 @@ i3GEO.Interface = |
| 380 | 380 | // inicialização específica de cada interface |
| 381 | 381 | // |
| 382 | 382 | i3GEO.Interface[i3GEO.Interface.ATUAL].inicia(); |
| 383 | + i3GEO.desenho.criaLayerGrafico(); | |
| 383 | 384 | // inclui o nome do usuario que esta logado |
| 384 | 385 | if ($i(i3GEO.login.divnomelogin) && i3GEO.util.pegaCookie("i3geousuarionome")) { |
| 385 | 386 | $i(i3GEO.login.divnomelogin).innerHTML = i3GEO.util.pegaCookie("i3geousuarionome"); | ... | ... |
js/listaDeFerramentas.js
| ... | ... | @@ -616,12 +616,6 @@ i3GEO.listaDeFerramentas = { |
| 616 | 616 | ] |
| 617 | 617 | ] |
| 618 | 618 | } |
| 619 | - }, | |
| 620 | - { | |
| 621 | - id : "omenudataBarraEdicao", | |
| 622 | - text : $trad("u29"), | |
| 623 | - url : "javascript:i3GEO.editor.inicia()", | |
| 624 | - Interface : "openlayers" //so para a interface openlayers | |
| 625 | 619 | } |
| 626 | 620 | ] |
| 627 | 621 | } | ... | ... |