Created
April 15, 2013 11:41
-
-
Save PDXIII/5387504 to your computer and use it in GitHub Desktop.
Code snippet for my Unfolding tutorial site.
This file contains hidden or 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
ArrayList <ArrayList> makeAirportLists( | |
UnfoldingMap map, | |
List<Marker> countryMarkers, | |
List<Marker> airportMarkers){ | |
ArrayList <ArrayList> lists = new ArrayList(); | |
// iterating through the countryMarkers | |
for (Marker country : countryMarkers){ | |
// a new ArrayList for each country | |
ArrayList currentMarkerList = new ArrayList(); | |
// iterating through the airportMarkers | |
for (Marker airport : airportMarkers){ | |
// we need to get the Loction of the airport | |
Location airportLocation = airport.getLocation(); | |
// we need do convert it into a ScreenPosition | |
ScreenPosition airportScreenPos = map.getScreenPosition(airportLocation); | |
// and if this ScreenPosition is inside the country | |
if(country.isInside(map, airportScreenPos.x, airportScreenPos.y)){ | |
// we add the Marker to this ArrayList | |
currentMarkerList.add(airport); | |
} | |
} | |
// we add this ArrayList of Markers to our ArrayList of ArrayLists | |
lists.add(currentMarkerList); | |
// to see if the program is running we generate some output | |
println(lists.size()); | |
} | |
airportListsBuild = true; | |
return lists; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment