Exemplo n.º 1
0

if settings.TREKKING_TOPOLOGY_ENABLED:
    Path.add_property('area_edges', RestrictedAreaEdge.path_area_edges)
    Path.add_property('areas', lambda self: uniquify(map(attrgetter('restricted_area'), self.area_edges)))
    Topology.add_property('area_edges', RestrictedAreaEdge.topology_area_edges)
    Topology.add_property('areas', lambda self: uniquify(map(attrgetter('restricted_area'), self.area_edges)))
    Intervention.add_property('area_edges', lambda self: self.topology.area_edges if self.topology else [])
    Intervention.add_property('areas', lambda self: self.topology.areas if self.topology else [])
    Project.add_property('area_edges', lambda self: self.edges_by_attr('area_edges'))
    Project.add_property('areas', lambda self: uniquify(map(attrgetter('restricted_area'), self.area_edges)))
else:
    Topology.add_property('areas', lambda self: intersecting(RestrictedArea, self))

TouristicContent.add_property('areas', lambda self: intersecting(RestrictedArea, self))
TouristicEvent.add_property('areas', lambda self: intersecting(RestrictedArea, self))


class City(models.Model):
    code = models.CharField(primary_key=True, max_length=6, db_column='insee')
    name = models.CharField(max_length=128, db_column='commune', verbose_name=_(u"Name"))
    geom = models.MultiPolygonField(srid=settings.SRID, spatial_index=False)

    # Override default manager
    objects = models.GeoManager()

    class Meta:
        db_table = 'l_commune'
        verbose_name = _(u"City")
        verbose_name_plural = _(u"Cities")
        ordering = ['name']
Exemplo n.º 2
0
        "Return wind of itself and its descendants"
        wind = set(
            sum(
                self.get_descendants(include_self=True).values_list('wind',
                                                                    flat=True),
                []))
        return [o for o, _o in self.ORIENTATION_CHOICES
                if o in wind]  # Sorting


Path.add_property('sites', lambda self: intersecting(Site, self), _("Sites"))
Topology.add_property('sites', lambda self: intersecting(Site, self),
                      _("Sites"))
TouristicContent.add_property('sites', lambda self: intersecting(Site, self),
                              _("Sites"))
TouristicEvent.add_property('sites', lambda self: intersecting(Site, self),
                            _("Sites"))

Site.add_property('sites', lambda self: intersecting(Site, self), _("Sites"))
Site.add_property('treks', lambda self: intersecting(Trek, self), _("Treks"))
Site.add_property('pois', lambda self: intersecting(POI, self), _("POIs"))
Site.add_property('trails', lambda self: intersecting(Trail, self),
                  _("Trails"))
Site.add_property('infrastructures',
                  lambda self: intersecting(Infrastructure, self),
                  _("Infrastructures"))
Site.add_property('signages', lambda self: intersecting(Signage, self),
                  _("Signages"))
Site.add_property('touristic_contents',
                  lambda self: intersecting(TouristicContent, self),
                  _("Touristic contents"))
Site.add_property('touristic_events',
Exemplo n.º 3
0
        intersecting(RestrictedArea, self)) if self.ispoint() else uniquify(
        map(attrgetter('restricted_area'), self.area_edges)), _(u"Restricted areas"))
    Intervention.add_property('area_edges', lambda self: self.topology.area_edges if self.topology else [],
                              _(u"Restricted area edges"))
    Intervention.add_property('areas', lambda self: self.topology.areas if self.topology else [],
                              _(u"Restricted areas"))
    Project.add_property('area_edges', lambda self: self.edges_by_attr('area_edges'), _(u"Restricted area edges"))
    Project.add_property('areas', lambda self: uniquify(map(attrgetter('restricted_area'), self.area_edges)),
                         _(u"Restricted areas"))
else:
    Topology.add_property('areas', lambda self: uniquify(intersecting(RestrictedArea, self, distance=0)),
                          _(u"Restricted areas"))

TouristicContent.add_property('areas', lambda self: intersecting(RestrictedArea, self, distance=0),
                              _(u"Restricted areas"))
TouristicEvent.add_property('areas', lambda self: intersecting(RestrictedArea, self, distance=0),
                            _(u"Restricted areas"))


class City(models.Model):
    code = models.CharField(primary_key=True, max_length=6, db_column='insee')
    name = models.CharField(max_length=128, db_column='commune', verbose_name=_(u"Name"))
    geom = models.MultiPolygonField(srid=settings.SRID, spatial_index=False)

    # Override default manager
    objects = models.GeoManager()

    class Meta:
        db_table = 'l_commune'
        verbose_name = _(u"City")
        verbose_name_plural = _(u"Cities")
        ordering = ['name']
Exemplo n.º 4
0
    Intervention.add_property('areas', lambda self: self.topology.areas if self.topology else [],
                              _("Restricted areas"))
    Project.add_property('area_edges', lambda self: self.edges_by_attr('area_edges'), _("Restricted area edges"))
    Project.add_property('areas', lambda self: uniquify(map(attrgetter('restricted_area'), self.area_edges)),
                         _("Restricted areas"))
else:
    Topology.add_property('areas', lambda self: uniquify(intersecting(RestrictedArea, self, distance=0)),
                          _("Restricted areas"))
    Project.add_property('areas', lambda self: uniquify(intersecting(RestrictedArea, self, distance=0)),
                         _("Restricted areas"))
    Intervention.add_property('areas', lambda self: uniquify(intersecting(RestrictedArea, self, distance=0)),
                              _("Restricted areas"))

TouristicContent.add_property('areas', lambda self: intersecting(RestrictedArea, self, distance=0),
                              _("Restricted areas"))
TouristicEvent.add_property('areas', lambda self: intersecting(RestrictedArea, self, distance=0),
                            _("Restricted areas"))
if 'geotrek.diving' in settings.INSTALLED_APPS:
    Dive.add_property('areas', lambda self: uniquify(intersecting(RestrictedArea, self, distance=0)), _("Restricted areas"))


class City(models.Model):
    code = models.CharField(primary_key=True, max_length=6, db_column='insee')
    name = models.CharField(max_length=128, db_column='commune', verbose_name=_("Name"))
    geom = models.MultiPolygonField(srid=settings.SRID, spatial_index=False)

    # Override default manager
    objects = models.GeoManager()

    class Meta:
        db_table = 'l_commune'
        verbose_name = _("City")
Exemplo n.º 5
0
        lambda self: uniquify(intersecting(RestrictedArea, self, distance=0)),
        _("Restricted areas"))
    Project.add_property(
        'areas',
        lambda self: uniquify(intersecting(RestrictedArea, self, distance=0)),
        _("Restricted areas"))
    Intervention.add_property(
        'areas',
        lambda self: uniquify(intersecting(RestrictedArea, self, distance=0)),
        _("Restricted areas"))

TouristicContent.add_property(
    'areas', lambda self: intersecting(RestrictedArea, self, distance=0),
    _("Restricted areas"))
TouristicEvent.add_property(
    'areas', lambda self: intersecting(RestrictedArea, self, distance=0),
    _("Restricted areas"))
if 'geotrek.diving' in settings.INSTALLED_APPS:
    Dive.add_property(
        'areas',
        lambda self: uniquify(intersecting(RestrictedArea, self, distance=0)),
        _("Restricted areas"))
    Dive.add_property(
        'published_areas',
        lambda self: [area for area in self.areas if area.published],
        _("Published areas"))
if 'geotrek.signage' in settings.INSTALLED_APPS:
    Blade.add_property('areas', lambda self: self.signage.areas,
                       _("Restricted areas"))
    Blade.add_property(
        'published_areas',