cursodsv27.htm
2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Category" content="i3Geo Mapa interativo MMA geoprocessamento sig mobile">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<title>i3GEO - OpenLayers</title>
<script src="../classesjs/i3geo.js"></script>
<script src="../pacotes/openlayers/OpenLayers2131.js"></script>
<link rel="stylesheet" type="text/css" href="../css/black.css">
</head>
<body style='margin-left: 7px; background: white;' class=yui-skin-sam>
<div id=i3geo>
<div id=corpoMapa style="left: 15px; width: 700px; height: 400px; background-image: url('../imagens/i3geo1bw.jpg');"></div>
</div>
<div style="top: 410px; text-align: left; left: 15px;">
<button title="Digitalizar" onclick="digitaliza()" value="i3GEOselecaopoli">
<img src="../imagens/gisicons/boundary-edit.png" />
</button>
<div id="wkt" style="text-align: left; left: 15px;"></div>
</div>
<script>
/************
Exemplo de inclusao de um botao que permite digitalizar poligonos no mapa
************/
i3GEO.idioma.MOSTRASELETOR = false; //para nao mostrar as bandeiras de escolha do idioma
i3GEO.configura.mapaRefDisplay = "none";//nao mostra o mapa de referencia
i3GEO.mapa.TEMASINICIAIS = "_lbiomashp,_llocali";
i3GEO.mapa.TEMASINICIAISLIGADOS = "_lbiomashp";
function digitaliza() {
i3GEO.eventos.cliquePerm.desativa();
if (i3GEO.desenho.layergrafico) {
var u = i3GEO.desenho.layergrafico.getFeaturesByAttribute(
"origem",
"geobahia");
if (u
&& u.length > 0) {
i3GEO.desenho.layergrafico.destroyFeatures(u);
}
poligono.activate();
return;
}
i3GEO.desenho.openlayers.inicia();
alert("Clique no mapa para desenhar um poligono");
poligono = new OpenLayers.Control.DrawFeature(
i3GEO.desenho.layergrafico, OpenLayers.Handler.Polygon, {
id : "inserePoligono",
autoActivate : true,
type : OpenLayers.Control.TYPE_TOOL,
//handlerOptions: {holeModifier: "altKey"},
callbacks : {
done : function(feature) {
var estilo, f, u;
u = i3GEO.desenho.layergrafico.getFeaturesByAttribute(
"origem",
"geobahia");
if (u
&& u.length > 0) {
i3GEO.desenho.layergrafico.destroyFeatures(u);
}
estilo = i3GEO.desenho.estilos["normal"];
f = new OpenLayers.Feature.Vector(
feature, {
origem : "geobahia"
}, {
graphicName : "square",
pointRadius : 10,
graphicOpacity : 1,
strokeWidth : 2,
strokeColor : estilo.linecolor,
fillColor : estilo.fillcolor,
fillOpacity : 0.3
});
i3GEO.desenho.layergrafico.addFeatures([
f
]);
i3GEO.eventos.cliquePerm.ativa();
$i("wkt").innerHTML = f.geometry;
poligono.deactivate();
}
}
});
i3geoOL.addControls([
poligono
]);
};
i3GEO.cria();
i3GEO.inicia();
</script>
</body>
</html>