/*jslint white:false,undef: false, rhino: true, onevar: true, evil: false */
var $i = function(id)
{return document.getElementById(id);};
//seta as variáveis navn e navm
var navn = false;
var navm = false;
var app = navigator.appName.substring(0,1);
if (app==='N'){navn=true;}else{navm=true;}
OpenLayers.ImgPath = "../pacotes/openlayers/img/";
OpenLayers.Lang.setCode("pt-BR");
i3GEO.editorOL = {
simbologia: {
opacidade: 0.8,
texto: "",
fillColor: "250,180,15",
strokeWidth: 2,
strokeColor: "250,150,0",
pointRadius: 4,
graphicName: "square",
fontSize: "12px",
fontColor: "0,0,0"
},
backup: new OpenLayers.Layer.Vector("Backup",{displayInLayerSwitcher:false,visibility:false}),
nomeFuncaoSalvar: "i3GEO.editorOL.testeSalvar()",
e_oce: new OpenLayers.Layer.ArcGIS93Rest(
"ESRI Ocean Basemap",
"http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer/export",
{format:"jpeg"},
{isBaseLayer:true,visibility:false}
),
e_ims: new OpenLayers.Layer.ArcGIS93Rest(
"ESRI Imagery World 2D",
"http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer/export",
{format:"jpeg"},
{isBaseLayer:true,visibility:false}
),
e_wsm: new OpenLayers.Layer.ArcGIS93Rest(
"ESRI World Street Map",
"http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer/export",
{format:"jpeg"},
{isBaseLayer:true,visibility:false}
),
ol_mma: new OpenLayers.Layer.WMS(
"Base cartográfica",
"http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseraster.map&",
{layers:'baseraster',SRS:'EPSG:4618',FORMAT:'image/png'},
{singleTile:true}
),
ol_wms: new OpenLayers.Layer.WMS.Untiled(
"OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0",
{layers: 'basic'}
),
top_wms: new OpenLayers.Layer.WMS(
"Toponímia MMA",
"http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseref.map&",
{layers: "base",FORMAT:'image/png'}
),
est_wms: new OpenLayers.Layer.WMS(
"Estados do Brasil",
"http://mapas.mma.gov.br/i3geo/ogc.php?tema=estadosl&",
{layers: "estadosl",FORMAT:'image/png'}
),
fundo: "e_oce,e_ims,e_wsm,ol_mma,ol_wms,top_wms,est_wms",
kml: [],
layersIniciais: [],
botoes: {
'pan':true,
'zoombox':true,
'zoomtot':true,
'legenda':true,
'distancia':true,
'area':true,
'identifica':true,
'linha':true,
'ponto':true,
'poligono':true,
'texto':true,
'edita':true,
'listag':true,
'corta': true,
'apaga':true,
'procura':true,
'selecao':true,
'salva':true,
'ajuda':true,
'propriedades':true,
'fecha':false,
'tools':true,
'undo':false,
'frente':false,
'legenda':true,
'rodadomouse':true
},
pontos: [],
marca: "../pacotes/openlayers/img/marker-gold.png",
controles: [
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.LayerSwitcher({'ascending':false}),
new OpenLayers.Control.ScaleLine(),
new OpenLayers.Control.MousePosition({'separator':' '}),
new OpenLayers.Control.OverviewMap(),
new OpenLayers.Control.KeyboardDefaults()
],
tiles: true,
incluilayergrafico: true,
ativalayerswitcher: false,
ativarodadomouse: true,
numzoom: 12,
maxext: "",
mapext: new OpenLayers.Bounds(-76.5125927,-39.3925675209,-29.5851853,9.49014852081),
mapa: "",
inicia: function(){
var single = false,
alayers = [],
fundo = (i3GEO.editorOL.fundo).split(","),
nfundo = fundo.length,
ncontroles = i3GEO.editorOL.controles.length,
i,
n;
if(i3GEO.editorOL.tiles === false || i3GEO.editorOL.tiles === "false"){
single = true;
}
if(i3GEO.editorOL.ativalayerswitcher === "false"){
i3GEO.editorOL.ativalayerswitcher = false;
}
if(i3GEO.editorOL.ativalayerswitcher === "true"){
i3GEO.editorOL.ativalayerswitcher = true;
}
if(i3GEO.editorOL.ativarodadomouse === "false"){
i3GEO.editorOL.ativarodadomouse = false;
}
if(i3GEO.editorOL.ativarodadomouse === "true"){
i3GEO.editorOL.ativarodadomouse = true;
}
if(i3GEO.editorOL.incluilayergrafico === "false"){
i3GEO.editorOL.incluilayergrafico = false;
}
if(i3GEO.editorOL.incluilayergrafico === "true"){
i3GEO.editorOL.incluilayergrafico = true;
}
if(i3GEO.editorOL.incluilayergrafico === true){
i3GEO.editorOL.criaLayerGrafico();
}
else{
i3GEO.editorOL.layergrafico = "";
i3GEO.editorOL.botoes.linha=false;
i3GEO.editorOL.botoes.ponto=false;
i3GEO.editorOL.botoes.poligono=false;
i3GEO.editorOL.botoes.texto=false;
i3GEO.editorOL.botoes.edita=false;
i3GEO.editorOL.botoes.listag=false;
i3GEO.editorOL.botoes.corta= false;
i3GEO.editorOL.botoes.apaga=false;
i3GEO.editorOL.botoes.selecao=false;
i3GEO.editorOL.botoes.salva=false;
i3GEO.editorOL.botoes.propriedades=false;
i3GEO.editorOL.botoes.fecha=false;
i3GEO.editorOL.botoes.tools=false;
i3GEO.editorOL.botoes.undo=false;
i3GEO.editorOL.botoes.frente=false;
}
if(i3GEO.editorOL.mapa === "")
{alert("O objeto i3GEO.editorOL.mapa precisa ser criado com new OpenLayers.Map()");return;}
if(i3GEO.editorOL.maxext !== ""){
i3GEO.editorOL.mapa.setOptions({
maxExtent: i3GEO.editorOL.maxext
});
}
if(i3GEO.editorOL.numzoom !== ""){
i3GEO.editorOL.mapa.setOptions({
numZoomLevels: i3GEO.editorOL.numzoom
});
}
for(i=0;i Foram encontrada(s) "+n+" geometria(s) selecionada(s) Listar ";
ins += "Salvar ";
ins += "Exportar (shapefile)
"+combo;
ins += "
Item:
";
ins += "
Procurar por:
";
ins += "
Resultado:
";
try{
YAHOO.namespace("procura.container");
YAHOO.procura.container.panel = new YAHOO.widget.Panel("panelprocura", {zIndex:2000, iframe:false, width:"250px", visible:false, draggable:true, close:true } );
YAHOO.procura.container.panel.setHeader("Encontre no mapa");
YAHOO.procura.container.panel.setBody(ins);
YAHOO.procura.container.panel.setFooter("");
YAHOO.procura.container.panel.render(document.body);
YAHOO.procura.container.panel.center();
document.getElementById("i3GEOOLbotaoBusca").onclick = function(){
var layer = i3GEO.editorOL.layerAtivo(),
item = document.getElementById("i3GEOOLbuscaItem").value,
palavra = document.getElementById("i3GEOOLpalavraBusca").value;
if(item === "" || palavra === "")
{alert("Escolha o item e o texto de busca");return;}
i3GEO.editorOL.busca(layer,item,palavra,"i3GEOOLcomboresultado");
};
document.getElementById("i3GEOOLlistaTemasBusca").onchange = function(){
i3GEO.editorOL.ativaTema(this.value);
document.getElementById("i3GEOOLcomboitens").innerHTML = "...";
i3GEO.editorOL.listaItens(i3GEO.editorOL.layerAtivo(),"i3GEOOLcomboitens","i3GEOOLbuscaItem");
};
}
catch(e){}
},
criaComboTemas: function(){
var layers = i3GEO.editorOL.layersLigados(),
nlayers = layers.length,
i,
temp,
combo = "";
return combo;
},
atualizaJanelaAtivaTema: function(){
var combo = i3GEO.editorOL.criaComboTemas();
YAHOO.temaativo.container.panel.setBody(combo);
document.getElementById("i3GEOOLlistaTemasAtivos").onchange = function(){
if(botaoIdentifica){
botaoIdentifica.layers = [i3GEO.editorOL.layersLigados()[this.value]];
}
};
},
criaJanelaAtivaTema: function(){
var temp;
if(!document.getElementById("paneltemaativo")){
YAHOO.namespace("temaativo.container");
YAHOO.temaativo.container.panel = new YAHOO.widget.Panel("paneltemaativo", {zIndex:20000, iframe:true, width:"250px", visible:false, draggable:true, close:true } );
YAHOO.temaativo.container.panel.setBody("");
if(typeof i3GEO != undefined && i3GEO != "")
{YAHOO.temaativo.container.panel.setHeader("Tema ativo");}
else
{YAHOO.temaativo.container.panel.setHeader("Tema ativo");}
YAHOO.temaativo.container.panel.setFooter("");
YAHOO.temaativo.container.panel.render(document.body);
YAHOO.temaativo.container.panel.show();
YAHOO.temaativo.container.panel.center();
i3GEO.editorOL.atualizaJanelaAtivaTema();
YAHOO.util.Event.addListener(YAHOO.temaativo.container.panel.close, "click", function(){
i3GEOpanelEditor.deactivate();
i3GEOpanelEditor.activate();
if(i3GEO.eventos && i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search("i3GEO.editorOL.atualizaJanelaAtivaTema()") > 0)
{i3GEO.eventos.ATUALIZAARVORECAMADAS.remove("i3GEO.editorOL.atualizaJanelaAtivaTema()");}
});
if(typeof i3GEO != undefined && i3GEO != ""){
if(i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search("i3GEO.editorOL.atualizaJanelaAtivaTema()") < 0)
{i3GEO.eventos.ATUALIZAARVORECAMADAS.push("i3GEO.editorOL.atualizaJanelaAtivaTema()");}
}
temp = $i("paneltemaativo_minimizaCabecalho");
if(temp){
temp.onclick = function(){i3GEO.janela.minimiza("paneltemaativo");}
}
}
else{
YAHOO.temaativo.container.panel.show();
}
},
ativaTema: function(id){
document.getElementById("i3GEOOLlistaTemasAtivos").value = id;
},
layerAtivo: function(){
var id = document.getElementById("i3GEOOLlistaTemasAtivos");
if(id)
{id = id.value;}
else
{id = i3GEO.temaAtivo;}
return i3GEO.editorOL.layersLigados()[id];
},
listaItens: function(layer,idonde,idobj){
if(!layer){return;}
if(!layer.params){return;}
var u = layer.url+"&request=describefeaturetype&service=wfs&version=1.0.0";
u += "&typename="+layer.params.LAYERS;
document.body.style.cursor="wait";
document.getElementById("i3geoMapa").style.cursor = "wait";
OpenLayers.Request.issue({
method: "GET",
url: u,
callback: function(retorno){
document.body.style.cursor="default";
document.getElementById("i3geoMapa").style.cursor = "default";
var fromgml = new OpenLayers.Format.WFSDescribeFeatureType({
geometryName: "msGeometry"
}),
gml = fromgml.read(retorno.responseText),
prop = gml.featureTypes[0].properties,
nprop = prop.length,
itens = [],
i,
combo = "";
document.getElementById(idonde).innerHTML = combo;
},
failure: function(){
document.body.style.cursor="default";
document.getElementById("i3geoMapa").style.cursor = "default";
alert("Erro");
}
});
},
busca: function(layer,item,palavra,onde){
document.body.style.cursor="wait";
document.getElementById("i3geoMapa").style.cursor = "wait";
var u = layer.url+"&request=getfeature&service=wfs&version=1.0.0";
u += "&OUTPUTFORMAT=gml2&typename="+layer.params.LAYERS;
u += "&filter=
";
}
catch(e){}
}
//var w = window.open();
//w.document.write(ins);
//w.document.close();
var temp;
if(!document.getElementById("panellegendaeditorOL")){
YAHOO.namespace("legendaeditorOL.container");
YAHOO.legendaeditorOL.container.panel = new YAHOO.widget.Panel("panellegendaeditorOL", {zIndex:20000, iframe:true, width:"250px", visible:false, draggable:true, close:true } );
YAHOO.legendaeditorOL.container.panel.setBody(ins);
YAHOO.legendaeditorOL.container.panel.setHeader("Legenda");
YAHOO.legendaeditorOL.container.panel.setFooter("");
YAHOO.legendaeditorOL.container.panel.render(document.body);
YAHOO.legendaeditorOL.container.panel.show();
YAHOO.legendaeditorOL.container.panel.center();
YAHOO.util.Event.addListener(YAHOO.legendaeditorOL.container.panel.close, "click", function(){
//i3GEOpanelEditor.deactivate();
//i3GEOpanelEditor.activate();
});
}
else{
YAHOO.legendaeditorOL.container.panel.setBody(ins);
YAHOO.legendaeditorOL.container.panel.show();
}
},
captura: function(lonlat){
//if(i3GEO.editorOL.layergrafico !== ""){return;}
var filtro,
layers = [i3GEO.editorOL.layerAtivo()],
xy = lonlat.split(","),
u = layers[0].url+"&request=getfeature&service=wfs&version=1.1.0";
u += "&OUTPUTFORMAT=gml2&typename="+layers[0].params.LAYERS;
//u += "&filter=
"+geos[i].geometry+"
";
ins += "Atributos: "+i+"
";
var a = geos[i].attributes;
var keys = [];
for(key in a){
if(a[key]){
ins += key+" = "+a[key]+"
";
}
}
}
var w = window.open();
w.document.write(ins);
w.document.close();
},
testeSalvar: function(){
alert("Funcao nao disponivel. Defina o nome da funcao em i3GEO.editorOL.nomeFuncaoSalvar ");
},
criaBotoes: function(botoes){
var sketchSymbolizers = {
"Point": {
pointRadius: 4,
graphicName: "square",
fillColor: "white",
fillOpacity: 1,
strokeWidth: 1,
strokeOpacity: 1,
strokeColor: "#333333"
},
"Line": {
strokeWidth: 3,
strokeOpacity: 1,
strokeColor: "#666666",
strokeDashstyle: "dash"
},
"Polygon": {
strokeWidth: 2,
strokeOpacity: 1,
strokeColor: "#666666",
fillColor: "white",
fillOpacity: 0.3
}
},
style = new OpenLayers.Style(),
styleMap = new OpenLayers.StyleMap({"default": style}),
adiciona = false,
button,
controles = [];
style.addRules([
new OpenLayers.Rule({symbolizer: sketchSymbolizers})
]);
i3GEOpanelEditor = new OpenLayers.Control.Panel({
displayClass: "olControlEditingToolbar1 noprint",
saveState: false,
activateControl: function(c){
this.deactivate();
this.activate();
try{
i3GEO.editorOL.ModifyFeature.deactivate();
if(i3GEO && i3GEO.barraDeBotoes){
i3GEO.barraDeBotoes.ativaPadrao();
}
}
catch(e){}
if(!c.trigger)
{c.activate();}
else
{c.trigger.call();}
}
});
if(botoes.procura===true){
button = new OpenLayers.Control.Button({
displayClass: "editorOLprocura",
trigger: function(){YAHOO.procura.container.panel.show();},
title: "procura",
type: OpenLayers.Control.TYPE_BUTTON
});
controles.push(button);
adiciona = true;
}
if(botoes.pan===true){
controles.push(new OpenLayers.Control.Navigation({
title: "deslocar",
displayClass:"editorOLpan",
type: OpenLayers.Control.TYPE_TOOL
}));
adiciona = true;
}
if(botoes.zoombox===true){
controles.push(new OpenLayers.Control.ZoomBox({
title: "zoombox",
displayClass: "editorOLzoombox",
type: OpenLayers.Control.TYPE_TOOL
}));
adiciona = true;
}
if(botoes.zoomtot===true){
button = new OpenLayers.Control.Button({
displayClass: "editorOLzoomtot",
trigger: function(){i3GEO.editorOL.mapa.zoomToMaxExtent();},
title: "ajusta extensão",
type: OpenLayers.Control.TYPE_BUTTON
});
controles.push(button);
adiciona = true;
}
if(botoes.legenda===true){
button = new OpenLayers.Control.Button({
displayClass: "editorOLlegenda",
trigger: function(){i3GEO.editorOL.mostraLegenda();},
title: "legenda",
type: OpenLayers.Control.TYPE_BUTTON
});
controles.push(button);
adiciona = true;
}
if(botoes.distancia===true){
button = new OpenLayers.Control.Measure(
OpenLayers.Handler.Path,
{
handlerOptions: {layerOptions: {styleMap: styleMap}},
persist: true,
displayClass: "editorOLdistancia",
title: "distância",
type: OpenLayers.Control.TYPE_TOOL
}
);
button.events.on({
"measure": function(event){
var units = event.units,
measure = event.measure;
alert("Distância: " + measure.toFixed(3) + " " + units);
}
});
controles.push(button);
adiciona = true;
}
if(botoes.area===true){
button = new OpenLayers.Control.Measure(
OpenLayers.Handler.Polygon,
{
handlerOptions: {layerOptions: {styleMap: styleMap}},
persist: true,
displayClass: "editorOLarea",
title: "área",
type: OpenLayers.Control.TYPE_TOOL
}
);
button.events.on({
"measure": function(event){
var units = event.units;
var measure = event.measure;
alert("Área: " + measure.toFixed(3) + " " + units + " quadrados");
}
});
controles.push(button);
adiciona = true;
}
if(botoes.identifica===true){
botaoIdentifica = new OpenLayers.Control.WMSGetFeatureInfo({
maxFeatures:1,
infoFormat:'text/plain', //'application/vnd.ogc.gml',
layers: [i3GEO.editorOL.layerAtivo()],
queryVisible: true,
title: "identifica",
type: OpenLayers.Control.TYPE_TOOL,
displayClass: "editorOLidentifica",
eventListeners: {
getfeatureinfo: function(event) {
var lonlat = i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy),
lonlattexto = "
",
formata;
if( botoes.linha === true || botoes.ponto === true || botoes.poligono === true || botoes.edita === true){
lonlattexto += "captura
";
}
formata = function(texto){
var temp,
temp1,
n,
i,
f = [],
f1 = [],
textoN = texto.split(":");
try{
if(textoN.length > 1){
temp = textoN[2].replace(/\n\r/g, "");
temp = temp.replace(/'/g, "");
temp = temp.replace(/\n/g, "|");
temp = temp.replace(/_/g, " ");
temp = temp.replace(/=/g, ":");
temp = temp.split("|");
n = temp.length;
for(i=0;i
");
}
}
catch(e){}
return texto;
};
i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud(
"chicken",
i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy),
null,
lonlattexto+""+formata(event.text)+"
",
null,
true
));
},
beforegetfeatureinfo: function(event){
var ativo = [i3GEO.editorOL.layerAtivo()];
event.object.layers = ativo;
botaoIdentifica.layers = ativo;
botaoIdentifica.url = ativo[0].url;
},
activate: function(){
i3GEO.editorOL.criaJanelaAtivaTema();
}
}
});
//button.events.register("getfeatureinfo", this, showInfo);
controles.push(botaoIdentifica);
adiciona = true;
}
if(botoes.linha===true){
button = new OpenLayers.Control.DrawFeature(
i3GEO.editorOL.layergrafico,
OpenLayers.Handler.Path,
{
displayClass: "editorOLlinha",
title: "digitalizar linha",
type: OpenLayers.Control.TYPE_TOOL,
callbacks:{
done: function(feature){
var f = new OpenLayers.Feature.Vector(feature);
f["attributes"] = {
opacidade: i3GEO.editorOL.simbologia.opacidade,
texto: i3GEO.editorOL.simbologia.texto,
fillColor: i3GEO.editorOL.simbologia.fillColor,
strokeWidth: i3GEO.editorOL.simbologia.strokeWidth,
strokeColor: i3GEO.editorOL.simbologia.strokeColor,
pointRadius: i3GEO.editorOL.simbologia.pointRadius,
graphicName: i3GEO.editorOL.simbologia.graphicName
};
i3GEO.editorOL.layergrafico.addFeatures([f]);
if(document.getElementById("panellistagEditor"))
{i3GEO.editorOL.listaGeometrias();}
}
}
}
);
controles.push(button);
adiciona = true;
}
if(botoes.ponto===true){
button = new OpenLayers.Control.DrawFeature(
i3GEO.editorOL.layergrafico,
OpenLayers.Handler.Point,
{
displayClass: "editorOLponto",
title: "digitalizar ponto",
type: OpenLayers.Control.TYPE_TOOL,
callbacks:{
done: function(feature){
var f = new OpenLayers.Feature.Vector(feature);
f["attributes"] = {
opacidade: i3GEO.editorOL.simbologia.opacidade,
texto: i3GEO.editorOL.simbologia.texto,
fillColor: i3GEO.editorOL.simbologia.fillColor,
strokeWidth: i3GEO.editorOL.simbologia.strokeWidth,
strokeColor: i3GEO.editorOL.simbologia.strokeColor,
pointRadius: i3GEO.editorOL.simbologia.pointRadius,
graphicName: i3GEO.editorOL.simbologia.graphicName
};
i3GEO.editorOL.layergrafico.addFeatures([f]);
if(document.getElementById("panellistagEditor"))
{i3GEO.editorOL.listaGeometrias();}
}
}
}
);
controles.push(button);
adiciona = true;
}
if(botoes.poligono===true){
button = new OpenLayers.Control.DrawFeature(
i3GEO.editorOL.layergrafico,
OpenLayers.Handler.Polygon,
{
displayClass: "editorOLpoligono",
title: "digitalizar polígono",
type: OpenLayers.Control.TYPE_TOOL,
//handlerOptions: {holeModifier: "altKey"},
callbacks:{
done: function(feature){
var f = new OpenLayers.Feature.Vector(feature);
f["attributes"] = {
opacidade: i3GEO.editorOL.simbologia.opacidade,
texto: i3GEO.editorOL.simbologia.texto,
fillColor: i3GEO.editorOL.simbologia.fillColor,
strokeWidth: i3GEO.editorOL.simbologia.strokeWidth,
strokeColor: i3GEO.editorOL.simbologia.strokeColor,
pointRadius: i3GEO.editorOL.simbologia.pointRadius,
graphicName: i3GEO.editorOL.simbologia.graphicName
};
i3GEO.editorOL.layergrafico.addFeatures([f]);
if(document.getElementById("panellistagEditor"))
{i3GEO.editorOL.listaGeometrias();}
}
}
}
);
controles.push(button);
adiciona = true;
}
if(botoes.texto===true){
button = new OpenLayers.Control.DrawFeature(
i3GEO.editorOL.layergrafico,
OpenLayers.Handler.Point,
{
displayClass: "editorOLtexto",
title: "incluir texto",
type: OpenLayers.Control.TYPE_TOOL,
persist: true,
callbacks:{
done: function(feature){
var texto = window.prompt("Texto",""),
label = new OpenLayers.Feature.Vector(feature);
label["attributes"] = {
opacidade: 0.1,
fillColor: "white",
strokeWidth: i3GEO.editorOL.simbologia.strokeWidth,
texto: texto,
pointRadius: 2,
graphicName: "square",
strokeColor: "black",
fontColor: i3GEO.editorOL.simbologia.fontColor,
fontSize: i3GEO.editorOL.simbologia.fontSize,
fontFamily: "Arial",
fontWeight: "bold",
labelAlign: "rt"
};
if(texto && texto !== "")
{i3GEO.editorOL.layergrafico.addFeatures([label]);}
}
}
}
);
controles.push(button);
adiciona = true;
}
if(botoes.edita===true && botoes.corta===true && i3GEO.php){
i3GEO.editorOL.CortaFeature = new OpenLayers.Control.DrawFeature(
i3GEO.editorOL.layergrafico,
OpenLayers.Handler.Polygon,
{
displayClass: "editorOLcorta",
title: "corta figura",
type: OpenLayers.Control.TYPE_TOOL,
clickout: true,
toggle: true,
trigger: function(){
if(i3GEO.editorOL.layergrafico.selectedFeatures.length != 1){
alert("Selecione primeiro um elemento para ser cortado");
i3GEO.editorOL.CortaFeature.deactivate();
}
else{
i3GEO.editorOL.CortaFeature.activate();
}
},
callbacks:{
done: function(feature){
var temp,
sel = i3GEO.editorOL.layergrafico.selectedFeatures[0].geometry,
corta = feature;
temp = function(retorno){
i3GEO.janela.fechaAguarde("i3GEO.cortador");
if(retorno != "" && retorno.data && retorno.data != "")
{i3GEO.editorOL.substituiFeaturesSel(retorno.data);}
};
i3GEO.janela.abreAguarde("i3GEO.cortador","Cortando");
i3GEO.php.funcoesGeometriasWkt(temp,sel+"|"+corta,"difference");
}
}
}
);
controles.push(i3GEO.editorOL.CortaFeature);
adiciona = true;
}
if(botoes.edita===true){
i3GEO.editorOL.ModifyFeature = new OpenLayers.Control.ModifyFeature(
i3GEO.editorOL.layergrafico,
{
displayClass: "editorOLedita",
title: "modifica figura",
type: OpenLayers.Control.TYPE_TOOL,
clickout: true,
toggle: true,
mode: OpenLayers.Control.ModifyFeature.RESHAPE
}
);
controles.push(i3GEO.editorOL.ModifyFeature);
adiciona = true;
}
if(botoes.edita===true && botoes.listag===true){
button = new OpenLayers.Control.Button({
displayClass: "editorOLlistag",
trigger: function(){
i3GEO.editorOL.listaGeometrias();
},
title: "lista geometrias",
type: OpenLayers.Control.TYPE_BUTTON
});
controles.push(button);
adiciona = true;
}
if(botoes.frente===true){
button = new OpenLayers.Control.Button({
displayClass: "editorOLfrente",
trigger: function(){
i3GEO.editorOL.trazParaFrente();
if(document.getElementById("panellistagEditor"))
{i3GEO.editorOL.listaGeometrias();}
},
title: "traz para frente",
type: OpenLayers.Control.TYPE_BUTTON
});
controles.push(button);
adiciona = true;
}
if(botoes.tools===true && i3GEO.php){
button = new OpenLayers.Control.Button({
displayClass: "editorOLtools",
trigger: function(){
//fora do i3geo, usa o jsts
if(i3GEO.php)
{i3GEO.editorOL.ferramentas();}
else
{i3GEO.editorOL.carregajts("i3GEO.editorOL.ferramentas()");}
},
title: "ferramentas",
type: OpenLayers.Control.TYPE_BUTTON
});
controles.push(button);
adiciona = true;
}
//botao de seleção
if(botoes.selecao===true){
i3GEO.editorOL.selbutton = new OpenLayers.Control.SelectFeature(
i3GEO.editorOL.layergrafico,
{
displayClass: "editorOLselecao",
title: "seleciona elemento",
type: OpenLayers.Control.TYPE_TOOL,
clickout: true,
toggle: true,
multiple: false,
hover: false,
toggleKey: "ctrlKey", // ctrl key removes from selection
multipleKey: "shiftKey", // shift key adds to selection
box: false
}
);
controles.push(i3GEO.editorOL.selbutton);
adiciona = true;
}
if(botoes.apaga===true){
button = new OpenLayers.Control.Button({
displayClass: "editorOLapaga",
trigger: function(){
if(i3GEO.editorOL.layergrafico.selectedFeatures.length > 0){
var x = window.confirm("Exclui os elementos selecionados?");
if(x){
i3GEO.editorOL.guardaBackup();
i3GEO.editorOL.layergrafico.removeFeatures(i3GEO.editorOL.layergrafico.selectedFeatures);
if(document.getElementById("panellistagEditor"))
{i3GEO.editorOL.listaGeometrias();}
}
}
else
{alert("Selecione pelo menos um elemento");}
},
title: "apaga selecionados",
type: OpenLayers.Control.TYPE_BUTTON
});
controles.push(button);
adiciona = true;
}
//não disponível ainda
/*
if(botoes.undo===true){
button = new OpenLayers.Control.Button({
displayClass: "editorOLundo",
trigger: function(){i3GEO.editorOL.restauraBackup();},
title: "recupera"
});
controles.push(button);
adiciona = true;
}
*/
if(botoes.propriedades===true){
button = new OpenLayers.Control.Button({
displayClass: "editorOLpropriedades",
trigger: function(){i3GEO.editorOL.propriedades();},
title: "propriedades",
type: OpenLayers.Control.TYPE_BUTTON
});
controles.push(button);
adiciona = true;
}
if(botoes.salva===true){
button = new OpenLayers.Control.Button({
displayClass: "editorOLsalva",
trigger: function(){i3GEO.editorOL.salvaGeometrias();},
title: "salva",
type: OpenLayers.Control.TYPE_BUTTON
});
controles.push(button);
adiciona = true;
}
if(botoes.ajuda===true){
button = new OpenLayers.Control.Button({
displayClass: "editorOLajuda",
trigger: function(){
try
{window.open(i3GEO.configura.locaplic+"/mashups/openlayers_ajuda.php");}
catch(e)
{window.open("openlayers_ajuda.php");}
},
title: "ajuda",
type: OpenLayers.Control.TYPE_BUTTON
});
controles.push(button);
adiciona = true;
}
if(botoes.fecha===true){
button = new OpenLayers.Control.Button({
displayClass: "editorOLfecha",
trigger: function(){
var temp = window.confirm("Remove a edição?");
i3GEOpanelEditor.destroy();
try{YAHOO.temaativo.container.panel.destroy();}catch(e){}
try{YAHOO.procura.container.panel.destroy();}catch(e){}
try{YAHOO.editorOL.container.panel.destroy();}catch(e){}
try{YAHOO.editorOL.listaGeometrias.panel.destroy();}catch(e){}
//try{YAHOO.panelpropriedadesEditor.panel.destroy();}catch(e){}
//try{YAHOO.editorOL.panellistagEditor.panel.destroy();}catch(e){}
try{YAHOO.editorOL.ferramentas.panel.destroy();}catch(e){}
//try{YAHOO.panelprocura.panel.destroy();}catch(e){}
try{YAHOO.legendaeditorOL.container.panel.destroy();}catch(e){}
try{YAHOO.salvaGeometrias.container.panel.destroy();}catch(e){}
if(temp === true){
try{
if(i3GEO.editorOL.layergrafico){
i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.layergrafico);
delete(i3GEO.editorOL.layergrafico);
}
if(i3GEO.editorOL.backup){
i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.backup);
delete(i3GEO.editorOL.backup);
}
}
catch(e){}
}
},
title: "fecha editor",
type: OpenLayers.Control.TYPE_BUTTON
});
controles.push(button);
adiciona = true;
}
//
//controle que permite o snap
//
i3GEOOLsnap = new OpenLayers.Control.Snapping({
layer: i3GEO.editorOL.layergrafico
});
i3GEOOLsplit = new OpenLayers.Control.Split({
layer: i3GEO.editorOL.layergrafico,
source: i3GEO.editorOL.layergrafico,
tolerance: 0.0001,
eventListeners: {
beforesplit: function(event){i3GEO.editorOL.guardaBackup();},
aftersplit: function(event) {
i3GEO.editorOL.flashFeatures(event.features);
if(document.getElementById("panellistagEditor"))
{i3GEO.editorOL.listaGeometrias();}
}
}
});
//
//adiciona o painel ao mapa se alguma op��o foi inserida
//
if(adiciona === true){
i3GEOpanelEditor.addControls(controles);
i3GEO.editorOL.mapa.addControl(i3GEOpanelEditor);
}
},
mudaSimbolo: function(estilo,id){
var valor = $i(id).value;
if(valor === "")
{return;}
if(estilo === "strokeWidth")
{i3GEO.editorOL.simbologia.strokeWidth = valor;return;}
if(estilo === "opacidade")
{i3GEO.editorOL.simbologia.opacidade = valor;return;}
i3GEO.editorOL.simbologia[estilo] = valor;
},
adicionaMarcas: function(){
if(i3GEO.editorOL.pontos.length === 0)
{return;}
var SHADOW_Z_INDEX = 10,
MARKER_Z_INDEX = 11,
DIAMETER = 200,
layer = new OpenLayers.Layer.Vector(
"pontos",
{
styleMap: new OpenLayers.StyleMap({
externalGraphic: i3GEO.editorOL.marca,
backgroundGraphic: "../pacotes/openlayers/img/marker_shadow.png",
backgroundXOffset: 0,
backgroundYOffset: -7,
graphicZIndex: MARKER_Z_INDEX,
backgroundGraphicZIndex: SHADOW_Z_INDEX,
pointRadius: 10
}),
isBaseLayer: false,
rendererOptions: {yOrdering: true},
displayInLayerSwitcher:true,
visibility:true
}
),
index,
x = [],
y = [],
pixel,
lonlat,
features = [];
for (index = 0; index < i3GEO.editorOL.pontos.length; index = index + 2){
x.push(i3GEO.editorOL.pontos[index]);
y.push(i3GEO.editorOL.pontos[index+1]);
}
for (index = 0; index < x.length; index++) {
features.push(
new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Point(x[index], y[index])
)
);
}
layer.addFeatures(features);
i3GEO.editorOL.mapa.addLayer(layer);
},
adicionaKml: function(){
var temp,n,i,id,url;
n = i3GEO.editorOL.kml.length;
for(i=0;i
Cor do contorno | '; if(i3GEO.configura) {ins += '';} ins += "" + ' | ' + '|
Cor do preenchimento | '; if(i3GEO.configura) {ins += '';} ins += "" + ' | ' + '|
Cor da fonte | '; if(i3GEO.configura) {ins += '';} ins += "" + ' | ' + '|
Tamanho da fonte | ' + ' | |
Opacidade (de 0 a 1) | ' + ' | |
Largura da linha/contorno | ' + ' |
Ajusta nó em edição para o(a):
' + 'nó | vértice | borda | ' + '|||
' + ' | ' + ' | ' + ' |
Divide intersecção ao digitalizar
' + 'borda | ' + '
Operação ativada pelo botão de modificação da figura
' + 'altera figura | ' + 'altera tamanho | ' + '||
rotaciona | ' + 'desloca | ' + '
Geometrias | Opções | ||
"+g.CLASS_NAME+" | seleciona | limpa | brilha |
Operações sobre as figuras selecionadas:
' + ''+ '