Пример #1
0
        public IDictionary <string, object> Serialize()
        {
            IDictionary <string, object> result = new Dictionary <string, object>();

            FluentDictionary.For(result)
            .Add("elementType", this.ElementType?.ToClientSideString(), () => this.ElementType != null)
            .Add("featureType", this.FeatureType?.ToClientSideString(), () => this.FeatureType != null)
            .Add("stylers", this.Stylers, () => this.Stylers.Any());

            return(result);
        }
Пример #2
0
        protected override IDictionary <string, object> LayerSerialize()
        {
            IDictionary <string, object> layerDictionary = new Dictionary <string, object>();

            FluentDictionary.For(layerDictionary)
            .Add("clickable", this.Layer.Clickable)
            .Add("preserveViewport", this.Layer.PreserveViewport)
            .Add("screenOverlays", this.Layer.ScreenOverlays)
            .Add("suppressInfoWindows", this.Layer.SuppressInfoWindows)
            .Add("url", this.Layer.Url.AbsoluteUri);

            return(layerDictionary);
        }
Пример #3
0
        public virtual IDictionary <string, object> Serialize()
        {
            IDictionary <string, object> result = new Dictionary <string, object>();

            FluentDictionary.For(result)
            .Add("altName", this.mapType.MapTypeAltName, () => !string.IsNullOrEmpty(this.mapType.MapTypeAltName))
            .Add("name", this.mapType.MapTypeName)
            .Add("maxZoom", this.mapType.MaxZoom, 0)
            .Add("minZoom", this.mapType.MinZoom, 0)
            .Add("opacity", this.mapType.Opacity / 100F, 1F)
            .Add("radius", this.mapType.Radius, 6378137);

            return(result);
        }
        protected override IDictionary<string, object> LayerSerialize()
        {
            List<string> gradientCollection = this.Layer.Gradient.Select(color => string.Format(CultureInfo.InvariantCulture, "rgba({0}, {1}, {2}, {3})", color.R, color.G, color.B, color.A)).ToList();

            IDictionary<string, object> layerDictionary = new Dictionary<string, object>();
            FluentDictionary.For(layerDictionary)
                .Add("dissipating", this.Layer.Dissipating, () => this.Layer.Dissipating)
                .Add("maxIntensity", this.Layer.MaxIntensity, () => this.Layer.MaxIntensity > 0)
                .Add("opacity", this.Layer.Opacity, () => this.Layer.Opacity > 0)
                .Add("radius", this.Layer.Radius, () => this.Layer.Radius > 0)
                .Add("gradient", gradientCollection, () => this.Layer.Gradient.Any())
                .Add("data", this.Layer.Data, () => this.Layer.Data.Any());

            return layerDictionary;
        }
        public override IDictionary <string, object> Serialize()
        {
            var customStyles = new List <IDictionary <string, object> >();

            if (this.styledMapType.Styles.Any())
            {
                this.styledMapType.Styles.Each(cs => customStyles.Add(cs.Serialize()));
            }

            IDictionary <string, object> result = base.Serialize();

            FluentDictionary.For(result)
            .Add("styles", customStyles, () => this.styledMapType.Styles.Any());

            return(result);
        }
        public IDictionary <string, object> Serialize()
        {
            var customStyles = new List <IDictionary <string, object> >();

            if (this.CustomStyles.Any())
            {
                this.CustomStyles.Each(cs => customStyles.Add(cs.CreateSerializer().Serialize()));
            }

            IDictionary <string, object> result = new Dictionary <string, object>();

            FluentDictionary.For(result)
            .Add("MaxZoom", this.MaxZoom)
            .Add("GridSize", this.GridSize)
            .Add("AverageCenter", this.AverageCenter)
            .Add("ZoomOnClick", this.ZoomOnClick, true)
            .Add("HideSingleGroupMarker", this.HideSingleGroupMarker)
            .Add("CustomStyles", customStyles, () => this.CustomStyles.Any());

            return(result);
        }