Projet

Général

Profil

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

root / show_capline.php @ dbd2521a

1
<?php 
2
require_once('class/FormValidator.class.php');
3

    
4
$fields_spec = array(
5
  'cap' => array('numeric'),
6
  'org_lat' => array('numeric'),
7
  'org_lon' => array('numeric'),
8
  'dist' => array('numeric'),
9
  'title' => array(),
10
);
11

    
12
$validator = new FormValidator($fields_spec);
13

    
14
$is_valid = $validator->validate($_GET);
15

    
16

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

    
29
 ?>
30

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

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

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

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

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

    
114
</script>
115
<script src="js/utils_osm.js">
116
</script>
117
<script src="js/pano.js">
118
</script>
119

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