[TIMOB-10808] Android: Refactor/Optimize MapView addRoute/removeRoute logic
| GitHub Issue | n/a | 
|---|---|
| Type | Bug | 
| Priority | High | 
| Status | Closed | 
| Resolution | Fixed | 
| Resolution Date | 2012-09-07T13:18:26.000+0000 | 
| Affected Version/s | Release 3.0.0 | 
| Fix Version/s | Release 3.0.0, Sprint 2012-18 API | 
| Components | Android | 
| Labels | api | 
| Reporter | Hieu Pham | 
| Assignee | Hieu Pham | 
| Created | 2012-09-06T18:08:01.000+0000 | 
| Updated | 2012-12-05T18:21:48.000+0000 | 
Description
	Refactor MapView add/removeRoute to improve performance and memory usage.
Functionality test:
var win = Ti.UI.createWindow({ backgroundColor: '#00f' });
var map = Titanium.Map.createView({
    mapType: Titanium.Map.STANDARD_TYPE,
    region: {
        latitude: 42.3366, longitude: -71.1689,
        latitudeDelta: 0.001, longitudeDelta: 0.004
    }
});
map.addRoute({
    name: '1',
    points: [
        {latitude: 42.3353, longitude: -71.1705 },
        {latitude: 42.3383, longitude: -71.1690 },
        {latitude: 42.3358, longitude: -71.1670 },
        {latitude: 42.3353, longitude: -71.1705 }
    ],
    color: 'red',
    width: 4
});
map.addRoute({
    name: '2',
    points: [
        {latitude: 42.3363, longitude: -71.1682 },
        {latitude: 42.3370, longitude: -71.1686 },
        {latitude: 42.3369, longitude: -71.1692 },
        {latitude: 42.3366, longitude: -71.1695 },
        {latitude: 42.3361, longitude: -71.1690 },
        {latitude: 42.3368, longitude: -71.1685 }
    ],
    color: 'red',
    width: 4
});
win.add(map);
win.open();
The bulk of this ticket is to refactor MapView add/removeRoute to improve memory usage. The performance increase is small/negligible.
Tested with 3.0.0v20121204144658 on Droid 1 2.2.3