Tuesday, October 21, 2008

Oracle SDO2FreeEarth Step 3

Lastly we'll reference our javascript file in our HTML page to display our points in FreeEarth.

First reference our javascript file:

script type="text/javascript" src="javascript/myfreearthpts.js"

Next declare variables, and functions

var map;

function randomPtPan() {
var ll = map.getTargetLatLng();
var max = ptlocations.length-1; //normally total number of points
var randomPt = Math.floor(Math.random()*max+1);
ll.lat = ptlocations[randomPt][1];
ll.lng = ptlocations[randomPt][2];

map.panTo(ll, 4, 'easeinquad');

_timeout = setTimeout(randomPtPan, 6000);
}

function onMapLoad() {
// The pts variable is defined in myfreeearthpts.js
//map.zoomTo(90000, 1, 'easeinquad')
for(var i=0; i var code = ptlocations[i][0];
var label = new FE.Label(new FE.LatLng(ptlocations[i][1], ptlocations[i][2]), ptlocations[i][3]);
var icon = new FE.Icon('http://freeearth.poly9.com/images/fff/icons/anchor.png');
var marker = new FE.Pushpin(new FE.LatLng(ptlocations[i][1], ptlocations[i][2]), icon);
this.addOverlay(marker);
}
this.toggleAtmosphere();
setTimeout(randomPtPan, 1);
}

function load() {
map = new FE.Map(document.getElementById("map"));
map.onLoad = onMapLoad;
map.load();
}

No comments: