/** * get pan url, if possible - return empty string if limit is hit * @param xdir = amount of left/right panning, e.g. -1 to pan left * @param ydir = amount of up/down panning, e.g. 1 to pan up * @access public */ function getPanToken($xdir, $ydir) { $out = new GeographMap(); //no panning unless you are zoomed in if ($this->pixels_per_km >= 1) { //start with same params $out->setScale($this->pixels_per_km); $out->setImageSize($this->image_w, $this->image_h); $out->type_or_user = $this->type_or_user; //pan half a map //figure out image size in km $mapw = $out->image_w / $out->pixels_per_km; $maph = $out->image_h / $out->pixels_per_km; //figure out how many pixels to pan by $panx = round($mapw / 2); $pany = round($maph / 2); $out->setOrigin($this->map_x + $panx * $xdir, $this->map_y + $pany * $ydir, true); } return $out->getToken(); }
* * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ require_once 'geograph/global.inc.php'; require_once 'geograph/gridsquare.class.php'; /************************** * Coverage Maps */ if (isset($_GET['map'])) { require_once 'geograph/map.class.php'; require_once 'geograph/mapmosaic.class.php'; require_once 'geograph/gridimage.class.php'; //render and return a map with token $_GET['map']; $map = new GeographMap(); if (isset($_GET['refresh']) && $_GET['refresh'] == 2 && (init_session() || true) && $USER->hasPerm('admin')) { $map->caching = false; } if ($map->setToken($_GET['map'])) { $map->returnImage(); } exit; /************************** * Raster Maps */ } elseif (isset($_GET['r'])) { require_once 'geograph/rastermap.class.php'; $square = false; $rastermap = new RasterMap($square); if (isset($_GET['debug']) || isset($_GET['refresh'])) {
* but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ require_once 'geograph/global.inc.php'; require_once 'geograph/gridsquare.class.php'; require_once 'geograph/gridimage.class.php'; require_once 'geograph/map.class.php'; require_once 'geograph/mapmosaic.class.php'; require_once 'geograph/image.inc.php'; init_session(); $map = new GeographMap(); if (isset($_GET['key'])) { $map->_outputDepthKey(); } if (isset($_GET['refresh']) && $_GET['refresh'] == 2 && $USER->hasPerm('admin')) { $map->caching = false; } $map->setOrigin(0, -10); $map->setImageSize(1200 / 2, 1700 / 2); $map->setScale(1.3 / 2); $year = !empty($_GET['year']) ? intval($_GET['year']) : date('Y'); if ((!isset($_GET['year']) || !empty($_GET['year'])) && $year >= 2004 && $year <= date('Y')) { $map->type_or_user = -1 * $year; } elseif (isset($_GET['depth'])) { $map->setOrigin(0, -10); $map->setImageSize(900, 1300);
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ require_once 'geograph/global.inc.php'; require_once 'geograph/gridsquare.class.php'; require_once 'geograph/gridimage.class.php'; require_once 'geograph/map.class.php'; require_once 'geograph/mapmosaic.class.php'; require_once 'geograph/image.inc.php'; init_session(); $smarty = new GeographPage(); $map = new GeographMap(); $map->setOrigin(0, -10); $map->setImageSize(1200, 1700); $map->setScale(1.3); $map->type_or_user = -60; $target = $_SERVER['DOCUMENT_ROOT'] . $map->getImageFilename(); $template = 'stuff_thumbnail.tpl'; $cacheid = $map->type_or_user * -1; $smarty->caching = 2; // lifetime is per cache $smarty->cache_lifetime = 3600 * 7 * 24; //7 day cache (as search can be cached - and we manually refreshed anyway if (!empty($_GET['refresh']) && $USER->hasPerm("admin")) { unlink($target); $map->_renderMap(); $smarty->clear_cache($template, $cacheid);
* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ require_once 'geograph/global.inc.php'; require_once 'geograph/gridsquare.class.php'; require_once 'geograph/gridimage.class.php'; require_once 'geograph/map.class.php'; require_once 'geograph/mapmosaic.class.php'; init_session(); $smarty = new GeographPage(); customGZipHandlerStart(); //initialise map $map = new GeographMap(); if (isset($_GET['t'])) { $ok = $map->setToken($_GET['t']); if (!$ok) { die("Invalid Token"); } } else { die("Missing Token"); } if ($map->pixels_per_km != 40 && $map->pixels_per_km != 4) { die("Invalid Parameter"); } if (isset($_GET['mine']) && $USER->hasPerm("basic")) { $map->type_or_user = $USER->user_id; } elseif (isset($_GET['u'])) { if (!empty($_GET['u'])) {
while (1) { $invalid_maps = $db->GetOne("select count(*) from mapcache where age > 0 and type_or_user >= -1"); if ($invalid_maps) { //done as many small select statements to allow new maps to be processed $recordSet =& $db->Execute("select * from mapcache where age > 0 and type_or_user >= -1\n\t\t\torder by pixels_per_km desc, age desc limit 50"); while (!$recordSet->EOF) { //sleep until calm if we've specified a load average if ($param['load'] < 100) { while (get_loadavg() > $param['load']) { sleep($param['sleep']); if (time() > $end_time) { exit; } } } $map = new GeographMap(); foreach ($recordSet->fields as $name => $value) { if (!is_numeric($name)) { $map->{$name} = $value; } } $ok = $map->_renderMap(); echo ($ok ? 're-rendered ' : 'FAILED: ') . $map->getImageFilename() . "\n"; flush(); if (time() > $end_time) { $recordSet->Close(); //well come to the end of the scripts useful life exit; } $recordSet->MoveNext(); }
} $smarty->display('_std_end.tpl'); exit; //do some processing? } else { if (isset($_POST['go'])) { if (isset($_POST['limit']) && preg_match("/^\\d+(,\\d+|)?\$/", $_POST['limit'])) { $limit = $_POST['limit']; } else { $limit = 10; } //this takes a long time, so we output a header first of all $smarty->display('_std_begin.tpl'); echo "<h3><a href=\"recreatemaps.php\"><<</a> Re-Creating Maps...</h3>"; flush(); $map = new GeographMap(); $recordSet =& $db->Execute("select * from mapcache where age > 0 order by pixels_per_km desc, age desc limit {$limit}"); while (!$recordSet->EOF) { foreach ($recordSet->fields as $name => $value) { if (!is_numeric($name)) { $map->{$name} = $value; } } $map->_renderMap(); echo "<li>re-rendered " . $map->getImageFilename() . "</li>"; flush(); $recordSet->MoveNext(); } $recordSet->Close(); $smarty->display('_std_end.tpl'); exit;
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ require_once 'geograph/global.inc.php'; require_once 'geograph/gridsquare.class.php'; require_once 'geograph/gridimage.class.php'; require_once 'geograph/map.class.php'; require_once 'geograph/mapmosaic.class.php'; if (isset($_GET['map'])) { require_once 'geograph/image.inc.php'; //render and return a map with token $_GET['map']; $map = new GeographMap(); if (isset($_GET['refresh']) && $_GET['refresh'] == 2 && (init_session() || true) && $USER->hasPerm('admin')) { $map->caching = false; } $map->setToken($_GET['map']); $map->returnImage(); exit; } init_session(); $template = 'mapbrowse.tpl'; $smarty = new GeographPage(); customGZipHandlerStart(); //initialise mosaic $mosaic = new GeographMapMosaic(); $overview = new GeographMapMosaic('overview'); if (isset($_GET['o'])) {