Login   Register  
PHP Classes
elePHPant
Icontem

File: gpxDrawer.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of david boardman  >  GPX Mapper & CMS  >  gpxDrawer.php  >  Download  
File: gpxDrawer.php
Role: Example script
Content type: text/plain
Description: gpxDrawer class callback
Class: GPX Mapper & CMS
Save maps GPX location files from coordinates
Author: By
Last change:
Date: 2006-11-09 12:50
Size: 2,689 bytes
 

Contents

Class file image Download
<?
/*        
    GPX Drawer
    Version: 1.0 
    Author: David Boardman
    URL: http://www.netzfunk.org/?usr=d
    Licenced under Creative Commons Attribution-NonCommercial-ShareAlike 2.5
    If redistributed in any form, please include credits and a link to http://www.netzfunk.org/?usr=d
*/
include('inc/config.php');
set_time_limit($config['timelimit']);
require_once(
"cls/cls.gpxDrawer.php");
require_once(
'cls/cls.SofeeXmlParser.php'); 
// VARS
$path=$config['mainfolder'].$config['mapfolder'];
$pathgpx=$config['mainfolder'].$config['gpxfolder']."/";
$mapname="nome_mappa";
$mapwidth=1650// larghezza mappa
$mapheight=1100// altezza mappa
$scale=2200// scala
$xmlfile="esempioGPX.xml";
$legenda=1// posizione della legenda (1:alto-sx; 2:alto-dx; 3:basso-sx; 4:basso-dx;)
$context=1;
// PARSING FILE GPX
$xml = new SofeeXmlParser(); 
$xml->parseFile($pathgpx,$xmlfile); 
$tree $xml->getTree(); 
unset(
$xml); 
// ISTANZA GPX DRAWER
$gps=new gpxDrawer($mapwidth,$mapheight,$mapname,$path,$tree,$scale,$legenda,$context);
// COLLECT DATA
$meta=$gps->collectMETA();
$wpt=$gps->collectWPT();
//$rte=$gps->collectRTE();
//$trk=$gps->collectTRK();
$trkpt=$gps->collectTRKPT();
// BUILD MAP
$gps->drawMap();
$area=$gps->getMapArea();
echo 
"<h5>Distanza percorsa ".$gps->getPathDistance()."km</h5>";
?>
<html>
<head>
<title></title>
<style>
h1 { 
    font-size:18px 
}    
a:link { 
    color:#33c 
}    
a:visited { 
    color:#339 
}    
/* This is where you can customize the appearance of the tooltip */
div#tipDiv {
  position:absolute; 
  visibility:hidden; 
  left:0; 
  top:0; 
  z-index:10000;
  background-color:#dee7f7; 
  border:1px solid #336; 
  width:250px; 
  padding:4px;
  color:#000; 
  font-size:11px; 
  line-height:1.2;
}
/* These are optional. They demonstrate how you can individually format tooltip content  */
div.tp1 { 
    font-size:12px; 
    color:#336; 
    font-style:italic 
}
div.tp2 { 
    font-weight:bolder; 
    color:#337; 
    padding-top:4px 
}
</style>
<script type="text/javascript" src="inc/js/initTooltip.js"></script>
<script type="text/javascript">
function showPOI(poi){
    var x=window.open('poi/'+poi,'poi','left=250,top=200,width=245,height=320,toolbar=no,statusbar=no,location=no,addressbar=no,resizable=no');
    x.focus();
}
</script>
</head>
<body>
<?
echo $gps->outMetaData();
?>
<img src="<?=$config['mapfolder']?>/map_<?=$mapname?>.png" border="0" usemap="#gpsmap" width="<?=$mapwidth?>" height="<?=$mapheight;?>"/>
<map name="gpsmap">
<?=$area?>
</map>
<script src="inc/js/dw_event.js" type="text/javascript"></script>
<script src="inc/js/dw_viewport.js" type="text/javascript"></script>
<script src="inc/js/dw_tooltip.js" type="text/javascript"></script>
</body>
</html>