Пример #1
0
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);
    $map->setScale(1);
    unset($CONF['enable_newmap']);
    $map->type_or_user = -1;
} elseif (isset($_GET['number'])) {
    $map->setOrigin(0, -10);
    $map->setImageSize(900, 1300);
    $map->setScale(1);
    $map->minimum = intval($_GET['number']);
Пример #2
0
 /**
  * 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();
 }
Пример #3
0
 * 
 * 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);
}
//regenerate?