[Phphtmllib-devel] SF.net SVN: phphtmllib:[3474] trunk/open2300/lib/modules/api/ AviationWeather.in
Status: Beta
                
                Brought to you by:
                
                    hemna
                    
                
            | 
      
      
      From: <he...@us...> - 2010-06-16 23:24:26
      
     | 
| Revision: 3474
          http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3474&view=rev
Author:   hemna
Date:     2010-06-16 23:24:20 +0000 (Wed, 16 Jun 2010)
Log Message:
-----------
bleh
Modified Paths:
--------------
    trunk/open2300/lib/modules/api/AviationWeather.inc
Modified: trunk/open2300/lib/modules/api/AviationWeather.inc
===================================================================
--- trunk/open2300/lib/modules/api/AviationWeather.inc	2010-06-16 22:48:09 UTC (rev 3473)
+++ trunk/open2300/lib/modules/api/AviationWeather.inc	2010-06-16 23:24:20 UTC (rev 3474)
@@ -61,7 +61,6 @@
 			if ($airport != null) {
 				$wxInfo["runways"] = $this->get_runways($airport, $wxInfo);								
 			}
-
 			$this->metars[] = $wxInfo;
 			//need to combine this info w/ the airport data cache.
 		}
@@ -70,16 +69,18 @@
 	}
 	
 	protected function get_runways(&$airport, &$wxInfo) {
-		$runways = $airport["runways"];
+		$runways = &$airport["runways"];
 		$info = array();
-		
+	
+
 		foreach($runways as &$runway) {
 			$width = $runway["runway_width"] * 3.2808399;
-			$info[] = array("number" => $runway["runway_number"],
+			$xw = $this->do_crosswind($runway, $wxInfo["Wind"]);					
+			$info[] = array("runway" => $runway["runway_number"],
 			                "length" => $runway["length"],
-			                "width" => $width);
-			$xw = $this->do_crosswind($runway, $wxInfo["Wind"]);					
+								 "crosswind" => $runway["crosswind"]);								 											
 		}
+
 		
 		return $info;
 	}
@@ -97,13 +98,29 @@
 		$diff = abs($left_right);
 		$p = .0174*$diff;
 		
-		$q = abs($speed*sin($p));
-		$m = abs($speed*cos($p));
+		$q = round(abs($speed*sin($p)));
+		$m = round(abs($speed*cos($p)));
 		
 		$runway["crosswind2"] = $q;
 		$runway["headwind"] = $m;
-		
-		
+
+		if ($left_right <0) {
+  		   $runway["xw_direction"] =  "left";
+		} else if ($left_right > 0) {
+  		   $runway["xw_direction"] =  "right";
+		} else if ($left_right == 0 || $left_right == 360 || 
+		           $left_right == 180) {
+		   $runway["xw_direction"] = "none";
+	   }
+
+		if ($diff < 90 || $diff > 270) {
+		    $runway["xw_head"] = "headwind";
+		} else {
+		    $runway["xw_head"] = "tailwind";
+	   }
+
+      $runway["crosswind"] = $q."kt ".$runway["xw_direction"]." ".$runway["xw_head"];
+	
 //		
 //		l = Rway.runwayd.value;
 //				n = Rway.wdirection.value;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |