Commit 2d8520f71bff2d9efdbd29322566d0a35ee2228e
1 parent
09643ef2
Exists in
master
and in
7 other branches
Correção no estilo e nas mensagens enviadas ao usuário pela opção de salvar geom…
…etrias do editor vetorial
Showing
2 changed files
with
2470 additions
and
2451 deletions
Show diff stats
ferramentas/editorol/editorol.js
| ... | ... | @@ -41,705 +41,705 @@ |
| 41 | 41 | */ |
| 42 | 42 | |
| 43 | 43 | if (!i3GEO || typeof (i3GEO) === 'undefined') { |
| 44 | - var i3GEO = {}; | |
| 45 | - i3GEO.Interface = {}; | |
| 46 | - navn = false; | |
| 47 | - navm = false; | |
| 48 | - $i = function(id) { | |
| 49 | - return document.getElementById(id); | |
| 50 | - }; | |
| 51 | - app = navigator.appName.substring(0, 1); | |
| 52 | - if (app === 'N') { | |
| 53 | - navn = true; | |
| 54 | - } else { | |
| 55 | - navm = true; | |
| 56 | - } | |
| 44 | + var i3GEO = {}; | |
| 45 | + i3GEO.Interface = {}; | |
| 46 | + navn = false; | |
| 47 | + navm = false; | |
| 48 | + $i = function(id) { | |
| 49 | + return document.getElementById(id); | |
| 50 | + }; | |
| 51 | + app = navigator.appName.substring(0, 1); | |
| 52 | + if (app === 'N') { | |
| 53 | + navn = true; | |
| 54 | + } else { | |
| 55 | + navm = true; | |
| 56 | + } | |
| 57 | 57 | } |
| 58 | 58 | i3GEO.editorOL = |
| 59 | - { | |
| 60 | - MUSTACHESALVAGEOMETRIAS: "", | |
| 61 | - MUSTACHEFERRAMENTAS: "", | |
| 62 | - MUSTACHEPROPRIEDADES: "", | |
| 63 | - layerDefault: "", | |
| 64 | - simbologia : { | |
| 65 | - opacidade : 0.8, | |
| 66 | - texto : "", | |
| 67 | - fillColor : "250,180,15", | |
| 68 | - strokeWidth : 5, | |
| 69 | - strokeColor : "250,150,0", | |
| 70 | - pointRadius : 4, | |
| 71 | - graphicName : "square", | |
| 72 | - fontSize : "12px", | |
| 73 | - fontColor : "0,0,0", | |
| 74 | - externalGraphic : "", | |
| 75 | - graphicHeight : 25, | |
| 76 | - graphicWidth : 25 | |
| 77 | - }, | |
| 78 | - backup : new ol.layer.Vector({ | |
| 79 | - source : new ol.source.Vector({ | |
| 80 | - features : new ol.Collection(), | |
| 81 | - useSpatialIndex : false, | |
| 82 | - name : "Backup" | |
| 83 | - }), | |
| 84 | - //map : i3geoOL, | |
| 85 | - visible : false | |
| 86 | - }), | |
| 87 | - e_oce : new ol.layer.Tile({ | |
| 88 | - title : "ESRI Ocean Basemap", | |
| 89 | - visible : false, | |
| 90 | - isBaseLayer : true, | |
| 91 | - name : "oce", | |
| 92 | - source : new ol.source.TileArcGISRest({ | |
| 93 | - url : "http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer", | |
| 94 | - attributions: [ | |
| 95 | - new ol.Attribution({ | |
| 96 | - html: 'Tiles © <a href="http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer">ArcGIS</a>' | |
| 97 | - }) | |
| 98 | - ] | |
| 99 | - }) | |
| 100 | - }), | |
| 101 | - e_ims : new ol.layer.Tile({ | |
| 102 | - title : "ESRI Imagery World 2D", | |
| 103 | - visible : false, | |
| 104 | - isBaseLayer : true, | |
| 105 | - name : "ims", | |
| 106 | - source : new ol.source.TileArcGISRest({ | |
| 107 | - url : "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer", | |
| 108 | - attributions: [ | |
| 109 | - new ol.Attribution({ | |
| 110 | - html: 'Tiles © <a href="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer">ArcGIS</a>' | |
| 111 | - }) | |
| 112 | - ] | |
| 113 | - }) | |
| 114 | - }), | |
| 115 | - e_wsm : new ol.layer.Tile({ | |
| 116 | - title : "ESRI World Street Map", | |
| 117 | - visible : false, | |
| 118 | - isBaseLayer : true, | |
| 119 | - name : "wsm", | |
| 120 | - source : new ol.source.TileArcGISRest({ | |
| 121 | - url : "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer", | |
| 122 | - attributions: [ | |
| 123 | - new ol.Attribution({ | |
| 124 | - html: 'Tiles © <a href="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer">ArcGIS</a>' | |
| 125 | - }) | |
| 126 | - ] | |
| 127 | - }) | |
| 128 | - }), | |
| 129 | - ol_mma : new ol.layer.Tile({ | |
| 130 | - title : "Base carto MMA", | |
| 131 | - visible : false, | |
| 132 | - isBaseLayer : true, | |
| 133 | - name : "bra", | |
| 134 | - source : new ol.source.TileWMS({ | |
| 135 | - url : "http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseraster.map&", | |
| 136 | - params : { | |
| 137 | - 'layers' : "baseraster", | |
| 138 | - 'srs' : "EPSG:4326", | |
| 139 | - 'format' : "image/png" | |
| 140 | - } | |
| 141 | - }) | |
| 142 | - }), | |
| 143 | - e_tms : new ol.layer.Tile({ | |
| 144 | - title : "OSGEO", | |
| 145 | - visible : false, | |
| 146 | - isBaseLayer : true, | |
| 147 | - name : "tms", | |
| 148 | - source : new ol.source.TileWMS({ | |
| 149 | - url : "http://tilecache.osgeo.org/wms-c/Basic.py/", | |
| 150 | - params : { | |
| 151 | - 'layers' : "basic", | |
| 152 | - 'type' : "png", | |
| 153 | - 'srs' : "EPSG:4326", | |
| 154 | - 'format' : "image/png", | |
| 155 | - 'VERSION' : '1.1.1' | |
| 156 | - }, | |
| 157 | - attributions: [ | |
| 158 | - new ol.Attribution({ | |
| 159 | - html: '© <a href="http://www.tilecache.org/">2006-2010, TileCache Contributors</a>' | |
| 160 | - }) | |
| 161 | - ] | |
| 162 | - }) | |
| 163 | - }), | |
| 164 | - top_wms : new ol.layer.Tile({ | |
| 165 | - title : "Toponímia MMA", | |
| 166 | - visible : false, | |
| 167 | - isBaseLayer : true, | |
| 168 | - name : "bra", | |
| 169 | - source : new ol.source.TileWMS({ | |
| 170 | - url : "http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseref.map&", | |
| 171 | - params : { | |
| 172 | - 'layers' : "base", | |
| 173 | - 'srs' : "EPSG:4326", | |
| 174 | - 'format' : "image/png" | |
| 175 | - } | |
| 176 | - }) | |
| 177 | - }), | |
| 178 | - est_wms : new ol.layer.Tile({ | |
| 179 | - title : "Estados do Brasil", | |
| 180 | - visible : false, | |
| 181 | - isBaseLayer : true, | |
| 182 | - name : "bra", | |
| 183 | - source : new ol.source.TileWMS({ | |
| 184 | - url : "http://mapas.mma.gov.br/i3geo/ogc.php?tema=estadosl&", | |
| 185 | - params : { | |
| 186 | - 'layers' : "estadosl", | |
| 187 | - 'srs' : "EPSG:4326", | |
| 188 | - 'format' : "image/png" | |
| 189 | - } | |
| 190 | - }) | |
| 191 | - }), | |
| 192 | - fundo: "e_ims,e_wsm,ol_mma,ol_wms,top_wms,est_wms,e_oce", | |
| 193 | - nomeFuncaoSalvar : "i3GEO.editorOL.salvaGeo()", | |
| 194 | - kml : [], | |
| 195 | - layersIniciais : [], | |
| 196 | - //essa configuracao dos botoes afeta apenas o mashup | |
| 197 | - //para a configuração do editor dentro de um mapa normal, veja i3GEO.barraDebotoes.editor.ativaPainel() | |
| 198 | - botoes : { | |
| 199 | - 'imprimir': false, | |
| 200 | - 'grid': false, | |
| 201 | - 'pan' : false, | |
| 202 | - 'zoombox' : false, | |
| 203 | - 'zoomtot' : false, | |
| 204 | - 'zoomin' : false, | |
| 205 | - 'zoomout' : false, | |
| 206 | - 'distancia' : false, | |
| 207 | - 'area' : false, | |
| 208 | - 'identifica' : false, | |
| 209 | - 'linha' : true, | |
| 210 | - 'ponto' : true, | |
| 211 | - 'poligono' : true, | |
| 212 | - 'texto' : true, | |
| 213 | - 'edita' : true, | |
| 214 | - 'listag' : true, | |
| 215 | - 'corta' : true, | |
| 216 | - 'apaga' : true, | |
| 217 | - 'procura' : false, | |
| 218 | - 'selecao' : true, | |
| 219 | - 'selecaotudo' : true, | |
| 220 | - 'salva' : true, | |
| 221 | - 'ajuda' : true, | |
| 222 | - 'propriedades' : true, | |
| 223 | - 'fecha' : false, | |
| 224 | - 'tools' : true, | |
| 225 | - 'undo' : false, | |
| 226 | - 'frente' : false, | |
| 227 | - 'legenda' : false, | |
| 228 | - 'rodadomouse' : true, | |
| 229 | - 'novaaba' : false | |
| 230 | - }, | |
| 231 | - pontos : [], | |
| 232 | - marca : "../pacotes/openlayers/img/marker-gold.png", | |
| 233 | - controles : [], | |
| 234 | - tiles : true, | |
| 235 | - incluilayergrafico : true, | |
| 236 | - ativalayerswitcher : false, | |
| 237 | - ativarodadomouse : true, | |
| 238 | - legendahtml : false, | |
| 239 | - numzoom : 12, | |
| 240 | - minresolution : 0.703125, | |
| 241 | - maxext : "", | |
| 242 | - mapext : [-76.5125927, -39.3925675209, -29.5851853, 9.49014852081], | |
| 243 | - mapa : "", | |
| 244 | - //ids das features graficas selecionadas | |
| 245 | - idsSelecionados : [], | |
| 246 | - //backup das features | |
| 247 | - featuresBackup : [], | |
| 248 | - resolutions : [], | |
| 249 | - matrixIds : [], | |
| 250 | - //utilizado pelo mashup | |
| 251 | - inicia : function() { | |
| 252 | - var projectionExtent, size,resolutions,matrixIds,z; | |
| 253 | - if (i3GEO.Interface.openlayers.googleLike === true) { | |
| 254 | - projectionExtent = ol.proj.get('EPSG:3857').getExtent(); | |
| 255 | - } else { | |
| 256 | - projectionExtent = ol.proj.get('EPSG:4326').getExtent(); | |
| 257 | - } | |
| 258 | - size = ol.extent.getWidth(projectionExtent) / 256; | |
| 259 | - resolutions = new Array(40); | |
| 260 | - matrixIds = new Array(40); | |
| 261 | - for (z = 0; z < 40; ++z) { | |
| 262 | - resolutions[z] = size / Math.pow(2, z); | |
| 263 | - matrixIds[z] = z; | |
| 264 | - } | |
| 265 | - i3GEO.editorOL.resolutions = resolutions; | |
| 266 | - i3GEO.editorOL.matrixIds = matrixIds; | |
| 59 | +{ | |
| 60 | + MUSTACHESALVAGEOMETRIAS: "", | |
| 61 | + MUSTACHEFERRAMENTAS: "", | |
| 62 | + MUSTACHEPROPRIEDADES: "", | |
| 63 | + layerDefault: "", | |
| 64 | + simbologia : { | |
| 65 | + opacidade : 0.8, | |
| 66 | + texto : "", | |
| 67 | + fillColor : "250,180,15", | |
| 68 | + strokeWidth : 5, | |
| 69 | + strokeColor : "250,150,0", | |
| 70 | + pointRadius : 4, | |
| 71 | + graphicName : "square", | |
| 72 | + fontSize : "12px", | |
| 73 | + fontColor : "0,0,0", | |
| 74 | + externalGraphic : "", | |
| 75 | + graphicHeight : 25, | |
| 76 | + graphicWidth : 25 | |
| 77 | + }, | |
| 78 | + backup : new ol.layer.Vector({ | |
| 79 | + source : new ol.source.Vector({ | |
| 80 | + features : new ol.Collection(), | |
| 81 | + useSpatialIndex : false, | |
| 82 | + name : "Backup" | |
| 83 | + }), | |
| 84 | + //map : i3geoOL, | |
| 85 | + visible : false | |
| 86 | + }), | |
| 87 | + e_oce : new ol.layer.Tile({ | |
| 88 | + title : "ESRI Ocean Basemap", | |
| 89 | + visible : false, | |
| 90 | + isBaseLayer : true, | |
| 91 | + name : "oce", | |
| 92 | + source : new ol.source.TileArcGISRest({ | |
| 93 | + url : "http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer", | |
| 94 | + attributions: [ | |
| 95 | + new ol.Attribution({ | |
| 96 | + html: 'Tiles © <a href="http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer">ArcGIS</a>' | |
| 97 | + }) | |
| 98 | + ] | |
| 99 | + }) | |
| 100 | + }), | |
| 101 | + e_ims : new ol.layer.Tile({ | |
| 102 | + title : "ESRI Imagery World 2D", | |
| 103 | + visible : false, | |
| 104 | + isBaseLayer : true, | |
| 105 | + name : "ims", | |
| 106 | + source : new ol.source.TileArcGISRest({ | |
| 107 | + url : "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer", | |
| 108 | + attributions: [ | |
| 109 | + new ol.Attribution({ | |
| 110 | + html: 'Tiles © <a href="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer">ArcGIS</a>' | |
| 111 | + }) | |
| 112 | + ] | |
| 113 | + }) | |
| 114 | + }), | |
| 115 | + e_wsm : new ol.layer.Tile({ | |
| 116 | + title : "ESRI World Street Map", | |
| 117 | + visible : false, | |
| 118 | + isBaseLayer : true, | |
| 119 | + name : "wsm", | |
| 120 | + source : new ol.source.TileArcGISRest({ | |
| 121 | + url : "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer", | |
| 122 | + attributions: [ | |
| 123 | + new ol.Attribution({ | |
| 124 | + html: 'Tiles © <a href="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer">ArcGIS</a>' | |
| 125 | + }) | |
| 126 | + ] | |
| 127 | + }) | |
| 128 | + }), | |
| 129 | + ol_mma : new ol.layer.Tile({ | |
| 130 | + title : "Base carto MMA", | |
| 131 | + visible : false, | |
| 132 | + isBaseLayer : true, | |
| 133 | + name : "bra", | |
| 134 | + source : new ol.source.TileWMS({ | |
| 135 | + url : "http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseraster.map&", | |
| 136 | + params : { | |
| 137 | + 'layers' : "baseraster", | |
| 138 | + 'srs' : "EPSG:4326", | |
| 139 | + 'format' : "image/png" | |
| 140 | + } | |
| 141 | + }) | |
| 142 | + }), | |
| 143 | + e_tms : new ol.layer.Tile({ | |
| 144 | + title : "OSGEO", | |
| 145 | + visible : false, | |
| 146 | + isBaseLayer : true, | |
| 147 | + name : "tms", | |
| 148 | + source : new ol.source.TileWMS({ | |
| 149 | + url : "http://tilecache.osgeo.org/wms-c/Basic.py/", | |
| 150 | + params : { | |
| 151 | + 'layers' : "basic", | |
| 152 | + 'type' : "png", | |
| 153 | + 'srs' : "EPSG:4326", | |
| 154 | + 'format' : "image/png", | |
| 155 | + 'VERSION' : '1.1.1' | |
| 156 | + }, | |
| 157 | + attributions: [ | |
| 158 | + new ol.Attribution({ | |
| 159 | + html: '© <a href="http://www.tilecache.org/">2006-2010, TileCache Contributors</a>' | |
| 160 | + }) | |
| 161 | + ] | |
| 162 | + }) | |
| 163 | + }), | |
| 164 | + top_wms : new ol.layer.Tile({ | |
| 165 | + title : "Toponímia MMA", | |
| 166 | + visible : false, | |
| 167 | + isBaseLayer : true, | |
| 168 | + name : "bra", | |
| 169 | + source : new ol.source.TileWMS({ | |
| 170 | + url : "http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseref.map&", | |
| 171 | + params : { | |
| 172 | + 'layers' : "base", | |
| 173 | + 'srs' : "EPSG:4326", | |
| 174 | + 'format' : "image/png" | |
| 175 | + } | |
| 176 | + }) | |
| 177 | + }), | |
| 178 | + est_wms : new ol.layer.Tile({ | |
| 179 | + title : "Estados do Brasil", | |
| 180 | + visible : false, | |
| 181 | + isBaseLayer : true, | |
| 182 | + name : "bra", | |
| 183 | + source : new ol.source.TileWMS({ | |
| 184 | + url : "http://mapas.mma.gov.br/i3geo/ogc.php?tema=estadosl&", | |
| 185 | + params : { | |
| 186 | + 'layers' : "estadosl", | |
| 187 | + 'srs' : "EPSG:4326", | |
| 188 | + 'format' : "image/png" | |
| 189 | + } | |
| 190 | + }) | |
| 191 | + }), | |
| 192 | + fundo: "e_ims,e_wsm,ol_mma,ol_wms,top_wms,est_wms,e_oce", | |
| 193 | + nomeFuncaoSalvar : "i3GEO.editorOL.salvaGeo()", | |
| 194 | + kml : [], | |
| 195 | + layersIniciais : [], | |
| 196 | + //essa configuracao dos botoes afeta apenas o mashup | |
| 197 | + //para a configuração do editor dentro de um mapa normal, veja i3GEO.barraDebotoes.editor.ativaPainel() | |
| 198 | + botoes : { | |
| 199 | + 'imprimir': false, | |
| 200 | + 'grid': false, | |
| 201 | + 'pan' : false, | |
| 202 | + 'zoombox' : false, | |
| 203 | + 'zoomtot' : false, | |
| 204 | + 'zoomin' : false, | |
| 205 | + 'zoomout' : false, | |
| 206 | + 'distancia' : false, | |
| 207 | + 'area' : false, | |
| 208 | + 'identifica' : false, | |
| 209 | + 'linha' : true, | |
| 210 | + 'ponto' : true, | |
| 211 | + 'poligono' : true, | |
| 212 | + 'texto' : true, | |
| 213 | + 'edita' : true, | |
| 214 | + 'listag' : true, | |
| 215 | + 'corta' : true, | |
| 216 | + 'apaga' : true, | |
| 217 | + 'procura' : false, | |
| 218 | + 'selecao' : true, | |
| 219 | + 'selecaotudo' : true, | |
| 220 | + 'salva' : true, | |
| 221 | + 'ajuda' : true, | |
| 222 | + 'propriedades' : true, | |
| 223 | + 'fecha' : false, | |
| 224 | + 'tools' : true, | |
| 225 | + 'undo' : false, | |
| 226 | + 'frente' : false, | |
| 227 | + 'legenda' : false, | |
| 228 | + 'rodadomouse' : true, | |
| 229 | + 'novaaba' : false | |
| 230 | + }, | |
| 231 | + pontos : [], | |
| 232 | + marca : "../pacotes/openlayers/img/marker-gold.png", | |
| 233 | + controles : [], | |
| 234 | + tiles : true, | |
| 235 | + incluilayergrafico : true, | |
| 236 | + ativalayerswitcher : false, | |
| 237 | + ativarodadomouse : true, | |
| 238 | + legendahtml : false, | |
| 239 | + numzoom : 12, | |
| 240 | + minresolution : 0.703125, | |
| 241 | + maxext : "", | |
| 242 | + mapext : [-76.5125927, -39.3925675209, -29.5851853, 9.49014852081], | |
| 243 | + mapa : "", | |
| 244 | + //ids das features graficas selecionadas | |
| 245 | + idsSelecionados : [], | |
| 246 | + //backup das features | |
| 247 | + featuresBackup : [], | |
| 248 | + resolutions : [], | |
| 249 | + matrixIds : [], | |
| 250 | + //utilizado pelo mashup | |
| 251 | + inicia : function() { | |
| 252 | + var projectionExtent, size,resolutions,matrixIds,z; | |
| 253 | + if (i3GEO.Interface.openlayers.googleLike === true) { | |
| 254 | + projectionExtent = ol.proj.get('EPSG:3857').getExtent(); | |
| 255 | + } else { | |
| 256 | + projectionExtent = ol.proj.get('EPSG:4326').getExtent(); | |
| 257 | + } | |
| 258 | + size = ol.extent.getWidth(projectionExtent) / 256; | |
| 259 | + resolutions = new Array(40); | |
| 260 | + matrixIds = new Array(40); | |
| 261 | + for (z = 0; z < 40; ++z) { | |
| 262 | + resolutions[z] = size / Math.pow(2, z); | |
| 263 | + matrixIds[z] = z; | |
| 264 | + } | |
| 265 | + i3GEO.editorOL.resolutions = resolutions; | |
| 266 | + i3GEO.editorOL.matrixIds = matrixIds; | |
| 267 | 267 | |
| 268 | - i3GEO.editorOL.incluilayergrafico = true; | |
| 268 | + i3GEO.editorOL.incluilayergrafico = true; | |
| 269 | 269 | |
| 270 | - i3GEO.Interface.openlayers.parametrosView = { | |
| 271 | - projection : "EPSG:4326", | |
| 272 | - resolutions: resolutions, | |
| 273 | - minResolution: i3GEO.editorOL.minresolution, | |
| 274 | - maxResolution: resolutions[i3GEO.editorOL.numzoom] | |
| 275 | - }; | |
| 276 | - i3GEO.Interface.openlayers.parametrosMap = { | |
| 277 | - target : "i3geoMapa", | |
| 278 | - layers : [], | |
| 279 | - controls : [] | |
| 280 | - }; | |
| 270 | + i3GEO.Interface.openlayers.parametrosView = { | |
| 271 | + projection : "EPSG:4326", | |
| 272 | + resolutions: resolutions, | |
| 273 | + minResolution: i3GEO.editorOL.minresolution, | |
| 274 | + maxResolution: resolutions[i3GEO.editorOL.numzoom] | |
| 275 | + }; | |
| 276 | + i3GEO.Interface.openlayers.parametrosMap = { | |
| 277 | + target : "i3geoMapa", | |
| 278 | + layers : [], | |
| 279 | + controls : [] | |
| 280 | + }; | |
| 281 | 281 | |
| 282 | - i3GEO.Interface.openlayers.cria(); | |
| 283 | - i3GEO.editorOL.mapa = i3geoOL; | |
| 282 | + i3GEO.Interface.openlayers.cria(); | |
| 283 | + i3GEO.editorOL.mapa = i3geoOL; | |
| 284 | 284 | |
| 285 | - // ativabotoes e boolean | |
| 286 | - if(i3GEO.editorOL.controles.length === 0){ | |
| 287 | - i3GEO.editorOL.controles = [ | |
| 288 | - new ol.interaction.DoubleClickZoom(), | |
| 289 | - new ol.interaction.KeyboardPan(), | |
| 290 | - new ol.interaction.KeyboardZoom(), | |
| 291 | - new ol.interaction.MouseWheelZoom(), | |
| 292 | - new ol.interaction.PinchRotate(), | |
| 293 | - new ol.interaction.PinchZoom(), | |
| 294 | - new ol.interaction.DragZoom(), | |
| 295 | - new ol.interaction.DragPan(), | |
| 296 | - new ol.control.Zoom(), | |
| 297 | - new ol.control.ZoomSlider(), | |
| 298 | - new ol.control.ScaleLine() | |
| 299 | - ]; | |
| 300 | - } | |
| 301 | - var alayers = [], fundo = (i3GEO.editorOL.fundo).split(","), nfundo = fundo.length, ncontroles = | |
| 302 | - i3GEO.editorOL.controles.length, i, n, temp; | |
| 285 | + // ativabotoes e boolean | |
| 286 | + if(i3GEO.editorOL.controles.length === 0){ | |
| 287 | + i3GEO.editorOL.controles = [ | |
| 288 | + new ol.interaction.DoubleClickZoom(), | |
| 289 | + new ol.interaction.KeyboardPan(), | |
| 290 | + new ol.interaction.KeyboardZoom(), | |
| 291 | + new ol.interaction.MouseWheelZoom(), | |
| 292 | + new ol.interaction.PinchRotate(), | |
| 293 | + new ol.interaction.PinchZoom(), | |
| 294 | + new ol.interaction.DragZoom(), | |
| 295 | + new ol.interaction.DragPan(), | |
| 296 | + new ol.control.Zoom(), | |
| 297 | + new ol.control.ZoomSlider(), | |
| 298 | + new ol.control.ScaleLine() | |
| 299 | + ]; | |
| 300 | + } | |
| 301 | + var alayers = [], fundo = (i3GEO.editorOL.fundo).split(","), nfundo = fundo.length, ncontroles = | |
| 302 | + i3GEO.editorOL.controles.length, i, n, temp; | |
| 303 | 303 | |
| 304 | - if (i3GEO.editorOL.ativarodadomouse === "false") { | |
| 305 | - i3GEO.editorOL.ativarodadomouse = false; | |
| 306 | - } | |
| 307 | - if (i3GEO.editorOL.ativarodadomouse === "true") { | |
| 308 | - i3GEO.editorOL.ativarodadomouse = true; | |
| 309 | - } | |
| 310 | - if (i3GEO.editorOL.legendahtml === "false") { | |
| 311 | - i3GEO.editorOL.legendahtml = false; | |
| 312 | - } | |
| 313 | - if (i3GEO.editorOL.legendahtml === "true") { | |
| 314 | - i3GEO.editorOL.legendahtml = true; | |
| 315 | - } | |
| 304 | + if (i3GEO.editorOL.ativarodadomouse === "false") { | |
| 305 | + i3GEO.editorOL.ativarodadomouse = false; | |
| 306 | + } | |
| 307 | + if (i3GEO.editorOL.ativarodadomouse === "true") { | |
| 308 | + i3GEO.editorOL.ativarodadomouse = true; | |
| 309 | + } | |
| 310 | + if (i3GEO.editorOL.legendahtml === "false") { | |
| 311 | + i3GEO.editorOL.legendahtml = false; | |
| 312 | + } | |
| 313 | + if (i3GEO.editorOL.legendahtml === "true") { | |
| 314 | + i3GEO.editorOL.legendahtml = true; | |
| 315 | + } | |
| 316 | 316 | |
| 317 | - if (i3GEO.editorOL.incluilayergrafico === "false") { | |
| 318 | - i3GEO.editorOL.incluilayergrafico = false; | |
| 319 | - } | |
| 320 | - if (i3GEO.editorOL.incluilayergrafico === "true") { | |
| 321 | - i3GEO.editorOL.incluilayergrafico = true; | |
| 322 | - } | |
| 323 | - if (i3GEO.editorOL.incluilayergrafico === true) { | |
| 324 | - if (!i3GEO.desenho.layergrafico) { | |
| 325 | - i3GEO.editorOL.criaLayerGrafico(); | |
| 326 | - } | |
| 327 | - } else { | |
| 328 | - i3GEO.desenho.layergrafico = ""; | |
| 329 | - i3GEO.editorOL.botoes.linha = false; | |
| 330 | - i3GEO.editorOL.botoes.ponto = false; | |
| 331 | - i3GEO.editorOL.botoes.poligono = false; | |
| 332 | - i3GEO.editorOL.botoes.texto = false; | |
| 333 | - i3GEO.editorOL.botoes.edita = false; | |
| 334 | - i3GEO.editorOL.botoes.listag = false; | |
| 335 | - i3GEO.editorOL.botoes.corta = false; | |
| 336 | - i3GEO.editorOL.botoes.apaga = false; | |
| 337 | - i3GEO.editorOL.botoes.selecao = false; | |
| 338 | - i3GEO.editorOL.botoes.selecaotudo = false; | |
| 339 | - i3GEO.editorOL.botoes.salva = false; | |
| 340 | - i3GEO.editorOL.botoes.propriedades = false; | |
| 341 | - i3GEO.editorOL.botoes.fecha = false; | |
| 342 | - i3GEO.editorOL.botoes.tools = false; | |
| 343 | - i3GEO.editorOL.botoes.undo = false; | |
| 344 | - i3GEO.editorOL.botoes.frente = false; | |
| 345 | - i3GEO.editorOL.botoes.novaaba = false; | |
| 346 | - } | |
| 347 | - for (i = 0; i < ncontroles; i++) { | |
| 348 | - i3GEO.editorOL.mapa.addControl(i3GEO.editorOL.controles[i]); | |
| 349 | - } | |
| 350 | - if (i3GEO.editorOL.fundo != "") { | |
| 351 | - for (i = nfundo - 1; i >= 0; i--) { | |
| 352 | - if (fundo[i] != "" && i3GEO.editorOL[fundo[i]]) { | |
| 353 | - alayers.push(i3GEO.editorOL[fundo[i]]); | |
| 354 | - i3GEO.editorOL[fundo[i]].setVisibility(true); | |
| 355 | - } | |
| 356 | - } | |
| 357 | - } | |
| 358 | - i3GEO.editorOL.mapa.addLayers(alayers); | |
| 359 | - if (i3GEO.editorOL.layersIniciais !== "") { | |
| 360 | - n = i3GEO.editorOL.layersIniciais.length; | |
| 361 | - for (i = 0; i < n; i++) { | |
| 362 | - // singleTile deve ser definido em cada layer | |
| 363 | - // i3GEO.editorOL.layersIniciais[i].singleTile = single; | |
| 364 | - i3GEO.editorOL.mapa.addLayer(i3GEO.editorOL.layersIniciais[i]); | |
| 365 | - } | |
| 366 | - } | |
| 367 | - if (!i3GEO.desenho.layergrafico && i3GEO.editorOL.incluilayergrafico === true) { | |
| 368 | - i3GEO.editorOL.mapa.addLayers([ | |
| 369 | - i3GEO.desenho.layergrafico | |
| 370 | - ]); | |
| 371 | - } | |
| 372 | - i3GEO.editorOL.adicionaKml(); | |
| 373 | - i3GEO.editorOL.adicionaMarcas(); | |
| 317 | + if (i3GEO.editorOL.incluilayergrafico === "false") { | |
| 318 | + i3GEO.editorOL.incluilayergrafico = false; | |
| 319 | + } | |
| 320 | + if (i3GEO.editorOL.incluilayergrafico === "true") { | |
| 321 | + i3GEO.editorOL.incluilayergrafico = true; | |
| 322 | + } | |
| 323 | + if (i3GEO.editorOL.incluilayergrafico === true) { | |
| 324 | + if (!i3GEO.desenho.layergrafico) { | |
| 325 | + i3GEO.editorOL.criaLayerGrafico(); | |
| 326 | + } | |
| 327 | + } else { | |
| 328 | + i3GEO.desenho.layergrafico = ""; | |
| 329 | + i3GEO.editorOL.botoes.linha = false; | |
| 330 | + i3GEO.editorOL.botoes.ponto = false; | |
| 331 | + i3GEO.editorOL.botoes.poligono = false; | |
| 332 | + i3GEO.editorOL.botoes.texto = false; | |
| 333 | + i3GEO.editorOL.botoes.edita = false; | |
| 334 | + i3GEO.editorOL.botoes.listag = false; | |
| 335 | + i3GEO.editorOL.botoes.corta = false; | |
| 336 | + i3GEO.editorOL.botoes.apaga = false; | |
| 337 | + i3GEO.editorOL.botoes.selecao = false; | |
| 338 | + i3GEO.editorOL.botoes.selecaotudo = false; | |
| 339 | + i3GEO.editorOL.botoes.salva = false; | |
| 340 | + i3GEO.editorOL.botoes.propriedades = false; | |
| 341 | + i3GEO.editorOL.botoes.fecha = false; | |
| 342 | + i3GEO.editorOL.botoes.tools = false; | |
| 343 | + i3GEO.editorOL.botoes.undo = false; | |
| 344 | + i3GEO.editorOL.botoes.frente = false; | |
| 345 | + i3GEO.editorOL.botoes.novaaba = false; | |
| 346 | + } | |
| 347 | + for (i = 0; i < ncontroles; i++) { | |
| 348 | + i3GEO.editorOL.mapa.addControl(i3GEO.editorOL.controles[i]); | |
| 349 | + } | |
| 350 | + if (i3GEO.editorOL.fundo != "") { | |
| 351 | + for (i = nfundo - 1; i >= 0; i--) { | |
| 352 | + if (fundo[i] != "" && i3GEO.editorOL[fundo[i]]) { | |
| 353 | + alayers.push(i3GEO.editorOL[fundo[i]]); | |
| 354 | + i3GEO.editorOL[fundo[i]].setVisibility(true); | |
| 355 | + } | |
| 356 | + } | |
| 357 | + } | |
| 358 | + i3GEO.editorOL.mapa.addLayers(alayers); | |
| 359 | + if (i3GEO.editorOL.layersIniciais !== "") { | |
| 360 | + n = i3GEO.editorOL.layersIniciais.length; | |
| 361 | + for (i = 0; i < n; i++) { | |
| 362 | + // singleTile deve ser definido em cada layer | |
| 363 | + // i3GEO.editorOL.layersIniciais[i].singleTile = single; | |
| 364 | + i3GEO.editorOL.mapa.addLayer(i3GEO.editorOL.layersIniciais[i]); | |
| 365 | + } | |
| 366 | + } | |
| 367 | + if (!i3GEO.desenho.layergrafico && i3GEO.editorOL.incluilayergrafico === true) { | |
| 368 | + i3GEO.editorOL.mapa.addLayers([ | |
| 369 | + i3GEO.desenho.layergrafico | |
| 370 | + ]); | |
| 371 | + } | |
| 372 | + i3GEO.editorOL.adicionaKml(); | |
| 373 | + i3GEO.editorOL.adicionaMarcas(); | |
| 374 | 374 | |
| 375 | - i3GEO.editorOL.coordenadas(); | |
| 376 | - //i3GEO.editorOL.criaJanelaBusca(); | |
| 377 | - i3GEO.editorOL.criaBotoes(i3GEO.editorOL.botoes); | |
| 378 | - if (i3GEO.editorOL.ativalayerswitcher === true) { | |
| 379 | - //i3GEO.editorOL.ativaLayerSwitcher(); | |
| 380 | - } | |
| 381 | - if (i3GEO.editorOL.ativarodadomouse === false) { | |
| 382 | - i3GEO.editorOL.desativaRodaDoMouse(); | |
| 383 | - } | |
| 384 | - //TODO testar numzoom | |
| 385 | - /* | |
| 375 | + i3GEO.editorOL.coordenadas(); | |
| 376 | + //i3GEO.editorOL.criaJanelaBusca(); | |
| 377 | + i3GEO.editorOL.criaBotoes(i3GEO.editorOL.botoes); | |
| 378 | + if (i3GEO.editorOL.ativalayerswitcher === true) { | |
| 379 | + //i3GEO.editorOL.ativaLayerSwitcher(); | |
| 380 | + } | |
| 381 | + if (i3GEO.editorOL.ativarodadomouse === false) { | |
| 382 | + i3GEO.editorOL.desativaRodaDoMouse(); | |
| 383 | + } | |
| 384 | + //TODO testar numzoom | |
| 385 | + /* | |
| 386 | 386 | if (i3GEO.editorOL.numzoom !== "") { |
| 387 | 387 | i3GEO.editorOL.mapa.getView().setOptions({ |
| 388 | 388 | minResolution : i3GEO.editorOL.minresolution, |
| 389 | 389 | maxResolution : |
| 390 | 390 | }); |
| 391 | 391 | } |
| 392 | - */ | |
| 393 | - if (i3GEO.editorOL.maxext !== "") { | |
| 394 | - i3GEO.editorOL.mapa.getView().setProperties({ | |
| 395 | - extent : i3GEO.editorOL.maxext | |
| 396 | - }); | |
| 397 | - } | |
| 398 | - if (i3GEO.editorOL.mapext != "") { | |
| 399 | - var m = i3GEO.util.extGeo2OSM(i3GEO.editorOL.mapext); | |
| 400 | - i3GEO.editorOL.mapa.zoomToExtent(m); | |
| 401 | - } | |
| 402 | - //i3GEO.editorOL.sobeLayersGraficos(); | |
| 403 | - // evita que botoes de opcoes propaguem | |
| 404 | - // o mashup utiliza esse tipo de botao junto ao nome do layer | |
| 405 | - temp = i3GEO.editorOL.pegaControle("OpenLayers.Control.LayerSwitcher"); | |
| 406 | - if (temp) { | |
| 407 | - temp = temp.dataLayersDiv.getElementsByTagName("label"); | |
| 408 | - n = temp.length; | |
| 409 | - for (i = 0; i < n; i++) { | |
| 410 | - // YAHOO.util.Event.addListener(temp[i], "click", YAHOO.util.Event.stopEvent); | |
| 411 | - temp[i].onclick = ""; | |
| 412 | - } | |
| 413 | - } | |
| 414 | - }, | |
| 415 | - criaLayerGrafico : function() { | |
| 416 | - i3GEO.desenho.openlayers.criaLayerGrafico(); | |
| 417 | - }, | |
| 418 | - layersLigados : function() { | |
| 419 | - var l, layers = i3GEO.editorOL.mapa.getLayers(), nlayers = layers.getLength(), ins = [], i; | |
| 420 | - for (i = 0; i < nlayers; i++) { | |
| 421 | - l = layers.item(i); | |
| 422 | - if (l.getVisible() === true) { | |
| 423 | - ins.push(l); | |
| 424 | - } | |
| 425 | - } | |
| 426 | - return ins; | |
| 427 | - }, | |
| 428 | - layerPorParametro : function(parametro, valor) { | |
| 429 | - var layers = i3GEO.editorOL.mapa.layers, nlayers = layers.length, ins = [], i; | |
| 430 | - for (i = 0; i < nlayers; i++) { | |
| 431 | - if (layers[i][parametro] || layers[i][parametro.toLowerCase()]) { | |
| 432 | - if (layers[i][parametro] === valor || layers[i][parametro.toLowerCase()] === valor) { | |
| 433 | - ins.push(layers[i]); | |
| 434 | - } | |
| 435 | - } else { | |
| 436 | - if (layers[i].params && layers[i].params[parametro] && layers[i].params[parametro] === valor) { | |
| 437 | - ins.push(layers[i]); | |
| 438 | - } | |
| 439 | - } | |
| 440 | - } | |
| 441 | - return ins; | |
| 442 | - }, | |
| 443 | - // layers clonados sao copias WMS de layers TMS necessarios para realizar o getfeature | |
| 444 | - // sao criados quando o layer e adicionado | |
| 445 | - layersClonados : function(paramsLayers) { | |
| 446 | - var layers = i3GEO.editorOL.mapa.layers, nlayers = layers.length, i; | |
| 447 | - for (i = 0; i < nlayers; i++) { | |
| 448 | - if (layers[i].params && layers[i].params.CLONETMS === paramsLayers) { | |
| 449 | - return (layers[i]); | |
| 450 | - } | |
| 451 | - } | |
| 452 | - return false; | |
| 453 | - }, | |
| 454 | - layertms2wms : function(tms) { | |
| 455 | - var layer, url; | |
| 456 | - url = tms.url.replace("&cache=sim", "&DESLIGACACHE=sim"); | |
| 457 | - url = url.replace("&Z=${z}&X=${x}&Y=${y}", ""); | |
| 458 | - url = url.replace("Z=${z}&X=${x}&Y=${y}", ""); | |
| 459 | - layer = new OpenLayers.Layer.WMS(tms.layername + "_clone", url, { | |
| 460 | - layers : tms.name, | |
| 461 | - transparent : true | |
| 462 | - }, { | |
| 463 | - gutter : 0, | |
| 464 | - isBaseLayer : false, | |
| 465 | - displayInLayerSwitcher : false, | |
| 466 | - opacity : 1, | |
| 467 | - visibility : true, | |
| 468 | - singleTile : true | |
| 469 | - }); | |
| 470 | - // i3GEO.editorOL.mapa.addLayer(layer); | |
| 471 | - return layer; | |
| 472 | - }, | |
| 473 | - // remove o layer clonado com layertms2wms | |
| 474 | - removeClone : function() { | |
| 475 | - var nome = i3GEO.editorOL.layerAtivo().layername + "_clone", busca = i3GEO.editorOL.mapa.getLayersByName(nome); | |
| 476 | - if (busca.length > 0) { | |
| 477 | - i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.mapa.getLayersByName(camada.name)[0], false); | |
| 478 | - } | |
| 479 | - }, | |
| 480 | - coordenadas : function() { | |
| 481 | - // | |
| 482 | - // substitui o controle que mostra as coordenadas | |
| 483 | - // | |
| 484 | - var idcoord = i3GEO.editorOL.mapa.getControlsBy("separator", " "); | |
| 485 | - if (idcoord[0]) { | |
| 486 | - i3GEO.editorOL.mapa.events.register("mousemove", i3GEO.editorOL.mapa, function(e) { | |
| 487 | - var p, lonlat, d; | |
| 488 | - if (navm) { | |
| 489 | - p = new OpenLayers.Pixel(e.x, e.y); | |
| 490 | - } else { | |
| 491 | - p = e.xy; | |
| 492 | - } | |
| 493 | - // altera o indicador de localizacao | |
| 494 | - lonlat = i3GEO.editorOL.mapa.getLonLatFromPixel(p); | |
| 495 | - lonlat = i3GEO.util.projOSM2Geo(lonlat); | |
| 496 | - d = i3GEO.calculo.dd2dms(lonlat.lon, lonlat.lat); | |
| 497 | - try { | |
| 498 | - $i(idcoord[0].id).innerHTML = "Long: " + d[0] + "<br>Lat: " + d[1]; | |
| 499 | - } catch (e) { | |
| 500 | - if (typeof (console) !== 'undefined') { | |
| 501 | - console.error(e); | |
| 502 | - } | |
| 503 | - } | |
| 504 | - }); | |
| 505 | - } | |
| 506 | - }, | |
| 507 | - criaJanelaBusca : function() { | |
| 508 | - var layers = i3GEO.editorOL.layersLigados(), nlayers = layers.length, i, ins, combo = | |
| 509 | - "<select id=i3GEOOLlistaTemasBusca ><option value=''>----</option>"; | |
| 510 | - for (i = 0; i < nlayers; i++) { | |
| 511 | - combo += "<option value='" + i + "' >" + layers[i].getProperties().name + "</option>"; | |
| 512 | - } | |
| 513 | - combo += "</select>"; | |
| 514 | - ins = "<div class=paragrafo >" + $trad("a7") + ":<br>" + combo; | |
| 515 | - ins += "<br>" + $trad("x64") + ":<br><span id=i3GEOOLcomboitens ></span>"; | |
| 516 | - ins += "<br>" + $trad("t23") + ":<br><input type=text size=20 id=i3GEOOLpalavraBusca >"; | |
| 517 | - ins += "<br><br><input type=button value='" + $trad("t23") + "' id='i3GEOOLbotaoBusca' ></div>"; | |
| 518 | - ins += "<br>'" + $trad("result") + "':<br><span id=i3GEOOLcomboresultado ></span>"; | |
| 392 | + */ | |
| 393 | + if (i3GEO.editorOL.maxext !== "") { | |
| 394 | + i3GEO.editorOL.mapa.getView().setProperties({ | |
| 395 | + extent : i3GEO.editorOL.maxext | |
| 396 | + }); | |
| 397 | + } | |
| 398 | + if (i3GEO.editorOL.mapext != "") { | |
| 399 | + var m = i3GEO.util.extGeo2OSM(i3GEO.editorOL.mapext); | |
| 400 | + i3GEO.editorOL.mapa.zoomToExtent(m); | |
| 401 | + } | |
| 402 | + //i3GEO.editorOL.sobeLayersGraficos(); | |
| 403 | + // evita que botoes de opcoes propaguem | |
| 404 | + // o mashup utiliza esse tipo de botao junto ao nome do layer | |
| 405 | + temp = i3GEO.editorOL.pegaControle("OpenLayers.Control.LayerSwitcher"); | |
| 406 | + if (temp) { | |
| 407 | + temp = temp.dataLayersDiv.getElementsByTagName("label"); | |
| 408 | + n = temp.length; | |
| 409 | + for (i = 0; i < n; i++) { | |
| 410 | + // YAHOO.util.Event.addListener(temp[i], "click", YAHOO.util.Event.stopEvent); | |
| 411 | + temp[i].onclick = ""; | |
| 412 | + } | |
| 413 | + } | |
| 414 | + }, | |
| 415 | + criaLayerGrafico : function() { | |
| 416 | + i3GEO.desenho.openlayers.criaLayerGrafico(); | |
| 417 | + }, | |
| 418 | + layersLigados : function() { | |
| 419 | + var l, layers = i3GEO.editorOL.mapa.getLayers(), nlayers = layers.getLength(), ins = [], i; | |
| 420 | + for (i = 0; i < nlayers; i++) { | |
| 421 | + l = layers.item(i); | |
| 422 | + if (l.getVisible() === true) { | |
| 423 | + ins.push(l); | |
| 424 | + } | |
| 425 | + } | |
| 426 | + return ins; | |
| 427 | + }, | |
| 428 | + layerPorParametro : function(parametro, valor) { | |
| 429 | + var layers = i3GEO.editorOL.mapa.layers, nlayers = layers.length, ins = [], i; | |
| 430 | + for (i = 0; i < nlayers; i++) { | |
| 431 | + if (layers[i][parametro] || layers[i][parametro.toLowerCase()]) { | |
| 432 | + if (layers[i][parametro] === valor || layers[i][parametro.toLowerCase()] === valor) { | |
| 433 | + ins.push(layers[i]); | |
| 434 | + } | |
| 435 | + } else { | |
| 436 | + if (layers[i].params && layers[i].params[parametro] && layers[i].params[parametro] === valor) { | |
| 437 | + ins.push(layers[i]); | |
| 438 | + } | |
| 439 | + } | |
| 440 | + } | |
| 441 | + return ins; | |
| 442 | + }, | |
| 443 | + // layers clonados sao copias WMS de layers TMS necessarios para realizar o getfeature | |
| 444 | + // sao criados quando o layer e adicionado | |
| 445 | + layersClonados : function(paramsLayers) { | |
| 446 | + var layers = i3GEO.editorOL.mapa.layers, nlayers = layers.length, i; | |
| 447 | + for (i = 0; i < nlayers; i++) { | |
| 448 | + if (layers[i].params && layers[i].params.CLONETMS === paramsLayers) { | |
| 449 | + return (layers[i]); | |
| 450 | + } | |
| 451 | + } | |
| 452 | + return false; | |
| 453 | + }, | |
| 454 | + layertms2wms : function(tms) { | |
| 455 | + var layer, url; | |
| 456 | + url = tms.url.replace("&cache=sim", "&DESLIGACACHE=sim"); | |
| 457 | + url = url.replace("&Z=${z}&X=${x}&Y=${y}", ""); | |
| 458 | + url = url.replace("Z=${z}&X=${x}&Y=${y}", ""); | |
| 459 | + layer = new OpenLayers.Layer.WMS(tms.layername + "_clone", url, { | |
| 460 | + layers : tms.name, | |
| 461 | + transparent : true | |
| 462 | + }, { | |
| 463 | + gutter : 0, | |
| 464 | + isBaseLayer : false, | |
| 465 | + displayInLayerSwitcher : false, | |
| 466 | + opacity : 1, | |
| 467 | + visibility : true, | |
| 468 | + singleTile : true | |
| 469 | + }); | |
| 470 | + // i3GEO.editorOL.mapa.addLayer(layer); | |
| 471 | + return layer; | |
| 472 | + }, | |
| 473 | + // remove o layer clonado com layertms2wms | |
| 474 | + removeClone : function() { | |
| 475 | + var nome = i3GEO.editorOL.layerAtivo().layername + "_clone", busca = i3GEO.editorOL.mapa.getLayersByName(nome); | |
| 476 | + if (busca.length > 0) { | |
| 477 | + i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.mapa.getLayersByName(camada.name)[0], false); | |
| 478 | + } | |
| 479 | + }, | |
| 480 | + coordenadas : function() { | |
| 481 | + // | |
| 482 | + // substitui o controle que mostra as coordenadas | |
| 483 | + // | |
| 484 | + var idcoord = i3GEO.editorOL.mapa.getControlsBy("separator", " "); | |
| 485 | + if (idcoord[0]) { | |
| 486 | + i3GEO.editorOL.mapa.events.register("mousemove", i3GEO.editorOL.mapa, function(e) { | |
| 487 | + var p, lonlat, d; | |
| 488 | + if (navm) { | |
| 489 | + p = new OpenLayers.Pixel(e.x, e.y); | |
| 490 | + } else { | |
| 491 | + p = e.xy; | |
| 492 | + } | |
| 493 | + // altera o indicador de localizacao | |
| 494 | + lonlat = i3GEO.editorOL.mapa.getLonLatFromPixel(p); | |
| 495 | + lonlat = i3GEO.util.projOSM2Geo(lonlat); | |
| 496 | + d = i3GEO.calculo.dd2dms(lonlat.lon, lonlat.lat); | |
| 497 | + try { | |
| 498 | + $i(idcoord[0].id).innerHTML = "Long: " + d[0] + "<br>Lat: " + d[1]; | |
| 499 | + } catch (e) { | |
| 500 | + if (typeof (console) !== 'undefined') { | |
| 501 | + console.error(e); | |
| 502 | + } | |
| 503 | + } | |
| 504 | + }); | |
| 505 | + } | |
| 506 | + }, | |
| 507 | + criaJanelaBusca : function() { | |
| 508 | + var layers = i3GEO.editorOL.layersLigados(), nlayers = layers.length, i, ins, combo = | |
| 509 | + "<select id=i3GEOOLlistaTemasBusca ><option value=''>----</option>"; | |
| 510 | + for (i = 0; i < nlayers; i++) { | |
| 511 | + combo += "<option value='" + i + "' >" + layers[i].getProperties().name + "</option>"; | |
| 512 | + } | |
| 513 | + combo += "</select>"; | |
| 514 | + ins = "<div class=paragrafo >" + $trad("a7") + ":<br>" + combo; | |
| 515 | + ins += "<br>" + $trad("x64") + ":<br><span id=i3GEOOLcomboitens ></span>"; | |
| 516 | + ins += "<br>" + $trad("t23") + ":<br><input type=text size=20 id=i3GEOOLpalavraBusca >"; | |
| 517 | + ins += "<br><br><input type=button value='" + $trad("t23") + "' id='i3GEOOLbotaoBusca' ></div>"; | |
| 518 | + ins += "<br>'" + $trad("result") + "':<br><span id=i3GEOOLcomboresultado ></span>"; | |
| 519 | 519 | |
| 520 | - YAHOO.namespace("procura.container"); | |
| 521 | - YAHOO.procura.container.panel = new YAHOO.widget.Panel("panelprocura", { | |
| 522 | - zIndex : 2000, | |
| 523 | - iframe : false, | |
| 524 | - width : "250px", | |
| 525 | - visible : false, | |
| 526 | - draggable : true, | |
| 527 | - close : true | |
| 528 | - }); | |
| 529 | - YAHOO.procura.container.panel.setHeader("Encontre no mapa"); | |
| 530 | - YAHOO.procura.container.panel.setBody(ins); | |
| 531 | - YAHOO.procura.container.panel.setFooter(""); | |
| 532 | - YAHOO.procura.container.panel.render(document.body); | |
| 533 | - YAHOO.procura.container.panel.center(); | |
| 520 | + YAHOO.namespace("procura.container"); | |
| 521 | + YAHOO.procura.container.panel = new YAHOO.widget.Panel("panelprocura", { | |
| 522 | + zIndex : 2000, | |
| 523 | + iframe : false, | |
| 524 | + width : "250px", | |
| 525 | + visible : false, | |
| 526 | + draggable : true, | |
| 527 | + close : true | |
| 528 | + }); | |
| 529 | + YAHOO.procura.container.panel.setHeader("Encontre no mapa"); | |
| 530 | + YAHOO.procura.container.panel.setBody(ins); | |
| 531 | + YAHOO.procura.container.panel.setFooter(""); | |
| 532 | + YAHOO.procura.container.panel.render(document.body); | |
| 533 | + YAHOO.procura.container.panel.center(); | |
| 534 | 534 | |
| 535 | - document.getElementById("i3GEOOLbotaoBusca").onclick = | |
| 536 | - function() { | |
| 537 | - var layer = i3GEO.editorOL.layerAtivo(), item = document.getElementById("i3GEOOLbuscaItem").value, palavra = | |
| 538 | - document.getElementById("i3GEOOLpalavraBusca").value; | |
| 539 | - if (item === "" || palavra === "") { | |
| 540 | - alert("Escolha o item e o texto de busca"); | |
| 541 | - return; | |
| 542 | - } | |
| 543 | - i3GEO.editorOL.busca(layer, item, palavra, "i3GEOOLcomboresultado"); | |
| 544 | - }; | |
| 545 | - document.getElementById("i3GEOOLlistaTemasBusca").onchange = function() { | |
| 546 | - i3GEO.editorOL.ativaTema(this.value); | |
| 547 | - document.getElementById("i3GEOOLcomboitens").innerHTML = "..."; | |
| 548 | - i3GEO.editorOL.listaItens(i3GEO.editorOL.layerAtivo(), "i3GEOOLcomboitens", "i3GEOOLbuscaItem"); | |
| 549 | - }; | |
| 535 | + document.getElementById("i3GEOOLbotaoBusca").onclick = | |
| 536 | + function() { | |
| 537 | + var layer = i3GEO.editorOL.layerAtivo(), item = document.getElementById("i3GEOOLbuscaItem").value, palavra = | |
| 538 | + document.getElementById("i3GEOOLpalavraBusca").value; | |
| 539 | + if (item === "" || palavra === "") { | |
| 540 | + alert("Escolha o item e o texto de busca"); | |
| 541 | + return; | |
| 542 | + } | |
| 543 | + i3GEO.editorOL.busca(layer, item, palavra, "i3GEOOLcomboresultado"); | |
| 544 | + }; | |
| 545 | + document.getElementById("i3GEOOLlistaTemasBusca").onchange = function() { | |
| 546 | + i3GEO.editorOL.ativaTema(this.value); | |
| 547 | + document.getElementById("i3GEOOLcomboitens").innerHTML = "..."; | |
| 548 | + i3GEO.editorOL.listaItens(i3GEO.editorOL.layerAtivo(), "i3GEOOLcomboitens", "i3GEOOLbuscaItem"); | |
| 549 | + }; | |
| 550 | 550 | |
| 551 | - }, | |
| 552 | - criaComboTemas : function() { | |
| 553 | - var layers = i3GEO.editorOL.layersLigados(), nlayers = layers.length, i, nometema = "", combo = | |
| 554 | - "<select id=i3GEOOLlistaTemasAtivos style=width:235px; >"; | |
| 555 | - // i3GEO.desenho.layergrafico.setLayerIndex(i3GEO.editorOL.getNumLayers() + 1); | |
| 556 | - for (i = 0; i < nlayers; i++) { | |
| 557 | - // pega o nome do tema | |
| 558 | - nometema = layers[i].getProperties().title; | |
| 559 | - combo += "<option value='" + layers[i].getProperties().name + "' >" + nometema + "</option>"; | |
| 560 | - } | |
| 561 | - combo += "</select>"; | |
| 562 | - return combo; | |
| 563 | - }, | |
| 564 | - atualizaJanelaAtivaTema : function() { | |
| 565 | - var combo = i3GEO.editorOL.criaComboTemas(); | |
| 566 | - YAHOO.temaativo.container.panel.setBody(combo); | |
| 567 | - }, | |
| 568 | - criaJanelaAtivaTema : function() { | |
| 569 | - var temp; | |
| 570 | - if (!document.getElementById("paneltemaativo")) { | |
| 571 | - YAHOO.namespace("temaativo.container"); | |
| 572 | - YAHOO.temaativo.container.panel = new YAHOO.widget.Panel("paneltemaativo", { | |
| 573 | - zIndex : 20000, | |
| 574 | - iframe : true, | |
| 575 | - width : "250px", | |
| 576 | - visible : false, | |
| 577 | - draggable : true, | |
| 578 | - close : true | |
| 579 | - }); | |
| 580 | - YAHOO.temaativo.container.panel.setBody(""); | |
| 581 | - if (i3GEO && typeof i3GEO != undefined && i3GEO != "") { | |
| 582 | - YAHOO.temaativo.container.panel | |
| 583 | - .setHeader("Tema ativo<div id='paneltemaativo_minimizaCabecalho' class='container-minimiza'></div>"); | |
| 584 | - } else { | |
| 585 | - YAHOO.temaativo.container.panel.setHeader($trad("tativo")); | |
| 586 | - } | |
| 587 | - YAHOO.temaativo.container.panel.setFooter(""); | |
| 588 | - YAHOO.temaativo.container.panel.render(document.body); | |
| 589 | - YAHOO.temaativo.container.panel.show(); | |
| 590 | - YAHOO.temaativo.container.panel.center(); | |
| 591 | - i3GEO.editorOL.atualizaJanelaAtivaTema(); | |
| 592 | - YAHOO.util.Event.addListener(YAHOO.temaativo.container.panel.close, "click", function() { | |
| 593 | - i3GEO.editorOL.marcaBotao(); | |
| 594 | - if (i3GEO.eventos) { | |
| 595 | - i3GEO.eventos.adicionaEventos("ATUALIZAARVORECAMADAS", [ | |
| 596 | - "i3GEO.editorOL.atualizaJanelaAtivaTema()" | |
| 597 | - ]); | |
| 598 | - } | |
| 599 | - }); | |
| 600 | - if (i3GEO && typeof i3GEO != undefined && i3GEO != "") { | |
| 601 | - if (i3GEO.eventos) { | |
| 602 | - i3GEO.eventos.adicionaEventos("ATUALIZAARVORECAMADAS", [ | |
| 603 | - "i3GEO.editorOL.atualizaJanelaAtivaTema()" | |
| 604 | - ]); | |
| 605 | - } | |
| 606 | - } | |
| 607 | - temp = $i("paneltemaativo_minimizaCabecalho"); | |
| 608 | - if (temp) { | |
| 609 | - temp.onclick = function() { | |
| 610 | - i3GEO.janela.minimiza("paneltemaativo"); | |
| 611 | - }; | |
| 612 | - } | |
| 613 | - } else { | |
| 614 | - YAHOO.temaativo.container.panel.show(); | |
| 615 | - i3GEO.editorOL.atualizaJanelaAtivaTema(); | |
| 616 | - } | |
| 617 | - }, | |
| 618 | - ativaTema : function(id) { | |
| 619 | - document.getElementById("i3GEOOLlistaTemasAtivos").value = id; | |
| 620 | - }, | |
| 621 | - layerAtivo : function() { | |
| 622 | - if(i3GEO.editorOL.layerDefault && i3GEO.editorOL.layerDefault != ""){ | |
| 623 | - return i3GEO.editorOL.layerPorParametro("LAYERS",i3GEO.editorOL.layerDefault); | |
| 624 | - } else { | |
| 625 | - var id = document.getElementById("i3GEOOLlistaTemasAtivos"); | |
| 626 | - if (id) { | |
| 627 | - id = id.value; | |
| 628 | - } else { | |
| 629 | - id = i3GEO.temaAtivo; | |
| 630 | - } | |
| 631 | - if (id == "") { | |
| 632 | - return []; | |
| 633 | - } else { | |
| 634 | - return i3GEO.editorOL.layersLigados()[id]; | |
| 635 | - } | |
| 636 | - } | |
| 637 | - }, | |
| 638 | - listaItens : function(layer, idonde, idobj) { | |
| 639 | - if (!layer) { | |
| 640 | - return; | |
| 641 | - } | |
| 642 | - if (!layer.params) { | |
| 643 | - return; | |
| 644 | - } | |
| 645 | - var u = layer.url + "&request=describefeaturetype&service=wfs&version=1.0.0"; | |
| 646 | - u += "&typename=" + layer.params.LAYERS; | |
| 647 | - document.body.style.cursor = "wait"; | |
| 648 | - document.getElementById("i3geoMapa").style.cursor = "wait"; | |
| 649 | - OpenLayers.Request.issue({ | |
| 650 | - method : "GET", | |
| 651 | - url : u, | |
| 652 | - callback : function(retorno) { | |
| 653 | - document.body.style.cursor = "default"; | |
| 654 | - document.getElementById("i3geoMapa").style.cursor = "default"; | |
| 655 | - var fromgml = new OpenLayers.Format.WFSDescribeFeatureType({ | |
| 656 | - geometryName : "msGeometry" | |
| 657 | - }), gml = fromgml.read(retorno.responseText), prop = gml.featureTypes[0].properties, nprop = prop.length, i, combo = | |
| 658 | - "<select id=" + idobj + " ><option value=''>----</option>"; | |
| 659 | - for (i = 0; i < nprop; i++) { | |
| 660 | - combo += "<option value=" + prop[i].name + " >" + prop[i].name + "</option>"; | |
| 661 | - } | |
| 662 | - combo += "</select>"; | |
| 663 | - document.getElementById(idonde).innerHTML = combo; | |
| 664 | - }, | |
| 665 | - failure : function() { | |
| 666 | - document.body.style.cursor = "default"; | |
| 667 | - document.getElementById("i3geoMapa").style.cursor = "default"; | |
| 668 | - alert("Erro"); | |
| 669 | - } | |
| 670 | - }); | |
| 671 | - }, | |
| 672 | - busca : function(layer, item, palavra, onde) { | |
| 673 | - document.body.style.cursor = "wait"; | |
| 674 | - document.getElementById("i3geoMapa").style.cursor = "wait"; | |
| 675 | - var u = layer.url + "&request=getfeature&service=wfs&version=1.0.0"; | |
| 676 | - u = u.replace("Z=${z}&X=${x}&Y=${y}", ""); | |
| 677 | - u += "&OUTPUTFORMAT=gml2&typename=" + layer.params.LAYERS; | |
| 678 | - u += | |
| 679 | - "&filter=<Filter><PropertyIsLike wildcard=* singleChar=. escape=! ><PropertyName>" + item | |
| 680 | - + "</PropertyName><Literal>*" | |
| 681 | - + palavra | |
| 682 | - + "*</Literal></PropertyIsLike></Filter>"; | |
| 683 | - document.body.style.cursor = "wait"; | |
| 684 | - document.getElementById("i3geoMapa").style.cursor = "wait"; | |
| 685 | - document.getElementById(onde).innerHTML = "..."; | |
| 686 | - OpenLayers.Request.issue({ | |
| 687 | - method : "GET", | |
| 688 | - url : u, | |
| 689 | - callback : function(retorno) { | |
| 690 | - document.body.style.cursor = "default"; | |
| 691 | - document.getElementById("i3geoMapa").style.cursor = "default"; | |
| 692 | - var fromgml = new OpenLayers.Format.GML({ | |
| 693 | - geometryName : "msGeometry" | |
| 694 | - }), gml = fromgml.read(retorno.responseText), ngml = gml.length, i, ins = | |
| 695 | - "<select onchange='i3GEO.editorOL.zoomPara(this.value)'>"; | |
| 696 | - ins += "<option value=''>---</option>"; | |
| 697 | - for (i = 0; i < ngml; i++) { | |
| 698 | - eval("var valor = gml[i].data." + item); | |
| 699 | - var bounds = gml[i].geometry.getBounds(); | |
| 700 | - bounds = bounds.toBBOX(); | |
| 701 | - ins += "<option value='" + bounds + "'>" + valor + "</option>"; | |
| 702 | - } | |
| 703 | - ins += "</select>"; | |
| 704 | - document.getElementById(onde).innerHTML = ins; | |
| 705 | - }, | |
| 706 | - failure : function() { | |
| 707 | - document.body.style.cursor = "default"; | |
| 708 | - document.getElementById("i3geoMapa").style.cursor = "default"; | |
| 709 | - alert("Erro"); | |
| 710 | - } | |
| 711 | - }); | |
| 712 | - }, | |
| 713 | - zoomPara : function(bbox) { | |
| 714 | - var b = new OpenLayers.Bounds.fromString(bbox); | |
| 715 | - i3GEO.editorOL.mapa.zoomToExtent(b); | |
| 716 | - }, | |
| 717 | - mostraLegenda : function() { | |
| 718 | - var prop, layer, layers = i3GEO.editorOL.mapa.getLayers(), nlayers = layers.getLength(), ins = "", i, icone = "", url, f = "", fonte = ""; | |
| 719 | - for (i = 0; i < nlayers; i++) { | |
| 720 | - layer = layers.item(i); | |
| 721 | - prop = layer.getProperties(); | |
| 722 | - //monta a url para fazer a requisicao da legenda | |
| 723 | - //para os temas que nao sao baselayers | |
| 724 | - if(prop.source.getUrls){ | |
| 725 | - url = prop.source.getUrls()[0]; | |
| 726 | - url = url.replace("&cache=sim", "&DESLIGACACHE=sim"); | |
| 727 | - url = url.replace("&Z=${z}&X=${x}&Y=${y}", ""); | |
| 728 | - url = url.replace("Z=${z}&X=${x}&Y=${y}", ""); | |
| 729 | - url += "&REQUEST=getlegendgraphic&service=wms&version=1.0.0"; | |
| 730 | - if (i3GEO.Interface.openlayers.googleLike === true) { | |
| 731 | - url += "&SRS=EPSG:3857"; | |
| 732 | - } | |
| 733 | - icone = ""; | |
| 734 | - //TODO criar a legenda para uso no mashup | |
| 735 | - //caso do mashup | |
| 736 | - if (i3GEO.editorOL.legendahtml === true) { | |
| 737 | - // os parametros FORMAT e SERVICE sao inseridos de forma redundante para grantir | |
| 738 | - // caso seja um TMS | |
| 739 | - url = url.replace("image%2Fpng", "text/html") + "&FORMAT=text/html&SERVICE=WMS"; | |
| 740 | - // verifica se a camada veio de um plugin de classe_plugini3geo | |
| 741 | - // e insere o icone se for necessario | |
| 742 | - /* | |
| 551 | + }, | |
| 552 | + criaComboTemas : function() { | |
| 553 | + var layers = i3GEO.editorOL.layersLigados(), nlayers = layers.length, i, nometema = "", combo = | |
| 554 | + "<select id=i3GEOOLlistaTemasAtivos style=width:235px; >"; | |
| 555 | + // i3GEO.desenho.layergrafico.setLayerIndex(i3GEO.editorOL.getNumLayers() + 1); | |
| 556 | + for (i = 0; i < nlayers; i++) { | |
| 557 | + // pega o nome do tema | |
| 558 | + nometema = layers[i].getProperties().title; | |
| 559 | + combo += "<option value='" + layers[i].getProperties().name + "' >" + nometema + "</option>"; | |
| 560 | + } | |
| 561 | + combo += "</select>"; | |
| 562 | + return combo; | |
| 563 | + }, | |
| 564 | + atualizaJanelaAtivaTema : function() { | |
| 565 | + var combo = i3GEO.editorOL.criaComboTemas(); | |
| 566 | + YAHOO.temaativo.container.panel.setBody(combo); | |
| 567 | + }, | |
| 568 | + criaJanelaAtivaTema : function() { | |
| 569 | + var temp; | |
| 570 | + if (!document.getElementById("paneltemaativo")) { | |
| 571 | + YAHOO.namespace("temaativo.container"); | |
| 572 | + YAHOO.temaativo.container.panel = new YAHOO.widget.Panel("paneltemaativo", { | |
| 573 | + zIndex : 20000, | |
| 574 | + iframe : true, | |
| 575 | + width : "250px", | |
| 576 | + visible : false, | |
| 577 | + draggable : true, | |
| 578 | + close : true | |
| 579 | + }); | |
| 580 | + YAHOO.temaativo.container.panel.setBody(""); | |
| 581 | + if (i3GEO && typeof i3GEO != undefined && i3GEO != "") { | |
| 582 | + YAHOO.temaativo.container.panel | |
| 583 | + .setHeader("Tema ativo<div id='paneltemaativo_minimizaCabecalho' class='container-minimiza'></div>"); | |
| 584 | + } else { | |
| 585 | + YAHOO.temaativo.container.panel.setHeader($trad("tativo")); | |
| 586 | + } | |
| 587 | + YAHOO.temaativo.container.panel.setFooter(""); | |
| 588 | + YAHOO.temaativo.container.panel.render(document.body); | |
| 589 | + YAHOO.temaativo.container.panel.show(); | |
| 590 | + YAHOO.temaativo.container.panel.center(); | |
| 591 | + i3GEO.editorOL.atualizaJanelaAtivaTema(); | |
| 592 | + YAHOO.util.Event.addListener(YAHOO.temaativo.container.panel.close, "click", function() { | |
| 593 | + i3GEO.editorOL.marcaBotao(); | |
| 594 | + if (i3GEO.eventos) { | |
| 595 | + i3GEO.eventos.adicionaEventos("ATUALIZAARVORECAMADAS", [ | |
| 596 | + "i3GEO.editorOL.atualizaJanelaAtivaTema()" | |
| 597 | + ]); | |
| 598 | + } | |
| 599 | + }); | |
| 600 | + if (i3GEO && typeof i3GEO != undefined && i3GEO != "") { | |
| 601 | + if (i3GEO.eventos) { | |
| 602 | + i3GEO.eventos.adicionaEventos("ATUALIZAARVORECAMADAS", [ | |
| 603 | + "i3GEO.editorOL.atualizaJanelaAtivaTema()" | |
| 604 | + ]); | |
| 605 | + } | |
| 606 | + } | |
| 607 | + temp = $i("paneltemaativo_minimizaCabecalho"); | |
| 608 | + if (temp) { | |
| 609 | + temp.onclick = function() { | |
| 610 | + i3GEO.janela.minimiza("paneltemaativo"); | |
| 611 | + }; | |
| 612 | + } | |
| 613 | + } else { | |
| 614 | + YAHOO.temaativo.container.panel.show(); | |
| 615 | + i3GEO.editorOL.atualizaJanelaAtivaTema(); | |
| 616 | + } | |
| 617 | + }, | |
| 618 | + ativaTema : function(id) { | |
| 619 | + document.getElementById("i3GEOOLlistaTemasAtivos").value = id; | |
| 620 | + }, | |
| 621 | + layerAtivo : function() { | |
| 622 | + if(i3GEO.editorOL.layerDefault && i3GEO.editorOL.layerDefault != ""){ | |
| 623 | + return i3GEO.editorOL.layerPorParametro("LAYERS",i3GEO.editorOL.layerDefault); | |
| 624 | + } else { | |
| 625 | + var id = document.getElementById("i3GEOOLlistaTemasAtivos"); | |
| 626 | + if (id) { | |
| 627 | + id = id.value; | |
| 628 | + } else { | |
| 629 | + id = i3GEO.temaAtivo; | |
| 630 | + } | |
| 631 | + if (id == "") { | |
| 632 | + return []; | |
| 633 | + } else { | |
| 634 | + return i3GEO.editorOL.layersLigados()[id]; | |
| 635 | + } | |
| 636 | + } | |
| 637 | + }, | |
| 638 | + listaItens : function(layer, idonde, idobj) { | |
| 639 | + if (!layer) { | |
| 640 | + return; | |
| 641 | + } | |
| 642 | + if (!layer.params) { | |
| 643 | + return; | |
| 644 | + } | |
| 645 | + var u = layer.url + "&request=describefeaturetype&service=wfs&version=1.0.0"; | |
| 646 | + u += "&typename=" + layer.params.LAYERS; | |
| 647 | + document.body.style.cursor = "wait"; | |
| 648 | + document.getElementById("i3geoMapa").style.cursor = "wait"; | |
| 649 | + OpenLayers.Request.issue({ | |
| 650 | + method : "GET", | |
| 651 | + url : u, | |
| 652 | + callback : function(retorno) { | |
| 653 | + document.body.style.cursor = "default"; | |
| 654 | + document.getElementById("i3geoMapa").style.cursor = "default"; | |
| 655 | + var fromgml = new OpenLayers.Format.WFSDescribeFeatureType({ | |
| 656 | + geometryName : "msGeometry" | |
| 657 | + }), gml = fromgml.read(retorno.responseText), prop = gml.featureTypes[0].properties, nprop = prop.length, i, combo = | |
| 658 | + "<select id=" + idobj + " ><option value=''>----</option>"; | |
| 659 | + for (i = 0; i < nprop; i++) { | |
| 660 | + combo += "<option value=" + prop[i].name + " >" + prop[i].name + "</option>"; | |
| 661 | + } | |
| 662 | + combo += "</select>"; | |
| 663 | + document.getElementById(idonde).innerHTML = combo; | |
| 664 | + }, | |
| 665 | + failure : function() { | |
| 666 | + document.body.style.cursor = "default"; | |
| 667 | + document.getElementById("i3geoMapa").style.cursor = "default"; | |
| 668 | + alert("Erro"); | |
| 669 | + } | |
| 670 | + }); | |
| 671 | + }, | |
| 672 | + busca : function(layer, item, palavra, onde) { | |
| 673 | + document.body.style.cursor = "wait"; | |
| 674 | + document.getElementById("i3geoMapa").style.cursor = "wait"; | |
| 675 | + var u = layer.url + "&request=getfeature&service=wfs&version=1.0.0"; | |
| 676 | + u = u.replace("Z=${z}&X=${x}&Y=${y}", ""); | |
| 677 | + u += "&OUTPUTFORMAT=gml2&typename=" + layer.params.LAYERS; | |
| 678 | + u += | |
| 679 | + "&filter=<Filter><PropertyIsLike wildcard=* singleChar=. escape=! ><PropertyName>" + item | |
| 680 | + + "</PropertyName><Literal>*" | |
| 681 | + + palavra | |
| 682 | + + "*</Literal></PropertyIsLike></Filter>"; | |
| 683 | + document.body.style.cursor = "wait"; | |
| 684 | + document.getElementById("i3geoMapa").style.cursor = "wait"; | |
| 685 | + document.getElementById(onde).innerHTML = "..."; | |
| 686 | + OpenLayers.Request.issue({ | |
| 687 | + method : "GET", | |
| 688 | + url : u, | |
| 689 | + callback : function(retorno) { | |
| 690 | + document.body.style.cursor = "default"; | |
| 691 | + document.getElementById("i3geoMapa").style.cursor = "default"; | |
| 692 | + var fromgml = new OpenLayers.Format.GML({ | |
| 693 | + geometryName : "msGeometry" | |
| 694 | + }), gml = fromgml.read(retorno.responseText), ngml = gml.length, i, ins = | |
| 695 | + "<select onchange='i3GEO.editorOL.zoomPara(this.value)'>"; | |
| 696 | + ins += "<option value=''>---</option>"; | |
| 697 | + for (i = 0; i < ngml; i++) { | |
| 698 | + eval("var valor = gml[i].data." + item); | |
| 699 | + var bounds = gml[i].geometry.getBounds(); | |
| 700 | + bounds = bounds.toBBOX(); | |
| 701 | + ins += "<option value='" + bounds + "'>" + valor + "</option>"; | |
| 702 | + } | |
| 703 | + ins += "</select>"; | |
| 704 | + document.getElementById(onde).innerHTML = ins; | |
| 705 | + }, | |
| 706 | + failure : function() { | |
| 707 | + document.body.style.cursor = "default"; | |
| 708 | + document.getElementById("i3geoMapa").style.cursor = "default"; | |
| 709 | + alert("Erro"); | |
| 710 | + } | |
| 711 | + }); | |
| 712 | + }, | |
| 713 | + zoomPara : function(bbox) { | |
| 714 | + var b = new OpenLayers.Bounds.fromString(bbox); | |
| 715 | + i3GEO.editorOL.mapa.zoomToExtent(b); | |
| 716 | + }, | |
| 717 | + mostraLegenda : function() { | |
| 718 | + var prop, layer, layers = i3GEO.editorOL.mapa.getLayers(), nlayers = layers.getLength(), ins = "", i, icone = "", url, f = "", fonte = ""; | |
| 719 | + for (i = 0; i < nlayers; i++) { | |
| 720 | + layer = layers.item(i); | |
| 721 | + prop = layer.getProperties(); | |
| 722 | + //monta a url para fazer a requisicao da legenda | |
| 723 | + //para os temas que nao sao baselayers | |
| 724 | + if(prop.source.getUrls){ | |
| 725 | + url = prop.source.getUrls()[0]; | |
| 726 | + url = url.replace("&cache=sim", "&DESLIGACACHE=sim"); | |
| 727 | + url = url.replace("&Z=${z}&X=${x}&Y=${y}", ""); | |
| 728 | + url = url.replace("Z=${z}&X=${x}&Y=${y}", ""); | |
| 729 | + url += "&REQUEST=getlegendgraphic&service=wms&version=1.0.0"; | |
| 730 | + if (i3GEO.Interface.openlayers.googleLike === true) { | |
| 731 | + url += "&SRS=EPSG:3857"; | |
| 732 | + } | |
| 733 | + icone = ""; | |
| 734 | + //TODO criar a legenda para uso no mashup | |
| 735 | + //caso do mashup | |
| 736 | + if (i3GEO.editorOL.legendahtml === true) { | |
| 737 | + // os parametros FORMAT e SERVICE sao inseridos de forma redundante para grantir | |
| 738 | + // caso seja um TMS | |
| 739 | + url = url.replace("image%2Fpng", "text/html") + "&FORMAT=text/html&SERVICE=WMS"; | |
| 740 | + // verifica se a camada veio de um plugin de classe_plugini3geo | |
| 741 | + // e insere o icone se for necessario | |
| 742 | + /* | |
| 743 | 743 | if (layers[i].options.plugini3geo) { |
| 744 | 744 | if (layers[i].params.LAYERS) { |
| 745 | 745 | // wms |
| ... | ... | @@ -759,1225 +759,1244 @@ i3GEO.editorOL = |
| 759 | 759 | icone = i3GEO.configura.ferramentasLayers[fer].icone(layers[i]); |
| 760 | 760 | } |
| 761 | 761 | } |
| 762 | - */ | |
| 762 | + */ | |
| 763 | 763 | |
| 764 | - fonte = ""; | |
| 765 | - if(prop.link_tema != ""){ | |
| 766 | - fonte = " <a class='i3GeoLinkFonte' href='" + prop.link_tema + "' target='_blank' >link</a>"; | |
| 767 | - } | |
| 764 | + fonte = ""; | |
| 765 | + if(prop.link_tema != ""){ | |
| 766 | + fonte = " <a class='i3GeoLinkFonte' href='" + prop.link_tema + "' target='_blank' >link</a>"; | |
| 767 | + } | |
| 768 | 768 | |
| 769 | - ins += icone + prop.name + fonte + "<br><div id=legendaL_" + i + " ></div><br>"; | |
| 770 | - // necessario pq nao e sincrono | |
| 771 | - eval("var f = function(retorno){document.getElementById('legendaL_" + i | |
| 772 | - + "').innerHTML = retorno.responseText;};"); | |
| 773 | - url = url.replace("LAYERS", "LAYER"); | |
| 774 | - var config = { | |
| 775 | - method : "GET", | |
| 776 | - url : url, | |
| 777 | - callback : f | |
| 778 | - }; | |
| 779 | - //OpenLayers.Request.issue(config); | |
| 780 | - } else if (prop.isBaseLayer === false && prop.visible === true) { | |
| 781 | - //caso a legenda seja aberta dentro do i3Geo | |
| 782 | - url = url.replace("LAYERS", "LAYER"); | |
| 783 | - url += "&FORMAT=image/png"; | |
| 784 | - ins += prop.title + "<br><img src='" + url + "' /><br>"; | |
| 785 | - } | |
| 786 | - } | |
| 787 | - } | |
| 788 | - if (!document.getElementById("panellegendaeditorOL")) { | |
| 789 | - YAHOO.namespace("legendaeditorOL.container"); | |
| 790 | - YAHOO.legendaeditorOL.container.panel = new YAHOO.widget.Panel("panellegendaeditorOL", { | |
| 791 | - zIndex : 20000, | |
| 792 | - iframe : true, | |
| 793 | - width : "auto", | |
| 794 | - visible : false, | |
| 795 | - draggable : true, | |
| 796 | - close : true | |
| 797 | - }); | |
| 798 | - YAHOO.legendaeditorOL.container.panel.setBody(ins); | |
| 799 | - YAHOO.legendaeditorOL.container.panel.setHeader($trad("p3")); | |
| 800 | - YAHOO.legendaeditorOL.container.panel.setFooter(""); | |
| 801 | - YAHOO.legendaeditorOL.container.panel.render(document.body); | |
| 802 | - YAHOO.legendaeditorOL.container.panel.show(); | |
| 803 | - YAHOO.legendaeditorOL.container.panel.center(); | |
| 769 | + ins += icone + prop.name + fonte + "<br><div id=legendaL_" + i + " ></div><br>"; | |
| 770 | + // necessario pq nao e sincrono | |
| 771 | + eval("var f = function(retorno){document.getElementById('legendaL_" + i | |
| 772 | + + "').innerHTML = retorno.responseText;};"); | |
| 773 | + url = url.replace("LAYERS", "LAYER"); | |
| 774 | + var config = { | |
| 775 | + method : "GET", | |
| 776 | + url : url, | |
| 777 | + callback : f | |
| 778 | + }; | |
| 779 | + //OpenLayers.Request.issue(config); | |
| 780 | + } else if (prop.isBaseLayer === false && prop.visible === true) { | |
| 781 | + //caso a legenda seja aberta dentro do i3Geo | |
| 782 | + url = url.replace("LAYERS", "LAYER"); | |
| 783 | + url += "&FORMAT=image/png"; | |
| 784 | + ins += prop.title + "<br><img src='" + url + "' /><br>"; | |
| 785 | + } | |
| 786 | + } | |
| 787 | + } | |
| 788 | + if (!document.getElementById("panellegendaeditorOL")) { | |
| 789 | + YAHOO.namespace("legendaeditorOL.container"); | |
| 790 | + YAHOO.legendaeditorOL.container.panel = new YAHOO.widget.Panel("panellegendaeditorOL", { | |
| 791 | + zIndex : 20000, | |
| 792 | + iframe : true, | |
| 793 | + width : "auto", | |
| 794 | + visible : false, | |
| 795 | + draggable : true, | |
| 796 | + close : true | |
| 797 | + }); | |
| 798 | + YAHOO.legendaeditorOL.container.panel.setBody(ins); | |
| 799 | + YAHOO.legendaeditorOL.container.panel.setHeader($trad("p3")); | |
| 800 | + YAHOO.legendaeditorOL.container.panel.setFooter(""); | |
| 801 | + YAHOO.legendaeditorOL.container.panel.render(document.body); | |
| 802 | + YAHOO.legendaeditorOL.container.panel.show(); | |
| 803 | + YAHOO.legendaeditorOL.container.panel.center(); | |
| 804 | 804 | |
| 805 | - YAHOO.util.Event.addListener(YAHOO.legendaeditorOL.container.panel.close, "click", function() { | |
| 806 | - YAHOO.legendaeditorOL.container.panel.destroy(); | |
| 807 | - }); | |
| 808 | - } else { | |
| 809 | - YAHOO.legendaeditorOL.container.panel.setBody(ins); | |
| 810 | - YAHOO.legendaeditorOL.container.panel.show(); | |
| 811 | - } | |
| 812 | - }, | |
| 813 | - captura : function(x,y,tema,idunico) { | |
| 814 | - var d = 0.001, | |
| 815 | - layer = i3geoOL.getLayersByName(tema)[0], | |
| 816 | - xy = [x,y], | |
| 817 | - u = layer.getSource().getUrls()[0], | |
| 818 | - poligono, retorno; | |
| 805 | + YAHOO.util.Event.addListener(YAHOO.legendaeditorOL.container.panel.close, "click", function() { | |
| 806 | + YAHOO.legendaeditorOL.container.panel.destroy(); | |
| 807 | + }); | |
| 808 | + } else { | |
| 809 | + YAHOO.legendaeditorOL.container.panel.setBody(ins); | |
| 810 | + YAHOO.legendaeditorOL.container.panel.show(); | |
| 811 | + } | |
| 812 | + }, | |
| 813 | + captura : function(x,y,tema,idunico) { | |
| 814 | + var d = 0.001, | |
| 815 | + layer = i3geoOL.getLayersByName(tema)[0], | |
| 816 | + xy = [x,y], | |
| 817 | + u = layer.getSource().getUrls()[0], | |
| 818 | + poligono, retorno; | |
| 819 | 819 | |
| 820 | - u += "&REQUEST=getfeature&service=wfs&version=1.0.0"; | |
| 821 | - u += "&OUTPUTFORMAT=gml2&typename=undefined"; | |
| 820 | + u += "&REQUEST=getfeature&service=wfs&version=1.0.0"; | |
| 821 | + u += "&OUTPUTFORMAT=gml2&typename=undefined"; | |
| 822 | 822 | |
| 823 | - // remove parametros nao desejados | |
| 824 | - if (i3GEO.Interface.openlayers.googleLike === true) { | |
| 825 | - u += "&SRS=EPSG:3857"; | |
| 826 | - } | |
| 827 | - u = u.replace("&cache=sim", "&DESLIGACACHE=sim"); | |
| 828 | - u = u.replace("&Z=${z}&X=${x}&Y=${y}", ""); | |
| 829 | - u = u.replace("Z=${z}&X=${x}&Y=${y}", ""); | |
| 823 | + // remove parametros nao desejados | |
| 824 | + if (i3GEO.Interface.openlayers.googleLike === true) { | |
| 825 | + u += "&SRS=EPSG:3857"; | |
| 826 | + } | |
| 827 | + u = u.replace("&cache=sim", "&DESLIGACACHE=sim"); | |
| 828 | + u = u.replace("&Z=${z}&X=${x}&Y=${y}", ""); | |
| 829 | + u = u.replace("Z=${z}&X=${x}&Y=${y}", ""); | |
| 830 | 830 | |
| 831 | - xy[0] = xy[0] * 1; | |
| 832 | - xy[1] = xy[1] * 1; | |
| 833 | - poligono = | |
| 834 | - (xy[0] - d) + "," | |
| 835 | - + (xy[1] + d) | |
| 836 | - + " " | |
| 837 | - + (xy[0] + d) | |
| 838 | - + "," | |
| 839 | - + (xy[1] + d) | |
| 840 | - + " " | |
| 841 | - + (xy[0] + d) | |
| 842 | - + "," | |
| 843 | - + (xy[1] - d) | |
| 844 | - + " " | |
| 845 | - + (xy[0] - d) | |
| 846 | - + "," | |
| 847 | - + (xy[1] - d) | |
| 848 | - + " " | |
| 849 | - + (xy[0] - d) | |
| 850 | - + "," | |
| 851 | - + (xy[1] + d); | |
| 852 | - u += | |
| 853 | - "&filter=<Filter><Intersects><PropertyName>Geometry</PropertyName><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:posList>" + poligono | |
| 854 | - + "</gml:posList></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects></Filter>"; | |
| 855 | - retorno = function(r){ | |
| 856 | - var fs,c,format, f, n, i, idunico; | |
| 857 | - format = new ol.format.WKT(); | |
| 858 | - fs = format.readFeatures(r[0]); | |
| 859 | - n = fs.length; | |
| 860 | - c = i3GEO.desenho.layergrafico.getSource(); | |
| 861 | - for(i=0; i<n; i++){ | |
| 862 | - f = fs[i]; | |
| 863 | - f.setStyle( | |
| 864 | - new ol.style.Style({ | |
| 865 | - stroke: new ol.style.Stroke({ | |
| 866 | - color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')', | |
| 867 | - width: i3GEO.editorOL.simbologia.strokeWidth | |
| 868 | - }), | |
| 869 | - fill: new ol.style.Fill({ | |
| 870 | - color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')' | |
| 871 | - }) | |
| 872 | - }) | |
| 873 | - ); | |
| 874 | - idunico = i3GEO.util.uid(); | |
| 875 | - f.setId(idunico); | |
| 876 | - f.setProperties({ | |
| 877 | - idUnico : idunico | |
| 878 | - }); | |
| 879 | - c.addFeature(f); | |
| 880 | - } | |
| 881 | - }; | |
| 882 | - u = i3GEO.configura.locaplic + "/classesphp/proxy.php?" | |
| 883 | - + u | |
| 884 | - + "&tipoRetornoProxy=gml2wkt"; | |
| 885 | - cpJSON.call(u, "foo", retorno, ""); | |
| 886 | - }, | |
| 887 | - salvaGeometrias : function() { | |
| 888 | - if(i3GEO.editorOL.MUSTACHESALVAGEOMETRIAS == ""){ | |
| 889 | - $.get(i3GEO.configura.locaplic + "/ferramentas/editorol/templateSalvaGeometrias_mst.html", function(template) { | |
| 890 | - i3GEO.editorOL.MUSTACHESALVAGEOMETRIAS = template; | |
| 891 | - i3GEO.editorOL.salvaGeometrias(); | |
| 892 | - }); | |
| 893 | - return; | |
| 894 | - } | |
| 895 | - var n = i3GEO.editorOL.idsSelecionados.length, | |
| 896 | - ins = ""; | |
| 897 | - if (n > 0) { | |
| 898 | - if ($i("panelsalvageometrias")) { | |
| 899 | - if (YAHOO.i3GEO) { | |
| 900 | - YAHOO.salvaGeometrias.container.panel = YAHOO.i3GEO.janela.manager.find("panelsalvageometrias"); | |
| 901 | - } | |
| 902 | - YAHOO.salvaGeometrias.container.panel.show(); | |
| 903 | - YAHOO.salvaGeometrias.container.panel.bringToTop(); | |
| 904 | - } else { | |
| 905 | - try { | |
| 906 | - YAHOO.namespace("salvaGeometrias.container"); | |
| 907 | - YAHOO.salvaGeometrias.container.panel = new YAHOO.widget.Panel("panelsalvageometrias", { | |
| 908 | - zIndex : 2000, | |
| 909 | - iframe : false, | |
| 910 | - width : "350px", | |
| 911 | - visible : false, | |
| 912 | - draggable : true, | |
| 913 | - close : true | |
| 914 | - }); | |
| 915 | - YAHOO.salvaGeometrias.container.panel.setHeader("<span class='i3GeoTituloJanelaBsNolink' >" + $trad("u6") + "</span>"); | |
| 916 | - YAHOO.salvaGeometrias.container.panel.setBody(""); | |
| 917 | - YAHOO.salvaGeometrias.container.panel.setFooter(""); | |
| 918 | - YAHOO.salvaGeometrias.container.panel.render(document.body); | |
| 919 | - YAHOO.salvaGeometrias.container.panel.center(); | |
| 920 | - if (YAHOO.i3GEO && YAHOO.i3GEO.janela) { | |
| 921 | - YAHOO.i3GEO.janela.manager.register(YAHOO.salvaGeometrias.container.panel); | |
| 922 | - } | |
| 923 | - YAHOO.salvaGeometrias.container.panel.show(); | |
| 924 | - } catch (e) { | |
| 925 | - } | |
| 926 | - } | |
| 927 | - var hash = { | |
| 928 | - "n" : n, | |
| 929 | - "geosel" : $trad("geosel"), | |
| 930 | - "listar" : $trad("listar"), | |
| 931 | - "nomeFuncaoSalvarHidden" : "hidden", | |
| 932 | - "incorpoHidden": "hidden" | |
| 933 | - }; | |
| 934 | - if (i3GEO.editorOL.nomeFuncaoSalvar && i3GEO.editorOL.nomeFuncaoSalvar != "") { | |
| 935 | - hash.nomeFuncaoSalvar = i3GEO.editorOL.nomeFuncaoSalvar; | |
| 936 | - hash.sdados = $trad("sdados"); | |
| 937 | - hash.nomeFuncaoSalvarHidden = ""; | |
| 938 | - } | |
| 939 | - if (typeof i3geoOL !== "undefined") { | |
| 940 | - hash.incorpo = $trad("incorpo"); | |
| 941 | - hash.ajudaEditorOlSalva = $trad("ajudaEditorOlSalva"); | |
| 942 | - hash.incorpoHidden = ""; | |
| 943 | - } | |
| 944 | - ins = Mustache.render(i3GEO.editorOL.MUSTACHESALVAGEOMETRIAS, hash); | |
| 831 | + xy[0] = xy[0] * 1; | |
| 832 | + xy[1] = xy[1] * 1; | |
| 833 | + poligono = | |
| 834 | + (xy[0] - d) + "," | |
| 835 | + + (xy[1] + d) | |
| 836 | + + " " | |
| 837 | + + (xy[0] + d) | |
| 838 | + + "," | |
| 839 | + + (xy[1] + d) | |
| 840 | + + " " | |
| 841 | + + (xy[0] + d) | |
| 842 | + + "," | |
| 843 | + + (xy[1] - d) | |
| 844 | + + " " | |
| 845 | + + (xy[0] - d) | |
| 846 | + + "," | |
| 847 | + + (xy[1] - d) | |
| 848 | + + " " | |
| 849 | + + (xy[0] - d) | |
| 850 | + + "," | |
| 851 | + + (xy[1] + d); | |
| 852 | + u += | |
| 853 | + "&filter=<Filter><Intersects><PropertyName>Geometry</PropertyName><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:posList>" + poligono | |
| 854 | + + "</gml:posList></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects></Filter>"; | |
| 855 | + retorno = function(r){ | |
| 856 | + var fs,c,format, f, n, i, idunico; | |
| 857 | + format = new ol.format.WKT(); | |
| 858 | + fs = format.readFeatures(r[0]); | |
| 859 | + n = fs.length; | |
| 860 | + c = i3GEO.desenho.layergrafico.getSource(); | |
| 861 | + for(i=0; i<n; i++){ | |
| 862 | + f = fs[i]; | |
| 863 | + f.setStyle( | |
| 864 | + new ol.style.Style({ | |
| 865 | + stroke: new ol.style.Stroke({ | |
| 866 | + color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')', | |
| 867 | + width: i3GEO.editorOL.simbologia.strokeWidth | |
| 868 | + }), | |
| 869 | + fill: new ol.style.Fill({ | |
| 870 | + color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')' | |
| 871 | + }) | |
| 872 | + }) | |
| 873 | + ); | |
| 874 | + idunico = i3GEO.util.uid(); | |
| 875 | + f.setId(idunico); | |
| 876 | + f.setProperties({ | |
| 877 | + idUnico : idunico | |
| 878 | + }); | |
| 879 | + c.addFeature(f); | |
| 880 | + } | |
| 881 | + }; | |
| 882 | + u = i3GEO.configura.locaplic + "/classesphp/proxy.php?" | |
| 883 | + + u | |
| 884 | + + "&tipoRetornoProxy=gml2wkt"; | |
| 885 | + cpJSON.call(u, "foo", retorno, ""); | |
| 886 | + }, | |
| 887 | + salvaGeometrias : function() { | |
| 888 | + if(i3GEO.editorOL.MUSTACHESALVAGEOMETRIAS == ""){ | |
| 889 | + $.get(i3GEO.configura.locaplic + "/ferramentas/editorol/templateSalvaGeometrias_mst.html", function(template) { | |
| 890 | + i3GEO.editorOL.MUSTACHESALVAGEOMETRIAS = template; | |
| 891 | + i3GEO.editorOL.salvaGeometrias(); | |
| 892 | + }); | |
| 893 | + return; | |
| 894 | + } | |
| 895 | + var n = i3GEO.editorOL.idsSelecionados.length, | |
| 896 | + ins = ""; | |
| 897 | + if (n > 0) { | |
| 898 | + if ($i("panelsalvageometrias")) { | |
| 899 | + if (YAHOO.i3GEO) { | |
| 900 | + YAHOO.salvaGeometrias.container.panel = YAHOO.i3GEO.janela.manager.find("panelsalvageometrias"); | |
| 901 | + } | |
| 902 | + YAHOO.salvaGeometrias.container.panel.show(); | |
| 903 | + YAHOO.salvaGeometrias.container.panel.bringToTop(); | |
| 904 | + } else { | |
| 905 | + try { | |
| 906 | + YAHOO.namespace("salvaGeometrias.container"); | |
| 907 | + YAHOO.salvaGeometrias.container.panel = new YAHOO.widget.Panel("panelsalvageometrias", { | |
| 908 | + zIndex : 2000, | |
| 909 | + iframe : false, | |
| 910 | + width : "350px", | |
| 911 | + visible : false, | |
| 912 | + draggable : true, | |
| 913 | + close : true | |
| 914 | + }); | |
| 915 | + YAHOO.salvaGeometrias.container.panel.setHeader("<span class='i3GeoTituloJanelaBsNolink' >" + $trad("u6") + "</span>"); | |
| 916 | + YAHOO.salvaGeometrias.container.panel.setBody(""); | |
| 917 | + YAHOO.salvaGeometrias.container.panel.setFooter(""); | |
| 918 | + YAHOO.salvaGeometrias.container.panel.render(document.body); | |
| 919 | + YAHOO.salvaGeometrias.container.panel.center(); | |
| 920 | + if (YAHOO.i3GEO && YAHOO.i3GEO.janela) { | |
| 921 | + YAHOO.i3GEO.janela.manager.register(YAHOO.salvaGeometrias.container.panel); | |
| 922 | + } | |
| 923 | + YAHOO.salvaGeometrias.container.panel.show(); | |
| 924 | + } catch (e) { | |
| 925 | + } | |
| 926 | + } | |
| 927 | + var hash = { | |
| 928 | + "n" : n, | |
| 929 | + "geosel" : $trad("geosel"), | |
| 930 | + "listar" : $trad("listar"), | |
| 931 | + "nomeFuncaoSalvarHidden" : "hidden", | |
| 932 | + "incorpoHidden": "hidden" | |
| 933 | + }; | |
| 934 | + if (i3GEO.editorOL.nomeFuncaoSalvar && i3GEO.editorOL.nomeFuncaoSalvar != "") { | |
| 935 | + hash.nomeFuncaoSalvar = i3GEO.editorOL.nomeFuncaoSalvar; | |
| 936 | + hash.sdados = $trad("sdados"); | |
| 937 | + hash.nomeFuncaoSalvarHidden = ""; | |
| 938 | + } | |
| 939 | + if (typeof i3geoOL !== "undefined") { | |
| 940 | + hash.incorpo = $trad("incorpo"); | |
| 941 | + hash.ajudaEditorOlSalva = $trad("ajudaEditorOlSalva"); | |
| 942 | + hash.incorpoHidden = ""; | |
| 943 | + } | |
| 944 | + ins = Mustache.render(i3GEO.editorOL.MUSTACHESALVAGEOMETRIAS, hash); | |
| 945 | 945 | |
| 946 | - YAHOO.salvaGeometrias.container.panel.setBody(ins); | |
| 947 | - } else { | |
| 948 | - i3GEO.janela.tempoMsg($trad("selum")); | |
| 949 | - } | |
| 950 | - }, | |
| 951 | - exportarSHP : function() { | |
| 952 | - i3GEO.editorOL.processageo("converteSHP"); | |
| 953 | - }, | |
| 954 | - incorporar : function() { | |
| 955 | - i3GEO.editorOL.processageo("incorporar"); | |
| 956 | - }, | |
| 957 | - listaGeometriasSel : function() { | |
| 958 | - var n = i3GEO.editorOL.idsSelecionados.length, | |
| 959 | - ins = "", | |
| 960 | - s = i3GEO.desenho.layergrafico.getSource(), | |
| 961 | - i, w, g; | |
| 962 | - for (i = 0; i < n; i++) { | |
| 963 | - g = s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]); | |
| 964 | - ins += "<b>" + $trad("u6") + ": #" + i + "</b><br>" + i3GEO.editorOL.google2wgs(g.getGeometry().getCoordinates()) + "<br><br>"; | |
| 965 | - } | |
| 966 | - w = window.open(); | |
| 967 | - w.document.write(ins); | |
| 968 | - w.document.close(); | |
| 969 | - }, | |
| 970 | - testeSalvar : function() { | |
| 971 | - alert("Funcao nao disponivel. Defina o nome da funcao em i3GEO.editorOL.nomeFuncaoSalvar "); | |
| 972 | - }, | |
| 973 | - salvaGeo : function() { | |
| 974 | - var s = i3GEO.desenho.layergrafico.getSource(), | |
| 975 | - n = i3GEO.editorOL.idsSelecionados.length, | |
| 976 | - funcaoOK = function() { | |
| 977 | - // verifica se a geometria contem o atributo que indica a coluna ou codigo unico | |
| 978 | - var f = s.getFeatureById(i3GEO.editorOL.idsSelecionados[0]), | |
| 979 | - g = f.getGeometry(), | |
| 980 | - tema = $i("editorOLcomboTemaEditavel").value, | |
| 981 | - redesenha, p, format; | |
| 946 | + YAHOO.salvaGeometrias.container.panel.setBody(ins); | |
| 947 | + } else { | |
| 948 | + i3GEO.janela.tempoMsg($trad("selum")); | |
| 949 | + } | |
| 950 | + }, | |
| 951 | + exportarSHP : function() { | |
| 952 | + i3GEO.editorOL.processageo("converteSHP"); | |
| 953 | + }, | |
| 954 | + incorporar : function() { | |
| 955 | + i3GEO.editorOL.processageo("incorporar"); | |
| 956 | + }, | |
| 957 | + listaGeometriasSel : function() { | |
| 958 | + var n = i3GEO.editorOL.idsSelecionados.length, | |
| 959 | + ins = "", | |
| 960 | + s = i3GEO.desenho.layergrafico.getSource(), | |
| 961 | + i, w, g; | |
| 962 | + for (i = 0; i < n; i++) { | |
| 963 | + g = s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]); | |
| 964 | + ins += "<b>" + $trad("u6") + ": #" + i + "</b><br>" + i3GEO.editorOL.google2wgs(g.getGeometry().getCoordinates()) + "<br><br>"; | |
| 965 | + } | |
| 966 | + w = window.open(); | |
| 967 | + w.document.write(ins); | |
| 968 | + w.document.close(); | |
| 969 | + }, | |
| 970 | + testeSalvar : function() { | |
| 971 | + alert("Funcao nao disponivel. Defina o nome da funcao em i3GEO.editorOL.nomeFuncaoSalvar "); | |
| 972 | + }, | |
| 973 | + salvaGeo : function() { | |
| 974 | + if(i3GEO.parametros.editor == "nao"){ | |
| 975 | + i3GEO.janela.tempoMsg($trad("meneditor3")); | |
| 976 | + return; | |
| 977 | + } | |
| 978 | + var s = i3GEO.desenho.layergrafico.getSource(), | |
| 979 | + n = i3GEO.editorOL.idsSelecionados.length, | |
| 980 | + funcaoOK = function() { | |
| 981 | + // verifica se a geometria contem o atributo que indica a coluna ou codigo unico | |
| 982 | + var f = s.getFeatureById(i3GEO.editorOL.idsSelecionados[0]), | |
| 983 | + g = f.getGeometry(), | |
| 984 | + tema = $i("editorOLcomboTemaEditavel").value, | |
| 985 | + redesenha, p, format; | |
| 982 | 986 | |
| 983 | - g = i3GEO.editorOL.google2wgs(g); | |
| 984 | - format = new ol.format.WKT(); | |
| 985 | - f.setGeometry(g); | |
| 987 | + g = i3GEO.editorOL.google2wgs(g); | |
| 988 | + format = new ol.format.WKT(); | |
| 989 | + f.setGeometry(g); | |
| 986 | 990 | |
| 987 | - if (tema == "") { | |
| 988 | - return; | |
| 989 | - } | |
| 990 | - redesenha = function(retorno) { | |
| 991 | - i3GEO.janela.fechaAguarde("aguardeSalvaPonto"); | |
| 992 | - i3GEO.editorOL.removeFeaturesSel(); | |
| 993 | - i3GEO.Interface.atualizaTema("", tema); | |
| 994 | - }; | |
| 995 | - i3GEO.janela.AGUARDEMODAL = true; | |
| 996 | - i3GEO.janela.abreAguarde("aguardeSalvaPonto", $trad("adic") + "..."); | |
| 997 | - i3GEO.janela.AGUARDEMODAL = false; | |
| 991 | + if (tema == "") { | |
| 992 | + return; | |
| 993 | + } | |
| 994 | + redesenha = function(retorno) { | |
| 995 | + i3GEO.janela.fechaAguarde("aguardeSalvaPonto"); | |
| 996 | + i3GEO.editorOL.removeFeaturesSel(); | |
| 997 | + i3GEO.Interface.atualizaTema("", tema); | |
| 998 | + }; | |
| 999 | + i3GEO.janela.AGUARDEMODAL = true; | |
| 1000 | + i3GEO.janela.abreAguarde("aguardeSalvaPonto", $trad("adic") + "..."); | |
| 1001 | + i3GEO.janela.AGUARDEMODAL = false; | |
| 998 | 1002 | |
| 999 | - // cria um novo registro | |
| 1000 | - if(!f.getProperties().idUnico || f.getProperties().idUnico == ""){ | |
| 1001 | - p = i3GEO.configura.locaplic | |
| 1002 | - + "/ferramentas/editortema/exec.php?funcao=adicionaGeometria&g_sid=" | |
| 1003 | - + i3GEO.configura.sid; | |
| 1004 | - cpJSON.call(p, "foo", redesenha, "&tema=" + tema + "&wkt=" + format.writeFeatures([f])); | |
| 1005 | - } else { | |
| 1006 | - // atualiza a geometria | |
| 1007 | - p = i3GEO.configura.locaplic | |
| 1008 | - + "/ferramentas/editortema/exec.php?funcao=atualizaGeometria&g_sid=" | |
| 1009 | - + i3GEO.configura.sid; | |
| 1010 | - cpJSON.call( | |
| 1011 | - p, | |
| 1012 | - "foo", | |
| 1013 | - redesenha, | |
| 1014 | - "&idunico=" + f.getProperties().idUnico + "&tema=" + tema + "&wkt=" + format.writeFeatures([f]) | |
| 1015 | - ); | |
| 1016 | - } | |
| 1017 | - }, | |
| 1018 | - funcaoCombo = function(obj) { | |
| 1019 | - $i("editorOLondeComboTemaEditavel").innerHTML = obj.dados; | |
| 1020 | - }, | |
| 1021 | - texto = $trad("stema") + ":<br><div id=editorOLondeComboTemaEditavel ></div><p class=paragrafo >"+$trad("salvaDadosEditor")+"</p><br><br>"; | |
| 1022 | - //monta a janela para o usuario escolher em qual camada os dados serao salvos | |
| 1023 | - if (n != 1) { | |
| 1024 | - i3GEO.janela.tempoMsg($trad("seluma")); | |
| 1025 | - } else { | |
| 1026 | - i3GEO.janela.confirma(texto, 300, $trad("salva"), $trad("canc"), funcaoOK); | |
| 1027 | - i3GEO.util.comboTemas("editorOLcomboTemaEditavel", funcaoCombo, "editorOLondeComboTemaEditavel", "", false, "editavel"); | |
| 1028 | - } | |
| 1029 | - }, | |
| 1030 | - //muda a classe do botao para marca-lo como ativo | |
| 1031 | - marcaBotao : function(classeBotao){ | |
| 1032 | - //desmarca todos os botoes | |
| 1033 | - var i, n, botoes = $i("i3GEObarraEdicao").getElementsByTagName("div"); | |
| 1034 | - n = botoes.length; | |
| 1035 | - for(i = 0; i < n; i++){ | |
| 1036 | - botoes[i].className = botoes[i].className.replace("ItemActive","ItemInactive"); | |
| 1037 | - if(classeBotao){ | |
| 1038 | - botoes[i].className = botoes[i].className.replace(classeBotao+"ItemInactive",classeBotao+"ItemActive"); | |
| 1039 | - } | |
| 1040 | - } | |
| 1041 | - i3GEO.editorOL.removeInteracoes(); | |
| 1042 | - }, | |
| 1043 | - //interacoes criadas ao ativar algum botao | |
| 1044 | - //usado para remover as interacoes | |
| 1045 | - interacoes : [], | |
| 1046 | - removeInteracoes: function(){ | |
| 1047 | - var i, n; | |
| 1048 | - n = i3GEO.editorOL.interacoes.length; | |
| 1049 | - for(i = 0; i < n; i++){ | |
| 1050 | - i3geoOL.removeInteraction(i3GEO.editorOL.interacoes[i]); | |
| 1051 | - } | |
| 1052 | - i3GEO.editorOL.interacoes = []; | |
| 1053 | - }, | |
| 1054 | - botaoProcura : function(){ | |
| 1055 | - var temp = document.createElement("div"); | |
| 1056 | - temp.className = "editorOLprocuraItemInactive olButton"; | |
| 1057 | - temp.title = $trad("t23"); | |
| 1058 | - temp.onclick = function(){ | |
| 1059 | - i3GEO.editorOL.criaJanelaBusca(); | |
| 1060 | - YAHOO.procura.container.panel.show(); | |
| 1061 | - }; | |
| 1062 | - return temp; | |
| 1063 | - }, | |
| 1064 | - botaoPan : function(){ | |
| 1065 | - var temp = document.createElement("div"); | |
| 1066 | - temp.className = "editorOLpanItemInactive olButton"; | |
| 1067 | - temp.title = "pan"; | |
| 1068 | - temp.onclick = function(){ | |
| 1069 | - i3GEO.editorOL.marcaBotao("editorOLpan"); | |
| 1070 | - }; | |
| 1071 | - return temp; | |
| 1072 | - }, | |
| 1073 | - botaoZoomBox : function(){ | |
| 1074 | - var temp = document.createElement("div"); | |
| 1075 | - temp.className = "editorOLzoomboxItemInactive olButton"; | |
| 1076 | - temp.title = "zoombox"; | |
| 1077 | - temp.onclick = function(){ | |
| 1078 | - i3GEO.navega.zoomli(); | |
| 1079 | - }; | |
| 1080 | - return temp; | |
| 1081 | - }, | |
| 1082 | - botaoZoomTot : function(){ | |
| 1083 | - var temp = document.createElement("div"); | |
| 1084 | - temp.className = "editorOLzoomtotItemInactive olButton"; | |
| 1085 | - temp.title = $trad("d2t"); | |
| 1086 | - temp.onclick = function(){ | |
| 1087 | - if (i3GEO.editorOL.mapext && i3GEO.editorOL.mapext != "") { | |
| 1088 | - i3GEO.Interface.openlayers.zoom2ext(i3GEO.editorOL.mapext.join(" ")); | |
| 1089 | - } else { | |
| 1090 | - i3GEO.Interface.openlayers.zoom2ext(i3GEO.parametros.extentTotal); | |
| 1091 | - } | |
| 1092 | - }; | |
| 1093 | - return temp; | |
| 1094 | - }, | |
| 1095 | - botaoZoomIn : function(){ | |
| 1096 | - var temp = document.createElement("div"); | |
| 1097 | - temp.className = "editorOLzoominItemInactive olButton"; | |
| 1098 | - temp.title = $trad("d5t"); | |
| 1099 | - temp.onclick = function(){ | |
| 1100 | - var v = i3GEO.editorOL.mapa.getView(); | |
| 1101 | - v.setZoom(v.getZoom() + 1); | |
| 1102 | - }; | |
| 1103 | - return temp; | |
| 1104 | - }, | |
| 1105 | - botaoZoomOut : function(){ | |
| 1106 | - var temp = document.createElement("div"); | |
| 1107 | - temp.className = "editorOLzoomoutItemInactive olButton"; | |
| 1108 | - temp.title = $trad("d5t"); | |
| 1109 | - temp.onclick = function(){ | |
| 1110 | - var v = i3GEO.editorOL.mapa.getView(); | |
| 1111 | - v.setZoom(v.getZoom() - 1); | |
| 1112 | - }; | |
| 1113 | - return temp; | |
| 1114 | - }, | |
| 1115 | - botaoLegenda : function(){ | |
| 1116 | - var temp = document.createElement("div"); | |
| 1117 | - temp.className = "editorOLlegendaItemInactive olButton"; | |
| 1118 | - temp.title = $trad("p3"); | |
| 1119 | - temp.onclick = function(){ | |
| 1120 | - i3GEO.editorOL.mostraLegenda(); | |
| 1121 | - }; | |
| 1122 | - return temp; | |
| 1123 | - }, | |
| 1124 | - botaoDistancia : function(){ | |
| 1125 | - var temp = document.createElement("div"); | |
| 1126 | - temp.className = "editorOLdistanciaItemInactive olButton"; | |
| 1127 | - temp.onclick = function(){ | |
| 1128 | - i3GEO.editorOL.marcaBotao("editorOLdistancia"); | |
| 1129 | - i3GEO.analise.medeDistancia.inicia(); | |
| 1130 | - }; | |
| 1131 | - return temp; | |
| 1132 | - }, | |
| 1133 | - botaoArea: function(){ | |
| 1134 | - var temp = document.createElement("div"); | |
| 1135 | - temp.className = "editorOLareaItemInactive olButton"; | |
| 1136 | - temp.onclick = function(){ | |
| 1137 | - i3GEO.editorOL.marcaBotao("editorOLarea"); | |
| 1138 | - i3GEO.analise.medeArea.inicia(); | |
| 1139 | - }; | |
| 1140 | - return temp; | |
| 1141 | - }, | |
| 1142 | - botaoLinha: function(){ | |
| 1143 | - var temp = document.createElement("div"); | |
| 1144 | - temp.className = "editorOLlinhaItemInactive olButton"; | |
| 1145 | - temp.title = $trad("dlinha"); | |
| 1146 | - temp.onclick = function(){ | |
| 1147 | - i3GEO.eventos.cliquePerm.desativa(); | |
| 1148 | - i3GEO.editorOL.marcaBotao("editorOLlinha"); | |
| 1149 | - var draw = new ol.interaction.Draw({ | |
| 1150 | - type : "LineString" | |
| 1151 | - }); | |
| 1152 | - //adiciona a interacao para poder ser removida | |
| 1153 | - i3GEO.editorOL.interacoes.push(draw); | |
| 1154 | - //desativa ol.interaction.DoubleClickZoom | |
| 1155 | - i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 1156 | - draw.on("drawend", function(evt) { | |
| 1157 | - evt.feature.setStyle( | |
| 1158 | - new ol.style.Style({ | |
| 1159 | - stroke: new ol.style.Stroke({ | |
| 1160 | - color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')', | |
| 1161 | - width: i3GEO.editorOL.simbologia.strokeWidth | |
| 1162 | - }), | |
| 1163 | - fill: new ol.style.Fill({ | |
| 1164 | - color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')' | |
| 1165 | - }) | |
| 1166 | - }) | |
| 1167 | - ); | |
| 1168 | - evt.feature.setId(i3GEO.util.uid()); | |
| 1169 | - i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature); | |
| 1170 | - draw.setActive(false); | |
| 1171 | - draw.setActive(true); | |
| 1172 | - if (document.getElementById("panellistagEditor")) { | |
| 1173 | - i3GEO.editorOL.listaGeometrias(); | |
| 1174 | - } | |
| 1175 | - }); | |
| 1176 | - i3geoOL.addInteraction(draw); | |
| 1177 | - }; | |
| 1178 | - return temp; | |
| 1179 | - }, | |
| 1180 | - botaoPonto: function(){ | |
| 1181 | - i3GEO.eventos.cliquePerm.desativa(); | |
| 1182 | - var temp = document.createElement("div"); | |
| 1183 | - temp.className = "editorOLpontoItemInactive olButton"; | |
| 1184 | - temp.title = $trad("dponto"); | |
| 1185 | - temp.onclick = function(){ | |
| 1186 | - i3GEO.eventos.cliquePerm.desativa(); | |
| 1187 | - i3GEO.editorOL.marcaBotao("editorOLponto"); | |
| 1188 | - var draw = new ol.interaction.Draw({ | |
| 1189 | - type : "Point" | |
| 1190 | - }); | |
| 1191 | - //adiciona a interacao para poder ser removida | |
| 1192 | - i3GEO.editorOL.interacoes.push(draw); | |
| 1193 | - i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 1194 | - draw.on("drawend", function(evt) { | |
| 1195 | - var simbolo, url; | |
| 1196 | - url = i3GEO.editorOL.simbologia.externalGraphic; | |
| 1197 | - if(url === ""){ | |
| 1198 | - simbolo = new ol.style.Circle({ | |
| 1199 | - radius: i3GEO.editorOL.simbologia.pointRadius, | |
| 1200 | - fill: new ol.style.Fill({ | |
| 1201 | - color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')' | |
| 1202 | - }), | |
| 1203 | - stroke: new ol.style.Stroke({ | |
| 1204 | - color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')', | |
| 1205 | - width: i3GEO.editorOL.simbologia.pointRadius / 3 | |
| 1206 | - }) | |
| 1207 | - }); | |
| 1208 | - } | |
| 1209 | - else{ | |
| 1210 | - simbolo = new ol.style.Icon({ | |
| 1211 | - src : url, | |
| 1212 | - size : [i3GEO.editorOL.simbologia.graphicWidth,i3GEO.editorOL.simbologia.graphicHeight] | |
| 1213 | - }); | |
| 1214 | - } | |
| 1215 | - evt.feature.setStyle( | |
| 1216 | - new ol.style.Style({ | |
| 1217 | - image: simbolo | |
| 1218 | - }) | |
| 1219 | - ); | |
| 1220 | - evt.feature.setId(i3GEO.util.uid()); | |
| 1221 | - i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature); | |
| 1222 | - draw.setActive(false); | |
| 1223 | - draw.setActive(true); | |
| 1224 | - if (document.getElementById("panellistagEditor")) { | |
| 1225 | - i3GEO.editorOL.listaGeometrias(); | |
| 1226 | - } | |
| 1227 | - }); | |
| 1228 | - i3geoOL.addInteraction(draw); | |
| 1229 | - }; | |
| 1230 | - return temp; | |
| 1231 | - }, | |
| 1232 | - botaoPoligono: function(){ | |
| 1233 | - i3GEO.eventos.cliquePerm.desativa(); | |
| 1234 | - var temp = document.createElement("div"); | |
| 1235 | - temp.className = "editorOLpoligonoItemInactive olButton"; | |
| 1236 | - temp.title = $trad("dpol"); | |
| 1237 | - temp.onclick = function(){ | |
| 1238 | - i3GEO.editorOL.marcaBotao("editorOLpoligono"); | |
| 1239 | - var draw = new ol.interaction.Draw({ | |
| 1240 | - type : "Polygon" | |
| 1241 | - }); | |
| 1242 | - /* | |
| 1003 | + // cria um novo registro | |
| 1004 | + if(!f.getProperties().idUnico || f.getProperties().idUnico == ""){ | |
| 1005 | + p = i3GEO.configura.locaplic | |
| 1006 | + + "/ferramentas/editortema/exec.php?funcao=adicionaGeometria&g_sid=" | |
| 1007 | + + i3GEO.configura.sid; | |
| 1008 | + cpJSON.call(p, "foo", redesenha, "&tema=" + tema + "&wkt=" + format.writeFeatures([f])); | |
| 1009 | + } else { | |
| 1010 | + // atualiza a geometria | |
| 1011 | + p = i3GEO.configura.locaplic | |
| 1012 | + + "/ferramentas/editortema/exec.php?funcao=atualizaGeometria&g_sid=" | |
| 1013 | + + i3GEO.configura.sid; | |
| 1014 | + cpJSON.call( | |
| 1015 | + p, | |
| 1016 | + "foo", | |
| 1017 | + redesenha, | |
| 1018 | + "&idunico=" + f.getProperties().idUnico + "&tema=" + tema + "&wkt=" + format.writeFeatures([f]) | |
| 1019 | + ); | |
| 1020 | + } | |
| 1021 | + }, | |
| 1022 | + funcaoCombo = function(obj) { | |
| 1023 | + $i("editorOLondeComboTemaEditavel").innerHTML = obj.dados; | |
| 1024 | + }, | |
| 1025 | + texto = $trad("stema") | |
| 1026 | + + "<div style='width: 100%;' class='form-group label-fixed condensed'><label class='control-label' for=''>" | |
| 1027 | + + $trad("salvaDadosEditor") | |
| 1028 | + + "</label><div style='width: 100%;' class='input-group'><div id='editorOLondeComboTemaEditavel'></div></div></div>"; | |
| 1029 | + | |
| 1030 | + //monta a janela para o usuario escolher em qual camada os dados serao salvos | |
| 1031 | + if (n != 1) { | |
| 1032 | + i3GEO.janela.tempoMsg($trad("seluma")); | |
| 1033 | + } else { | |
| 1034 | + i3GEO.janela.confirma(texto, 300, $trad("salva"), "", funcaoOK); | |
| 1035 | + i3GEO.util.comboTemas( | |
| 1036 | + "editorOLcomboTemaEditavel", | |
| 1037 | + funcaoCombo, | |
| 1038 | + "editorOLondeComboTemaEditavel", | |
| 1039 | + "", | |
| 1040 | + false, | |
| 1041 | + "editavel", | |
| 1042 | + " ", | |
| 1043 | + false, | |
| 1044 | + true, | |
| 1045 | + "form-control comboTema" | |
| 1046 | + ); | |
| 1047 | + } | |
| 1048 | + }, | |
| 1049 | + //muda a classe do botao para marca-lo como ativo | |
| 1050 | + marcaBotao : function(classeBotao){ | |
| 1051 | + //desmarca todos os botoes | |
| 1052 | + var i, n, botoes = $i("i3GEObarraEdicao").getElementsByTagName("div"); | |
| 1053 | + n = botoes.length; | |
| 1054 | + for(i = 0; i < n; i++){ | |
| 1055 | + botoes[i].className = botoes[i].className.replace("ItemActive","ItemInactive"); | |
| 1056 | + if(classeBotao){ | |
| 1057 | + botoes[i].className = botoes[i].className.replace(classeBotao+"ItemInactive",classeBotao+"ItemActive"); | |
| 1058 | + } | |
| 1059 | + } | |
| 1060 | + i3GEO.editorOL.removeInteracoes(); | |
| 1061 | + }, | |
| 1062 | + //interacoes criadas ao ativar algum botao | |
| 1063 | + //usado para remover as interacoes | |
| 1064 | + interacoes : [], | |
| 1065 | + removeInteracoes: function(){ | |
| 1066 | + var i, n; | |
| 1067 | + n = i3GEO.editorOL.interacoes.length; | |
| 1068 | + for(i = 0; i < n; i++){ | |
| 1069 | + i3geoOL.removeInteraction(i3GEO.editorOL.interacoes[i]); | |
| 1070 | + } | |
| 1071 | + i3GEO.editorOL.interacoes = []; | |
| 1072 | + }, | |
| 1073 | + botaoProcura : function(){ | |
| 1074 | + var temp = document.createElement("div"); | |
| 1075 | + temp.className = "editorOLprocuraItemInactive olButton"; | |
| 1076 | + temp.title = $trad("t23"); | |
| 1077 | + temp.onclick = function(){ | |
| 1078 | + i3GEO.editorOL.criaJanelaBusca(); | |
| 1079 | + YAHOO.procura.container.panel.show(); | |
| 1080 | + }; | |
| 1081 | + return temp; | |
| 1082 | + }, | |
| 1083 | + botaoPan : function(){ | |
| 1084 | + var temp = document.createElement("div"); | |
| 1085 | + temp.className = "editorOLpanItemInactive olButton"; | |
| 1086 | + temp.title = "pan"; | |
| 1087 | + temp.onclick = function(){ | |
| 1088 | + i3GEO.editorOL.marcaBotao("editorOLpan"); | |
| 1089 | + }; | |
| 1090 | + return temp; | |
| 1091 | + }, | |
| 1092 | + botaoZoomBox : function(){ | |
| 1093 | + var temp = document.createElement("div"); | |
| 1094 | + temp.className = "editorOLzoomboxItemInactive olButton"; | |
| 1095 | + temp.title = "zoombox"; | |
| 1096 | + temp.onclick = function(){ | |
| 1097 | + i3GEO.navega.zoomli(); | |
| 1098 | + }; | |
| 1099 | + return temp; | |
| 1100 | + }, | |
| 1101 | + botaoZoomTot : function(){ | |
| 1102 | + var temp = document.createElement("div"); | |
| 1103 | + temp.className = "editorOLzoomtotItemInactive olButton"; | |
| 1104 | + temp.title = $trad("d2t"); | |
| 1105 | + temp.onclick = function(){ | |
| 1106 | + if (i3GEO.editorOL.mapext && i3GEO.editorOL.mapext != "") { | |
| 1107 | + i3GEO.Interface.openlayers.zoom2ext(i3GEO.editorOL.mapext.join(" ")); | |
| 1108 | + } else { | |
| 1109 | + i3GEO.Interface.openlayers.zoom2ext(i3GEO.parametros.extentTotal); | |
| 1110 | + } | |
| 1111 | + }; | |
| 1112 | + return temp; | |
| 1113 | + }, | |
| 1114 | + botaoZoomIn : function(){ | |
| 1115 | + var temp = document.createElement("div"); | |
| 1116 | + temp.className = "editorOLzoominItemInactive olButton"; | |
| 1117 | + temp.title = $trad("d5t"); | |
| 1118 | + temp.onclick = function(){ | |
| 1119 | + var v = i3GEO.editorOL.mapa.getView(); | |
| 1120 | + v.setZoom(v.getZoom() + 1); | |
| 1121 | + }; | |
| 1122 | + return temp; | |
| 1123 | + }, | |
| 1124 | + botaoZoomOut : function(){ | |
| 1125 | + var temp = document.createElement("div"); | |
| 1126 | + temp.className = "editorOLzoomoutItemInactive olButton"; | |
| 1127 | + temp.title = $trad("d5t"); | |
| 1128 | + temp.onclick = function(){ | |
| 1129 | + var v = i3GEO.editorOL.mapa.getView(); | |
| 1130 | + v.setZoom(v.getZoom() - 1); | |
| 1131 | + }; | |
| 1132 | + return temp; | |
| 1133 | + }, | |
| 1134 | + botaoLegenda : function(){ | |
| 1135 | + var temp = document.createElement("div"); | |
| 1136 | + temp.className = "editorOLlegendaItemInactive olButton"; | |
| 1137 | + temp.title = $trad("p3"); | |
| 1138 | + temp.onclick = function(){ | |
| 1139 | + i3GEO.editorOL.mostraLegenda(); | |
| 1140 | + }; | |
| 1141 | + return temp; | |
| 1142 | + }, | |
| 1143 | + botaoDistancia : function(){ | |
| 1144 | + var temp = document.createElement("div"); | |
| 1145 | + temp.className = "editorOLdistanciaItemInactive olButton"; | |
| 1146 | + temp.onclick = function(){ | |
| 1147 | + i3GEO.editorOL.marcaBotao("editorOLdistancia"); | |
| 1148 | + i3GEO.analise.medeDistancia.inicia(); | |
| 1149 | + }; | |
| 1150 | + return temp; | |
| 1151 | + }, | |
| 1152 | + botaoArea: function(){ | |
| 1153 | + var temp = document.createElement("div"); | |
| 1154 | + temp.className = "editorOLareaItemInactive olButton"; | |
| 1155 | + temp.onclick = function(){ | |
| 1156 | + i3GEO.editorOL.marcaBotao("editorOLarea"); | |
| 1157 | + i3GEO.analise.medeArea.inicia(); | |
| 1158 | + }; | |
| 1159 | + return temp; | |
| 1160 | + }, | |
| 1161 | + botaoLinha: function(){ | |
| 1162 | + var temp = document.createElement("div"); | |
| 1163 | + temp.className = "editorOLlinhaItemInactive olButton"; | |
| 1164 | + temp.title = $trad("dlinha"); | |
| 1165 | + temp.onclick = function(){ | |
| 1166 | + i3GEO.eventos.cliquePerm.desativa(); | |
| 1167 | + i3GEO.editorOL.marcaBotao("editorOLlinha"); | |
| 1168 | + var draw = new ol.interaction.Draw({ | |
| 1169 | + type : "LineString" | |
| 1170 | + }); | |
| 1171 | + //adiciona a interacao para poder ser removida | |
| 1172 | + i3GEO.editorOL.interacoes.push(draw); | |
| 1173 | + //desativa ol.interaction.DoubleClickZoom | |
| 1174 | + i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 1175 | + draw.on("drawend", function(evt) { | |
| 1176 | + evt.feature.setStyle( | |
| 1177 | + new ol.style.Style({ | |
| 1178 | + stroke: new ol.style.Stroke({ | |
| 1179 | + color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')', | |
| 1180 | + width: i3GEO.editorOL.simbologia.strokeWidth | |
| 1181 | + }), | |
| 1182 | + fill: new ol.style.Fill({ | |
| 1183 | + color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')' | |
| 1184 | + }) | |
| 1185 | + }) | |
| 1186 | + ); | |
| 1187 | + evt.feature.setId(i3GEO.util.uid()); | |
| 1188 | + i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature); | |
| 1189 | + draw.setActive(false); | |
| 1190 | + draw.setActive(true); | |
| 1191 | + if (document.getElementById("panellistagEditor")) { | |
| 1192 | + i3GEO.editorOL.listaGeometrias(); | |
| 1193 | + } | |
| 1194 | + }); | |
| 1195 | + i3geoOL.addInteraction(draw); | |
| 1196 | + }; | |
| 1197 | + return temp; | |
| 1198 | + }, | |
| 1199 | + botaoPonto: function(){ | |
| 1200 | + i3GEO.eventos.cliquePerm.desativa(); | |
| 1201 | + var temp = document.createElement("div"); | |
| 1202 | + temp.className = "editorOLpontoItemInactive olButton"; | |
| 1203 | + temp.title = $trad("dponto"); | |
| 1204 | + temp.onclick = function(){ | |
| 1205 | + i3GEO.eventos.cliquePerm.desativa(); | |
| 1206 | + i3GEO.editorOL.marcaBotao("editorOLponto"); | |
| 1207 | + var draw = new ol.interaction.Draw({ | |
| 1208 | + type : "Point" | |
| 1209 | + }); | |
| 1210 | + //adiciona a interacao para poder ser removida | |
| 1211 | + i3GEO.editorOL.interacoes.push(draw); | |
| 1212 | + i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 1213 | + draw.on("drawend", function(evt) { | |
| 1214 | + var simbolo, url; | |
| 1215 | + url = i3GEO.editorOL.simbologia.externalGraphic; | |
| 1216 | + if(url === ""){ | |
| 1217 | + simbolo = new ol.style.Circle({ | |
| 1218 | + radius: i3GEO.editorOL.simbologia.pointRadius, | |
| 1219 | + fill: new ol.style.Fill({ | |
| 1220 | + color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')' | |
| 1221 | + }), | |
| 1222 | + stroke: new ol.style.Stroke({ | |
| 1223 | + color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')', | |
| 1224 | + width: i3GEO.editorOL.simbologia.pointRadius / 3 | |
| 1225 | + }) | |
| 1226 | + }); | |
| 1227 | + } | |
| 1228 | + else{ | |
| 1229 | + simbolo = new ol.style.Icon({ | |
| 1230 | + src : url, | |
| 1231 | + size : [i3GEO.editorOL.simbologia.graphicWidth,i3GEO.editorOL.simbologia.graphicHeight] | |
| 1232 | + }); | |
| 1233 | + } | |
| 1234 | + evt.feature.setStyle( | |
| 1235 | + new ol.style.Style({ | |
| 1236 | + image: simbolo | |
| 1237 | + }) | |
| 1238 | + ); | |
| 1239 | + evt.feature.setId(i3GEO.util.uid()); | |
| 1240 | + i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature); | |
| 1241 | + draw.setActive(false); | |
| 1242 | + draw.setActive(true); | |
| 1243 | + if (document.getElementById("panellistagEditor")) { | |
| 1244 | + i3GEO.editorOL.listaGeometrias(); | |
| 1245 | + } | |
| 1246 | + }); | |
| 1247 | + i3geoOL.addInteraction(draw); | |
| 1248 | + }; | |
| 1249 | + return temp; | |
| 1250 | + }, | |
| 1251 | + botaoPoligono: function(){ | |
| 1252 | + i3GEO.eventos.cliquePerm.desativa(); | |
| 1253 | + var temp = document.createElement("div"); | |
| 1254 | + temp.className = "editorOLpoligonoItemInactive olButton"; | |
| 1255 | + temp.title = $trad("dpol"); | |
| 1256 | + temp.onclick = function(){ | |
| 1257 | + i3GEO.editorOL.marcaBotao("editorOLpoligono"); | |
| 1258 | + var draw = new ol.interaction.Draw({ | |
| 1259 | + type : "Polygon" | |
| 1260 | + }); | |
| 1261 | + /* | |
| 1243 | 1262 | snap = new ol.interaction.Snap({ |
| 1244 | 1263 | source: i3GEO.desenho.layergrafico.getSource() |
| 1245 | 1264 | }); |
| 1246 | 1265 | i3GEO.editorOL.interacoes.push(snap); |
| 1247 | - */ | |
| 1248 | - //adiciona a interacao para poder ser removida | |
| 1249 | - i3GEO.editorOL.interacoes.push(draw); | |
| 1250 | - i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 1251 | - draw.on("drawend", function(evt) { | |
| 1252 | - evt.feature.setStyle( | |
| 1253 | - new ol.style.Style({ | |
| 1254 | - stroke: new ol.style.Stroke({ | |
| 1255 | - color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')', | |
| 1256 | - width: i3GEO.editorOL.simbologia.strokeWidth | |
| 1257 | - }), | |
| 1258 | - fill: new ol.style.Fill({ | |
| 1259 | - color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')' | |
| 1260 | - }) | |
| 1261 | - }) | |
| 1262 | - ); | |
| 1263 | - evt.feature.setId(i3GEO.util.uid()); | |
| 1264 | - i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature); | |
| 1265 | - draw.setActive(false); | |
| 1266 | - draw.setActive(true); | |
| 1267 | - if (document.getElementById("panellistagEditor")) { | |
| 1268 | - i3GEO.editorOL.listaGeometrias(); | |
| 1269 | - } | |
| 1270 | - }); | |
| 1271 | - i3geoOL.addInteraction(draw); | |
| 1272 | - }; | |
| 1273 | - return temp; | |
| 1274 | - }, | |
| 1275 | - botaoTexto: function(){ | |
| 1276 | - i3GEO.eventos.cliquePerm.desativa(); | |
| 1277 | - var temp = document.createElement("div"); | |
| 1278 | - temp.className = "editorOLtextoItemInactive olButton"; | |
| 1279 | - temp.title = $trad("dtexto"); | |
| 1280 | - temp.onclick = function(){ | |
| 1281 | - i3GEO.eventos.cliquePerm.desativa(); | |
| 1282 | - i3GEO.editorOL.marcaBotao("editorOLtexto"); | |
| 1283 | - var draw = new ol.interaction.Draw({ | |
| 1284 | - type : "Point" | |
| 1285 | - }); | |
| 1286 | - //adiciona a interacao para poder ser removida | |
| 1287 | - i3GEO.editorOL.interacoes.push(draw); | |
| 1288 | - i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 1289 | - draw.on("drawend", function(evt) { | |
| 1290 | - var texto = window.prompt("Texto", ""); | |
| 1291 | - evt.feature.setStyle( | |
| 1292 | - new ol.style.Style({ | |
| 1293 | - text: new ol.style.Text({ | |
| 1294 | - text: texto, | |
| 1295 | - font: 'Bold ' + parseInt(i3GEO.editorOL.simbologia.fontSize,10) + 'px Arial', | |
| 1296 | - textAlign: 'left', | |
| 1297 | - stroke: new ol.style.Stroke({ | |
| 1298 | - color: 'white', | |
| 1299 | - width: i3GEO.editorOL.simbologia.strokeWidth | |
| 1300 | - }), | |
| 1301 | - fill: new ol.style.Fill({ | |
| 1302 | - color: i3GEO.editorOL.simbologia.fontColor | |
| 1303 | - }), | |
| 1304 | - zIndex: 2000 | |
| 1305 | - }) | |
| 1306 | - }) | |
| 1307 | - ); | |
| 1308 | - evt.feature.setId(i3GEO.util.uid()); | |
| 1309 | - i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature); | |
| 1310 | - draw.setActive(false); | |
| 1311 | - draw.setActive(true); | |
| 1312 | - i3GEO.editorOL.marcaBotao(); | |
| 1313 | - }); | |
| 1314 | - i3geoOL.addInteraction(draw); | |
| 1315 | - }; | |
| 1316 | - return temp; | |
| 1317 | - }, | |
| 1318 | - botaoSelecao: function(){ | |
| 1319 | - i3GEO.eventos.cliquePerm.desativa(); | |
| 1320 | - var temp = document.createElement("div"); | |
| 1321 | - temp.className = "editorOLselecaoItemInactive olButton"; | |
| 1322 | - temp.title = $trad("d24t"); | |
| 1323 | - temp.onclick = function(){ | |
| 1324 | - i3GEO.editorOL.marcaBotao("editorOLselecao"); | |
| 1325 | - var sel = new ol.interaction.Select(); | |
| 1326 | - //adiciona a interacao para poder ser removida | |
| 1327 | - i3GEO.editorOL.interacoes.push(sel); | |
| 1328 | - i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 1329 | - sel.on("select", function(evt) { | |
| 1330 | - var s,i, n, id, f; | |
| 1331 | - n = evt.selected.length; | |
| 1332 | - for(i=0; i<n; i++){ | |
| 1333 | - f = evt.selected[i]; | |
| 1334 | - id = f.getId(); | |
| 1335 | - if(id && i3GEO.util.in_array(id,i3GEO.editorOL.idsSelecionados)){ | |
| 1336 | - i3GEO.editorOL.unselFeature(id); | |
| 1337 | - } | |
| 1338 | - else{ | |
| 1339 | - id = i3GEO.util.uid(); | |
| 1340 | - i3GEO.editorOL.idsSelecionados.push(id); | |
| 1341 | - f.setId(id); | |
| 1342 | - s = f.getStyle(); | |
| 1266 | + */ | |
| 1267 | + //adiciona a interacao para poder ser removida | |
| 1268 | + i3GEO.editorOL.interacoes.push(draw); | |
| 1269 | + i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 1270 | + draw.on("drawend", function(evt) { | |
| 1271 | + evt.feature.setStyle( | |
| 1272 | + new ol.style.Style({ | |
| 1273 | + stroke: new ol.style.Stroke({ | |
| 1274 | + color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')', | |
| 1275 | + width: i3GEO.editorOL.simbologia.strokeWidth | |
| 1276 | + }), | |
| 1277 | + fill: new ol.style.Fill({ | |
| 1278 | + color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')' | |
| 1279 | + }) | |
| 1280 | + }) | |
| 1281 | + ); | |
| 1282 | + evt.feature.setId(i3GEO.util.uid()); | |
| 1283 | + i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature); | |
| 1284 | + draw.setActive(false); | |
| 1285 | + draw.setActive(true); | |
| 1286 | + if (document.getElementById("panellistagEditor")) { | |
| 1287 | + i3GEO.editorOL.listaGeometrias(); | |
| 1288 | + } | |
| 1289 | + }); | |
| 1290 | + i3geoOL.addInteraction(draw); | |
| 1291 | + }; | |
| 1292 | + return temp; | |
| 1293 | + }, | |
| 1294 | + botaoTexto: function(){ | |
| 1295 | + i3GEO.eventos.cliquePerm.desativa(); | |
| 1296 | + var temp = document.createElement("div"); | |
| 1297 | + temp.className = "editorOLtextoItemInactive olButton"; | |
| 1298 | + temp.title = $trad("dtexto"); | |
| 1299 | + temp.onclick = function(){ | |
| 1300 | + i3GEO.eventos.cliquePerm.desativa(); | |
| 1301 | + i3GEO.editorOL.marcaBotao("editorOLtexto"); | |
| 1302 | + var draw = new ol.interaction.Draw({ | |
| 1303 | + type : "Point" | |
| 1304 | + }); | |
| 1305 | + //adiciona a interacao para poder ser removida | |
| 1306 | + i3GEO.editorOL.interacoes.push(draw); | |
| 1307 | + i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 1308 | + draw.on("drawend", function(evt) { | |
| 1309 | + var texto = window.prompt("Texto", ""); | |
| 1310 | + evt.feature.setStyle( | |
| 1311 | + new ol.style.Style({ | |
| 1312 | + text: new ol.style.Text({ | |
| 1313 | + text: texto, | |
| 1314 | + font: 'Bold ' + parseInt(i3GEO.editorOL.simbologia.fontSize,10) + 'px Arial', | |
| 1315 | + textAlign: 'left', | |
| 1316 | + stroke: new ol.style.Stroke({ | |
| 1317 | + color: 'white', | |
| 1318 | + width: i3GEO.editorOL.simbologia.strokeWidth | |
| 1319 | + }), | |
| 1320 | + fill: new ol.style.Fill({ | |
| 1321 | + color: i3GEO.editorOL.simbologia.fontColor | |
| 1322 | + }), | |
| 1323 | + zIndex: 2000 | |
| 1324 | + }) | |
| 1325 | + }) | |
| 1326 | + ); | |
| 1327 | + evt.feature.setId(i3GEO.util.uid()); | |
| 1328 | + i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature); | |
| 1329 | + draw.setActive(false); | |
| 1330 | + draw.setActive(true); | |
| 1331 | + i3GEO.editorOL.marcaBotao(); | |
| 1332 | + }); | |
| 1333 | + i3geoOL.addInteraction(draw); | |
| 1334 | + }; | |
| 1335 | + return temp; | |
| 1336 | + }, | |
| 1337 | + botaoSelecao: function(){ | |
| 1338 | + i3GEO.eventos.cliquePerm.desativa(); | |
| 1339 | + var temp = document.createElement("div"); | |
| 1340 | + temp.className = "editorOLselecaoItemInactive olButton"; | |
| 1341 | + temp.title = $trad("d24t"); | |
| 1342 | + temp.onclick = function(){ | |
| 1343 | + i3GEO.editorOL.marcaBotao("editorOLselecao"); | |
| 1344 | + var sel = new ol.interaction.Select(); | |
| 1345 | + //adiciona a interacao para poder ser removida | |
| 1346 | + i3GEO.editorOL.interacoes.push(sel); | |
| 1347 | + i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 1348 | + sel.on("select", function(evt) { | |
| 1349 | + var s,i, n, id, f; | |
| 1350 | + n = evt.selected.length; | |
| 1351 | + for(i=0; i<n; i++){ | |
| 1352 | + f = evt.selected[i]; | |
| 1353 | + id = f.getId(); | |
| 1354 | + if(id && i3GEO.util.in_array(id,i3GEO.editorOL.idsSelecionados)){ | |
| 1355 | + i3GEO.editorOL.unselFeature(id); | |
| 1356 | + } | |
| 1357 | + else{ | |
| 1358 | + id = i3GEO.util.uid(); | |
| 1359 | + i3GEO.editorOL.idsSelecionados.push(id); | |
| 1360 | + f.setId(id); | |
| 1361 | + s = f.getStyle(); | |
| 1343 | 1362 | |
| 1344 | - if(s.getImage()){ | |
| 1345 | - f.setStyle( | |
| 1346 | - new ol.style.Style({ | |
| 1347 | - image: new ol.style.Circle({ | |
| 1348 | - radius: i3GEO.editorOL.simbologia.pointRadius, | |
| 1349 | - fill: new ol.style.Fill({ | |
| 1350 | - color: 'rgba(255, 255, 255, 0.5)' | |
| 1351 | - }), | |
| 1352 | - stroke: new ol.style.Stroke({ | |
| 1353 | - color: 'blue', | |
| 1354 | - width: i3GEO.editorOL.simbologia.pointRadius / 3 | |
| 1355 | - }) | |
| 1356 | - }) | |
| 1357 | - }) | |
| 1358 | - ); | |
| 1359 | - if(!s.getImage().getSrc){ | |
| 1360 | - f.setProperties({ | |
| 1361 | - fillColor: s.getImage().getFill().getColor(), | |
| 1362 | - strokeColor: s.getImage().getStroke().getColor(), | |
| 1363 | - externalGraphic: "", | |
| 1364 | - graphicHeight : 25, | |
| 1365 | - graphicWidth : 25 | |
| 1366 | - }); | |
| 1367 | - } | |
| 1368 | - else{ | |
| 1369 | - f.setProperties({ | |
| 1370 | - fillColor: "", | |
| 1371 | - strokeColor: "", | |
| 1372 | - externalGraphic: s.getImage().getSrc(), | |
| 1373 | - graphicHeight : s.getImage().getSize()[1], | |
| 1374 | - graphicWidth : s.getImage().getSize()[0] | |
| 1375 | - }); | |
| 1376 | - } | |
| 1377 | - } | |
| 1378 | - else{ | |
| 1379 | - f.setProperties({ | |
| 1380 | - fillColor: s.getFill().getColor(), | |
| 1381 | - strokeColor: s.getStroke().getColor(), | |
| 1382 | - externalGraphic: "", | |
| 1383 | - graphicHeight : 25, | |
| 1384 | - graphicWidth : 25 | |
| 1385 | - }); | |
| 1386 | - s.getFill().setColor('rgba(255, 255, 255, 0.5)'); | |
| 1387 | - s.getStroke().setColor('blue'); | |
| 1388 | - } | |
| 1389 | - } | |
| 1390 | - } | |
| 1391 | - if (n === 0){ | |
| 1392 | - i3GEO.editorOL.unselTodos(); | |
| 1393 | - } | |
| 1394 | - }); | |
| 1395 | - i3geoOL.addInteraction(sel); | |
| 1396 | - }; | |
| 1397 | - return temp; | |
| 1398 | - }, | |
| 1399 | - botaoSelecaoTudo: function(){ | |
| 1400 | - var temp = document.createElement("div"); | |
| 1401 | - temp.className = "editorOLselecaoTudoItemInactive olButton"; | |
| 1402 | - temp.title = $trad("studo"); | |
| 1403 | - temp.onclick = function(){ | |
| 1404 | - i3GEO.editorOL.marcaBotao(); | |
| 1405 | - i3GEO.editorOL.selTodos(); | |
| 1406 | - }; | |
| 1407 | - return temp; | |
| 1408 | - }, | |
| 1409 | - botaoApaga: function(){ | |
| 1410 | - var temp = document.createElement("div"); | |
| 1411 | - temp.className = "editorOLapagaItemInactive olButton"; | |
| 1412 | - temp.title = $trad("excsel"); | |
| 1413 | - temp.onclick = function(){ | |
| 1414 | - var x, nsel = i3GEO.editorOL.idsSelecionados.length; | |
| 1415 | - i3GEO.editorOL.featuresBackup = []; | |
| 1416 | - i3GEO.editorOL.marcaBotao(); | |
| 1417 | - if(nsel > 0){ | |
| 1418 | - x = window.confirm($trad("excsel") + "?"); | |
| 1419 | - if(x){ | |
| 1420 | - i3GEO.editorOL.removeFeaturesSel(); | |
| 1421 | - i3GEO.desenho.layergrafico.getSource().changed(); | |
| 1422 | - } | |
| 1423 | - } | |
| 1424 | - else{ | |
| 1425 | - i3GEO.janela.tempoMsg($trad("selum")); | |
| 1426 | - } | |
| 1427 | - }; | |
| 1428 | - return temp; | |
| 1429 | - }, | |
| 1430 | - botaoFrente: function(){ | |
| 1431 | - var temp = document.createElement("div"); | |
| 1432 | - temp.className = "editorOLfrenteItemInactive olButton"; | |
| 1433 | - temp.title = $trad("frente"); | |
| 1434 | - temp.onclick = function(){ | |
| 1435 | - var nsel = i3GEO.editorOL.idsSelecionados.length; | |
| 1436 | - if(nsel > 0){ | |
| 1437 | - i3GEO.editorOL.marcaBotao(); | |
| 1438 | - i3GEO.editorOL.trazParaFrente(); | |
| 1439 | - } | |
| 1440 | - else{ | |
| 1441 | - i3GEO.janela.tempoMsg($trad("selum")); | |
| 1442 | - } | |
| 1443 | - }; | |
| 1444 | - return temp; | |
| 1445 | - }, | |
| 1446 | - //FIXME Translate nao funciona nessa versao do openlayers 3x precisa atualizar | |
| 1447 | - botaoEdita: function(){ | |
| 1448 | - i3GEO.eventos.cliquePerm.desativa(); | |
| 1449 | - var temp = document.createElement("div"); | |
| 1450 | - temp.className = "editorOLeditaItemInactive olButton"; | |
| 1451 | - temp.title = $trad("modf"); | |
| 1452 | - temp.onclick = function(){ | |
| 1453 | - i3GEO.editorOL.featuresBackup = []; | |
| 1454 | - var draw, nsel, f, c; | |
| 1455 | - nsel = i3GEO.editorOL.idsSelecionados.length; | |
| 1456 | - if(nsel == 1){ | |
| 1457 | - i3GEO.editorOL.marcaBotao("editorOLedita"); | |
| 1458 | - f = i3GEO.desenho.layergrafico.getSource().getFeatureById(i3GEO.editorOL.idsSelecionados[nsel - 1]); | |
| 1459 | - i3GEO.editorOL.featuresBackup.push(f.clone()); | |
| 1460 | - c = new ol.Collection(); | |
| 1461 | - c.push(f); | |
| 1462 | - draw = new ol.interaction.Modify({ | |
| 1463 | - features: c | |
| 1464 | - }); | |
| 1465 | - //adiciona a interacao para poder ser removida | |
| 1466 | - i3GEO.editorOL.interacoes.push(draw); | |
| 1467 | - i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 1468 | - i3geoOL.addInteraction(draw); | |
| 1469 | - } | |
| 1470 | - else{ | |
| 1471 | - i3GEO.janela.tempoMsg($trad("selum")); | |
| 1472 | - } | |
| 1473 | - }; | |
| 1474 | - return temp; | |
| 1475 | - }, | |
| 1476 | - botaoCorta: function(){ | |
| 1477 | - i3GEO.eventos.cliquePerm.desativa(); | |
| 1478 | - var temp = document.createElement("div"); | |
| 1479 | - temp.className = "editorOLcortaItemInactive olButton"; | |
| 1480 | - temp.title = $trad("cortaf"); | |
| 1481 | - temp.onclick = function(){ | |
| 1482 | - var nsel = i3GEO.editorOL.idsSelecionados.length; | |
| 1483 | - if (nsel != 1) { | |
| 1484 | - alert("Selecione primeiro um elemento para ser cortado"); | |
| 1485 | - } else { | |
| 1486 | - i3GEO.janela.tempoMsg("Desenhe um polígono"); | |
| 1487 | - i3GEO.editorOL.marcaBotao("editorOLcorta"); | |
| 1488 | - var draw = new ol.interaction.Draw({ | |
| 1489 | - type : "Polygon" | |
| 1490 | - }); | |
| 1491 | - //adiciona a interacao para poder ser removida | |
| 1492 | - i3GEO.editorOL.interacoes.push(draw); | |
| 1493 | - i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 1494 | - draw.on("drawend", function(evt) { | |
| 1495 | - var temp, f, c, format, fwkt, cwkt; | |
| 1496 | - f = evt.feature; | |
| 1497 | - c = i3GEO.desenho.layergrafico.getSource().getFeatureById(i3GEO.editorOL.idsSelecionados[nsel - 1]); | |
| 1498 | - i3GEO.editorOL.featuresBackup.push(c.clone()); | |
| 1499 | - i3GEO.editorOL.marcaBotao(); | |
| 1500 | - //corta | |
| 1501 | - format = new ol.format.WKT(); | |
| 1502 | - if(f && c){ | |
| 1503 | - fwkt = format.writeFeatures([f]); | |
| 1504 | - cwkt = format.writeFeatures([c]); | |
| 1505 | - if(fwkt && cwkt){ | |
| 1506 | - temp = function(retorno) { | |
| 1507 | - i3GEO.janela.fechaAguarde("i3GEO.cortador"); | |
| 1508 | - if (retorno != "" && retorno.data && retorno.data != "") { | |
| 1509 | - i3GEO.janela.fechaAguarde("i3GEO.cortador"); | |
| 1510 | - c.setGeometry(format.readGeometry(retorno.data)); | |
| 1511 | - if (document.getElementById("panellistagEditor")) { | |
| 1512 | - i3GEO.editorOL.listaGeometrias(); | |
| 1513 | - } | |
| 1514 | - } | |
| 1515 | - }; | |
| 1516 | - i3GEO.janela.abreAguarde("i3GEO.cortador", "Cortando"); | |
| 1517 | - i3GEO.php.funcoesGeometriasWkt(temp, cwkt + "|" + fwkt, "difference"); | |
| 1518 | - } | |
| 1519 | - } | |
| 1520 | - }); | |
| 1521 | - i3geoOL.addInteraction(draw); | |
| 1522 | - } | |
| 1523 | - }; | |
| 1524 | - return temp; | |
| 1525 | - }, | |
| 1526 | - botaoListaGeometrias: function(){ | |
| 1527 | - var temp = document.createElement("div"); | |
| 1528 | - temp.className = "editorOLlistagItemInactive olButton"; | |
| 1529 | - temp.title = $trad("listag"); | |
| 1530 | - temp.onclick = function(){ | |
| 1531 | - i3GEO.editorOL.listaGeometrias(); | |
| 1532 | - }; | |
| 1533 | - return temp; | |
| 1534 | - }, | |
| 1535 | - botaoNovaaba: function(){ | |
| 1536 | - var temp = document.createElement("div"); | |
| 1537 | - temp.className = "editorOLnovaabaItemInactive olButton"; | |
| 1538 | - temp.title = $trad("novaaba"); | |
| 1539 | - temp.onclick = function(){ | |
| 1540 | - window.open(window.location, '_blank'); | |
| 1541 | - }; | |
| 1542 | - return temp; | |
| 1543 | - }, | |
| 1544 | - botaoAjuda: function(){ | |
| 1545 | - var temp = document.createElement("div"); | |
| 1546 | - temp.className = "editorOLajudaItemInactive olButton"; | |
| 1547 | - temp.title = $trad("s1"); | |
| 1548 | - temp.onclick = function(){ | |
| 1549 | - if(i3GEO.configura && i3GEO.configura.locaplic){ | |
| 1550 | - i3GEO.janela.cria("400px", "200px", i3GEO.configura.locaplic | |
| 1551 | - + "/ferramentas/editorol/openlayers_ajuda.php?completo=none", "", "", "<span class='i3GeoTituloJanelaBsNolink' >"+$trad("s1")+"</span></div>", "editorOlAjuda"); | |
| 1552 | - } | |
| 1553 | - else{ | |
| 1554 | - window.open("openlayers_ajuda.php"); | |
| 1555 | - } | |
| 1556 | - }; | |
| 1557 | - return temp; | |
| 1558 | - }, | |
| 1559 | - botaoFecha: function(){ | |
| 1560 | - var temp = document.createElement("div"); | |
| 1561 | - temp.className = "editorOLfechaItemInactive olButton"; | |
| 1562 | - temp.title = $trad("x74"); | |
| 1563 | - temp.onclick = function(){ | |
| 1564 | - i3GEO.editorOL.unselTodos(); | |
| 1565 | - i3GEO.editorOL.featuresBackup = []; | |
| 1566 | - i3GEO.editorOL.marcaBotao(); | |
| 1567 | - i3GEO.eventos.cliquePerm.ativa(); | |
| 1568 | - $i("i3GEObarraEdicao").style.display = "none"; | |
| 1569 | - }; | |
| 1570 | - return temp; | |
| 1571 | - }, | |
| 1572 | - botaoTools: function(){ | |
| 1573 | - var temp = document.createElement("div"); | |
| 1574 | - temp.className = "editorOLtoolsItemInactive olButton"; | |
| 1575 | - temp.title = $trad("u15a"); | |
| 1576 | - temp.onclick = function(){ | |
| 1577 | - // fora do i3geo, usa o jsts | |
| 1578 | - if (i3GEO.php) { | |
| 1579 | - i3GEO.editorOL.ferramentas(); | |
| 1580 | - } else { | |
| 1581 | - i3GEO.editorOL.carregajts("i3GEO.editorOL.ferramentas()"); | |
| 1582 | - } | |
| 1583 | - }; | |
| 1584 | - return temp; | |
| 1585 | - }, | |
| 1586 | - botaoPropriedades: function(){ | |
| 1587 | - var temp = document.createElement("div"); | |
| 1588 | - temp.className = "editorOLpropriedadesItemInactive olButton"; | |
| 1589 | - temp.title = $trad("p13"); | |
| 1590 | - temp.onclick = function(){ | |
| 1591 | - i3GEO.editorOL.propriedades(); | |
| 1592 | - }; | |
| 1593 | - return temp; | |
| 1594 | - }, | |
| 1595 | - botaoImprimir: function(){ | |
| 1596 | - var temp = document.createElement("div"); | |
| 1597 | - temp.className = "editorOLimprimirItemInactive olButton"; | |
| 1598 | - temp.onclick = function(){ | |
| 1599 | - window.print(); | |
| 1600 | - }; | |
| 1601 | - return temp; | |
| 1602 | - }, | |
| 1603 | - botaoGrid: function(){ | |
| 1604 | - var temp = document.createElement("div"); | |
| 1605 | - temp.className = "editorOLgridItemInactive olButton"; | |
| 1606 | - temp.onclick = function(){ | |
| 1607 | - var p = {"map": i3GEO.editorOL.mapa,"targetSize": 200}; | |
| 1608 | - if(!i3GEO.editorOL.grid){ | |
| 1609 | - i3GEO.editorOL.grid = new ol.Graticule(p); | |
| 1610 | - } else { | |
| 1611 | - if(i3GEO.editorOL.grid.getMap() == null){ | |
| 1612 | - i3GEO.editorOL.grid.setMap(i3GEO.editorOL.mapa); | |
| 1613 | - } else { | |
| 1614 | - i3GEO.editorOL.grid.setMap(null); | |
| 1615 | - } | |
| 1616 | - } | |
| 1617 | - }; | |
| 1618 | - return temp; | |
| 1619 | - }, | |
| 1620 | - botaoIdentifica: function(){ | |
| 1621 | - i3GEO.eventos.cliquePerm.desativa(); | |
| 1622 | - var temp = document.createElement("div"); | |
| 1623 | - temp.className = "editorOLidentificaItemInactive olButton"; | |
| 1624 | - temp.title = $trad("d7t"); | |
| 1625 | - temp.onclick = function(){ | |
| 1626 | - if(i3GEO.editorOL.layerDefault == ""){ | |
| 1627 | - i3GEO.editorOL.criaJanelaAtivaTema(); | |
| 1628 | - } | |
| 1629 | - i3GEO.eventos.cliquePerm.desativa(); | |
| 1630 | - i3GEO.editorOL.marcaBotao("editorOLidentifica"); | |
| 1631 | - var draw = new ol.interaction.Draw({ | |
| 1632 | - type : "Point" | |
| 1633 | - }); | |
| 1634 | - //adiciona a interacao para poder ser removida | |
| 1635 | - i3GEO.editorOL.interacoes.push(draw); | |
| 1636 | - i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 1637 | - draw.on("drawend", function(evt) { | |
| 1638 | - var xy, p, retorno, url, layer, tema = $i("i3GEOOLlistaTemasAtivos"); | |
| 1639 | - if(tema){ | |
| 1640 | - layer = i3geoOL.getLayersByName(tema.value)[0]; | |
| 1641 | - if(layer.getSource().getUrls){ | |
| 1642 | - url = layer.getSource().getUrls()[0]; | |
| 1643 | - } | |
| 1644 | - else{ | |
| 1645 | - url = layer.getSource().getUrl(); | |
| 1646 | - } | |
| 1363 | + if(s.getImage()){ | |
| 1364 | + f.setStyle( | |
| 1365 | + new ol.style.Style({ | |
| 1366 | + image: new ol.style.Circle({ | |
| 1367 | + radius: i3GEO.editorOL.simbologia.pointRadius, | |
| 1368 | + fill: new ol.style.Fill({ | |
| 1369 | + color: 'rgba(255, 255, 255, 0.5)' | |
| 1370 | + }), | |
| 1371 | + stroke: new ol.style.Stroke({ | |
| 1372 | + color: 'blue', | |
| 1373 | + width: i3GEO.editorOL.simbologia.pointRadius / 3 | |
| 1374 | + }) | |
| 1375 | + }) | |
| 1376 | + }) | |
| 1377 | + ); | |
| 1378 | + if(!s.getImage().getSrc){ | |
| 1379 | + f.setProperties({ | |
| 1380 | + fillColor: s.getImage().getFill().getColor(), | |
| 1381 | + strokeColor: s.getImage().getStroke().getColor(), | |
| 1382 | + externalGraphic: "", | |
| 1383 | + graphicHeight : 25, | |
| 1384 | + graphicWidth : 25 | |
| 1385 | + }); | |
| 1386 | + } | |
| 1387 | + else{ | |
| 1388 | + f.setProperties({ | |
| 1389 | + fillColor: "", | |
| 1390 | + strokeColor: "", | |
| 1391 | + externalGraphic: s.getImage().getSrc(), | |
| 1392 | + graphicHeight : s.getImage().getSize()[1], | |
| 1393 | + graphicWidth : s.getImage().getSize()[0] | |
| 1394 | + }); | |
| 1395 | + } | |
| 1396 | + } | |
| 1397 | + else{ | |
| 1398 | + f.setProperties({ | |
| 1399 | + fillColor: s.getFill().getColor(), | |
| 1400 | + strokeColor: s.getStroke().getColor(), | |
| 1401 | + externalGraphic: "", | |
| 1402 | + graphicHeight : 25, | |
| 1403 | + graphicWidth : 25 | |
| 1404 | + }); | |
| 1405 | + s.getFill().setColor('rgba(255, 255, 255, 0.5)'); | |
| 1406 | + s.getStroke().setColor('blue'); | |
| 1407 | + } | |
| 1408 | + } | |
| 1409 | + } | |
| 1410 | + if (n === 0){ | |
| 1411 | + i3GEO.editorOL.unselTodos(); | |
| 1412 | + } | |
| 1413 | + }); | |
| 1414 | + i3geoOL.addInteraction(sel); | |
| 1415 | + }; | |
| 1416 | + return temp; | |
| 1417 | + }, | |
| 1418 | + botaoSelecaoTudo: function(){ | |
| 1419 | + var temp = document.createElement("div"); | |
| 1420 | + temp.className = "editorOLselecaoTudoItemInactive olButton"; | |
| 1421 | + temp.title = $trad("studo"); | |
| 1422 | + temp.onclick = function(){ | |
| 1423 | + i3GEO.editorOL.marcaBotao(); | |
| 1424 | + i3GEO.editorOL.selTodos(); | |
| 1425 | + }; | |
| 1426 | + return temp; | |
| 1427 | + }, | |
| 1428 | + botaoApaga: function(){ | |
| 1429 | + var temp = document.createElement("div"); | |
| 1430 | + temp.className = "editorOLapagaItemInactive olButton"; | |
| 1431 | + temp.title = $trad("excsel"); | |
| 1432 | + temp.onclick = function(){ | |
| 1433 | + var x, nsel = i3GEO.editorOL.idsSelecionados.length; | |
| 1434 | + i3GEO.editorOL.featuresBackup = []; | |
| 1435 | + i3GEO.editorOL.marcaBotao(); | |
| 1436 | + if(nsel > 0){ | |
| 1437 | + x = window.confirm($trad("excsel") + "?"); | |
| 1438 | + if(x){ | |
| 1439 | + i3GEO.editorOL.removeFeaturesSel(); | |
| 1440 | + i3GEO.desenho.layergrafico.getSource().changed(); | |
| 1441 | + } | |
| 1442 | + } | |
| 1443 | + else{ | |
| 1444 | + i3GEO.janela.tempoMsg($trad("selum")); | |
| 1445 | + } | |
| 1446 | + }; | |
| 1447 | + return temp; | |
| 1448 | + }, | |
| 1449 | + botaoFrente: function(){ | |
| 1450 | + var temp = document.createElement("div"); | |
| 1451 | + temp.className = "editorOLfrenteItemInactive olButton"; | |
| 1452 | + temp.title = $trad("frente"); | |
| 1453 | + temp.onclick = function(){ | |
| 1454 | + var nsel = i3GEO.editorOL.idsSelecionados.length; | |
| 1455 | + if(nsel > 0){ | |
| 1456 | + i3GEO.editorOL.marcaBotao(); | |
| 1457 | + i3GEO.editorOL.trazParaFrente(); | |
| 1458 | + } | |
| 1459 | + else{ | |
| 1460 | + i3GEO.janela.tempoMsg($trad("selum")); | |
| 1461 | + } | |
| 1462 | + }; | |
| 1463 | + return temp; | |
| 1464 | + }, | |
| 1465 | + //FIXME Translate nao funciona nessa versao do openlayers 3x precisa atualizar | |
| 1466 | + botaoEdita: function(){ | |
| 1467 | + i3GEO.eventos.cliquePerm.desativa(); | |
| 1468 | + var temp = document.createElement("div"); | |
| 1469 | + temp.className = "editorOLeditaItemInactive olButton"; | |
| 1470 | + temp.title = $trad("modf"); | |
| 1471 | + temp.onclick = function(){ | |
| 1472 | + i3GEO.editorOL.featuresBackup = []; | |
| 1473 | + var draw, nsel, f, c; | |
| 1474 | + nsel = i3GEO.editorOL.idsSelecionados.length; | |
| 1475 | + if(nsel == 1){ | |
| 1476 | + i3GEO.editorOL.marcaBotao("editorOLedita"); | |
| 1477 | + f = i3GEO.desenho.layergrafico.getSource().getFeatureById(i3GEO.editorOL.idsSelecionados[nsel - 1]); | |
| 1478 | + i3GEO.editorOL.featuresBackup.push(f.clone()); | |
| 1479 | + c = new ol.Collection(); | |
| 1480 | + c.push(f); | |
| 1481 | + draw = new ol.interaction.Modify({ | |
| 1482 | + features: c | |
| 1483 | + }); | |
| 1484 | + //adiciona a interacao para poder ser removida | |
| 1485 | + i3GEO.editorOL.interacoes.push(draw); | |
| 1486 | + i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 1487 | + i3geoOL.addInteraction(draw); | |
| 1488 | + } | |
| 1489 | + else{ | |
| 1490 | + i3GEO.janela.tempoMsg($trad("seluma")); | |
| 1491 | + } | |
| 1492 | + }; | |
| 1493 | + return temp; | |
| 1494 | + }, | |
| 1495 | + botaoCorta: function(){ | |
| 1496 | + i3GEO.eventos.cliquePerm.desativa(); | |
| 1497 | + var temp = document.createElement("div"); | |
| 1498 | + temp.className = "editorOLcortaItemInactive olButton"; | |
| 1499 | + temp.title = $trad("cortaf"); | |
| 1500 | + temp.onclick = function(){ | |
| 1501 | + var nsel = i3GEO.editorOL.idsSelecionados.length; | |
| 1502 | + if (nsel != 1) { | |
| 1503 | + alert("Selecione primeiro um elemento para ser cortado"); | |
| 1504 | + } else { | |
| 1505 | + i3GEO.janela.tempoMsg("Desenhe um polígono"); | |
| 1506 | + i3GEO.editorOL.marcaBotao("editorOLcorta"); | |
| 1507 | + var draw = new ol.interaction.Draw({ | |
| 1508 | + type : "Polygon" | |
| 1509 | + }); | |
| 1510 | + //adiciona a interacao para poder ser removida | |
| 1511 | + i3GEO.editorOL.interacoes.push(draw); | |
| 1512 | + i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 1513 | + draw.on("drawend", function(evt) { | |
| 1514 | + var temp, f, c, format, fwkt, cwkt; | |
| 1515 | + f = evt.feature; | |
| 1516 | + c = i3GEO.desenho.layergrafico.getSource().getFeatureById(i3GEO.editorOL.idsSelecionados[nsel - 1]); | |
| 1517 | + i3GEO.editorOL.featuresBackup.push(c.clone()); | |
| 1518 | + i3GEO.editorOL.marcaBotao(); | |
| 1519 | + //corta | |
| 1520 | + format = new ol.format.WKT(); | |
| 1521 | + if(f && c){ | |
| 1522 | + fwkt = format.writeFeatures([f]); | |
| 1523 | + cwkt = format.writeFeatures([c]); | |
| 1524 | + if(fwkt && cwkt){ | |
| 1525 | + temp = function(retorno) { | |
| 1526 | + i3GEO.janela.fechaAguarde("i3GEO.cortador"); | |
| 1527 | + if (retorno != "" && retorno.data && retorno.data != "") { | |
| 1528 | + i3GEO.janela.fechaAguarde("i3GEO.cortador"); | |
| 1529 | + c.setGeometry(format.readGeometry(retorno.data)); | |
| 1530 | + if (document.getElementById("panellistagEditor")) { | |
| 1531 | + i3GEO.editorOL.listaGeometrias(); | |
| 1532 | + } | |
| 1533 | + } | |
| 1534 | + }; | |
| 1535 | + i3GEO.janela.abreAguarde("i3GEO.cortador", "Cortando"); | |
| 1536 | + i3GEO.php.funcoesGeometriasWkt(temp, cwkt + "|" + fwkt, "difference"); | |
| 1537 | + } | |
| 1538 | + } | |
| 1539 | + }); | |
| 1540 | + i3geoOL.addInteraction(draw); | |
| 1541 | + } | |
| 1542 | + }; | |
| 1543 | + return temp; | |
| 1544 | + }, | |
| 1545 | + botaoListaGeometrias: function(){ | |
| 1546 | + var temp = document.createElement("div"); | |
| 1547 | + temp.className = "editorOLlistagItemInactive olButton"; | |
| 1548 | + temp.title = $trad("listag"); | |
| 1549 | + temp.onclick = function(){ | |
| 1550 | + i3GEO.editorOL.listaGeometrias(); | |
| 1551 | + }; | |
| 1552 | + return temp; | |
| 1553 | + }, | |
| 1554 | + botaoNovaaba: function(){ | |
| 1555 | + var temp = document.createElement("div"); | |
| 1556 | + temp.className = "editorOLnovaabaItemInactive olButton"; | |
| 1557 | + temp.title = $trad("novaaba"); | |
| 1558 | + temp.onclick = function(){ | |
| 1559 | + window.open(window.location, '_blank'); | |
| 1560 | + }; | |
| 1561 | + return temp; | |
| 1562 | + }, | |
| 1563 | + botaoAjuda: function(){ | |
| 1564 | + var temp = document.createElement("div"); | |
| 1565 | + temp.className = "editorOLajudaItemInactive olButton"; | |
| 1566 | + temp.title = $trad("s1"); | |
| 1567 | + temp.onclick = function(){ | |
| 1568 | + if(i3GEO.configura && i3GEO.configura.locaplic){ | |
| 1569 | + i3GEO.janela.cria("400px", "200px", i3GEO.configura.locaplic | |
| 1570 | + + "/ferramentas/editorol/openlayers_ajuda.php?completo=none", "", "", "<span class='i3GeoTituloJanelaBsNolink' >"+$trad("s1")+"</span></div>", "editorOlAjuda"); | |
| 1571 | + } | |
| 1572 | + else{ | |
| 1573 | + window.open("openlayers_ajuda.php"); | |
| 1574 | + } | |
| 1575 | + }; | |
| 1576 | + return temp; | |
| 1577 | + }, | |
| 1578 | + botaoFecha: function(){ | |
| 1579 | + var temp = document.createElement("div"); | |
| 1580 | + temp.className = "editorOLfechaItemInactive olButton"; | |
| 1581 | + temp.title = $trad("x74"); | |
| 1582 | + temp.onclick = function(){ | |
| 1583 | + i3GEO.editorOL.unselTodos(); | |
| 1584 | + i3GEO.editorOL.featuresBackup = []; | |
| 1585 | + i3GEO.editorOL.marcaBotao(); | |
| 1586 | + i3GEO.eventos.cliquePerm.ativa(); | |
| 1587 | + $i("i3GEObarraEdicao").style.display = "none"; | |
| 1588 | + }; | |
| 1589 | + return temp; | |
| 1590 | + }, | |
| 1591 | + botaoTools: function(){ | |
| 1592 | + var temp = document.createElement("div"); | |
| 1593 | + temp.className = "editorOLtoolsItemInactive olButton"; | |
| 1594 | + temp.title = $trad("u15a"); | |
| 1595 | + temp.onclick = function(){ | |
| 1596 | + // fora do i3geo, usa o jsts | |
| 1597 | + if (i3GEO.php) { | |
| 1598 | + i3GEO.editorOL.ferramentas(); | |
| 1599 | + } else { | |
| 1600 | + i3GEO.editorOL.carregajts("i3GEO.editorOL.ferramentas()"); | |
| 1601 | + } | |
| 1602 | + }; | |
| 1603 | + return temp; | |
| 1604 | + }, | |
| 1605 | + botaoPropriedades: function(){ | |
| 1606 | + var temp = document.createElement("div"); | |
| 1607 | + temp.className = "editorOLpropriedadesItemInactive olButton"; | |
| 1608 | + temp.title = $trad("p13"); | |
| 1609 | + temp.onclick = function(){ | |
| 1610 | + i3GEO.editorOL.propriedades(); | |
| 1611 | + }; | |
| 1612 | + return temp; | |
| 1613 | + }, | |
| 1614 | + botaoImprimir: function(){ | |
| 1615 | + var temp = document.createElement("div"); | |
| 1616 | + temp.className = "editorOLimprimirItemInactive olButton"; | |
| 1617 | + temp.onclick = function(){ | |
| 1618 | + window.print(); | |
| 1619 | + }; | |
| 1620 | + return temp; | |
| 1621 | + }, | |
| 1622 | + botaoGrid: function(){ | |
| 1623 | + var temp = document.createElement("div"); | |
| 1624 | + temp.className = "editorOLgridItemInactive olButton"; | |
| 1625 | + temp.onclick = function(){ | |
| 1626 | + var p = {"map": i3GEO.editorOL.mapa,"targetSize": 200}; | |
| 1627 | + if(!i3GEO.editorOL.grid){ | |
| 1628 | + i3GEO.editorOL.grid = new ol.Graticule(p); | |
| 1629 | + } else { | |
| 1630 | + if(i3GEO.editorOL.grid.getMap() == null){ | |
| 1631 | + i3GEO.editorOL.grid.setMap(i3GEO.editorOL.mapa); | |
| 1632 | + } else { | |
| 1633 | + i3GEO.editorOL.grid.setMap(null); | |
| 1634 | + } | |
| 1635 | + } | |
| 1636 | + }; | |
| 1637 | + return temp; | |
| 1638 | + }, | |
| 1639 | + botaoIdentifica: function(){ | |
| 1640 | + i3GEO.eventos.cliquePerm.desativa(); | |
| 1641 | + var temp = document.createElement("div"); | |
| 1642 | + temp.className = "editorOLidentificaItemInactive olButton"; | |
| 1643 | + temp.title = $trad("d7t"); | |
| 1644 | + temp.onclick = function(){ | |
| 1645 | + if(i3GEO.editorOL.layerDefault == ""){ | |
| 1646 | + i3GEO.editorOL.criaJanelaAtivaTema(); | |
| 1647 | + } | |
| 1648 | + i3GEO.eventos.cliquePerm.desativa(); | |
| 1649 | + i3GEO.editorOL.marcaBotao("editorOLidentifica"); | |
| 1650 | + var draw = new ol.interaction.Draw({ | |
| 1651 | + type : "Point" | |
| 1652 | + }); | |
| 1653 | + //adiciona a interacao para poder ser removida | |
| 1654 | + i3GEO.editorOL.interacoes.push(draw); | |
| 1655 | + i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false); | |
| 1656 | + draw.on("drawend", function(evt) { | |
| 1657 | + var xy, p, retorno, url, layer, tema = $i("i3GEOOLlistaTemasAtivos"); | |
| 1658 | + if(tema){ | |
| 1659 | + layer = i3geoOL.getLayersByName(tema.value)[0]; | |
| 1660 | + if(layer.getSource().getUrls){ | |
| 1661 | + url = layer.getSource().getUrls()[0]; | |
| 1662 | + } | |
| 1663 | + else{ | |
| 1664 | + url = layer.getSource().getUrl(); | |
| 1665 | + } | |
| 1647 | 1666 | |
| 1648 | - //xy = evt.target.downPx_; | |
| 1649 | - xy = evt.feature.getGeometry().getFirstCoordinate(); | |
| 1650 | - retorno = function(r){ | |
| 1651 | - var valorunico = "", camada = null, texto = "", lonlattexto, xy, temp, temp1, n, i, f = [], textoN = r.split(":"); | |
| 1652 | - if(i3GEO.arvoreDeCamadas){ | |
| 1653 | - camada = i3GEO.arvoreDeCamadas.pegaTema(tema.value, "", "name"); | |
| 1654 | - } | |
| 1655 | - xy = evt.feature.getGeometry().getFirstCoordinate(); | |
| 1656 | - i3GEO.eventos.cliquePerm.ativo = true; | |
| 1657 | - try { | |
| 1658 | - if (textoN.length > 1) { | |
| 1659 | - textoN.shift(); | |
| 1660 | - textoN.shift(); | |
| 1661 | - temp = textoN.join(":"); | |
| 1662 | - temp = temp.replace(/'/g, ""); | |
| 1663 | - temp = temp.replace(/\n/g, "|"); | |
| 1664 | - temp = temp.replace(/_/g, " "); | |
| 1665 | - //temp = temp.replace(/=/g, ":"); | |
| 1666 | - temp = temp.split("|"); | |
| 1667 | - n = temp.length; | |
| 1668 | - for (i = 0; i < n; i++) { | |
| 1669 | - temp1 = temp[i].replace(/^\s+/, ""); | |
| 1670 | - temp1 = temp1.replace(/\s+$/, ""); | |
| 1671 | - if (temp1 != ""){ | |
| 1672 | - //verifica se a coluna eh o idunico e pega o valor | |
| 1673 | - if(camada && camada.colunaidunico != "" && temp1.split("=")[0].trim() == camada.colunaidunico){ | |
| 1674 | - valorunico = temp1.split("=")[1].trim(); | |
| 1675 | - temp1 = "(*) "+temp1; | |
| 1676 | - } | |
| 1677 | - f.push(temp1); | |
| 1678 | - } | |
| 1679 | - } | |
| 1680 | - texto = "<pre>" + f.join("<br>") + "</pre>"; | |
| 1681 | - } | |
| 1682 | - } catch (e) {} | |
| 1683 | - //funcao para capturar a geometria | |
| 1684 | - lonlattexto = | |
| 1685 | - "<span style=font-size:12px;color:blue;cursor:pointer onclick='i3GEO.editorOL.captura(" + xy[0] | |
| 1686 | - + "," | |
| 1687 | - + xy[1] | |
| 1688 | - + ",\"" | |
| 1689 | - + tema.value | |
| 1690 | - + "\"" | |
| 1691 | - + ",\"" | |
| 1692 | - + valorunico | |
| 1693 | - + "\")'>edita geometria</span><br>"; | |
| 1694 | - i3GEO.Interface.openlayers.balao("<div style='text-align:left' >" + lonlattexto + texto + "</div>","", xy[0], xy[1], false, false); | |
| 1695 | - i3GEO.eventos.cliquePerm.ativo = false; | |
| 1696 | - }; | |
| 1697 | - p = i3GEO.configura.locaplic + "/classesphp/proxy.php?" | |
| 1698 | - + url | |
| 1699 | - + "&tipoRetornoProxy=string&REQUEST=GetFeatureInfo&TIPOIMAGEM=nenhum&DESLIGACACHE=sim&STYLES=&SERVICE=WMS&VERSION=1.1.1&FEATURE_COUNT=1" | |
| 1700 | - + "&FORMAT=image/png&INFO_FORMAT=text/plain&SRS=EPSG:4326" | |
| 1701 | - + "&LAYERS=" + tema.value | |
| 1702 | - + "&layer=" + tema.value | |
| 1703 | - + "&QUERY_LAYERS=" + tema.value | |
| 1704 | - + "&HEIGHT=" + i3geoOL.getSize()[1] | |
| 1705 | - + "&WIDTH=" + i3geoOL.getSize()[0] | |
| 1706 | - + "&BBOX=" + i3geoOL.getExtent().toBBOX().split(",").join(" ") | |
| 1707 | - + "&X=" + xy[0] + "&Y=" + xy[1]; | |
| 1708 | - cpJSON.call(p, "foo", retorno, ""); | |
| 1709 | - } | |
| 1710 | - }); | |
| 1711 | - i3geoOL.addInteraction(draw); | |
| 1712 | - }; | |
| 1713 | - return temp; | |
| 1714 | - }, | |
| 1715 | - botaoSalva: function(){ | |
| 1716 | - var temp = document.createElement("div"); | |
| 1717 | - temp.className = "editorOLsalvaItemInactive olButton"; | |
| 1718 | - temp.title = $trad("salva"); | |
| 1719 | - temp.onclick = function(){ | |
| 1720 | - i3GEO.editorOL.salvaGeometrias(); | |
| 1721 | - }; | |
| 1722 | - return temp; | |
| 1723 | - }, | |
| 1724 | - criaBotoes : function(botoes) { | |
| 1725 | - if($i("i3GEObarraEdicao")){ | |
| 1726 | - $i("i3GEObarraEdicao").style.display = "block"; | |
| 1727 | - return; | |
| 1728 | - } | |
| 1729 | - //cria o painel onde entrarao os icones | |
| 1730 | - i3GEOpanelEditor = document.createElement("div"); | |
| 1731 | - i3GEOpanelEditor.id = "i3GEObarraEdicao"; | |
| 1732 | - i3GEOpanelEditor.className = "olControlEditingToolbar1 noprint"; | |
| 1733 | - //cria os icones | |
| 1734 | - if (botoes.imprimir === true) { | |
| 1735 | - //i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoImprimir()); | |
| 1736 | - } | |
| 1737 | - if (botoes.grid === true) { | |
| 1738 | - //i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoGrid()); | |
| 1739 | - } | |
| 1740 | - if (botoes.novaaba === true) { | |
| 1741 | - //i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoNovaaba()); | |
| 1742 | - } | |
| 1743 | - if (botoes.procura === true) { | |
| 1744 | - //i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoProcura()); | |
| 1745 | - } | |
| 1746 | - if (botoes.pan === true) { | |
| 1747 | - //i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPan()); | |
| 1748 | - } | |
| 1749 | - if (botoes.zoombox === true) { | |
| 1750 | - //i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoZoomBox()); | |
| 1751 | - } | |
| 1752 | - if (botoes.zoomtot === true) { | |
| 1753 | - //i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoZoomTot()); | |
| 1754 | - } | |
| 1755 | - if (botoes.zoomin === true) { | |
| 1756 | - //i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoZoomIn()); | |
| 1757 | - } | |
| 1758 | - if (botoes.zoomout === true) { | |
| 1759 | - //i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoZoomOut()); | |
| 1760 | - } | |
| 1761 | - if (botoes.legenda === true) { | |
| 1762 | - //i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoLegenda()); | |
| 1763 | - } | |
| 1764 | - if (botoes.distancia === true) { | |
| 1765 | - //i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoDistancia()); | |
| 1766 | - } | |
| 1767 | - if (botoes.area === true) { | |
| 1768 | - //i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoArea()); | |
| 1769 | - } | |
| 1770 | - if (botoes.identifica === true) { | |
| 1771 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoIdentifica()); | |
| 1772 | - } | |
| 1773 | - if (botoes.linha === true) { | |
| 1774 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoLinha()); | |
| 1775 | - } | |
| 1776 | - if (botoes.ponto === true) { | |
| 1777 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPonto()); | |
| 1778 | - } | |
| 1779 | - if (botoes.poligono === true) { | |
| 1780 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPoligono()); | |
| 1781 | - } | |
| 1782 | - if (botoes.texto === true) { | |
| 1783 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoTexto()); | |
| 1784 | - } | |
| 1785 | - if (botoes.edita === true) { | |
| 1786 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoEdita()); | |
| 1787 | - } | |
| 1788 | - if (botoes.selecao === true) { | |
| 1789 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoSelecao()); | |
| 1790 | - } | |
| 1791 | - if (botoes.selecaotudo === true) { | |
| 1792 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoSelecaoTudo()); | |
| 1793 | - } | |
| 1794 | - if (botoes.apaga === true) { | |
| 1795 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoApaga()); | |
| 1796 | - } | |
| 1797 | - if (botoes.frente === true) { | |
| 1798 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoFrente()); | |
| 1799 | - } | |
| 1800 | - if (botoes.edita === true && botoes.corta === true && i3GEO.php) { | |
| 1801 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoCorta()); | |
| 1802 | - } | |
| 1803 | - if (botoes.edita === true && botoes.listag === true) { | |
| 1804 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoListaGeometrias()); | |
| 1805 | - } | |
| 1806 | - if (botoes.tools === true) { | |
| 1807 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoTools()); | |
| 1808 | - } | |
| 1809 | - if (botoes.propriedades === true) { | |
| 1810 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPropriedades()); | |
| 1811 | - } | |
| 1812 | - if (botoes.salva === true) { | |
| 1813 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoSalva()); | |
| 1814 | - } | |
| 1815 | - if (botoes.ajuda === true) { | |
| 1816 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoAjuda()); | |
| 1817 | - } | |
| 1818 | - if (botoes.fecha === true) { | |
| 1819 | - i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoFecha()); | |
| 1820 | - } | |
| 1821 | - i3GEOpanelEditor.style.width = i3GEOpanelEditor.getElementsByTagName("div").length * 33 + "px"; | |
| 1822 | - i3GEO.editorOL.mapa.getViewport().getElementsByClassName("ol-overlaycontainer-stopevent")[0].appendChild(i3GEOpanelEditor); | |
| 1823 | - }, | |
| 1824 | - removeFeaturesSel : function(){ | |
| 1825 | - var s, i, nsel, f; | |
| 1826 | - nsel = i3GEO.editorOL.idsSelecionados.length; | |
| 1827 | - s = i3GEO.desenho.layergrafico.getSource(); | |
| 1828 | - for(i=0; i<nsel; i++){ | |
| 1829 | - f = s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]); | |
| 1830 | - if(f){ | |
| 1831 | - i3GEO.editorOL.featuresBackup.push(f.clone()); | |
| 1832 | - s.removeFeature(f); | |
| 1833 | - } | |
| 1834 | - } | |
| 1835 | - i3GEO.editorOL.idsSelecionados = []; | |
| 1836 | - }, | |
| 1837 | - mudaSimbolo : function(estilo, obj) { | |
| 1838 | - var s, i, nsel, f; | |
| 1839 | - i3GEO.editorOL.simbologia[estilo] = obj.value; | |
| 1840 | - nsel = i3GEO.editorOL.idsSelecionados.length; | |
| 1841 | - s = i3GEO.desenho.layergrafico.getSource(); | |
| 1842 | - for(i=0; i<nsel; i++){ | |
| 1843 | - f = s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]); | |
| 1844 | - if(f){ | |
| 1845 | - if(estilo === "externalGraphic" || estilo === "graphicWidth" || estilo === "graphicHeight"){ | |
| 1846 | - f.setProperties({ | |
| 1847 | - src: i3GEO.editorOL.simbologia.externalGraphic, | |
| 1848 | - size: [ | |
| 1849 | - i3GEO.editorOL.simbologia.graphicWidth, | |
| 1850 | - i3GEO.editorOL.simbologia.graphicHeight | |
| 1851 | - ] | |
| 1852 | - }); | |
| 1853 | - } | |
| 1854 | - else{ | |
| 1855 | - f.setProperties({ | |
| 1856 | - fillColor: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')', | |
| 1857 | - strokeColor: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')', | |
| 1858 | - width: i3GEO.editorOL.simbologia.strokeWidth, | |
| 1859 | - fontSize: i3GEO.editorOL.simbologia.fontSize, | |
| 1860 | - fontColor: i3GEO.editorOL.simbologia.fontColor, | |
| 1861 | - }); | |
| 1862 | - } | |
| 1863 | - } | |
| 1864 | - } | |
| 1865 | - }, | |
| 1866 | - adicionaMarcas : function() { | |
| 1867 | - if (i3GEO.editorOL.pontos.length === 0) { | |
| 1868 | - return; | |
| 1869 | - } | |
| 1870 | - var f, SHADOW_Z_INDEX = 10, MARKER_Z_INDEX = 11, layer = new OpenLayers.Layer.Vector("pontos", { | |
| 1871 | - styleMap : new OpenLayers.StyleMap({ | |
| 1872 | - externalGraphic : i3GEO.editorOL.marca, | |
| 1873 | - backgroundGraphic : "../pacotes/openlayers/img/marker_shadow.png", | |
| 1874 | - backgroundXOffset : 0, | |
| 1875 | - backgroundYOffset : -7, | |
| 1876 | - graphicZIndex : MARKER_Z_INDEX, | |
| 1877 | - backgroundGraphicZIndex : SHADOW_Z_INDEX, | |
| 1878 | - pointRadius : 10 | |
| 1879 | - }), | |
| 1880 | - isBaseLayer : false, | |
| 1881 | - rendererOptions : { | |
| 1882 | - yOrdering : true | |
| 1883 | - }, | |
| 1884 | - displayInLayerSwitcher : true, | |
| 1885 | - visibility : true | |
| 1886 | - }), index, x = [], y = [], features = []; | |
| 1887 | - for (index = 0; index < i3GEO.editorOL.pontos.length; index = index + 2) { | |
| 1888 | - x.push(i3GEO.editorOL.pontos[index]); | |
| 1889 | - y.push(i3GEO.editorOL.pontos[index + 1]); | |
| 1890 | - } | |
| 1891 | - for (index = 0; index < x.length; index++) { | |
| 1892 | - f = new OpenLayers.Geometry.Point(x[index], y[index]); | |
| 1893 | - f = i3GEO.util.projGeo2OSM(f); | |
| 1894 | - f = new OpenLayers.Feature.Vector(f); | |
| 1895 | - features.push(f); | |
| 1896 | - } | |
| 1897 | - layer.addFeatures(features); | |
| 1898 | - i3GEO.editorOL.mapa.addLayer(layer); | |
| 1899 | - }, | |
| 1900 | - adicionaKml : function() { | |
| 1901 | - var temp, n, i, id, url; | |
| 1902 | - n = i3GEO.editorOL.kml.length; | |
| 1903 | - for (i = 0; i < n; i++) { | |
| 1904 | - id = "kml" + i; | |
| 1905 | - url = i3GEO.editorOL.kml[i]; | |
| 1906 | - eval(id + " = new OpenLayers.Layer.Vector('" | |
| 1907 | - + id | |
| 1908 | - + "', {displayOutsideMaxExtent:true,displayInLayerSwitcher:false,visibility:true, strategies: [new OpenLayers.Strategy.Fixed()],protocol: new OpenLayers.Protocol.HTTP({url: '" | |
| 1909 | - + url | |
| 1910 | - + "',format: new OpenLayers.Format.KML({extractStyles: true,extractAttributes: true,maxDepth: 5})})})"); | |
| 1911 | - eval("i3GEO.editorOL.mapa.addLayer(" + id + ");"); | |
| 1912 | - eval("temp = " + id + ".div;"); | |
| 1913 | - temp.onclick = | |
| 1914 | - function(e) { | |
| 1915 | - var targ = "", id, temp, features, n, i, g, html = ""; | |
| 1916 | - if (!e) { | |
| 1917 | - e = window.event; | |
| 1918 | - } | |
| 1919 | - if (e.target) { | |
| 1920 | - targ = e.target; | |
| 1921 | - } else { | |
| 1922 | - if (e.srcElement) { | |
| 1923 | - targ = e.srcElement; | |
| 1924 | - } | |
| 1925 | - } | |
| 1926 | - if (targ.id) { | |
| 1927 | - temp = targ.id.split("_"); | |
| 1928 | - if (temp[0] === "OpenLayers.Geometry.Point") { | |
| 1929 | - id = targ.id; | |
| 1930 | - temp = i3GEO.editorOL.mapa.getLayer(this.id); | |
| 1931 | - features = temp.features; | |
| 1932 | - n = features.length; | |
| 1933 | - for (i = 0; i < n; i++) { | |
| 1934 | - if (features[i].geometry.id === id) { | |
| 1935 | - for ( var j in features[i].attributes) { | |
| 1936 | - html += j + ": " + features[i].attributes[j]; | |
| 1937 | - } | |
| 1938 | - g = features[i].geometry; | |
| 1939 | - i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud( | |
| 1940 | - "kml", | |
| 1941 | - new OpenLayers.LonLat(g.x, g.y), | |
| 1942 | - null, | |
| 1943 | - html, | |
| 1944 | - null, | |
| 1945 | - true)); | |
| 1946 | - } | |
| 1947 | - } | |
| 1948 | - } | |
| 1949 | - } | |
| 1950 | - }; | |
| 1951 | - } | |
| 1952 | - }, | |
| 1953 | - // obtido de openlayers.org | |
| 1954 | - propriedades : function() { | |
| 1955 | - if(i3GEO.editorOL.MUSTACHEPROPRIEDADES == ""){ | |
| 1956 | - $.get(i3GEO.configura.locaplic + "/ferramentas/editorol/templatePropriedades_mst.html", function(template) { | |
| 1957 | - i3GEO.editorOL.MUSTACHEPROPRIEDADES = template; | |
| 1958 | - i3GEO.editorOL.propriedades(); | |
| 1959 | - }); | |
| 1960 | - return; | |
| 1961 | - } | |
| 1962 | - if (!document.getElementById("panelpropriedadesEditor")) { | |
| 1963 | - YAHOO.namespace("editorOL.container"); | |
| 1964 | - YAHOO.editorOL.container.panel = new YAHOO.widget.Panel("panelpropriedadesEditor", { | |
| 1965 | - iframe : true, | |
| 1966 | - width : "350px", | |
| 1967 | - height : "300px", | |
| 1968 | - overflow: "auto", | |
| 1969 | - visible : false, | |
| 1970 | - draggable : true, | |
| 1971 | - close : true | |
| 1972 | - }); | |
| 1667 | + //xy = evt.target.downPx_; | |
| 1668 | + xy = evt.feature.getGeometry().getFirstCoordinate(); | |
| 1669 | + retorno = function(r){ | |
| 1670 | + var valorunico = "", camada = null, texto = "", lonlattexto, xy, temp, temp1, n, i, f = [], textoN = r.split(":"); | |
| 1671 | + if(i3GEO.arvoreDeCamadas){ | |
| 1672 | + camada = i3GEO.arvoreDeCamadas.pegaTema(tema.value, "", "name"); | |
| 1673 | + } | |
| 1674 | + xy = evt.feature.getGeometry().getFirstCoordinate(); | |
| 1675 | + i3GEO.eventos.cliquePerm.ativo = true; | |
| 1676 | + try { | |
| 1677 | + if (textoN.length > 1) { | |
| 1678 | + textoN.shift(); | |
| 1679 | + textoN.shift(); | |
| 1680 | + temp = textoN.join(":"); | |
| 1681 | + temp = temp.replace(/'/g, ""); | |
| 1682 | + temp = temp.replace(/\n/g, "|"); | |
| 1683 | + temp = temp.replace(/_/g, " "); | |
| 1684 | + //temp = temp.replace(/=/g, ":"); | |
| 1685 | + temp = temp.split("|"); | |
| 1686 | + n = temp.length; | |
| 1687 | + for (i = 0; i < n; i++) { | |
| 1688 | + temp1 = temp[i].replace(/^\s+/, ""); | |
| 1689 | + temp1 = temp1.replace(/\s+$/, ""); | |
| 1690 | + if (temp1 != ""){ | |
| 1691 | + //verifica se a coluna eh o idunico e pega o valor | |
| 1692 | + if(camada && camada.colunaidunico != "" && temp1.split("=")[0].trim() == camada.colunaidunico){ | |
| 1693 | + valorunico = temp1.split("=")[1].trim(); | |
| 1694 | + temp1 = "(*) "+temp1; | |
| 1695 | + } | |
| 1696 | + f.push(temp1); | |
| 1697 | + } | |
| 1698 | + } | |
| 1699 | + texto = "<pre>" + f.join("<br>") + "</pre>"; | |
| 1700 | + } | |
| 1701 | + } catch (e) {} | |
| 1702 | + //funcao para capturar a geometria | |
| 1703 | + lonlattexto = | |
| 1704 | + "<span style=font-size:12px;color:blue;cursor:pointer onclick='i3GEO.editorOL.captura(" + xy[0] | |
| 1705 | + + "," | |
| 1706 | + + xy[1] | |
| 1707 | + + ",\"" | |
| 1708 | + + tema.value | |
| 1709 | + + "\"" | |
| 1710 | + + ",\"" | |
| 1711 | + + valorunico | |
| 1712 | + + "\")'>edita geometria</span><br>"; | |
| 1713 | + i3GEO.Interface.openlayers.balao("<div style='text-align:left' >" + lonlattexto + texto + "</div>","", xy[0], xy[1], false, false); | |
| 1714 | + i3GEO.eventos.cliquePerm.ativo = false; | |
| 1715 | + }; | |
| 1716 | + p = i3GEO.configura.locaplic + "/classesphp/proxy.php?" | |
| 1717 | + + url | |
| 1718 | + + "&tipoRetornoProxy=string&REQUEST=GetFeatureInfo&TIPOIMAGEM=nenhum&DESLIGACACHE=sim&STYLES=&SERVICE=WMS&VERSION=1.1.1&FEATURE_COUNT=1" | |
| 1719 | + + "&FORMAT=image/png&INFO_FORMAT=text/plain&SRS=EPSG:4326" | |
| 1720 | + + "&LAYERS=" + tema.value | |
| 1721 | + + "&layer=" + tema.value | |
| 1722 | + + "&QUERY_LAYERS=" + tema.value | |
| 1723 | + + "&HEIGHT=" + i3geoOL.getSize()[1] | |
| 1724 | + + "&WIDTH=" + i3geoOL.getSize()[0] | |
| 1725 | + + "&BBOX=" + i3geoOL.getExtent().toBBOX().split(",").join(" ") | |
| 1726 | + + "&X=" + xy[0] + "&Y=" + xy[1]; | |
| 1727 | + cpJSON.call(p, "foo", retorno, ""); | |
| 1728 | + } | |
| 1729 | + }); | |
| 1730 | + i3geoOL.addInteraction(draw); | |
| 1731 | + }; | |
| 1732 | + return temp; | |
| 1733 | + }, | |
| 1734 | + botaoSalva: function(){ | |
| 1735 | + var temp = document.createElement("div"); | |
| 1736 | + temp.className = "editorOLsalvaItemInactive olButton"; | |
| 1737 | + temp.title = $trad("salva"); | |
| 1738 | + temp.onclick = function(){ | |
| 1739 | + i3GEO.editorOL.salvaGeometrias(); | |
| 1740 | + }; | |
| 1741 | + return temp; | |
| 1742 | + }, | |
| 1743 | + criaBotoes : function(botoes) { | |
| 1744 | + if($i("i3GEObarraEdicao")){ | |
| 1745 | + $i("i3GEObarraEdicao").style.display = "block"; | |
| 1746 | + return; | |
| 1747 | + } | |
| 1748 | + //cria o painel onde entrarao os icones | |
| 1749 | + i3GEOpanelEditor = document.createElement("div"); | |
| 1750 | + i3GEOpanelEditor.id = "i3GEObarraEdicao"; | |
| 1751 | + i3GEOpanelEditor.className = "olControlEditingToolbar1 noprint"; | |
| 1752 | + //cria os icones | |
| 1753 | + if (botoes.imprimir === true) { | |
| 1754 | + //i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoImprimir()); | |
| 1755 | + } | |
| 1756 | + if (botoes.grid === true) { | |
| 1757 | + //i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoGrid()); | |
| 1758 | + } | |
| 1759 | + if (botoes.novaaba === true) { | |
| 1760 | + //i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoNovaaba()); | |
| 1761 | + } | |
| 1762 | + if (botoes.procura === true) { | |
| 1763 | + //i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoProcura()); | |
| 1764 | + } | |
| 1765 | + if (botoes.pan === true) { | |
| 1766 | + //i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPan()); | |
| 1767 | + } | |
| 1768 | + if (botoes.zoombox === true) { | |
| 1769 | + //i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoZoomBox()); | |
| 1770 | + } | |
| 1771 | + if (botoes.zoomtot === true) { | |
| 1772 | + //i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoZoomTot()); | |
| 1773 | + } | |
| 1774 | + if (botoes.zoomin === true) { | |
| 1775 | + //i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoZoomIn()); | |
| 1776 | + } | |
| 1777 | + if (botoes.zoomout === true) { | |
| 1778 | + //i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoZoomOut()); | |
| 1779 | + } | |
| 1780 | + if (botoes.legenda === true) { | |
| 1781 | + //i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoLegenda()); | |
| 1782 | + } | |
| 1783 | + if (botoes.distancia === true) { | |
| 1784 | + //i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoDistancia()); | |
| 1785 | + } | |
| 1786 | + if (botoes.area === true) { | |
| 1787 | + //i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoArea()); | |
| 1788 | + } | |
| 1789 | + if (botoes.identifica === true) { | |
| 1790 | + i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoIdentifica()); | |
| 1791 | + } | |
| 1792 | + if (botoes.linha === true) { | |
| 1793 | + i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoLinha()); | |
| 1794 | + } | |
| 1795 | + if (botoes.ponto === true) { | |
| 1796 | + i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPonto()); | |
| 1797 | + } | |
| 1798 | + if (botoes.poligono === true) { | |
| 1799 | + i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPoligono()); | |
| 1800 | + } | |
| 1801 | + if (botoes.texto === true) { | |
| 1802 | + i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoTexto()); | |
| 1803 | + } | |
| 1804 | + if (botoes.edita === true) { | |
| 1805 | + i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoEdita()); | |
| 1806 | + } | |
| 1807 | + if (botoes.selecao === true) { | |
| 1808 | + i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoSelecao()); | |
| 1809 | + } | |
| 1810 | + if (botoes.selecaotudo === true) { | |
| 1811 | + i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoSelecaoTudo()); | |
| 1812 | + } | |
| 1813 | + if (botoes.apaga === true) { | |
| 1814 | + i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoApaga()); | |
| 1815 | + } | |
| 1816 | + if (botoes.frente === true) { | |
| 1817 | + i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoFrente()); | |
| 1818 | + } | |
| 1819 | + if (botoes.edita === true && botoes.corta === true && i3GEO.php) { | |
| 1820 | + i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoCorta()); | |
| 1821 | + } | |
| 1822 | + if (botoes.edita === true && botoes.listag === true) { | |
| 1823 | + i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoListaGeometrias()); | |
| 1824 | + } | |
| 1825 | + if (botoes.tools === true) { | |
| 1826 | + i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoTools()); | |
| 1827 | + } | |
| 1828 | + if (botoes.propriedades === true) { | |
| 1829 | + i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPropriedades()); | |
| 1830 | + } | |
| 1831 | + if (botoes.salva === true) { | |
| 1832 | + i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoSalva()); | |
| 1833 | + } | |
| 1834 | + if (botoes.ajuda === true) { | |
| 1835 | + i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoAjuda()); | |
| 1836 | + } | |
| 1837 | + if (botoes.fecha === true) { | |
| 1838 | + i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoFecha()); | |
| 1839 | + } | |
| 1840 | + i3GEOpanelEditor.style.width = i3GEOpanelEditor.getElementsByTagName("div").length * 33 + "px"; | |
| 1841 | + i3GEO.editorOL.mapa.getViewport().getElementsByClassName("ol-overlaycontainer-stopevent")[0].appendChild(i3GEOpanelEditor); | |
| 1842 | + }, | |
| 1843 | + removeFeaturesSel : function(){ | |
| 1844 | + var s, i, nsel, f; | |
| 1845 | + nsel = i3GEO.editorOL.idsSelecionados.length; | |
| 1846 | + s = i3GEO.desenho.layergrafico.getSource(); | |
| 1847 | + for(i=0; i<nsel; i++){ | |
| 1848 | + f = s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]); | |
| 1849 | + if(f){ | |
| 1850 | + i3GEO.editorOL.featuresBackup.push(f.clone()); | |
| 1851 | + s.removeFeature(f); | |
| 1852 | + } | |
| 1853 | + } | |
| 1854 | + i3GEO.editorOL.idsSelecionados = []; | |
| 1855 | + }, | |
| 1856 | + mudaSimbolo : function(estilo, obj) { | |
| 1857 | + var s, i, nsel, f; | |
| 1858 | + i3GEO.editorOL.simbologia[estilo] = obj.value; | |
| 1859 | + nsel = i3GEO.editorOL.idsSelecionados.length; | |
| 1860 | + s = i3GEO.desenho.layergrafico.getSource(); | |
| 1861 | + for(i=0; i<nsel; i++){ | |
| 1862 | + f = s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]); | |
| 1863 | + if(f){ | |
| 1864 | + if(estilo === "externalGraphic" || estilo === "graphicWidth" || estilo === "graphicHeight"){ | |
| 1865 | + f.setProperties({ | |
| 1866 | + src: i3GEO.editorOL.simbologia.externalGraphic, | |
| 1867 | + size: [ | |
| 1868 | + i3GEO.editorOL.simbologia.graphicWidth, | |
| 1869 | + i3GEO.editorOL.simbologia.graphicHeight | |
| 1870 | + ] | |
| 1871 | + }); | |
| 1872 | + } | |
| 1873 | + else{ | |
| 1874 | + f.setProperties({ | |
| 1875 | + fillColor: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')', | |
| 1876 | + strokeColor: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')', | |
| 1877 | + width: i3GEO.editorOL.simbologia.strokeWidth, | |
| 1878 | + fontSize: i3GEO.editorOL.simbologia.fontSize, | |
| 1879 | + fontColor: i3GEO.editorOL.simbologia.fontColor, | |
| 1880 | + }); | |
| 1881 | + } | |
| 1882 | + } | |
| 1883 | + } | |
| 1884 | + }, | |
| 1885 | + adicionaMarcas : function() { | |
| 1886 | + if (i3GEO.editorOL.pontos.length === 0) { | |
| 1887 | + return; | |
| 1888 | + } | |
| 1889 | + var f, SHADOW_Z_INDEX = 10, MARKER_Z_INDEX = 11, layer = new OpenLayers.Layer.Vector("pontos", { | |
| 1890 | + styleMap : new OpenLayers.StyleMap({ | |
| 1891 | + externalGraphic : i3GEO.editorOL.marca, | |
| 1892 | + backgroundGraphic : "../pacotes/openlayers/img/marker_shadow.png", | |
| 1893 | + backgroundXOffset : 0, | |
| 1894 | + backgroundYOffset : -7, | |
| 1895 | + graphicZIndex : MARKER_Z_INDEX, | |
| 1896 | + backgroundGraphicZIndex : SHADOW_Z_INDEX, | |
| 1897 | + pointRadius : 10 | |
| 1898 | + }), | |
| 1899 | + isBaseLayer : false, | |
| 1900 | + rendererOptions : { | |
| 1901 | + yOrdering : true | |
| 1902 | + }, | |
| 1903 | + displayInLayerSwitcher : true, | |
| 1904 | + visibility : true | |
| 1905 | + }), index, x = [], y = [], features = []; | |
| 1906 | + for (index = 0; index < i3GEO.editorOL.pontos.length; index = index + 2) { | |
| 1907 | + x.push(i3GEO.editorOL.pontos[index]); | |
| 1908 | + y.push(i3GEO.editorOL.pontos[index + 1]); | |
| 1909 | + } | |
| 1910 | + for (index = 0; index < x.length; index++) { | |
| 1911 | + f = new OpenLayers.Geometry.Point(x[index], y[index]); | |
| 1912 | + f = i3GEO.util.projGeo2OSM(f); | |
| 1913 | + f = new OpenLayers.Feature.Vector(f); | |
| 1914 | + features.push(f); | |
| 1915 | + } | |
| 1916 | + layer.addFeatures(features); | |
| 1917 | + i3GEO.editorOL.mapa.addLayer(layer); | |
| 1918 | + }, | |
| 1919 | + adicionaKml : function() { | |
| 1920 | + var temp, n, i, id, url; | |
| 1921 | + n = i3GEO.editorOL.kml.length; | |
| 1922 | + for (i = 0; i < n; i++) { | |
| 1923 | + id = "kml" + i; | |
| 1924 | + url = i3GEO.editorOL.kml[i]; | |
| 1925 | + eval(id + " = new OpenLayers.Layer.Vector('" | |
| 1926 | + + id | |
| 1927 | + + "', {displayOutsideMaxExtent:true,displayInLayerSwitcher:false,visibility:true, strategies: [new OpenLayers.Strategy.Fixed()],protocol: new OpenLayers.Protocol.HTTP({url: '" | |
| 1928 | + + url | |
| 1929 | + + "',format: new OpenLayers.Format.KML({extractStyles: true,extractAttributes: true,maxDepth: 5})})})"); | |
| 1930 | + eval("i3GEO.editorOL.mapa.addLayer(" + id + ");"); | |
| 1931 | + eval("temp = " + id + ".div;"); | |
| 1932 | + temp.onclick = | |
| 1933 | + function(e) { | |
| 1934 | + var targ = "", id, temp, features, n, i, g, html = ""; | |
| 1935 | + if (!e) { | |
| 1936 | + e = window.event; | |
| 1937 | + } | |
| 1938 | + if (e.target) { | |
| 1939 | + targ = e.target; | |
| 1940 | + } else { | |
| 1941 | + if (e.srcElement) { | |
| 1942 | + targ = e.srcElement; | |
| 1943 | + } | |
| 1944 | + } | |
| 1945 | + if (targ.id) { | |
| 1946 | + temp = targ.id.split("_"); | |
| 1947 | + if (temp[0] === "OpenLayers.Geometry.Point") { | |
| 1948 | + id = targ.id; | |
| 1949 | + temp = i3GEO.editorOL.mapa.getLayer(this.id); | |
| 1950 | + features = temp.features; | |
| 1951 | + n = features.length; | |
| 1952 | + for (i = 0; i < n; i++) { | |
| 1953 | + if (features[i].geometry.id === id) { | |
| 1954 | + for ( var j in features[i].attributes) { | |
| 1955 | + html += j + ": " + features[i].attributes[j]; | |
| 1956 | + } | |
| 1957 | + g = features[i].geometry; | |
| 1958 | + i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud( | |
| 1959 | + "kml", | |
| 1960 | + new OpenLayers.LonLat(g.x, g.y), | |
| 1961 | + null, | |
| 1962 | + html, | |
| 1963 | + null, | |
| 1964 | + true)); | |
| 1965 | + } | |
| 1966 | + } | |
| 1967 | + } | |
| 1968 | + } | |
| 1969 | + }; | |
| 1970 | + } | |
| 1971 | + }, | |
| 1972 | + // obtido de openlayers.org | |
| 1973 | + propriedades : function() { | |
| 1974 | + if(i3GEO.editorOL.MUSTACHEPROPRIEDADES == ""){ | |
| 1975 | + $.get(i3GEO.configura.locaplic + "/ferramentas/editorol/templatePropriedades_mst.html", function(template) { | |
| 1976 | + i3GEO.editorOL.MUSTACHEPROPRIEDADES = template; | |
| 1977 | + i3GEO.editorOL.propriedades(); | |
| 1978 | + }); | |
| 1979 | + return; | |
| 1980 | + } | |
| 1981 | + if (!document.getElementById("panelpropriedadesEditor")) { | |
| 1982 | + YAHOO.namespace("editorOL.container"); | |
| 1983 | + YAHOO.editorOL.container.panel = new YAHOO.widget.Panel("panelpropriedadesEditor", { | |
| 1984 | + iframe : true, | |
| 1985 | + width : "350px", | |
| 1986 | + height : "300px", | |
| 1987 | + overflow: "auto", | |
| 1988 | + visible : false, | |
| 1989 | + draggable : true, | |
| 1990 | + close : true | |
| 1991 | + }); | |
| 1973 | 1992 | |
| 1974 | - var ins = Mustache.render(i3GEO.editorOL.MUSTACHEPROPRIEDADES, i3GEO.editorOL.simbologia); | |
| 1975 | - //TODO traduzir | |
| 1976 | - YAHOO.editorOL.container.panel.setBody(ins); | |
| 1993 | + var ins = Mustache.render(i3GEO.editorOL.MUSTACHEPROPRIEDADES, i3GEO.editorOL.simbologia); | |
| 1994 | + //TODO traduzir | |
| 1995 | + YAHOO.editorOL.container.panel.setBody(ins); | |
| 1977 | 1996 | |
| 1978 | 1997 | |
| 1979 | - //TODO implementar ao atualizar OL3 | |
| 1980 | - /* | |
| 1998 | + //TODO implementar ao atualizar OL3 | |
| 1999 | + /* | |
| 1981 | 2000 | + '<br />' |
| 1982 | 2001 | + '<p class=paragrafo ><b>Ajusta nó em edição para o(a):</b></p>' |
| 1983 | 2002 | + '<table class=lista7 >' |
| ... | ... | @@ -2010,589 +2029,589 @@ i3GEO.editorOL = |
| 2010 | 2029 | + ' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.DRAG;" type="radio" name=i3geoOLtipoEdita /></td><td>desloca</td>' |
| 2011 | 2030 | + ' </tr>' |
| 2012 | 2031 | + '</table>'; |
| 2013 | - */ | |
| 2032 | + */ | |
| 2014 | 2033 | |
| 2015 | 2034 | |
| 2016 | - if (i3GEO && typeof i3GEO != undefined && i3GEO != "") { | |
| 2017 | - YAHOO.editorOL.container.panel | |
| 2018 | - .setHeader("<span class='i3GeoTituloJanelaBsNolink'>Propriedades</span>"); | |
| 2019 | - } else { | |
| 2020 | - YAHOO.editorOL.container.panel.setHeader("Propriedades"); | |
| 2021 | - } | |
| 2035 | + if (i3GEO && typeof i3GEO != undefined && i3GEO != "") { | |
| 2036 | + YAHOO.editorOL.container.panel | |
| 2037 | + .setHeader("<span class='i3GeoTituloJanelaBsNolink'>Propriedades</span>"); | |
| 2038 | + } else { | |
| 2039 | + YAHOO.editorOL.container.panel.setHeader("Propriedades"); | |
| 2040 | + } | |
| 2022 | 2041 | |
| 2023 | - YAHOO.editorOL.container.panel.setFooter(""); | |
| 2024 | - YAHOO.editorOL.container.panel.render(document.body); | |
| 2042 | + YAHOO.editorOL.container.panel.setFooter(""); | |
| 2043 | + YAHOO.editorOL.container.panel.render(document.body); | |
| 2025 | 2044 | |
| 2026 | - YAHOO.editorOL.container.panel.center(); | |
| 2027 | - YAHOO.util.Event.addListener(YAHOO.editorOL.container.panel.close, "click", function() { | |
| 2028 | - }); | |
| 2029 | - i3GEO.util.aplicaAquarela("panelpropriedadesEditor"); | |
| 2030 | - } | |
| 2031 | - YAHOO.editorOL.container.panel.show(); | |
| 2032 | - temp = $i("panelpropriedadesEditor").getElementsByTagName("div"); | |
| 2033 | - if (temp && temp[2]) { | |
| 2034 | - temp[2].style.overflow = "auto"; | |
| 2035 | - } | |
| 2036 | - }, | |
| 2037 | - listaGeometrias : function() { | |
| 2038 | - if (!document.getElementById("panellistagEditor")) { | |
| 2039 | - YAHOO.namespace("editorOL.listaGeometrias"); | |
| 2040 | - YAHOO.editorOL.listaGeometrias.panel = new YAHOO.widget.Panel("panellistagEditor", { | |
| 2041 | - iframe : true, | |
| 2042 | - width : "380px", | |
| 2043 | - height : "300px", | |
| 2044 | - overflow: "auto", | |
| 2045 | - visible : false, | |
| 2046 | - draggable : true, | |
| 2047 | - close : true | |
| 2048 | - }); | |
| 2049 | - if (i3GEO && typeof i3GEO != undefined && i3GEO != "") { | |
| 2050 | - YAHOO.editorOL.listaGeometrias.panel | |
| 2051 | - .setHeader("<span class='i3GeoTituloJanelaBsNolink' >" + $trad("u6") + "</span>" ); | |
| 2052 | - } else { | |
| 2053 | - YAHOO.editorOL.listaGeometrias.panel.setHeader($trad("u6")); | |
| 2054 | - } | |
| 2055 | - YAHOO.editorOL.listaGeometrias.panel.setFooter(""); | |
| 2056 | - YAHOO.editorOL.listaGeometrias.panel.render(document.body); | |
| 2057 | - YAHOO.editorOL.listaGeometrias.panel.center(); | |
| 2058 | - YAHOO.util.Event.addListener(YAHOO.editorOL.listaGeometrias.panel.close, "click", function() { | |
| 2059 | - YAHOO.editorOL.listaGeometrias.panel.destroy(); | |
| 2060 | - }); | |
| 2061 | - } else { | |
| 2062 | - YAHOO.editorOL.listaGeometrias.panel.render(document.body); | |
| 2063 | - } | |
| 2064 | - var id, temp, geos = i3GEO.desenho.layergrafico.getSource().getFeatures(), n = geos.length, ins = ""; | |
| 2065 | - ins += '<div class="container-fluid" style="height:210px;overflow:auto">'; | |
| 2066 | - while (n > 0) { | |
| 2067 | - n -= 1; | |
| 2068 | - id = geos[n].getId(); | |
| 2069 | - if(id){ | |
| 2070 | - ins += '<h5>' | |
| 2071 | - + '<button title="Unsel" onclick="i3GEO.editorOL.unselFeature(\'' + id + '\')" class="btn btn-xs" style="margin:2px;padding:2px;"><span class="material-icons">clear</span></button>' | |
| 2072 | - + '<a title="Sel" onclick="i3GEO.editorOL.selFeature(\'' + id + '\')" href="javascript:void(0)">' | |
| 2073 | - + id + "</a></h5>"; | |
| 2074 | - } | |
| 2075 | - } | |
| 2076 | - ins += "</div>"; | |
| 2077 | - if (geos.length === 0) { | |
| 2078 | - ins = '<div class="container-fluid" >' + $trad("meneditor2") + "</div>"; | |
| 2079 | - } | |
| 2080 | - YAHOO.editorOL.listaGeometrias.panel.setBody(ins); | |
| 2081 | - YAHOO.editorOL.listaGeometrias.panel.show(); | |
| 2045 | + YAHOO.editorOL.container.panel.center(); | |
| 2046 | + YAHOO.util.Event.addListener(YAHOO.editorOL.container.panel.close, "click", function() { | |
| 2047 | + }); | |
| 2048 | + i3GEO.util.aplicaAquarela("panelpropriedadesEditor"); | |
| 2049 | + } | |
| 2050 | + YAHOO.editorOL.container.panel.show(); | |
| 2051 | + temp = $i("panelpropriedadesEditor").getElementsByTagName("div"); | |
| 2052 | + if (temp && temp[2]) { | |
| 2053 | + temp[2].style.overflow = "auto"; | |
| 2054 | + } | |
| 2055 | + }, | |
| 2056 | + listaGeometrias : function() { | |
| 2057 | + if (!document.getElementById("panellistagEditor")) { | |
| 2058 | + YAHOO.namespace("editorOL.listaGeometrias"); | |
| 2059 | + YAHOO.editorOL.listaGeometrias.panel = new YAHOO.widget.Panel("panellistagEditor", { | |
| 2060 | + iframe : true, | |
| 2061 | + width : "380px", | |
| 2062 | + height : "300px", | |
| 2063 | + overflow: "auto", | |
| 2064 | + visible : false, | |
| 2065 | + draggable : true, | |
| 2066 | + close : true | |
| 2067 | + }); | |
| 2068 | + if (i3GEO && typeof i3GEO != undefined && i3GEO != "") { | |
| 2069 | + YAHOO.editorOL.listaGeometrias.panel | |
| 2070 | + .setHeader("<span class='i3GeoTituloJanelaBsNolink' >" + $trad("u6") + "</span>" ); | |
| 2071 | + } else { | |
| 2072 | + YAHOO.editorOL.listaGeometrias.panel.setHeader($trad("u6")); | |
| 2073 | + } | |
| 2074 | + YAHOO.editorOL.listaGeometrias.panel.setFooter(""); | |
| 2075 | + YAHOO.editorOL.listaGeometrias.panel.render(document.body); | |
| 2076 | + YAHOO.editorOL.listaGeometrias.panel.center(); | |
| 2077 | + YAHOO.util.Event.addListener(YAHOO.editorOL.listaGeometrias.panel.close, "click", function() { | |
| 2078 | + YAHOO.editorOL.listaGeometrias.panel.destroy(); | |
| 2079 | + }); | |
| 2080 | + } else { | |
| 2081 | + YAHOO.editorOL.listaGeometrias.panel.render(document.body); | |
| 2082 | + } | |
| 2083 | + var id, temp, geos = i3GEO.desenho.layergrafico.getSource().getFeatures(), n = geos.length, ins = ""; | |
| 2084 | + ins += '<div class="container-fluid" style="height:210px;overflow:auto">'; | |
| 2085 | + while (n > 0) { | |
| 2086 | + n -= 1; | |
| 2087 | + id = geos[n].getId(); | |
| 2088 | + if(id){ | |
| 2089 | + ins += '<h5>' | |
| 2090 | + + '<button title="Unsel" onclick="i3GEO.editorOL.unselFeature(\'' + id + '\')" class="btn btn-xs" style="margin:2px;padding:2px;"><span class="material-icons">clear</span></button>' | |
| 2091 | + + '<a title="Sel" onclick="i3GEO.editorOL.selFeature(\'' + id + '\')" href="javascript:void(0)">' | |
| 2092 | + + id + "</a></h5>"; | |
| 2093 | + } | |
| 2094 | + } | |
| 2095 | + ins += "</div>"; | |
| 2096 | + if (geos.length === 0) { | |
| 2097 | + ins = '<div class="container-fluid" >' + $trad("meneditor2") + "</div>"; | |
| 2098 | + } | |
| 2099 | + YAHOO.editorOL.listaGeometrias.panel.setBody(ins); | |
| 2100 | + YAHOO.editorOL.listaGeometrias.panel.show(); | |
| 2082 | 2101 | |
| 2083 | - }, | |
| 2084 | - ferramentas : function() { | |
| 2085 | - if(i3GEO.editorOL.MUSTACHEFERRAMENTAS == ""){ | |
| 2086 | - $.get(i3GEO.configura.locaplic + "/ferramentas/editorol/templateFerramentas_mst.html", function(template) { | |
| 2087 | - i3GEO.editorOL.MUSTACHEFERRAMENTAS = template; | |
| 2088 | - i3GEO.editorOL.ferramentas(); | |
| 2089 | - }); | |
| 2090 | - return; | |
| 2091 | - } | |
| 2092 | - var b, ins; | |
| 2093 | - if (!document.getElementById("panelferramentasEditor")) { | |
| 2094 | - YAHOO.namespace("editorOL.ferramentas"); | |
| 2095 | - YAHOO.editorOL.ferramentas.panel = new YAHOO.widget.Panel("panelferramentasEditor", { | |
| 2096 | - zIndex : 20000, | |
| 2097 | - iframe : true, | |
| 2098 | - width : "300px", | |
| 2099 | - visible : false, | |
| 2100 | - draggable : true, | |
| 2101 | - close : true | |
| 2102 | - }); | |
| 2103 | - var hash = { | |
| 2104 | - "opsel": $trad("opsel"), | |
| 2105 | - "p14": $trad("p14"), | |
| 2106 | - "hidden": "hidden" | |
| 2107 | - }; | |
| 2108 | - if (i3GEO.php) { | |
| 2109 | - hash.hidden = ""; | |
| 2110 | - } | |
| 2111 | - ins = Mustache.render(i3GEO.editorOL.MUSTACHEFERRAMENTAS, hash); | |
| 2112 | - YAHOO.editorOL.ferramentas.panel.setBody(ins); | |
| 2113 | - YAHOO.editorOL.ferramentas.panel.setHeader("<span class='i3GeoTituloJanelaBsNolink' >Ferramentas</span>"); | |
| 2102 | + }, | |
| 2103 | + ferramentas : function() { | |
| 2104 | + if(i3GEO.editorOL.MUSTACHEFERRAMENTAS == ""){ | |
| 2105 | + $.get(i3GEO.configura.locaplic + "/ferramentas/editorol/templateFerramentas_mst.html", function(template) { | |
| 2106 | + i3GEO.editorOL.MUSTACHEFERRAMENTAS = template; | |
| 2107 | + i3GEO.editorOL.ferramentas(); | |
| 2108 | + }); | |
| 2109 | + return; | |
| 2110 | + } | |
| 2111 | + var b, ins; | |
| 2112 | + if (!document.getElementById("panelferramentasEditor")) { | |
| 2113 | + YAHOO.namespace("editorOL.ferramentas"); | |
| 2114 | + YAHOO.editorOL.ferramentas.panel = new YAHOO.widget.Panel("panelferramentasEditor", { | |
| 2115 | + zIndex : 20000, | |
| 2116 | + iframe : true, | |
| 2117 | + width : "300px", | |
| 2118 | + visible : false, | |
| 2119 | + draggable : true, | |
| 2120 | + close : true | |
| 2121 | + }); | |
| 2122 | + var hash = { | |
| 2123 | + "opsel": $trad("opsel"), | |
| 2124 | + "p14": $trad("p14"), | |
| 2125 | + "hidden": "hidden" | |
| 2126 | + }; | |
| 2127 | + if (i3GEO.php) { | |
| 2128 | + hash.hidden = ""; | |
| 2129 | + } | |
| 2130 | + ins = Mustache.render(i3GEO.editorOL.MUSTACHEFERRAMENTAS, hash); | |
| 2131 | + YAHOO.editorOL.ferramentas.panel.setBody(ins); | |
| 2132 | + YAHOO.editorOL.ferramentas.panel.setHeader("<span class='i3GeoTituloJanelaBsNolink' >Ferramentas</span>"); | |
| 2114 | 2133 | |
| 2115 | - YAHOO.editorOL.ferramentas.panel.setFooter(""); | |
| 2116 | - YAHOO.editorOL.ferramentas.panel.render(document.body); | |
| 2117 | - YAHOO.editorOL.ferramentas.panel.center(); | |
| 2118 | - YAHOO.util.Event.addListener(YAHOO.editorOL.ferramentas.panel.close, "click", function() { | |
| 2119 | - }); | |
| 2134 | + YAHOO.editorOL.ferramentas.panel.setFooter(""); | |
| 2135 | + YAHOO.editorOL.ferramentas.panel.render(document.body); | |
| 2136 | + YAHOO.editorOL.ferramentas.panel.center(); | |
| 2137 | + YAHOO.util.Event.addListener(YAHOO.editorOL.ferramentas.panel.close, "click", function() { | |
| 2138 | + }); | |
| 2120 | 2139 | |
| 2121 | - } else { | |
| 2122 | - YAHOO.editorOL.ferramentas.panel.render(document.body); | |
| 2123 | - } | |
| 2124 | - YAHOO.editorOL.ferramentas.panel.show(); | |
| 2125 | - }, | |
| 2126 | - //TODO implementar ao atualizar OL3 | |
| 2127 | - snap : function() { | |
| 2128 | - var target = i3GEOOLsnap.targets[0], tipos = [ | |
| 2129 | - "node", "vertex", "edge" | |
| 2130 | - ], ntipos = tipos.length, i, temp, ativa = false; | |
| 2131 | - i3GEOOLsnap.deactivate(); | |
| 2132 | - for (i = 0; i < ntipos; i++) { | |
| 2133 | - temp = $i("target_" + tipos[i]); | |
| 2134 | - target[tipos[i]] = temp.checked; | |
| 2135 | - if (temp.checked === true) { | |
| 2136 | - ativa = true; | |
| 2137 | - } | |
| 2138 | - temp = $i("target_" + tipos[i] + "Tolerance"); | |
| 2139 | - target[tipos[i] + "Tolerance"] = temp.value; | |
| 2140 | - } | |
| 2141 | - if (ativa === true) { | |
| 2142 | - i3GEOOLsnap.activate(); | |
| 2143 | - } | |
| 2144 | - }, | |
| 2145 | - split : function() { | |
| 2146 | - i3GEOOLsplit.deactivate(); | |
| 2147 | - var temp = $i("edge_split_toggle"); | |
| 2148 | - if (temp.checked === true) { | |
| 2149 | - i3GEOOLsplit.activate(); | |
| 2150 | - } | |
| 2151 | - }, | |
| 2152 | - processageo : function(operacao) { | |
| 2153 | - if (operacao === "") { | |
| 2154 | - return; | |
| 2155 | - } | |
| 2156 | - var polis, linhas, pontos, temp, nsel = i3GEO.editorOL.idsSelecionados.length; | |
| 2157 | - if (nsel > 0) { | |
| 2158 | - temp = function(retorno) { | |
| 2159 | - if (i3GEO.janela) { | |
| 2160 | - i3GEO.janela.fechaAguarde("i3GEO.editorPoli"); | |
| 2161 | - i3GEO.janela.fechaAguarde("i3GEO.editorLinhas"); | |
| 2162 | - i3GEO.janela.fechaAguarde("i3GEO.editorPontos"); | |
| 2163 | - } | |
| 2164 | - if (retorno != "" && retorno.data && retorno.data != "" && operacao != "converteSHP") { | |
| 2165 | - i3GEO.editorOL.substituiFeaturesSel(retorno.data); | |
| 2166 | - } | |
| 2167 | - if (operacao === "converteSHP") { | |
| 2168 | - i3GEO.atualiza(); | |
| 2169 | - i3GEO.janela.minimiza("paneltemaativo"); | |
| 2170 | - } | |
| 2171 | - }; | |
| 2172 | - if (operacao === "incorporar") { | |
| 2173 | - polis = i3GEO.editorOL.retornaFeaturesTipo("Polygon"); | |
| 2174 | - linhas = i3GEO.editorOL.retornaFeaturesTipo("LineString"); | |
| 2175 | - pontos = i3GEO.editorOL.retornaFeaturesTipo("Point"); | |
| 2176 | - if (polis.length > 0) { | |
| 2177 | - temp = i3GEO.editorOL.merge(polis); | |
| 2178 | - } | |
| 2179 | - if (linhas.length > 0) { | |
| 2180 | - temp = i3GEO.editorOL.merge(linhas); | |
| 2181 | - } | |
| 2182 | - if (pontos.length > 0) { | |
| 2183 | - temp = i3GEO.editorOL.desagrupa(pontos); | |
| 2184 | - } | |
| 2185 | - if (i3GEO.mapa) { | |
| 2186 | - i3GEO.mapa.dialogo.wkt2layer(temp); | |
| 2187 | - } | |
| 2188 | - return; | |
| 2189 | - } | |
| 2190 | - if (operacao === "union" && !i3GEO.php) { | |
| 2191 | - polis = i3GEO.editorOL.retornaFeaturesTipo("Polygon"); | |
| 2192 | - linhas = i3GEO.editorOL.retornaFeaturesTipo("LineString"); | |
| 2193 | - pontos = i3GEO.editorOL.retornaFeaturesTipo("Point"); | |
| 2194 | - if (polis.length > 0) { | |
| 2195 | - temp = i3GEO.editorOL.uniaojts(polis); | |
| 2196 | - i3GEO.editorOL.substituiFeaturesSel(temp); | |
| 2197 | - } | |
| 2198 | - if (linhas.length > 0) { | |
| 2199 | - temp = i3GEO.editorOL.uniaojts(linhas); | |
| 2200 | - i3GEO.editorOL.substituiFeaturesSel(temp); | |
| 2201 | - } | |
| 2202 | - if (pontos.length > 0) { | |
| 2203 | - temp = i3GEO.editorOL.uniaojts(pontos); | |
| 2204 | - i3GEO.editorOL.substituiFeaturesSel(temp); | |
| 2205 | - } | |
| 2206 | - } else { | |
| 2207 | - polis = i3GEO.editorOL.retornaGeometriasTipo("Polygon"); | |
| 2208 | - linhas = i3GEO.editorOL.retornaGeometriasTipo("LineString"); | |
| 2209 | - pontos = i3GEO.editorOL.retornaGeometriasTipo("Point"); | |
| 2210 | - if (polis.length > 0) { | |
| 2211 | - i3GEO.janela.abreAguarde("i3GEO.editorPoli", "Poligonos"); | |
| 2212 | - i3GEO.php.funcoesGeometriasWkt(temp, polis.join("|"), operacao); | |
| 2213 | - } | |
| 2214 | - if (linhas.length > 0) { | |
| 2215 | - i3GEO.janela.abreAguarde("i3GEO.editorLinhas", "Linhas"); | |
| 2216 | - i3GEO.php.funcoesGeometriasWkt(temp, linhas.join("|"), operacao); | |
| 2217 | - } | |
| 2218 | - if (pontos.length > 0) { | |
| 2219 | - i3GEO.janela.abreAguarde("i3GEO.editorPontos", "Pontos"); | |
| 2220 | - i3GEO.php.funcoesGeometriasWkt(temp, pontos.join("|"), operacao); | |
| 2221 | - } | |
| 2222 | - } | |
| 2223 | - i3GEO.desenho.layergrafico.getSource().changed(); | |
| 2224 | - return; | |
| 2225 | - } else { | |
| 2226 | - i3GEO.janela.tempoMsg("Selecione pelo menos dois elementos"); | |
| 2227 | - } | |
| 2228 | - }, | |
| 2229 | - desagrupa : function(geoms) { | |
| 2230 | - var n = geoms.length, | |
| 2231 | - w = [], | |
| 2232 | - g, m, i, | |
| 2233 | - format = new ol.format.WKT(); | |
| 2234 | - for (i = 0; i < n; i++) { | |
| 2235 | - g = format.writeFeatures([geoms[i]]); | |
| 2236 | - m = new Wkt.Wkt(); | |
| 2237 | - m.read(g); | |
| 2238 | - w.push(m); | |
| 2239 | - } | |
| 2240 | - return w.join("\n"); | |
| 2241 | - }, | |
| 2242 | - merge : function(geoms) { | |
| 2243 | - var n = geoms.length, | |
| 2244 | - w = new Wkt.Wkt(), | |
| 2245 | - g, m, i,f, | |
| 2246 | - format = new ol.format.WKT(); | |
| 2247 | - f = format.writeFeatures([geoms[0]]); | |
| 2248 | - w.read(f); | |
| 2249 | - if (n > 1) { | |
| 2250 | - for (i = 1; i < n; i++) { | |
| 2251 | - g = format.writeFeatures([geoms[i]]); | |
| 2252 | - m = new Wkt.Wkt(); | |
| 2253 | - m.read(g); | |
| 2254 | - w.merge(m); | |
| 2255 | - } | |
| 2256 | - } | |
| 2257 | - return w.write(); | |
| 2258 | - }, | |
| 2259 | - uniaojts : function(geoms) { | |
| 2260 | - var n = geoms.length, | |
| 2261 | - fwkt = new ol.format.WKT(), | |
| 2262 | - rwkt = new jsts.io.WKTReader(), | |
| 2263 | - wwkt = new jsts.io.WKTWriter(), | |
| 2264 | - g, i, uniao; | |
| 2265 | - if (n > 1) { | |
| 2266 | - //converte em wkt | |
| 2267 | - uniao = fwkt.writeFeatures([geoms[0]]); | |
| 2268 | - //le na jsts | |
| 2269 | - uniao = rwkt.read(uniao); | |
| 2270 | - for (i = 1; i <= n; i++) { | |
| 2271 | - g = fwkt.writeFeatures([geoms[i]]); | |
| 2272 | - uniao = uniao.union(rwkt.read(g)); | |
| 2273 | - } | |
| 2274 | - //gera em wkt | |
| 2275 | - uniao = wwkt.write(uniao); | |
| 2276 | - return [ | |
| 2277 | - fwkt.readFeatures(uniao) | |
| 2278 | - ]; | |
| 2279 | - } else { | |
| 2280 | - return false; | |
| 2281 | - } | |
| 2282 | - }, | |
| 2283 | - retornaGeometriasTipo : function(tipo) { | |
| 2284 | - var n = i3GEO.editorOL.idsSelecionados.length, lista = [], i, | |
| 2285 | - s = i3GEO.desenho.layergrafico.getSource(), | |
| 2286 | - fwkt = new ol.format.WKT(); | |
| 2287 | - for (i = 0; i < n; i++) { | |
| 2288 | - f = s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]); | |
| 2289 | - if (f.getGeometry().getType() == tipo) { | |
| 2290 | - lista.push(fwkt.writeFeatures([f])); | |
| 2291 | - } | |
| 2292 | - } | |
| 2293 | - return lista; | |
| 2294 | - }, | |
| 2295 | - retornaFeaturesTipo : function(tipo) { | |
| 2296 | - var n = i3GEO.editorOL.idsSelecionados.length, lista = [], i, | |
| 2297 | - s = i3GEO.desenho.layergrafico.getSource(); | |
| 2298 | - for (i = 0; i < n; i++) { | |
| 2299 | - f = s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]); | |
| 2300 | - if (f.getGeometry().getType() == tipo) { | |
| 2301 | - lista.push(f); | |
| 2302 | - } | |
| 2303 | - } | |
| 2304 | - return lista; | |
| 2305 | - }, | |
| 2306 | - guardaBackup : function() { | |
| 2307 | - return; | |
| 2308 | - // if(!i3GEO.editorOL.backup) | |
| 2309 | - // {i3GEO.editorOL.backup = new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false});} | |
| 2310 | - // else | |
| 2311 | - // {i3GEO.editorOL.backup.removeFeatures(i3GEO.editorOL.backup.features);} | |
| 2312 | - // i3GEO.editorOL.backup.addFeatures(i3GEO.desenho.layergrafico.features); | |
| 2313 | - }, | |
| 2314 | - selTodos : function() { | |
| 2315 | - i3GEO.editorOL.unselTodos(); | |
| 2316 | - var features, n, f, i, id, st; | |
| 2317 | - features = i3GEO.desenho.layergrafico.getSource().getFeatures(); | |
| 2318 | - n = features.length; | |
| 2319 | - for (i = 0; i < n; i++) { | |
| 2320 | - f = features[i]; | |
| 2321 | - id = f.getId(); | |
| 2322 | - if(!id){ | |
| 2323 | - id = i3GEO.util.uid(); | |
| 2324 | - f.setId(id); | |
| 2325 | - } | |
| 2326 | - i3GEO.editorOL.idsSelecionados.push(id); | |
| 2327 | - st = f.getStyle(); | |
| 2328 | - //para o caso de pontos | |
| 2329 | - if(st && st.getImage()){ | |
| 2330 | - f.setStyle( | |
| 2331 | - new ol.style.Style({ | |
| 2332 | - image: new ol.style.Circle({ | |
| 2333 | - radius: i3GEO.editorOL.simbologia.pointRadius, | |
| 2334 | - fill: new ol.style.Fill({ | |
| 2335 | - color: 'rgba(255, 255, 255, 0.5)' | |
| 2336 | - }), | |
| 2337 | - stroke: new ol.style.Stroke({ | |
| 2338 | - color: 'blue', | |
| 2339 | - width: i3GEO.editorOL.simbologia.pointRadius / 3 | |
| 2340 | - }) | |
| 2341 | - }) | |
| 2342 | - }) | |
| 2343 | - ); | |
| 2344 | - if(st.getImage().getSrc){ | |
| 2345 | - f.setProperties({ | |
| 2346 | - fillColor: "", | |
| 2347 | - strokeColor: "", | |
| 2348 | - externalGraphic: st.getImage().getSrc(), | |
| 2349 | - graphicHeight : st.getImage().getSize()[1], | |
| 2350 | - graphicWidth : st.getImage().getSize()[0] | |
| 2351 | - }); | |
| 2352 | - } | |
| 2353 | - else{ | |
| 2354 | - f.setProperties({ | |
| 2355 | - fillColor: st.getImage().getFill().getColor(), | |
| 2356 | - strokeColor: st.getImage().getStroke().getColor(), | |
| 2357 | - externalGraphic: "", | |
| 2358 | - graphicHeight: "", | |
| 2359 | - graphicWidth: "" | |
| 2360 | - }); | |
| 2361 | - } | |
| 2362 | - } | |
| 2363 | - else if (st){ | |
| 2364 | - f.setProperties({ | |
| 2365 | - fillColor: st.getFill().getColor(), | |
| 2366 | - strokeColor: st.getStroke().getColor() | |
| 2367 | - }); | |
| 2368 | - st.getFill().setColor('rgba(255, 255, 255, 0.5)'); | |
| 2369 | - st.getStroke().setColor('blue'); | |
| 2370 | - } | |
| 2371 | - } | |
| 2372 | - i3GEO.desenho.layergrafico.getSource().changed(); | |
| 2373 | - }, | |
| 2374 | - unselTodos : function() { | |
| 2375 | - var i, n, f, s, st; | |
| 2376 | - s = i3GEO.desenho.layergrafico.getSource(); | |
| 2377 | - n = i3GEO.editorOL.idsSelecionados.length; | |
| 2378 | - for(i=0; i<n; i++){ | |
| 2379 | - f = s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]); | |
| 2380 | - if(f){ | |
| 2381 | - st = f.getStyle(); | |
| 2382 | - //caso de ponto | |
| 2383 | - if(st && st.getImage()){ | |
| 2384 | - if(st.getImage().getSrc || f.getProperties().externalGraphic != ""){ | |
| 2385 | - f.setStyle( | |
| 2386 | - new ol.style.Style({ | |
| 2387 | - image: new ol.style.Icon({ | |
| 2388 | - src : f.getProperties().externalGraphic, | |
| 2389 | - size : [f.getProperties().graphicWidth,f.getProperties().graphicHeight] | |
| 2390 | - }) | |
| 2391 | - }) | |
| 2392 | - ); | |
| 2393 | - } | |
| 2394 | - else{ | |
| 2395 | - f.setStyle( | |
| 2396 | - new ol.style.Style({ | |
| 2397 | - image: new ol.style.Circle({ | |
| 2398 | - radius: i3GEO.editorOL.simbologia.pointRadius, | |
| 2399 | - fill: new ol.style.Fill({ | |
| 2400 | - color: f.getProperties().fillColor | |
| 2401 | - }), | |
| 2402 | - stroke: new ol.style.Stroke({ | |
| 2403 | - color: f.getProperties().strokeColor, | |
| 2404 | - width: i3GEO.editorOL.simbologia.pointRadius / 3 | |
| 2405 | - }) | |
| 2406 | - }) | |
| 2407 | - }) | |
| 2408 | - ); | |
| 2409 | - } | |
| 2410 | - } | |
| 2411 | - else if(st){ | |
| 2412 | - st.getFill().setColor(f.getProperties().fillColor); | |
| 2413 | - st.getStroke().setColor(f.getProperties().strokeColor); | |
| 2414 | - } | |
| 2415 | - } | |
| 2416 | - } | |
| 2417 | - i3GEO.editorOL.idsSelecionados = []; | |
| 2418 | - i3GEO.desenho.layergrafico.getSource().changed(); | |
| 2419 | - }, | |
| 2420 | - unselTodosBackup : function() { | |
| 2421 | - var n, i; | |
| 2422 | - n = i3GEO.editorOL.backup.features.length; | |
| 2423 | - for (i = 0; i < n; i++) { | |
| 2424 | - i3GEO.editorOL.backup.features[i].renderIntent = "default"; | |
| 2425 | - i3GEO.editorOL.selbutton.unselect(i3GEO.editorOL.backup.features[i]); | |
| 2426 | - } | |
| 2427 | - }, | |
| 2428 | - unselFeature : function(id) { | |
| 2429 | - var f, s; | |
| 2430 | - s = i3GEO.desenho.layergrafico.getSource(); | |
| 2431 | - f = s.getFeatureById(id); | |
| 2432 | - if(f){ | |
| 2433 | - if(f.getStyle() && f.getStyle().getSrc){ | |
| 2434 | - f.getStyle().setSrc(f.getProperties().externalGraphic); | |
| 2435 | - f.getStyle().setSize([f.getProperties().graphicWidth,f.getProperties().graphicHeight]); | |
| 2436 | - } | |
| 2437 | - else{ | |
| 2438 | - f.getStyle().getFill().setColor(f.getProperties().fillColor); | |
| 2439 | - f.getStyle().getStroke().setColor(f.getProperties().strokeColor); | |
| 2440 | - } | |
| 2441 | - } | |
| 2442 | - i3GEO.editorOL.idsSelecionados.remove(id); | |
| 2443 | - i3GEO.desenho.layergrafico.getSource().changed(); | |
| 2444 | - }, | |
| 2445 | - restauraBackup : function() { | |
| 2446 | - if (i3GEO.editorOL.backup.features.length > 0) { | |
| 2447 | - i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.features); | |
| 2448 | - i3GEO.desenho.layergrafico.addFeatures(i3GEO.editorOL.backup.features); | |
| 2449 | - } | |
| 2450 | - if (document.getElementById("panellistagEditor")) { | |
| 2451 | - i3GEO.editorOL.listaGeometrias(); | |
| 2452 | - } | |
| 2453 | - // i3GEO.editorOL.backup.removeFeatures(i3GEO.editorOL.backup.features); | |
| 2454 | - }, | |
| 2455 | - substituiFeaturesSel : function(f) { | |
| 2456 | - i3GEO.editorOL.removeFeaturesSel(); | |
| 2457 | - var fwkt = new ol.format.WKT(); | |
| 2458 | - f = fwkt.readFeatures(f)[0]; | |
| 2459 | - f.setStyle( | |
| 2460 | - new ol.style.Style({ | |
| 2461 | - stroke: new ol.style.Stroke({ | |
| 2462 | - color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')', | |
| 2463 | - width: i3GEO.editorOL.simbologia.strokeWidth | |
| 2464 | - }), | |
| 2465 | - fill: new ol.style.Fill({ | |
| 2466 | - color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')' | |
| 2467 | - }) | |
| 2468 | - }) | |
| 2469 | - ); | |
| 2470 | - f.setId(i3GEO.util.uid()); | |
| 2471 | - i3GEO.desenho.layergrafico.getSource().addFeature(f); | |
| 2472 | - }, | |
| 2473 | - adicionaFeatureWkt : function(wkt, atributos) { | |
| 2474 | - var f, fwkt = new OpenLayers.Format.WKT(); | |
| 2140 | + } else { | |
| 2141 | + YAHOO.editorOL.ferramentas.panel.render(document.body); | |
| 2142 | + } | |
| 2143 | + YAHOO.editorOL.ferramentas.panel.show(); | |
| 2144 | + }, | |
| 2145 | + //TODO implementar ao atualizar OL3 | |
| 2146 | + snap : function() { | |
| 2147 | + var target = i3GEOOLsnap.targets[0], tipos = [ | |
| 2148 | + "node", "vertex", "edge" | |
| 2149 | + ], ntipos = tipos.length, i, temp, ativa = false; | |
| 2150 | + i3GEOOLsnap.deactivate(); | |
| 2151 | + for (i = 0; i < ntipos; i++) { | |
| 2152 | + temp = $i("target_" + tipos[i]); | |
| 2153 | + target[tipos[i]] = temp.checked; | |
| 2154 | + if (temp.checked === true) { | |
| 2155 | + ativa = true; | |
| 2156 | + } | |
| 2157 | + temp = $i("target_" + tipos[i] + "Tolerance"); | |
| 2158 | + target[tipos[i] + "Tolerance"] = temp.value; | |
| 2159 | + } | |
| 2160 | + if (ativa === true) { | |
| 2161 | + i3GEOOLsnap.activate(); | |
| 2162 | + } | |
| 2163 | + }, | |
| 2164 | + split : function() { | |
| 2165 | + i3GEOOLsplit.deactivate(); | |
| 2166 | + var temp = $i("edge_split_toggle"); | |
| 2167 | + if (temp.checked === true) { | |
| 2168 | + i3GEOOLsplit.activate(); | |
| 2169 | + } | |
| 2170 | + }, | |
| 2171 | + processageo : function(operacao) { | |
| 2172 | + if (operacao === "") { | |
| 2173 | + return; | |
| 2174 | + } | |
| 2175 | + var polis, linhas, pontos, temp, nsel = i3GEO.editorOL.idsSelecionados.length; | |
| 2176 | + if (nsel > 0) { | |
| 2177 | + temp = function(retorno) { | |
| 2178 | + if (i3GEO.janela) { | |
| 2179 | + i3GEO.janela.fechaAguarde("i3GEO.editorPoli"); | |
| 2180 | + i3GEO.janela.fechaAguarde("i3GEO.editorLinhas"); | |
| 2181 | + i3GEO.janela.fechaAguarde("i3GEO.editorPontos"); | |
| 2182 | + } | |
| 2183 | + if (retorno != "" && retorno.data && retorno.data != "" && operacao != "converteSHP") { | |
| 2184 | + i3GEO.editorOL.substituiFeaturesSel(retorno.data); | |
| 2185 | + } | |
| 2186 | + if (operacao === "converteSHP") { | |
| 2187 | + i3GEO.atualiza(); | |
| 2188 | + i3GEO.janela.minimiza("paneltemaativo"); | |
| 2189 | + } | |
| 2190 | + }; | |
| 2191 | + if (operacao === "incorporar") { | |
| 2192 | + polis = i3GEO.editorOL.retornaFeaturesTipo("Polygon"); | |
| 2193 | + linhas = i3GEO.editorOL.retornaFeaturesTipo("LineString"); | |
| 2194 | + pontos = i3GEO.editorOL.retornaFeaturesTipo("Point"); | |
| 2195 | + if (polis.length > 0) { | |
| 2196 | + temp = i3GEO.editorOL.merge(polis); | |
| 2197 | + } | |
| 2198 | + if (linhas.length > 0) { | |
| 2199 | + temp = i3GEO.editorOL.merge(linhas); | |
| 2200 | + } | |
| 2201 | + if (pontos.length > 0) { | |
| 2202 | + temp = i3GEO.editorOL.desagrupa(pontos); | |
| 2203 | + } | |
| 2204 | + if (i3GEO.mapa) { | |
| 2205 | + i3GEO.mapa.dialogo.wkt2layer(temp); | |
| 2206 | + } | |
| 2207 | + return; | |
| 2208 | + } | |
| 2209 | + if (operacao === "union" && !i3GEO.php) { | |
| 2210 | + polis = i3GEO.editorOL.retornaFeaturesTipo("Polygon"); | |
| 2211 | + linhas = i3GEO.editorOL.retornaFeaturesTipo("LineString"); | |
| 2212 | + pontos = i3GEO.editorOL.retornaFeaturesTipo("Point"); | |
| 2213 | + if (polis.length > 0) { | |
| 2214 | + temp = i3GEO.editorOL.uniaojts(polis); | |
| 2215 | + i3GEO.editorOL.substituiFeaturesSel(temp); | |
| 2216 | + } | |
| 2217 | + if (linhas.length > 0) { | |
| 2218 | + temp = i3GEO.editorOL.uniaojts(linhas); | |
| 2219 | + i3GEO.editorOL.substituiFeaturesSel(temp); | |
| 2220 | + } | |
| 2221 | + if (pontos.length > 0) { | |
| 2222 | + temp = i3GEO.editorOL.uniaojts(pontos); | |
| 2223 | + i3GEO.editorOL.substituiFeaturesSel(temp); | |
| 2224 | + } | |
| 2225 | + } else { | |
| 2226 | + polis = i3GEO.editorOL.retornaGeometriasTipo("Polygon"); | |
| 2227 | + linhas = i3GEO.editorOL.retornaGeometriasTipo("LineString"); | |
| 2228 | + pontos = i3GEO.editorOL.retornaGeometriasTipo("Point"); | |
| 2229 | + if (polis.length > 0) { | |
| 2230 | + i3GEO.janela.abreAguarde("i3GEO.editorPoli", "Poligonos"); | |
| 2231 | + i3GEO.php.funcoesGeometriasWkt(temp, polis.join("|"), operacao); | |
| 2232 | + } | |
| 2233 | + if (linhas.length > 0) { | |
| 2234 | + i3GEO.janela.abreAguarde("i3GEO.editorLinhas", "Linhas"); | |
| 2235 | + i3GEO.php.funcoesGeometriasWkt(temp, linhas.join("|"), operacao); | |
| 2236 | + } | |
| 2237 | + if (pontos.length > 0) { | |
| 2238 | + i3GEO.janela.abreAguarde("i3GEO.editorPontos", "Pontos"); | |
| 2239 | + i3GEO.php.funcoesGeometriasWkt(temp, pontos.join("|"), operacao); | |
| 2240 | + } | |
| 2241 | + } | |
| 2242 | + i3GEO.desenho.layergrafico.getSource().changed(); | |
| 2243 | + return; | |
| 2244 | + } else { | |
| 2245 | + i3GEO.janela.tempoMsg("Selecione pelo menos dois elementos"); | |
| 2246 | + } | |
| 2247 | + }, | |
| 2248 | + desagrupa : function(geoms) { | |
| 2249 | + var n = geoms.length, | |
| 2250 | + w = [], | |
| 2251 | + g, m, i, | |
| 2252 | + format = new ol.format.WKT(); | |
| 2253 | + for (i = 0; i < n; i++) { | |
| 2254 | + g = format.writeFeatures([geoms[i]]); | |
| 2255 | + m = new Wkt.Wkt(); | |
| 2256 | + m.read(g); | |
| 2257 | + w.push(m); | |
| 2258 | + } | |
| 2259 | + return w.join("\n"); | |
| 2260 | + }, | |
| 2261 | + merge : function(geoms) { | |
| 2262 | + var n = geoms.length, | |
| 2263 | + w = new Wkt.Wkt(), | |
| 2264 | + g, m, i,f, | |
| 2265 | + format = new ol.format.WKT(); | |
| 2266 | + f = format.writeFeatures([geoms[0]]); | |
| 2267 | + w.read(f); | |
| 2268 | + if (n > 1) { | |
| 2269 | + for (i = 1; i < n; i++) { | |
| 2270 | + g = format.writeFeatures([geoms[i]]); | |
| 2271 | + m = new Wkt.Wkt(); | |
| 2272 | + m.read(g); | |
| 2273 | + w.merge(m); | |
| 2274 | + } | |
| 2275 | + } | |
| 2276 | + return w.write(); | |
| 2277 | + }, | |
| 2278 | + uniaojts : function(geoms) { | |
| 2279 | + var n = geoms.length, | |
| 2280 | + fwkt = new ol.format.WKT(), | |
| 2281 | + rwkt = new jsts.io.WKTReader(), | |
| 2282 | + wwkt = new jsts.io.WKTWriter(), | |
| 2283 | + g, i, uniao; | |
| 2284 | + if (n > 1) { | |
| 2285 | + //converte em wkt | |
| 2286 | + uniao = fwkt.writeFeatures([geoms[0]]); | |
| 2287 | + //le na jsts | |
| 2288 | + uniao = rwkt.read(uniao); | |
| 2289 | + for (i = 1; i <= n; i++) { | |
| 2290 | + g = fwkt.writeFeatures([geoms[i]]); | |
| 2291 | + uniao = uniao.union(rwkt.read(g)); | |
| 2292 | + } | |
| 2293 | + //gera em wkt | |
| 2294 | + uniao = wwkt.write(uniao); | |
| 2295 | + return [ | |
| 2296 | + fwkt.readFeatures(uniao) | |
| 2297 | + ]; | |
| 2298 | + } else { | |
| 2299 | + return false; | |
| 2300 | + } | |
| 2301 | + }, | |
| 2302 | + retornaGeometriasTipo : function(tipo) { | |
| 2303 | + var n = i3GEO.editorOL.idsSelecionados.length, lista = [], i, | |
| 2304 | + s = i3GEO.desenho.layergrafico.getSource(), | |
| 2305 | + fwkt = new ol.format.WKT(); | |
| 2306 | + for (i = 0; i < n; i++) { | |
| 2307 | + f = s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]); | |
| 2308 | + if (f.getGeometry().getType() == tipo) { | |
| 2309 | + lista.push(fwkt.writeFeatures([f])); | |
| 2310 | + } | |
| 2311 | + } | |
| 2312 | + return lista; | |
| 2313 | + }, | |
| 2314 | + retornaFeaturesTipo : function(tipo) { | |
| 2315 | + var n = i3GEO.editorOL.idsSelecionados.length, lista = [], i, | |
| 2316 | + s = i3GEO.desenho.layergrafico.getSource(); | |
| 2317 | + for (i = 0; i < n; i++) { | |
| 2318 | + f = s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]); | |
| 2319 | + if (f.getGeometry().getType() == tipo) { | |
| 2320 | + lista.push(f); | |
| 2321 | + } | |
| 2322 | + } | |
| 2323 | + return lista; | |
| 2324 | + }, | |
| 2325 | + guardaBackup : function() { | |
| 2326 | + return; | |
| 2327 | + // if(!i3GEO.editorOL.backup) | |
| 2328 | + // {i3GEO.editorOL.backup = new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false});} | |
| 2329 | + // else | |
| 2330 | + // {i3GEO.editorOL.backup.removeFeatures(i3GEO.editorOL.backup.features);} | |
| 2331 | + // i3GEO.editorOL.backup.addFeatures(i3GEO.desenho.layergrafico.features); | |
| 2332 | + }, | |
| 2333 | + selTodos : function() { | |
| 2334 | + i3GEO.editorOL.unselTodos(); | |
| 2335 | + var features, n, f, i, id, st; | |
| 2336 | + features = i3GEO.desenho.layergrafico.getSource().getFeatures(); | |
| 2337 | + n = features.length; | |
| 2338 | + for (i = 0; i < n; i++) { | |
| 2339 | + f = features[i]; | |
| 2340 | + id = f.getId(); | |
| 2341 | + if(!id){ | |
| 2342 | + id = i3GEO.util.uid(); | |
| 2343 | + f.setId(id); | |
| 2344 | + } | |
| 2345 | + i3GEO.editorOL.idsSelecionados.push(id); | |
| 2346 | + st = f.getStyle(); | |
| 2347 | + //para o caso de pontos | |
| 2348 | + if(st && st.getImage()){ | |
| 2349 | + f.setStyle( | |
| 2350 | + new ol.style.Style({ | |
| 2351 | + image: new ol.style.Circle({ | |
| 2352 | + radius: i3GEO.editorOL.simbologia.pointRadius, | |
| 2353 | + fill: new ol.style.Fill({ | |
| 2354 | + color: 'rgba(255, 255, 255, 0.5)' | |
| 2355 | + }), | |
| 2356 | + stroke: new ol.style.Stroke({ | |
| 2357 | + color: 'blue', | |
| 2358 | + width: i3GEO.editorOL.simbologia.pointRadius / 3 | |
| 2359 | + }) | |
| 2360 | + }) | |
| 2361 | + }) | |
| 2362 | + ); | |
| 2363 | + if(st.getImage().getSrc){ | |
| 2364 | + f.setProperties({ | |
| 2365 | + fillColor: "", | |
| 2366 | + strokeColor: "", | |
| 2367 | + externalGraphic: st.getImage().getSrc(), | |
| 2368 | + graphicHeight : st.getImage().getSize()[1], | |
| 2369 | + graphicWidth : st.getImage().getSize()[0] | |
| 2370 | + }); | |
| 2371 | + } | |
| 2372 | + else{ | |
| 2373 | + f.setProperties({ | |
| 2374 | + fillColor: st.getImage().getFill().getColor(), | |
| 2375 | + strokeColor: st.getImage().getStroke().getColor(), | |
| 2376 | + externalGraphic: "", | |
| 2377 | + graphicHeight: "", | |
| 2378 | + graphicWidth: "" | |
| 2379 | + }); | |
| 2380 | + } | |
| 2381 | + } | |
| 2382 | + else if (st){ | |
| 2383 | + f.setProperties({ | |
| 2384 | + fillColor: st.getFill().getColor(), | |
| 2385 | + strokeColor: st.getStroke().getColor() | |
| 2386 | + }); | |
| 2387 | + st.getFill().setColor('rgba(255, 255, 255, 0.5)'); | |
| 2388 | + st.getStroke().setColor('blue'); | |
| 2389 | + } | |
| 2390 | + } | |
| 2391 | + i3GEO.desenho.layergrafico.getSource().changed(); | |
| 2392 | + }, | |
| 2393 | + unselTodos : function() { | |
| 2394 | + var i, n, f, s, st; | |
| 2395 | + s = i3GEO.desenho.layergrafico.getSource(); | |
| 2396 | + n = i3GEO.editorOL.idsSelecionados.length; | |
| 2397 | + for(i=0; i<n; i++){ | |
| 2398 | + f = s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]); | |
| 2399 | + if(f){ | |
| 2400 | + st = f.getStyle(); | |
| 2401 | + //caso de ponto | |
| 2402 | + if(st && st.getImage()){ | |
| 2403 | + if(st.getImage().getSrc || f.getProperties().externalGraphic != ""){ | |
| 2404 | + f.setStyle( | |
| 2405 | + new ol.style.Style({ | |
| 2406 | + image: new ol.style.Icon({ | |
| 2407 | + src : f.getProperties().externalGraphic, | |
| 2408 | + size : [f.getProperties().graphicWidth,f.getProperties().graphicHeight] | |
| 2409 | + }) | |
| 2410 | + }) | |
| 2411 | + ); | |
| 2412 | + } | |
| 2413 | + else{ | |
| 2414 | + f.setStyle( | |
| 2415 | + new ol.style.Style({ | |
| 2416 | + image: new ol.style.Circle({ | |
| 2417 | + radius: i3GEO.editorOL.simbologia.pointRadius, | |
| 2418 | + fill: new ol.style.Fill({ | |
| 2419 | + color: f.getProperties().fillColor | |
| 2420 | + }), | |
| 2421 | + stroke: new ol.style.Stroke({ | |
| 2422 | + color: f.getProperties().strokeColor, | |
| 2423 | + width: i3GEO.editorOL.simbologia.pointRadius / 3 | |
| 2424 | + }) | |
| 2425 | + }) | |
| 2426 | + }) | |
| 2427 | + ); | |
| 2428 | + } | |
| 2429 | + } | |
| 2430 | + else if(st){ | |
| 2431 | + st.getFill().setColor(f.getProperties().fillColor); | |
| 2432 | + st.getStroke().setColor(f.getProperties().strokeColor); | |
| 2433 | + } | |
| 2434 | + } | |
| 2435 | + } | |
| 2436 | + i3GEO.editorOL.idsSelecionados = []; | |
| 2437 | + i3GEO.desenho.layergrafico.getSource().changed(); | |
| 2438 | + }, | |
| 2439 | + unselTodosBackup : function() { | |
| 2440 | + var n, i; | |
| 2441 | + n = i3GEO.editorOL.backup.features.length; | |
| 2442 | + for (i = 0; i < n; i++) { | |
| 2443 | + i3GEO.editorOL.backup.features[i].renderIntent = "default"; | |
| 2444 | + i3GEO.editorOL.selbutton.unselect(i3GEO.editorOL.backup.features[i]); | |
| 2445 | + } | |
| 2446 | + }, | |
| 2447 | + unselFeature : function(id) { | |
| 2448 | + var f, s; | |
| 2449 | + s = i3GEO.desenho.layergrafico.getSource(); | |
| 2450 | + f = s.getFeatureById(id); | |
| 2451 | + if(f){ | |
| 2452 | + if(f.getStyle() && f.getStyle().getSrc){ | |
| 2453 | + f.getStyle().setSrc(f.getProperties().externalGraphic); | |
| 2454 | + f.getStyle().setSize([f.getProperties().graphicWidth,f.getProperties().graphicHeight]); | |
| 2455 | + } | |
| 2456 | + else{ | |
| 2457 | + f.getStyle().getFill().setColor(f.getProperties().fillColor); | |
| 2458 | + f.getStyle().getStroke().setColor(f.getProperties().strokeColor); | |
| 2459 | + } | |
| 2460 | + } | |
| 2461 | + i3GEO.editorOL.idsSelecionados.remove(id); | |
| 2462 | + i3GEO.desenho.layergrafico.getSource().changed(); | |
| 2463 | + }, | |
| 2464 | + restauraBackup : function() { | |
| 2465 | + if (i3GEO.editorOL.backup.features.length > 0) { | |
| 2466 | + i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.features); | |
| 2467 | + i3GEO.desenho.layergrafico.addFeatures(i3GEO.editorOL.backup.features); | |
| 2468 | + } | |
| 2469 | + if (document.getElementById("panellistagEditor")) { | |
| 2470 | + i3GEO.editorOL.listaGeometrias(); | |
| 2471 | + } | |
| 2472 | + // i3GEO.editorOL.backup.removeFeatures(i3GEO.editorOL.backup.features); | |
| 2473 | + }, | |
| 2474 | + substituiFeaturesSel : function(f) { | |
| 2475 | + i3GEO.editorOL.removeFeaturesSel(); | |
| 2476 | + var fwkt = new ol.format.WKT(); | |
| 2477 | + f = fwkt.readFeatures(f)[0]; | |
| 2478 | + f.setStyle( | |
| 2479 | + new ol.style.Style({ | |
| 2480 | + stroke: new ol.style.Stroke({ | |
| 2481 | + color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')', | |
| 2482 | + width: i3GEO.editorOL.simbologia.strokeWidth | |
| 2483 | + }), | |
| 2484 | + fill: new ol.style.Fill({ | |
| 2485 | + color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')' | |
| 2486 | + }) | |
| 2487 | + }) | |
| 2488 | + ); | |
| 2489 | + f.setId(i3GEO.util.uid()); | |
| 2490 | + i3GEO.desenho.layergrafico.getSource().addFeature(f); | |
| 2491 | + }, | |
| 2492 | + adicionaFeatureWkt : function(wkt, atributos) { | |
| 2493 | + var f, fwkt = new OpenLayers.Format.WKT(); | |
| 2475 | 2494 | |
| 2476 | - if (atributos.externalGraphic && atributos.externalGraphic != "") { | |
| 2477 | - var style_mark = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']); | |
| 2478 | - style_mark.externalGraphic = atributos.externalGraphic; | |
| 2479 | - style_mark.graphicWidth = atributos.graphicWidth; | |
| 2480 | - style_mark.graphicHeight = atributos.graphicHeight; | |
| 2481 | - style_mark.fillOpacity = atributos.opacidade; | |
| 2482 | - f = fwkt.read(wkt); | |
| 2483 | - f["attributes"] = atributos; | |
| 2484 | - f["style"] = style_mark; | |
| 2485 | - } else { | |
| 2486 | - f = fwkt.read(wkt); | |
| 2487 | - f["attributes"] = atributos; | |
| 2488 | - } | |
| 2489 | - i3GEO.desenho.layergrafico.addFeatures([ | |
| 2490 | - f | |
| 2491 | - ]); | |
| 2492 | - if (document.getElementById("panellistagEditor")) { | |
| 2493 | - i3GEO.editorOL.listaGeometrias(); | |
| 2494 | - } | |
| 2495 | - }, | |
| 2496 | - flashFeaturesI : function(index) { | |
| 2497 | - i3GEO.editorOL.flashFeatures([ | |
| 2498 | - i3GEO.desenho.layergrafico.features[index] | |
| 2499 | - ], 0); | |
| 2500 | - }, | |
| 2501 | - flashFeatures : function(features, index) { | |
| 2502 | - if (!index) { | |
| 2503 | - index = 0; | |
| 2504 | - } | |
| 2505 | - var current = features[index]; | |
| 2506 | - if (current && current.layer === i3GEO.desenho.layergrafico) { | |
| 2507 | - i3GEO.desenho.layergrafico.drawFeature(features[index], "select"); | |
| 2508 | - } | |
| 2509 | - var prev = features[index - 1]; | |
| 2510 | - if (prev && prev.layer === i3GEO.desenho.layergrafico) { | |
| 2511 | - i3GEO.desenho.layergrafico.drawFeature(prev, "default"); | |
| 2512 | - } | |
| 2513 | - ++index; | |
| 2514 | - if (index <= features.length) { | |
| 2515 | - window.setTimeout(function() { | |
| 2516 | - i3GEO.editorOL.flashFeatures(features, index); | |
| 2517 | - }, 75); | |
| 2518 | - } | |
| 2519 | - }, | |
| 2520 | - selFeature : function(id) { | |
| 2521 | - var s,f; | |
| 2522 | - s = i3GEO.desenho.layergrafico.getSource(); | |
| 2523 | - f = s.getFeatureById(id); | |
| 2524 | - if(!i3GEO.util.in_array(id,i3GEO.editorOL.idsSelecionados)){ | |
| 2525 | - i3GEO.editorOL.idsSelecionados.push(id); | |
| 2526 | - f.setProperties({ | |
| 2527 | - fillColor: f.getStyle().getFill().getColor(), | |
| 2528 | - strokeColor: f.getStyle().getStroke().getColor(), | |
| 2529 | - externalGraphic: "" | |
| 2530 | - }); | |
| 2531 | - f.getStyle().getFill().setColor('rgba(255, 255, 255, 0.5)'); | |
| 2532 | - f.getStyle().getStroke().setColor('blue'); | |
| 2533 | - s.changed(); | |
| 2534 | - } | |
| 2535 | - }, | |
| 2536 | - carregajts : function(funcao) { | |
| 2537 | - if (i3GEO.configura) { | |
| 2538 | - i3GEO.util.scriptTag(i3GEO.configura.locaplic + "/pacotes/jsts/lib/jsts.js", funcao, "i3GEOjts", true); | |
| 2539 | - } else { | |
| 2540 | - i3GEO.util.scriptTag("../pacotes/jsts/lib/jsts.js", funcao, "i3GEOjts", true); | |
| 2541 | - } | |
| 2542 | - }, | |
| 2543 | - trazParaFrente : function() { | |
| 2544 | - var s, i, nsel, id, clone; | |
| 2545 | - s = i3GEO.desenho.layergrafico.getSource(); | |
| 2546 | - nsel = i3GEO.editorOL.idsSelecionados.length; | |
| 2547 | - for(i=0; i<nsel; i++){ | |
| 2548 | - f = s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]); | |
| 2549 | - if(f){ | |
| 2550 | - clone = f.clone(); | |
| 2551 | - id = f.getId(); | |
| 2552 | - s.removeFeature(f); | |
| 2553 | - clone.setId(id); | |
| 2554 | - s.addFeature(clone); | |
| 2555 | - } | |
| 2556 | - } | |
| 2557 | - s.changed(); | |
| 2558 | - }, | |
| 2559 | - pegaControle : function(classe) { | |
| 2560 | - var n = i3GEO.editorOL.controles.length, i; | |
| 2561 | - for (i = 0; i < n; i++) { | |
| 2562 | - if (i3GEO.editorOL.controles[i].CLASS_NAME === classe) { | |
| 2563 | - return i3GEO.editorOL.controles[i]; | |
| 2564 | - } | |
| 2565 | - } | |
| 2566 | - return false; | |
| 2567 | - }, | |
| 2568 | - ativaLayerSwitcher : function() { | |
| 2569 | - var ls = i3GEO.editorOL.pegaControle("OpenLayers.Control.LayerSwitcher"); | |
| 2570 | - if (ls) { | |
| 2571 | - ls.maximizeDiv.click(); | |
| 2572 | - } | |
| 2573 | - }, | |
| 2574 | - desativaRodaDoMouse : function() { | |
| 2575 | - var controls = i3GEO.editorOL.mapa.getControlsByClass('OpenLayers.Control.Navigation'); | |
| 2576 | - for ( var i = 0; i < controls.length; ++i) { | |
| 2577 | - controls[i].disableZoomWheel(); | |
| 2578 | - } | |
| 2579 | - }, | |
| 2580 | - google2wgs : function(obj) { | |
| 2581 | - if (i3GEO.Interface.openlayers.googleLike === true) { | |
| 2582 | - return obj.transform("EPSG:900913","EPSG:4326"); | |
| 2583 | - } else { | |
| 2584 | - return obj; | |
| 2585 | - } | |
| 2586 | - }, | |
| 2587 | - sobeLayersGraficos : function() { | |
| 2588 | - /* | |
| 2495 | + if (atributos.externalGraphic && atributos.externalGraphic != "") { | |
| 2496 | + var style_mark = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']); | |
| 2497 | + style_mark.externalGraphic = atributos.externalGraphic; | |
| 2498 | + style_mark.graphicWidth = atributos.graphicWidth; | |
| 2499 | + style_mark.graphicHeight = atributos.graphicHeight; | |
| 2500 | + style_mark.fillOpacity = atributos.opacidade; | |
| 2501 | + f = fwkt.read(wkt); | |
| 2502 | + f["attributes"] = atributos; | |
| 2503 | + f["style"] = style_mark; | |
| 2504 | + } else { | |
| 2505 | + f = fwkt.read(wkt); | |
| 2506 | + f["attributes"] = atributos; | |
| 2507 | + } | |
| 2508 | + i3GEO.desenho.layergrafico.addFeatures([ | |
| 2509 | + f | |
| 2510 | + ]); | |
| 2511 | + if (document.getElementById("panellistagEditor")) { | |
| 2512 | + i3GEO.editorOL.listaGeometrias(); | |
| 2513 | + } | |
| 2514 | + }, | |
| 2515 | + flashFeaturesI : function(index) { | |
| 2516 | + i3GEO.editorOL.flashFeatures([ | |
| 2517 | + i3GEO.desenho.layergrafico.features[index] | |
| 2518 | + ], 0); | |
| 2519 | + }, | |
| 2520 | + flashFeatures : function(features, index) { | |
| 2521 | + if (!index) { | |
| 2522 | + index = 0; | |
| 2523 | + } | |
| 2524 | + var current = features[index]; | |
| 2525 | + if (current && current.layer === i3GEO.desenho.layergrafico) { | |
| 2526 | + i3GEO.desenho.layergrafico.drawFeature(features[index], "select"); | |
| 2527 | + } | |
| 2528 | + var prev = features[index - 1]; | |
| 2529 | + if (prev && prev.layer === i3GEO.desenho.layergrafico) { | |
| 2530 | + i3GEO.desenho.layergrafico.drawFeature(prev, "default"); | |
| 2531 | + } | |
| 2532 | + ++index; | |
| 2533 | + if (index <= features.length) { | |
| 2534 | + window.setTimeout(function() { | |
| 2535 | + i3GEO.editorOL.flashFeatures(features, index); | |
| 2536 | + }, 75); | |
| 2537 | + } | |
| 2538 | + }, | |
| 2539 | + selFeature : function(id) { | |
| 2540 | + var s,f; | |
| 2541 | + s = i3GEO.desenho.layergrafico.getSource(); | |
| 2542 | + f = s.getFeatureById(id); | |
| 2543 | + if(!i3GEO.util.in_array(id,i3GEO.editorOL.idsSelecionados)){ | |
| 2544 | + i3GEO.editorOL.idsSelecionados.push(id); | |
| 2545 | + f.setProperties({ | |
| 2546 | + fillColor: f.getStyle().getFill().getColor(), | |
| 2547 | + strokeColor: f.getStyle().getStroke().getColor(), | |
| 2548 | + externalGraphic: "" | |
| 2549 | + }); | |
| 2550 | + f.getStyle().getFill().setColor('rgba(255, 255, 255, 0.5)'); | |
| 2551 | + f.getStyle().getStroke().setColor('blue'); | |
| 2552 | + s.changed(); | |
| 2553 | + } | |
| 2554 | + }, | |
| 2555 | + carregajts : function(funcao) { | |
| 2556 | + if (i3GEO.configura) { | |
| 2557 | + i3GEO.util.scriptTag(i3GEO.configura.locaplic + "/pacotes/jsts/lib/jsts.js", funcao, "i3GEOjts", true); | |
| 2558 | + } else { | |
| 2559 | + i3GEO.util.scriptTag("../pacotes/jsts/lib/jsts.js", funcao, "i3GEOjts", true); | |
| 2560 | + } | |
| 2561 | + }, | |
| 2562 | + trazParaFrente : function() { | |
| 2563 | + var s, i, nsel, id, clone; | |
| 2564 | + s = i3GEO.desenho.layergrafico.getSource(); | |
| 2565 | + nsel = i3GEO.editorOL.idsSelecionados.length; | |
| 2566 | + for(i=0; i<nsel; i++){ | |
| 2567 | + f = s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]); | |
| 2568 | + if(f){ | |
| 2569 | + clone = f.clone(); | |
| 2570 | + id = f.getId(); | |
| 2571 | + s.removeFeature(f); | |
| 2572 | + clone.setId(id); | |
| 2573 | + s.addFeature(clone); | |
| 2574 | + } | |
| 2575 | + } | |
| 2576 | + s.changed(); | |
| 2577 | + }, | |
| 2578 | + pegaControle : function(classe) { | |
| 2579 | + var n = i3GEO.editorOL.controles.length, i; | |
| 2580 | + for (i = 0; i < n; i++) { | |
| 2581 | + if (i3GEO.editorOL.controles[i].CLASS_NAME === classe) { | |
| 2582 | + return i3GEO.editorOL.controles[i]; | |
| 2583 | + } | |
| 2584 | + } | |
| 2585 | + return false; | |
| 2586 | + }, | |
| 2587 | + ativaLayerSwitcher : function() { | |
| 2588 | + var ls = i3GEO.editorOL.pegaControle("OpenLayers.Control.LayerSwitcher"); | |
| 2589 | + if (ls) { | |
| 2590 | + ls.maximizeDiv.click(); | |
| 2591 | + } | |
| 2592 | + }, | |
| 2593 | + desativaRodaDoMouse : function() { | |
| 2594 | + var controls = i3GEO.editorOL.mapa.getControlsByClass('OpenLayers.Control.Navigation'); | |
| 2595 | + for ( var i = 0; i < controls.length; ++i) { | |
| 2596 | + controls[i].disableZoomWheel(); | |
| 2597 | + } | |
| 2598 | + }, | |
| 2599 | + google2wgs : function(obj) { | |
| 2600 | + if (i3GEO.Interface.openlayers.googleLike === true) { | |
| 2601 | + return obj.transform("EPSG:900913","EPSG:4326"); | |
| 2602 | + } else { | |
| 2603 | + return obj; | |
| 2604 | + } | |
| 2605 | + }, | |
| 2606 | + sobeLayersGraficos : function() { | |
| 2607 | + /* | |
| 2589 | 2608 | var nlayers = i3GEO.editorOL.mapa.getNumLayers(), layers = i3GEO.editorOL.mapa.layers, i; |
| 2590 | 2609 | for (i = 0; i < nlayers; i++) { |
| 2591 | 2610 | if (layers[i].CLASS_NAME == "OpenLayers.Layer.Vector" && layers[i].name != "Nenhum") { |
| 2592 | 2611 | i3GEO.editorOL.mapa.raiseLayer(i3GEO.editorOL.mapa.layers[i], nlayers); |
| 2593 | 2612 | } |
| 2594 | 2613 | } |
| 2595 | - */ | |
| 2614 | + */ | |
| 2596 | 2615 | } |
| 2597 | 2616 | }; |
| 2598 | 2617 | ... | ... |
js/dicionario.js