コード例 #1
0
        public override JsonCollection BuildParams()
        {
            JsonCollection options = new JsonCollection(false);

            // If it's already escaped, we use it raw
            if (!string.IsNullOrEmpty(Content) && Content.StartsWith("'"))
            {
                options.Add("content", this.Content);
            }
            else
            {
                options.Add("content", this.Content.Replace("'", "\\'"), !string.IsNullOrEmpty(Content), typeof(string));
            }

            options.Add("disableAutoPan", this.DisableAutoPan, this.DisableAutoPan != DefaultAutoPan, typeof (bool));
            if (this.MaxWidth.HasValue)
            {
                options.Add("maxWidth", this.MaxWidth.Value, typeof (int));
            }
            if (this.PixelOffset != null)
            {
                options.Add("pixelOffset", this.PixelOffset.ToStringNew());
            }
            if (this.Position != null)
            {
                options.Add("position", this.Position.ToStringNew());
            }
            if (ZIndex.HasValue)
            {
                options.Add("zIndex", this.ZIndex.Value, typeof (int));
            }

            return options;
        }
コード例 #2
0
        public override string ToString()
        {
            var options = new JsonCollection(false);

            if (Position.HasValue)
            {
                options.Add("position", "google.maps.ControlPosition." + Position.Value.ToString().ToUpperInvariant());
            }

            options.Add("style", "google.maps.MapTypeControlStyle." + Enum.GetName(typeof(MapTypeControlStyle), Style).ToUpperInvariant(), Style != MapTypeControlStyle.Default);

            // TODO :: Review MapType
            if ((mapType == typeof(Map) || mapType.Name == "GMap") && MapTypeIds != null && MapTypeIds.Count > 0)
            {
                var types = new JsArrayCollection();

                foreach (var mapTypeId in MapTypeIds)
                {
                    types.Add(mapTypeId);
                }

                options.Add("mapTypeIds", types);
            }

            return options.ToString();
        }
コード例 #3
0
        public override string ToString()
        {
            var options = new JsonCollection(false);

            options.Add("opened", Opened, Opened, typeof(bool));

            return options.ToString();
        }
コード例 #4
0
        public override string ToString()
        {
            var options = new JsonCollection(false);

            options.Add("coords", string.Format("[{0}]", string.Join(",", Coords)));
            options.Add("type", Type.ToString(), typeof(string));

            return string.Format("new google.maps.MarkerShape({0})", options);
        }
コード例 #5
0
        public override string ToString()
        {
            JsonCollection options = new JsonCollection(false);

            options.Add("heading", Heading.Value, Heading.HasValue, typeof (double));
            options.Add("pitch", Pitch.Value, Pitch.HasValue, typeof(double));
            options.Add("zoom", Zoom.Value, Zoom.HasValue, typeof(int));

            return options.ToString();
        }
コード例 #6
0
        public override string ToString()
        {
            var options = new JsonCollection(false);

            options.Add<string>("elementType", GetElementType());
            options.Add<string>("featureType", GetFeatureType());
            options.Add("stylers", Styler.ToString());

            return options.ToString();
        }
コード例 #7
0
        public override string ToString()
        {
            var options = new JsonCollection(false);

            if (Position.HasValue)
            {
                options.Add("position", "google.maps.ControlPosition." + Position.Value.ToString().ToUpperInvariant(), Position.Value != ControlPosition.Top_Left);
            }

            return options.ToString();
        }
コード例 #8
0
        public override string ToString()
        {
            var options = new JsonCollection(false);

            if (Position.HasValue)
            {
                options.Add("position", "google.maps.ControlPosition." + Position.Value.ToString().ToUpperInvariant(), Position.Value != ControlPosition.Top_Left);
            }
            options.Add("style", "google.maps.ZoomControlStyle." + Enum.GetName(typeof(ZoomControlStyle), this.Style).ToUpperInvariant(), this.Style != ZoomControlStyle.Default);

            return options.ToString();
        }
コード例 #9
0
        public override JsonCollection BuildParams()
        {
            var options = new JsonCollection(false);

            options.Add("alt", Alt, !string.IsNullOrEmpty(Alt), typeof(string));
            options.Add("name", Name, !string.IsNullOrEmpty(Name), typeof(string));

            options.Add("maxZoom", this.MaxZoom, this.MaxZoom.HasValue, typeof(int));
            options.Add("minZoom", this.MinZoom, this.MinZoom.HasValue, typeof(int));

            return options;
        }
コード例 #10
0
        public override JsonCollection BuildParams()
        {
            JsonCollection options = new JsonCollection(false);

            if (Clickable.HasValue)
            {
                options.Add<bool>("clickable", Clickable.Value);
            }

            options.Add("map", Map, !string.IsNullOrEmpty(Map));

            if (Opacity.HasValue && Opacity.Value >= 0 && Opacity.Value < 1)
            {
                options.Add("opacity", Opacity.Value);
            }

            return options;
        }
コード例 #11
0
        public override JsonCollection BuildParams()
        {
            var options = new JsonCollection(false);

            if (Clickable.HasValue)
            {
                options.Add<bool>("clickable", Clickable.Value);
            }

            if (SuppressInfoWindows.HasValue)
            {
                options.Add<bool>("supressInfoWindows", SuppressInfoWindows.Value);
            }

            options.Add("labelColor", "google.maps.weather.LabelColor." + LabelColor.ToString().ToUpperInvariant(), LabelColor != WeatherLayer.LabelColor.Auto);
            options.Add("temperatureUnits", "google.maps.weather.TemperatureUnit." + TemperatureUnits.ToString().ToUpperInvariant(), TemperatureUnits != WeatherLayer.TemperatureUnit.Default);
            options.Add("windSpeedUnits", "google.maps.weather.WindSpeedUnit." + WindSpeedUnits.ToString().ToUpperInvariant(), WindSpeedUnits != WeatherLayer.WindSpeedUnit.Default);

            return options;
        }
コード例 #12
0
        public override string ToString()
        {
            JsonCollection options = new JsonCollection(false);

            options.Add<string>("text", JavascriptHelper.PrepareJavascript(Text, false), !string.IsNullOrEmpty(Text));

            if (Color.HasValue)
            {
                options.Add<string>("color", JavascriptHelper.GetStringFromColor(Color.Value));
            }

            if (Fore.HasValue)
            {
                options.Add<string>("fore", JavascriptHelper.GetStringFromColor(Fore.Value));
            }

            if (StarColor.HasValue)
            {
                options.Add<string>("starcolor", JavascriptHelper.GetStringFromColor(StarColor.Value));
            }

            return options.ToString();
        }
コード例 #13
0
        public override JsonCollection BuildParams()
        {
            JsonCollection options = new JsonCollection(false);

            options.Add("addressControl", AddressControl.Value, AddressControl.HasValue, typeof(bool));
            options.Add("addressControlOptions", AddressControlOptions.ToString(), AddressControlOptions != null);
            options.Add("disableDoubleClickZoom", DisableDoubleClickZoom.Value, DisableDoubleClickZoom.HasValue, typeof(bool));
            options.Add("enableCloseButton", EnableCloseButton.Value, EnableCloseButton.HasValue, typeof(bool));
            options.Add("imageDateControl", ImageDateControl.Value, ImageDateControl.HasValue, typeof(bool));
            options.Add("linksControl", LinksControl.Value, LinksControl.HasValue, typeof(bool));
            options.Add("panControl", PanControl.Value, PanControl.HasValue, typeof(bool));
            options.Add("panControlOptions", PanControlOptions.ToString(), PanControlOptions != null);
            options.Add("pano", Pano, !string.IsNullOrEmpty(Pano), typeof(string));
            options.Add("panoProvider", PanoProvider, !string.IsNullOrEmpty(PanoProvider));
            options.Add("position", Position.ToStringNew(), Position != null);
            options.Add("pov", Pov.ToString(), Pov != null);
            options.Add("scrollwheel", Scrollwheel.Value, Scrollwheel.HasValue, typeof(bool));
            options.Add("visible", Visible.Value, Visible.HasValue, typeof(bool));
            options.Add("zoomControl", ZoomControl.Value, ZoomControl.HasValue, typeof(bool));
            options.Add("zoomControlOptions", ZoomControlOptions.ToString(), ZoomControlOptions != null);

            return options;
        }
コード例 #14
0
        public JsonCollection BuildParams(bool addInitialComma)
        {
            var optionList = new JsonCollection(addInitialComma);

            optionList.Add("backgroundColor", JavascriptHelper.GetStringFromColor(BackgroundColor), BackgroundColor != DefaultBackColor, typeof(string));
            optionList.Add("center", Center == null ? string.Empty : Center.ToStringNew(), Center != null);
            optionList.Add("disableDefaultUI", DisableDefaultUI, DisableDefaultUI != DefaultDisableDefaultUi, typeof(bool));
            optionList.Add("disableDoubleClickZoom", DisableDoubleClickZoom, DisableDoubleClickZoom != DefaultDisableDoubleClickZoom, typeof(bool));
            optionList.Add("draggable", Draggable, Draggable != DefaultDraggable, typeof(bool));
            optionList.Add("draggableCursor", DraggableCursor.ToString().ToLowerInvariant(), DraggableCursor != Cursor.None, typeof(string));
            optionList.Add("draggingCursor", DraggingCursor.ToString().ToLowerInvariant(), DraggingCursor != Cursor.None, typeof(string));
            optionList.Add("heading", Heading, Heading.HasValue);
            optionList.Add("keyboardShortcuts", KeyboardShortcuts, DisableDefaultUI || KeyboardShortcuts != DefaultKeyboardShortcuts, typeof(bool));
            // TODO :: MapMaker
            // optionList.Add("mapMaker", MapMaker, MapMaker != DefaultMapMaker, typeof(bool));
            if (MapTypeControl.HasValue)
            {
                optionList.Add<bool>("mapTypeControl", MapTypeControl.Value);
            }
            optionList.Add("mapTypeControlOptions", MapTypeControlOptions, MapTypeControlOptions != null);

            if (string.IsNullOrEmpty(CustomMapTypeId))
            {
                optionList.Add("mapTypeId", GetMapType(MapTypeId));
            }
            else
            {
                optionList.Add<string>("mapTypeId", CustomMapTypeId);
            }

            optionList.Add("maxZoom", MaxZoom, MaxZoom.HasValue);
            optionList.Add("minZoom", MinZoom, MinZoom.HasValue);
            optionList.Add("noClear", NoClear, NoClear != DefaultNoClear, typeof(bool));
            optionList.Add("overviewMapControl", OverviewMapControl, OverviewMapControl != DefaultOverviewMapControl, typeof(bool));
            optionList.Add("overviewMapControlOptions", OverviewMapControlOptions, OverviewMapControlOptions != null);
            optionList.Add("panControl", PanControl, PanControl != DefaultPanControl, typeof(bool));
            optionList.Add("panControlOptions", PanControlOptions, PanControlOptions != null);
            optionList.Add("rotateControl", RotateControl, RotateControl != DefaultRotateControl, typeof(bool));
            optionList.Add("rotateControlOptions", RotateControlOptions, RotateControlOptions != null);
            optionList.Add("scaleControl", ScaleControl, ScaleControl != DefaultScaleControl, typeof(bool));
            optionList.Add("scaleControlOptions", ScaleControlOptions, ScaleControlOptions != null);
            optionList.Add("scrollwheel", Scrollwheel, Scrollwheel != DefaultScrollwheel, typeof(bool));
            optionList.Add("streetView", StreetView != null, StreetView != null, typeof(bool));
            optionList.Add("streetViewControl", StreetViewControl, StreetViewControl != DefaultStreetViewControl, typeof(bool));
            optionList.Add("streetViewControlOptions", StreetViewControlOptions, StreetViewControlOptions != null);
            if (Styles.Count > 0)
            {
                optionList.Add("styles", MapTypeStyle.GetStyles(Styles));
            }
            optionList.Add("tilt", Tilt, Tilt.HasValue);
            optionList.Add("zoom", Zoom, Zoom.HasValue, typeof(int));
            optionList.Add("zoomControl", ZoomControl, ZoomControl != DefaultZoomControl, typeof(bool));
            optionList.Add("zoomControlOptions", ZoomControlOptions, ZoomControlOptions != null);

            return optionList;
        }
コード例 #15
0
        public override JsonCollection BuildParams()
        {
            JsonCollection options = new JsonCollection(false);

            if (Map != null)
            {
                options.Add("map", this.Map.Id, !string.IsNullOrEmpty(this.Map.Id));
            }

            options.AddIfValue("clickable", this.Clickable, typeof (bool));
            options.AddIfValue("editable", this.Editable, typeof(bool));
            options.Add("strokeColor", this.StrokeColor, !string.IsNullOrEmpty(StrokeColor), typeof (string));
            options.AddIfValue("strokeOpacity", this.StrokeOpacity, typeof(double));
            options.AddIfValue("strokeWeight", this.StrokeWeight, typeof(int));
            options.AddIfValue("visible", this.Visible, typeof(bool));
            options.AddIfValue("zIndex", this.ZIndex, typeof(int));

            return options;
        }
コード例 #16
0
        public override JsonCollection BuildParams()
        {
            JsonCollection options = new JsonCollection(false);

            if (string.IsNullOrEmpty(PositionLiteral))
            {
                options.Add("position", Position == null ? string.Empty : this.Position.ToStringNew(), Position != null);
            }
            else
            {
                options.Add("position", PositionLiteral);
            }

            options.Add("animation", this.Animation.ToString().ToLowerInvariant(), Animation != Animation.None, typeof(string));
            options.Add("clickable", this.Clickable, this.Clickable.HasValue, typeof(bool));
            options.Add("clickable", this.Cursor, !string.IsNullOrEmpty(Cursor), typeof(string));
            options.Add("draggable", this.Draggable, this.Draggable.HasValue, typeof(bool));
            options.Add("flat", this.Flat, this.Flat.HasValue, typeof(bool));
            options.Add("map", this.Map);
            options.Add("optimized", this.Optimized, this.Optimized.HasValue, typeof(bool));
            options.Add("raiseOnDrag", this.RaiseOnDrag, this.RaiseOnDrag.HasValue, typeof(bool));
            options.Add("title", this.Title, !string.IsNullOrEmpty(Title), typeof(string));
            options.Add("visible", this.Visible, this.Visible.HasValue, typeof(bool));
            options.Add("zIndex", this.ZIndex, this.ZIndex.HasValue, typeof(int));

            if (!string.IsNullOrEmpty(this.IconText))
            {
                options.Add("icon", this.IconText);
            }
            else
            {
                options.Add("icon", this.Icon, this.Icon != null);
            }

            if (!string.IsNullOrEmpty(this.ShadowText))
            {
                options.Add("shadow", this.ShadowText);
            }
            else
            {
                options.Add("shadow", this.Shadow, this.Icon != null);
            }

            if (!string.IsNullOrEmpty(this.ShapeText))
            {
                options.Add("shape", this.ShapeText);
            }
            else
            {
                options.Add("shape", this.Shape, this.Shape != null);
            }

            return options;
        }