Projet

Général

Profil

Révision 598caaec

Ajouté par Jocelyn Delande il y a presque 11 ans

now displays the circles with the same color as on the pano (sortof...)

Voir les différences:

ajax/ref_points.php
41 41
	                                 "type" => "Point",
42 42
	                                 "coordinates" => [$values[1],$values[0]]
43 43
	                                 ),
44
	             "properties" => array("name" => $name)
44
	             "properties" => array("name" => $name, "type" => 'loc_point')
45 45
	             );
46 46
}
47 47

  
js/pano.js
29 29
var canvas_pos = {x:0,y:0};
30 30
var tmt;
31 31
var is_located = false;
32
var point_colors = {'pano_point' : '255,128,128',
33
		    'ref_point'  : '128,128,255',
34
		    'loc_point'  : '128,255,128',
35
		    'temporary'  : '255,255,128',
36
		    'unlocated'  : '255,255,255'};
32
var point_colors = {
33
	'pano_point' : '255,128,128', // red
34
	'ref_point'  : '128,128,255', // blue
35
	'loc_point'  : '128,255,128', // green
36
	'temporary'  : '255,255,128', // yellow
37
	'unlocated'  : '255,255,255'  // white
38
};
37 39
var test = {x:0, y:0, i:100};
38 40

  
39 41

  
js/utils_osm.js
229 229
	return map;
230 230
}
231 231

  
232
function list2css_color(vals) {
233
	return "rgb("+vals+")";
234
}
235

  
232 236
function mk_all_refpoints_layer() {
237
	// Put the same style as panorama view for points
238
	var points_style = new OpenLayers.StyleMap({
239
		pointRadius: 10,
240
		fillOpacity: 0.5,
241
	});
242
	
243
	var lookup = {};
244
	
245
	for (var k in  point_colors ) {
246
		var css_color = list2css_color(point_colors[k]);
247
		lookup[k] = {
248
			fillColor: css_color,
249
			strokeColor: css_color
250
		};
251
	}
252
	console.log(lookup);
253
	points_style.addUniqueValueRules("default", "type", lookup);	
254
	
233 255
	var layer = new OpenLayers.Layer.Vector(
234 256
		"Reference points",{
235 257
			projection: new OpenLayers.Projection("EPSG:4326"),
......
237 259
			protocol: new OpenLayers.Protocol.HTTP({
238 260
				url: 'ajax/ref_points.php',
239 261
				format: new OpenLayers.Format.GeoJSON(),
240
			})
262
			}),
263
			styleMap: points_style
241 264
		});
242 265
	return layer;
243 266
}
......
262 285
				feature.popup.destroy();
263 286
				feature.popup = null;
264 287
			}});
265

  
288
	
266 289
	map.addControl(selectControl);
267 290
	selectControl.activate();
291

  
268 292
}
269 293

  

Formats disponibles : Unified diff