Exemplo n.º 1
0
        public GoogleMap(jQueryObject container, GoogleMapOptions opt)
            : base(container, opt)
        {
            var center = new LatLng(options.Latitude ?? 0, options.Longitude ?? 0);

            map = new Map(container[0], new MapOptions
            {
                Center      = center,
                MapTypeId   = options.MapTypeId ?? MapTypeId.roadmap,
                Zoom        = options.Zoom ?? 15,
                ZoomControl = true
            });

            if (options.MarkerTitle != null)
            {
                new Marker(new MarkerOptions {
                    Position = new LatLng(
                        options.MarkerLatitude ?? options.Latitude ?? 0,
                        options.MarkerLongitude ?? options.Longitude ?? 0),
                    Map       = map,
                    Title     = options.MarkerTitle,
                    Animation = Animation.Drop
                });
            }

            LazyLoadHelper.ExecuteOnceWhenShown(container, () =>
            {
                GEvent.Trigger(map, "resize");
                map.SetCenter(center); // in case it wasn't visible (e.g. in dialog)
            });
        }