- Timestamp:
- 01/05/2006 06:36:43 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 1 deleted
- 5 edited
-
config-sample/config.php (modified) (1 diff)
-
files/srtm (added)
-
globals/classes/geoimage.php (added)
-
globals/classes/srtm.php (added)
-
includes/pages/nodes/nodes_plot_link.php (modified) (3 diffs)
-
includes/pages/nodes/nodes_view.php (modified) (3 diffs)
-
plot (deleted)
-
templates/basic/generic/plot.tpl (modified) (1 diff)
-
templates/basic/includes/pages/nodes/nodes_plot_link.tpl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/config-sample/config.php
r106 r129 60 60 ), 61 61 62 'srtm' => array( 63 'path' => $root_path.'files/srtm/' 64 ), 65 62 66 'gmap' => array( 63 67 'server' => 'maps.google.com', -
trunk/includes/pages/nodes/nodes_plot_link.php
r5 r129 20 20 */ 21 21 22 $plot_path = $root_path."plot/";23 include_once $root_path."plot/elevation.php";24 22 include_once($root_path.'globals/classes/geocalc.php'); 23 $geocalc = new geocalc(); 24 25 include_once($root_path.'globals/classes/srtm.php'); 26 $srtm = new srtm($vars['srtm']['path']); 25 27 26 28 class nodes_plot_link { … … 33 35 34 36 function output() { 35 global $main, $db ;37 global $main, $db, $geocalc, $srtm; 36 38 $main->header->hide = TRUE; 37 39 $main->menu->hide = TRUE; … … 51 53 52 54 if ($this->tpl['a_node'] != '' && $this->tpl['b_node'] != '') { 53 $gc = new GeoCalc(); 54 $this->tpl['a_node_azimuth'] = $gc->GCAzimuth($a_node_data['latitude'], $a_node_data['longitude'], $b_node_data['latitude'], $b_node_data['longitude']); 55 $this->tpl['b_node_azimuth'] = $gc->GCAzimuth($b_node_data['latitude'], $b_node_data['longitude'], $a_node_data['latitude'], $a_node_data['longitude']); 56 $this->tpl['a_node_elevation'] = get_elevation($a_node_data['latitude'], $a_node_data['longitude']) + $a_node_data['elevation']; 57 $this->tpl['b_node_elevation'] = get_elevation($b_node_data['latitude'], $b_node_data['longitude']) + $b_node_data['elevation']; 58 $frequency = 2400000000; 55 $this->tpl['a_node_azimuth'] = $geocalc->GCAzimuth($a_node_data['latitude'], $a_node_data['longitude'], $b_node_data['latitude'], $b_node_data['longitude']); 56 $this->tpl['b_node_azimuth'] = $geocalc->GCAzimuth($b_node_data['latitude'], $b_node_data['longitude'], $a_node_data['latitude'], $a_node_data['longitude']); 57 $this->tpl['a_node_geo_elevation'] = $srtm->get_elevation($a_node_data['latitude'], $a_node_data['longitude']); 58 $this->tpl['b_node_geo_elevation'] = $srtm->get_elevation($b_node_data['latitude'], $b_node_data['longitude']); 59 $this->tpl['a_node_elevation'] = $a_node_data['elevation']; 60 $this->tpl['b_node_elevation'] = $b_node_data['elevation']; 61 62 $a_node_total_elevation = $this->tpl['a_node_geo_elevation'] + $this->tpl['a_node_elevation']; 63 $b_node_total_elevation = $this->tpl['b_node_geo_elevation'] + $this->tpl['b_node_elevation']; 64 65 $this->tpl['distance'] = $geocalc->GCDistance($a_node_data['latitude'], $a_node_data['longitude'], $b_node_data['latitude'], $b_node_data['longitude']); 66 $this->tpl['a_node_tilt'] = rad2deg(atan(($b_node_total_elevation - $a_node_total_elevation) / ($this->tpl['distance'] * 1000))); 67 $this->tpl['b_node_tilt'] = rad2deg(atan(($a_node_total_elevation - $b_node_total_elevation) / ($this->tpl['distance'] * 1000))); 68 $this->tpl['distance'] = sqrt( pow($this->tpl['distance'] * 1000, 2) + pow( abs($a_node_total_elevation - $b_node_total_elevation), 2 ) ) / 1000; 69 70 $this->tpl['frequency'] = (integer)$_POST['frequency']; 71 if ($this->tpl['frequency'] <= 0) $this->tpl['frequency'] = 2450; 72 $frequency = $this->tpl['frequency'] * 1000000; 59 73 $c = 299792.458; // light speed in km 60 $this->tpl['distance'] = $gc->GCDistance($a_node_data['latitude'], $a_node_data['longitude'], $b_node_data['latitude'], $b_node_data['longitude']);61 74 $this->tpl['fsl'] = 20 * log10(4 * pi() * $this->tpl['distance'] * ($frequency / $c)); 62 $this->tpl['a_node_tilt'] = rad2deg(atan(($this->tpl['b_node_elevation'] - $this->tpl['a_node_elevation']) / ($this->tpl['distance'] * 1000)));63 $this->tpl[' b_node_tilt'] = rad2deg(atan(($this->tpl['a_node_elevation'] - $this->tpl['b_node_elevation']) / ($this->tpl['distance'] * 1000)));75 76 $this->tpl['plot_image'] = makelink(array("page" => "nodes", "subpage" => "plot", "a_node" => $this->tpl['a_node'], "b_node" => $this->tpl['b_node'], "frequency" => $_POST['frequency'])); 64 77 } 65 78 -
trunk/includes/pages/nodes/nodes_view.php
r103 r129 20 20 */ 21 21 22 $plot_path = $root_path."plot/"; 23 include_once $root_path."plot/elevation.php"; 22 include_once($root_path.'globals/classes/geocalc.php'); 23 $geocalc = new geocalc(); 24 25 include_once($root_path.'globals/classes/srtm.php'); 26 $srtm = new srtm($vars['srtm']['path']); 24 27 25 28 class nodes_view { … … 32 35 33 36 function calculate_distance($a_node, $b_node) { 34 global $db ;37 global $db, $geocalc, $srtm; 35 38 $a_node_i = $db->get('latitude, longitude, elevation', 'nodes', "id = '".$a_node."'"); 36 39 $b_node_i = $db->get('latitude, longitude, elevation', 'nodes', "id = '".$b_node."'"); … … 41 44 $lon2 = $b_node_i[0]['longitude']; 42 45 43 $a_node_el = str_replace(",", ".", get_elevation($lat1, $lon1, FALSE)); 44 $b_node_el = str_replace(",", ".", get_elevation($lat2, $lon2, FALSE)); 45 46 $dist = acos(sin(deg2rad($lat1)) 47 * sin(deg2rad($lat2)) 48 + cos(deg2rad($lat1)) 49 * cos(deg2rad($lat2)) 50 * cos(deg2rad($lon1 - $lon2))); 51 52 $dist = rad2deg($dist); 53 54 $miles = (float) $dist * 69; 55 56 $meters = (float) $miles * 1610; 46 $a_node_el = str_replace(",", ".", $srtm->get_elevation($lat1, $lon1, FALSE)); 47 $b_node_el = str_replace(",", ".", $srtm->get_elevation($lat2, $lon2, FALSE)); 48 49 $dist = $geocalc->GCDistance($lat1, $lon1, $lat2, $lon2); 57 50 58 51 if ($a_node_el != FALSE && $b_node_el != FALSE) { 59 52 $a_node_el += (integer)$a_node_i[0]['elevation']; 60 53 $b_node_el += (integer)$b_node_i[0]['elevation']; 61 $meters = sqrt( pow($meters, 2) + pow( abs($a_node_el - $b_node_el), 2 ) ); 62 } 63 64 $km = (float) $meters / 1000; 65 66 return $km; 54 $dist = sqrt( pow($dist * 1000, 2) + pow( abs($a_node_el - $b_node_el), 2 ) ) / 1000; 55 } 56 57 return $dist; 67 58 } 68 59 -
trunk/templates/basic/generic/plot.tpl
r48 r129 22 22 <tr><td colspan="3" class="plot-title">{$lang.plot}</td></tr> 23 23 <tr><td width="33%" align="left">{$data[rowl].node_name|escape} (#{$data[rowl].node_id})</td><td width="33%" align="center">-- {$data[rowl].distance|round:3}km --</td><td align="right">{$data[rowl].peer_node_name|escape} (#{$data[rowl].links__peer_node_id})</td></tr> 24 <tr><td colspan="3" align="center"><a href="" onclick="javascript: t = window.open('?page=nodes&subpage=plot_link&a_node={$data[rowl].node_id}&b_node={$data[rowl].links__peer_node_id}', 'popup_plot_link', 'width=600,height=4 20,toolbar=0,resizable=1,scrollbars=1'); t.focus(); return false;"><img src="?page=nodes&subpage=plot&a_node={$data[rowl].node_id}&b_node={$data[rowl].links__peer_node_id}&width=300&height=150" width="300" height="150" alt="{$lang.plot}" /></a></td></tr>24 <tr><td colspan="3" align="center"><a href="" onclick="javascript: t = window.open('?page=nodes&subpage=plot_link&a_node={$data[rowl].node_id}&b_node={$data[rowl].links__peer_node_id}', 'popup_plot_link', 'width=600,height=450,toolbar=0,resizable=1,scrollbars=1'); t.focus(); return false;"><img src="?page=nodes&subpage=plot&a_node={$data[rowl].node_id}&b_node={$data[rowl].links__peer_node_id}&width=300&height=150" width="300" height="150" alt="{$lang.plot}" /></a></td></tr> 25 25 </table> -
trunk/templates/basic/includes/pages/nodes/nodes_plot_link.tpl
r120 r129 35 35 <input class="fld-form-input-pickup" type="text" disabled="disabled" name="a_node_output" value="{$a_node_output|escape}" /> 36 36 </td> 37 <td width="50%" align="center"><input class="fld-form-submit" type="submit" name="submit " value="{$lang.submit}" /></td>37 <td width="50%" align="center"><input class="fld-form-submit" type="submit" name="submitbutton" value="{$lang.submit}" /></td> 38 38 <td width="25%" align="right"> 39 39 {include file=generic/link.tpl content="`$lang.change`" onclick="javascript: t = window.open('?page=pickup&subpage=nodes&object=form_nodes_plot_link.b_node', 'popup_pickup', 'width=700,height=600,toolbar=0,resizable=1,scrollbars=1'); t.focus(); return false;"} … … 47 47 <td align="left"> 48 48 {$lang.azimuth}: {$a_node_azimuth|round:2}°<br /> 49 {$lang.elevation}: {$a_node_ elevation|round:0}m<br />49 {$lang.elevation}: {$a_node_geo_elevation|round:0} (+{$a_node_elevation|round:0}) m<br /> 50 50 {$lang.tilt}: {$a_node_tilt|round:2}° 51 51 </td> 52 52 <td align="center"> 53 {$lang.distance}: {$distance|round:3} km<br /> 54 {$lang.fsl}: {$fsl|round:2} dBm 53 <--- {$lang.distance}: {$distance|round:3} km ---><br /> 54 <span style="color: brown;"> 55 {$lang.fsl}:<br /> 56 {$fsl|round:2} dBm @ 57 <select name="frequency" onchange="this.form.submit();" style="font-size: 10px;"> 58 <option value="2450"{if $frequency == 2450} selected="selected"{/if}>2450</option> 59 <option value="5500"{if $frequency == 5500} selected="selected"{/if}>5500</option> 60 </select> 61 MHz 62 </span> 55 63 </td> 56 64 <td align="right"> 57 65 {$lang.azimuth}: {$b_node_azimuth|round:2}°<br /> 58 {$lang.elevation}: {$b_node_ elevation|round:0}m<br />66 {$lang.elevation}: {$b_node_geo_elevation|round:0} (+{$b_node_elevation|round:0}) m<br /> 59 67 {$lang.tilt}: {$b_node_tilt|round:2}° 60 68 </td> 61 69 </tr> 62 70 <tr> 63 <td height="100%" colspan="3" align="center"><img src=" ?page=nodes&subpage=plot&a_node={$a_node}&b_node={$b_node}&width=570&height=250" width="570" height="250" /></td>71 <td height="100%" colspan="3" align="center"><img src="{$plot_image}&width=570&height=250" width="570" height="250" /></td> 64 72 </tr> 65 73 {else}
Note: See TracChangeset
for help on using the changeset viewer.
