Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Made getCellsUnderIndex use indices instead of lonLat

  • Loading branch information...
commit 7fe17166f9ccc3159dfadca0e351b9de063ef0a2 1 parent 9814841
@jrasky jrasky authored
View
0  example/moar_django/__init__.py
No changes.
View
3  example/moar_django/models.py
@@ -0,0 +1,3 @@
+from django.db import models
+
+# Create your models here.
View
23 example/moar_django/tests.py
@@ -0,0 +1,23 @@
+"""
+This file demonstrates two different styles of tests (one doctest and one
+unittest). These will both pass when you run "manage.py test".
+
+Replace these with more appropriate tests for your application.
+"""
+
+from django.test import TestCase
+
+class SimpleTest(TestCase):
+ def test_basic_addition(self):
+ """
+ Tests that 1 + 1 always equals 2.
+ """
+ self.failUnlessEqual(1 + 1, 2)
+
+__test__ = {"doctest": """
+Another way to test that 1 + 1 is equal to 2.
+
+>>> 1 + 1 == 2
+True
+"""}
+
View
1  example/moar_django/views.py
@@ -0,0 +1 @@
+# Create your views here.
View
12 geocamLayer/models.py
@@ -132,14 +132,12 @@ def getCellAtLonLat(zoom, lonLat):
@staticmethod
def getCellsUnderIndex(zoom, x, y):
cell = QuadTreeCell.getCellAtIndex(zoom, (x, y))
- if cell.isLeaf: return None
+ if cell.isLeaf: return []
cells = []
- zoom, lng, lat = QuadTreeCell.getLonLatAtIndex(zoom, (x, y))
- size = QuadTreeCell.getSizeForZoom(zoom)
- cells.append(QuadTreeCell.getCellAtLonLat(zoom+1, (lng,lat)))
- cells.append(QuadTreeCell.getCellAtLonLat(zoom+1, (lng+size,lat)))
- cells.append(QuadTreeCell.getCellAtLonLat(zoom+1, (lng,lat+size)))
- cells.append(QuadTreeCell.getCellAtLonLat(zoom+1, (lng+size,lat+size)))
+ cells.append(QuadTreeCell.getCellAtIndex(zoom+1, (2 * x, 2 * y)))
+ cells.append(QuadTreeCell.getCellAtIndex(zoom+1, ((2 * x) + 1, 2 * y)))
+ cells.append(QuadTreeCell.getCellAtIndex(zoom+1, (2 * x, (2 * y) + 1)))
+ cells.append(QuadTreeCell.getCellAtIndex(zoom+1, ((2 * x) + 1,(2 * y) + 1)))
return cells
@staticmethod
Please sign in to comment.
Something went wrong with that request. Please try again.