Changeset 497
- Timestamp:
- 02/18/08 17:22:26 (7 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/processing/sketches/modest_maps_interactive/InteractiveMap.java
r496 r497 49 49 // for loading tiles from the inside first 50 50 QueueSorter queueSorter = new QueueSorter(); 51 52 /** default to Microsoft Hybrid */ 53 InteractiveMap(PApplet p) { 54 this(p, new Microsoft.HybridProvider()); 55 } 56 57 /** new map using applet width and height, and given provider */ 58 InteractiveMap(PApplet p, AbstractMapProvider provider) { 59 this(p, provider, p.width, p.height); 60 } 51 61 52 62 /** make a new interactive map, using the given provider, of the given width and height */ … … 298 308 299 309 void setMapProvider(AbstractMapProvider provider) { 300 this.provider = provider; 301 images.clear(); 302 queue.clear(); 303 pending.clear(); 310 if (this.provider.getClass() != provider.getClass()) { 311 this.provider = provider; 312 images.clear(); 313 queue.clear(); 314 pending.clear(); 315 } 304 316 } 305 317 trunk/processing/sketches/modest_maps_interactive/modest_maps_interactive.pde
r496 r497 2 2 InteractiveMap map; 3 3 4 ZoomButton in, out; 5 PanButton up, down, left, right; 6 Button[] buttons; 4 ZoomButton out = new ZoomButton(5,5,14,14,false); 5 ZoomButton in = new ZoomButton(22,5,14,14,true); 6 PanButton up = new PanButton(14,25,14,14,UP); 7 PanButton down = new PanButton(14,57,14,14,DOWN); 8 PanButton left = new PanButton(5,41,14,14,LEFT); 9 PanButton right = new PanButton(22,41,14,14,RIGHT); 10 11 Button[] buttons = { in, out, up, down, left, right }; 12 13 float startTx, endTx; 14 float startTy, endTy; 15 float startSc, endSc; 16 17 int startTime; 18 int duration; 7 19 8 20 void setup() { … … 16 28 }); 17 29 18 map = new InteractiveMap(this , new Microsoft.HybridProvider(), width, height);30 map = new InteractiveMap(this); 19 31 20 Location location = new Location(37.784, -122.406); // san francisco 21 22 map.setCenterZoom(location, 18); 23 24 out = new ZoomButton(5,5,14,14,false); 25 in = new ZoomButton(22,5,14,14,true); 26 up = new PanButton(14,25,14,14,UP); 27 down = new PanButton(14,57,14,14,DOWN); 28 left = new PanButton(5,41,14,14,LEFT); 29 right = new PanButton(22,41,14,14,RIGHT); 30 31 buttons = new Button[] { 32 in, out, up, down, left, right }; 32 // London from getlatlon.com, thanks Simon! 33 map.setCenterZoom(new Location(51.500152, -0.126236), 11); 33 34 34 35 textFont(createFont("Helvetica", 12), 12); 35 36 37 startTime = millis() + 1000; 38 duration = 5000; 36 39 } 37 40
