Created
December 9, 2011 10:06
-
-
Save sharpred/1450967 to your computer and use it in GitHub Desktop.
map code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
win.addEventListener('focus',function() { | |
//create map annotation | |
longitude = -1.7933350801467896; | |
latitude = 51.531768798828125; | |
objLocationAnnotation = Titanium.Map.createAnnotation({ | |
latitude: latitude, | |
longitude: longitude, | |
title:"Issue", | |
animate:true | |
}); | |
//create map | |
Ti.API.debug('latitude: ' +latitude); | |
Ti.API.debug('longitude: ' +longitude); | |
var mapView = Ti.UI.createView($$.stretch); | |
var map = Titanium.Map.createView({ | |
mapType: Titanium.Map.STANDARD_TYPE, | |
region:{ | |
//locations are hard coded as a test | |
latitude:latitude, | |
longitude:longitude, | |
latitudeDelta:0.02, | |
longitudeDelta:0.02 | |
}, | |
top:80, | |
animate:true, | |
regionFit:true, | |
userLocation:true, | |
annotations:[objLocationAnnotation] | |
}); | |
Ti.API.debug('using ' +objLocationAnnotation.latitude +' and ' +objLocationAnnotation.longitude +' for mapping'); | |
map.addAnnotation(objLocationAnnotation); | |
mapView.add(map); | |
//render mapview to image | |
mapImage = mapView.toImage(); | |
var mapfileName = new Date().getTime() + "map.jpg"; | |
mapFile = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,mapfileName); | |
mapFile.write(mapImage); | |
Ti.API.debug('writing ' +mapfileName +' to file'); | |
//end of focus event listener | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment