";
+ return caixa;
},
- "verde" : {
- fillcolor : '#3CCC2F',
- linecolor : '#0C6642',
- linewidth : '1',
- circcolor : '#C7D9D2',
- textcolor : '#787A78'
- }
- },
- // @TODO remover apos refatorar codigo
- estilosOld : {
- "normal" : {
- fillcolor : 'red',
- linecolor : 'black',
- linewidth : '1',
- circcolor : 'white',
- textcolor : 'gray'
+ /**
+ * Function: addBox
+ *
+ * Adiciona um retangulo
+ *
+ * Parameter:
+ *
+ * {numeric} - novo xmin
+ *
+ * {numeric} - novo ymin
+ *
+ * {numeric} - novo xmax
+ *
+ * {numeric} - novo ymax
+ *
+ * {string} - namespace que identifica o elemento grafico, permitindo busca
+ *
+ * {string} - cor do contorno
+ *
+ * {string} - expessura do contorno
+ */
+ addBox : function(xmin, ymin, xmax, ymax, namespace, strokeColor, strokeWidth) {
+ if (i3GEO.Interface.ATUAL != "googleearth") {
+ return i3GEO.desenho[i3GEO.Interface.ATUAL].addBox(xmin, ymin, xmax, ymax, namespace, strokeColor, strokeWidth);
+ } else {
+ return false;
+ }
},
- "palido" : {
- fillcolor : 'gray',
- linecolor : 'gray',
- linewidth : '1',
- circcolor : 'gray',
- textcolor : 'gray'
+ /**
+ * Function: moveBox
+ *
+ * Reposiciona um retangulo
+ *
+ * Parameter:
+ *
+ * {object} - box
+ *
+ * {numeric} - novo xmin
+ *
+ * {numeric} - novo ymin
+ *
+ * {numeric} - novo xmax
+ *
+ * {numeric} - novo ymax
+ */
+ moveBox : function(box, xmin, ymin, xmax, ymax) {
+ if (i3GEO.Interface.ATUAL != "googleearth") {
+ return i3GEO.desenho[i3GEO.Interface.ATUAL].moveBox(box, xmin, ymin, xmax, ymax);
+ } else {
+ return false;
+ }
},
- "vermelho" : {
- fillcolor : 'gray',
- linecolor : 'red',
- linewidth : '1',
- circcolor : 'pink',
- textcolor : 'brown'
+ /**
+ * Function: removeBox
+ *
+ * Remove box do mapa (apenas alias para removePins)
+ *
+ * Parameter:
+ *
+ * {string} - namespace que identifica o grupo de marcas que serao removidas
+ */
+ removeBox : function(namespace) {
+ i3GEO.desenho.removePins(namespace);
},
- "verde" : {
- fillcolor : 'gray',
- linecolor : 'green',
- linewidth : '1',
- circcolor : 'DarkGreen',
- textcolor : 'GreenYellow'
- }
- },
- /**
- * Propriedade: estiloPadrao
- *
- * Estilo utilizado como padrão
- */
- estiloPadrao : "normal",
- /**
- * Cria uma caixa de seleção para escolha do estilo a ser
- * utilizado
- */
- caixaEstilos : function() {
- var lista = i3GEO.util.listaChaves(i3GEO.desenho.estilos), n = lista.length, i, caixa, sel;
- caixa = "
";
- return caixa;
- },
- /**
- * Function: addBox
- *
- * Adiciona um retangulo
- *
- * Parameter:
- *
- * {numeric} - novo xmin
- *
- * {numeric} - novo ymin
- *
- * {numeric} - novo xmax
- *
- * {numeric} - novo ymax
- *
- * {string} - namespace que identifica o elemento grafico, permitindo busca
- *
- * {string} - cor do contorno
- *
- * {string} - expessura do contorno
- */
- addBox : function(xmin, ymin, xmax, ymax, namespace, strokeColor, strokeWidth) {
- if (i3GEO.Interface.ATUAL != "googleearth") {
- return i3GEO.desenho[i3GEO.Interface.ATUAL].addBox(
- xmin,
- ymin,
- xmax,
- ymax,
- namespace,
- strokeColor,
- strokeWidth);
- } else {
- return false;
- }
- },
- /**
- * Function: moveBox
- *
- * Reposiciona um retangulo
- *
- * Parameter:
- *
- * {object} - box
- *
- * {numeric} - novo xmin
- *
- * {numeric} - novo ymin
- *
- * {numeric} - novo xmax
- *
- * {numeric} - novo ymax
- */
- moveBox : function(box, xmin, ymin, xmax, ymax) {
- if (i3GEO.Interface.ATUAL != "googleearth") {
- return i3GEO.desenho[i3GEO.Interface.ATUAL].moveBox(
- box,
- xmin,
- ymin,
- xmax,
- ymax);
- } else {
- return false;
- }
- },
- /**
- * Function: removeBox
- *
- * Remove box do mapa (apenas alias para removePins)
- *
- * Parameter:
- *
- * {string} - namespace que identifica o grupo de marcas que serao removidas
- */
- removeBox : function(namespace) {
- i3GEO.desenho.removePins(namespace);
- },
- /**
- * Function: addPin
- *
- * Adiciona uma marca no mapa em uma determinada coordenada
- *
- * Parameters:
- *
- * {numeric} - longitude
- *
- * {numeric} - latitude
- *
- * {numeric} - largura da imagem
- *
- * {numeric} - altura da imagem
- *
- * {string} - namespace utilizado para agrupar a marca, permitindo sua
- * remocao
- *
- * {boolean} - posiciona a marca no centro do ponto
- *
- * {function} - função disparada no evento onclick
- *
- * Return:
- *
- * {objeto}
- *
- */
- addPin : function(x, y, w, h, imagem, namespace, centro, funcaoclick) {
- if (i3GEO.Interface.ATUAL != "googleearth") {
- return i3GEO.desenho[i3GEO.Interface.ATUAL].addPin(
- x,
- y,
- w,
- h,
- imagem,
- namespace,
- centro);
- } else {
- return false;
- }
- },
- /**
- * Function: removePins
- *
- * Remove marcas do mapa
- *
- * Parameter:
- *
- * {string} - namespace que identifica o grupo de marcas que serao removidas
- */
- removePins : function(namespace) {
- if (i3GEO.Interface.ATUAL != "googleearth") {
- i3GEO.desenho[i3GEO.Interface.ATUAL].removePins(namespace);
- }
- },
- /**
- * Function: movePin
- *
- * Reposiciona uma marca
- *
- * Parameter:
- *
- * {object} - marca
- *
- * {numeric} - novo x
- *
- * {numeric} - novo y
- */
- movePin : function(pin, x, y) {
- if (i3GEO.Interface.ATUAL != "googleearth") {
- i3GEO.desenho[i3GEO.Interface.ATUAL].movePin(
- pin,
- x,
- y);
- }
- },
- /**
- * Section: i3GEO.desenho.openlayers
- *
- * Funções utilizadas quando o mapa baseia-se na interface
- * OpenLayers
- */
- openlayers : {
/**
- * Function: inicia
- *
- * Cria o layer onde os desenhos serao inseridos
+ * Function: addPin
+ *
+ * Adiciona uma marca no mapa em uma determinada coordenada
+ *
+ * Parameters:
+ *
+ * {numeric} - longitude
+ *
+ * {numeric} - latitude
+ *
+ * {numeric} - largura da imagem
+ *
+ * {numeric} - altura da imagem
+ *
+ * {string} - namespace utilizado para agrupar a marca, permitindo sua remocao
+ *
+ * {boolean} - posiciona a marca no centro do ponto
+ *
+ * {function} - função disparada no evento onclick
+ *
+ * Return:
+ *
+ * {objeto}
+ *
*/
- inicia : function() {
- if (!i3GEO.desenho.layergrafico) {
- i3GEO.desenho.openlayers.criaLayerGrafico();
+ addPin : function(x, y, w, h, imagem, namespace, centro, funcaoclick) {
+ if (i3GEO.Interface.ATUAL != "googleearth") {
+ return i3GEO.desenho[i3GEO.Interface.ATUAL].addPin(x, y, w, h, imagem, namespace, centro);
+ } else {
+ return false;
}
},
- addBox : function(xmin, ymin, xmax, ymax, namespace, strokeColor, strokeWidth) {
- var bounds, f;
- if (!namespace) {
- namespace = "box";
- }
- if (!strokeColor) {
- strokeColor = "#FF0000";
+ /**
+ * Function: removePins
+ *
+ * Remove marcas do mapa
+ *
+ * Parameter:
+ *
+ * {string} - namespace que identifica o grupo de marcas que serao removidas
+ */
+ removePins : function(namespace) {
+ if (i3GEO.Interface.ATUAL != "googleearth") {
+ i3GEO.desenho[i3GEO.Interface.ATUAL].removePins(namespace);
}
- if (!strokeWidth) {
- strokeWidth = 2;
+ },
+ /**
+ * Function: movePin
+ *
+ * Reposiciona uma marca
+ *
+ * Parameter:
+ *
+ * {object} - marca
+ *
+ * {numeric} - novo x
+ *
+ * {numeric} - novo y
+ */
+ movePin : function(pin, x, y) {
+ if (i3GEO.Interface.ATUAL != "googleearth") {
+ i3GEO.desenho[i3GEO.Interface.ATUAL].movePin(pin, x, y);
}
- i3GEO.desenho.openlayers.inicia();
- bounds = OpenLayers.Bounds.fromArray([
- xmin,
- ymin,
- xmax,
- ymax
- ]);
- bounds = bounds.toGeometry();
- bounds = i3GEO.util.extGeo2OSM(bounds);
- f = new OpenLayers.Feature.Vector(
- bounds, {
+ },
+ /**
+ * Section: i3GEO.desenho.openlayers
+ *
+ * Funções utilizadas quando o mapa baseia-se na interface OpenLayers
+ */
+ openlayers : {
+ /**
+ * Function: inicia
+ *
+ * Cria o layer onde os desenhos serao inseridos
+ */
+ inicia : function() {
+ if (!i3GEO.desenho.layergrafico) {
+ i3GEO.desenho.openlayers.criaLayerGrafico();
+ }
+ },
+ addBox : function(xmin, ymin, xmax, ymax, namespace, strokeColor, strokeWidth) {
+ var bounds, f;
+ if (!namespace) {
+ namespace = "box";
+ }
+ if (!strokeColor) {
+ strokeColor = "#FF0000";
+ }
+ if (!strokeWidth) {
+ strokeWidth = 2;
+ }
+ i3GEO.desenho.openlayers.inicia();
+ bounds = OpenLayers.Bounds.fromArray([
+ xmin, ymin, xmax, ymax
+ ]);
+ bounds = bounds.toGeometry();
+ bounds = i3GEO.util.extGeo2OSM(bounds);
+ f = new OpenLayers.Feature.Vector(bounds, {
origem : namespace
}, {
fill : false,
strokeColor : strokeColor,
strokeWidth : strokeWidth
});
- i3GEO.desenho.layergrafico.addFeatures([
- f
- ]);
- return f;
- },
- moveBox : function(box, xmin, ymin, xmax, ymax) {
- i3GEO.desenho.layergrafico.removeFeatures(box);
- var namespace = box["attributes"].origem, strokeWidth = box["style"].strokeWidth, strokeColor = box["style"].strokeColor;
- box = i3GEO.desenho.addBox(
- xmin,
- ymin,
- xmax,
- ymax,
- namespace,
- strokeColor,
- strokeWidth);
- return box;
- },
- addPin : function(x, y, w, h, imagem, namespace, centro, funcaoclick) {
- return;
- if (!imagem
- || imagem === "") {
- imagem = i3GEO.configura.locaplic
- + "/imagens/google/confluence.png";
- }
- if (!namespace) {
- namespace = "pin";
- }
- if (!w
- || w === "") {
- w = 27;
- }
- if (!h
- || h === "") {
- h = 27;
- }
- if (!funcaoclick) {
- funcaoclick = function() {
- i3GEO.desenho.openlayers.removePins(namespace);
- };
- }
- if (!centro) {
- centro = false;
- }
- i3GEO.desenho.openlayers.inicia();
- var point, f, ox, oy;
- if (centro === true) {
- ox = parseInt(
- w / 2,
- 10)
- * -1;
- oy = parseInt(
- h / 2,
- 10)
- * -1;
- } else {
- ox = parseInt(
- w / 2,
- 10)
- * -1;
- oy = h
- * -1;
- }
- point = new OpenLayers.Geometry.Point(
- x, y);
- point = i3GEO.util.extGeo2OSM(point);
- f = new OpenLayers.Feature.Vector(
- point, {
+ i3GEO.desenho.layergrafico.addFeatures([
+ f
+ ]);
+ return f;
+ },
+ moveBox : function(box, xmin, ymin, xmax, ymax) {
+ i3GEO.desenho.layergrafico.removeFeatures(box);
+ var namespace = box["attributes"].origem, strokeWidth = box["style"].strokeWidth, strokeColor = box["style"].strokeColor;
+ box = i3GEO.desenho.addBox(xmin, ymin, xmax, ymax, namespace, strokeColor, strokeWidth);
+ return box;
+ },
+ addPin : function(x, y, w, h, imagem, namespace, centro, funcaoclick) {
+ return;
+ if (!imagem || imagem === "") {
+ imagem = i3GEO.configura.locaplic + "/imagens/google/confluence.png";
+ }
+ if (!namespace) {
+ namespace = "pin";
+ }
+ if (!w || w === "") {
+ w = 27;
+ }
+ if (!h || h === "") {
+ h = 27;
+ }
+ if (!funcaoclick) {
+ funcaoclick = function() {
+ i3GEO.desenho.openlayers.removePins(namespace);
+ };
+ }
+ if (!centro) {
+ centro = false;
+ }
+ i3GEO.desenho.openlayers.inicia();
+ var point, f, ox, oy;
+ if (centro === true) {
+ ox = parseInt(w / 2, 10) * -1;
+ oy = parseInt(h / 2, 10) * -1;
+ } else {
+ ox = parseInt(w / 2, 10) * -1;
+ oy = h * -1;
+ }
+ point = new OpenLayers.Geometry.Point(x, y);
+ point = i3GEO.util.extGeo2OSM(point);
+ f = new OpenLayers.Feature.Vector(point, {
origem : namespace,
click : funcaoclick
}, {
@@ -431,70 +368,85 @@ i3GEO.desenho = {
graphicYOffset : oy,
externalGraphic : imagem
});
- i3GEO.desenho.layergrafico.addFeatures([
- f
- ]);
- return f;
- },
- removePins : function(namespace) {
- return;
- if (!namespace) {
- namespace = "pin";
- }
- if (i3GEO.desenho.layergrafico) {
- var f = i3GEO.desenho.layergrafico.getFeaturesByAttribute(
- "origem",
- namespace);
- if (f
- && f.length > 0) {
- i3GEO.desenho.layergrafico.destroyFeatures(f);
+ i3GEO.desenho.layergrafico.addFeatures([
+ f
+ ]);
+ return f;
+ },
+ removePins : function(namespace) {
+ return;
+ if (!namespace) {
+ namespace = "pin";
}
- }
- },
- movePin : function(pin, x, y) {
- return;
- var point = new OpenLayers.LonLat(
- x, y);
- point = i3GEO.util.extGeo2OSM(point);
- pin.move(point);
- },
- criaLayerGrafico : function() {
- return;
- if (!i3GEO.desenho.layergrafico) {
- var sketchSymbolizers = {
- "Point" : {
- fillColor : "rgb(${fillColor})",
- fillOpacity : "${opacidade}",
- strokeWidth : "${strokeWidth}",
- strokeOpacity : "${opacidade}",
- strokeColor : "rgb(${strokeColor})",
- label : "${texto}",
- pointRadius : "${pointRadius}",
- graphicName : "${graphicName}",
- fontSize : "${fontSize}",
- fontColor : "rgb(${fontColor})",
- fontFamily : "Arial",
- fontWeight : "normal",
- labelAlign : "lb",
- labelXOffset : "3",
- labelYOffset : "3",
- externalGraphic : "${externalGraphic}"
- },
- "Line" : {
- strokeWidth : "${strokeWidth}",
- strokeOpacity : "${opacidade}",
- strokeColor : "rgb(${strokeColor})"
- },
- "Polygon" : {
- strokeWidth : "${strokeWidth}",
- strokeOpacity : "${opacidade}",
- strokeColor : "rgb(${strokeColor})",
- fillColor : "rgb(${fillColor})",
- fillOpacity : "${opacidade}",
- zIndex : 5000
+ if (i3GEO.desenho.layergrafico) {
+ var f = i3GEO.desenho.layergrafico.getFeaturesByAttribute("origem", namespace);
+ if (f && f.length > 0) {
+ i3GEO.desenho.layergrafico.destroyFeatures(f);
}
- }, style = new OpenLayers.Style(), styleMap1 = new OpenLayers.StyleMap(
- {
+ }
+ },
+ movePin : function(pin, x, y) {
+ return;
+ var point = new OpenLayers.LonLat(x, y);
+ point = i3GEO.util.extGeo2OSM(point);
+ pin.move(point);
+ },
+ criaLayerGrafico : function() {
+ if (!i3GEO.desenho.layergrafico) {
+ i3GEO.desenho.layergrafico = new ol.FeatureOverlay({
+ style : new ol.style.Style({
+ fill : new ol.style.Fill({
+ color : 'rgba(255, 255, 255, 0.2)'
+ }),
+ stroke : new ol.style.Stroke({
+ color : '#ffcc33',
+ width : 2
+ }),
+ image : new ol.style.Circle({
+ radius : 7,
+ fill : new ol.style.Fill({
+ color : '#ffcc33'
+ })
+ })
+ })
+ });
+ i3GEO.desenho.layergrafico.setMap(i3geoOL);
+ }
+ return;
+ if (!i3GEO.desenho.layergrafico) {
+ var sketchSymbolizers = {
+ "Point" : {
+ fillColor : "rgb(${fillColor})",
+ fillOpacity : "${opacidade}",
+ strokeWidth : "${strokeWidth}",
+ strokeOpacity : "${opacidade}",
+ strokeColor : "rgb(${strokeColor})",
+ label : "${texto}",
+ pointRadius : "${pointRadius}",
+ graphicName : "${graphicName}",
+ fontSize : "${fontSize}",
+ fontColor : "rgb(${fontColor})",
+ fontFamily : "Arial",
+ fontWeight : "normal",
+ labelAlign : "lb",
+ labelXOffset : "3",
+ labelYOffset : "3",
+ externalGraphic : "${externalGraphic}"
+ },
+ "Line" : {
+ strokeWidth : "${strokeWidth}",
+ strokeOpacity : "${opacidade}",
+ strokeColor : "rgb(${strokeColor})"
+ },
+ "Polygon" : {
+ strokeWidth : "${strokeWidth}",
+ strokeOpacity : "${opacidade}",
+ strokeColor : "rgb(${strokeColor})",
+ fillColor : "rgb(${fillColor})",
+ fillOpacity : "${opacidade}",
+ zIndex : 5000
+ }
+ }, style = new OpenLayers.Style(), styleMap1 = new OpenLayers.StyleMap({
"default" : style,
"vertex" : {
strokeOpacity : 1,
@@ -506,14 +458,12 @@ i3GEO.desenho = {
}, {
extendDefault : false
});
- style.addRules([
- new OpenLayers.Rule(
- {
+ style.addRules([
+ new OpenLayers.Rule({
symbolizer : sketchSymbolizers
})
- ]);
- i3GEO.desenho.layergrafico = new OpenLayers.Layer.Vector(
- "Graf", {
+ ]);
+ i3GEO.desenho.layergrafico = new OpenLayers.Layer.Vector("Graf", {
styleMap : styleMap1,
displayInLayerSwitcher : true,
visibility : true,
@@ -529,292 +479,238 @@ i3GEO.desenho = {
}
}
});
- // para efeitos de compatibilidade
- if (i3GEO.editorOL
- && i3GEO.editorOL.mapa) {
- i3GEO.editorOL.mapa.addLayers([
- i3GEO.desenho.layergrafico
- ]);
- } else {
- i3geoOL.addLayers([
- i3GEO.desenho.layergrafico
- ]);
+ // para efeitos de compatibilidade
+ if (i3GEO.editorOL && i3GEO.editorOL.mapa) {
+ i3GEO.editorOL.mapa.addLayers([
+ i3GEO.desenho.layergrafico
+ ]);
+ } else {
+ i3geoOL.addLayers([
+ i3GEO.desenho.layergrafico
+ ]);
+ }
}
}
- }
- },
- /**
- * Section: i3GEO.desenho.googlemaps
- *
- * Funções utilizadas quando o mapa baseia-se na interface
- * GoogleMaps
- */
- googlemaps : {
+ },
/**
- * Variavel: shapes
- *
- * Array que guarda todos os objetos que estao atualmente no mapa E
- * atualizado toda vez que uma figura e acrescentada ou removida
+ * Section: i3GEO.desenho.googlemaps
+ *
+ * Funções utilizadas quando o mapa baseia-se na interface GoogleMaps
*/
- shapes : [],
- inicia : function() {
- },
- addBox : function(xmin, ymin, xmax, ymax, namespace, strokeColor, strokeWidth) {
- var f;
- if (!namespace) {
- namespace = "box";
- }
- if (!strokeColor) {
- strokeColor = "#FF0000";
- }
- if (!strokeWidth) {
- strokeWidth = 2;
- }
- i3GEO.desenho.googlemaps.inicia();
- f = new google.maps.Rectangle(
- {
+ googlemaps : {
+ /**
+ * Variavel: shapes
+ *
+ * Array que guarda todos os objetos que estao atualmente no mapa E atualizado toda vez que uma figura e acrescentada ou
+ * removida
+ */
+ shapes : [],
+ inicia : function() {
+ },
+ addBox : function(xmin, ymin, xmax, ymax, namespace, strokeColor, strokeWidth) {
+ var f;
+ if (!namespace) {
+ namespace = "box";
+ }
+ if (!strokeColor) {
+ strokeColor = "#FF0000";
+ }
+ if (!strokeWidth) {
+ strokeWidth = 2;
+ }
+ i3GEO.desenho.googlemaps.inicia();
+ f = new google.maps.Rectangle({
origem : namespace,
strokeColor : strokeColor,
strokeWeight : strokeWidth,
- fillOpacity: 0,
+ fillOpacity : 0,
map : i3GeoMap,
- bounds : new google.maps.LatLngBounds(
- new google.maps.LatLng(
- ymin, xmin), new google.maps.LatLng(
- ymax, xmax))
+ bounds : new google.maps.LatLngBounds(new google.maps.LatLng(ymin, xmin), new google.maps.LatLng(ymax, xmax))
});
- i3GEO.desenho.googlemaps.shapes.push(f);
- return f;
- },
- moveBox : function(box, xmin, ymin, xmax, ymax) {
- box.setBounds(new google.maps.LatLngBounds(
- new google.maps.LatLng(
- ymin, xmin), new google.maps.LatLng(
- ymax, xmax)));
- return box;
- },
- addPin : function(x, y, w, h, imagem, namespace, centro, funcaoclick) {
- if (!imagem
- || imagem === "") {
- imagem = i3GEO.configura.locaplic
- + "/imagens/google/confluence.png";
- }
- if (!namespace) {
- namespace = "pin";
- }
- if (!w
- || w === "") {
- w = 27;
- }
- if (!h
- || h === "") {
- h = 27;
- }
- if (!funcaoclick) {
- funcaoclick = function() {
- i3GEO.desenho.googlemaps.removePins(namespace);
- };
- }
- if (!centro) {
- centro = false;
- }
- i3GEO.desenho.googlemaps.inicia();
- var point, f, icon;
- if (centro === false) {
- icon = {
- url : imagem,
- size : new google.maps.Size(
- w, h)
- };
- } else {
- icon = {
- url : imagem,
- size : new google.maps.Size(
- w, h),
- origin : new google.maps.Point(
- 0, 0),
- anchor : new google.maps.Point(
- w / 2, h / 2)
- };
- }
- point = new google.maps.LatLng(
- y, x);
+ i3GEO.desenho.googlemaps.shapes.push(f);
+ return f;
+ },
+ moveBox : function(box, xmin, ymin, xmax, ymax) {
+ box.setBounds(new google.maps.LatLngBounds(new google.maps.LatLng(ymin, xmin), new google.maps.LatLng(ymax, xmax)));
+ return box;
+ },
+ addPin : function(x, y, w, h, imagem, namespace, centro, funcaoclick) {
+ if (!imagem || imagem === "") {
+ imagem = i3GEO.configura.locaplic + "/imagens/google/confluence.png";
+ }
+ if (!namespace) {
+ namespace = "pin";
+ }
+ if (!w || w === "") {
+ w = 27;
+ }
+ if (!h || h === "") {
+ h = 27;
+ }
+ if (!funcaoclick) {
+ funcaoclick = function() {
+ i3GEO.desenho.googlemaps.removePins(namespace);
+ };
+ }
+ if (!centro) {
+ centro = false;
+ }
+ i3GEO.desenho.googlemaps.inicia();
+ var point, f, icon;
+ if (centro === false) {
+ icon = {
+ url : imagem,
+ size : new google.maps.Size(w, h)
+ };
+ } else {
+ icon = {
+ url : imagem,
+ size : new google.maps.Size(w, h),
+ origin : new google.maps.Point(0, 0),
+ anchor : new google.maps.Point(w / 2, h / 2)
+ };
+ }
+ point = new google.maps.LatLng(y, x);
- f = new google.maps.Marker(
- {
+ f = new google.maps.Marker({
position : point,
map : i3GeoMap,
origem : namespace,
icon : icon
});
- i3GEO.desenho.googlemaps.shapes.push(f);
- return f;
- },
- removePins : function(namespace) {
- if (!namespace) {
- namespace = "pin";
- }
- var f = i3GEO.desenho.googlemaps.getFeaturesByAttribute(
- "origem",
- namespace);
- if (f
- && f.length > 0) {
- i3GEO.desenho.googlemaps.destroyFeatures(f);
- }
- },
- movePin : function(pin, x, y) {
- var point = new google.maps.LatLng(
- y, x);
- pin.setPosition(point);
- },
- /**
- * Function: getFeaturesByAttribute
- *
- * Obtém uma figura com base em um atributo
- *
- * {string}
- *
- * {string}
- */
- getFeaturesByAttribute : function(atributo, valor) {
- var i, s = [], n = i3GEO.desenho.googlemaps.shapes.length;
- for (i = 0; i < n; i++) {
- if (i3GEO.desenho.googlemaps.shapes[i]
- && i3GEO.desenho.googlemaps.shapes[i] != "") {
- if (i3GEO.desenho.googlemaps.shapes[i][atributo] == valor) {
- s.push(i3GEO.desenho.googlemaps.shapes[i]);
+ i3GEO.desenho.googlemaps.shapes.push(f);
+ return f;
+ },
+ removePins : function(namespace) {
+ if (!namespace) {
+ namespace = "pin";
+ }
+ var f = i3GEO.desenho.googlemaps.getFeaturesByAttribute("origem", namespace);
+ if (f && f.length > 0) {
+ i3GEO.desenho.googlemaps.destroyFeatures(f);
+ }
+ },
+ movePin : function(pin, x, y) {
+ var point = new google.maps.LatLng(y, x);
+ pin.setPosition(point);
+ },
+ /**
+ * Function: getFeaturesByAttribute
+ *
+ * Obtém uma figura com base em um atributo
+ *
+ * {string}
+ *
+ * {string}
+ */
+ getFeaturesByAttribute : function(atributo, valor) {
+ var i, s = [], n = i3GEO.desenho.googlemaps.shapes.length;
+ for (i = 0; i < n; i++) {
+ if (i3GEO.desenho.googlemaps.shapes[i] && i3GEO.desenho.googlemaps.shapes[i] != "") {
+ if (i3GEO.desenho.googlemaps.shapes[i][atributo] == valor) {
+ s.push(i3GEO.desenho.googlemaps.shapes[i]);
+ }
+ }
+ }
+ return s;
+ },
+ /**
+ * Function: destroyFeatures
+ *
+ * Destroi as figuras
+ *
+ * {array} - lista de objetos
+ */
+ destroyFeatures : function(f) {
+ if (f) {
+ var i, n = f.length;
+ for (i = 0; i < n; i++) {
+ f[i].setMap(null);
+ f[i] = "";
}
}
}
- return s;
},
/**
- * Function: destroyFeatures
- *
- * Destroi as figuras
- *
- * {array} - lista de objetos
+ * Section: i3GEO.desenho.googleearth
+ *
+ * Funções utilizadas quando o mapa baseia-se na interface GoogleEarth
*/
- destroyFeatures : function(f) {
- if (f) {
- var i, n = f.length;
- for (i = 0; i < n; i++) {
- f[i].setMap(null);
- f[i] = "";
- }
- }
- }
- },
- /**
- * Section: i3GEO.desenho.googleearth
- *
- * Funções utilizadas quando o mapa baseia-se na interface
- * GoogleEarth
- */
- googleearth : {
- insereMarca : function(description, ddx, ddy, name, snippet) {
- if (typeof (console) !== 'undefined')
- console.info("i3GEO.Interface.googleearth.insereMarca()");
+ googleearth : {
+ insereMarca : function(description, ddx, ddy, name, snippet) {
+ if (typeof (console) !== 'undefined')
+ console.info("i3GEO.Interface.googleearth.insereMarca()");
- var placemark = i3GeoMap.createPlacemark(''), point = i3GeoMap.createPoint('');
- placemark.setName(name);
- point.setLatitude(ddy);
- point.setLongitude(ddx);
- placemark.setGeometry(point);
- if (description !== "") {
- placemark.setDescription(description);
- }
- placemark.setSnippet(snippet);
- i3GeoMap.getFeatures().appendChild(
- placemark);
- },
- //
- // código obtido em
- // http://code.google.com/intl/pt-BR/apis/earth/documentation/geometries.html
- //
- insereCirculo : function(centerLng, centerLat, radius, name, snippet) {
- function makeCircle(centerLat, centerLng, radius) {
- var ring = i3GeoMap.createLinearRing(''), steps = 25, i, pi2 = Math.PI * 2, lat, lng;
- for (i = 0; i < steps; i++) {
- lat = centerLat
- + radius
- * Math.cos(i
- / steps
- * pi2);
- lng = centerLng
- + radius
- * Math.sin(i
- / steps
- * pi2);
- ring.getCoordinates().pushLatLngAlt(
- lat,
- lng,
- 0);
- }
- return ring;
- }
- var polygonPlacemark = i3GeoMap.createPlacemark(''), poly = i3GeoMap.createPolygon(''), polyStyle;
- poly.setAltitudeMode(i3GeoMap.ALTITUDE_RELATIVE_TO_GROUND);
- polygonPlacemark.setGeometry(poly);
- polygonPlacemark.getGeometry().setOuterBoundary(
- makeCircle(
- centerLat,
- centerLng,
- radius));
- polygonPlacemark.setName(name);
- polygonPlacemark.setSnippet(snippet);
- polygonPlacemark.setStyleSelector(i3GeoMap.createStyle(''));
- polyStyle = polygonPlacemark.getStyleSelector().getPolyStyle();
- polyStyle.setFill(0);
- i3GeoMap.getFeatures().appendChild(
- polygonPlacemark);
- },
- insereLinha : function(xi, yi, xf, yf, name, snippet) {
- var lineStringPlacemark = i3GeoMap.createPlacemark(''), lineString, lineStyle;
- lineStringPlacemark.setName(name);
- lineString = i3GeoMap.createLineString('');
- lineString.setAltitudeMode(i3GeoMap.ALTITUDE_RELATIVE_TO_GROUND);
- lineStringPlacemark.setGeometry(lineString);
- lineString.getCoordinates().pushLatLngAlt(
- yi,
- xi,
- 0);
- lineString.getCoordinates().pushLatLngAlt(
- yf,
- xf,
- 0);
+ var placemark = i3GeoMap.createPlacemark(''), point = i3GeoMap.createPoint('');
+ placemark.setName(name);
+ point.setLatitude(ddy);
+ point.setLongitude(ddx);
+ placemark.setGeometry(point);
+ if (description !== "") {
+ placemark.setDescription(description);
+ }
+ placemark.setSnippet(snippet);
+ i3GeoMap.getFeatures().appendChild(placemark);
+ },
+ //
+ // código obtido em
+ // http://code.google.com/intl/pt-BR/apis/earth/documentation/geometries.html
+ //
+ insereCirculo : function(centerLng, centerLat, radius, name, snippet) {
+ function makeCircle(centerLat, centerLng, radius) {
+ var ring = i3GeoMap.createLinearRing(''), steps = 25, i, pi2 = Math.PI * 2, lat, lng;
+ for (i = 0; i < steps; i++) {
+ lat = centerLat + radius * Math.cos(i / steps * pi2);
+ lng = centerLng + radius * Math.sin(i / steps * pi2);
+ ring.getCoordinates().pushLatLngAlt(lat, lng, 0);
+ }
+ return ring;
+ }
+ var polygonPlacemark = i3GeoMap.createPlacemark(''), poly = i3GeoMap.createPolygon(''), polyStyle;
+ poly.setAltitudeMode(i3GeoMap.ALTITUDE_RELATIVE_TO_GROUND);
+ polygonPlacemark.setGeometry(poly);
+ polygonPlacemark.getGeometry().setOuterBoundary(makeCircle(centerLat, centerLng, radius));
+ polygonPlacemark.setName(name);
+ polygonPlacemark.setSnippet(snippet);
+ polygonPlacemark.setStyleSelector(i3GeoMap.createStyle(''));
+ polyStyle = polygonPlacemark.getStyleSelector().getPolyStyle();
+ polyStyle.setFill(0);
+ i3GeoMap.getFeatures().appendChild(polygonPlacemark);
+ },
+ insereLinha : function(xi, yi, xf, yf, name, snippet) {
+ var lineStringPlacemark = i3GeoMap.createPlacemark(''), lineString, lineStyle;
+ lineStringPlacemark.setName(name);
+ lineString = i3GeoMap.createLineString('');
+ lineString.setAltitudeMode(i3GeoMap.ALTITUDE_RELATIVE_TO_GROUND);
+ lineStringPlacemark.setGeometry(lineString);
+ lineString.getCoordinates().pushLatLngAlt(yi, xi, 0);
+ lineString.getCoordinates().pushLatLngAlt(yf, xf, 0);
- lineStringPlacemark.setStyleSelector(i3GeoMap.createStyle(''));
- lineStringPlacemark.setSnippet(snippet);
- lineStyle = lineStringPlacemark.getStyleSelector().getLineStyle();
- lineStyle.setWidth(3);
+ lineStringPlacemark.setStyleSelector(i3GeoMap.createStyle(''));
+ lineStringPlacemark.setSnippet(snippet);
+ lineStyle = lineStringPlacemark.getStyleSelector().getLineStyle();
+ lineStyle.setWidth(3);
- i3GeoMap.getFeatures().appendChild(
- lineStringPlacemark);
- },
- removePlacemark : function(nome) {
- var features = i3GeoMap.getFeatures(), n = features.getChildNodes().getLength(), i, nfeatures = [];
- for (i = 0; i < n; i++) {
- try {
- if (features.getChildNodes().item(
- i).getName() === nome
- || features.getChildNodes().item(
- i).getDescription() === nome
- || features.getChildNodes().item(
- i).getSnippet() === nome) {
- // features.getChildNodes().item(i).setVisibility(false);
- nfeatures.push(features.getChildNodes().item(
- i));
- // features.removeChild(features.getChildNodes().item(i));
+ i3GeoMap.getFeatures().appendChild(lineStringPlacemark);
+ },
+ removePlacemark : function(nome) {
+ var features = i3GeoMap.getFeatures(), n = features.getChildNodes().getLength(), i, nfeatures = [];
+ for (i = 0; i < n; i++) {
+ try {
+ if (features.getChildNodes().item(i).getName() === nome || features.getChildNodes().item(i).getDescription() === nome
+ || features.getChildNodes().item(i).getSnippet() === nome) {
+ // features.getChildNodes().item(i).setVisibility(false);
+ nfeatures.push(features.getChildNodes().item(i));
+ // features.removeChild(features.getChildNodes().item(i));
+ }
+ } catch (e) {
}
- } catch (e) {
}
- }
- n = nfeatures.length;
- for (i = 0; i < n; i++) {
- features.removeChild(nfeatures[i]);
+ n = nfeatures.length;
+ for (i = 0; i < n; i++) {
+ features.removeChild(nfeatures[i]);
+ }
}
}
- }
-};
+ };
// YAHOO.log("carregou classe desenho", "Classes i3geo");
diff --git a/js/eventos.js b/js/eventos.js
index 85dd4f0..29f1725 100644
--- a/js/eventos.js
+++ b/js/eventos.js
@@ -290,7 +290,8 @@ i3GEO.eventos =
}
i3GEO.eventos.executaEventos(this.MOUSEUP);
}
- else if (i3GEO.Interface.ATUAL === "openlayers"){
+ else if (i3GEO.Interface.ATUAL === "openlayers" && exy.target && exy.target.tagName === "CANVAS"){
+ //para evitar bubble
i3GEO.eventos.executaEventos(this.MOUSEUP);
}
diff --git a/js/ini_i3geo.js b/js/ini_i3geo.js
index 7785f79..80a087d 100644
--- a/js/ini_i3geo.js
+++ b/js/ini_i3geo.js
@@ -780,10 +780,6 @@ var i3GEO = {
}
i3GEO.eventos.navegaMapa();
- i3GEO.ajuda.mostraJanela(
- "Tempo de redesenho em segundos: "
- + retorno.data.variaveis.tempo,
- "");
//
// verifica se deve ser feito o zoom em algum tema
//
diff --git a/js/interface.js b/js/interface.js
index f3f7b36..ef862b4 100755
--- a/js/interface.js
+++ b/js/interface.js
@@ -723,21 +723,40 @@ i3GEO.Interface =
googleLike : false,
BALAOPROP : {
removeAoAdicionar : true,
- classeCadeado : "i3GEOiconeAberto"
+ classeCadeado : "i3GEOiconeAberto",
+ autoPan : true,
+ autoPanAnimation: {
+ duration: 250
+ },
+ width: '200px',
+ baloes: []
},
balao : function(texto, completo, x, y) {
- var e, b, c, temp, p = i3GEO.Interface.openlayers.BALAOPROP;
+ var icone, painel, b, cabecalho, conteudo, p = i3GEO.Interface.openlayers.BALAOPROP, removeBaloes;
- // cabecalho de opcoes
- c = "
";
- texto = c + texto;
- b = new OpenLayers.Popup.FramedCloud(null, i3GEO.util.projGeo2OSM(new OpenLayers.LonLat(x, y)), null, texto, null, true);
- b.maxsize = new OpenLayers.Size(parseInt(i3GEO.parametros.w / 2, 10), parseInt(i3GEO.parametros.h / 2, 10));
+ removeBaloes = function(){
+ var t, n = i3GEO.Interface.openlayers.BALAOPROP.baloes.length, i;
+ for(i=0; i
" + completo + " ", "");
+ return false;
};
- temp.appendChild(e);
+ cabecalho.appendChild(icone);
+ //icone x
+ icone = document.createElement("div");
+ icone.className = "ol-popup-closer";
+ icone.onclick = removeBaloes;
+ cabecalho.appendChild(icone);
+
+ painel.appendChild(cabecalho);
+
+ conteudo = document.createElement("div");
+ conteudo.innerHTML = texto;
+ painel.appendChild(conteudo);
+
+ b = new ol.Overlay({
+ element: painel,
+ stopEvent: true,
+ autoPan: p.autoPan,
+ autoPanAnimation: p.autoPanAnimation
+ });
+ p.baloes.push(b);
+ i3geoOL.addOverlay(b);
+ b.setPosition([x,y]);
},
/**
* Redesenha o mapa atual
@@ -814,6 +858,12 @@ i3GEO.Interface =
ol.layer.Layer.prototype.setVisibility = function(v) {
this.setVisible(v);
};
+ ol.layer.Layer.prototype.getVisibility = function(v) {
+ this.getVisible(v);
+ };
+ i3geoOL.panTo = function(x,y){
+ this.getView().setCenter([x,y]);
+ };
i3geoOL.getLayersByName = function(nome) {
var res = [], layers = this.getLayers(), n = layers.getLength(), i;
for (i = 0; i < n; i++) {
@@ -847,6 +897,15 @@ i3GEO.Interface =
}
return res;
};
+ i3geoOL.getControlsBy = function(chave, valor) {
+ var res = [], controles = this.getControls(), n = controles.getLength(), i;
+ for (i = 0; i < n; i++) {
+ if (controles.item(i).get(chave) && controles.item(i).get(chave) === valor) {
+ res.push(controles.item(i));
+ }
+ }
+ return res;
+ };
i3geoOL.getCenter = function() {
var c = this.getView().getCenter();
return {
@@ -1010,7 +1069,7 @@ i3GEO.Interface =
for (i = nlayers - 1; i >= 0; i--) {
camada = i3GEO.arvoreDeCamadas.CAMADAS[i];
l = i3geoOL.getLayersByName(camada.name)[0];
- if (l && l.isBaseLayer === false) {
+ if (l && l.get("isBaseLayer") === false) {
if (layer == "" || layer == camada.name) {
l.setOpacity(opacidade);
}
@@ -1829,7 +1888,7 @@ i3GEO.Interface =
y = metrica.lat;
}
}
- i3geoOL.panTo(new OpenLayers.LonLat(x, y));
+ i3geoOL.panTo(x,y);
}
},
/**
diff --git a/js/mapa.js b/js/mapa.js
index bf1f4c9..3823bd6 100644
--- a/js/mapa.js
+++ b/js/mapa.js
@@ -1405,113 +1405,113 @@ i3GEO.mapa =
}
retorna =
function(retorno) {
- var textoCompleto = "", textoSimples = "", textoTempCompleto = "", textoTempSimples = "", classeCor, temp, n, mostra, res, temas, ntemas, titulo, tips, j, ntips, r, ds, nds, s, configura =
- i3GEO.configura, tipotip = configura.tipotip;
- i3GEO.eventos.cliquePerm.status = true;
- mostra = false;
- retorno = retorno.data;
- if (retorno !== "") {
- res = "";
- temas = retorno;
- if (!temas) {
- return;
+ var textoCompleto = "", textoSimples = "", textoTempCompleto = "", textoTempSimples = "", classeCor, temp, n, mostra, res, temas, ntemas, titulo, tips, j, ntips, r, ds, nds, s, configura =
+ i3GEO.configura, tipotip = configura.tipotip;
+ i3GEO.eventos.cliquePerm.status = true;
+ mostra = false;
+ retorno = retorno.data;
+ if (retorno !== "") {
+ res = "";
+ temas = retorno;
+ if (!temas) {
+ return;
+ }
+ ntemas = temas.length;
+ for (j = 0; j < ntemas; j += 1) {
+ titulo = temas[j].nome;
+ if (tipotip != "simples") {
+ titulo = "