Commit 54903afe1fbe0cfb5b2a9f9f8257b49d4fa11fba

Authored by Edmar Moretti
1 parent 12befcd1

--no commit message

mashups/openlayers.js 0 → 100755
@@ -0,0 +1,1705 @@ @@ -0,0 +1,1705 @@
  1 +/*çjslint white:false,undef: false, rhino: true, onevar: true, evil: false */
  2 +var $i = function(id)
  3 +{return document.getElementById(id);};
  4 +//seta as variáveis navn e navm
  5 +var navn = false;
  6 +var navm = false;
  7 +var app = navigator.appName.substring(0,1);
  8 +if (app==='N'){navn=true;}else{navm=true;}
  9 +
  10 +OpenLayers.ImgPath = "../pacotes/openlayers/img/";
  11 +OpenLayers.Lang.setCode("pt-BR");
  12 +i3GEO.editorOL = {
  13 + simbologia: {
  14 + opacidade: 0.8,
  15 + texto: "",
  16 + fillColor: "250,180,15",
  17 + strokeWidth: 2,
  18 + strokeColor: "250,150,0",
  19 + pointRadius: 4,
  20 + graphicName: "square",
  21 + fontSize: "12px",
  22 + fontColor: "0,0,0"
  23 + },
  24 + backup: new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false}),
  25 + nomeFuncaoSalvar: "i3GEO.editorOL.testeSalvar()",
  26 + e_oce: new OpenLayers.Layer.ArcGIS93Rest(
  27 + "ESRI Ocean Basemap",
  28 + "http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer/export",
  29 + {format:"jpeg"},
  30 + {isBaseLayer:true,visibility:false}
  31 + ),
  32 + e_ims: new OpenLayers.Layer.ArcGIS93Rest(
  33 + "ESRI Imagery World 2D",
  34 + "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer/export",
  35 + {format:"jpeg"},
  36 + {isBaseLayer:true,visibility:false}
  37 + ),
  38 + e_wsm: new OpenLayers.Layer.ArcGIS93Rest(
  39 + "ESRI World Street Map",
  40 + "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer/export",
  41 + {format:"jpeg"},
  42 + {isBaseLayer:true,visibility:false}
  43 + ),
  44 + ol_mma: new OpenLayers.Layer.WMS(
  45 + "Base cartográfica",
  46 + "http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseraster.map&",
  47 + {layers:'baseraster',SRS:'EPSG:4618',FORMAT:'image/png'},
  48 + {singleTile:true}
  49 + ),
  50 + ol_wms: new OpenLayers.Layer.WMS.Untiled(
  51 + "OpenLayers WMS",
  52 + "http://labs.metacarta.com/wms/vmap0",
  53 + {layers: 'basic'}
  54 + ),
  55 + top_wms: new OpenLayers.Layer.WMS(
  56 + "Toponímia MMA",
  57 + "http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseref.map&",
  58 + {layers: "base",FORMAT:'image/png'}
  59 + ),
  60 + est_wms: new OpenLayers.Layer.WMS(
  61 + "Estados do Brasil",
  62 + "http://mapas.mma.gov.br/i3geo/ogc.php?tema=estadosl&",
  63 + {layers: "estadosl",FORMAT:'image/png'}
  64 + ),
  65 + fundo: "e_oce,e_ims,e_wsm,ol_mma,ol_wms,top_wms,est_wms",
  66 + kml: [],
  67 + layersIniciais: [],
  68 + botoes: {
  69 + 'pan':true,
  70 + 'zoombox':true,
  71 + 'zoomtot':true,
  72 + 'legenda':true,
  73 + 'distancia':true,
  74 + 'area':true,
  75 + 'identifica':true,
  76 + 'linha':true,
  77 + 'ponto':true,
  78 + 'poligono':true,
  79 + 'texto':true,
  80 + 'edita':true,
  81 + 'listag':true,
  82 + 'corta': true,
  83 + 'apaga':true,
  84 + 'procura':true,
  85 + 'selecao':true,
  86 + 'salva':true,
  87 + 'ajuda':true,
  88 + 'propriedades':true,
  89 + 'fecha':false,
  90 + 'tools':true,
  91 + 'undo':false,
  92 + 'frente':false,
  93 + 'legenda':true,
  94 + 'rodadomouse':true
  95 + },
  96 + pontos: [],
  97 + marca: "../pacotes/openlayers/img/marker-gold.png",
  98 + controles: [
  99 + new OpenLayers.Control.Navigation(),
  100 + new OpenLayers.Control.PanZoomBar(),
  101 + new OpenLayers.Control.LayerSwitcher({'ascending':false}),
  102 + new OpenLayers.Control.ScaleLine(),
  103 + new OpenLayers.Control.MousePosition({'separator':' '}),
  104 + new OpenLayers.Control.OverviewMap(),
  105 + new OpenLayers.Control.KeyboardDefaults()
  106 + ],
  107 + tiles: true,
  108 + incluilayergrafico: true,
  109 + ativalayerswitcher: false,
  110 + ativarodadomouse: true,
  111 + numzoom: 12,
  112 + maxext: "",
  113 + mapext: new OpenLayers.Bounds(-76.5125927,-39.3925675209,-29.5851853,9.49014852081),
  114 + mapa: "",
  115 + inicia: function(){
  116 + var single = false,
  117 + alayers = [],
  118 + fundo = (i3GEO.editorOL.fundo).split(","),
  119 + nfundo = fundo.length,
  120 + ncontroles = i3GEO.editorOL.controles.length,
  121 + i,
  122 + n;
  123 + if(i3GEO.editorOL.tiles === false || i3GEO.editorOL.tiles === "false"){
  124 + single = true;
  125 + }
  126 + if(i3GEO.editorOL.ativalayerswitcher === "false"){
  127 + i3GEO.editorOL.ativalayerswitcher = false;
  128 + }
  129 + if(i3GEO.editorOL.ativalayerswitcher === "true"){
  130 + i3GEO.editorOL.ativalayerswitcher = true;
  131 + }
  132 + if(i3GEO.editorOL.ativarodadomouse === "false"){
  133 + i3GEO.editorOL.ativarodadomouse = false;
  134 + }
  135 + if(i3GEO.editorOL.ativarodadomouse === "true"){
  136 + i3GEO.editorOL.ativarodadomouse = true;
  137 + }
  138 + if(i3GEO.editorOL.incluilayergrafico === "false"){
  139 + i3GEO.editorOL.incluilayergrafico = false;
  140 + }
  141 + if(i3GEO.editorOL.incluilayergrafico === "true"){
  142 + i3GEO.editorOL.incluilayergrafico = true;
  143 + }
  144 + if(i3GEO.editorOL.incluilayergrafico === true){
  145 + i3GEO.editorOL.criaLayerGrafico();
  146 + }
  147 + else{
  148 + i3GEO.editorOL.layergrafico = "";
  149 + i3GEO.editorOL.botoes.linha=false;
  150 + i3GEO.editorOL.botoes.ponto=false;
  151 + i3GEO.editorOL.botoes.poligono=false;
  152 + i3GEO.editorOL.botoes.texto=false;
  153 + i3GEO.editorOL.botoes.edita=false;
  154 + i3GEO.editorOL.botoes.listag=false;
  155 + i3GEO.editorOL.botoes.corta= false;
  156 + i3GEO.editorOL.botoes.apaga=false;
  157 + i3GEO.editorOL.botoes.selecao=false;
  158 + i3GEO.editorOL.botoes.salva=false;
  159 + i3GEO.editorOL.botoes.propriedades=false;
  160 + i3GEO.editorOL.botoes.fecha=false;
  161 + i3GEO.editorOL.botoes.tools=false;
  162 + i3GEO.editorOL.botoes.undo=false;
  163 + i3GEO.editorOL.botoes.frente=false;
  164 + }
  165 + if(i3GEO.editorOL.mapa === "")
  166 + {alert("O objeto i3GEO.editorOL.mapa precisa ser criado com new OpenLayers.Map()");return;}
  167 + if(i3GEO.editorOL.maxext !== ""){
  168 + i3GEO.editorOL.mapa.setOptions({
  169 + maxExtent: i3GEO.editorOL.maxext
  170 + });
  171 + }
  172 + if(i3GEO.editorOL.numzoom !== ""){
  173 + i3GEO.editorOL.mapa.setOptions({
  174 + numZoomLevels: i3GEO.editorOL.numzoom
  175 + });
  176 + }
  177 + for(i=0;i<ncontroles;i++){
  178 + i3GEO.editorOL.mapa.addControl(i3GEO.editorOL.controles[i]);
  179 + }
  180 + if(i3GEO.editorOL.fundo != ""){
  181 + for(i=nfundo-1;i>=0;i--){
  182 + try{
  183 + eval("i3GEO.editorOL."+fundo[i]+".transitionEffect = 'resize';");
  184 + eval("i3GEO.editorOL."+fundo[i]+".setVisibility(false);");
  185 + eval("i3GEO.editorOL."+fundo[i]+".singleTile = single;");
  186 + eval("alayers.push(i3GEO.editorOL."+fundo[i]+");");
  187 + }
  188 + catch(e){
  189 + if(alayers[0])
  190 + {alayers[0].setVisibility(true);}
  191 + }
  192 + }
  193 + }
  194 + i3GEO.editorOL.mapa.addLayers(alayers);
  195 + if(i3GEO.editorOL.layersIniciais !== ""){
  196 + n = i3GEO.editorOL.layersIniciais.length;
  197 + for(i=0;i<n;i++){
  198 + i3GEO.editorOL.layersIniciais[i].singleTile = single;
  199 + i3GEO.editorOL.mapa.addLayer(i3GEO.editorOL.layersIniciais[i]);
  200 + }
  201 + }
  202 + if(i3GEO.editorOL.layergrafico !== ""){
  203 + i3GEO.editorOL.mapa.addLayers([i3GEO.editorOL.layergrafico]);
  204 + }
  205 + i3GEO.editorOL.adicionaKml();
  206 + i3GEO.editorOL.adicionaMarcas();
  207 + if(i3GEO.editorOL.maxext !== "")
  208 + {i3GEO.editorOL.mapa.zoomToMaxExtent();}
  209 + if(i3GEO.editorOL.mapext != "")
  210 + {i3GEO.editorOL.mapa.zoomToExtent(i3GEO.editorOL.mapext);}
  211 + i3GEO.editorOL.coordenadas();
  212 + i3GEO.editorOL.criaJanelaBusca();
  213 + i3GEO.editorOL.criaBotoes(i3GEO.editorOL.botoes);
  214 + if(i3GEO.editorOL.ativalayerswitcher === true)
  215 + {i3GEO.editorOL.ativaLayerSwitcher();}
  216 + if(i3GEO.editorOL.ativarodadomouse === false)
  217 + {i3GEO.editorOL.desativaRodaDoMouse();}
  218 + },
  219 + criaLayerGrafico: function(){
  220 + var sketchSymbolizers = {
  221 + "Point": {
  222 + fillColor: "rgb(${fillColor})",
  223 + fillOpacity: "${opacidade}",
  224 + strokeWidth: "${strokeWidth}",
  225 + strokeOpacity: "${opacidade}",
  226 + strokeColor: "rgb(${strokeColor})",
  227 + label: "${texto}",
  228 + pointRadius: "${pointRadius}",
  229 + graphicName: "${graphicName}",
  230 + fontSize: "${fontSize}",
  231 + fontColor: "rgb(${fontColor})",
  232 + fontFamily: "Arial",
  233 + fontWeight: "normal",
  234 + labelAlign: "lb",
  235 + labelXOffset: "3",
  236 + labelYOffset: "3"
  237 + },
  238 + "Line": {
  239 + strokeWidth: "${strokeWidth}",
  240 + strokeOpacity: "${opacidade}",
  241 + strokeColor: "rgb(${strokeColor})"
  242 + },
  243 + "Polygon": {
  244 + strokeWidth: "${strokeWidth}",
  245 + strokeOpacity: "${opacidade}",
  246 + strokeColor: "rgb(${strokeColor})",
  247 + fillColor: "rgb(${fillColor})",
  248 + fillOpacity: "${opacidade}"
  249 + }
  250 + },
  251 + style = new OpenLayers.Style(),
  252 + styleMap1 = new OpenLayers.StyleMap({"default": style});
  253 + style.addRules([
  254 + new OpenLayers.Rule({symbolizer: sketchSymbolizers})
  255 + ]);
  256 + i3GEO.editorOL.layergrafico = new OpenLayers.Layer.Vector("Edição",{
  257 + styleMap: styleMap1,
  258 + displayInLayerSwitcher:true,
  259 + visibility:true
  260 + }
  261 + );
  262 + },
  263 + layersLigados: function(){
  264 + var layers = i3GEO.editorOL.mapa.layers,
  265 + nlayers = layers.length,
  266 + ins = [],i;
  267 + for(i=0;i<nlayers;i++){
  268 + if(layers[i].visibility === true){
  269 + ins.push(layers[i]);
  270 + }
  271 + }
  272 + return ins;
  273 + },
  274 + coordenadas: function(){
  275 + //
  276 + //substitui o controle que mostra as coordenadas
  277 + //
  278 + var idcoord = i3GEO.editorOL.mapa.getControlsBy("separator"," ");
  279 + if(idcoord[0]){
  280 + i3GEO.editorOL.mapa.events.register("mousemove", i3GEO.editorOL.mapa, function(e){
  281 + var p,lonlat,d;
  282 + if (navm)
  283 + {p = new OpenLayers.Pixel(e.x,e.y);}
  284 + else
  285 + {p = e.xy;}
  286 + //altera o indicador de localizacao
  287 + lonlat = i3GEO.editorOL.mapa.getLonLatFromPixel(p);
  288 + d = i3GEO.calculo.dd2dms(lonlat.lon,lonlat.lat);
  289 + try{
  290 + $i(idcoord[0].id).innerHTML = "Long: "+d[0]+"<br>Lat: "+d[1];
  291 + }
  292 + catch(e){
  293 + if(typeof(console) !== 'undefined'){console.error(e);}
  294 + }
  295 + });
  296 + }
  297 + },
  298 + criaJanelaBusca: function(){
  299 + var layers = i3GEO.editorOL.layersLigados(),
  300 + nlayers = layers.length,
  301 + i,
  302 + ins,
  303 + combo = "<select id=i3GEOOLlistaTemasBusca ><option value=''>----</option>";
  304 + for(i=0;i<nlayers;i++){
  305 + combo += "<option value='"+i+"' >"+layers[i].name+"</option>";
  306 + }
  307 + combo += "</select>";
  308 + ins = "<div class=paragrafo >Tema:<br>"+combo;
  309 + ins += "<br>Item:<br><span id=i3GEOOLcomboitens ></span>";
  310 + ins += "<br>Procurar por:<br><input type=text size=20 id=i3GEOOLpalavraBusca >";
  311 + ins += "<br><br><input type=button value='Procurar' id='i3GEOOLbotaoBusca' ></div>";
  312 + ins += "<br>Resultado:<br><span id=i3GEOOLcomboresultado ></span>";
  313 + try{
  314 + YAHOO.namespace("procura.container");
  315 + YAHOO.procura.container.panel = new YAHOO.widget.Panel("panelprocura", {zIndex:2000, iframe:false, width:"250px", visible:false, draggable:true, close:true } );
  316 + YAHOO.procura.container.panel.setHeader("Encontre no mapa");
  317 + YAHOO.procura.container.panel.setBody(ins);
  318 + YAHOO.procura.container.panel.setFooter("");
  319 + YAHOO.procura.container.panel.render(document.body);
  320 + YAHOO.procura.container.panel.center();
  321 +
  322 + document.getElementById("i3GEOOLbotaoBusca").onclick = function(){
  323 + var layer = i3GEO.editorOL.layerAtivo(),
  324 + item = document.getElementById("i3GEOOLbuscaItem").value,
  325 + palavra = document.getElementById("i3GEOOLpalavraBusca").value;
  326 + if(item === "" || palavra === "")
  327 + {alert("Escolha o item e o texto de busca");return;}
  328 + i3GEO.editorOL.busca(layer,item,palavra,"i3GEOOLcomboresultado");
  329 + };
  330 + document.getElementById("i3GEOOLlistaTemasBusca").onchange = function(){
  331 + i3GEO.editorOL.ativaTema(this.value);
  332 + document.getElementById("i3GEOOLcomboitens").innerHTML = "...";
  333 + i3GEO.editorOL.listaItens(i3GEO.editorOL.layerAtivo(),"i3GEOOLcomboitens","i3GEOOLbuscaItem");
  334 + };
  335 + }
  336 + catch(e){}
  337 + },
  338 + criaComboTemas: function(){
  339 + var layers = i3GEO.editorOL.layersLigados(),
  340 + nlayers = layers.length,
  341 + i,
  342 + combo = "<select id=i3GEOOLlistaTemasAtivos >";
  343 + //i3GEO.editorOL.layergrafico.setLayerIndex(i3GEO.editorOL.getNumLayers() + 1);
  344 + for(i=0;i<nlayers;i++){
  345 + combo += "<option value='"+i+"' >"+layers[i].name+"</option>";
  346 + }
  347 + combo += "</select>";
  348 + return combo;
  349 + },
  350 + atualizaJanelaAtivaTema: function(){
  351 + var combo = i3GEO.editorOL.criaComboTemas();
  352 + YAHOO.temaativo.container.panel.setBody(combo);
  353 + document.getElementById("i3GEOOLlistaTemasAtivos").onchange = function(){
  354 + if(botaoIdentifica){
  355 + botaoIdentifica.layers = [i3GEO.editorOL.layersLigados()[this.value]];
  356 + }
  357 + };
  358 + },
  359 + criaJanelaAtivaTema: function(){
  360 + var temp;
  361 + if(!document.getElementById("paneltemaativo")){
  362 + YAHOO.namespace("temaativo.container");
  363 + YAHOO.temaativo.container.panel = new YAHOO.widget.Panel("paneltemaativo", {zIndex:20000, iframe:true, width:"250px", visible:false, draggable:true, close:true } );
  364 + YAHOO.temaativo.container.panel.setBody("");
  365 + if(typeof i3GEO != undefined && i3GEO != "")
  366 + {YAHOO.temaativo.container.panel.setHeader("Tema ativo<div id='paneltemaativo_minimizaCabecalho' class='container-minimiza'></div>");}
  367 + else
  368 + {YAHOO.temaativo.container.panel.setHeader("Tema ativo");}
  369 + YAHOO.temaativo.container.panel.setFooter("");
  370 + YAHOO.temaativo.container.panel.render(document.body);
  371 + YAHOO.temaativo.container.panel.show();
  372 + YAHOO.temaativo.container.panel.center();
  373 + i3GEO.editorOL.atualizaJanelaAtivaTema();
  374 + YAHOO.util.Event.addListener(YAHOO.temaativo.container.panel.close, "click", function(){
  375 + i3GEOpanelEditor.deactivate();
  376 + i3GEOpanelEditor.activate();
  377 + if(i3GEO.eventos && i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search("i3GEO.editorOL.atualizaJanelaAtivaTema()") > 0)
  378 + {i3GEO.eventos.ATUALIZAARVORECAMADAS.remove("i3GEO.editorOL.atualizaJanelaAtivaTema()");}
  379 + });
  380 + if(typeof i3GEO != undefined && i3GEO != ""){
  381 + if(i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search("i3GEO.editorOL.atualizaJanelaAtivaTema()") < 0)
  382 + {i3GEO.eventos.ATUALIZAARVORECAMADAS.push("i3GEO.editorOL.atualizaJanelaAtivaTema()");}
  383 + }
  384 + temp = $i("paneltemaativo_minimizaCabecalho");
  385 + if(temp){
  386 + temp.onclick = function(){i3GEO.janela.minimiza("paneltemaativo");};
  387 + }
  388 + }
  389 + else{
  390 + YAHOO.temaativo.container.panel.show();
  391 + }
  392 + },
  393 + ativaTema: function(id){
  394 + document.getElementById("i3GEOOLlistaTemasAtivos").value = id;
  395 + },
  396 + layerAtivo: function(){
  397 + var id = document.getElementById("i3GEOOLlistaTemasAtivos");
  398 + if(id)
  399 + {id = id.value;}
  400 + else
  401 + {id = i3GEO.temaAtivo;}
  402 + return i3GEO.editorOL.layersLigados()[id];
  403 + },
  404 + listaItens: function(layer,idonde,idobj){
  405 + if(!layer){return;}
  406 + if(!layer.params){return;}
  407 + var u = layer.url+"&request=describefeaturetype&service=wfs&version=1.0.0";
  408 + u += "&typename="+layer.params.LAYERS;
  409 + document.body.style.cursor="wait";
  410 + document.getElementById("i3geoMapa").style.cursor = "wait";
  411 + OpenLayers.Request.issue({
  412 + method: "GET",
  413 + url: u,
  414 + callback: function(retorno){
  415 + document.body.style.cursor="default";
  416 + document.getElementById("i3geoMapa").style.cursor = "default";
  417 + var fromgml = new OpenLayers.Format.WFSDescribeFeatureType({
  418 + geometryName: "msGeometry"
  419 + }),
  420 + gml = fromgml.read(retorno.responseText),
  421 + prop = gml.featureTypes[0].properties,
  422 + nprop = prop.length,
  423 + i,
  424 + combo = "<select id="+idobj+" ><option value=''>----</option>";
  425 + for(i = 0;i < nprop; i++){
  426 + combo += "<option value="+prop[i].name+" >"+prop[i].name+"</option>";
  427 + }
  428 + combo += "</select>";
  429 + document.getElementById(idonde).innerHTML = combo;
  430 + },
  431 + failure: function(){
  432 + document.body.style.cursor="default";
  433 + document.getElementById("i3geoMapa").style.cursor = "default";
  434 + alert("Erro");
  435 + }
  436 + });
  437 + },
  438 + busca: function(layer,item,palavra,onde){
  439 + document.body.style.cursor="wait";
  440 + document.getElementById("i3geoMapa").style.cursor = "wait";
  441 + var u = layer.url+"&request=getfeature&service=wfs&version=1.0.0";
  442 + u += "&OUTPUTFORMAT=gml2&typename="+layer.params.LAYERS;
  443 + u += "&filter=<Filter><PropertyIsLike wildcard=* singleChar=. escape=! ><PropertyName>"+item+"</PropertyName><Literal>*"+palavra+"*</Literal></PropertyIsLike></Filter>";
  444 + document.body.style.cursor="wait";
  445 + document.getElementById("i3geoMapa").style.cursor = "wait";
  446 + document.getElementById(onde).innerHTML = "...";
  447 + OpenLayers.Request.issue({
  448 + method: "GET",
  449 + url: u,
  450 + callback: function(retorno){
  451 + document.body.style.cursor="default";
  452 + document.getElementById("i3geoMapa").style.cursor = "default";
  453 + var fromgml = new OpenLayers.Format.GML({
  454 + geometryName: "msGeometry"
  455 + }),
  456 + gml = fromgml.read(retorno.responseText),
  457 + ngml = gml.length,
  458 + i,
  459 + ins = "<select onchange='i3GEO.editorOL.zoomPara(this.value)'>";
  460 + ins += "<option value=''>---</option>";
  461 + for(i=0;i<ngml;i++){
  462 + eval("var valor = gml[i].data."+item);
  463 + var bounds = gml[i].geometry.getBounds();
  464 + bounds = bounds.toBBOX();
  465 + ins += "<option value='"+bounds+"'>"+valor+"</option>";
  466 + }
  467 + ins += "</select>";
  468 + document.getElementById(onde).innerHTML = ins;
  469 + },
  470 + failure: function(){
  471 + document.body.style.cursor="default";
  472 + document.getElementById("i3geoMapa").style.cursor = "default";
  473 + alert("Erro");
  474 + }
  475 + });
  476 + },
  477 + zoomPara: function(bbox){
  478 + var b = new OpenLayers.Bounds.fromString(bbox);
  479 + i3GEO.editorOL.mapa.zoomToExtent(b);
  480 + },
  481 + mostraLegenda: function(){
  482 + var layers = i3GEO.editorOL.layersLigados(),
  483 + nlayers = layers.length,
  484 + ins = "",i;
  485 + for(i=0;i<nlayers;i++){
  486 + try{
  487 + var url = layers[i].getFullRequestString({"request":"getlegendgraphic"});
  488 + url = url.replace("LAYERS","LAYER");
  489 + ins += "<img src='"+url+"' /><br>";
  490 + }
  491 + catch(e){}
  492 + }
  493 + //var w = window.open();
  494 + //w.document.write(ins);
  495 + //w.document.close();
  496 + if(!document.getElementById("panellegendaeditorOL")){
  497 + YAHOO.namespace("legendaeditorOL.container");
  498 + YAHOO.legendaeditorOL.container.panel = new YAHOO.widget.Panel("panellegendaeditorOL", {zIndex:20000, iframe:true, width:"250px", visible:false, draggable:true, close:true } );
  499 + YAHOO.legendaeditorOL.container.panel.setBody(ins);
  500 + YAHOO.legendaeditorOL.container.panel.setHeader("Legenda");
  501 + YAHOO.legendaeditorOL.container.panel.setFooter("");
  502 + YAHOO.legendaeditorOL.container.panel.render(document.body);
  503 + YAHOO.legendaeditorOL.container.panel.show();
  504 + YAHOO.legendaeditorOL.container.panel.center();
  505 +
  506 + YAHOO.util.Event.addListener(YAHOO.legendaeditorOL.container.panel.close, "click", function(){
  507 + //i3GEOpanelEditor.deactivate();
  508 + //i3GEOpanelEditor.activate();
  509 + });
  510 + }
  511 + else{
  512 + YAHOO.legendaeditorOL.container.panel.setBody(ins);
  513 + YAHOO.legendaeditorOL.container.panel.show();
  514 + }
  515 + },
  516 + captura: function(lonlat){
  517 + //if(i3GEO.editorOL.layergrafico !== ""){return;}
  518 + var layers = [i3GEO.editorOL.layerAtivo()],
  519 + xy = lonlat.split(","),
  520 + u = layers[0].url+"&request=getfeature&service=wfs&version=1.0.0";
  521 + u += "&OUTPUTFORMAT=gml2&typename="+layers[0].params.LAYERS;
  522 +
  523 + //u += "&filter=<Filter><Intersects><PropertyName>Geometry</PropertyName><gml:Point><gml:coordinates>"+lonlat+"</gml:coordinates></gml:Point></Intersects></Filter>";
  524 +
  525 + xy[0] = xy[0] * 1;
  526 + xy[1] = xy[1] * 1;
  527 + var poligono = (xy[0]-0.1)+","+(xy[1]+0.1) + " "+(xy[0]+0.1)+","+(xy[1]+0.1)+" " + (xy[0]+0.1)+","+(xy[1]-0.1)+" " + (xy[0]-0.1)+","+(xy[1]-0.1)+" "+(xy[0]-0.1)+","+(xy[1]+0.1);
  528 + u += "&filter=<Filter><Intersects><PropertyName>Geometry</PropertyName><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:posList>"+poligono+"</gml:posList></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects></Filter>";
  529 +
  530 + document.body.style.cursor="wait";
  531 + if(document.getElementById("i3geoMapa"))
  532 + {document.getElementById("i3geoMapa").style.cursor = "wait";}
  533 + OpenLayers.Request.issue({
  534 + method: "GET",
  535 + url: u,
  536 + callback: function(retorno){
  537 + document.body.style.cursor="default";
  538 + if(document.getElementById("i3geoMapa"))
  539 + {document.getElementById("i3geoMapa").style.cursor = "default";}
  540 + var i,n,f,
  541 + fromgml = new OpenLayers.Format.GML({
  542 + geometryName: "msGeometry"
  543 + }),
  544 + gml = fromgml.read(retorno.responseText);
  545 + n = gml.length;
  546 + for(i=0;i<n;i++){
  547 + f = gml[i];
  548 + f["attributes"] = {
  549 + opacidade: i3GEO.editorOL.simbologia.opacidade,
  550 + texto: i3GEO.editorOL.simbologia.texto,
  551 + fillColor: i3GEO.editorOL.simbologia.fillColor,
  552 + strokeWidth: i3GEO.editorOL.simbologia.strokeWidth,
  553 + strokeColor: i3GEO.editorOL.simbologia.strokeColor,
  554 + pointRadius: i3GEO.editorOL.simbologia.pointRadius,
  555 + graphicName: i3GEO.editorOL.simbologia.graphicName
  556 + };
  557 + }
  558 + i3GEO.editorOL.layergrafico.addFeatures(gml);
  559 + },
  560 + failure: function(){
  561 + document.body.style.cursor="default";
  562 + if(document.getElementById("i3geoMapa"))
  563 + {document.getElementById("i3geoMapa").style.cursor = "default";}
  564 + alert("Erro");
  565 + }
  566 + });
  567 + },
  568 + salvaGeometrias: function(){
  569 + var geos = i3GEO.editorOL.layergrafico.selectedFeatures;
  570 + var n = geos.length;
  571 + var ins = "";
  572 + if(n > 0){
  573 + try{
  574 + YAHOO.namespace("salvaGeometrias.container");
  575 + YAHOO.salvaGeometrias.container.panel = new YAHOO.widget.Panel("panelsalvageometrias", {zIndex:2000, iframe:false, width:"250px", visible:false, draggable:true, close:true } );
  576 + YAHOO.salvaGeometrias.container.panel.setHeader("Geometrias");
  577 + YAHOO.salvaGeometrias.container.panel.setBody("");
  578 + YAHOO.salvaGeometrias.container.panel.setFooter("");
  579 + YAHOO.salvaGeometrias.container.panel.render(document.body);
  580 + YAHOO.salvaGeometrias.container.panel.center();
  581 + }
  582 + catch(e){}
  583 + YAHOO.salvaGeometrias.container.panel.show();
  584 + ins += "<p class=paragrafo >Foram encontrada(s) "+n+" geometria(s) selecionada(s) </p>";
  585 + ins += "<p class=paragrafo ><a href='#' onclick='i3GEO.editorOL.listaGeometriasSel()' >Listar</a>&nbsp;&nbsp;";
  586 + ins += "<a href='#' onclick='"+i3GEO.editorOL.nomeFuncaoSalvar+"' >Salvar</a>&nbsp;&nbsp;";
  587 + ins += "<a href='#' onclick='i3GEO.editorOL.exportarSHP()' >Exportar (shapefile)</a></p>";
  588 + YAHOO.salvaGeometrias.container.panel.setBody(ins);
  589 + }
  590 + else
  591 + {alert("Selecione pelo menos um elemento");}
  592 + },
  593 + exportarSHP: function(){
  594 + i3GEO.editorOL.processageo("converteSHP");
  595 + },
  596 + listaGeometriasSel: function(){
  597 + var geos = i3GEO.editorOL.layergrafico.selectedFeatures;
  598 + var n = geos.length;
  599 + var ins = "",i;
  600 + for(i=0;i<n;i++){
  601 + ins += "<b>Geometria: "+i+"</b><br>"+geos[i].geometry+"<br><br>";
  602 + ins += "<b>Atributos: "+i+"</b><br>";
  603 + var a = geos[i].attributes;
  604 + for(key in a){
  605 + if(a[key]){
  606 + ins += key+" = "+a[key]+"<br>";
  607 + }
  608 + }
  609 + }
  610 + var w = window.open();
  611 + w.document.write(ins);
  612 + w.document.close();
  613 + },
  614 + testeSalvar: function(){
  615 + alert("Funcao nao disponivel. Defina o nome da funcao em i3GEO.editorOL.nomeFuncaoSalvar ");
  616 + },
  617 + criaBotoes: function(botoes){
  618 + var sketchSymbolizers = {
  619 + "Point": {
  620 + pointRadius: 4,
  621 + graphicName: "square",
  622 + fillColor: "white",
  623 + fillOpacity: 1,
  624 + strokeWidth: 1,
  625 + strokeOpacity: 1,
  626 + strokeColor: "#333333"
  627 + },
  628 + "Line": {
  629 + strokeWidth: 3,
  630 + strokeOpacity: 1,
  631 + strokeColor: "#666666",
  632 + strokeDashstyle: "dash"
  633 + },
  634 + "Polygon": {
  635 + strokeWidth: 2,
  636 + strokeOpacity: 1,
  637 + strokeColor: "#666666",
  638 + fillColor: "white",
  639 + fillOpacity: 0.3
  640 + }
  641 + },
  642 + style = new OpenLayers.Style(),
  643 + styleMap = new OpenLayers.StyleMap({"default": style}),
  644 + adiciona = false,
  645 + button,
  646 + controles = [];
  647 + style.addRules([
  648 + new OpenLayers.Rule({symbolizer: sketchSymbolizers})
  649 + ]);
  650 + i3GEOpanelEditor = new OpenLayers.Control.Panel({
  651 + displayClass: "olControlEditingToolbar1 noprint",
  652 + saveState: false,
  653 + activateControl: function(c){
  654 + this.deactivate();
  655 + this.activate();
  656 + try{
  657 + i3GEO.editorOL.ModifyFeature.deactivate();
  658 + if(i3GEO && i3GEO.barraDeBotoes){
  659 + i3GEO.barraDeBotoes.ativaPadrao();
  660 + }
  661 + }
  662 + catch(e){ }
  663 + if(!c.trigger)
  664 + {c.activate();}
  665 + else
  666 + {c.trigger.call();}
  667 + }
  668 + });
  669 + if(botoes.procura===true){
  670 + button = new OpenLayers.Control.Button({
  671 + displayClass: "editorOLprocura",
  672 + trigger: function(){YAHOO.procura.container.panel.show();},
  673 + title: "procura",
  674 + type: OpenLayers.Control.TYPE_BUTTON
  675 + });
  676 + controles.push(button);
  677 + adiciona = true;
  678 + }
  679 + if(botoes.pan===true){
  680 + controles.push(new OpenLayers.Control.Navigation({
  681 + title: "deslocar",
  682 + displayClass:"editorOLpan",
  683 + type: OpenLayers.Control.TYPE_TOOL
  684 + }));
  685 + adiciona = true;
  686 + }
  687 + if(botoes.zoombox===true){
  688 + controles.push(new OpenLayers.Control.ZoomBox({
  689 + title: "zoombox",
  690 + displayClass: "editorOLzoombox",
  691 + type: OpenLayers.Control.TYPE_TOOL
  692 + }));
  693 + adiciona = true;
  694 + }
  695 + if(botoes.zoomtot===true){
  696 + button = new OpenLayers.Control.Button({
  697 + displayClass: "editorOLzoomtot",
  698 + trigger: function(){i3GEO.editorOL.mapa.zoomToMaxExtent();},
  699 + title: "ajusta extensão",
  700 + type: OpenLayers.Control.TYPE_BUTTON
  701 + });
  702 + controles.push(button);
  703 + adiciona = true;
  704 + }
  705 + if(botoes.legenda===true){
  706 + button = new OpenLayers.Control.Button({
  707 + displayClass: "editorOLlegenda",
  708 + trigger: function(){i3GEO.editorOL.mostraLegenda();},
  709 + title: "legenda",
  710 + type: OpenLayers.Control.TYPE_BUTTON
  711 + });
  712 + controles.push(button);
  713 + adiciona = true;
  714 + }
  715 + if(botoes.distancia===true){
  716 + button = new OpenLayers.Control.Measure(
  717 + OpenLayers.Handler.Path,
  718 + {
  719 + handlerOptions: {layerOptions: {styleMap: styleMap}},
  720 + persist: true,
  721 + displayClass: "editorOLdistancia",
  722 + title: "distância",
  723 + type: OpenLayers.Control.TYPE_TOOL
  724 + }
  725 + );
  726 + button.events.on({
  727 + "measure": function(event){
  728 + var units = event.units,
  729 + measure = event.measure;
  730 + alert("Distância: " + measure.toFixed(3) + " " + units);
  731 + }
  732 + });
  733 + controles.push(button);
  734 + adiciona = true;
  735 + }
  736 + if(botoes.area===true){
  737 + button = new OpenLayers.Control.Measure(
  738 + OpenLayers.Handler.Polygon,
  739 + {
  740 + handlerOptions: {layerOptions: {styleMap: styleMap}},
  741 + persist: true,
  742 + displayClass: "editorOLarea",
  743 + title: "área",
  744 + type: OpenLayers.Control.TYPE_TOOL
  745 + }
  746 + );
  747 + button.events.on({
  748 + "measure": function(event){
  749 + var units = event.units;
  750 + var measure = event.measure;
  751 + alert("Área: " + measure.toFixed(3) + " " + units + " quadrados");
  752 + }
  753 + });
  754 + controles.push(button);
  755 + adiciona = true;
  756 + }
  757 + if(botoes.identifica===true){
  758 + botaoIdentifica = new OpenLayers.Control.WMSGetFeatureInfo({
  759 + maxFeatures:1,
  760 + infoFormat:'text/plain', //'application/vnd.ogc.gml',
  761 + layers: [i3GEO.editorOL.layerAtivo()],
  762 + queryVisible: true,
  763 + title: "identifica",
  764 + type: OpenLayers.Control.TYPE_TOOL,
  765 + displayClass: "editorOLidentifica",
  766 + eventListeners: {
  767 + getfeatureinfo: function(event) {
  768 + var lonlat = i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy),
  769 + lonlattexto = "<hr>",
  770 + formata;
  771 + if( botoes.linha === true || botoes.ponto === true || botoes.poligono === true || botoes.edita === true){
  772 + lonlattexto += "<pre><span style=color:blue;cursor:pointer onclick='i3GEO.editorOL.captura(\""+lonlat.lon+","+lonlat.lat+"\")'>captura</span></pre>";
  773 + }
  774 + formata = function(texto){
  775 + var temp,
  776 + temp1,
  777 + n,
  778 + i,
  779 + f = [],
  780 + textoN = texto.split(":");
  781 + try{
  782 + if(textoN.length > 1){
  783 + temp = textoN[2].replace(/\n\r/g, "");
  784 + temp = temp.replace(/'/g, "");
  785 + temp = temp.replace(/\n/g, "|");
  786 + temp = temp.replace(/_/g, " ");
  787 + temp = temp.replace(/=/g, ":");
  788 + temp = temp.split("|");
  789 + n = temp.length;
  790 + for(i=0;i<n;i++){
  791 + temp1 = temp[i].replace(/^\s+/,"");
  792 + temp1 = temp1.replace(/\s+$/,"");
  793 + if(temp1 != "")
  794 + f.push(temp1);
  795 + }
  796 + texto = f.join("<br><br>");
  797 + }
  798 + }
  799 + catch(e){}
  800 + return texto;
  801 + };
  802 + i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud(
  803 + "chicken",
  804 + i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy),
  805 + null,
  806 + lonlattexto+"<pre>"+formata(event.text)+"</pre>",
  807 + null,
  808 + true
  809 + ));
  810 + },
  811 + beforegetfeatureinfo: function(event){
  812 + var ativo = [i3GEO.editorOL.layerAtivo()];
  813 + event.object.layers = ativo;
  814 + botaoIdentifica.layers = ativo;
  815 + botaoIdentifica.url = ativo[0].url;
  816 + },
  817 + activate: function(){
  818 + i3GEO.editorOL.criaJanelaAtivaTema();
  819 + }
  820 + }
  821 + });
  822 + //button.events.register("getfeatureinfo", this, showInfo);
  823 + controles.push(botaoIdentifica);
  824 + adiciona = true;
  825 + }
  826 + if(botoes.linha===true){
  827 + button = new OpenLayers.Control.DrawFeature(
  828 + i3GEO.editorOL.layergrafico,
  829 + OpenLayers.Handler.Path,
  830 + {
  831 + displayClass: "editorOLlinha",
  832 + title: "digitalizar linha",
  833 + type: OpenLayers.Control.TYPE_TOOL,
  834 + callbacks:{
  835 + done: function(feature){
  836 + var f = new OpenLayers.Feature.Vector(feature);
  837 + f["attributes"] = {
  838 + opacidade: i3GEO.editorOL.simbologia.opacidade,
  839 + texto: i3GEO.editorOL.simbologia.texto,
  840 + fillColor: i3GEO.editorOL.simbologia.fillColor,
  841 + strokeWidth: i3GEO.editorOL.simbologia.strokeWidth,
  842 + strokeColor: i3GEO.editorOL.simbologia.strokeColor,
  843 + pointRadius: i3GEO.editorOL.simbologia.pointRadius,
  844 + graphicName: i3GEO.editorOL.simbologia.graphicName
  845 + };
  846 + i3GEO.editorOL.layergrafico.addFeatures([f]);
  847 + if(document.getElementById("panellistagEditor"))
  848 + {i3GEO.editorOL.listaGeometrias();}
  849 + }
  850 + }
  851 + }
  852 + );
  853 + controles.push(button);
  854 + adiciona = true;
  855 + }
  856 + if(botoes.ponto===true){
  857 + button = new OpenLayers.Control.DrawFeature(
  858 + i3GEO.editorOL.layergrafico,
  859 + OpenLayers.Handler.Point,
  860 + {
  861 + displayClass: "editorOLponto",
  862 + title: "digitalizar ponto",
  863 + type: OpenLayers.Control.TYPE_TOOL,
  864 + callbacks:{
  865 + done: function(feature){
  866 + var f = new OpenLayers.Feature.Vector(feature);
  867 + f["attributes"] = {
  868 + opacidade: i3GEO.editorOL.simbologia.opacidade,
  869 + texto: i3GEO.editorOL.simbologia.texto,
  870 + fillColor: i3GEO.editorOL.simbologia.fillColor,
  871 + strokeWidth: i3GEO.editorOL.simbologia.strokeWidth,
  872 + strokeColor: i3GEO.editorOL.simbologia.strokeColor,
  873 + pointRadius: i3GEO.editorOL.simbologia.pointRadius,
  874 + graphicName: i3GEO.editorOL.simbologia.graphicName
  875 + };
  876 + i3GEO.editorOL.layergrafico.addFeatures([f]);
  877 + if(document.getElementById("panellistagEditor"))
  878 + {i3GEO.editorOL.listaGeometrias();}
  879 + }
  880 + }
  881 + }
  882 + );
  883 + controles.push(button);
  884 + adiciona = true;
  885 + }
  886 + if(botoes.poligono===true){
  887 + button = new OpenLayers.Control.DrawFeature(
  888 + i3GEO.editorOL.layergrafico,
  889 + OpenLayers.Handler.Polygon,
  890 + {
  891 + displayClass: "editorOLpoligono",
  892 + title: "digitalizar polígono",
  893 + type: OpenLayers.Control.TYPE_TOOL,
  894 + //handlerOptions: {holeModifier: "altKey"},
  895 + callbacks:{
  896 + done: function(feature){
  897 + var f = new OpenLayers.Feature.Vector(feature);
  898 + f["attributes"] = {
  899 + opacidade: i3GEO.editorOL.simbologia.opacidade,
  900 + texto: i3GEO.editorOL.simbologia.texto,
  901 + fillColor: i3GEO.editorOL.simbologia.fillColor,
  902 + strokeWidth: i3GEO.editorOL.simbologia.strokeWidth,
  903 + strokeColor: i3GEO.editorOL.simbologia.strokeColor,
  904 + pointRadius: i3GEO.editorOL.simbologia.pointRadius,
  905 + graphicName: i3GEO.editorOL.simbologia.graphicName
  906 + };
  907 + i3GEO.editorOL.layergrafico.addFeatures([f]);
  908 + if(document.getElementById("panellistagEditor"))
  909 + {i3GEO.editorOL.listaGeometrias();}
  910 + }
  911 + }
  912 + }
  913 + );
  914 + controles.push(button);
  915 + adiciona = true;
  916 + }
  917 + if(botoes.texto===true){
  918 + button = new OpenLayers.Control.DrawFeature(
  919 + i3GEO.editorOL.layergrafico,
  920 + OpenLayers.Handler.Point,
  921 + {
  922 + displayClass: "editorOLtexto",
  923 + title: "incluir texto",
  924 + type: OpenLayers.Control.TYPE_TOOL,
  925 + persist: true,
  926 + callbacks:{
  927 + done: function(feature){
  928 + var texto = window.prompt("Texto",""),
  929 + label = new OpenLayers.Feature.Vector(feature);
  930 + label["attributes"] = {
  931 + opacidade: 0.1,
  932 + fillColor: "white",
  933 + strokeWidth: i3GEO.editorOL.simbologia.strokeWidth,
  934 + texto: texto,
  935 + pointRadius: 2,
  936 + graphicName: "square",
  937 + strokeColor: "black",
  938 + fontColor: i3GEO.editorOL.simbologia.fontColor,
  939 + fontSize: i3GEO.editorOL.simbologia.fontSize,
  940 + fontFamily: "Arial",
  941 + fontWeight: "bold",
  942 + labelAlign: "rt"
  943 + };
  944 + if(texto && texto !== "")
  945 + {i3GEO.editorOL.layergrafico.addFeatures([label]);}
  946 + }
  947 + }
  948 + }
  949 + );
  950 + controles.push(button);
  951 + adiciona = true;
  952 + }
  953 + if(botoes.edita===true && botoes.corta===true && i3GEO.php){
  954 + i3GEO.editorOL.CortaFeature = new OpenLayers.Control.DrawFeature(
  955 + i3GEO.editorOL.layergrafico,
  956 + OpenLayers.Handler.Polygon,
  957 + {
  958 + displayClass: "editorOLcorta",
  959 + title: "corta figura",
  960 + type: OpenLayers.Control.TYPE_TOOL,
  961 + clickout: true,
  962 + toggle: true,
  963 + trigger: function(){
  964 + if(i3GEO.editorOL.layergrafico.selectedFeatures.length != 1){
  965 + alert("Selecione primeiro um elemento para ser cortado");
  966 + i3GEO.editorOL.CortaFeature.deactivate();
  967 + }
  968 + else{
  969 + i3GEO.editorOL.CortaFeature.activate();
  970 + }
  971 + },
  972 + callbacks:{
  973 + done: function(feature){
  974 + var temp,
  975 + sel = i3GEO.editorOL.layergrafico.selectedFeatures[0].geometry,
  976 + corta = feature;
  977 + temp = function(retorno){
  978 + i3GEO.janela.fechaAguarde("i3GEO.cortador");
  979 + if(retorno != "" && retorno.data && retorno.data != "")
  980 + {i3GEO.editorOL.substituiFeaturesSel(retorno.data);}
  981 + };
  982 + i3GEO.janela.abreAguarde("i3GEO.cortador","Cortando");
  983 + i3GEO.php.funcoesGeometriasWkt(temp,sel+"|"+corta,"difference");
  984 + }
  985 + }
  986 + }
  987 + );
  988 + controles.push(i3GEO.editorOL.CortaFeature);
  989 + adiciona = true;
  990 + }
  991 + if(botoes.edita===true){
  992 + i3GEO.editorOL.ModifyFeature = new OpenLayers.Control.ModifyFeature(
  993 + i3GEO.editorOL.layergrafico,
  994 + {
  995 + displayClass: "editorOLedita",
  996 + title: "modifica figura",
  997 + type: OpenLayers.Control.TYPE_TOOL,
  998 + clickout: true,
  999 + toggle: true,
  1000 + mode: OpenLayers.Control.ModifyFeature.RESHAPE
  1001 + }
  1002 + );
  1003 + controles.push(i3GEO.editorOL.ModifyFeature);
  1004 + adiciona = true;
  1005 + }
  1006 + if(botoes.edita===true && botoes.listag===true){
  1007 + button = new OpenLayers.Control.Button({
  1008 + displayClass: "editorOLlistag",
  1009 + trigger: function(){
  1010 + i3GEO.editorOL.listaGeometrias();
  1011 + },
  1012 + title: "lista geometrias",
  1013 + type: OpenLayers.Control.TYPE_BUTTON
  1014 + });
  1015 + controles.push(button);
  1016 + adiciona = true;
  1017 + }
  1018 + if(botoes.frente===true){
  1019 + button = new OpenLayers.Control.Button({
  1020 + displayClass: "editorOLfrente",
  1021 + trigger: function(){
  1022 + i3GEO.editorOL.trazParaFrente();
  1023 + if(document.getElementById("panellistagEditor"))
  1024 + {i3GEO.editorOL.listaGeometrias();}
  1025 + },
  1026 + title: "traz para frente",
  1027 + type: OpenLayers.Control.TYPE_BUTTON
  1028 + });
  1029 + controles.push(button);
  1030 + adiciona = true;
  1031 + }
  1032 + if(botoes.tools===true && i3GEO.php){
  1033 + button = new OpenLayers.Control.Button({
  1034 + displayClass: "editorOLtools",
  1035 + trigger: function(){
  1036 + //fora do i3geo, usa o jsts
  1037 + if(i3GEO.php)
  1038 + {i3GEO.editorOL.ferramentas();}
  1039 + else
  1040 + {i3GEO.editorOL.carregajts("i3GEO.editorOL.ferramentas()");}
  1041 +
  1042 + },
  1043 + title: "ferramentas",
  1044 + type: OpenLayers.Control.TYPE_BUTTON
  1045 + });
  1046 + controles.push(button);
  1047 + adiciona = true;
  1048 + }
  1049 + //botao de seleção
  1050 + if(botoes.selecao===true){
  1051 + i3GEO.editorOL.selbutton = new OpenLayers.Control.SelectFeature(
  1052 + i3GEO.editorOL.layergrafico,
  1053 + {
  1054 + displayClass: "editorOLselecao",
  1055 + title: "seleciona elemento",
  1056 + type: OpenLayers.Control.TYPE_TOOL,
  1057 + clickout: true,
  1058 + toggle: true,
  1059 + multiple: false,
  1060 + hover: false,
  1061 + toggleKey: "ctrlKey", // ctrl key removes from selection
  1062 + multipleKey: "shiftKey", // shift key adds to selection
  1063 + box: false
  1064 + }
  1065 + );
  1066 + controles.push(i3GEO.editorOL.selbutton);
  1067 + adiciona = true;
  1068 + }
  1069 + if(botoes.apaga===true){
  1070 + button = new OpenLayers.Control.Button({
  1071 + displayClass: "editorOLapaga",
  1072 + trigger: function(){
  1073 + if(i3GEO.editorOL.layergrafico.selectedFeatures.length > 0){
  1074 + var x = window.confirm("Exclui os elementos selecionados?");
  1075 + if(x){
  1076 + i3GEO.editorOL.guardaBackup();
  1077 + i3GEO.editorOL.layergrafico.removeFeatures(i3GEO.editorOL.layergrafico.selectedFeatures);
  1078 + if(document.getElementById("panellistagEditor"))
  1079 + {i3GEO.editorOL.listaGeometrias();}
  1080 + }
  1081 + }
  1082 + else
  1083 + {alert("Selecione pelo menos um elemento");}
  1084 + },
  1085 + title: "apaga selecionados",
  1086 + type: OpenLayers.Control.TYPE_BUTTON
  1087 + });
  1088 + controles.push(button);
  1089 + adiciona = true;
  1090 + }
  1091 + //não disponível ainda
  1092 + /*
  1093 + if(botoes.undo===true){
  1094 + button = new OpenLayers.Control.Button({
  1095 + displayClass: "editorOLundo",
  1096 + trigger: function(){i3GEO.editorOL.restauraBackup();},
  1097 + title: "recupera"
  1098 + });
  1099 + controles.push(button);
  1100 + adiciona = true;
  1101 + }
  1102 + */
  1103 + if(botoes.propriedades===true){
  1104 + button = new OpenLayers.Control.Button({
  1105 + displayClass: "editorOLpropriedades",
  1106 + trigger: function(){i3GEO.editorOL.propriedades();},
  1107 + title: "propriedades",
  1108 + type: OpenLayers.Control.TYPE_BUTTON
  1109 + });
  1110 + controles.push(button);
  1111 + adiciona = true;
  1112 + }
  1113 + if(botoes.salva===true){
  1114 + button = new OpenLayers.Control.Button({
  1115 + displayClass: "editorOLsalva",
  1116 + trigger: function(){i3GEO.editorOL.salvaGeometrias();},
  1117 + title: "salva",
  1118 + type: OpenLayers.Control.TYPE_BUTTON
  1119 + });
  1120 + controles.push(button);
  1121 + adiciona = true;
  1122 + }
  1123 + if(botoes.ajuda===true){
  1124 + button = new OpenLayers.Control.Button({
  1125 + displayClass: "editorOLajuda",
  1126 + trigger: function(){
  1127 + try
  1128 + {window.open(i3GEO.configura.locaplic+"/mashups/openlayers_ajuda.php");}
  1129 + catch(e)
  1130 + {window.open("openlayers_ajuda.php");}
  1131 + },
  1132 + title: "ajuda",
  1133 + type: OpenLayers.Control.TYPE_BUTTON
  1134 + });
  1135 + controles.push(button);
  1136 + adiciona = true;
  1137 + }
  1138 + if(botoes.fecha===true){
  1139 + button = new OpenLayers.Control.Button({
  1140 + displayClass: "editorOLfecha",
  1141 + trigger: function(){
  1142 + var temp = window.confirm("Remove a edição?");
  1143 + i3GEOpanelEditor.destroy();
  1144 + try{YAHOO.temaativo.container.panel.destroy();}catch(e){}
  1145 + try{YAHOO.procura.container.panel.destroy();}catch(e){}
  1146 + try{YAHOO.editorOL.container.panel.destroy();}catch(e){}
  1147 + try{YAHOO.editorOL.listaGeometrias.panel.destroy();}catch(e){}
  1148 + //try{YAHOO.panelpropriedadesEditor.panel.destroy();}catch(e){}
  1149 + //try{YAHOO.editorOL.panellistagEditor.panel.destroy();}catch(e){}
  1150 + try{YAHOO.editorOL.ferramentas.panel.destroy();}catch(e){}
  1151 + //try{YAHOO.panelprocura.panel.destroy();}catch(e){}
  1152 + try{YAHOO.legendaeditorOL.container.panel.destroy();}catch(e){}
  1153 + try{YAHOO.salvaGeometrias.container.panel.destroy();}catch(e){}
  1154 + if(temp === true){
  1155 + try{
  1156 + if(i3GEO.editorOL.layergrafico){
  1157 + i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.layergrafico);
  1158 + delete(i3GEO.editorOL.layergrafico);
  1159 + }
  1160 + if(i3GEO.editorOL.backup){
  1161 + i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.backup);
  1162 + delete(i3GEO.editorOL.backup);
  1163 + }
  1164 + }
  1165 + catch(e){}
  1166 + }
  1167 + },
  1168 + title: "fecha editor",
  1169 + type: OpenLayers.Control.TYPE_BUTTON
  1170 + });
  1171 + controles.push(button);
  1172 + adiciona = true;
  1173 + }
  1174 + //
  1175 + //controle que permite o snap
  1176 + //
  1177 + i3GEOOLsnap = new OpenLayers.Control.Snapping({
  1178 + layer: i3GEO.editorOL.layergrafico
  1179 + });
  1180 + i3GEOOLsplit = new OpenLayers.Control.Split({
  1181 + layer: i3GEO.editorOL.layergrafico,
  1182 + source: i3GEO.editorOL.layergrafico,
  1183 + tolerance: 0.0001,
  1184 + eventListeners: {
  1185 + beforesplit: function(event){i3GEO.editorOL.guardaBackup();},
  1186 + aftersplit: function(event) {
  1187 + i3GEO.editorOL.flashFeatures(event.features);
  1188 + if(document.getElementById("panellistagEditor"))
  1189 + {i3GEO.editorOL.listaGeometrias();}
  1190 + }
  1191 + }
  1192 + });
  1193 + //
  1194 + //adiciona o painel ao mapa se alguma op��o foi inserida
  1195 + //
  1196 + if(adiciona === true){
  1197 + i3GEOpanelEditor.addControls(controles);
  1198 + i3GEO.editorOL.mapa.addControl(i3GEOpanelEditor);
  1199 + }
  1200 + },
  1201 + mudaSimbolo: function(estilo,id){
  1202 + var valor = $i(id).value;
  1203 + if(valor === "")
  1204 + {return;}
  1205 + if(estilo === "strokeWidth")
  1206 + {i3GEO.editorOL.simbologia.strokeWidth = valor;return;}
  1207 + if(estilo === "opacidade")
  1208 + {i3GEO.editorOL.simbologia.opacidade = valor;return;}
  1209 + i3GEO.editorOL.simbologia[estilo] = valor;
  1210 + },
  1211 + adicionaMarcas: function(){
  1212 + if(i3GEO.editorOL.pontos.length === 0)
  1213 + {return;}
  1214 + var SHADOW_Z_INDEX = 10,
  1215 + MARKER_Z_INDEX = 11,
  1216 + layer = new OpenLayers.Layer.Vector(
  1217 + "pontos",
  1218 + {
  1219 + styleMap: new OpenLayers.StyleMap({
  1220 + externalGraphic: i3GEO.editorOL.marca,
  1221 + backgroundGraphic: "../pacotes/openlayers/img/marker_shadow.png",
  1222 + backgroundXOffset: 0,
  1223 + backgroundYOffset: -7,
  1224 + graphicZIndex: MARKER_Z_INDEX,
  1225 + backgroundGraphicZIndex: SHADOW_Z_INDEX,
  1226 + pointRadius: 10
  1227 + }),
  1228 + isBaseLayer: false,
  1229 + rendererOptions: {yOrdering: true},
  1230 + displayInLayerSwitcher:true,
  1231 + visibility:true
  1232 + }
  1233 + ),
  1234 + index,
  1235 + x = [],
  1236 + y = [],
  1237 + features = [];
  1238 + for (index = 0; index < i3GEO.editorOL.pontos.length; index = index + 2){
  1239 + x.push(i3GEO.editorOL.pontos[index]);
  1240 + y.push(i3GEO.editorOL.pontos[index+1]);
  1241 + }
  1242 + for (index = 0; index < x.length; index++) {
  1243 + features.push(
  1244 + new OpenLayers.Feature.Vector(
  1245 + new OpenLayers.Geometry.Point(x[index], y[index])
  1246 + )
  1247 + );
  1248 + }
  1249 + layer.addFeatures(features);
  1250 + i3GEO.editorOL.mapa.addLayer(layer);
  1251 + },
  1252 + adicionaKml: function(){
  1253 + var temp,n,i,id,url;
  1254 + n = i3GEO.editorOL.kml.length;
  1255 + for(i=0;i<n;i++){
  1256 + id = "kml"+i;
  1257 + url = i3GEO.editorOL.kml[i];
  1258 + eval(id+" = new OpenLayers.Layer.Vector('"+id+"', {displayOutsideMaxExtent:true,displayInLayerSwitcher:false,visibility:true, strategies: [new OpenLayers.Strategy.Fixed()],protocol: new OpenLayers.Protocol.HTTP({url: '"+url+"',format: new OpenLayers.Format.KML({extractStyles: true,extractAttributes: true,maxDepth: 5})})})");
  1259 + eval("i3GEO.editorOL.mapa.addLayer("+id+");");
  1260 + eval("temp = "+id+".div;");
  1261 + temp.onclick = function(e){
  1262 + var targ = "",id,temp,features,n,i,g,html="";
  1263 + if (!e){e = window.event;}
  1264 + if (e.target)
  1265 + {targ = e.target;}
  1266 + else{
  1267 + if (e.srcElement)
  1268 + {targ = e.srcElement;}
  1269 + }
  1270 + if(targ.id){
  1271 + temp = targ.id.split("_");
  1272 + if(temp[0] === "OpenLayers.Geometry.Point"){
  1273 + id = targ.id;
  1274 + temp = i3GEO.editorOL.mapa.getLayer(this.id);
  1275 + features = temp.features;
  1276 + n = features.length;
  1277 + for(i=0;i<n;i++){
  1278 + if(features[i].geometry.id === id){
  1279 + for (var j in features[i].attributes) {
  1280 + html += j+": "+features[i].attributes[j];
  1281 + }
  1282 + g = features[i].geometry;
  1283 + i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud(
  1284 + "kml",
  1285 + new OpenLayers.LonLat(g.x,g.y),
  1286 + null,
  1287 + html,
  1288 + null,
  1289 + true
  1290 + ));
  1291 + }
  1292 + }
  1293 + }
  1294 + }
  1295 + };
  1296 + }
  1297 + },
  1298 + //obtido de openlayers.org
  1299 + propriedades: function(){
  1300 + if(!document.getElementById("panelpropriedadesEditor")){
  1301 + YAHOO.namespace("editorOL.container");
  1302 + YAHOO.editorOL.container.panel = new YAHOO.widget.Panel("panelpropriedadesEditor", {zIndex:20000, iframe:true, width:"350px", height:"250px",visible:false, draggable:true, close:true } );
  1303 + var ins = "" +
  1304 + '<p class=paragrafo ><b>Estilos (utilize a cor no formato r,g,b):</b></p>' +
  1305 + '<table class=lista7 >' +
  1306 + ' <tr>' +
  1307 + ' <td>Cor do contorno</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'strokeColor\',\'i3GEOEditorOLcorContorno\')" type="text" style="cursor:text" id="i3GEOEditorOLcorContorno" size="12" value="'+i3GEO.editorOL.simbologia.strokeColor+'" /></td><td>';
  1308 + if(i3GEO.configura)
  1309 + {ins += '<img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorContorno\');" />';}
  1310 + ins += "" +
  1311 + ' </td>' +
  1312 + ' </tr>' +
  1313 + ' <tr>' +
  1314 + ' <td>Cor do preenchimento</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fillColor\',\'i3GEOEditorOLcorPre\')" type="text" style="cursor:text" id="i3GEOEditorOLcorPre" size="12" value="'+i3GEO.editorOL.simbologia.fillColor+'" /></td><td>';
  1315 + if(i3GEO.configura)
  1316 + {ins += '<img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorPre\');" />';}
  1317 + ins += "" +
  1318 + ' </td>' +
  1319 + ' </tr>' +
  1320 + ' <tr>' +
  1321 + ' <td>Cor da fonte</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fontColor\',\'i3GEOEditorOLcorFonte\')" type="text" style="cursor:text" id="i3GEOEditorOLcorFonte" size="12" value="'+i3GEO.editorOL.simbologia.fontColor+'" /></td><td>';
  1322 + if(i3GEO.configura)
  1323 + {ins += '<img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorFonte\');" />';}
  1324 + ins += "" +
  1325 + ' </td>' +
  1326 + ' </tr>' +
  1327 + ' <tr>' +
  1328 + ' <td>Tamanho da fonte</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fontSize\',\'i3GEOEditorOLfontsize\')" type="text" style="cursor:text" id="i3GEOEditorOLfontsize" size="3" value="'+i3GEO.editorOL.simbologia.fontSize+'" /></td><td></td>' +
  1329 + ' </tr>' +
  1330 + ' <tr>' +
  1331 + ' <td>Opacidade (de 0 a 1)</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'opacidade\',\'i3GEOEditorOLopacidade\')" type="text" style="cursor:text" id="i3GEOEditorOLopacidade" size="3" value="'+i3GEO.editorOL.simbologia.opacidade+'" /></td><td></td>' +
  1332 + ' </tr>' +
  1333 + ' <tr>' +
  1334 + ' <td>Largura da linha/contorno</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'strokeWidth\',\'i3GEOEditorOLlarguraLinha\')" type="text" style="cursor:text" id="i3GEOEditorOLlarguraLinha" size="2" value="'+i3GEO.editorOL.simbologia.strokeWidth+'" /></td><td></td>' +
  1335 + ' </tr>' +
  1336 + '</table>' +
  1337 + '<br />' +
  1338 + '<p class=paragrafo ><b>Ajusta nó em edição para o(a):</b></p>' +
  1339 + '<table class=lista7 >' +
  1340 + ' <tr>' +
  1341 + ' <td></td><td>nó</td><td></td><td>vértice</td><td></td><td>borda</td>' +
  1342 + ' </tr>' +
  1343 + ' <tr>' +
  1344 + ' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_node" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_nodeTolerance" type="text" size="3" value=15 /></td>' +
  1345 + ' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_vertex" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_vertexTolerance" type="text" size="3" value=15 /></td>' +
  1346 + ' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_edge" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_edgeTolerance" type="text" size="3" value=15 /></td>' +
  1347 + ' </tr>' +
  1348 + '</table>' +
  1349 + '<br />' +
  1350 + '<p class=paragrafo ><b>Divide intersecção ao digitalizar</b></p>' +
  1351 + '<table class=lista7 >' +
  1352 + ' <tr>' +
  1353 + ' <td><input style=cursor:pointer onclick="i3GEO.editorOL.split()" type="checkbox" id="edge_split_toggle" /></td><td>borda</td>' +
  1354 + ' </tr>' +
  1355 + '</table>' +
  1356 + '<br />' +
  1357 + '<p class=paragrafo ><b>Operação ativada pelo botão de modificação da figura</b></p>' +
  1358 + '<table class=lista7 >' +
  1359 + ' <tr>' +
  1360 + ' <td><input checked style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.RESHAPE;" type="radio" name=i3geoOLtipoEdita /></td><td>altera figura</td>' +
  1361 + ' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.RESIZE;" type="radio" name=i3geoOLtipoEdita /></td><td>altera tamanho</td>' +
  1362 + ' </tr>' +
  1363 + ' <tr>' +
  1364 + ' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.ROTATE;" type="radio" name=i3geoOLtipoEdita /></td><td>rotaciona</td>' +
  1365 + ' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.DRAG;" type="radio" name=i3geoOLtipoEdita /></td><td>desloca</td>' +
  1366 + ' </tr>' +
  1367 + '</table>';
  1368 + YAHOO.editorOL.container.panel.setBody(ins);
  1369 + if(typeof i3GEO != undefined && i3GEO != "")
  1370 + {YAHOO.editorOL.container.panel.setHeader("Propriedades<div id='panelpropriedadesEditor_minimizaCabecalho' class='container-minimiza'></div>");}
  1371 + else
  1372 + {YAHOO.editorOL.container.panel.setHeader("Propriedades");}
  1373 +
  1374 + YAHOO.editorOL.container.panel.setFooter("");
  1375 + YAHOO.editorOL.container.panel.render(document.body);
  1376 +
  1377 + YAHOO.editorOL.container.panel.center();
  1378 + YAHOO.util.Event.addListener(YAHOO.editorOL.container.panel.close, "click", function(){});
  1379 + temp = $i("panelpropriedadesEditor_minimizaCabecalho");
  1380 + if(temp){
  1381 + temp.onclick = function(){i3GEO.janela.minimiza("panelpropriedadesEditor");};
  1382 + }
  1383 + }
  1384 + YAHOO.editorOL.container.panel.show();
  1385 + if(i3GEO.configura)
  1386 + {$i("panelpropriedadesEditor").getElementsByTagName("div")[2].style.overflow = "auto";}
  1387 + else
  1388 + {$i("panelpropriedadesEditor").getElementsByTagName("div")[1].style.overflow = "auto";}
  1389 + },
  1390 + listaGeometrias: function(){
  1391 + if(!document.getElementById("panellistagEditor")){
  1392 + YAHOO.namespace("editorOL.listaGeometrias");
  1393 + YAHOO.editorOL.listaGeometrias.panel = new YAHOO.widget.Panel("panellistagEditor", {zIndex:20000, iframe:true, width:"320px", visible:false, draggable:true, close:true } );
  1394 + if(typeof i3GEO != undefined && i3GEO != "")
  1395 + {YAHOO.editorOL.listaGeometrias.panel.setHeader("Geometrias <div id='panellistagEditor_minimizaCabecalho' class='container-minimiza'></div>");}
  1396 + else
  1397 + {YAHOO.editorOL.listaGeometrias.panel.setHeader("Geometrias");}
  1398 + YAHOO.editorOL.listaGeometrias.panel.setFooter("");
  1399 + YAHOO.editorOL.listaGeometrias.panel.render(document.body);
  1400 + YAHOO.editorOL.listaGeometrias.panel.center();
  1401 + YAHOO.util.Event.addListener(YAHOO.editorOL.listaGeometrias.panel.close, "click", function(){
  1402 + YAHOO.editorOL.listaGeometrias.panel.destroy();
  1403 + });
  1404 + temp = $i("panellistagEditor_minimizaCabecalho");
  1405 + if(temp){
  1406 + temp.onclick = function(){i3GEO.janela.minimiza("panellistagEditor");};
  1407 + }
  1408 + }
  1409 + else{
  1410 + YAHOO.editorOL.listaGeometrias.panel.render(document.body);
  1411 + }
  1412 + var g,temp,
  1413 + geos = i3GEO.editorOL.layergrafico.features,
  1414 + n = geos.length,
  1415 + ins = "<table class=lista4 >";
  1416 + ins += "<tr><td><i>Geometrias</i></td><td><i>Opções</i></td><td></td><td></td></tr>";
  1417 +
  1418 + while(n > 0){
  1419 + n -= 1;
  1420 + g = geos[n].geometry;
  1421 + ins += "<tr><td>"+g.CLASS_NAME+"</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.selFeature("+n+")'>seleciona</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.unselFeature("+n+")'>limpa</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.flashFeaturesI("+n+")'>brilha</td></tr>";
  1422 + }
  1423 + ins += "</table>";
  1424 + if(geos.length === 0)
  1425 + {ins = "Nenhum elemento gráfico encontrado. Utilize as opções de criação de geometrias.";}
  1426 + YAHOO.editorOL.listaGeometrias.panel.show();
  1427 + if(i3GEO.configura)
  1428 + {temp = $i("panellistagEditor").getElementsByTagName("div")[2];}
  1429 + else
  1430 + {temp = $i("panellistagEditor").getElementsByTagName("div")[1];}
  1431 + temp.style.overflow = "auto";
  1432 + temp.style.height = "100px";
  1433 + temp.innerHTML = ins;
  1434 + },
  1435 + ferramentas: function(){
  1436 + if(!document.getElementById("panelferramentasEditor")){
  1437 + YAHOO.namespace("editorOL.ferramentas");
  1438 + YAHOO.editorOL.ferramentas.panel = new YAHOO.widget.Panel("panelferramentasEditor", {zIndex:20000, iframe:true, width:"300px", visible:false, draggable:true, close:true } );
  1439 + var ins = "" +
  1440 + '<p class=paragrafo >Operações sobre as figuras selecionadas:</p>' +
  1441 + '<select onchange="i3GEO.editorOL.processageo(this.value);this.value = \'\'" >' +
  1442 + ' <option value="">---</option>' +
  1443 + ' <option value=union >União</option>';
  1444 + if(i3GEO.php){
  1445 + ins += ' <option value=intersection >Intersecção</option>' +
  1446 + ' <option value=convexhull >Convex hull</option>' +
  1447 + ' <option value=boundary >Bordas</option>' +
  1448 + ' <option value=difference >Diferença</option>' +
  1449 + ' <option value=symdifference >Diferença simétrica</option>';
  1450 + }
  1451 + ins += '</select>'+
  1452 + '<br><br><a class=paragrafo href=# onclick="i3GEO.editorOL.layergrafico.destroyFeatures()" >Apaga tudo</a>';
  1453 +
  1454 + YAHOO.editorOL.ferramentas.panel.setBody(ins);
  1455 + if(typeof i3GEO != undefined && i3GEO != "")
  1456 + {YAHOO.editorOL.ferramentas.panel.setHeader("Ferramentas <div id='panelferramentasEditor_minimizaCabecalho' class='container-minimiza'></div>");}
  1457 + else
  1458 + {YAHOO.editorOL.ferramentas.panel.setHeader("Ferramentas");}
  1459 +
  1460 + YAHOO.editorOL.ferramentas.panel.setFooter("");
  1461 + YAHOO.editorOL.ferramentas.panel.render(document.body);
  1462 + YAHOO.editorOL.ferramentas.panel.center();
  1463 + YAHOO.util.Event.addListener(YAHOO.editorOL.ferramentas.panel.close, "click", function(){
  1464 + });
  1465 + temp = $i("panelferramentasEditor_minimizaCabecalho");
  1466 + if(temp){
  1467 + temp.onclick = function(){i3GEO.janela.minimiza("panelferramentasEditor");};
  1468 + }
  1469 + }
  1470 + else{
  1471 + YAHOO.editorOL.ferramentas.panel.render(document.body);
  1472 + }
  1473 + YAHOO.editorOL.ferramentas.panel.show();
  1474 + },
  1475 + snap: function(){
  1476 + var target = i3GEOOLsnap.targets[0],
  1477 + tipos = ["node","vertex","edge"],
  1478 + ntipos = tipos.length,
  1479 + i,
  1480 + temp,
  1481 + ativa = false;
  1482 + i3GEOOLsnap.deactivate();
  1483 + for(i=0;i<ntipos;i++){
  1484 + temp = $i("target_"+tipos[i]);
  1485 + target[tipos[i]] = temp.checked;
  1486 + if(temp.checked === true)
  1487 + {ativa = true;}
  1488 + temp = $i("target_"+tipos[i]+"Tolerance");
  1489 + target[tipos[i]+"Tolerance"] = temp.value;
  1490 + }
  1491 + if(ativa === true)
  1492 + {i3GEOOLsnap.activate();}
  1493 + },
  1494 + split: function(){
  1495 + i3GEOOLsplit.deactivate();
  1496 + var temp = $i("edge_split_toggle");
  1497 + if(temp.checked === true)
  1498 + {i3GEOOLsplit.activate();}
  1499 + },
  1500 + processageo: function(operacao){
  1501 + if(operacao === ""){return;}
  1502 + var geosel = i3GEO.editorOL.layergrafico.selectedFeatures,
  1503 + polis,linhas,pontos,temp;
  1504 + if(geosel.length > 0){
  1505 + polis = i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.Polygon");
  1506 + linhas = i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.LineString");
  1507 + pontos = i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.Point");
  1508 + temp = function(retorno){
  1509 + if(i3GEO.janela){
  1510 + i3GEO.janela.fechaAguarde("i3GEO.editorPoli");
  1511 + i3GEO.janela.fechaAguarde("i3GEO.editorLinhas");
  1512 + i3GEO.janela.fechaAguarde("i3GEO.editorPontos");
  1513 + }
  1514 + if(retorno != "" && retorno.data && retorno.data != "" && operacao != "converteSHP")
  1515 + {i3GEO.editorOL.substituiFeaturesSel(retorno.data);}
  1516 + if(operacao === "converteSHP"){
  1517 + i3GEO.atualiza();
  1518 + i3GEO.janela.minimiza("paneltemaativo");
  1519 + }
  1520 + };
  1521 + if(operacao === "union" && !i3GEO.php ){
  1522 + if(polis.length > 0){
  1523 + temp = i3GEO.editorOL.uniaojts(polis);
  1524 + i3GEO.editorOL.substituiFeaturesSel(temp);
  1525 + }
  1526 + if(linhas.length > 0){
  1527 + temp = i3GEO.editorOL.uniaojts(linhas);
  1528 + i3GEO.editorOL.substituiFeaturesSel(temp);
  1529 + }
  1530 + if(pontos.length > 0){
  1531 + temp = i3GEO.editorOL.uniaojts(p);
  1532 + i3GEO.editorOL.substituiFeaturesSel(temp);
  1533 + }
  1534 + }
  1535 + else{
  1536 + if(polis.length > 0){
  1537 + i3GEO.janela.abreAguarde("i3GEO.editorPoli","Poligonos");
  1538 + i3GEO.php.funcoesGeometriasWkt(temp,polis.join("|"),operacao);
  1539 + }
  1540 + if(linhas.length > 0){
  1541 + i3GEO.janela.abreAguarde("i3GEO.editorLinhas","Linhas");
  1542 + i3GEO.php.funcoesGeometriasWkt(temp,linhas.join("|"),operacao);
  1543 + }
  1544 + if(pontos.length > 0){
  1545 + i3GEO.janela.abreAguarde("i3GEO.editorPontos","Pontos");
  1546 + i3GEO.php.funcoesGeometriasWkt(temp,pontos.join("|"),operacao);
  1547 + }
  1548 + }
  1549 + return;
  1550 + }
  1551 + else
  1552 + {alert("Selecione pelo menos dois elementos");}
  1553 + },
  1554 + uniaojts: function(geoms){
  1555 + var n = geoms.length,
  1556 + rwkt = new jsts.io.WKTReader(),
  1557 + wwkt = new jsts.io.WKTWriter(),
  1558 + fwkt = new OpenLayers.Format.WKT(),
  1559 + g,
  1560 + i,uniao;
  1561 + if(n > 1){
  1562 + uniao = (fwkt.read(geoms[0]).geometry).toString();
  1563 + uniao = rwkt.read(uniao);
  1564 + for(i=1;i <= n;i++){
  1565 + g = (fwkt.read(geoms[i]).geometry).toString();
  1566 + uniao = uniao.union(rwkt.read(g));
  1567 + }
  1568 + uniao = wwkt.write(uniao);
  1569 + return [fwkt.read(uniao)];
  1570 + }
  1571 + else
  1572 + {return false;}
  1573 + },
  1574 + retornaGeometriasTipo: function(features,tipo){
  1575 + var n = features.length,
  1576 + lista = [],
  1577 + i,temp;
  1578 + for(i=0;i<n;i++){
  1579 + temp = features[i].geometry;
  1580 + if(temp.CLASS_NAME == tipo)
  1581 + {lista.push(temp);}
  1582 + }
  1583 + return lista;
  1584 + },
  1585 + guardaBackup: function(){
  1586 + return;
  1587 + if(!i3GEO.editorOL.backup)
  1588 + {i3GEO.editorOL.backup = new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false});}
  1589 + else
  1590 + {i3GEO.editorOL.backup.removeFeatures(i3GEO.editorOL.backup.features);}
  1591 + i3GEO.editorOL.backup.addFeatures(i3GEO.editorOL.layergrafico.features);
  1592 + },
  1593 + unselTodos:function(){
  1594 + var n,i;
  1595 + n = i3GEO.editorOL.layergrafico.features.length;
  1596 + for(i=0;i<n;i++){
  1597 + i3GEO.editorOL.layergrafico.features[i].renderIntent = "default";
  1598 + i3GEO.editorOL.selbutton.unselect(i3GEO.editorOL.layergrafico.features[i]);
  1599 + }
  1600 + },
  1601 + unselTodosBackup:function(){
  1602 + var n,i;
  1603 + n = i3GEO.editorOL.backup.features.length;
  1604 + for(i=0;i<n;i++){
  1605 + i3GEO.editorOL.backup.features[i].renderIntent = "default";
  1606 + i3GEO.editorOL.selbutton.unselect(i3GEO.editorOL.backup.features[i]);
  1607 + }
  1608 + },
  1609 + restauraBackup: function(){
  1610 + if(i3GEO.editorOL.backup.features.length > 0){
  1611 + i3GEO.editorOL.layergrafico.removeFeatures(i3GEO.editorOL.layergrafico.features);
  1612 + i3GEO.editorOL.layergrafico.addFeatures(i3GEO.editorOL.backup.features);
  1613 + }
  1614 + if(document.getElementById("panellistagEditor"))
  1615 + {i3GEO.editorOL.listaGeometrias();}
  1616 + //i3GEO.editorOL.backup.removeFeatures(i3GEO.editorOL.backup.features);
  1617 + },
  1618 + substituiFeaturesSel: function(wkt){
  1619 + i3GEO.editorOL.guardaBackup();
  1620 + try{
  1621 + var f,fwkt = new OpenLayers.Format.WKT();
  1622 + i3GEO.editorOL.layergrafico.removeFeatures(i3GEO.editorOL.layergrafico.selectedFeatures);
  1623 + f = fwkt.read(wkt);
  1624 + f["attributes"] = {
  1625 + opacidade: i3GEO.editorOL.simbologia.opacidade,
  1626 + texto: i3GEO.editorOL.simbologia.texto,
  1627 + fillColor: i3GEO.editorOL.simbologia.fillColor,
  1628 + strokeWidth: i3GEO.editorOL.simbologia.strokeWidth,
  1629 + strokeColor: i3GEO.editorOL.simbologia.strokeColor,
  1630 + pointRadius: i3GEO.editorOL.simbologia.pointRadius,
  1631 + graphicName: i3GEO.editorOL.simbologia.graphicName
  1632 + };
  1633 + i3GEO.editorOL.layergrafico.addFeatures([f]);
  1634 + if(document.getElementById("panellistagEditor"))
  1635 + {i3GEO.editorOL.listaGeometrias();}
  1636 + }
  1637 + catch(e)
  1638 + {i3GEO.editorOL.restauraBackup();}
  1639 + },
  1640 + flashFeaturesI: function(index){
  1641 + i3GEO.editorOL.flashFeatures([i3GEO.editorOL.layergrafico.features[index]],0);
  1642 + },
  1643 + flashFeatures: function(features, index) {
  1644 + if(!index) {
  1645 + index = 0;
  1646 + }
  1647 + var current = features[index];
  1648 + if(current && current.layer === i3GEO.editorOL.layergrafico) {
  1649 + i3GEO.editorOL.layergrafico.drawFeature(features[index], "select");
  1650 + }
  1651 + var prev = features[index-1];
  1652 + if(prev && prev.layer === i3GEO.editorOL.layergrafico) {
  1653 + i3GEO.editorOL.layergrafico.drawFeature(prev, "default");
  1654 + }
  1655 + ++index;
  1656 + if(index <= features.length) {
  1657 + window.setTimeout(function() {i3GEO.editorOL.flashFeatures(features, index);}, 75);
  1658 + }
  1659 + },
  1660 + selFeature: function(index) {
  1661 + i3GEO.editorOL.selbutton.select(i3GEO.editorOL.layergrafico.features[index]);
  1662 + },
  1663 + unselFeature: function(index) {
  1664 + i3GEO.editorOL.selbutton.unselect(i3GEO.editorOL.layergrafico.features[index]);
  1665 + },
  1666 + carregajts: function(funcao){
  1667 + if(i3GEO.configura)
  1668 + {i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/pacotes/jsts/lib/jsts.js",funcao,"i3GEOjts",true);}
  1669 + else
  1670 + {i3GEO.util.scriptTag("../pacotes/jsts/lib/jsts.js",funcao,"i3GEOjts",true);}
  1671 + },
  1672 + trazParaFrente: function(){
  1673 + var features = i3GEO.editorOL.layergrafico.selectedFeatures;
  1674 + if(features.length > 0){
  1675 + i3GEO.editorOL.backup = new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false});
  1676 + i3GEO.editorOL.backup.addFeatures(features);
  1677 + i3GEO.editorOL.unselTodosBackup();
  1678 + i3GEO.editorOL.layergrafico.removeFeatures(features);
  1679 + i3GEO.editorOL.layergrafico.addFeatures(i3GEO.editorOL.backup.features);
  1680 + if(document.getElementById("panellistagEditor"))
  1681 + {i3GEO.editorOL.listaGeometrias();}
  1682 + }
  1683 + else
  1684 + {alert("Selecione pelo menos um elemento");}
  1685 + },
  1686 + pegaControle: function(classe){
  1687 + var n = i3GEO.editorOL.controles.length,
  1688 + i;
  1689 + for(i=0;i<n;i++){
  1690 + if(i3GEO.editorOL.controles[i].CLASS_NAME === classe)
  1691 + {return i3GEO.editorOL.controles[i];}
  1692 + }
  1693 + return false;
  1694 + },
  1695 + ativaLayerSwitcher: function(){
  1696 + var ls = i3GEO.editorOL.pegaControle("OpenLayers.Control.LayerSwitcher");
  1697 + if(ls){
  1698 + ls.maximizeDiv.click();
  1699 + }
  1700 + },
  1701 + desativaRodaDoMouse: function(){
  1702 + var controls = i3GEO.editorOL.mapa.getControlsByClass('OpenLayers.Control.Navigation');
  1703 + for(var i = 0; i<controls.length; ++i){controls[i].disableZoomWheel();}
  1704 + }
  1705 +};
0 \ No newline at end of file 1706 \ No newline at end of file
mashups/openlayers.js.php
1 -/*jslint white:false,undef: false, rhino: true, onevar: true, evil: false */  
2 -var $i = function(id)  
3 -{return document.getElementById(id);};  
4 -//seta as variáveis navn e navm  
5 -var navn = false;  
6 -var navm = false;  
7 -var app = navigator.appName.substring(0,1);  
8 -if (app==='N'){navn=true;}else{navm=true;}  
9 -  
10 -OpenLayers.ImgPath = "../pacotes/openlayers/img/";  
11 -OpenLayers.Lang.setCode("pt-BR");  
12 -i3GEO.editorOL = {  
13 - simbologia: {  
14 - opacidade: 0.8,  
15 - texto: "",  
16 - fillColor: "250,180,15",  
17 - strokeWidth: 2,  
18 - strokeColor: "250,150,0",  
19 - pointRadius: 4,  
20 - graphicName: "square",  
21 - fontSize: "12px",  
22 - fontColor: "0,0,0"  
23 - },  
24 - backup: new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false}),  
25 - nomeFuncaoSalvar: "i3GEO.editorOL.testeSalvar()",  
26 - e_oce: new OpenLayers.Layer.ArcGIS93Rest(  
27 - "ESRI Ocean Basemap",  
28 - "http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer/export",  
29 - {format:"jpeg"},  
30 - {isBaseLayer:true,visibility:false}  
31 - ),  
32 - e_ims: new OpenLayers.Layer.ArcGIS93Rest(  
33 - "ESRI Imagery World 2D",  
34 - "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer/export",  
35 - {format:"jpeg"},  
36 - {isBaseLayer:true,visibility:false}  
37 - ),  
38 - e_wsm: new OpenLayers.Layer.ArcGIS93Rest(  
39 - "ESRI World Street Map",  
40 - "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer/export",  
41 - {format:"jpeg"},  
42 - {isBaseLayer:true,visibility:false}  
43 - ),  
44 - ol_mma: new OpenLayers.Layer.WMS(  
45 - "Base cartográfica",  
46 - "http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseraster.map&",  
47 - {layers:'baseraster',SRS:'EPSG:4618',FORMAT:'image/png'},  
48 - {singleTile:true}  
49 - ),  
50 - ol_wms: new OpenLayers.Layer.WMS.Untiled(  
51 - "OpenLayers WMS",  
52 - "http://labs.metacarta.com/wms/vmap0",  
53 - {layers: 'basic'}  
54 - ),  
55 - top_wms: new OpenLayers.Layer.WMS(  
56 - "Toponímia MMA",  
57 - "http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseref.map&",  
58 - {layers: "base",FORMAT:'image/png'}  
59 - ),  
60 - est_wms: new OpenLayers.Layer.WMS(  
61 - "Estados do Brasil",  
62 - "http://mapas.mma.gov.br/i3geo/ogc.php?tema=estadosl&",  
63 - {layers: "estadosl",FORMAT:'image/png'}  
64 - ),  
65 - fundo: "e_oce,e_ims,e_wsm,ol_mma,ol_wms,top_wms,est_wms",  
66 - kml: [],  
67 - layersIniciais: [],  
68 - botoes: {  
69 - 'pan':true,  
70 - 'zoombox':true,  
71 - 'zoomtot':true,  
72 - 'legenda':true,  
73 - 'distancia':true,  
74 - 'area':true,  
75 - 'identifica':true,  
76 - 'linha':true,  
77 - 'ponto':true,  
78 - 'poligono':true,  
79 - 'texto':true,  
80 - 'edita':true,  
81 - 'listag':true,  
82 - 'corta': true,  
83 - 'apaga':true,  
84 - 'procura':true,  
85 - 'selecao':true,  
86 - 'salva':true,  
87 - 'ajuda':true,  
88 - 'propriedades':true,  
89 - 'fecha':false,  
90 - 'tools':true,  
91 - 'undo':false,  
92 - 'frente':false,  
93 - 'legenda':true,  
94 - 'rodadomouse':true  
95 - },  
96 - pontos: [],  
97 - marca: "../pacotes/openlayers/img/marker-gold.png",  
98 - controles: [  
99 - new OpenLayers.Control.Navigation(),  
100 - new OpenLayers.Control.PanZoomBar(),  
101 - new OpenLayers.Control.LayerSwitcher({'ascending':false}),  
102 - new OpenLayers.Control.ScaleLine(),  
103 - new OpenLayers.Control.MousePosition({'separator':' '}),  
104 - new OpenLayers.Control.OverviewMap(),  
105 - new OpenLayers.Control.KeyboardDefaults()  
106 - ],  
107 - tiles: true,  
108 - incluilayergrafico: true,  
109 - ativalayerswitcher: false,  
110 - ativarodadomouse: true,  
111 - numzoom: 12,  
112 - maxext: "",  
113 - mapext: new OpenLayers.Bounds(-76.5125927,-39.3925675209,-29.5851853,9.49014852081),  
114 - mapa: "",  
115 - inicia: function(){  
116 - var single = false,  
117 - alayers = [],  
118 - fundo = (i3GEO.editorOL.fundo).split(","),  
119 - nfundo = fundo.length,  
120 - ncontroles = i3GEO.editorOL.controles.length,  
121 - i,  
122 - n;  
123 - if(i3GEO.editorOL.tiles === false || i3GEO.editorOL.tiles === "false"){  
124 - single = true;  
125 - }  
126 - if(i3GEO.editorOL.ativalayerswitcher === "false"){  
127 - i3GEO.editorOL.ativalayerswitcher = false;  
128 - }  
129 - if(i3GEO.editorOL.ativalayerswitcher === "true"){  
130 - i3GEO.editorOL.ativalayerswitcher = true;  
131 - }  
132 - if(i3GEO.editorOL.ativarodadomouse === "false"){  
133 - i3GEO.editorOL.ativarodadomouse = false;  
134 - }  
135 - if(i3GEO.editorOL.ativarodadomouse === "true"){  
136 - i3GEO.editorOL.ativarodadomouse = true;  
137 - }  
138 - if(i3GEO.editorOL.incluilayergrafico === "false"){  
139 - i3GEO.editorOL.incluilayergrafico = false;  
140 - }  
141 - if(i3GEO.editorOL.incluilayergrafico === "true"){  
142 - i3GEO.editorOL.incluilayergrafico = true;  
143 - }  
144 - if(i3GEO.editorOL.incluilayergrafico === true){  
145 - i3GEO.editorOL.criaLayerGrafico();  
146 - }  
147 - else{  
148 - i3GEO.editorOL.layergrafico = "";  
149 - i3GEO.editorOL.botoes.linha=false;  
150 - i3GEO.editorOL.botoes.ponto=false;  
151 - i3GEO.editorOL.botoes.poligono=false;  
152 - i3GEO.editorOL.botoes.texto=false;  
153 - i3GEO.editorOL.botoes.edita=false;  
154 - i3GEO.editorOL.botoes.listag=false;  
155 - i3GEO.editorOL.botoes.corta= false;  
156 - i3GEO.editorOL.botoes.apaga=false;  
157 - i3GEO.editorOL.botoes.selecao=false;  
158 - i3GEO.editorOL.botoes.salva=false;  
159 - i3GEO.editorOL.botoes.propriedades=false;  
160 - i3GEO.editorOL.botoes.fecha=false;  
161 - i3GEO.editorOL.botoes.tools=false;  
162 - i3GEO.editorOL.botoes.undo=false;  
163 - i3GEO.editorOL.botoes.frente=false;  
164 - }  
165 - if(i3GEO.editorOL.mapa === "")  
166 - {alert("O objeto i3GEO.editorOL.mapa precisa ser criado com new OpenLayers.Map()");return;}  
167 - if(i3GEO.editorOL.maxext !== ""){  
168 - i3GEO.editorOL.mapa.setOptions({  
169 - maxExtent: i3GEO.editorOL.maxext  
170 - });  
171 - }  
172 - if(i3GEO.editorOL.numzoom !== ""){  
173 - i3GEO.editorOL.mapa.setOptions({  
174 - numZoomLevels: i3GEO.editorOL.numzoom  
175 - });  
176 - }  
177 - for(i=0;i<ncontroles;i++){  
178 - i3GEO.editorOL.mapa.addControl(i3GEO.editorOL.controles[i]);  
179 - }  
180 - if(i3GEO.editorOL.fundo != ""){  
181 - for(i=nfundo-1;i>=0;i--){  
182 - try{  
183 - eval("i3GEO.editorOL."+fundo[i]+".transitionEffect = 'resize';");  
184 - eval("i3GEO.editorOL."+fundo[i]+".setVisibility(false);");  
185 - eval("i3GEO.editorOL."+fundo[i]+".singleTile = single;");  
186 - eval("alayers.push(i3GEO.editorOL."+fundo[i]+");");  
187 - }  
188 - catch(e){  
189 - if(alayers[0])  
190 - {alayers[0].setVisibility(true);}  
191 - }  
192 - }  
193 - }  
194 - i3GEO.editorOL.mapa.addLayers(alayers);  
195 - if(i3GEO.editorOL.layersIniciais !== ""){  
196 - n = i3GEO.editorOL.layersIniciais.length;  
197 - for(i=0;i<n;i++){  
198 - i3GEO.editorOL.layersIniciais[i].singleTile = single;  
199 - i3GEO.editorOL.mapa.addLayer(i3GEO.editorOL.layersIniciais[i]);  
200 - }  
201 - }  
202 - if(i3GEO.editorOL.layergrafico !== ""){  
203 - i3GEO.editorOL.mapa.addLayers([i3GEO.editorOL.layergrafico]);  
204 - }  
205 - i3GEO.editorOL.adicionaKml();  
206 - i3GEO.editorOL.adicionaMarcas();  
207 - if(i3GEO.editorOL.maxext !== "")  
208 - {i3GEO.editorOL.mapa.zoomToMaxExtent();}  
209 - if(i3GEO.editorOL.mapext != "")  
210 - {i3GEO.editorOL.mapa.zoomToExtent(i3GEO.editorOL.mapext);}  
211 - i3GEO.editorOL.coordenadas();  
212 - i3GEO.editorOL.criaJanelaBusca();  
213 - i3GEO.editorOL.criaBotoes(i3GEO.editorOL.botoes);  
214 - if(i3GEO.editorOL.ativalayerswitcher === true)  
215 - {i3GEO.editorOL.ativaLayerSwitcher();}  
216 - if(i3GEO.editorOL.ativarodadomouse === false)  
217 - {i3GEO.editorOL.desativaRodaDoMouse();}  
218 - },  
219 - criaLayerGrafico: function(){  
220 - var sketchSymbolizers = {  
221 - "Point": {  
222 - fillColor: "rgb(${fillColor})",  
223 - fillOpacity: "${opacidade}",  
224 - strokeWidth: "${strokeWidth}",  
225 - strokeOpacity: "${opacidade}",  
226 - strokeColor: "rgb(${strokeColor})",  
227 - label: "${texto}",  
228 - pointRadius: "${pointRadius}",  
229 - graphicName: "${graphicName}",  
230 - fontSize: "${fontSize}",  
231 - fontColor: "rgb(${fontColor})",  
232 - fontFamily: "Arial",  
233 - fontWeight: "normal",  
234 - labelAlign: "lb",  
235 - labelXOffset: "3",  
236 - labelYOffset: "3"  
237 - },  
238 - "Line": {  
239 - strokeWidth: "${strokeWidth}",  
240 - strokeOpacity: "${opacidade}",  
241 - strokeColor: "rgb(${strokeColor})"  
242 - },  
243 - "Polygon": {  
244 - strokeWidth: "${strokeWidth}",  
245 - strokeOpacity: "${opacidade}",  
246 - strokeColor: "rgb(${strokeColor})",  
247 - fillColor: "rgb(${fillColor})",  
248 - fillOpacity: "${opacidade}"  
249 - }  
250 - },  
251 - style = new OpenLayers.Style(),  
252 - styleMap1 = new OpenLayers.StyleMap({"default": style});  
253 - style.addRules([  
254 - new OpenLayers.Rule({symbolizer: sketchSymbolizers})  
255 - ]);  
256 - i3GEO.editorOL.layergrafico = new OpenLayers.Layer.Vector("Edição",{  
257 - styleMap: styleMap1,  
258 - displayInLayerSwitcher:true,  
259 - visibility:true  
260 - }  
261 - );  
262 - },  
263 - layersLigados: function(){  
264 - var layers = i3GEO.editorOL.mapa.layers,  
265 - nlayers = layers.length,  
266 - ins = [];  
267 - for(i=0;i<nlayers;i++){  
268 - if(layers[i].visibility === true){  
269 - ins.push(layers[i]);  
270 - }  
271 - }  
272 - return ins;  
273 - },  
274 - coordenadas: function(){  
275 - //  
276 - //substitui o controle que mostra as coordenadas  
277 - //  
278 - var idcoord = i3GEO.editorOL.mapa.getControlsBy("separator"," ");  
279 - if(idcoord[0]){  
280 - i3GEO.editorOL.mapa.events.register("mousemove", i3GEO.editorOL.mapa, function(e){  
281 - var p,lonlat,d,dc;  
282 - if (navm)  
283 - {p = new OpenLayers.Pixel(e.x,e.y);}  
284 - else  
285 - {p = e.xy;}  
286 - //altera o indicador de localizacao  
287 - lonlat = i3GEO.editorOL.mapa.getLonLatFromPixel(p);  
288 - d = i3GEO.calculo.dd2dms(lonlat.lon,lonlat.lat);  
289 - try{  
290 - $i(idcoord[0].id).innerHTML = "Long: "+d[0]+"<br>Lat: "+d[1];  
291 - }  
292 - catch(e){  
293 - if(typeof(console) !== 'undefined'){console.error(e);}  
294 - }  
295 - });  
296 - }  
297 - },  
298 - criaJanelaBusca: function(){  
299 - var layers = i3GEO.editorOL.layersLigados(),  
300 - nlayers = layers.length,  
301 - i,  
302 - ins,  
303 - combo = "<select id=i3GEOOLlistaTemasBusca ><option value=''>----</option>";  
304 - for(i=0;i<nlayers;i++){  
305 - combo += "<option value='"+i+"' >"+layers[i].name+"</option>";  
306 - }  
307 - combo += "</select>";  
308 - ins = "<div class=paragrafo >Tema:<br>"+combo;  
309 - ins += "<br>Item:<br><span id=i3GEOOLcomboitens ></span>";  
310 - ins += "<br>Procurar por:<br><input type=text size=20 id=i3GEOOLpalavraBusca >";  
311 - ins += "<br><br><input type=button value='Procurar' id='i3GEOOLbotaoBusca' ></div>";  
312 - ins += "<br>Resultado:<br><span id=i3GEOOLcomboresultado ></span>";  
313 - try{  
314 - YAHOO.namespace("procura.container");  
315 - YAHOO.procura.container.panel = new YAHOO.widget.Panel("panelprocura", {zIndex:2000, iframe:false, width:"250px", visible:false, draggable:true, close:true } );  
316 - YAHOO.procura.container.panel.setHeader("Encontre no mapa");  
317 - YAHOO.procura.container.panel.setBody(ins);  
318 - YAHOO.procura.container.panel.setFooter("");  
319 - YAHOO.procura.container.panel.render(document.body);  
320 - YAHOO.procura.container.panel.center();  
321 -  
322 - document.getElementById("i3GEOOLbotaoBusca").onclick = function(){  
323 - var layer = i3GEO.editorOL.layerAtivo(),  
324 - item = document.getElementById("i3GEOOLbuscaItem").value,  
325 - palavra = document.getElementById("i3GEOOLpalavraBusca").value;  
326 - if(item === "" || palavra === "")  
327 - {alert("Escolha o item e o texto de busca");return;}  
328 - i3GEO.editorOL.busca(layer,item,palavra,"i3GEOOLcomboresultado");  
329 - };  
330 - document.getElementById("i3GEOOLlistaTemasBusca").onchange = function(){  
331 - i3GEO.editorOL.ativaTema(this.value);  
332 - document.getElementById("i3GEOOLcomboitens").innerHTML = "...";  
333 - i3GEO.editorOL.listaItens(i3GEO.editorOL.layerAtivo(),"i3GEOOLcomboitens","i3GEOOLbuscaItem");  
334 - };  
335 - }  
336 - catch(e){}  
337 - },  
338 - criaComboTemas: function(){  
339 - var layers = i3GEO.editorOL.layersLigados(),  
340 - nlayers = layers.length,  
341 - i,  
342 - temp,  
343 - combo = "<select id=i3GEOOLlistaTemasAtivos >";  
344 - //i3GEO.editorOL.layergrafico.setLayerIndex(i3GEO.editorOL.getNumLayers() + 1);  
345 - for(i=0;i<nlayers;i++){  
346 - combo += "<option value='"+i+"' >"+layers[i].name+"</option>";  
347 - }  
348 - combo += "</select>";  
349 - return combo;  
350 - },  
351 - atualizaJanelaAtivaTema: function(){  
352 - var combo = i3GEO.editorOL.criaComboTemas();  
353 - YAHOO.temaativo.container.panel.setBody(combo);  
354 - document.getElementById("i3GEOOLlistaTemasAtivos").onchange = function(){  
355 - if(botaoIdentifica){  
356 - botaoIdentifica.layers = [i3GEO.editorOL.layersLigados()[this.value]];  
357 - }  
358 - };  
359 - },  
360 - criaJanelaAtivaTema: function(){  
361 - var temp;  
362 - if(!document.getElementById("paneltemaativo")){  
363 - YAHOO.namespace("temaativo.container");  
364 - YAHOO.temaativo.container.panel = new YAHOO.widget.Panel("paneltemaativo", {zIndex:20000, iframe:true, width:"250px", visible:false, draggable:true, close:true } );  
365 - YAHOO.temaativo.container.panel.setBody("");  
366 - if(typeof i3GEO != undefined && i3GEO != "")  
367 - {YAHOO.temaativo.container.panel.setHeader("Tema ativo<div id='paneltemaativo_minimizaCabecalho' class='container-minimiza'></div>");}  
368 - else  
369 - {YAHOO.temaativo.container.panel.setHeader("Tema ativo");}  
370 - YAHOO.temaativo.container.panel.setFooter("");  
371 - YAHOO.temaativo.container.panel.render(document.body);  
372 - YAHOO.temaativo.container.panel.show();  
373 - YAHOO.temaativo.container.panel.center();  
374 - i3GEO.editorOL.atualizaJanelaAtivaTema();  
375 - YAHOO.util.Event.addListener(YAHOO.temaativo.container.panel.close, "click", function(){  
376 - i3GEOpanelEditor.deactivate();  
377 - i3GEOpanelEditor.activate();  
378 - if(i3GEO.eventos && i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search("i3GEO.editorOL.atualizaJanelaAtivaTema()") > 0)  
379 - {i3GEO.eventos.ATUALIZAARVORECAMADAS.remove("i3GEO.editorOL.atualizaJanelaAtivaTema()");}  
380 - });  
381 - if(typeof i3GEO != undefined && i3GEO != ""){  
382 - if(i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search("i3GEO.editorOL.atualizaJanelaAtivaTema()") < 0)  
383 - {i3GEO.eventos.ATUALIZAARVORECAMADAS.push("i3GEO.editorOL.atualizaJanelaAtivaTema()");}  
384 - }  
385 - temp = $i("paneltemaativo_minimizaCabecalho");  
386 - if(temp){  
387 - temp.onclick = function(){i3GEO.janela.minimiza("paneltemaativo");}  
388 - }  
389 - }  
390 - else{  
391 - YAHOO.temaativo.container.panel.show();  
392 - }  
393 - },  
394 - ativaTema: function(id){  
395 - document.getElementById("i3GEOOLlistaTemasAtivos").value = id;  
396 - },  
397 - layerAtivo: function(){  
398 - var id = document.getElementById("i3GEOOLlistaTemasAtivos");  
399 - if(id)  
400 - {id = id.value;}  
401 - else  
402 - {id = i3GEO.temaAtivo;}  
403 - return i3GEO.editorOL.layersLigados()[id];  
404 - },  
405 - listaItens: function(layer,idonde,idobj){  
406 - if(!layer){return;}  
407 - if(!layer.params){return;}  
408 - var u = layer.url+"&request=describefeaturetype&service=wfs&version=1.0.0";  
409 - u += "&typename="+layer.params.LAYERS;  
410 - document.body.style.cursor="wait";  
411 - document.getElementById("i3geoMapa").style.cursor = "wait";  
412 - OpenLayers.Request.issue({  
413 - method: "GET",  
414 - url: u,  
415 - callback: function(retorno){  
416 - document.body.style.cursor="default";  
417 - document.getElementById("i3geoMapa").style.cursor = "default";  
418 - var fromgml = new OpenLayers.Format.WFSDescribeFeatureType({  
419 - geometryName: "msGeometry"  
420 - }),  
421 - gml = fromgml.read(retorno.responseText),  
422 - prop = gml.featureTypes[0].properties,  
423 - nprop = prop.length,  
424 - itens = [],  
425 - i,  
426 - combo = "<select id="+idobj+" ><option value=''>----</option>";  
427 - for(i = 0;i < nprop; i++){  
428 - combo += "<option value="+prop[i].name+" >"+prop[i].name+"</option>";  
429 - }  
430 - combo += "</select>";  
431 - document.getElementById(idonde).innerHTML = combo;  
432 - },  
433 - failure: function(){  
434 - document.body.style.cursor="default";  
435 - document.getElementById("i3geoMapa").style.cursor = "default";  
436 - alert("Erro");  
437 - }  
438 - });  
439 - },  
440 - busca: function(layer,item,palavra,onde){  
441 - document.body.style.cursor="wait";  
442 - document.getElementById("i3geoMapa").style.cursor = "wait";  
443 - var u = layer.url+"&request=getfeature&service=wfs&version=1.0.0";  
444 - u += "&OUTPUTFORMAT=gml2&typename="+layer.params.LAYERS;  
445 - u += "&filter=<Filter><PropertyIsLike wildcard=* singleChar=. escape=! ><PropertyName>"+item+"</PropertyName><Literal>*"+palavra+"*</Literal></PropertyIsLike></Filter>";  
446 - document.body.style.cursor="wait";  
447 - document.getElementById("i3geoMapa").style.cursor = "wait";  
448 - document.getElementById(onde).innerHTML = "...";  
449 - OpenLayers.Request.issue({  
450 - method: "GET",  
451 - url: u,  
452 - callback: function(retorno){  
453 - document.body.style.cursor="default";  
454 - document.getElementById("i3geoMapa").style.cursor = "default";  
455 - var fromgml = new OpenLayers.Format.GML({  
456 - geometryName: "msGeometry"  
457 - }),  
458 - gml = fromgml.read(retorno.responseText),  
459 - ngml = gml.length,  
460 - i,  
461 - ins = "<select onchange='i3GEO.editorOL.zoomPara(this.value)'>";  
462 - ins += "<option value=''>---</option>";  
463 - for(i=0;i<ngml;i++){  
464 - eval("var valor = gml[i].data."+item);  
465 - var bounds = gml[i].geometry.getBounds();  
466 - bounds = bounds.toBBOX();  
467 - ins += "<option value='"+bounds+"'>"+valor+"</option>";  
468 - }  
469 - ins += "</select>";  
470 - document.getElementById(onde).innerHTML = ins;  
471 - },  
472 - failure: function(){  
473 - document.body.style.cursor="default";  
474 - document.getElementById("i3geoMapa").style.cursor = "default";  
475 - alert("Erro");  
476 - }  
477 - });  
478 - },  
479 - zoomPara: function(bbox){  
480 - var b = new OpenLayers.Bounds.fromString(bbox);  
481 - i3GEO.editorOL.mapa.zoomToExtent(b);  
482 - },  
483 - mostraLegenda: function(){  
484 - var layers = i3GEO.editorOL.layersLigados(),  
485 - nlayers = layers.length,  
486 - ins = "";  
487 - for(i=0;i<nlayers;i++){  
488 - try{  
489 - var url = layers[i].getFullRequestString({"request":"getlegendgraphic"});  
490 - url = url.replace("LAYERS","LAYER");  
491 - ins += "<img src='"+url+"' /><br>";  
492 - }  
493 - catch(e){}  
494 - }  
495 - //var w = window.open();  
496 - //w.document.write(ins);  
497 - //w.document.close();  
498 - var temp;  
499 - if(!document.getElementById("panellegendaeditorOL")){  
500 - YAHOO.namespace("legendaeditorOL.container");  
501 - YAHOO.legendaeditorOL.container.panel = new YAHOO.widget.Panel("panellegendaeditorOL", {zIndex:20000, iframe:true, width:"250px", visible:false, draggable:true, close:true } );  
502 - YAHOO.legendaeditorOL.container.panel.setBody(ins);  
503 - YAHOO.legendaeditorOL.container.panel.setHeader("Legenda");  
504 - YAHOO.legendaeditorOL.container.panel.setFooter("");  
505 - YAHOO.legendaeditorOL.container.panel.render(document.body);  
506 - YAHOO.legendaeditorOL.container.panel.show();  
507 - YAHOO.legendaeditorOL.container.panel.center();  
508 -  
509 - YAHOO.util.Event.addListener(YAHOO.legendaeditorOL.container.panel.close, "click", function(){  
510 - //i3GEOpanelEditor.deactivate();  
511 - //i3GEOpanelEditor.activate();  
512 - });  
513 - }  
514 - else{  
515 - YAHOO.legendaeditorOL.container.panel.setBody(ins);  
516 - YAHOO.legendaeditorOL.container.panel.show();  
517 - }  
518 - },  
519 - captura: function(lonlat){  
520 - //if(i3GEO.editorOL.layergrafico !== ""){return;}  
521 - var layers = [i3GEO.editorOL.layerAtivo()],  
522 - xy = lonlat.split(","),  
523 - u = layers[0].url+"&request=getfeature&service=wfs&version=1.0.0";  
524 - u += "&OUTPUTFORMAT=gml2&typename="+layers[0].params.LAYERS;  
525 -  
526 - //u += "&filter=<Filter><Intersects><PropertyName>Geometry</PropertyName><gml:Point><gml:coordinates>"+lonlat+"</gml:coordinates></gml:Point></Intersects></Filter>";  
527 -  
528 - xy[0] = xy[0] * 1;  
529 - xy[1] = xy[1] * 1;  
530 - var poligono = (xy[0]-0.1)+","+(xy[1]+0.1) + " "+(xy[0]+0.1)+","+(xy[1]+0.1)+" " + (xy[0]+0.1)+","+(xy[1]-0.1)+" " + (xy[0]-0.1)+","+(xy[1]-0.1)+" "+(xy[0]-0.1)+","+(xy[1]+0.1);  
531 - u += "&filter=<Filter><Intersects><PropertyName>Geometry</PropertyName><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:posList>"+poligono+"</gml:posList></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects></Filter>";  
532 -  
533 - document.body.style.cursor="wait";  
534 - if(document.getElementById("i3geoMapa"))  
535 - {document.getElementById("i3geoMapa").style.cursor = "wait";}  
536 - OpenLayers.Request.issue({  
537 - method: "GET",  
538 - url: u,  
539 - callback: function(retorno){  
540 - document.body.style.cursor="default";  
541 - if(document.getElementById("i3geoMapa"))  
542 - {document.getElementById("i3geoMapa").style.cursor = "default";}  
543 - var i,n,f,  
544 - fromgml = new OpenLayers.Format.GML({  
545 - geometryName: "msGeometry"  
546 - }),  
547 - gml = fromgml.read(retorno.responseText);  
548 - n = gml.length;  
549 - for(i=0;i<n;i++){  
550 - f = gml[i];  
551 - f["attributes"] = {  
552 - opacidade: i3GEO.editorOL.simbologia.opacidade,  
553 - texto: i3GEO.editorOL.simbologia.texto,  
554 - fillColor: i3GEO.editorOL.simbologia.fillColor,  
555 - strokeWidth: i3GEO.editorOL.simbologia.strokeWidth,  
556 - strokeColor: i3GEO.editorOL.simbologia.strokeColor,  
557 - pointRadius: i3GEO.editorOL.simbologia.pointRadius,  
558 - graphicName: i3GEO.editorOL.simbologia.graphicName  
559 - };  
560 - }  
561 - i3GEO.editorOL.layergrafico.addFeatures(gml);  
562 - },  
563 - failure: function(){  
564 - document.body.style.cursor="default";  
565 - if(document.getElementById("i3geoMapa"))  
566 - {document.getElementById("i3geoMapa").style.cursor = "default";}  
567 - alert("Erro");  
568 - }  
569 - });  
570 - },  
571 - salvaGeometrias: function(){  
572 - var geos = i3GEO.editorOL.layergrafico.selectedFeatures;  
573 - var n = geos.length;  
574 - var ins = "";  
575 - if(n > 0){  
576 - try{  
577 - YAHOO.namespace("salvaGeometrias.container");  
578 - YAHOO.salvaGeometrias.container.panel = new YAHOO.widget.Panel("panelsalvageometrias", {zIndex:2000, iframe:false, width:"250px", visible:false, draggable:true, close:true } );  
579 - YAHOO.salvaGeometrias.container.panel.setHeader("Geometrias");  
580 - YAHOO.salvaGeometrias.container.panel.setBody("");  
581 - YAHOO.salvaGeometrias.container.panel.setFooter("");  
582 - YAHOO.salvaGeometrias.container.panel.render(document.body);  
583 - YAHOO.salvaGeometrias.container.panel.center();  
584 - }  
585 - catch(e){}  
586 - YAHOO.salvaGeometrias.container.panel.show();  
587 - ins += "<p class=paragrafo >Foram encontrada(s) "+n+" geometria(s) selecionada(s) </p>";  
588 - ins += "<p class=paragrafo ><a href='#' onclick='i3GEO.editorOL.listaGeometriasSel()' >Listar</a>&nbsp;&nbsp;";  
589 - ins += "<a href='#' onclick='"+i3GEO.editorOL.nomeFuncaoSalvar+"' >Salvar</a>&nbsp;&nbsp;";  
590 - ins += "<a href='#' onclick='i3GEO.editorOL.exportarSHP()' >Exportar (shapefile)</a></p>";  
591 - YAHOO.salvaGeometrias.container.panel.setBody(ins);  
592 - }  
593 - else  
594 - {alert("Selecione pelo menos um elemento");}  
595 - },  
596 - exportarSHP: function(){  
597 - i3GEO.editorOL.processageo("converteSHP");  
598 - },  
599 - listaGeometriasSel: function(){  
600 - var geos = i3GEO.editorOL.layergrafico.selectedFeatures;  
601 - var n = geos.length;  
602 - var ins = "";  
603 - for(i=0;i<n;i++){  
604 - ins += "<b>Geometria: "+i+"</b><br>"+geos[i].geometry+"<br><br>";  
605 - ins += "<b>Atributos: "+i+"</b><br>";  
606 - var a = geos[i].attributes;  
607 - var keys = [];  
608 - for(key in a){  
609 - if(a[key]){  
610 - ins += key+" = "+a[key]+"<br>";  
611 - }  
612 - }  
613 - }  
614 - var w = window.open();  
615 - w.document.write(ins);  
616 - w.document.close();  
617 - },  
618 - testeSalvar: function(){  
619 - alert("Funcao nao disponivel. Defina o nome da funcao em i3GEO.editorOL.nomeFuncaoSalvar ");  
620 - },  
621 - criaBotoes: function(botoes){  
622 - var sketchSymbolizers = {  
623 - "Point": {  
624 - pointRadius: 4,  
625 - graphicName: "square",  
626 - fillColor: "white",  
627 - fillOpacity: 1,  
628 - strokeWidth: 1,  
629 - strokeOpacity: 1,  
630 - strokeColor: "#333333"  
631 - },  
632 - "Line": {  
633 - strokeWidth: 3,  
634 - strokeOpacity: 1,  
635 - strokeColor: "#666666",  
636 - strokeDashstyle: "dash"  
637 - },  
638 - "Polygon": {  
639 - strokeWidth: 2,  
640 - strokeOpacity: 1,  
641 - strokeColor: "#666666",  
642 - fillColor: "white",  
643 - fillOpacity: 0.3  
644 - }  
645 - },  
646 - style = new OpenLayers.Style(),  
647 - styleMap = new OpenLayers.StyleMap({"default": style}),  
648 - adiciona = false,  
649 - button,  
650 - controles = [];  
651 - style.addRules([  
652 - new OpenLayers.Rule({symbolizer: sketchSymbolizers})  
653 - ]);  
654 - i3GEOpanelEditor = new OpenLayers.Control.Panel({  
655 - displayClass: "olControlEditingToolbar1 noprint",  
656 - saveState: false,  
657 - activateControl: function(c){  
658 - this.deactivate();  
659 - this.activate();  
660 - try{  
661 - i3GEO.editorOL.ModifyFeature.deactivate();  
662 - if(i3GEO && i3GEO.barraDeBotoes){  
663 - i3GEO.barraDeBotoes.ativaPadrao();  
664 - }  
665 - }  
666 - catch(e){}  
667 - if(!c.trigger)  
668 - {c.activate();}  
669 - else  
670 - {c.trigger.call();}  
671 - });  
672 - if(botoes.procura===true){  
673 - button = new OpenLayers.Control.Button({  
674 - displayClass: "editorOLprocura",  
675 - trigger: function(){YAHOO.procura.container.panel.show();},  
676 - title: "procura",  
677 - type: OpenLayers.Control.TYPE_BUTTON  
678 - });  
679 - controles.push(button);  
680 - adiciona = true;  
681 - }  
682 - if(botoes.pan===true){  
683 - controles.push(new OpenLayers.Control.Navigation({  
684 - title: "deslocar",  
685 - displayClass:"editorOLpan",  
686 - type: OpenLayers.Control.TYPE_TOOL  
687 - }));  
688 - adiciona = true;  
689 - }  
690 - if(botoes.zoombox===true){  
691 - controles.push(new OpenLayers.Control.ZoomBox({  
692 - title: "zoombox",  
693 - displayClass: "editorOLzoombox",  
694 - type: OpenLayers.Control.TYPE_TOOL  
695 - }));  
696 - adiciona = true;  
697 - }  
698 - if(botoes.zoomtot===true){  
699 - button = new OpenLayers.Control.Button({  
700 - displayClass: "editorOLzoomtot",  
701 - trigger: function(){i3GEO.editorOL.mapa.zoomToMaxExtent();},  
702 - title: "ajusta extensão",  
703 - type: OpenLayers.Control.TYPE_BUTTON  
704 - });  
705 - controles.push(button);  
706 - adiciona = true;  
707 - }  
708 - if(botoes.legenda===true){  
709 - button = new OpenLayers.Control.Button({  
710 - displayClass: "editorOLlegenda",  
711 - trigger: function(){i3GEO.editorOL.mostraLegenda();},  
712 - title: "legenda",  
713 - type: OpenLayers.Control.TYPE_BUTTON  
714 - });  
715 - controles.push(button);  
716 - adiciona = true;  
717 - }  
718 - if(botoes.distancia===true){  
719 - button = new OpenLayers.Control.Measure(  
720 - OpenLayers.Handler.Path,  
721 - {  
722 - handlerOptions: {layerOptions: {styleMap: styleMap}},  
723 - persist: true,  
724 - displayClass: "editorOLdistancia",  
725 - title: "distância",  
726 - type: OpenLayers.Control.TYPE_TOOL  
727 - }  
728 - );  
729 - button.events.on({  
730 - "measure": function(event){  
731 - var units = event.units,  
732 - measure = event.measure;  
733 - alert("Distância: " + measure.toFixed(3) + " " + units);  
734 - }  
735 - });  
736 - controles.push(button);  
737 - adiciona = true;  
738 - }  
739 - if(botoes.area===true){  
740 - button = new OpenLayers.Control.Measure(  
741 - OpenLayers.Handler.Polygon,  
742 - {  
743 - handlerOptions: {layerOptions: {styleMap: styleMap}},  
744 - persist: true,  
745 - displayClass: "editorOLarea",  
746 - title: "área",  
747 - type: OpenLayers.Control.TYPE_TOOL  
748 - }  
749 - );  
750 - button.events.on({  
751 - "measure": function(event){  
752 - var units = event.units;  
753 - var measure = event.measure;  
754 - alert("Área: " + measure.toFixed(3) + " " + units + " quadrados");  
755 - }  
756 - });  
757 - controles.push(button);  
758 - adiciona = true;  
759 - }  
760 - if(botoes.identifica===true){  
761 - botaoIdentifica = new OpenLayers.Control.WMSGetFeatureInfo({  
762 - maxFeatures:1,  
763 - infoFormat:'text/plain', //'application/vnd.ogc.gml',  
764 - layers: [i3GEO.editorOL.layerAtivo()],  
765 - queryVisible: true,  
766 - title: "identifica",  
767 - type: OpenLayers.Control.TYPE_TOOL,  
768 - displayClass: "editorOLidentifica",  
769 - eventListeners: {  
770 - getfeatureinfo: function(event) {  
771 - var lonlat = i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy),  
772 - lonlattexto = "<hr>",  
773 - formata;  
774 - if( botoes.linha === true || botoes.ponto === true || botoes.poligono === true || botoes.edita === true){  
775 - lonlattexto += "<pre><span style=color:blue;cursor:pointer onclick='i3GEO.editorOL.captura(\""+lonlat.lon+","+lonlat.lat+"\")'>captura</span></pre>";  
776 - }  
777 - formata = function(texto){  
778 - var temp,  
779 - temp1,  
780 - n,  
781 - i,  
782 - f = [],  
783 - f1 = [],  
784 - textoN = texto.split(":");  
785 - try{  
786 - if(textoN.length > 1){  
787 - temp = textoN[2].replace(/\n\r/g, "");  
788 - temp = temp.replace(/'/g, "");  
789 - temp = temp.replace(/\n/g, "|");  
790 - temp = temp.replace(/_/g, " ");  
791 - temp = temp.replace(/=/g, ":");  
792 - temp = temp.split("|");  
793 - n = temp.length;  
794 - for(i=0;i<n;i++){  
795 - temp1 = temp[i].replace(/^\s+/,"");  
796 - temp1 = temp1.replace(/\s+$/,"");  
797 - if(temp1 != "")  
798 - f.push(temp1);  
799 - }  
800 - texto = f.join("<br><br>");  
801 - }  
802 - }  
803 - catch(e){}  
804 - return texto;  
805 - };  
806 - i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud(  
807 - "chicken",  
808 - i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy),  
809 - null,  
810 - lonlattexto+"<pre>"+formata(event.text)+"</pre>",  
811 - null,  
812 - true  
813 - ));  
814 - },  
815 - beforegetfeatureinfo: function(event){  
816 - var ativo = [i3GEO.editorOL.layerAtivo()];  
817 - event.object.layers = ativo;  
818 - botaoIdentifica.layers = ativo;  
819 - botaoIdentifica.url = ativo[0].url;  
820 - },  
821 - activate: function(){  
822 - i3GEO.editorOL.criaJanelaAtivaTema();  
823 - }  
824 - }  
825 - });  
826 - //button.events.register("getfeatureinfo", this, showInfo);  
827 - controles.push(botaoIdentifica);  
828 - adiciona = true;  
829 - }  
830 - if(botoes.linha===true){  
831 - button = new OpenLayers.Control.DrawFeature(  
832 - i3GEO.editorOL.layergrafico,  
833 - OpenLayers.Handler.Path,  
834 - {  
835 - displayClass: "editorOLlinha",  
836 - title: "digitalizar linha",  
837 - type: OpenLayers.Control.TYPE_TOOL,  
838 - callbacks:{  
839 - done: function(feature){  
840 - var f = new OpenLayers.Feature.Vector(feature);  
841 - f["attributes"] = {  
842 - opacidade: i3GEO.editorOL.simbologia.opacidade,  
843 - texto: i3GEO.editorOL.simbologia.texto,  
844 - fillColor: i3GEO.editorOL.simbologia.fillColor,  
845 - strokeWidth: i3GEO.editorOL.simbologia.strokeWidth,  
846 - strokeColor: i3GEO.editorOL.simbologia.strokeColor,  
847 - pointRadius: i3GEO.editorOL.simbologia.pointRadius,  
848 - graphicName: i3GEO.editorOL.simbologia.graphicName  
849 - };  
850 - i3GEO.editorOL.layergrafico.addFeatures([f]);  
851 - if(document.getElementById("panellistagEditor"))  
852 - {i3GEO.editorOL.listaGeometrias();}  
853 - }  
854 - }  
855 - }  
856 - );  
857 - controles.push(button);  
858 - adiciona = true;  
859 - }  
860 - if(botoes.ponto===true){  
861 - button = new OpenLayers.Control.DrawFeature(  
862 - i3GEO.editorOL.layergrafico,  
863 - OpenLayers.Handler.Point,  
864 - {  
865 - displayClass: "editorOLponto",  
866 - title: "digitalizar ponto",  
867 - type: OpenLayers.Control.TYPE_TOOL,  
868 - callbacks:{  
869 - done: function(feature){  
870 - var f = new OpenLayers.Feature.Vector(feature);  
871 - f["attributes"] = {  
872 - opacidade: i3GEO.editorOL.simbologia.opacidade,  
873 - texto: i3GEO.editorOL.simbologia.texto,  
874 - fillColor: i3GEO.editorOL.simbologia.fillColor,  
875 - strokeWidth: i3GEO.editorOL.simbologia.strokeWidth,  
876 - strokeColor: i3GEO.editorOL.simbologia.strokeColor,  
877 - pointRadius: i3GEO.editorOL.simbologia.pointRadius,  
878 - graphicName: i3GEO.editorOL.simbologia.graphicName  
879 - };  
880 - i3GEO.editorOL.layergrafico.addFeatures([f]);  
881 - if(document.getElementById("panellistagEditor"))  
882 - {i3GEO.editorOL.listaGeometrias();}  
883 - }  
884 - }  
885 - }  
886 - );  
887 - controles.push(button);  
888 - adiciona = true;  
889 - }  
890 - if(botoes.poligono===true){  
891 - button = new OpenLayers.Control.DrawFeature(  
892 - i3GEO.editorOL.layergrafico,  
893 - OpenLayers.Handler.Polygon,  
894 - {  
895 - displayClass: "editorOLpoligono",  
896 - title: "digitalizar polígono",  
897 - type: OpenLayers.Control.TYPE_TOOL,  
898 - //handlerOptions: {holeModifier: "altKey"},  
899 - callbacks:{  
900 - done: function(feature){  
901 - var f = new OpenLayers.Feature.Vector(feature);  
902 - f["attributes"] = {  
903 - opacidade: i3GEO.editorOL.simbologia.opacidade,  
904 - texto: i3GEO.editorOL.simbologia.texto,  
905 - fillColor: i3GEO.editorOL.simbologia.fillColor,  
906 - strokeWidth: i3GEO.editorOL.simbologia.strokeWidth,  
907 - strokeColor: i3GEO.editorOL.simbologia.strokeColor,  
908 - pointRadius: i3GEO.editorOL.simbologia.pointRadius,  
909 - graphicName: i3GEO.editorOL.simbologia.graphicName  
910 - };  
911 - i3GEO.editorOL.layergrafico.addFeatures([f]);  
912 - if(document.getElementById("panellistagEditor"))  
913 - {i3GEO.editorOL.listaGeometrias();}  
914 - }  
915 - }  
916 - }  
917 - );  
918 - controles.push(button);  
919 - adiciona = true;  
920 - }  
921 - if(botoes.texto===true){  
922 - button = new OpenLayers.Control.DrawFeature(  
923 - i3GEO.editorOL.layergrafico,  
924 - OpenLayers.Handler.Point,  
925 - {  
926 - displayClass: "editorOLtexto",  
927 - title: "incluir texto",  
928 - type: OpenLayers.Control.TYPE_TOOL,  
929 - persist: true,  
930 - callbacks:{  
931 - done: function(feature){  
932 - var texto = window.prompt("Texto",""),  
933 - label = new OpenLayers.Feature.Vector(feature);  
934 - label["attributes"] = {  
935 - opacidade: 0.1,  
936 - fillColor: "white",  
937 - strokeWidth: i3GEO.editorOL.simbologia.strokeWidth,  
938 - texto: texto,  
939 - pointRadius: 2,  
940 - graphicName: "square",  
941 - strokeColor: "black",  
942 - fontColor: i3GEO.editorOL.simbologia.fontColor,  
943 - fontSize: i3GEO.editorOL.simbologia.fontSize,  
944 - fontFamily: "Arial",  
945 - fontWeight: "bold",  
946 - labelAlign: "rt"  
947 - };  
948 - if(texto && texto !== "")  
949 - {i3GEO.editorOL.layergrafico.addFeatures([label]);}  
950 - }  
951 - }  
952 - }  
953 - );  
954 - controles.push(button);  
955 - adiciona = true;  
956 - }  
957 - if(botoes.edita===true && botoes.corta===true && i3GEO.php){  
958 - i3GEO.editorOL.CortaFeature = new OpenLayers.Control.DrawFeature(  
959 - i3GEO.editorOL.layergrafico,  
960 - OpenLayers.Handler.Polygon,  
961 - {  
962 - displayClass: "editorOLcorta",  
963 - title: "corta figura",  
964 - type: OpenLayers.Control.TYPE_TOOL,  
965 - clickout: true,  
966 - toggle: true,  
967 - trigger: function(){  
968 - if(i3GEO.editorOL.layergrafico.selectedFeatures.length != 1){  
969 - alert("Selecione primeiro um elemento para ser cortado");  
970 - i3GEO.editorOL.CortaFeature.deactivate();  
971 - }  
972 - else{  
973 - i3GEO.editorOL.CortaFeature.activate();  
974 - }  
975 - },  
976 - callbacks:{  
977 - done: function(feature){  
978 - var temp,  
979 - sel = i3GEO.editorOL.layergrafico.selectedFeatures[0].geometry,  
980 - corta = feature;  
981 - temp = function(retorno){  
982 - i3GEO.janela.fechaAguarde("i3GEO.cortador");  
983 - if(retorno != "" && retorno.data && retorno.data != "")  
984 - {i3GEO.editorOL.substituiFeaturesSel(retorno.data);}  
985 - };  
986 - i3GEO.janela.abreAguarde("i3GEO.cortador","Cortando");  
987 - i3GEO.php.funcoesGeometriasWkt(temp,sel+"|"+corta,"difference");  
988 - }  
989 - }  
990 - }  
991 - );  
992 - controles.push(i3GEO.editorOL.CortaFeature);  
993 - adiciona = true;  
994 - }  
995 - if(botoes.edita===true){  
996 - i3GEO.editorOL.ModifyFeature = new OpenLayers.Control.ModifyFeature(  
997 - i3GEO.editorOL.layergrafico,  
998 - {  
999 - displayClass: "editorOLedita",  
1000 - title: "modifica figura",  
1001 - type: OpenLayers.Control.TYPE_TOOL,  
1002 - clickout: true,  
1003 - toggle: true,  
1004 - mode: OpenLayers.Control.ModifyFeature.RESHAPE  
1005 - }  
1006 - );  
1007 - controles.push(i3GEO.editorOL.ModifyFeature);  
1008 - adiciona = true;  
1009 - }  
1010 - if(botoes.edita===true && botoes.listag===true){  
1011 - button = new OpenLayers.Control.Button({  
1012 - displayClass: "editorOLlistag",  
1013 - trigger: function(){  
1014 - i3GEO.editorOL.listaGeometrias();  
1015 - },  
1016 - title: "lista geometrias",  
1017 - type: OpenLayers.Control.TYPE_BUTTON  
1018 - });  
1019 - controles.push(button);  
1020 - adiciona = true;  
1021 - }  
1022 - if(botoes.frente===true){  
1023 - button = new OpenLayers.Control.Button({  
1024 - displayClass: "editorOLfrente",  
1025 - trigger: function(){  
1026 - i3GEO.editorOL.trazParaFrente();  
1027 - if(document.getElementById("panellistagEditor"))  
1028 - {i3GEO.editorOL.listaGeometrias();}  
1029 - },  
1030 - title: "traz para frente",  
1031 - type: OpenLayers.Control.TYPE_BUTTON  
1032 - });  
1033 - controles.push(button);  
1034 - adiciona = true;  
1035 - }  
1036 - if(botoes.tools===true && i3GEO.php){  
1037 - button = new OpenLayers.Control.Button({  
1038 - displayClass: "editorOLtools",  
1039 - trigger: function(){  
1040 - //fora do i3geo, usa o jsts  
1041 - if(i3GEO.php)  
1042 - {i3GEO.editorOL.ferramentas();}  
1043 - else  
1044 - {i3GEO.editorOL.carregajts("i3GEO.editorOL.ferramentas()");}  
1045 -  
1046 - },  
1047 - title: "ferramentas",  
1048 - type: OpenLayers.Control.TYPE_BUTTON  
1049 - });  
1050 - controles.push(button);  
1051 - adiciona = true;  
1052 - }  
1053 - //botao de seleção  
1054 - if(botoes.selecao===true){  
1055 - i3GEO.editorOL.selbutton = new OpenLayers.Control.SelectFeature(  
1056 - i3GEO.editorOL.layergrafico,  
1057 - {  
1058 - displayClass: "editorOLselecao",  
1059 - title: "seleciona elemento",  
1060 - type: OpenLayers.Control.TYPE_TOOL,  
1061 - clickout: true,  
1062 - toggle: true,  
1063 - multiple: false,  
1064 - hover: false,  
1065 - toggleKey: "ctrlKey", // ctrl key removes from selection  
1066 - multipleKey: "shiftKey", // shift key adds to selection  
1067 - box: false  
1068 - }  
1069 - );  
1070 - controles.push(i3GEO.editorOL.selbutton);  
1071 - adiciona = true;  
1072 - }  
1073 - if(botoes.apaga===true){  
1074 - button = new OpenLayers.Control.Button({  
1075 - displayClass: "editorOLapaga",  
1076 - trigger: function(){  
1077 - if(i3GEO.editorOL.layergrafico.selectedFeatures.length > 0){  
1078 - var x = window.confirm("Exclui os elementos selecionados?");  
1079 - if(x){  
1080 - i3GEO.editorOL.guardaBackup();  
1081 - i3GEO.editorOL.layergrafico.removeFeatures(i3GEO.editorOL.layergrafico.selectedFeatures);  
1082 - if(document.getElementById("panellistagEditor"))  
1083 - {i3GEO.editorOL.listaGeometrias();}  
1084 - }  
1085 - }  
1086 - else  
1087 - {alert("Selecione pelo menos um elemento");}  
1088 - },  
1089 - title: "apaga selecionados",  
1090 - type: OpenLayers.Control.TYPE_BUTTON  
1091 - });  
1092 - controles.push(button);  
1093 - adiciona = true;  
1094 - }  
1095 - //não disponível ainda  
1096 - /*  
1097 - if(botoes.undo===true){  
1098 - button = new OpenLayers.Control.Button({  
1099 - displayClass: "editorOLundo",  
1100 - trigger: function(){i3GEO.editorOL.restauraBackup();},  
1101 - title: "recupera"  
1102 - });  
1103 - controles.push(button);  
1104 - adiciona = true;  
1105 - }  
1106 - */  
1107 - if(botoes.propriedades===true){  
1108 - button = new OpenLayers.Control.Button({  
1109 - displayClass: "editorOLpropriedades",  
1110 - trigger: function(){i3GEO.editorOL.propriedades();},  
1111 - title: "propriedades",  
1112 - type: OpenLayers.Control.TYPE_BUTTON  
1113 - });  
1114 - controles.push(button);  
1115 - adiciona = true;  
1116 - }  
1117 - if(botoes.salva===true){  
1118 - button = new OpenLayers.Control.Button({  
1119 - displayClass: "editorOLsalva",  
1120 - trigger: function(){i3GEO.editorOL.salvaGeometrias();},  
1121 - title: "salva",  
1122 - type: OpenLayers.Control.TYPE_BUTTON  
1123 - });  
1124 - controles.push(button);  
1125 - adiciona = true;  
1126 - }  
1127 - if(botoes.ajuda===true){  
1128 - button = new OpenLayers.Control.Button({  
1129 - displayClass: "editorOLajuda",  
1130 - trigger: function(){  
1131 - try  
1132 - {window.open(i3GEO.configura.locaplic+"/mashups/openlayers_ajuda.php");}  
1133 - catch(e)  
1134 - {window.open("openlayers_ajuda.php");}  
1135 - },  
1136 - title: "ajuda",  
1137 - type: OpenLayers.Control.TYPE_BUTTON  
1138 - });  
1139 - controles.push(button);  
1140 - adiciona = true;  
1141 - }  
1142 - if(botoes.fecha===true){  
1143 - button = new OpenLayers.Control.Button({  
1144 - displayClass: "editorOLfecha",  
1145 - trigger: function(){  
1146 - var temp = window.confirm("Remove a edição?");  
1147 - i3GEOpanelEditor.destroy();  
1148 - try{YAHOO.temaativo.container.panel.destroy();}catch(e){}  
1149 - try{YAHOO.procura.container.panel.destroy();}catch(e){}  
1150 - try{YAHOO.editorOL.container.panel.destroy();}catch(e){}  
1151 - try{YAHOO.editorOL.listaGeometrias.panel.destroy();}catch(e){}  
1152 - //try{YAHOO.panelpropriedadesEditor.panel.destroy();}catch(e){}  
1153 - //try{YAHOO.editorOL.panellistagEditor.panel.destroy();}catch(e){}  
1154 - try{YAHOO.editorOL.ferramentas.panel.destroy();}catch(e){}  
1155 - //try{YAHOO.panelprocura.panel.destroy();}catch(e){}  
1156 - try{YAHOO.legendaeditorOL.container.panel.destroy();}catch(e){}  
1157 - try{YAHOO.salvaGeometrias.container.panel.destroy();}catch(e){}  
1158 - if(temp === true){  
1159 - try{  
1160 - if(i3GEO.editorOL.layergrafico){  
1161 - i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.layergrafico);  
1162 - delete(i3GEO.editorOL.layergrafico);  
1163 - }  
1164 - if(i3GEO.editorOL.backup){  
1165 - i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.backup);  
1166 - delete(i3GEO.editorOL.backup);  
1167 - }  
1168 - }  
1169 - catch(e){}  
1170 - }  
1171 - },  
1172 - title: "fecha editor",  
1173 - type: OpenLayers.Control.TYPE_BUTTON  
1174 - });  
1175 - controles.push(button);  
1176 - adiciona = true;  
1177 - }  
1178 - //  
1179 - //controle que permite o snap  
1180 - //  
1181 - i3GEOOLsnap = new OpenLayers.Control.Snapping({  
1182 - layer: i3GEO.editorOL.layergrafico  
1183 - });  
1184 - i3GEOOLsplit = new OpenLayers.Control.Split({  
1185 - layer: i3GEO.editorOL.layergrafico,  
1186 - source: i3GEO.editorOL.layergrafico,  
1187 - tolerance: 0.0001,  
1188 - eventListeners: {  
1189 - beforesplit: function(event){i3GEO.editorOL.guardaBackup();},  
1190 - aftersplit: function(event) {  
1191 - i3GEO.editorOL.flashFeatures(event.features);  
1192 - if(document.getElementById("panellistagEditor"))  
1193 - {i3GEO.editorOL.listaGeometrias();}  
1194 - }  
1195 - }  
1196 - });  
1197 - //  
1198 - //adiciona o painel ao mapa se alguma op��o foi inserida  
1199 - //  
1200 - if(adiciona === true){  
1201 - i3GEOpanelEditor.addControls(controles);  
1202 - i3GEO.editorOL.mapa.addControl(i3GEOpanelEditor);  
1203 - }  
1204 - },  
1205 - mudaSimbolo: function(estilo,id){  
1206 - var valor = $i(id).value;  
1207 - if(valor === "")  
1208 - {return;}  
1209 - if(estilo === "strokeWidth")  
1210 - {i3GEO.editorOL.simbologia.strokeWidth = valor;return;}  
1211 - if(estilo === "opacidade")  
1212 - {i3GEO.editorOL.simbologia.opacidade = valor;return;}  
1213 - i3GEO.editorOL.simbologia[estilo] = valor;  
1214 - },  
1215 - adicionaMarcas: function(){  
1216 - if(i3GEO.editorOL.pontos.length === 0)  
1217 - {return;}  
1218 - var SHADOW_Z_INDEX = 10,  
1219 - MARKER_Z_INDEX = 11,  
1220 - DIAMETER = 200,  
1221 - layer = new OpenLayers.Layer.Vector(  
1222 - "pontos",  
1223 - {  
1224 - styleMap: new OpenLayers.StyleMap({  
1225 - externalGraphic: i3GEO.editorOL.marca,  
1226 - backgroundGraphic: "../pacotes/openlayers/img/marker_shadow.png",  
1227 - backgroundXOffset: 0,  
1228 - backgroundYOffset: -7,  
1229 - graphicZIndex: MARKER_Z_INDEX,  
1230 - backgroundGraphicZIndex: SHADOW_Z_INDEX,  
1231 - pointRadius: 10  
1232 - }),  
1233 - isBaseLayer: false,  
1234 - rendererOptions: {yOrdering: true},  
1235 - displayInLayerSwitcher:true,  
1236 - visibility:true  
1237 - }  
1238 - ),  
1239 - index,  
1240 - x = [],  
1241 - y = [],  
1242 - pixel,  
1243 - lonlat,  
1244 - features = [];  
1245 - for (index = 0; index < i3GEO.editorOL.pontos.length; index = index + 2){  
1246 - x.push(i3GEO.editorOL.pontos[index]);  
1247 - y.push(i3GEO.editorOL.pontos[index+1]);  
1248 - }  
1249 - for (index = 0; index < x.length; index++) {  
1250 - features.push(  
1251 - new OpenLayers.Feature.Vector(  
1252 - new OpenLayers.Geometry.Point(x[index], y[index])  
1253 - )  
1254 - );  
1255 - }  
1256 - layer.addFeatures(features);  
1257 - i3GEO.editorOL.mapa.addLayer(layer);  
1258 - },  
1259 - adicionaKml: function(){  
1260 - var temp,n,i,id,url;  
1261 - n = i3GEO.editorOL.kml.length;  
1262 - for(i=0;i<n;i++){  
1263 - id = "kml"+i;  
1264 - url = i3GEO.editorOL.kml[i];  
1265 - eval(id+" = new OpenLayers.Layer.Vector('"+id+"', {displayOutsideMaxExtent:true,displayInLayerSwitcher:false,visibility:true, strategies: [new OpenLayers.Strategy.Fixed()],protocol: new OpenLayers.Protocol.HTTP({url: '"+url+"',format: new OpenLayers.Format.KML({extractStyles: true,extractAttributes: true,maxDepth: 5})})})");  
1266 - eval("i3GEO.editorOL.mapa.addLayer("+id+");");  
1267 - eval("temp = "+id+".div;");  
1268 - temp.onclick = function(e){  
1269 - var targ,id,temp,features,n,i,j,g,html="";  
1270 - if (!e){e = window.event;}  
1271 - if (e.target)  
1272 - {targ = e.target;}  
1273 - else  
1274 - if (e.srcElement)  
1275 - {targ = e.srcElement;}  
1276 - temp = targ.id.split("_");  
1277 - if(temp[0] === "OpenLayers.Geometry.Point"){  
1278 - id = targ.id;  
1279 - temp = i3GEO.editorOL.mapa.getLayer(this.id);  
1280 - features = temp.features;  
1281 - n = features.length;  
1282 - for(i=0;i<n;i++){  
1283 - if(features[i].geometry.id === id){  
1284 - for (j in features[i].attributes) {  
1285 - html += j+": "+features[i].attributes[j];  
1286 - }  
1287 - g = features[i].geometry;  
1288 - i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud(  
1289 - "kml",  
1290 - new OpenLayers.LonLat(g.x,g.y),  
1291 - null,  
1292 - html,  
1293 - null,  
1294 - true  
1295 - ));  
1296 - }  
1297 - }  
1298 - }  
1299 - };  
1300 - }  
1301 - },  
1302 - //obtido de openlayers.org  
1303 - propriedades: function(){  
1304 - if(!document.getElementById("panelpropriedadesEditor")){  
1305 - YAHOO.namespace("editorOL.container");  
1306 - YAHOO.editorOL.container.panel = new YAHOO.widget.Panel("panelpropriedadesEditor", {zIndex:20000, iframe:true, width:"350px", height:"250px",visible:false, draggable:true, close:true } );  
1307 - var ins = "" +  
1308 - '<p class=paragrafo ><b>Estilos (utilize a cor no formato r,g,b):</b></p>' +  
1309 - '<table class=lista7 >' +  
1310 - ' <tr>' +  
1311 - ' <td>Cor do contorno</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'strokeColor\',\'i3GEOEditorOLcorContorno\')" type="text" style="cursor:text" id="i3GEOEditorOLcorContorno" size="12" value="'+i3GEO.editorOL.simbologia.strokeColor+'" /></td><td>';  
1312 - if(i3GEO.configura)  
1313 - {ins += '<img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorContorno\');" />';}  
1314 - ins += "" +  
1315 - ' </td>' +  
1316 - ' </tr>' +  
1317 - ' <tr>' +  
1318 - ' <td>Cor do preenchimento</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fillColor\',\'i3GEOEditorOLcorPre\')" type="text" style="cursor:text" id="i3GEOEditorOLcorPre" size="12" value="'+i3GEO.editorOL.simbologia.fillColor+'" /></td><td>';  
1319 - if(i3GEO.configura)  
1320 - {ins += '<img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorPre\');" />';}  
1321 - ins += "" +  
1322 - ' </td>' +  
1323 - ' </tr>' +  
1324 - ' <tr>' +  
1325 - ' <td>Cor da fonte</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fontColor\',\'i3GEOEditorOLcorFonte\')" type="text" style="cursor:text" id="i3GEOEditorOLcorFonte" size="12" value="'+i3GEO.editorOL.simbologia.fontColor+'" /></td><td>';  
1326 - if(i3GEO.configura)  
1327 - {ins += '<img alt="aquarela.gif" style=cursor:pointer src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEO.util.abreCor(\'\',\'i3GEOEditorOLcorFonte\');" />';}  
1328 - ins += "" +  
1329 - ' </td>' +  
1330 - ' </tr>' +  
1331 - ' <tr>' +  
1332 - ' <td>Tamanho da fonte</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'fontSize\',\'i3GEOEditorOLfontsize\')" type="text" style="cursor:text" id="i3GEOEditorOLfontsize" size="3" value="'+i3GEO.editorOL.simbologia.fontSize+'" /></td><td></td>' +  
1333 - ' </tr>' +  
1334 - ' <tr>' +  
1335 - ' <td>Opacidade (de 0 a 1)</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'opacidade\',\'i3GEOEditorOLopacidade\')" type="text" style="cursor:text" id="i3GEOEditorOLopacidade" size="3" value="'+i3GEO.editorOL.simbologia.opacidade+'" /></td><td></td>' +  
1336 - ' </tr>' +  
1337 - ' <tr>' +  
1338 - ' <td>Largura da linha/contorno</td><td><input onchange="i3GEO.editorOL.mudaSimbolo(\'strokeWidth\',\'i3GEOEditorOLlarguraLinha\')" type="text" style="cursor:text" id="i3GEOEditorOLlarguraLinha" size="2" value="'+i3GEO.editorOL.simbologia.strokeWidth+'" /></td><td></td>' +  
1339 - ' </tr>' +  
1340 - '</table>' +  
1341 - '<br />' +  
1342 - '<p class=paragrafo ><b>Ajusta nó em edição para o(a):</b></p>' +  
1343 - '<table class=lista7 >' +  
1344 - ' <tr>' +  
1345 - ' <td></td><td>nó</td><td></td><td>vértice</td><td></td><td>borda</td>' +  
1346 - ' </tr>' +  
1347 - ' <tr>' +  
1348 - ' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_node" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_nodeTolerance" type="text" size="3" value=15 /></td>' +  
1349 - ' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_vertex" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_vertexTolerance" type="text" size="3" value=15 /></td>' +  
1350 - ' <td><input style=cursor:pointer onclick="i3GEO.editorOL.snap()" type="checkbox" id="target_edge" /></td><td><input onchange="i3GEO.editorOL.snap()" id="target_edgeTolerance" type="text" size="3" value=15 /></td>' +  
1351 - ' </tr>' +  
1352 - '</table>' +  
1353 - '<br />' +  
1354 - '<p class=paragrafo ><b>Divide intersecção ao digitalizar</b></p>' +  
1355 - '<table class=lista7 >' +  
1356 - ' <tr>' +  
1357 - ' <td><input style=cursor:pointer onclick="i3GEO.editorOL.split()" type="checkbox" id="edge_split_toggle" /></td><td>borda</td>' +  
1358 - ' </tr>' +  
1359 - '</table>' +  
1360 - '<br />' +  
1361 - '<p class=paragrafo ><b>Operação ativada pelo botão de modificação da figura</b></p>' +  
1362 - '<table class=lista7 >' +  
1363 - ' <tr>' +  
1364 - ' <td><input checked style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.RESHAPE;" type="radio" name=i3geoOLtipoEdita /></td><td>altera figura</td>' +  
1365 - ' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.RESIZE;" type="radio" name=i3geoOLtipoEdita /></td><td>altera tamanho</td>' +  
1366 - ' </tr>' +  
1367 - ' <tr>' +  
1368 - ' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.ROTATE;" type="radio" name=i3geoOLtipoEdita /></td><td>rotaciona</td>' +  
1369 - ' <td><input style=cursor:pointer onclick="i3GEO.editorOL.ModifyFeature.mode = OpenLayers.Control.ModifyFeature.DRAG;" type="radio" name=i3geoOLtipoEdita /></td><td>desloca</td>' +  
1370 - ' </tr>' +  
1371 - '</table>';  
1372 - YAHOO.editorOL.container.panel.setBody(ins);  
1373 - if(typeof i3GEO != undefined && i3GEO != "")  
1374 - {YAHOO.editorOL.container.panel.setHeader("Propriedades<div id='panelpropriedadesEditor_minimizaCabecalho' class='container-minimiza'></div>");}  
1375 - else  
1376 - {YAHOO.editorOL.container.panel.setHeader("Propriedades");}  
1377 -  
1378 - YAHOO.editorOL.container.panel.setFooter("");  
1379 - YAHOO.editorOL.container.panel.render(document.body);  
1380 -  
1381 - YAHOO.editorOL.container.panel.center();  
1382 - YAHOO.util.Event.addListener(YAHOO.editorOL.container.panel.close, "click", function(){});  
1383 - temp = $i("panelpropriedadesEditor_minimizaCabecalho");  
1384 - if(temp){  
1385 - temp.onclick = function(){i3GEO.janela.minimiza("panelpropriedadesEditor");}  
1386 - }  
1387 - }  
1388 - YAHOO.editorOL.container.panel.show();  
1389 - if(i3GEO.configura)  
1390 - {$i("panelpropriedadesEditor").getElementsByTagName("div")[2].style.overflow = "auto";}  
1391 - else  
1392 - {$i("panelpropriedadesEditor").getElementsByTagName("div")[1].style.overflow = "auto";}  
1393 - },  
1394 - listaGeometrias: function(){  
1395 - if(!document.getElementById("panellistagEditor")){  
1396 - YAHOO.namespace("editorOL.listaGeometrias");  
1397 - YAHOO.editorOL.listaGeometrias.panel = new YAHOO.widget.Panel("panellistagEditor", {zIndex:20000, iframe:true, width:"320px", visible:false, draggable:true, close:true } );  
1398 - if(typeof i3GEO != undefined && i3GEO != "")  
1399 - {YAHOO.editorOL.listaGeometrias.panel.setHeader("Geometrias <div id='panellistagEditor_minimizaCabecalho' class='container-minimiza'></div>");}  
1400 - else  
1401 - {YAHOO.editorOL.listaGeometrias.panel.setHeader("Geometrias");}  
1402 - YAHOO.editorOL.listaGeometrias.panel.setFooter("");  
1403 - YAHOO.editorOL.listaGeometrias.panel.render(document.body);  
1404 - YAHOO.editorOL.listaGeometrias.panel.center();  
1405 - YAHOO.util.Event.addListener(YAHOO.editorOL.listaGeometrias.panel.close, "click", function(){  
1406 - YAHOO.editorOL.listaGeometrias.panel.destroy();  
1407 - });  
1408 - temp = $i("panellistagEditor_minimizaCabecalho");  
1409 - if(temp){  
1410 - temp.onclick = function(){i3GEO.janela.minimiza("panellistagEditor");}  
1411 - }  
1412 - }  
1413 - else{  
1414 - YAHOO.editorOL.listaGeometrias.panel.render(document.body);  
1415 - }  
1416 - var g,temp,  
1417 - geos = i3GEO.editorOL.layergrafico.features,  
1418 - n = geos.length,  
1419 - ins = "<table class=lista4 >";  
1420 - ins += "<tr><td><i>Geometrias</i></td><td><i>Opções</i></td><td></td><td></td></tr>";  
1421 -  
1422 - while(n > 0){  
1423 - n -= 1;  
1424 - g = geos[n].geometry;  
1425 - ins += "<tr><td>"+g.CLASS_NAME+"</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.selFeature("+n+")'>seleciona</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.unselFeature("+n+")'>limpa</td><td style='cursor:pointer;color:blue' onclick='javascript:i3GEO.editorOL.flashFeaturesI("+n+")'>brilha</td></tr>";  
1426 - }  
1427 - ins += "</table>";  
1428 - if(geos.length === 0)  
1429 - {ins = "Nenhum elemento gráfico encontrado. Utilize as opções de criação de geometrias.";}  
1430 - YAHOO.editorOL.listaGeometrias.panel.show();  
1431 - if(i3GEO.configura)  
1432 - {temp = $i("panellistagEditor").getElementsByTagName("div")[2];}  
1433 - else  
1434 - {temp = $i("panellistagEditor").getElementsByTagName("div")[1];}  
1435 - temp.style.overflow = "auto";  
1436 - temp.style.height = "100px";  
1437 - temp.innerHTML = ins;  
1438 - },  
1439 - ferramentas: function(){  
1440 - if(!document.getElementById("panelferramentasEditor")){  
1441 - YAHOO.namespace("editorOL.ferramentas");  
1442 - YAHOO.editorOL.ferramentas.panel = new YAHOO.widget.Panel("panelferramentasEditor", {zIndex:20000, iframe:true, width:"300px", visible:false, draggable:true, close:true } );  
1443 - var ins = "" +  
1444 - '<p class=paragrafo >Operações sobre as figuras selecionadas:</p>' +  
1445 - '<select onchange="i3GEO.editorOL.processageo(this.value);this.value = \'\'" >' +  
1446 - ' <option value="">---</option>' +  
1447 - ' <option value=union >União</option>';  
1448 - if(i3GEO.php){  
1449 - ins += ' <option value=intersection >Intersecção</option>' +  
1450 - ' <option value=convexhull >Convex hull</option>' +  
1451 - ' <option value=boundary >Bordas</option>' +  
1452 - ' <option value=difference >Diferença</option>' +  
1453 - ' <option value=symdifference >Diferença simétrica</option>';  
1454 - }  
1455 - ins += '</select>'+  
1456 - '<br><br><a class=paragrafo href=# onclick="i3GEO.editorOL.layergrafico.destroyFeatures()" >Apaga tudo</a>';  
1457 -  
1458 - YAHOO.editorOL.ferramentas.panel.setBody(ins);  
1459 - if(typeof i3GEO != undefined && i3GEO != "")  
1460 - {YAHOO.editorOL.ferramentas.panel.setHeader("Ferramentas <div id='panelferramentasEditor_minimizaCabecalho' class='container-minimiza'></div>");}  
1461 - else  
1462 - {YAHOO.editorOL.ferramentas.panel.setHeader("Ferramentas");}  
1463 -  
1464 - YAHOO.editorOL.ferramentas.panel.setFooter("");  
1465 - YAHOO.editorOL.ferramentas.panel.render(document.body);  
1466 - YAHOO.editorOL.ferramentas.panel.center();  
1467 - YAHOO.util.Event.addListener(YAHOO.editorOL.ferramentas.panel.close, "click", function(){  
1468 - });  
1469 - temp = $i("panelferramentasEditor_minimizaCabecalho");  
1470 - if(temp){  
1471 - temp.onclick = function(){i3GEO.janela.minimiza("panelferramentasEditor");}  
1472 - }  
1473 - }  
1474 - else{  
1475 - YAHOO.editorOL.ferramentas.panel.render(document.body);  
1476 - }  
1477 - YAHOO.editorOL.ferramentas.panel.show();  
1478 - },  
1479 - snap: function(){  
1480 - var target = i3GEOOLsnap.targets[0],  
1481 - tipos = ["node","vertex","edge"],  
1482 - ntipos = tipos.length,  
1483 - i,  
1484 - temp,  
1485 - ativa = false;  
1486 - i3GEOOLsnap.deactivate();  
1487 - for(i=0;i<ntipos;i++){  
1488 - temp = $i("target_"+tipos[i]);  
1489 - target[tipos[i]] = temp.checked;  
1490 - if(temp.checked === true)  
1491 - {ativa = true;}  
1492 - temp = $i("target_"+tipos[i]+"Tolerance");  
1493 - target[tipos[i]+"Tolerance"] = temp.value;  
1494 - }  
1495 - if(ativa === true)  
1496 - {i3GEOOLsnap.activate();}  
1497 - },  
1498 - split: function(){  
1499 - i3GEOOLsplit.deactivate();  
1500 - var temp = $i("edge_split_toggle");  
1501 - if(temp.checked === true)  
1502 - {i3GEOOLsplit.activate();}  
1503 - },  
1504 - processageo: function(operacao){  
1505 - if(operacao === ""){return;}  
1506 - var geosel = i3GEO.editorOL.layergrafico.selectedFeatures,  
1507 - fwkt = new OpenLayers.Format.WKT(),  
1508 - polis,linhas,pontos,uniaopolis,uniaolinhas,uniaopontos,n,i,temp;  
1509 - if(geosel.length > 0){  
1510 - polis = i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.Polygon");  
1511 - linhas = i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.LineString");  
1512 - pontos = i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.Point");  
1513 - temp = function(retorno){  
1514 - if(i3GEO.janela){  
1515 - i3GEO.janela.fechaAguarde("i3GEO.editorPoli");  
1516 - i3GEO.janela.fechaAguarde("i3GEO.editorLinhas");  
1517 - i3GEO.janela.fechaAguarde("i3GEO.editorPontos");  
1518 - }  
1519 - if(retorno != "" && retorno.data && retorno.data != "" && operacao != "converteSHP")  
1520 - {i3GEO.editorOL.substituiFeaturesSel(retorno.data);}  
1521 - if(operacao === "converteSHP"){  
1522 - i3GEO.atualiza();  
1523 - i3GEO.janela.minimiza("paneltemaativo");  
1524 - }  
1525 - }  
1526 - if(operacao === "union" && !i3GEO.php ){  
1527 - if(polis.length > 0){  
1528 - temp = i3GEO.editorOL.uniaojts(polis);  
1529 - i3GEO.editorOL.substituiFeaturesSel(temp);  
1530 - }  
1531 - if(linhas.length > 0){  
1532 - temp = i3GEO.editorOL.uniaojts(linhas);  
1533 - i3GEO.editorOL.substituiFeaturesSel(temp);  
1534 - }  
1535 - if(pontos.length > 0){  
1536 - temp = i3GEO.editorOL.uniaojts(p);  
1537 - i3GEO.editorOL.substituiFeaturesSel(temp);  
1538 - }  
1539 - }  
1540 - else{  
1541 - if(polis.length > 0){  
1542 - i3GEO.janela.abreAguarde("i3GEO.editorPoli","Poligonos");  
1543 - i3GEO.php.funcoesGeometriasWkt(temp,polis.join("|"),operacao);  
1544 - }  
1545 - if(linhas.length > 0){  
1546 - i3GEO.janela.abreAguarde("i3GEO.editorLinhas","Linhas");  
1547 - i3GEO.php.funcoesGeometriasWkt(temp,linhas.join("|"),operacao);  
1548 - }  
1549 - if(pontos.length > 0){  
1550 - i3GEO.janela.abreAguarde("i3GEO.editorPontos","Pontos");  
1551 - i3GEO.php.funcoesGeometriasWkt(temp,pontos.join("|"),operacao);  
1552 - }  
1553 - }  
1554 - return;  
1555 - }  
1556 - else  
1557 - {alert("Selecione pelo menos dois elementos");}  
1558 - },  
1559 - uniaojts: function(geoms){  
1560 - var n = geoms.length,  
1561 - rwkt = new jsts.io.WKTReader(),  
1562 - wwkt = new jsts.io.WKTWriter(),  
1563 - fwkt = new OpenLayers.Format.WKT(),  
1564 - g,  
1565 - i,uniao;  
1566 - if(n > 1){  
1567 - uniao = (fwkt.read(geoms[0]).geometry).toString();  
1568 - uniao = rwkt.read(uniao);  
1569 - for(i=1;i <= n;i++){  
1570 - g = (fwkt.read(geoms[i]).geometry).toString();  
1571 - uniao = uniao.union(rwkt.read(g));  
1572 - }  
1573 - uniao = wwkt.write(uniao);  
1574 - return [fwkt.read(uniao)];  
1575 - }  
1576 - else  
1577 - {return false;}  
1578 - },  
1579 - retornaGeometriasTipo: function(features,tipo){  
1580 - var n = features.length,  
1581 - lista = [],  
1582 - i,temp;  
1583 - for(i=0;i<n;i++){  
1584 - temp = features[i].geometry;  
1585 - if(temp.CLASS_NAME == tipo)  
1586 - {lista.push(temp);}  
1587 - }  
1588 - return lista;  
1589 - },  
1590 - guardaBackup: function(){  
1591 - return;  
1592 - if(!i3GEO.editorOL.backup)  
1593 - {i3GEO.editorOL.backup = new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false})}  
1594 - else  
1595 - {i3GEO.editorOL.backup.removeFeatures(i3GEO.editorOL.backup.features);}  
1596 - i3GEO.editorOL.backup.addFeatures(i3GEO.editorOL.layergrafico.features);  
1597 - },  
1598 - unselTodos:function(){  
1599 - var n,i,temp;  
1600 - n = i3GEO.editorOL.layergrafico.features.length;  
1601 - for(i=0;i<n;i++){  
1602 - i3GEO.editorOL.layergrafico.features[i].renderIntent = "default";  
1603 - i3GEO.editorOL.selbutton.unselect(i3GEO.editorOL.layergrafico.features[i]);  
1604 - }  
1605 - },  
1606 - unselTodosBackup:function(){  
1607 - var n,i,temp;  
1608 - n = i3GEO.editorOL.backup.features.length;  
1609 - for(i=0;i<n;i++){  
1610 - i3GEO.editorOL.backup.features[i].renderIntent = "default";  
1611 - i3GEO.editorOL.selbutton.unselect(i3GEO.editorOL.backup.features[i]);  
1612 - }  
1613 - },  
1614 - restauraBackup: function(){  
1615 - if(i3GEO.editorOL.backup.features.length > 0){  
1616 - i3GEO.editorOL.layergrafico.removeFeatures(i3GEO.editorOL.layergrafico.features);  
1617 - i3GEO.editorOL.layergrafico.addFeatures(i3GEO.editorOL.backup.features);  
1618 - }  
1619 - if(document.getElementById("panellistagEditor"))  
1620 - {i3GEO.editorOL.listaGeometrias();}  
1621 - //i3GEO.editorOL.backup.removeFeatures(i3GEO.editorOL.backup.features);  
1622 - },  
1623 - substituiFeaturesSel: function(wkt){  
1624 - i3GEO.editorOL.guardaBackup();  
1625 - try{  
1626 - var f,fwkt = new OpenLayers.Format.WKT();  
1627 - i3GEO.editorOL.layergrafico.removeFeatures(i3GEO.editorOL.layergrafico.selectedFeatures);  
1628 - f = fwkt.read(wkt);  
1629 - f["attributes"] = {  
1630 - opacidade: i3GEO.editorOL.simbologia.opacidade,  
1631 - texto: i3GEO.editorOL.simbologia.texto,  
1632 - fillColor: i3GEO.editorOL.simbologia.fillColor,  
1633 - strokeWidth: i3GEO.editorOL.simbologia.strokeWidth,  
1634 - strokeColor: i3GEO.editorOL.simbologia.strokeColor,  
1635 - pointRadius: i3GEO.editorOL.simbologia.pointRadius,  
1636 - graphicName: i3GEO.editorOL.simbologia.graphicName  
1637 - };  
1638 - i3GEO.editorOL.layergrafico.addFeatures([f]);  
1639 - if(document.getElementById("panellistagEditor"))  
1640 - {i3GEO.editorOL.listaGeometrias();}  
1641 - }  
1642 - catch(e)  
1643 - {i3GEO.editorOL.restauraBackup();}  
1644 - },  
1645 - flashFeaturesI: function(index){  
1646 - i3GEO.editorOL.flashFeatures([i3GEO.editorOL.layergrafico.features[index]],0);  
1647 - },  
1648 - flashFeatures: function(features, index) {  
1649 - if(!index) {  
1650 - index = 0;  
1651 - }  
1652 - var current = features[index];  
1653 - if(current && current.layer === i3GEO.editorOL.layergrafico) {  
1654 - i3GEO.editorOL.layergrafico.drawFeature(features[index], "select");  
1655 - }  
1656 - var prev = features[index-1];  
1657 - if(prev && prev.layer === i3GEO.editorOL.layergrafico) {  
1658 - i3GEO.editorOL.layergrafico.drawFeature(prev, "default");  
1659 - }  
1660 - ++index;  
1661 - if(index <= features.length) {  
1662 - window.setTimeout(function() {i3GEO.editorOL.flashFeatures(features, index);}, 75);  
1663 - }  
1664 - },  
1665 - selFeature: function(index) {  
1666 - i3GEO.editorOL.selbutton.select(i3GEO.editorOL.layergrafico.features[index]);  
1667 - },  
1668 - unselFeature: function(index) {  
1669 - i3GEO.editorOL.selbutton.unselect(i3GEO.editorOL.layergrafico.features[index]);  
1670 - },  
1671 - carregajts: function(funcao){  
1672 - if(i3GEO.configura)  
1673 - {i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/pacotes/jsts/lib/jsts.js",funcao,"i3GEOjts",true);}  
1674 - else  
1675 - {i3GEO.util.scriptTag("../pacotes/jsts/lib/jsts.js",funcao,"i3GEOjts",true);}  
1676 - },  
1677 - trazParaFrente: function(){  
1678 - var features = i3GEO.editorOL.layergrafico.selectedFeatures;  
1679 - if(features.length > 0){  
1680 - i3GEO.editorOL.backup = new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false})  
1681 - i3GEO.editorOL.backup.addFeatures(features);  
1682 - i3GEO.editorOL.unselTodosBackup();  
1683 - i3GEO.editorOL.layergrafico.removeFeatures(features);  
1684 - i3GEO.editorOL.layergrafico.addFeatures(i3GEO.editorOL.backup.features);  
1685 - if(document.getElementById("panellistagEditor"))  
1686 - {i3GEO.editorOL.listaGeometrias();}  
1687 - }  
1688 - else  
1689 - {alert("Selecione pelo menos um elemento");}  
1690 - },  
1691 - pegaControle: function(classe){  
1692 - var n = i3GEO.editorOL.controles.length,  
1693 - i;  
1694 - for(i=0;i<n;i++){  
1695 - if(i3GEO.editorOL.controles[i].CLASS_NAME === classe)  
1696 - {return i3GEO.editorOL.controles[i];}  
1697 - }  
1698 - return false;  
1699 - },  
1700 - ativaLayerSwitcher: function(){  
1701 - var ls = i3GEO.editorOL.pegaControle("OpenLayers.Control.LayerSwitcher");  
1702 - if(ls){  
1703 - ls.maximizeDiv.click();  
1704 - }  
1705 - },  
1706 - desativaRodaDoMouse: function(){  
1707 - var controls = i3GEO.editorOL.mapa.getControlsByClass('OpenLayers.Control.Navigation');  
1708 - for(var i = 0; i<controls.length; ++i){controls[i].disableZoomWheel();}  
1709 - }  
1710 -};  
1711 \ No newline at end of file 1 \ No newline at end of file
  2 +//
  3 +//depreciado
  4 +//
  5 +alert("O arquivo mashups/openlayers.js.php que esta sendo carregado foi depreciado. Utilize mashups/openlayers.js
1712 \ No newline at end of file 6 \ No newline at end of file
mashups/openlayers_compacto.js
@@ -3011,7 +3011,7 @@ OpenLayers.Feature.prototype.destroy.apply(this,arguments);},processXMLNode:func @@ -3011,7 +3011,7 @@ OpenLayers.Feature.prototype.destroy.apply(this,arguments);},processXMLNode:func
3011 if(data&&data.nodeType==9){data=data.documentElement;} 3011 if(data&&data.nodeType==9){data=data.documentElement;}
3012 var capabilities={};this.readNode(data,capabilities);capabilities.version=this.version;return capabilities;},readers:{"wmts":{"Capabilities":function(node,obj){this.readChildNodes(node,obj);},"Contents":function(node,obj){obj.contents={};obj.contents.layers=[];obj.contents.tileMatrixSets={};this.readChildNodes(node,obj.contents);},"Layer":function(node,obj){var layer={styles:[],formats:[],tileMatrixSetLinks:[]};layer.layers=[];this.readChildNodes(node,layer);obj.layers.push(layer);},"Style":function(node,obj){var style={};style.isDefault=(node.getAttribute("isDefault")==="true");this.readChildNodes(node,style);obj.styles.push(style);},"Format":function(node,obj){obj.formats.push(this.getChildValue(node));},"TileMatrixSetLink":function(node,obj){var tileMatrixSetLink={};this.readChildNodes(node,tileMatrixSetLink);obj.tileMatrixSetLinks.push(tileMatrixSetLink);},"TileMatrixSet":function(node,obj){if(obj.layers){var tileMatrixSet={matrixIds:[]};this.readChildNodes(node,tileMatrixSet);obj.tileMatrixSets[tileMatrixSet.identifier]=tileMatrixSet;}else{obj.tileMatrixSet=this.getChildValue(node);}},"TileMatrix":function(node,obj){var tileMatrix={supportedCRS:obj.supportedCRS};this.readChildNodes(node,tileMatrix);obj.matrixIds.push(tileMatrix);},"ScaleDenominator":function(node,obj){obj.scaleDenominator=parseFloat(this.getChildValue(node));},"TopLeftCorner":function(node,obj){var topLeftCorner=this.getChildValue(node);var coords=topLeftCorner.split(" ");var yx;if(obj.supportedCRS){var crs=obj.supportedCRS.replace(/urn:ogc:def:crs:(\w+):.+:(\w+)$/,"urn:ogc:def:crs:$1::$2");yx=!!this.yx[crs];} 3012 var capabilities={};this.readNode(data,capabilities);capabilities.version=this.version;return capabilities;},readers:{"wmts":{"Capabilities":function(node,obj){this.readChildNodes(node,obj);},"Contents":function(node,obj){obj.contents={};obj.contents.layers=[];obj.contents.tileMatrixSets={};this.readChildNodes(node,obj.contents);},"Layer":function(node,obj){var layer={styles:[],formats:[],tileMatrixSetLinks:[]};layer.layers=[];this.readChildNodes(node,layer);obj.layers.push(layer);},"Style":function(node,obj){var style={};style.isDefault=(node.getAttribute("isDefault")==="true");this.readChildNodes(node,style);obj.styles.push(style);},"Format":function(node,obj){obj.formats.push(this.getChildValue(node));},"TileMatrixSetLink":function(node,obj){var tileMatrixSetLink={};this.readChildNodes(node,tileMatrixSetLink);obj.tileMatrixSetLinks.push(tileMatrixSetLink);},"TileMatrixSet":function(node,obj){if(obj.layers){var tileMatrixSet={matrixIds:[]};this.readChildNodes(node,tileMatrixSet);obj.tileMatrixSets[tileMatrixSet.identifier]=tileMatrixSet;}else{obj.tileMatrixSet=this.getChildValue(node);}},"TileMatrix":function(node,obj){var tileMatrix={supportedCRS:obj.supportedCRS};this.readChildNodes(node,tileMatrix);obj.matrixIds.push(tileMatrix);},"ScaleDenominator":function(node,obj){obj.scaleDenominator=parseFloat(this.getChildValue(node));},"TopLeftCorner":function(node,obj){var topLeftCorner=this.getChildValue(node);var coords=topLeftCorner.split(" ");var yx;if(obj.supportedCRS){var crs=obj.supportedCRS.replace(/urn:ogc:def:crs:(\w+):.+:(\w+)$/,"urn:ogc:def:crs:$1::$2");yx=!!this.yx[crs];}
3013 if(yx){obj.topLeftCorner=new OpenLayers.LonLat(coords[1],coords[0]);}else{obj.topLeftCorner=new OpenLayers.LonLat(coords[0],coords[1]);}},"TileWidth":function(node,obj){obj.tileWidth=parseInt(this.getChildValue(node));},"TileHeight":function(node,obj){obj.tileHeight=parseInt(this.getChildValue(node));},"MatrixWidth":function(node,obj){obj.matrixWidth=parseInt(this.getChildValue(node));},"MatrixHeight":function(node,obj){obj.matrixHeight=parseInt(this.getChildValue(node));},"ResourceURL":function(node,obj){obj.resourceUrl=obj.resourceUrl||{};obj.resourceUrl[node.getAttribute("resourceType")]={format:node.getAttribute("format"),template:node.getAttribute("template")};},"WSDL":function(node,obj){obj.wsdl={};obj.wsdl.href=node.getAttribute("xlink:href");},"ServiceMetadataURL":function(node,obj){obj.serviceMetadataUrl={};obj.serviceMetadataUrl.href=node.getAttribute("xlink:href");}},"ows":OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers["ows"]},CLASS_NAME:"OpenLayers.Format.WMTSCapabilities.v1_0_0"}); 3013 if(yx){obj.topLeftCorner=new OpenLayers.LonLat(coords[1],coords[0]);}else{obj.topLeftCorner=new OpenLayers.LonLat(coords[0],coords[1]);}},"TileWidth":function(node,obj){obj.tileWidth=parseInt(this.getChildValue(node));},"TileHeight":function(node,obj){obj.tileHeight=parseInt(this.getChildValue(node));},"MatrixWidth":function(node,obj){obj.matrixWidth=parseInt(this.getChildValue(node));},"MatrixHeight":function(node,obj){obj.matrixHeight=parseInt(this.getChildValue(node));},"ResourceURL":function(node,obj){obj.resourceUrl=obj.resourceUrl||{};obj.resourceUrl[node.getAttribute("resourceType")]={format:node.getAttribute("format"),template:node.getAttribute("template")};},"WSDL":function(node,obj){obj.wsdl={};obj.wsdl.href=node.getAttribute("xlink:href");},"ServiceMetadataURL":function(node,obj){obj.serviceMetadataUrl={};obj.serviceMetadataUrl.href=node.getAttribute("xlink:href");}},"ows":OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers["ows"]},CLASS_NAME:"OpenLayers.Format.WMTSCapabilities.v1_0_0"});
3014 -/*jslint white:false,undef: false, rhino: true, onevar: true, evil: false */ 3014 +/*çjslint white:false,undef: false, rhino: true, onevar: true, evil: false */
3015 var $i = function(id) 3015 var $i = function(id)
3016 {return document.getElementById(id);}; 3016 {return document.getElementById(id);};
3017 //seta as variáveis navn e navm 3017 //seta as variáveis navn e navm
@@ -3275,7 +3275,7 @@ visibility:true @@ -3275,7 +3275,7 @@ visibility:true
3275 layersLigados: function(){ 3275 layersLigados: function(){
3276 var layers = i3GEO.editorOL.mapa.layers, 3276 var layers = i3GEO.editorOL.mapa.layers,
3277 nlayers = layers.length, 3277 nlayers = layers.length,
3278 -ins = []; 3278 +ins = [],i;
3279 for(i=0;i<nlayers;i++){ 3279 for(i=0;i<nlayers;i++){
3280 if(layers[i].visibility === true){ 3280 if(layers[i].visibility === true){
3281 ins.push(layers[i]); 3281 ins.push(layers[i]);
@@ -3290,7 +3290,7 @@ coordenadas: function(){ @@ -3290,7 +3290,7 @@ coordenadas: function(){
3290 var idcoord = i3GEO.editorOL.mapa.getControlsBy("separator"," "); 3290 var idcoord = i3GEO.editorOL.mapa.getControlsBy("separator"," ");
3291 if(idcoord[0]){ 3291 if(idcoord[0]){
3292 i3GEO.editorOL.mapa.events.register("mousemove", i3GEO.editorOL.mapa, function(e){ 3292 i3GEO.editorOL.mapa.events.register("mousemove", i3GEO.editorOL.mapa, function(e){
3293 -var p,lonlat,d,dc; 3293 +var p,lonlat,d;
3294 if (navm) 3294 if (navm)
3295 {p = new OpenLayers.Pixel(e.x,e.y);} 3295 {p = new OpenLayers.Pixel(e.x,e.y);}
3296 else 3296 else
@@ -3350,7 +3350,6 @@ criaComboTemas: function(){ @@ -3350,7 +3350,6 @@ criaComboTemas: function(){
3350 var layers = i3GEO.editorOL.layersLigados(), 3350 var layers = i3GEO.editorOL.layersLigados(),
3351 nlayers = layers.length, 3351 nlayers = layers.length,
3352 i, 3352 i,
3353 -temp,  
3354 combo = "<select id=i3GEOOLlistaTemasAtivos >"; 3353 combo = "<select id=i3GEOOLlistaTemasAtivos >";
3355 //i3GEO.editorOL.layergrafico.setLayerIndex(i3GEO.editorOL.getNumLayers() + 1); 3354 //i3GEO.editorOL.layergrafico.setLayerIndex(i3GEO.editorOL.getNumLayers() + 1);
3356 for(i=0;i<nlayers;i++){ 3355 for(i=0;i<nlayers;i++){
@@ -3395,7 +3394,7 @@ if(i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search(&quot;i3GEO.editorOL.atualiz @@ -3395,7 +3394,7 @@ if(i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search(&quot;i3GEO.editorOL.atualiz
3395 } 3394 }
3396 temp = $i("paneltemaativo_minimizaCabecalho"); 3395 temp = $i("paneltemaativo_minimizaCabecalho");
3397 if(temp){ 3396 if(temp){
3398 -temp.onclick = function(){i3GEO.janela.minimiza("paneltemaativo");} 3397 +temp.onclick = function(){i3GEO.janela.minimiza("paneltemaativo");};
3399 } 3398 }
3400 } 3399 }
3401 else{ 3400 else{
@@ -3432,7 +3431,6 @@ geometryName: &quot;msGeometry&quot; @@ -3432,7 +3431,6 @@ geometryName: &quot;msGeometry&quot;
3432 gml = fromgml.read(retorno.responseText), 3431 gml = fromgml.read(retorno.responseText),
3433 prop = gml.featureTypes[0].properties, 3432 prop = gml.featureTypes[0].properties,
3434 nprop = prop.length, 3433 nprop = prop.length,
3435 -itens = [],  
3436 i, 3434 i,
3437 combo = "<select id="+idobj+" ><option value=''>----</option>"; 3435 combo = "<select id="+idobj+" ><option value=''>----</option>";
3438 for(i = 0;i < nprop; i++){ 3436 for(i = 0;i < nprop; i++){
@@ -3494,7 +3492,7 @@ i3GEO.editorOL.mapa.zoomToExtent(b); @@ -3494,7 +3492,7 @@ i3GEO.editorOL.mapa.zoomToExtent(b);
3494 mostraLegenda: function(){ 3492 mostraLegenda: function(){
3495 var layers = i3GEO.editorOL.layersLigados(), 3493 var layers = i3GEO.editorOL.layersLigados(),
3496 nlayers = layers.length, 3494 nlayers = layers.length,
3497 -ins = ""; 3495 +ins = "",i;
3498 for(i=0;i<nlayers;i++){ 3496 for(i=0;i<nlayers;i++){
3499 try{ 3497 try{
3500 var url = layers[i].getFullRequestString({"request":"getlegendgraphic"}); 3498 var url = layers[i].getFullRequestString({"request":"getlegendgraphic"});
@@ -3506,7 +3504,6 @@ catch(e){} @@ -3506,7 +3504,6 @@ catch(e){}
3506 //var w = window.open(); 3504 //var w = window.open();
3507 //w.document.write(ins); 3505 //w.document.write(ins);
3508 //w.document.close(); 3506 //w.document.close();
3509 -var temp;  
3510 if(!document.getElementById("panellegendaeditorOL")){ 3507 if(!document.getElementById("panellegendaeditorOL")){
3511 YAHOO.namespace("legendaeditorOL.container"); 3508 YAHOO.namespace("legendaeditorOL.container");
3512 YAHOO.legendaeditorOL.container.panel = new YAHOO.widget.Panel("panellegendaeditorOL", {zIndex:20000, iframe:true, width:"250px", visible:false, draggable:true, close:true } ); 3509 YAHOO.legendaeditorOL.container.panel = new YAHOO.widget.Panel("panellegendaeditorOL", {zIndex:20000, iframe:true, width:"250px", visible:false, draggable:true, close:true } );
@@ -3606,12 +3603,11 @@ i3GEO.editorOL.processageo(&quot;converteSHP&quot;); @@ -3606,12 +3603,11 @@ i3GEO.editorOL.processageo(&quot;converteSHP&quot;);
3606 listaGeometriasSel: function(){ 3603 listaGeometriasSel: function(){
3607 var geos = i3GEO.editorOL.layergrafico.selectedFeatures; 3604 var geos = i3GEO.editorOL.layergrafico.selectedFeatures;
3608 var n = geos.length; 3605 var n = geos.length;
3609 -var ins = ""; 3606 +var ins = "",i;
3610 for(i=0;i<n;i++){ 3607 for(i=0;i<n;i++){
3611 ins += "<b>Geometria: "+i+"</b><br>"+geos[i].geometry+"<br><br>"; 3608 ins += "<b>Geometria: "+i+"</b><br>"+geos[i].geometry+"<br><br>";
3612 ins += "<b>Atributos: "+i+"</b><br>"; 3609 ins += "<b>Atributos: "+i+"</b><br>";
3613 var a = geos[i].attributes; 3610 var a = geos[i].attributes;
3614 -var keys = [];  
3615 for(key in a){ 3611 for(key in a){
3616 if(a[key]){ 3612 if(a[key]){
3617 ins += key+" = "+a[key]+"<br>"; 3613 ins += key+" = "+a[key]+"<br>";
@@ -3670,11 +3666,12 @@ if(i3GEO &amp;&amp; i3GEO.barraDeBotoes){ @@ -3670,11 +3666,12 @@ if(i3GEO &amp;&amp; i3GEO.barraDeBotoes){
3670 i3GEO.barraDeBotoes.ativaPadrao(); 3666 i3GEO.barraDeBotoes.ativaPadrao();
3671 } 3667 }
3672 } 3668 }
3673 -catch(e){} 3669 +catch(e){ }
3674 if(!c.trigger) 3670 if(!c.trigger)
3675 {c.activate();} 3671 {c.activate();}
3676 else 3672 else
3677 {c.trigger.call();} 3673 {c.trigger.call();}
  3674 +}
3678 }); 3675 });
3679 if(botoes.procura===true){ 3676 if(botoes.procura===true){
3680 button = new OpenLayers.Control.Button({ 3677 button = new OpenLayers.Control.Button({
@@ -3787,7 +3784,6 @@ temp1, @@ -3787,7 +3784,6 @@ temp1,
3787 n, 3784 n,
3788 i, 3785 i,
3789 f = [], 3786 f = [],
3790 -f1 = [],  
3791 textoN = texto.split(":"); 3787 textoN = texto.split(":");
3792 try{ 3788 try{
3793 if(textoN.length > 1){ 3789 if(textoN.length > 1){
@@ -4223,7 +4219,6 @@ if(i3GEO.editorOL.pontos.length === 0) @@ -4223,7 +4219,6 @@ if(i3GEO.editorOL.pontos.length === 0)
4223 {return;} 4219 {return;}
4224 var SHADOW_Z_INDEX = 10, 4220 var SHADOW_Z_INDEX = 10,
4225 MARKER_Z_INDEX = 11, 4221 MARKER_Z_INDEX = 11,
4226 -DIAMETER = 200,  
4227 layer = new OpenLayers.Layer.Vector( 4222 layer = new OpenLayers.Layer.Vector(
4228 "pontos", 4223 "pontos",
4229 { 4224 {
@@ -4245,8 +4240,6 @@ visibility:true @@ -4245,8 +4240,6 @@ visibility:true
4245 index, 4240 index,
4246 x = [], 4241 x = [],
4247 y = [], 4242 y = [],
4248 -pixel,  
4249 -lonlat,  
4250 features = []; 4243 features = [];
4251 for (index = 0; index < i3GEO.editorOL.pontos.length; index = index + 2){ 4244 for (index = 0; index < i3GEO.editorOL.pontos.length; index = index + 2){
4252 x.push(i3GEO.editorOL.pontos[index]); 4245 x.push(i3GEO.editorOL.pontos[index]);
@@ -4272,13 +4265,15 @@ eval(id+&quot; = new OpenLayers.Layer.Vector(&#39;&quot;+id+&quot;&#39;, {displayOutsideMaxExtent:true, @@ -4272,13 +4265,15 @@ eval(id+&quot; = new OpenLayers.Layer.Vector(&#39;&quot;+id+&quot;&#39;, {displayOutsideMaxExtent:true,
4272 eval("i3GEO.editorOL.mapa.addLayer("+id+");"); 4265 eval("i3GEO.editorOL.mapa.addLayer("+id+");");
4273 eval("temp = "+id+".div;"); 4266 eval("temp = "+id+".div;");
4274 temp.onclick = function(e){ 4267 temp.onclick = function(e){
4275 -var targ,id,temp,features,n,i,j,g,html=""; 4268 +var targ = "",id,temp,features,n,i,g,html="";
4276 if (!e){e = window.event;} 4269 if (!e){e = window.event;}
4277 if (e.target) 4270 if (e.target)
4278 {targ = e.target;} 4271 {targ = e.target;}
4279 -else 4272 +else{
4280 if (e.srcElement) 4273 if (e.srcElement)
4281 {targ = e.srcElement;} 4274 {targ = e.srcElement;}
  4275 +}
  4276 +if(targ.id){
4282 temp = targ.id.split("_"); 4277 temp = targ.id.split("_");
4283 if(temp[0] === "OpenLayers.Geometry.Point"){ 4278 if(temp[0] === "OpenLayers.Geometry.Point"){
4284 id = targ.id; 4279 id = targ.id;
@@ -4287,7 +4282,7 @@ features = temp.features; @@ -4287,7 +4282,7 @@ features = temp.features;
4287 n = features.length; 4282 n = features.length;
4288 for(i=0;i<n;i++){ 4283 for(i=0;i<n;i++){
4289 if(features[i].geometry.id === id){ 4284 if(features[i].geometry.id === id){
4290 -for (j in features[i].attributes) { 4285 +for (var j in features[i].attributes) {
4291 html += j+": "+features[i].attributes[j]; 4286 html += j+": "+features[i].attributes[j];
4292 } 4287 }
4293 g = features[i].geometry; 4288 g = features[i].geometry;
@@ -4302,6 +4297,7 @@ true @@ -4302,6 +4297,7 @@ true
4302 } 4297 }
4303 } 4298 }
4304 } 4299 }
  4300 +}
4305 }; 4301 };
4306 } 4302 }
4307 }, 4303 },
@@ -4386,7 +4382,7 @@ YAHOO.editorOL.container.panel.center(); @@ -4386,7 +4382,7 @@ YAHOO.editorOL.container.panel.center();
4386 YAHOO.util.Event.addListener(YAHOO.editorOL.container.panel.close, "click", function(){}); 4382 YAHOO.util.Event.addListener(YAHOO.editorOL.container.panel.close, "click", function(){});
4387 temp = $i("panelpropriedadesEditor_minimizaCabecalho"); 4383 temp = $i("panelpropriedadesEditor_minimizaCabecalho");
4388 if(temp){ 4384 if(temp){
4389 -temp.onclick = function(){i3GEO.janela.minimiza("panelpropriedadesEditor");} 4385 +temp.onclick = function(){i3GEO.janela.minimiza("panelpropriedadesEditor");};
4390 } 4386 }
4391 } 4387 }
4392 YAHOO.editorOL.container.panel.show(); 4388 YAHOO.editorOL.container.panel.show();
@@ -4411,7 +4407,7 @@ YAHOO.editorOL.listaGeometrias.panel.destroy(); @@ -4411,7 +4407,7 @@ YAHOO.editorOL.listaGeometrias.panel.destroy();
4411 }); 4407 });
4412 temp = $i("panellistagEditor_minimizaCabecalho"); 4408 temp = $i("panellistagEditor_minimizaCabecalho");
4413 if(temp){ 4409 if(temp){
4414 -temp.onclick = function(){i3GEO.janela.minimiza("panellistagEditor");} 4410 +temp.onclick = function(){i3GEO.janela.minimiza("panellistagEditor");};
4415 } 4411 }
4416 } 4412 }
4417 else{ 4413 else{
@@ -4469,7 +4465,7 @@ YAHOO.util.Event.addListener(YAHOO.editorOL.ferramentas.panel.close, &quot;click&quot;, fu @@ -4469,7 +4465,7 @@ YAHOO.util.Event.addListener(YAHOO.editorOL.ferramentas.panel.close, &quot;click&quot;, fu
4469 }); 4465 });
4470 temp = $i("panelferramentasEditor_minimizaCabecalho"); 4466 temp = $i("panelferramentasEditor_minimizaCabecalho");
4471 if(temp){ 4467 if(temp){
4472 -temp.onclick = function(){i3GEO.janela.minimiza("panelferramentasEditor");} 4468 +temp.onclick = function(){i3GEO.janela.minimiza("panelferramentasEditor");};
4473 } 4469 }
4474 } 4470 }
4475 else{ 4471 else{
@@ -4505,8 +4501,7 @@ if(temp.checked === true) @@ -4505,8 +4501,7 @@ if(temp.checked === true)
4505 processageo: function(operacao){ 4501 processageo: function(operacao){
4506 if(operacao === ""){return;} 4502 if(operacao === ""){return;}
4507 var geosel = i3GEO.editorOL.layergrafico.selectedFeatures, 4503 var geosel = i3GEO.editorOL.layergrafico.selectedFeatures,
4508 -fwkt = new OpenLayers.Format.WKT(),  
4509 -polis,linhas,pontos,uniaopolis,uniaolinhas,uniaopontos,n,i,temp; 4504 +polis,linhas,pontos,temp;
4510 if(geosel.length > 0){ 4505 if(geosel.length > 0){
4511 polis = i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.Polygon"); 4506 polis = i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.Polygon");
4512 linhas = i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.LineString"); 4507 linhas = i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.LineString");
@@ -4523,7 +4518,7 @@ if(operacao === &quot;converteSHP&quot;){ @@ -4523,7 +4518,7 @@ if(operacao === &quot;converteSHP&quot;){
4523 i3GEO.atualiza(); 4518 i3GEO.atualiza();
4524 i3GEO.janela.minimiza("paneltemaativo"); 4519 i3GEO.janela.minimiza("paneltemaativo");
4525 } 4520 }
4526 -} 4521 +};
4527 if(operacao === "union" && !i3GEO.php ){ 4522 if(operacao === "union" && !i3GEO.php ){
4528 if(polis.length > 0){ 4523 if(polis.length > 0){
4529 temp = i3GEO.editorOL.uniaojts(polis); 4524 temp = i3GEO.editorOL.uniaojts(polis);
@@ -4591,13 +4586,13 @@ return lista; @@ -4591,13 +4586,13 @@ return lista;
4591 guardaBackup: function(){ 4586 guardaBackup: function(){
4592 return; 4587 return;
4593 if(!i3GEO.editorOL.backup) 4588 if(!i3GEO.editorOL.backup)
4594 -{i3GEO.editorOL.backup = new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false})} 4589 +{i3GEO.editorOL.backup = new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false});}
4595 else 4590 else
4596 {i3GEO.editorOL.backup.removeFeatures(i3GEO.editorOL.backup.features);} 4591 {i3GEO.editorOL.backup.removeFeatures(i3GEO.editorOL.backup.features);}
4597 i3GEO.editorOL.backup.addFeatures(i3GEO.editorOL.layergrafico.features); 4592 i3GEO.editorOL.backup.addFeatures(i3GEO.editorOL.layergrafico.features);
4598 }, 4593 },
4599 unselTodos:function(){ 4594 unselTodos:function(){
4600 -var n,i,temp; 4595 +var n,i;
4601 n = i3GEO.editorOL.layergrafico.features.length; 4596 n = i3GEO.editorOL.layergrafico.features.length;
4602 for(i=0;i<n;i++){ 4597 for(i=0;i<n;i++){
4603 i3GEO.editorOL.layergrafico.features[i].renderIntent = "default"; 4598 i3GEO.editorOL.layergrafico.features[i].renderIntent = "default";
@@ -4605,7 +4600,7 @@ i3GEO.editorOL.selbutton.unselect(i3GEO.editorOL.layergrafico.features[i]); @@ -4605,7 +4600,7 @@ i3GEO.editorOL.selbutton.unselect(i3GEO.editorOL.layergrafico.features[i]);
4605 } 4600 }
4606 }, 4601 },
4607 unselTodosBackup:function(){ 4602 unselTodosBackup:function(){
4608 -var n,i,temp; 4603 +var n,i;
4609 n = i3GEO.editorOL.backup.features.length; 4604 n = i3GEO.editorOL.backup.features.length;
4610 for(i=0;i<n;i++){ 4605 for(i=0;i<n;i++){
4611 i3GEO.editorOL.backup.features[i].renderIntent = "default"; 4606 i3GEO.editorOL.backup.features[i].renderIntent = "default";
@@ -4678,7 +4673,7 @@ else @@ -4678,7 +4673,7 @@ else
4678 trazParaFrente: function(){ 4673 trazParaFrente: function(){
4679 var features = i3GEO.editorOL.layergrafico.selectedFeatures; 4674 var features = i3GEO.editorOL.layergrafico.selectedFeatures;
4680 if(features.length > 0){ 4675 if(features.length > 0){
4681 -i3GEO.editorOL.backup = new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false}) 4676 +i3GEO.editorOL.backup = new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false});
4682 i3GEO.editorOL.backup.addFeatures(features); 4677 i3GEO.editorOL.backup.addFeatures(features);
4683 i3GEO.editorOL.unselTodosBackup(); 4678 i3GEO.editorOL.unselTodosBackup();
4684 i3GEO.editorOL.layergrafico.removeFeatures(features); 4679 i3GEO.editorOL.layergrafico.removeFeatures(features);
mashups/openlayers_compacto.js.php
@@ -3011,7 +3011,7 @@ OpenLayers.Feature.prototype.destroy.apply(this,arguments);},processXMLNode:func @@ -3011,7 +3011,7 @@ OpenLayers.Feature.prototype.destroy.apply(this,arguments);},processXMLNode:func
3011 if(data&&data.nodeType==9){data=data.documentElement;} 3011 if(data&&data.nodeType==9){data=data.documentElement;}
3012 var capabilities={};this.readNode(data,capabilities);capabilities.version=this.version;return capabilities;},readers:{"wmts":{"Capabilities":function(node,obj){this.readChildNodes(node,obj);},"Contents":function(node,obj){obj.contents={};obj.contents.layers=[];obj.contents.tileMatrixSets={};this.readChildNodes(node,obj.contents);},"Layer":function(node,obj){var layer={styles:[],formats:[],tileMatrixSetLinks:[]};layer.layers=[];this.readChildNodes(node,layer);obj.layers.push(layer);},"Style":function(node,obj){var style={};style.isDefault=(node.getAttribute("isDefault")==="true");this.readChildNodes(node,style);obj.styles.push(style);},"Format":function(node,obj){obj.formats.push(this.getChildValue(node));},"TileMatrixSetLink":function(node,obj){var tileMatrixSetLink={};this.readChildNodes(node,tileMatrixSetLink);obj.tileMatrixSetLinks.push(tileMatrixSetLink);},"TileMatrixSet":function(node,obj){if(obj.layers){var tileMatrixSet={matrixIds:[]};this.readChildNodes(node,tileMatrixSet);obj.tileMatrixSets[tileMatrixSet.identifier]=tileMatrixSet;}else{obj.tileMatrixSet=this.getChildValue(node);}},"TileMatrix":function(node,obj){var tileMatrix={supportedCRS:obj.supportedCRS};this.readChildNodes(node,tileMatrix);obj.matrixIds.push(tileMatrix);},"ScaleDenominator":function(node,obj){obj.scaleDenominator=parseFloat(this.getChildValue(node));},"TopLeftCorner":function(node,obj){var topLeftCorner=this.getChildValue(node);var coords=topLeftCorner.split(" ");var yx;if(obj.supportedCRS){var crs=obj.supportedCRS.replace(/urn:ogc:def:crs:(\w+):.+:(\w+)$/,"urn:ogc:def:crs:$1::$2");yx=!!this.yx[crs];} 3012 var capabilities={};this.readNode(data,capabilities);capabilities.version=this.version;return capabilities;},readers:{"wmts":{"Capabilities":function(node,obj){this.readChildNodes(node,obj);},"Contents":function(node,obj){obj.contents={};obj.contents.layers=[];obj.contents.tileMatrixSets={};this.readChildNodes(node,obj.contents);},"Layer":function(node,obj){var layer={styles:[],formats:[],tileMatrixSetLinks:[]};layer.layers=[];this.readChildNodes(node,layer);obj.layers.push(layer);},"Style":function(node,obj){var style={};style.isDefault=(node.getAttribute("isDefault")==="true");this.readChildNodes(node,style);obj.styles.push(style);},"Format":function(node,obj){obj.formats.push(this.getChildValue(node));},"TileMatrixSetLink":function(node,obj){var tileMatrixSetLink={};this.readChildNodes(node,tileMatrixSetLink);obj.tileMatrixSetLinks.push(tileMatrixSetLink);},"TileMatrixSet":function(node,obj){if(obj.layers){var tileMatrixSet={matrixIds:[]};this.readChildNodes(node,tileMatrixSet);obj.tileMatrixSets[tileMatrixSet.identifier]=tileMatrixSet;}else{obj.tileMatrixSet=this.getChildValue(node);}},"TileMatrix":function(node,obj){var tileMatrix={supportedCRS:obj.supportedCRS};this.readChildNodes(node,tileMatrix);obj.matrixIds.push(tileMatrix);},"ScaleDenominator":function(node,obj){obj.scaleDenominator=parseFloat(this.getChildValue(node));},"TopLeftCorner":function(node,obj){var topLeftCorner=this.getChildValue(node);var coords=topLeftCorner.split(" ");var yx;if(obj.supportedCRS){var crs=obj.supportedCRS.replace(/urn:ogc:def:crs:(\w+):.+:(\w+)$/,"urn:ogc:def:crs:$1::$2");yx=!!this.yx[crs];}
3013 if(yx){obj.topLeftCorner=new OpenLayers.LonLat(coords[1],coords[0]);}else{obj.topLeftCorner=new OpenLayers.LonLat(coords[0],coords[1]);}},"TileWidth":function(node,obj){obj.tileWidth=parseInt(this.getChildValue(node));},"TileHeight":function(node,obj){obj.tileHeight=parseInt(this.getChildValue(node));},"MatrixWidth":function(node,obj){obj.matrixWidth=parseInt(this.getChildValue(node));},"MatrixHeight":function(node,obj){obj.matrixHeight=parseInt(this.getChildValue(node));},"ResourceURL":function(node,obj){obj.resourceUrl=obj.resourceUrl||{};obj.resourceUrl[node.getAttribute("resourceType")]={format:node.getAttribute("format"),template:node.getAttribute("template")};},"WSDL":function(node,obj){obj.wsdl={};obj.wsdl.href=node.getAttribute("xlink:href");},"ServiceMetadataURL":function(node,obj){obj.serviceMetadataUrl={};obj.serviceMetadataUrl.href=node.getAttribute("xlink:href");}},"ows":OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers["ows"]},CLASS_NAME:"OpenLayers.Format.WMTSCapabilities.v1_0_0"}); 3013 if(yx){obj.topLeftCorner=new OpenLayers.LonLat(coords[1],coords[0]);}else{obj.topLeftCorner=new OpenLayers.LonLat(coords[0],coords[1]);}},"TileWidth":function(node,obj){obj.tileWidth=parseInt(this.getChildValue(node));},"TileHeight":function(node,obj){obj.tileHeight=parseInt(this.getChildValue(node));},"MatrixWidth":function(node,obj){obj.matrixWidth=parseInt(this.getChildValue(node));},"MatrixHeight":function(node,obj){obj.matrixHeight=parseInt(this.getChildValue(node));},"ResourceURL":function(node,obj){obj.resourceUrl=obj.resourceUrl||{};obj.resourceUrl[node.getAttribute("resourceType")]={format:node.getAttribute("format"),template:node.getAttribute("template")};},"WSDL":function(node,obj){obj.wsdl={};obj.wsdl.href=node.getAttribute("xlink:href");},"ServiceMetadataURL":function(node,obj){obj.serviceMetadataUrl={};obj.serviceMetadataUrl.href=node.getAttribute("xlink:href");}},"ows":OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers["ows"]},CLASS_NAME:"OpenLayers.Format.WMTSCapabilities.v1_0_0"});
3014 -/*jslint white:false,undef: false, rhino: true, onevar: true, evil: false */ 3014 +/*çjslint white:false,undef: false, rhino: true, onevar: true, evil: false */
3015 var $i = function(id) 3015 var $i = function(id)
3016 {return document.getElementById(id);}; 3016 {return document.getElementById(id);};
3017 //seta as variáveis navn e navm 3017 //seta as variáveis navn e navm
@@ -3275,7 +3275,7 @@ visibility:true @@ -3275,7 +3275,7 @@ visibility:true
3275 layersLigados: function(){ 3275 layersLigados: function(){
3276 var layers = i3GEO.editorOL.mapa.layers, 3276 var layers = i3GEO.editorOL.mapa.layers,
3277 nlayers = layers.length, 3277 nlayers = layers.length,
3278 -ins = []; 3278 +ins = [],i;
3279 for(i=0;i<nlayers;i++){ 3279 for(i=0;i<nlayers;i++){
3280 if(layers[i].visibility === true){ 3280 if(layers[i].visibility === true){
3281 ins.push(layers[i]); 3281 ins.push(layers[i]);
@@ -3290,7 +3290,7 @@ coordenadas: function(){ @@ -3290,7 +3290,7 @@ coordenadas: function(){
3290 var idcoord = i3GEO.editorOL.mapa.getControlsBy("separator"," "); 3290 var idcoord = i3GEO.editorOL.mapa.getControlsBy("separator"," ");
3291 if(idcoord[0]){ 3291 if(idcoord[0]){
3292 i3GEO.editorOL.mapa.events.register("mousemove", i3GEO.editorOL.mapa, function(e){ 3292 i3GEO.editorOL.mapa.events.register("mousemove", i3GEO.editorOL.mapa, function(e){
3293 -var p,lonlat,d,dc; 3293 +var p,lonlat,d;
3294 if (navm) 3294 if (navm)
3295 {p = new OpenLayers.Pixel(e.x,e.y);} 3295 {p = new OpenLayers.Pixel(e.x,e.y);}
3296 else 3296 else
@@ -3350,7 +3350,6 @@ criaComboTemas: function(){ @@ -3350,7 +3350,6 @@ criaComboTemas: function(){
3350 var layers = i3GEO.editorOL.layersLigados(), 3350 var layers = i3GEO.editorOL.layersLigados(),
3351 nlayers = layers.length, 3351 nlayers = layers.length,
3352 i, 3352 i,
3353 -temp,  
3354 combo = "<select id=i3GEOOLlistaTemasAtivos >"; 3353 combo = "<select id=i3GEOOLlistaTemasAtivos >";
3355 //i3GEO.editorOL.layergrafico.setLayerIndex(i3GEO.editorOL.getNumLayers() + 1); 3354 //i3GEO.editorOL.layergrafico.setLayerIndex(i3GEO.editorOL.getNumLayers() + 1);
3356 for(i=0;i<nlayers;i++){ 3355 for(i=0;i<nlayers;i++){
@@ -3395,7 +3394,7 @@ if(i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search(&quot;i3GEO.editorOL.atualiz @@ -3395,7 +3394,7 @@ if(i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search(&quot;i3GEO.editorOL.atualiz
3395 } 3394 }
3396 temp = $i("paneltemaativo_minimizaCabecalho"); 3395 temp = $i("paneltemaativo_minimizaCabecalho");
3397 if(temp){ 3396 if(temp){
3398 -temp.onclick = function(){i3GEO.janela.minimiza("paneltemaativo");} 3397 +temp.onclick = function(){i3GEO.janela.minimiza("paneltemaativo");};
3399 } 3398 }
3400 } 3399 }
3401 else{ 3400 else{
@@ -3432,7 +3431,6 @@ geometryName: &quot;msGeometry&quot; @@ -3432,7 +3431,6 @@ geometryName: &quot;msGeometry&quot;
3432 gml = fromgml.read(retorno.responseText), 3431 gml = fromgml.read(retorno.responseText),
3433 prop = gml.featureTypes[0].properties, 3432 prop = gml.featureTypes[0].properties,
3434 nprop = prop.length, 3433 nprop = prop.length,
3435 -itens = [],  
3436 i, 3434 i,
3437 combo = "<select id="+idobj+" ><option value=''>----</option>"; 3435 combo = "<select id="+idobj+" ><option value=''>----</option>";
3438 for(i = 0;i < nprop; i++){ 3436 for(i = 0;i < nprop; i++){
@@ -3494,7 +3492,7 @@ i3GEO.editorOL.mapa.zoomToExtent(b); @@ -3494,7 +3492,7 @@ i3GEO.editorOL.mapa.zoomToExtent(b);
3494 mostraLegenda: function(){ 3492 mostraLegenda: function(){
3495 var layers = i3GEO.editorOL.layersLigados(), 3493 var layers = i3GEO.editorOL.layersLigados(),
3496 nlayers = layers.length, 3494 nlayers = layers.length,
3497 -ins = ""; 3495 +ins = "",i;
3498 for(i=0;i<nlayers;i++){ 3496 for(i=0;i<nlayers;i++){
3499 try{ 3497 try{
3500 var url = layers[i].getFullRequestString({"request":"getlegendgraphic"}); 3498 var url = layers[i].getFullRequestString({"request":"getlegendgraphic"});
@@ -3506,7 +3504,6 @@ catch(e){} @@ -3506,7 +3504,6 @@ catch(e){}
3506 //var w = window.open(); 3504 //var w = window.open();
3507 //w.document.write(ins); 3505 //w.document.write(ins);
3508 //w.document.close(); 3506 //w.document.close();
3509 -var temp;  
3510 if(!document.getElementById("panellegendaeditorOL")){ 3507 if(!document.getElementById("panellegendaeditorOL")){
3511 YAHOO.namespace("legendaeditorOL.container"); 3508 YAHOO.namespace("legendaeditorOL.container");
3512 YAHOO.legendaeditorOL.container.panel = new YAHOO.widget.Panel("panellegendaeditorOL", {zIndex:20000, iframe:true, width:"250px", visible:false, draggable:true, close:true } ); 3509 YAHOO.legendaeditorOL.container.panel = new YAHOO.widget.Panel("panellegendaeditorOL", {zIndex:20000, iframe:true, width:"250px", visible:false, draggable:true, close:true } );
@@ -3606,12 +3603,11 @@ i3GEO.editorOL.processageo(&quot;converteSHP&quot;); @@ -3606,12 +3603,11 @@ i3GEO.editorOL.processageo(&quot;converteSHP&quot;);
3606 listaGeometriasSel: function(){ 3603 listaGeometriasSel: function(){
3607 var geos = i3GEO.editorOL.layergrafico.selectedFeatures; 3604 var geos = i3GEO.editorOL.layergrafico.selectedFeatures;
3608 var n = geos.length; 3605 var n = geos.length;
3609 -var ins = ""; 3606 +var ins = "",i;
3610 for(i=0;i<n;i++){ 3607 for(i=0;i<n;i++){
3611 ins += "<b>Geometria: "+i+"</b><br>"+geos[i].geometry+"<br><br>"; 3608 ins += "<b>Geometria: "+i+"</b><br>"+geos[i].geometry+"<br><br>";
3612 ins += "<b>Atributos: "+i+"</b><br>"; 3609 ins += "<b>Atributos: "+i+"</b><br>";
3613 var a = geos[i].attributes; 3610 var a = geos[i].attributes;
3614 -var keys = [];  
3615 for(key in a){ 3611 for(key in a){
3616 if(a[key]){ 3612 if(a[key]){
3617 ins += key+" = "+a[key]+"<br>"; 3613 ins += key+" = "+a[key]+"<br>";
@@ -3670,11 +3666,12 @@ if(i3GEO &amp;&amp; i3GEO.barraDeBotoes){ @@ -3670,11 +3666,12 @@ if(i3GEO &amp;&amp; i3GEO.barraDeBotoes){
3670 i3GEO.barraDeBotoes.ativaPadrao(); 3666 i3GEO.barraDeBotoes.ativaPadrao();
3671 } 3667 }
3672 } 3668 }
3673 -catch(e){} 3669 +catch(e){ }
3674 if(!c.trigger) 3670 if(!c.trigger)
3675 {c.activate();} 3671 {c.activate();}
3676 else 3672 else
3677 {c.trigger.call();} 3673 {c.trigger.call();}
  3674 +}
3678 }); 3675 });
3679 if(botoes.procura===true){ 3676 if(botoes.procura===true){
3680 button = new OpenLayers.Control.Button({ 3677 button = new OpenLayers.Control.Button({
@@ -3787,7 +3784,6 @@ temp1, @@ -3787,7 +3784,6 @@ temp1,
3787 n, 3784 n,
3788 i, 3785 i,
3789 f = [], 3786 f = [],
3790 -f1 = [],  
3791 textoN = texto.split(":"); 3787 textoN = texto.split(":");
3792 try{ 3788 try{
3793 if(textoN.length > 1){ 3789 if(textoN.length > 1){
@@ -4223,7 +4219,6 @@ if(i3GEO.editorOL.pontos.length === 0) @@ -4223,7 +4219,6 @@ if(i3GEO.editorOL.pontos.length === 0)
4223 {return;} 4219 {return;}
4224 var SHADOW_Z_INDEX = 10, 4220 var SHADOW_Z_INDEX = 10,
4225 MARKER_Z_INDEX = 11, 4221 MARKER_Z_INDEX = 11,
4226 -DIAMETER = 200,  
4227 layer = new OpenLayers.Layer.Vector( 4222 layer = new OpenLayers.Layer.Vector(
4228 "pontos", 4223 "pontos",
4229 { 4224 {
@@ -4245,8 +4240,6 @@ visibility:true @@ -4245,8 +4240,6 @@ visibility:true
4245 index, 4240 index,
4246 x = [], 4241 x = [],
4247 y = [], 4242 y = [],
4248 -pixel,  
4249 -lonlat,  
4250 features = []; 4243 features = [];
4251 for (index = 0; index < i3GEO.editorOL.pontos.length; index = index + 2){ 4244 for (index = 0; index < i3GEO.editorOL.pontos.length; index = index + 2){
4252 x.push(i3GEO.editorOL.pontos[index]); 4245 x.push(i3GEO.editorOL.pontos[index]);
@@ -4272,13 +4265,15 @@ eval(id+&quot; = new OpenLayers.Layer.Vector(&#39;&quot;+id+&quot;&#39;, {displayOutsideMaxExtent:true, @@ -4272,13 +4265,15 @@ eval(id+&quot; = new OpenLayers.Layer.Vector(&#39;&quot;+id+&quot;&#39;, {displayOutsideMaxExtent:true,
4272 eval("i3GEO.editorOL.mapa.addLayer("+id+");"); 4265 eval("i3GEO.editorOL.mapa.addLayer("+id+");");
4273 eval("temp = "+id+".div;"); 4266 eval("temp = "+id+".div;");
4274 temp.onclick = function(e){ 4267 temp.onclick = function(e){
4275 -var targ,id,temp,features,n,i,j,g,html=""; 4268 +var targ = "",id,temp,features,n,i,g,html="";
4276 if (!e){e = window.event;} 4269 if (!e){e = window.event;}
4277 if (e.target) 4270 if (e.target)
4278 {targ = e.target;} 4271 {targ = e.target;}
4279 -else 4272 +else{
4280 if (e.srcElement) 4273 if (e.srcElement)
4281 {targ = e.srcElement;} 4274 {targ = e.srcElement;}
  4275 +}
  4276 +if(targ.id){
4282 temp = targ.id.split("_"); 4277 temp = targ.id.split("_");
4283 if(temp[0] === "OpenLayers.Geometry.Point"){ 4278 if(temp[0] === "OpenLayers.Geometry.Point"){
4284 id = targ.id; 4279 id = targ.id;
@@ -4287,7 +4282,7 @@ features = temp.features; @@ -4287,7 +4282,7 @@ features = temp.features;
4287 n = features.length; 4282 n = features.length;
4288 for(i=0;i<n;i++){ 4283 for(i=0;i<n;i++){
4289 if(features[i].geometry.id === id){ 4284 if(features[i].geometry.id === id){
4290 -for (j in features[i].attributes) { 4285 +for (var j in features[i].attributes) {
4291 html += j+": "+features[i].attributes[j]; 4286 html += j+": "+features[i].attributes[j];
4292 } 4287 }
4293 g = features[i].geometry; 4288 g = features[i].geometry;
@@ -4302,6 +4297,7 @@ true @@ -4302,6 +4297,7 @@ true
4302 } 4297 }
4303 } 4298 }
4304 } 4299 }
  4300 +}
4305 }; 4301 };
4306 } 4302 }
4307 }, 4303 },
@@ -4386,7 +4382,7 @@ YAHOO.editorOL.container.panel.center(); @@ -4386,7 +4382,7 @@ YAHOO.editorOL.container.panel.center();
4386 YAHOO.util.Event.addListener(YAHOO.editorOL.container.panel.close, "click", function(){}); 4382 YAHOO.util.Event.addListener(YAHOO.editorOL.container.panel.close, "click", function(){});
4387 temp = $i("panelpropriedadesEditor_minimizaCabecalho"); 4383 temp = $i("panelpropriedadesEditor_minimizaCabecalho");
4388 if(temp){ 4384 if(temp){
4389 -temp.onclick = function(){i3GEO.janela.minimiza("panelpropriedadesEditor");} 4385 +temp.onclick = function(){i3GEO.janela.minimiza("panelpropriedadesEditor");};
4390 } 4386 }
4391 } 4387 }
4392 YAHOO.editorOL.container.panel.show(); 4388 YAHOO.editorOL.container.panel.show();
@@ -4411,7 +4407,7 @@ YAHOO.editorOL.listaGeometrias.panel.destroy(); @@ -4411,7 +4407,7 @@ YAHOO.editorOL.listaGeometrias.panel.destroy();
4411 }); 4407 });
4412 temp = $i("panellistagEditor_minimizaCabecalho"); 4408 temp = $i("panellistagEditor_minimizaCabecalho");
4413 if(temp){ 4409 if(temp){
4414 -temp.onclick = function(){i3GEO.janela.minimiza("panellistagEditor");} 4410 +temp.onclick = function(){i3GEO.janela.minimiza("panellistagEditor");};
4415 } 4411 }
4416 } 4412 }
4417 else{ 4413 else{
@@ -4469,7 +4465,7 @@ YAHOO.util.Event.addListener(YAHOO.editorOL.ferramentas.panel.close, &quot;click&quot;, fu @@ -4469,7 +4465,7 @@ YAHOO.util.Event.addListener(YAHOO.editorOL.ferramentas.panel.close, &quot;click&quot;, fu
4469 }); 4465 });
4470 temp = $i("panelferramentasEditor_minimizaCabecalho"); 4466 temp = $i("panelferramentasEditor_minimizaCabecalho");
4471 if(temp){ 4467 if(temp){
4472 -temp.onclick = function(){i3GEO.janela.minimiza("panelferramentasEditor");} 4468 +temp.onclick = function(){i3GEO.janela.minimiza("panelferramentasEditor");};
4473 } 4469 }
4474 } 4470 }
4475 else{ 4471 else{
@@ -4505,8 +4501,7 @@ if(temp.checked === true) @@ -4505,8 +4501,7 @@ if(temp.checked === true)
4505 processageo: function(operacao){ 4501 processageo: function(operacao){
4506 if(operacao === ""){return;} 4502 if(operacao === ""){return;}
4507 var geosel = i3GEO.editorOL.layergrafico.selectedFeatures, 4503 var geosel = i3GEO.editorOL.layergrafico.selectedFeatures,
4508 -fwkt = new OpenLayers.Format.WKT(),  
4509 -polis,linhas,pontos,uniaopolis,uniaolinhas,uniaopontos,n,i,temp; 4504 +polis,linhas,pontos,temp;
4510 if(geosel.length > 0){ 4505 if(geosel.length > 0){
4511 polis = i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.Polygon"); 4506 polis = i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.Polygon");
4512 linhas = i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.LineString"); 4507 linhas = i3GEO.editorOL.retornaGeometriasTipo(geosel,"OpenLayers.Geometry.LineString");
@@ -4523,7 +4518,7 @@ if(operacao === &quot;converteSHP&quot;){ @@ -4523,7 +4518,7 @@ if(operacao === &quot;converteSHP&quot;){
4523 i3GEO.atualiza(); 4518 i3GEO.atualiza();
4524 i3GEO.janela.minimiza("paneltemaativo"); 4519 i3GEO.janela.minimiza("paneltemaativo");
4525 } 4520 }
4526 -} 4521 +};
4527 if(operacao === "union" && !i3GEO.php ){ 4522 if(operacao === "union" && !i3GEO.php ){
4528 if(polis.length > 0){ 4523 if(polis.length > 0){
4529 temp = i3GEO.editorOL.uniaojts(polis); 4524 temp = i3GEO.editorOL.uniaojts(polis);
@@ -4591,13 +4586,13 @@ return lista; @@ -4591,13 +4586,13 @@ return lista;
4591 guardaBackup: function(){ 4586 guardaBackup: function(){
4592 return; 4587 return;
4593 if(!i3GEO.editorOL.backup) 4588 if(!i3GEO.editorOL.backup)
4594 -{i3GEO.editorOL.backup = new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false})} 4589 +{i3GEO.editorOL.backup = new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false});}
4595 else 4590 else
4596 {i3GEO.editorOL.backup.removeFeatures(i3GEO.editorOL.backup.features);} 4591 {i3GEO.editorOL.backup.removeFeatures(i3GEO.editorOL.backup.features);}
4597 i3GEO.editorOL.backup.addFeatures(i3GEO.editorOL.layergrafico.features); 4592 i3GEO.editorOL.backup.addFeatures(i3GEO.editorOL.layergrafico.features);
4598 }, 4593 },
4599 unselTodos:function(){ 4594 unselTodos:function(){
4600 -var n,i,temp; 4595 +var n,i;
4601 n = i3GEO.editorOL.layergrafico.features.length; 4596 n = i3GEO.editorOL.layergrafico.features.length;
4602 for(i=0;i<n;i++){ 4597 for(i=0;i<n;i++){
4603 i3GEO.editorOL.layergrafico.features[i].renderIntent = "default"; 4598 i3GEO.editorOL.layergrafico.features[i].renderIntent = "default";
@@ -4605,7 +4600,7 @@ i3GEO.editorOL.selbutton.unselect(i3GEO.editorOL.layergrafico.features[i]); @@ -4605,7 +4600,7 @@ i3GEO.editorOL.selbutton.unselect(i3GEO.editorOL.layergrafico.features[i]);
4605 } 4600 }
4606 }, 4601 },
4607 unselTodosBackup:function(){ 4602 unselTodosBackup:function(){
4608 -var n,i,temp; 4603 +var n,i;
4609 n = i3GEO.editorOL.backup.features.length; 4604 n = i3GEO.editorOL.backup.features.length;
4610 for(i=0;i<n;i++){ 4605 for(i=0;i<n;i++){
4611 i3GEO.editorOL.backup.features[i].renderIntent = "default"; 4606 i3GEO.editorOL.backup.features[i].renderIntent = "default";
@@ -4678,7 +4673,7 @@ else @@ -4678,7 +4673,7 @@ else
4678 trazParaFrente: function(){ 4673 trazParaFrente: function(){
4679 var features = i3GEO.editorOL.layergrafico.selectedFeatures; 4674 var features = i3GEO.editorOL.layergrafico.selectedFeatures;
4680 if(features.length > 0){ 4675 if(features.length > 0){
4681 -i3GEO.editorOL.backup = new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false}) 4676 +i3GEO.editorOL.backup = new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false});
4682 i3GEO.editorOL.backup.addFeatures(features); 4677 i3GEO.editorOL.backup.addFeatures(features);
4683 i3GEO.editorOL.unselTodosBackup(); 4678 i3GEO.editorOL.unselTodosBackup();
4684 i3GEO.editorOL.layergrafico.removeFeatures(features); 4679 i3GEO.editorOL.layergrafico.removeFeatures(features);