]> git.openstreetmap.org Git - rails.git/blob - public/javascripts/main.js
get new slippy map in rails
[rails.git] / public / javascripts / main.js
1 /*
2     Copyright (C) 2004-05 Nick Whitelegg, Hogweed Software, nick@hogweed.org 
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the Lesser GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     Lesser GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
17
18 */
19
20 // These are functions which manipulate the slippy map in various ways
21 // The idea has been to try and clean up the slippy map API and take code
22 // which does not manipulate it directly outside.
23
24 var view=0, tileURL, tile_engine; 
25
26 function init()
27 {
28         tileURL = 'http://tile.openstreetmap.org/ruby/wmsmod.rbx';
29         tile_engine = new tile_engine_new('drag','FULL','',tileURL,lon,lat,zoom,700,500);
30
31         tile_engine.setURLAttribute("landsat",1);
32
33         document.getElementById('zoomout').onclick = zoomOut;
34         document.getElementById('zoomin').onclick = zoomIn;
35         /*
36         document.getElementById('landsat').onclick = landsatToggle;
37         */
38
39         //document.getElementById('posGo').onclick = setPosition;
40 }
41
42 function zoomIn()
43 {
44         tile_engine.tile_engine_zoomin();
45 }
46
47 function zoomOut()
48 {
49         tile_engine.tile_engine_zoomout();
50 }
51
52 function enableTileEngine()
53 {
54         tile_engine.event_catch();
55 }
56
57 function landsatToggle()
58 {
59         var lsat = tile_engine.getURLAttribute("landsat");
60         tile_engine.setURLAttribute("landsat", (lsat) ? 0: 1);
61         tile_engine.forceRefresh();
62 }
63
64 function setPosition()
65 {
66         /*
67         var txtLat = document.getElementById("txtLat"),
68                 txtLon = document.getElementById("txtLon");
69
70         tile_engine.setLatLon(txtLat, txtLon);
71         */
72 }