Пример #1
0
        public MapTypeStyleBuilder Add()
        {
            var style = new MapTypeStyle();

            this.mapType.Styles.Add(style);

            return(new MapTypeStyleBuilder(style));
        }
Пример #2
0
        public MapTypeStyleBuilder Add()
        {
            var style = new MapTypeStyle();

            mapType.Styles.Add(style);

            return new MapTypeStyleBuilder(style);
        }
Пример #3
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);
        }
Пример #4
0
        public override string ToString()
        {
            var sb = new StringBuilder();

            var styles = MapTypeStyle.GetStyles(_styles);

            if (string.IsNullOrEmpty(styles))
            {
                styles = "[]";
            }

            var options = Options.ToString();

            if (string.IsNullOrEmpty(options))
            {
                options = "{}";
            }

            sb.AppendFormat("var {0}=new google.maps.StyledMapType({1}, {2});", Id, styles, options);

            return(sb.ToString());
        }