# Path: osm_data_processing/models.py
# class OsmPoint(OsmModel):
#     the_geom = geomodels.PointField()
#     name = models.CharField(verbose_name=_('Name'), max_length=400, null=True, blank=True)
#     amenity = models.CharField(max_length=200, null=True, blank=True)
#     description = models.CharField(verbose_name=_('Description'), max_length=200, null=True, blank=True)
#     ele = models.CharField(verbose_name=_('Elevation'), max_length=200, null=True, blank=True)
#     highway = models.CharField(max_length=200, null=True, blank=True)
#     historic = models.CharField(max_length=200, null=True, blank=True)
#     information = models.CharField(max_length=200, null=True, blank=True)
#     leisure = models.CharField(max_length=200, null=True, blank=True)
#     man_made = models.CharField(max_length=200, null=True, blank=True)
#     natural = models.CharField(max_length=200, null=True, blank=True)
#     noexit = models.CharField(max_length=200, null=True, blank=True)
#     opening_hours = models.CharField(verbose_name=_('Opening hours'), max_length=200, null=True, blank=True)
#     place = models.CharField(max_length=200, null=True, blank=True)
#     protect_class = models.CharField(max_length=200, null=True, blank=True)
#     railway = models.CharField(max_length=200, null=True, blank=True)
#     ref = models.CharField(verbose_name=_('Reference code'), max_length=200, null=True, blank=True)
#     ruins = models.CharField(max_length=200, null=True, blank=True)
#     shop = models.CharField(verbose_name=_('Shop type'), max_length=200, null=True, blank=True)
#     sport = models.CharField(max_length=200, null=True, blank=True)
#     tourism = models.CharField(max_length=200, null=True, blank=True)
# 
#     objects = geomodels.GeoManager()
# 
#     def osm_link(self, url='http://www.openstreetmap.org/browse/', geometry='node'):
#         return super(OsmPoint, self).osm_link(url, geometry)
# 
# class OsmLine(OsmModel):
#     the_geom = geomodels.LineStringField()
#     name = models.CharField(verbose_name=_('Name'), max_length=400, null=True, blank=True)
#     mtbscale = models.CharField(verbose_name=_('MTB scale'), max_length=200, null=True, blank=True)
#     mtbdescription = models.CharField(verbose_name=_('MTB description'), max_length=200, null=True, blank=True)
#     mtbscaleuphill = models.CharField(verbose_name=_('MTB scale uphill'), max_length=200, null=True, blank=True)
# 
#     objects = geomodels.GeoManager()


import simplejson as json
from transmeta import TransMeta
from django.db import models
from django.contrib.gis.geos import Polygon
from django.utils.translation import ugettext_lazy as _
from osm_data_processing.models import OsmPoint, OsmLine
# Django imports

# Local imports


class TileLayer(models.Model):
    __metaclass__ = TransMeta

    slug = models.SlugField(max_length=200, unique=True)
    name = models.CharField(verbose_name=_('name'), max_length=200)
    attribution = models.CharField(max_length=400)
    url = models.CharField(max_length=400)
    last_update = models.DateField(null=True, blank=True)

    class Meta:
        translate = ('name',)

    def __unicode__(self):
        return u"%s,%s" % (self.slug, self.url)

    def as_dict(self):
        return {'slug': self.slug, 'name': self.name, 'url': self.url}


class GeojsonLayer(models.Model):
    __metaclass__ = TransMeta

    slug = models.SlugField(max_length=40, unique=True)
    name = models.CharField(verbose_name=_('name'), max_length=40)
    filter = models.TextField(null=True, blank=True)

# Path: osm_data_processing/models.py
# class OsmPoint(OsmModel):
#     the_geom = geomodels.PointField()
#     name = models.CharField(verbose_name=_('Name'), max_length=400, null=True, blank=True)
#     amenity = models.CharField(max_length=200, null=True, blank=True)
#     description = models.CharField(verbose_name=_('Description'), max_length=200, null=True, blank=True)
#     ele = models.CharField(verbose_name=_('Elevation'), max_length=200, null=True, blank=True)
#     highway = models.CharField(max_length=200, null=True, blank=True)
#     historic = models.CharField(max_length=200, null=True, blank=True)
#     information = models.CharField(max_length=200, null=True, blank=True)
#     leisure = models.CharField(max_length=200, null=True, blank=True)
#     man_made = models.CharField(max_length=200, null=True, blank=True)
#     natural = models.CharField(max_length=200, null=True, blank=True)
#     noexit = models.CharField(max_length=200, null=True, blank=True)
#     opening_hours = models.CharField(verbose_name=_('Opening hours'), max_length=200, null=True, blank=True)
#     place = models.CharField(max_length=200, null=True, blank=True)
#     protect_class = models.CharField(max_length=200, null=True, blank=True)
#     railway = models.CharField(max_length=200, null=True, blank=True)
#     ref = models.CharField(verbose_name=_('Reference code'), max_length=200, null=True, blank=True)
#     ruins = models.CharField(max_length=200, null=True, blank=True)
#     shop = models.CharField(verbose_name=_('Shop type'), max_length=200, null=True, blank=True)
#     sport = models.CharField(max_length=200, null=True, blank=True)
#     tourism = models.CharField(max_length=200, null=True, blank=True)
# 
#     objects = geomodels.GeoManager()
# 
#     def osm_link(self, url='http://www.openstreetmap.org/browse/', geometry='node'):
#         return super(OsmPoint, self).osm_link(url, geometry)
# 
# class OsmLine(OsmModel):
#     the_geom = geomodels.LineStringField()
#     name = models.CharField(verbose_name=_('Name'), max_length=400, null=True, blank=True)
#     mtbscale = models.CharField(verbose_name=_('MTB scale'), max_length=200, null=True, blank=True)
#     mtbdescription = models.CharField(verbose_name=_('MTB description'), max_length=200, null=True, blank=True)
#     mtbscaleuphill = models.CharField(verbose_name=_('MTB scale uphill'), max_length=200, null=True, blank=True)
# 
#     objects = geomodels.GeoManager()


# Path: map/models.py
import simplejson as json
from transmeta import TransMeta
from django.db import models
from django.contrib.gis.geos import Polygon
from django.utils.translation import ugettext_lazy as _
from osm_data_processing.models import OsmPoint, OsmLine

# Django imports

# Local imports


class TileLayer(models.Model):
    __metaclass__ = TransMeta

    slug = models.SlugField(max_length=200, unique=True)
    name = models.CharField(verbose_name=_('name'), max_length=200)
    attribution = models.CharField(max_length=400)
    url = models.CharField(max_length=400)
    last_update = models.DateField(null=True, blank=True)

    class Meta:
        translate = ('name',)

    def __unicode__(self):
        return u"%s,%s" % (self.slug, self.url)

    def as_dict(self):
        return {'slug': self.slug, 'name': self.name, 'url': self.url}


class GeojsonLayer(models.Model):
    __metaclass__ = TransMeta

    slug = models.SlugField(max_length=40, unique=True)
    name = models.CharField(verbose_name=_('name'), max_length=40)
    filter = models.TextField(null=True, blank=True)

    pointGeom = models.BooleanField(default=False)