Projet

Général

Profil

Paste
Télécharger (3,61 ko) Statistiques
| Branche: | Révision:

root / show_capline.php @ f7cc6422

1
<?php 
2
$fields_spec = array(
3
  'cap' => array('numeric'),
4
  'org_lat' => array('numeric'),
5
  'org_lon' => array('numeric'),
6
  'dist' => array('numeric'),
7
  'title' => array(),
8
);
9

    
10
$validator = new FormValidator($fields_spec);
11

    
12
$is_valid = $validator->validate($_GET);
13

    
14

    
15
if ($is_valid) {
16
  $input = $validator->sane_values();
17
  if (isset($input['cap'], $input['org_lat'], $input['org_lon'])) {
18
    $cap = $input['cap'];
19
    $org_lat = $input['org_lat'];
20
    $org_lon = $input['org_lon'];
21
    $show_capline = true;
22
  } else {
23
    $show_capline = false;
24
  }
25
}
26

    
27
 ?>
28

    
29
<head>
30
  <title>Visualisation axe horizontal sur OSM</title>
31
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
32
  <link type="image/x-icon" rel="shortcut icon" href="images/tsf.png"/>
33
  <link rel="stylesheet" type="text/css" href="css/layers.css" />
34
  <link rel="stylesheet" type="text/css" href="http://dev.openlayers.org/releases/OpenLayers-2.13.1/theme/default/style.css" />
35
  <link rel="stylesheet" type="text/css" href="css/olmap.css" />
36

    
37
<?php
38
if (isset($_REQUEST['cap']) && isset($_REQUEST['org_lat']) && isset($_REQUEST['org_lon'])) {
39
  $cap = $_REQUEST['cap'];
40
  $org_lat = $_REQUEST['org_lat'];
41
  $org_lon = $_REQUEST['org_lon'];
42
  $complete = true;
43
} else {
44
  $complete = false;
45
}
46
if (isset($_REQUEST['title'])) {
47
  $pt_comment = htmlentities(base64_decode($_REQUEST['title']), ENT_QUOTES);
48
} else {
49
  $pt_comment = 'Le point de départ';
50
}
51
if (isset($_REQUEST['dist'])) {
52
  $dist = $_REQUEST['dist'];
53
} else {
54
  $dist = 120000;
55
}
56
if ($complete) {
57
  echo <<< EOS
58
<script src="http://maps.google.com/maps/api/js?v=3&amp;sensor=false"></script>
59
<script src="http://openlayers.org/api/OpenLayers.js"></script>
60
<script>
61
  var get_lon_lat = false;
62
  var scale_line = true;
63

64
  var def_points_style = {
65
  showPopup: false,
66
  icon_width: 24,
67
  icon_height: 24,
68
  icon_shiftX: -12,
69
  icon_shiftY: -24,
70
  opacity: 0.7}
71

72
  var ref_point = {
73
  lon: $org_lon,
74
  lat: $org_lat,
75
  icon_url: 'images/ptref.png',
76
  descr: '<div id="bulle">$pt_comment</div>',
77
  showPopup: true,
78
  icon_width: 24,
79
  icon_height: 24,
80
  icon_shiftX: -12,
81
  icon_shiftY: -24,
82
  title: 'chez nous'
83
};
84

85
var ref_line = {
86
 lon1: $org_lon,
87
 lat1: $org_lat,
88
 cap: $cap,
89
 width: 2,
90
 length: $dist,
91
 color: '#F00'
92
};
93
var base_layers = [
94
                   new OpenLayers.Layer.OSM(),
95
                   new OpenLayers.Layer.Google(
96
                                               "Google Satellite",
97
  {type: google.maps.MapTypeId.SATELLITE, numZoomLevels: 22}
98
                                               ),
99
                   new OpenLayers.Layer.Google(
100
                                               "Google Relief",
101
  {type: google.maps.MapTypeId.TERRAIN, visibility: false}
102
                                               ),
103
                   new OpenLayers.Layer.Google(
104
                                               "Google plan",
105
  {numZoomLevels: 20, visibility: false}
106
                                               ),
107
                   new OpenLayers.Layer.Google(
108
                                               "Google Hybrid",
109
  {type: google.maps.MapTypeId.HYBRID, numZoomLevels: 22, visibility: false}
110
                                               )];
111

    
112
</script>
113
<script src="js/utils_osm.js">
114
</script>
115
<script src="js/pano.js">
116
</script>
117

    
118
EOS;
119
}
120
?>
121
<script>
122
window.onload = function() {
123
  var map = draw_cap_map(12);//zoom
124
  all_refpoints = mk_all_refpoints_layer()
125
  map.addLayer(all_refpoints);
126
  add_refpoint_control(all_refpoints, map);
127
}
128
</script>
129
</head>
130
<body>
131
<?php
132
if ($complete) {
133
  echo '<div id="map"></div>'."\n";
134
  echo '<div id="panel"></div>'."\n";
135
  echo '<div id="position"></div>'."\n";
136
  echo '<div id="extra">'."\n";
137
  echo '<p>Autres contrôles'."\n";
138
  echo '<label><input type="checkbox" id="tilt" checked="checked"/>vision à 45°</label>'."\n";
139
  echo '<label><input type="checkbox" id="clic_pos"/>Position afichée sur clic</label>'."\n";
140
  echo '</div>'."\n";
141
} else {
142
  echo "<h1>Il faut indiquer des coordonnées.</h1>\n";
143
}
144
?>
145
</body>
146
</html>