Projet

Général

Profil

« Précédent | Suivant » 

Révision e1acd4a1

IDe1acd4a196bf65dd03abeb0426a70e07a037f139
Parent 329a7a3b
Enfant 043955eb

Ajouté par Jocelyn Dealande il y a presque 10 ans

Can add a panorama from the map.

Fichiers

  • ajouté
  • modifié
  • copié
  • renommé
  • supprimé

Voir les différences

Révisions

css/layers.css
5 5
    right: 0;
6 6
    height: 1em; 
7 7
}
8
#panel div { 
8
#panel div {
9 9
    float: left;
10 10
    margin: 0.5em;
11 11
}
......
53 53
    background-color:#F0F;
54 54
    padding:1em;
55 55
}
56

  
57

  
58

  
css/olmap.css
1

  
2
#panel {
3

  
4
/*    border: 1px solid black;*/
5
    cursor: pointer;
6
    }
7

  
8
#panel button {
9
    position: relative;
10
    display: block;
11
    margin: 2px;
12
    border: 1px solid;
13
    padding: 0 5px;
14
    border-radius: 4px;
15
    height: 35px;
16
    background-color: white;
17
    float: left;
18
    overflow: visible; /* needed to remove padding from buttons in IE */
19
	width: 6em;
20
	background-repeat: none;
21
}
22
#panel button span {
23
    padding-left: 25px;
24
}
25
#panel button span:first-child {
26
    padding-left: 0;
27
    display: block;
28
    position: absolute;
29
    left: 2px;
30
}
31

  
32
#panel .olControlNavigationHistory {
33
	background-image: none;
34
}
35

  
36

  
37
#panel {
38
	opacity: 0.5;
39
}
40

  
41
#panel:hover {
42
	opacity: 1;
43
}
44

  
45

  
46
#panel .olControlNavigationHistory span:first-child, #panel .olControlBtnNewPanoItemInActive span:first-child {
47
    background-image: url("../images/plus_photo.png");
48
    height: 24px;
49
    width: 24px;
50
    top: 4px;
51
}
52
#panel .olControlNavigationHistoryPreviousItemActive span:first-child {
53
    background-position: 0 0;
54
}
55
#panel .olControlNavigationHistoryPreviousItemInactive span:first-child {
56
    background-position: 0 -24px;
57
}
58
#panel .olControlNavigationHistoryNextItemActive span:first-child {
59
    background-position: -24px 0;
60
}
61
#panel .olControlNavigationHistoryNextItemInactive span:first-child {
62
    background-position: -24px -24px;
63
}
64

  
65
#panel .olControlNavigationHistory span:first-child {
66
    background-image: url("http://dev.openlayers.org/releases/OpenLayers-2.13.1/theme/default/img/navigation_history.png");
67
    height: 24px;
68
    width: 24px;
69
    top: 4px;
70
}
js/utils_osm.js
341 341
				feature.popup.destroy();
342 342
				feature.popup = null;
343 343
			}});
344
	
344

  
345 345
	map.addControl(selectControl);
346 346
	selectControl.activate();
347
}
348

  
349

  
350
function mk_new_pano_button(map) {
351
	var btn = new OpenLayers.Control.Button({
352
		displayClass: 'olControlBtnNewPano',
353
		title: "Ajouter un nouveau panorama",
354
		text: "Photo",
355
		id: 'btn-new-pano',
356
		autoActivate: true,
357
		trigger: function() {start_add_new_pano(map)},
358
	});
359
	return btn;
360
}
361

  
362

  
363
function add_pano_click_handler(callback) {
364
	var ctrlClass = OpenLayers.Class(OpenLayers.Control, {
365
		defaultHandlerOptions: {
366
		    'single': false,
367
		    'double': true,
368
		    'pixelTolerance': 0,
369
		    'stopSingle': false,
370
		    'stopDouble': false
371
		},
372

  
373
		initialize: function(options)
374
		{
375
		    this.handlerOptions = OpenLayers.Util.extend(
376
		        {}, this.defaultHandlerOptions
377
		    );
347 378

  
379
		    OpenLayers.Control.prototype.initialize.apply(this, arguments);
380

  
381
		    this.handler = new OpenLayers.Handler.Click(
382
		        this, {
383
		            'click': callback
384
		        }, this.handlerOptions
385
		    );
386
		},
387
	});
388

  
389
	var control = new ctrlClass({
390
		        handlerOptions: {
391
		            "single": true,
392
		            "double": false
393
		        },
394
		autoActivate: true});
395

  
396
	return control;
397
}
398

  
399
function start_add_new_pano(map) {
400
	map.celutz_addnew = true;
401
	alert("cliquer sur un point de la carte pour choisir l'emplacement");
402
	document.body.style.cursor = 'crosshair';
403

  
404
	var control = add_pano_click_handler(function(evt) {
405
		var coord = map.getLonLatFromPixel(evt.xy);
406
		coord.transform(new OpenLayers.Projection("EPSG:900913"),
407
		                new OpenLayers.Projection("EPSG:4326"));
408
		window.location = 'envoyer.php?lat='+coord.lat+'&lon='+coord.lon;
409
	});
410
	map.addControl(control);
348 411
}
349 412

  
350 413