Changeset 9026 for src/django_gheat/gheat
- Timestamp:
- Apr 6, 2011, 4:23:50 PM (14 years ago)
- Location:
- src/django_gheat/gheat
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/django_gheat/gheat/__init__.py
r9006 r9026 31 31 32 32 SIZE = 256 # size of (square) tile; NB: changing this will break gmerc calls! 33 MAX_ZOOM = 31# this depends on Google API; 0 is furthest out as of recent ver.33 MAX_ZOOM = 17 # this depends on Google API; 0 is furthest out as of recent ver. 34 34 35 35 -
src/django_gheat/gheat/base.py
r9006 r9026 8 8 import gheat 9 9 import gheat.opacity 10 from gheat.models import Point10 from gheat.models import Accespoint, Gebruiker, Meting 11 11 from gheat import gheatsettings as settings 12 12 from gheat import gmerc … … 164 164 SELECT count(uid) FROM points 165 165 """ 166 numpoints = Point.objects.num_points(self)166 numpoints = Meting.objects.num_points(self) 167 167 return numpoints == 0 168 168 … … 178 178 179 179 timestamp = os.stat(self.fspath)[stat.ST_MTIME] 180 modtime= datetime.datetime.fromtimestamp(timestamp)181 182 numpoints = Point.objects.num_points(self, modtime)180 datum = datetime.datetime.fromtimestamp(timestamp) 181 182 numpoints = Meting.objects.num_points(self, datum) 183 183 184 184 return numpoints > 0 … … 194 194 # to be included on this tile, relative to the top-left of the tile. 195 195 196 _points = Point.objects.points_inside(self)196 _points = Meting.objects.points_inside(self) 197 197 198 198 def points(): … … 204 204 x = x - self.x1 # account for tile offset relative to 205 205 y = y - self.y1 # overall map 206 point_ density = point.density207 while point_ density> 0:206 point_signaal = point.signaal 207 while point_signaal > 0: 208 208 result.append((x-self.pad,y-self.pad)) 209 point_ density = point_density- 1209 point_signaal = point_signaal - 1 210 210 return result 211 211 -
src/django_gheat/gheat/managers.py
r9006 r9026 2 2 from django.db import models 3 3 4 class PointManager(models.Manager):4 class MetingManager(models.Manager): 5 5 6 6 def actives(self): … … 17 17 longitude__lte=lng1, 18 18 longitude__gte=lng2, 19 density__gt=0,19 signaal__gt=0, 20 20 ) 21 21 return qs -
src/django_gheat/gheat/models.py
r9006 r9026 1 1 from django.db import models 2 2 from gheat import managers 3 import datetime 3 4 4 # Create your models here.5 class Point(models.Model):6 """7 A simple representation of a point inside the gheat database8 """9 uid = models.CharField(max_length=100, name='unique identifier')10 latitude = models.FloatField(name='Latitude', db_column='lat', blank=True)11 longitude = models.FloatField(name='Longitude', db_column='lng', blank=True)12 modtime = models.DateTimeField(auto_now = True,13 name='Last modification time', null=True)14 density = models.PositiveIntegerField(default=0, editable=False,15 name='density of the current point')16 5 17 objects = managers.PointManager() 6 class Accespoint(models.Model): 7 mac = models.CharField(max_length=17) 8 ssid = models.CharField(max_length=64) 9 encryptie = models.BooleanField() 10 def __unicode__(self): 11 return (self.mac, self.ssid) 18 12 19 class Meta: 20 unique_together = ('uid',) 13 14 class Gebruiker(models.Model): 15 gebruiker = models.CharField(max_length=64) 16 apparatuur = models.CharField(max_length=64) 17 def __unicode__(self): 18 return (self.gebruiker, self.apparatuur) 19 20 21 class Meting(models.Model): 22 accespoint = models.ForeignKey(Accespoint) 23 gebruiker = models.ForeignKey(Gebruiker) 24 latitude = models.FloatField(name='Latitude', db_column='lat') 25 longitude = models.FloatField(name='Longitude', db_column='lng') 26 signaal = models.IntegerField(max_length=3) 27 datum = models.DateTimeField() 28 29 objects = managers.MetingManager()
Note:
See TracChangeset
for help on using the changeset viewer.