From f02d41c93e596f30369c2e7bf65b1199ef28d613 Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Tue, 17 Nov 2015 16:23:47 +0000 Subject: [PATCH] --- ferramentas/editorol/editorol.js | 193 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------- 1 file changed, 131 insertions(+), 62 deletions(-) diff --git a/ferramentas/editorol/editorol.js b/ferramentas/editorol/editorol.js index b5c5bf1..a19a0ba 100755 --- a/ferramentas/editorol/editorol.js +++ b/ferramentas/editorol/editorol.js @@ -1031,18 +1031,29 @@ i3GEO.editorOL = i3GEO.editorOL.interacoes.push(draw); i3GEO.Interface.openlayers.interacoes[0].setActive(false); draw.on("drawend", function(evt) { + var simbolo, url; + url = i3GEO.editorOL.simbologia.externalGraphic; + if(url === ""){ + simbolo = new ol.style.Circle({ + radius: i3GEO.editorOL.simbologia.pointRadius, + fill: new ol.style.Fill({ + color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')' + }), + stroke: new ol.style.Stroke({ + color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')', + width: i3GEO.editorOL.simbologia.pointRadius / 3 + }) + }); + } + else{ + simbolo = new ol.style.Icon({ + src : url, + size : [i3GEO.editorOL.simbologia.graphicWidth,i3GEO.editorOL.simbologia.graphicHeight] + }); + } evt.feature.setStyle( new ol.style.Style({ - image: new ol.style.Circle({ - radius: i3GEO.editorOL.simbologia.pointRadius, - fill: new ol.style.Fill({ - color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')' - }), - stroke: new ol.style.Stroke({ - color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')', - width: i3GEO.editorOL.simbologia.pointRadius / 3 - }) - }) + image: simbolo }) ); evt.feature.setId(i3GEO.util.uid()); @@ -1168,11 +1179,8 @@ i3GEO.editorOL = i3GEO.editorOL.idsSelecionados.push(id); f.setId(id); s = f.getStyle(); + if(s.getImage()){ - f.setProperties({ - fillColor: s.getImage().getFill().getColor(), - strokeColor: s.getImage().getStroke().getColor() - }); f.setStyle( new ol.style.Style({ image: new ol.style.Circle({ @@ -1187,11 +1195,32 @@ i3GEO.editorOL = }) }) ); + if(!s.getImage().getSrc){ + f.setProperties({ + fillColor: s.getImage().getFill().getColor(), + strokeColor: s.getImage().getStroke().getColor(), + externalGraphic: "", + graphicHeight : 25, + graphicWidth : 25 + }); + } + else{ + f.setProperties({ + fillColor: "", + strokeColor: "", + externalGraphic: s.getImage().getSrc(), + graphicHeight : s.getImage().getSize()[1], + graphicWidth : s.getImage().getSize()[0] + }); + } } else{ f.setProperties({ fillColor: s.getFill().getColor(), - strokeColor: s.getStroke().getColor() + strokeColor: s.getStroke().getColor(), + externalGraphic: "", + graphicHeight : 25, + graphicWidth : 25 }); s.getFill().setColor('rgba(255, 255, 255, 0.5)'); s.getStroke().setColor('blue'); @@ -1597,13 +1626,24 @@ i3GEO.editorOL = for(i=0; i' + '' + '' - + '

Cor do preenchimento

' + + '

Cor do preenchimento

' + '
' + '' + '
' - + '

Cor da fonte

' + + '

Cor da fonte

' + '
' + '' + '
' - + '

Tamanho da fonte

' + + '

Tamanho da fonte

' + '
' + '' + '
' - + '

Opacidade (de 0 a 1)

' + + '

Opacidade (de 0 a 1)

' + '
' + '' + '
' - + '

Largura da linha/contorno

' + + '

Largura da linha/contorno

' + '
' + '' + + '
' + + '

Url de uma imagem

' + + '
' + + '' + + '
' + + '

Largura da imagem

' + + '
' + + '' + + '
' + + '

Altura da imagem

' + + '
' + + '' + '
'; - //TODO incluir propriedades de uma figura - /* - + ' ' - + ' Url de uma figura' - + ' ' - + ' ' - + ' Largura e altura ' - + ' ' - */ - //TODO implementar ao atualizar OL3 /* + '
' @@ -2122,10 +2158,24 @@ i3GEO.editorOL = }) }) ); - f.setProperties({ - fillColor: st.getImage().getFill().getColor(), - strokeColor: st.getImage().getStroke().getColor() - }); + if(st.getImage().getSrc){ + f.setProperties({ + fillColor: "", + strokeColor: "", + externalGraphic: st.getImage().getSrc(), + graphicHeight : st.getImage().getSize()[1], + graphicWidth : st.getImage().getSize()[0] + }); + } + else{ + f.setProperties({ + fillColor: st.getImage().getFill().getColor(), + strokeColor: st.getImage().getStroke().getColor(), + externalGraphic: "", + graphicHeight: "", + graphicWidth: "" + }); + } } else{ f.setProperties({ @@ -2148,20 +2198,32 @@ i3GEO.editorOL = st = f.getStyle(); //caso de ponto if(st.getImage()){ - f.setStyle( - new ol.style.Style({ - image: new ol.style.Circle({ - radius: i3GEO.editorOL.simbologia.pointRadius, - fill: new ol.style.Fill({ - color: f.getProperties().fillColor - }), - stroke: new ol.style.Stroke({ - color: f.getProperties().strokeColor, - width: i3GEO.editorOL.simbologia.pointRadius / 3 + if(st.getImage().getSrc || f.getProperties().externalGraphic != ""){ + f.setStyle( + new ol.style.Style({ + image: new ol.style.Icon({ + src : f.getProperties().externalGraphic, + size : [f.getProperties().graphicWidth,f.getProperties().graphicHeight] }) }) - }) - ); + ); + } + else{ + f.setStyle( + new ol.style.Style({ + image: new ol.style.Circle({ + radius: i3GEO.editorOL.simbologia.pointRadius, + fill: new ol.style.Fill({ + color: f.getProperties().fillColor + }), + stroke: new ol.style.Stroke({ + color: f.getProperties().strokeColor, + width: i3GEO.editorOL.simbologia.pointRadius / 3 + }) + }) + }) + ); + } } else{ st.getFill().setColor(f.getProperties().fillColor); @@ -2185,8 +2247,14 @@ i3GEO.editorOL = s = i3GEO.desenho.layergrafico.getSource(); f = s.getFeatureById(id); if(f){ - f.getStyle().getFill().setColor(f.getProperties().fillColor); - f.getStyle().getStroke().setColor(f.getProperties().strokeColor); + if(f.getStyle().getSrc()){ + f.getStyle().setSrc(f.getProperties().externalGraphic); + f.getStyle().setSize([f.getProperties().graphicWidth,f.getProperties().graphicHeight]); + } + else{ + f.getStyle().getFill().setColor(f.getProperties().fillColor); + f.getStyle().getStroke().setColor(f.getProperties().strokeColor); + } } i3GEO.editorOL.idsSelecionados.remove(id); i3GEO.desenho.layergrafico.getSource().changed(); @@ -2274,7 +2342,8 @@ i3GEO.editorOL = i3GEO.editorOL.idsSelecionados.push(id); f.setProperties({ fillColor: f.getStyle().getFill().getColor(), - strokeColor: f.getStyle().getStroke().getColor() + strokeColor: f.getStyle().getStroke().getColor(), + externalGraphic: "" }); f.getStyle().getFill().setColor('rgba(255, 255, 255, 0.5)'); f.getStyle().getStroke().setColor('blue'); -- libgit2 0.21.2