Beispiel #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()
Beispiel #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()
Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #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()
Beispiel #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
Beispiel #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
Beispiel #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)
Beispiel #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
Beispiel #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)
Beispiel #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)
Beispiel #13
0
 def __init__(self, ctx, req, icon_map):
     self.ldstatus = ldstatus()
     self.icon_map = icon_map
     Map.__init__(self, ctx, req)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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
Beispiel #18
0
 def get_options(self):
     return dict_merged(Map.get_options(self), **OPTIONS)
Beispiel #19
0
 def __init__(self, ctx, req, icon_map):
     self.icon_map = icon_map
     Map.__init__(self, ctx, req)
Beispiel #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)
Beispiel #21
0
 def __init__(self, ctx, req, icon_map):
     self.icon_map = icon_map
     Map.__init__(self, ctx, req)