#'Streets' Version:8 (Converted: 20/06/2021 11:47 AM)
import:
    - icons.yaml


labels-global:
    - &text_visible         true
    - &debug_visible        true
global:
    language: ar # optional ISO 2-char code
    extrude: false
    navigation: false
    vanishing_point: [0, 0]
    language_text_source: |
        function() {
            // Use preferred language label if available
            return (global.language && feature['name_'+global.language]) || feature['name_en'] || feature.name;
        }
    language_text_source_building: |
        function() {
            // Use preferred language label if available
            return  feature.type;
        }
    language_text_source_left: |
        function() {
            return (global.language && feature['name:left:'+global.language]) || feature['name:left'];
        }
    language_text_source_right: |
        function() {
            return (global.language && feature['name:right:'+global.language]) || feature['name:right'];
        }
    feature_order: function () { return feature.sort_rank; }
    min_label: function () { return feature.min_label; }
    max_label: function () { return feature.max_label; }


fonts:
    default:
        url: fonts/Tajawal-Medium.ttf

styles:
    buildings:
        base: polygons
        material:
            diffuse: 0.0
            ambient: 0
            specular: 0.5
            shininess: 2.0
            #shaders:
            #    blocks:
            #       color: |
            #           // Shade by building height
            #           color.rgb *= vec3((worldPosition().z*-0.004 + .9));
            #           // Add translucency at higher zoom
            #           color.a = clamp(mix(1., 0., (u_map_position.z - 15.) * .25), .7, 1.);

    rail-dash:
        base: lines
        texcoords: true
        shaders:
            defines:
                DASH_SIZE: .9
                DASH_SCALE: .6
            blocks:
                filter: |
                    if (step(DASH_SIZE, fract(v_texcoord.y * DASH_SCALE)) == 0.)
                    {
                    discard;
                    }
    lines-dash:
        base: lines
        dash: [2,2]

    main_route:
        base: lines
        interactive: true
        width: [[ 1,1px ],[ 2,1px ], [ 3,1px ],[ 4,1px ],[ 5,1px ],[ 6,0.73px ],[ 7,1px ],[ 8,1.35px ],[ 9,1.75px ],[ 10,2.24px ],[ 11,2.82px ],[ 12,3.52px ],[ 13,4.36px ],[ 14,5.36px ],[ 15,6.57px ],[ 16,8.01px ],[ 17,9.75px ],[ 18,11.83px ],[ 19,14.33px ],[ 20,18px ] ]
        blend: overlay
    route:
        base: lines
        blend: overlay
        width: [ [ 1,1px ],[ 2,1px ], [ 3,1px ],[ 4,1px ],[ 5,1px ],[ 6,0.73px ],[ 7,1px ],[ 8,1.35px ],[ 9,1.75px ],[ 10,2.24px ],[ 11,2.82px ],[ 12,3.52px ],[ 13,4.36px ],[ 14,5.36px ],[ 15,6.57px ],[ 16,8.01px ],[ 17,9.75px ],[ 18,11.83px ],[ 19,14.33px ],[ 20,18px ] ]
        interactive: true

    bridges:
        base: lines
        blend_order: 1
        blend: inlay

    ux-route-line-overlay:
        base: lines

    transit-lines:
        base: lines
          # blend: overlay
          # blend_order: -2
          #shaders:
          #    blocks:
          #        filter: |
          #           color.rgb *= 1.25; // pump up the colors
        #           color.a *= 0.5;     // translucent
        draw: # default draw parameters
            color: function() { return feature.colour_name; }
            interactive: true
            width: 6px
            cap: round
            outline:
                color: '#DDDDDD'
                width: 1px
            #interactive: true
    arrow-lines:
        base: lines
        draw: # default draw parameters
            color: function() { return feature.colour_name; }
            interactive: false
            width: 3px
            cap: arrow
            outline:
                color: '#DDDDDD'
                width: 1px
            #interactive: true

    lines-blended:
        base: lines
        blend: inlay
    polys-blended:
        base: polygons
        blend: inlay

    small_text:
        base: text
        draw:
            placement: centroid
            text_source: global.language_text_source
            priority: 4
            font:
                family: default
                size: 10px
                fill: "#023047"
                stroke: { color: white, width: 1px }
                transform: uppercase

    medium_text:
        base: text
        draw:
            placement: centroid
            text_source: global.language_text_source
            priority: 3
            font:
                family: default
                size: 13px
                fill: "#023047"
                stroke: { color: white, width: 1px }
                transform: uppercase

    large_text:
        base: text
        draw:
            placement: centroid
            text_source: global.language_text_source
            priority: 3
            font:
                family: default
                size: 16px
                fill: "#023047"
                stroke: { color: white, width: 1px }
                transform: uppercase
    icon_library:
        base: points
        texture: icon_library
        collide: true
        order: 800
        placement: centroid
        draw:
            #size: global.icon_size
            sprite: function() { return feature.type; }
            sprite_default: 9 pins
            buffer: 0.2px
            order: 800
            text:
                text_source: global.language_text_source
                buffer: 0.2px
                text_wrap: 18
                max_lines: 3
                font:
                    family: default
                    fill: function() { if(feature.type == 'hospital' || feature.type == 'clinic' || feature.type == 'pharmacy'){ return "red"} else if(feature.type == 'police' || feature.type == 'parking' || feature.type == 'fuel'){ return "#6884F7"}  else {return "#023047";}  }
                    size: 12px
                    stroke: { color: global.text_stroke, width: 1px }


    brand_library:
        base: points
        texture: brand_library
        collide: true
        placement: centroid
        draw:
            #size: global.icon_size
            sprite: function() { return feature.type; }
            buffer: 0.2px
            order: 890
            priority: 1
            collide: true
            text:
                text_source: global.language_text_source
                buffer: 0.2px
                text_wrap: 18
                max_lines: 3
                font:
                    family: default
                    fill: "#023047"
                    size: 12px
                    stroke: { color: global.text_stroke, width: 1px }

    marker_label:
        base: points
        texture: icon_library
        draw:
            sprite: circle
            order: 900
            buffer: 0.2px
            collide: true
            priority: 1
            text:
                buffer: 0.2px
                text_wrap: 18
                max_lines: 3
                collide: true
                priority: 0
                font:
                    family: default
                    weight: normal
                    fill: "#023047"
                    size: 12px
                    stroke: { color: global.text_stroke, width: 1px }
    marker:
        base: points
        order: 2000
        interactive: true


    marker_selected:
        base: points
        texture: icon_marker
        collide: true
        draw:
            sprite: mapy
            priority: 1
            order: 1800
            collide: true
            buffer: 0.2px
            text:
                buffer: 0.2px
                text_wrap: 18
                max_lines: 3
                collide: true
                font:
                    family: default
                    fill: "#023047"
                    size: 12px
                    stroke: { color: global.text_stroke, width: 1px }



    normals:
        base: raster
        blend: inlay

cameras:
    perspective:
        type: perspective
        max_tilt: 20
        vanishing_point: global.vanishing_point # relative to center of screen, in pixels
        active: true    

#    isometric:
#        type: isometric
#        vanishing_point: global.vanishing_point # relative to center of screen, in pixels
#        active: true

    flat:
        type: flat
        active: true

lights:
    mainlight:
        type: directional
        origin: world
        direction: [0, 0, -1]
        diffuse: [.3, .3, .3, 1.]
        ambient: [0.7, 0.7, 0.7, 1.]
        #cameraLight:
        #   type: directional
        #  origin: camera
        # direction: [6, 0, -1]



scene:
    background:
        color: '#F1EEE8'

sources:
    toomaps_raster:
        type: Raster
        url: https://tiles.altawasol.app/wmts/mappy/webmercator/{z}/{x}/{y}.png
        max_zoom: 18
        tile_size: 800
    vector:
        type: MVT
        url: https://tiles.altawasol.app:9999/maps/planet/{z}/{x}/{y}.pbf
        min_zoom: 11
        min_display_zoom: 11



#    toomaps_landcover:
#        type: Raster
#        alpha: 0.4
#        url: https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}.jpeg
#        max_zoom: 17



layers:

    earth:
        data: { source: toomaps_raster }
        draw:
            normals:
                blend_order: 0
                order: 0

    data_polyline:
        data: { source: data_polyline }
        normal:
            filter:
                dashed: ['false']
            draw:
                lines:
                    interactive: function() { return feature.interactive; }
                    color: function() { return feature.color; }
                    order: function() { return feature.order; }
                    collide: false
                    width: function() { return feature.width; }
        dashed:
            filter:
                dashed: ['true']
            draw:
                lines-dash:
                    interactive: function() { return feature.interactive; }
                    color: function() { return feature.color; }
                    order: function() { return feature.order; }
                    collide: false
                    width: function() { return feature.width; }


#    earth:
#        data: { source: toomaps_landcover }
#        draw:
#            normals:
#                color: transparent
#                blend: translucent
#                order: 5

    house_numbers:
        data: { source: vector }
        filter:
            $zoom: { min: 17}
        draw:
            small_text:
                interactive: true
                priority: 5
                text_source: global.language_text_source_building

    data_polygons:
        data: { source: data_polygons }
        draw:
            polygons:
                order: 500
                interactive: true
                color: red
                outline:
                    color: green
                    width: 0.5px
    buildings:
        data: { source: vector }
        filter:
            $zoom: { min: 15 }
        draw:
            polygons:
                #blend: translucent
                visible: global.extrude
                order: 200
                #extrude: global.extrude
                extrude: function() { return feature.height || 20; }
                interactive: true
                color: [ 0.847, 0.847, 0.847, 1.00 ]
                outline:
                    color: grey
                    width: 0.5px
        buildings_labels:
            filter:
                not:
                    name: [ "", yes ]
            draw:
                small_text:
                    priority: 2
                    text_source: global.language_text_source

    neigh:
        data: { source: vector }
        filter:
            $zoom: { min: 11 , max: 14 }
        draw:
            medium_text:
                priority: 2
                text_source: global.language_text_source


    all_amenties:
        data: { source: vector }
        all_amenties_icons:
            filter:
                $zoom: { min: 15 }
                not:
                    name: [ "" , McDonald, McDonalds, KFC, kfc, Kfc, Starbucks , starbucks, ستاربكس , macdonald, ماكدونالدز , كنتاكي , kansas fried chicken, zara , زارا , radioshak , راديو شاك, albaik, البيك, pizzahut, بيتزا هت , hardees, هارديز, burger king, بيرجر كينج , papa johns, بابا جونز , dominos pizza, دومينيز بيتزا, subway, سب واي, dunkin donuts, دانكن دوناتس, chilis, تشيليز, fridays, فراي دايز , هرم خوفو ]
            draw:
                icon_library:
                    interactive: true
                    priority: 2
                    order: 800
                    collide: true
                    sprite: function() { return feature.type; }

        all_amenties_brands:
            filter:
                $zoom: { min: 15 }
                name: [ McDonald, McDonalds, KFC, kfc, Kfc, Starbucks, starbucks, ستاربكس , macdonald, ماكدونالدز , كنتاكي , kansas fried chicken, zara , زارا , radioshak , راديو شاك, albaik, البيك, pizzahut, بيتزا هت , hardees, هارديز, burger king, بيرجر كينج , papa johns, بابا جونز , dominos pizza, دومينيز بيتزا, subway, سب واي, dunkin donuts, دانكن دوناتس, chilis, تشيليز, fridays,  فراي دايز , هرم خوفو ]
            draw:
                brand_library:
                    interactive: true
                    placement: centroid
                    priority: 2
                    order: 820
                    collide: true
                    sprite: function() { return feature.name; }

    amenties:
        data: { source: vector }
        filter:
            not:
                name: ""
            $zoom: { min: 12 , max: 15 }
        draw:
            icon_library:
                interactive: true
                priority: 2
                order: 800
                collide: true
                sprite: function() { return feature.type; }

    healthcare:
        data: { source: vector }
        filter:
            not:
                name: ""
            $zoom: { min: 15  }
        draw:
            icon_library:
                interactive: true
                priority: 2
                order: 800
                collide: true
                sprite: function() { return feature.type; }
    leisure:
        data: { source: vector }
        filter:
            not:
                name: ""
            $zoom: { min: 15  }
        draw:
            icon_library:
                interactive: true
                priority: 2
                order: 800
                collide: true
                sprite: function() { return feature.type; }
    offices:
        data: { source: vector }
        filter:
            not:
                name: ""
            $zoom: { min: 15  }
        draw:
            icon_library:
                interactive: true
                priority: 2
                order: 800
                collide: true
                sprite: function() { return feature.type; }
    shops:
        data: { source: vector }
        shops_icons:
            filter:
                $zoom: { min: 15 }
                not:
                    name: [ "" , McDonald, McDonalds, KFC, kfc, Kfc, Starbucks , starbucks, ستاربكس , macdonald, ماكدونالدز , كنتاكي , kansas fried chicken, zara , زارا , radioshak , راديو شاك, albaik, البيك, pizzahut, بيتزا هت , hardees, هارديز, burger king, بيرجر كينج , papa johns, بابا جونز , dominos pizza, دومينيز بيتزا, subway, سب واي, dunkin donuts, دانكن دوناتس, chilis, تشيليز, fridays, فراي دايز , هرم خوفو ]
            draw:
                icon_library:
                    interactive: true
                    priority: 2
                    order: 800
                    sprite_default: shopping-mall
                    collide: true
                    sprite: function() { return feature.type; }

        shops_brands:
            filter:
                $zoom: { min: 15 }
                name: [ McDonald, McDonalds, KFC, kfc, Kfc, Starbucks, starbucks, ستاربكس , macdonald, ماكدونالدز , كنتاكي , kansas fried chicken, zara , زارا , radioshak , راديو شاك, albaik, البيك, pizzahut, بيتزا هت , hardees, هارديز, burger king, بيرجر كينج , papa johns, بابا جونز , dominos pizza, دومينيز بيتزا, subway, سب واي, dunkin donuts, دانكن دوناتس, chilis, تشيليز, fridays,  فراي دايز , هرم خوفو ]
            draw:
                brand_library:
                    interactive: true
                    placement: centroid
                    priority: 2
                    order: 900
                    collide: true
                    sprite: function() { return feature.name; }
    sports:
        data: { source: vector }
        filter:
            not:
                name: ""
            $zoom: { min: 15  }
        draw:
            icon_library:
                interactive: true
                priority: 2
                order: 800
                collide: true
                sprite: function() { return feature.type; }
    tourism:
        data: { source: vector }
        filter:
            not:
                name: ""
            $zoom: { min: 15  }
        draw:
            icon_library:
                interactive: true
                priority: 2
                order: 800
                collide: true
                sprite: function() { return feature.type; }
    places:
        data: { source: vector }
        places_icons:
            filter:
                $zoom: { min: 15 }
                not:
                    name: [ "" , shell , Shell , McDonald, McDonalds, KFC, kfc, Kfc, Starbucks , starbucks, ستاربكس , macdonald, ماكدونالدز , كنتاكي , kansas fried chicken, zara , زارا , radioshak , راديو شاك, albaik, البيك, pizzahut, بيتزا هت , hardees, هارديز, burger king, بيرجر كينج , papa johns, بابا جونز , dominos pizza, دومينيز بيتزا, subway, سب واي, dunkin donuts, دانكن دوناتس, chilis, تشيليز, fridays, فراي دايز , هرم خوفو ]
            draw:
                icon_library:
                    interactive: true
                    priority: 2
                    order: 800
                    sprite_default: shopping-mall
                    collide: true
                    sprite: function() { return feature.type; }

        places_brands:
            filter:
                $zoom: { min: 15 }
                name: [ shell , Shell , McDonald, McDonalds, KFC, kfc, Kfc, Starbucks, starbucks, ستاربكس , macdonald, ماكدونالدز , كنتاكي , kansas fried chicken, zara , زارا , radioshak , راديو شاك, albaik, البيك, pizzahut, بيتزا هت , hardees, هارديز, burger king, بيرجر كينج , papa johns, بابا جونز , dominos pizza, دومينيز بيتزا, subway, سب واي, dunkin donuts, دانكن دوناتس, chilis, تشيليز, fridays,  فراي دايز , هرم خوفو ]
            draw:
                brand_library:
                    interactive: true
                    placement: centroid
                    priority: 2
                    order: 900
                    collide: true
                    sprite: function() { return feature.name; }

    contributions:
        data: { source: vector }
        filter:
            approved: true
            $zoom: { min: 12 }
        draw:
            icon_library:
                interactive: true
                priority: 1
                order: 800
                collide: true
                sprite: function() { return feature.type; }



