Projet

Général

Profil

Révision 5c5b7504

Ajouté par Jocelyn Delande il y a plus de 10 ans

Added a display of all the ref_points on the map.

Voir les différences:

js/utils_osm.js
225 225
	    alert(position.lat.toFixed(5) + ', ' + position.lon.toFixed(5));
226 226
	});
227 227
    }
228

  
229
	return map;
230
}
231

  
232
function mk_all_refpoints_layer() {
233
	var layer = new OpenLayers.Layer.Vector(
234
		"Reference points",{
235
			projection: new OpenLayers.Projection("EPSG:4326"),
236
			strategies: [new OpenLayers.Strategy.Fixed()],
237
			protocol: new OpenLayers.Protocol.HTTP({
238
				url: 'ajax/ref_points.php',
239
				format: new OpenLayers.Format.GeoJSON(),
240
			})
241
		});
242
	return layer;
228 243
}
244

  
245

  
246
function add_refpoint_control(layer, map) {
247
	var selectControl ;
248
	selectControl = new OpenLayers.Control.SelectFeature(
249
		layer,{
250
			onSelect:function(feature) {
251
				var popup = new OpenLayers.Popup.FramedCloud(
252
					feature.attributes.name,
253
					feature.geometry.getBounds().getCenterLonLat(),
254
					null,
255
					"<div>" + feature.attributes.name+"</div>",
256
					null, true, function() {selectControl.unselect(feature);});
257
				feature.popup = popup;
258
				map.addPopup(popup);},
259

  
260
			onUnselect:function(feature) {
261
				map.removePopup(feature.popup);
262
				feature.popup.destroy();
263
				feature.popup = null;
264
			}});
265

  
266
	map.addControl(selectControl);
267
	selectControl.activate();
268
}
269

  

Formats disponibles : Unified diff