Ejemplo n.º 1
0
    def test_Map(self):
        from clld.web.maps import Map

        class MockRoute(Mock):
            name = 'language'

        self.set_request_properties(matched_route=MockRoute())

        dt = Map(common.Parameter.first(), self.env['request'])
        dt.render()
Ejemplo n.º 2
0
    def test_Map(self):
        from clld.web.maps import Map

        class MockRoute(Mock):
            name = 'language'

        self.set_request_properties(matched_route=MockRoute())

        dt = Map(common.Parameter.first(), self.env['request'])
        dt.render()
Ejemplo n.º 3
0
    def get_layers(self):
        #yield Layer(
        #    'ecoregions',
        #    'WWF Eco Regions',
        #    self.req.route_url('ecoregions_alt', ext='geojson'))

        for layer in Map.get_layers(self):
            yield layer
Ejemplo n.º 4
0
    def get_layers(self):
        #yield Layer(
        #    'ecoregions',
        #    'WWF Eco Regions',
        #    self.req.route_url('ecoregions_alt', ext='geojson'))

        for layer in Map.get_layers(self):
            yield layer
Ejemplo n.º 5
0
 def get_options(self):
     res = dict_merged(Map.get_options(self), **OPTIONS)
     res.update({
         #'center': list(reversed(get_lonlat(self.ctx) or [0, 0])),
         #'zoom': 3,
         'max_zoom': 15,
         'no_popup': True,
         'no_link': True,
         'sidebar': True})
     return res
Ejemplo n.º 6
0
    def test_Map(self):
        from clld.web.maps import Map

        self.set_route()
        self.set_request_properties(params=dict(z=3, lat=1, lng=1))

        dt = Map(common.Parameter.first(), self.env['request'])
        dt.render()

        self.set_request_properties(params=dict(z='abc'))
        dt = Map(common.Parameter.first(), self.env['request'])
        dt.render()
Ejemplo n.º 7
0
    def get_legends(self):
        items = []
        seen = set()

        def item(lang, label):
            return HTML.div(map_marker_img(self.req, lang),
                            ' ',
                            label,
                            style="padding-left: 5px")

        for lang in DBSession.query(models.Doculect).order_by(
                models.Doculect.subfamily):
            if lang.subfamily not in seen:
                items.append(item(lang, lang.subfamily))
                seen.add(lang.subfamily)
        yield Legend(self,
                     'subfamilies',
                     items,
                     label='Legend',
                     stay_open=True)

        for legend in Map.get_legends(self):
            yield legend
Ejemplo n.º 8
0
    def get_legends(self):
        items = []
        seen = set()

        def item(lang, label):
            return HTML.div(map_marker_img(self.req, lang),
                            ' ',
                            label,
                            style="padding-left: 5px")

        for lang in DBSession.query(Variety).order_by(Variety.subgroup):
            if lang.subgroup:
                if lang.subgroup not in seen:
                    items.append(item(lang, lang.subgroup))
                    seen.add(lang.subgroup)
            else:
                family = lang.family.name if lang.family else 'Isolate'
                if family not in seen:
                    items.append(item(lang, family))
                    seen.add(family)
        yield Legend(self, 'sub-groups', items, label='Legend', stay_open=True)

        for legend in Map.get_legends(self):
            yield legend
Ejemplo n.º 9
0
    def get_legends(self):
        for legend in Map.get_legends(self):
            yield legend

        def header(label):
            return HTML.h5(label, style='padding-left:5px;margin-top:0;margin-bottom:0')

        def make_item(label, icon):
            return HTML.span(
                HTML.img(
                    width=16,
                    height=16,
                    src=self.req.static_url('clld:web/static/icons/%s.png' % icon)),
                HTML.span(label, style='padding-left:5px'),
                style='padding-left:5px')

        items = [header('Dogon')]
        items.extend(
            [make_item(GC_TO_NAME[gc], icon) for gc, icon in DOGON_MARKER.items()])
        items.append(header('Other'))
        items.extend(
            [make_item(name, icon) for name, icon in FAMILY_MARKER.items() if name != 'Dogon'])
        items.append(make_item('unknown', FAMILY_MARKER['x']))
        yield Legend(self, 'families', items)
Ejemplo n.º 10
0
 def __init__(self, ctx, req, eid='map', col=None, dt=None):
     Map.__init__(self, ctx, req, eid=eid)
     self.col, self.dt = col, dt
Ejemplo n.º 11
0
 def __init__(self, ctx, req, icon_map, focus):
     self.ldstatus = ldstatus()
     self.icon_map = icon_map
     self.focus = focus
     Map.__init__(self, ctx, req)
Ejemplo n.º 12
0
    def get_legends(self):
        for legend in Map.get_legends(self):
            yield legend

        yield FilterLegend(self, 'SAILS.getFamily', col=self.col, dt=self.dt)
Ejemplo n.º 13
0
 def __init__(self, ctx, req, icon_map):
     self.ldstatus = ldstatus()
     self.icon_map = icon_map
     Map.__init__(self, ctx, req)
Ejemplo n.º 14
0
 def __init__(self, ctx, req, eid='map', col=None, dt=None):
     self.col, self.dt = col, dt
     Map.__init__(self, ctx, req, eid=eid)
Ejemplo n.º 15
0
 def __init__(self, ctx, req, icon_map, focus):
     self.ldstatus = ldstatus()
     self.icon_map = icon_map
     self.focus = focus
     Map.__init__(self, ctx, req)
Ejemplo n.º 16
0
    def get_legends(self):
        for legend in Map.get_legends(self):
            yield legend

        yield FilterLegend(self, 'SAILS.getFamily', col=self.col, dt=self.dt)
Ejemplo n.º 17
0
 def get_options(self):
     res = dict_merged(Map.get_options(self), **OPTIONS)
     del res['show_labels']
     res['info_route'] = 'village_alt'
     res['icon_size'] = 15
     return res
Ejemplo n.º 18
0
 def get_options(self):
     return dict_merged(Map.get_options(self), **OPTIONS)
Ejemplo n.º 19
0
 def __init__(self, ctx, req, icon_map):
     self.icon_map = icon_map
     Map.__init__(self, ctx, req)
Ejemplo n.º 20
0
 def __init__(self, ctx, req, icon_map, focus, de_to_icon):
     self.icon_map = icon_map
     self.focus = focus
     self.de_to_icon = de_to_icon
     Map.__init__(self, ctx, req)
Ejemplo n.º 21
0
 def __init__(self, ctx, req, icon_map):
     self.icon_map = icon_map
     Map.__init__(self, ctx, req)