コード例 #1
0
 def test_stops(self):
     style = _get_line_layer({
         "line-color": "#9e9cab",
         "line-dasharray": [3, 1, 1, 1],
         "line-width": {
             "base": 1.4,
             "stops": [[4, 0.4], [5, 1], [12, 3]]}
     })
     styles = get_styles(style)
     self.assertTrue(True)
コード例 #2
0
 def test_line_cap(self):
     style = {
         "id": None,
         "type": "line",
         "layout": {
             "line-cap": "round",
             "line-join": "square"
         }
     }
     styles = get_styles(style)
     self.assertEqual(1, len(styles))
     self.assertEqual("square", styles[0]["line-join"])
     self.assertEqual("round", styles[0]["line-cap"])
コード例 #3
0
 def test_line_dasharray_multiple(self):
     layer = _get_line_layer({
         "id": "test",
         "line-dasharray": [
             5,
             6,
             10,
             11
         ]
     })
     styles = get_styles(layer)
     d = xml_helper._get_line_symbol(0, styles[0])
     self.assertTrue(True)
コード例 #4
0
 def test_get_styles_float(self):
     style = _get_fill_style({
         "fill-opacity": 0.7,
         "fill-color": "#f2eae2",
     })
     styles = get_styles(style)
     expected = {
         "fill-color": "#f2eae2",
         "fill-opacity": 0.7,
         "zoom_level": None,
         "min_scale_denom": None,
         "max_scale_denom": None
     }
     self.assertDictEqual(expected, styles[0])
コード例 #5
0
 def test_get_styles_simple(self):
     style = _get_fill_style({
         "fill-outline-color": "#dfdbd7",
         "fill-color": "#f2eae2",
     })
     styles = get_styles(style)
     self.assertEqual(1, len(styles))
     expected = {
         "fill-outline-color": "#dfdbd7",
         "fill-color": "#f2eae2",
         "zoom_level": None,
         "min_scale_denom": None,
         "max_scale_denom": None
     }
     self.assertDictEqual(expected, styles[0])
コード例 #6
0
 def test_zoom_level_zero(self):
     style = _get_fill_style({
         "fill-opacity": {
             "base": 1,
             "stops": [[0, 0.9], [10, 0.3]]
         }
     })
     styles = get_styles(style)
     self.assertEqual(2, len(styles))
     expected = {
         'zoom_level': 0,
         'max_scale_denom': 1000000000,
         'min_scale_denom': 750000,
         'fill-color': '0,0,0,0',
         'fill-opacity': 0.9
     }
     self.assertDictEqual(expected, styles[0])
コード例 #7
0
 def test_scale(self):
     style = _get_line_layer({
         "line-width": {
             "stops": [
                 [
                     10,
                     0
                 ],
                 [
                     15,
                     1
                 ]
             ]
         }
     })
     styles = get_styles(style)
     self.assertEqual(1, len(styles))
     self.assertEqual(10, styles[0]["zoom_level"])
コード例 #8
0
 def test_get_styles(self):
     style = _get_fill_style({
         "fill-outline-color": "#dfdbd7",
         "fill-color": "#f2eae2",
         "fill-opacity": {
             "base": 1,
             "stops": [
                 [
                     13,
                     0
                 ],
                 [
                     16,
                     1
                 ]
             ]
         }
     })
     styles = get_styles(style)
     styles = sorted(styles, key=lambda s: s["zoom_level"])
     self.assertEqual(2, len(styles))
     first_expected = {
         'fill-outline-color': '#dfdbd7',
         'fill-color': '#f2eae2',
         'zoom_level': 13,
         'fill-opacity': 0,
         'max_scale_denom': 100000,
         'min_scale_denom': 12500
     }
     second_expected = {
         'fill-outline-color': '#dfdbd7',
         'fill-color': '#f2eae2',
         'zoom_level': 16,
         'fill-opacity': 1,
         'max_scale_denom': 12500,
         'min_scale_denom': 1
     }
     self.assertDictEqual(first_expected, styles[0])
     self.assertDictEqual(second_expected, styles[1])
コード例 #9
0
 def test_highway_motorway(self):
     style = _get_line_layer({
         "line-width": {
             "base": 1.2,
             "stops": [
                 [
                     6.5,
                     0
                 ],
                 [
                     7,
                     0.5
                 ],
                 [
                     20,
                     18
                 ]
             ]
         }
     })
     result = get_styles(style)
     self.assertEqual(2, len(result))
コード例 #10
0
 def test_line_dasharray(self):
     style = _get_line_layer({
         "line-color": "#cba",
         "line-dasharray": [
             1.5,
             0.75
         ],
         "line-width": {
             "base": 1.2,
             "stops": [
                 [
                     15,
                     1.2
                 ],
                 [
                     20,
                     4
                 ]
             ]
         }
     })
     styles = get_styles(style)
     self.assertTrue(True)