「OpenLayers入門」矩形を描画する方法
サンプルコード:
var vectors,lineFeature;
//css定義
var style_green = {
strokeColor: “#00FF00",
strokeWidth: 3,
strokeDashstyle: “dashdot",
pointRadius: 6,
pointerEvents: “visiblePainted"
};
//line layerの設定
var layer_style = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default’]);
layer_style.fillOpacity = 0.2;
layer_style.graphicOpacity = 1;
//vectorの作成
vectors = new OpenLayers.Layer.Vector(“Simple Geometry", {style: layer_style});
map.addLayer(vectors);
//ポイントの操作
var pointList = [];
for(var i=0;i<5;i++){
newPoint = new OpenLayers.Geometry.Point(lon,lan);
pointList.push(newPoint);
}
lineFeature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(pointList),null,style_green);
vectors.addFeatures([lineFeature]);
var scene_left_top_lat,scene_left_top_lon,scene_right_top_lat,scene_right_top_lon;
var scene_left_bottom_lat,scene_left_bottom_lon,scene_right_bottom_lat,scene_right_bottom_lon;