Guest User

Untitled

a guest
Jan 22nd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. var win = Ti.UI.currentWindow;
  2.  
  3. var mapview;
  4. var points = [];
  5.  
  6. function loadWebView(pointId) {
  7.  
  8. }
  9.  
  10. for(var i=0; i < Locations.length; i++) // Locations is an array of name, lat/lon objects
  11. {
  12. var point = Locations[i];
  13. if(point.url !== undefined)
  14. {
  15. var annote = Ti.Map.createAnnotation({
  16. latitude:point.lat,
  17. longitude:point.lon,
  18. title:point.name,
  19. subtitle:point.desc,
  20. pincolor:Ti.Map.ANNOTATION_GREEN,
  21. rightButton: Titanium.UI.iPhone.SystemButton.DISCLOSURE,
  22. animate:true,
  23. pointId:i
  24. });
  25. annote.addEventListener('click', function(e) {
  26. loadWebView(i);
  27. });
  28. points.push(annote);
  29. }
  30. else
  31. {
  32. points.push(Ti.Map.createAnnotation({
  33. latitude:point.lat,
  34. longitude:point.lon,
  35. title:point.name,
  36. subtitle:point.desc,
  37. animate:true,
  38. pointcolor:Ti.Map.ANNOTATION_GREEN
  39. }));
  40. }
  41. }
  42.  
  43. var mapview = Ti.Map.createView({
  44. mapType: Ti.Map.STANDARD_TYPE,
  45. region:{latitude:options.Lat, longitude:options.Lon, latitudeDelta:0.03, longitudeDelta:0.03},
  46. animate:true,
  47. regionFit:true
  48. });
  49.  
  50. win.add(mapview);
  51.  
  52. for(var i=0; i<points.length; i++)
  53. {
  54. mapview.addAnnotation(points[i]);
  55. }
  56. if (points !== [])
  57. {
  58. mapview.selectAnnotation(points[0]);
  59. }
Add Comment
Please, Sign In to add comment