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

            if (this.marker.Window != null)
            {
                FluentDictionary.For(windowDictionary)
                .Add("content", this.marker.Window.Content)
                .Add("disableAutoPan", this.marker.Window.DisableAutoPan, () => this.marker.Window.DisableAutoPan)
                .Add("openOnRightClick", this.marker.Window.OpenOnRightClick, () => this.marker.Window.OpenOnRightClick)
                .Add("lat", this.marker.Window.Latitude, () => this.marker.Latitude != this.marker.Window.Latitude)
                .Add("lng", this.marker.Window.Longitude, () => this.marker.Longitude != this.marker.Window.Longitude)
                .Add("maxWidth", this.marker.Window.MaxWidth, () => this.marker.Window.MaxWidth != 0)
                .Add("zIndex", this.marker.Window.ZIndex, () => this.marker.Window.ZIndex != 0);
            }

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

            FluentDictionary.For(result)
            .Add("id", this.marker.Id, () => this.marker.Id != null)
            .Add("address", this.marker.Address, () => this.marker.Address != null)
            .Add("title", this.marker.Title, () => this.marker.Title != null)
            .Add("lat", this.marker.Latitude, () => this.marker.Latitude != null)
            .Add("lng", this.marker.Longitude, () => this.marker.Latitude != null)
            .Add("zIndex", this.marker.ZIndex, 0)
            .Add("clickable", this.marker.Clickable, true)
            .Add("draggable", this.marker.Draggable, false)
            .Add("icon", this.marker.Icon, () => this.marker.Icon != null)
            .Add("window", windowDictionary, () => this.marker.Window != null);

            return(result);
        }
Пример #2
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);
        }
Пример #3
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);
        }
Пример #4
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);
        }