Esempio n. 1
0
        /// <summary>
        /// NOTE: According to documentation, as of the moment, the icon-rotation-alignment does not support data-driven-styling yet
        /// https://www.mapbox.com/mapbox-gl-js/style-spec/#layout-symbol-icon-rotation-alignment
        /// </summary>
        private void initializePinsLayer()
        {
            // Pins with bearings layer - configure elements
            var mapLockedPinsPropertyValues = new List <PropertyValue> {
                PropertyFactory.IconImage("{" + pin_image_key + "}"),             //Tokenize the field
                PropertyFactory.IconRotate(Expression.Get(pin_rotation_key)),
                PropertyFactory.IconSize(Expression.Get(pin_size_key)),
                PropertyFactory.IconRotationAlignment("map"),                 // Finally the map-lock flat = "map"
                PropertyFactory.IconAllowOverlap(Java.Lang.Boolean.True)      // Always overlap
            };
            var mapLockedPinsLayer = new SymbolLayer(mapLockedPinsKey, mapLockedPinsSourceKey)
                                     .WithProperties(mapLockedPinsPropertyValues.ToArray());

            nMap.AddLayer(mapLockedPinsLayer);

            // Normal pins layer - configure elements
            var normalPinsPropertyValues = new List <PropertyValue> {
                PropertyFactory.IconImage("{" + pin_image_key + "}"),       //Tokenize the field
                PropertyFactory.IconSize(Expression.Get(pin_size_key)),
                PropertyFactory.IconOffset(Expression.Get(pin_offset_key)), //https://www.mapbox.com/mapbox-gl-js/style-spec/#layout-symbol-icon-offset
                PropertyFactory.IconAnchor("bottom"),                       // https://www.mapbox.com/mapbox-gl-js/style-spec/#layout-symbol-icon-anchor = "bottom" or "center"
                PropertyFactory.IconAllowOverlap(Java.Lang.Boolean.True)    // Always overlap
            };
            var normalPinsLayer = new SymbolLayer(normalPinsKey, normalPinsSourceKey)
                                  .WithProperties(normalPinsPropertyValues.ToArray());

            nMap.AddLayer(normalPinsLayer);
        }