Help us translate this website and improve this translation and earn free licenses!
Anonymous user  |  Log in  |  Create Account

GOverViewMap

[Obsolete("Deprecated by Official Google Maps API. User GMap1.addControl(new GControl(GControl.preBuilt.GOverviewMapControl)); instead")]

The simplest way to add an OverViewMap is explained in the section about pre-built controls, where we see that there's little more to do than GMap1.Add (new GControl (GControl.preBuilt.GOverviewMapControl)); .

Nevertheless, sometimes we are going to want greater control on this OverViewMap. By using GOverViewMap, we'll be able to choose certain characteristics of the OverViewMap that are similar to what's offered in a normal map.

We are going to work with:
  • Dimensions: by using the gSize property, we can choose the dimensions.
  • Map Type: choose the type of map with the mapType property.
  • Change Map Type: we can then set the type of map simply by calling addControl_MapType().
  • Control scale: similarly, instantiate the scale control by calling addControl_Scale().
  • Listeners: we will use almost any type of Listeners using addListener (GListener).
  • Lines: we will add a polygon by means of addPolyline (GPolyline).




Code.aspx
<cc1:GMap ID="GMap1" runat="server" />
Code.aspx.cs
GLatLng latlng = new GLatLng(40, 1);

GOverViewMap gOVM = new GOverViewMap();
gOVM.gSize = new GSize(250, 150);
gOVM.mapType = GMapType.GTypes.Satellite;

gOVM.addControl_MapType();
gOVM.addControl_Scale();

gOVM.addListener(new GListener(gOVM.ID, GListener.Event.click, "function() {alert('Clicked!!');}"));

List<GLatLng> puntos = new List<GLatLng>();
puntos.Add(latlng + new GLatLng(0, 8));
puntos.Add(latlng + new GLatLng(-0.5, 4.2));
puntos.Add(latlng);
puntos.Add(latlng + new GLatLng(3.5, -4));
puntos.Add(latlng + new GLatLng(4.79, +2.6));
GPolyline linea = new GPolyline(puntos, "FFF000", 2);
gOVM.addPolyline(linea);

GMap1.gOverViewMap = gOVM;
GMap1.addControl(new GControl(GControl.preBuilt.MapTypeControl));
Powered by Subgurim.NET