Created
October 16, 2014 01:04
-
-
Save bguidolim/6680d0cb06a0d99a9de7 to your computer and use it in GitHub Desktop.
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
var Mods = require('/ModulePaths'); | |
var Map = require('com.guidolim.ticlusteredmapkit'); | |
var mapview = Map.createView({ | |
mapType:Map.NORMAL_TYPE, | |
width: Ti.UI.FILL, | |
height: Ti.UI.FILL | |
}); | |
var data = Array(); | |
AddAnnotations = function(){ | |
var fileName = 'MOCK_DATA.json'; | |
var file = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory, fileName); | |
Ti.API.info(file); | |
var preParseData = file.read(); | |
var response = JSON.parse(preParseData); | |
for (var i=0; i < response.length; i++) { | |
var obj = response[i]; | |
var annotation = Map.createAnnotation({ | |
latitude: obj.latitude, | |
longitude: obj.longitude, | |
pincolor: Map.ANNOTATION_RED, | |
title: obj.address | |
}); | |
data.push(annotation); | |
}; | |
mapview.setAnnotations(data); | |
}; | |
Window = function() { | |
var w = Ti.UI.createWindow(); | |
AddAnnotations(); | |
mapview.addEventListener("click", function(e){ | |
if(e.clicksource == 'rightButton' || e.clicksource == 'rightPane') { | |
if(e.annotation.multiEvents){ | |
var chooseW = require("chooseevent")(e.annotation.multiEvents); | |
Ti.App.tabgroup.activeTab.open(chooseW); | |
}else{ | |
var profileW = require("eventprofile")(e.annotation.evt); | |
Ti.App.tabgroup.activeTab.open(profileW); | |
} | |
} | |
}); | |
w.add(mapview); | |
return w; | |
}; | |
module.exports = Window; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment