$outFile = '/tmp/binaryout.png'; $driver = new Java('LatLongInterpolation.LatLngDriver', $bandHashMap); $r = $driver->getContours($allData['ozoneStations'], $allData['windStations'], $allData['ozoneValues'], $allData['windSpeed'], $allData['windDirection'], $stepSize); $responseObject = prepareResponseObject(java_values($r), $monthStartEpoch); if (!empty($allData['ozoneStations'])) { for ($i = 0; $i < count($allData['ozoneStations']); $i++) { $lat = $allData['ozoneStations'][$i][0]; $lng = $allData['ozoneStations'][$i][1]; $o3 = $allData['ozoneValues'][0][$i]; $siteDesc = "({$lat},{$lng})|{$allData['ozoneValues'][0][$i]}"; $responseObject['station'][] = array('lat' => $lat, 'lng' => $lng, 'o3' => $o3, 'desc' => $siteDesc); } } $end = microtime(true); include_once 'nebula/dochead.inc'; echo "<pre>Using Band Schema '" . $bandHelper->getSchemeId() . "' " . implode(",", $ozoneBand) . "\n"; print "Execution Time : " . ($end - $start) . "sec\n"; print "</pre>"; if (!empty($outFile)) { $retval = 0; system("cp {$outFile} ./testout.png", $retval); if ($retval == 0) { print "<img src='testout.png' " . "style='position:absolute;top:10px;right:50px' />"; } system("cp /tmp/binaryoutk.png ./testoutk.png", $retval); if ($retval == 0) { print "<img src='testoutk.png' " . "style='position:absolute;top:10px;right:150px' />"; } } print '<div id="panel">'; print '<form method="post" style="display:inline-block">';
$queryTime = 0; $gridTime = 0; $contourTime = 0; // query based on timestamp $readOnly = false; // disable gzip -- TMH 2012/07/13 $useGzip = false; // pad with JSONP -- TMH 2012/07/20 $useJSONP = true; // keep history -- TMH 2012/08/31 $keepHistory = false; // grid Updated time $updatedTime = -1; $phpStart = microtime(true); $queryManager = new QueryManager($readOnly); $contourDataStore = new ContourCacheHelper($useGzip, $bandHelper->getSchemeId()); $phpTime = microtime(true) - $phpStart; // Check if $txnAt for $timestamp is older than specified right now, // then only proceed. Otherwise just exit from here // Honour force flag if is set $lastTxnAt = $txnAt; if ($txnAt >= 0) { $lastTxnAt = $queryManager->getGridUpdatedTime($timestamp); } if ($txnAt >= 0 && $lastTxnAt >= $txnAt) { echo "Grid last updated with txn stamp [{$lastTxnAt}]," . " more recent than / equal to [{$txnAt}]\n"; echo "Use force write if it was intended to forcefully update data"; exit(0); } $midTime = microtime(true); $queryStart = microtime(true);
} $bandSchema = 0; if (!empty($_REQUEST['bandschema'])) { $bandSchema = intval($_REQUEST['bandschema']); } // forece using JSONP by default $use_jsonp = true; // option to return JSON, instead of jsonp if (isset($_REQUEST['forcejson']) && $_REQUEST['forcejson'] == 1) { $use_jsonp = false; } //$useGzip = true; $useGzip = false; $queryManager = new QueryManager(); $bandHelper = new DiscreteBandHelper(DiscreteBandHelper::LABEL_TYPE_BAND, $bandSchema); $contourDataStore = new ContourCacheHelper($useGzip, $bandHelper->getSchemeId()); $ozoneBand = $bandHelper->getBand(); //$bandHashMap = new Java("java.util.HashMap"); //foreach($ozoneBand as $key => $val) { // $bandHashMap->put($key, doubleval($val)); //} $timestamp = ''; if (isset($_REQUEST['timestamp']) && is_numeric($_REQUEST['timestamp'])) { $timestamp = $_REQUEST['timestamp']; $month = date('m', $timestamp); $day = date('d', $timestamp); $year = date('Y', $timestamp); $hour = date('H', $timestamp); $min = date('i', $timestamp); $min = intval($min) - intval($min) % 5; $timestamp = mktime($hour, $min, 0, $month, $day, $year);