Zoom level:
|
|
Click on the button below to change the shape's visibility.
Click on the button below to delete the shape.
Click on the button below to delete all shapes.
What:
Where:
void ShowDefaultMap()
{
var map = new Microsoft.LiveLabs.Volta.VirtualEarth.Map(mapDiv);
map.LoadMap();
}
void ShowSpecificMap()
{
var map = new Microsoft.LiveLabs.Volta.VirtualEarth.Map(mapDiv);
map.LoadMap(new LatLong(47.6, -122.33), 10, "h", false);
}
void UseCallback()
{
var map = new Microsoft.LiveLabs.Volta.VirtualEarth.Map(mapDiv);
var callback = new HtmlEventHandler(map_OnLoadMap);
map.OnLoadMap += callback;
map.LoadMap(new LatLong(47.22, -122.44), 12, "r", false);
map.OnLoadMap -= callback;
}
void map_OnLoadMap()
{
Window.Alert("The map has loaded.");
}
void Show3DMap()
{
var map = new Microsoft.LiveLabs.Volta.VirtualEarth.Map(mapDiv);
map.LoadMap(new LatLong(47.22, -122.44), 12, "r", false, MapMode.Mode3D, true);
}
void ShowHideNavControl()
{
var map = new Microsoft.LiveLabs.Volta.VirtualEarth.Map(mapDiv);
map.LoadMap();
loadNormal.Click += delegate { SetDashboardSize(map, DashboardSize.Normal); };
loadSmall.Click += delegate { SetDashboardSize(map, DashboardSize.Small); };
loadTiny.Click += delegate { SetDashboardSize(map, DashboardSize.Tiny); };
showDashboard.Click += delegate { map.ShowDashboard(); };
hideDashboard.Click += delegate { map.HideDashboard(); };
}
void SetDashboardSize(Microsoft.LiveLabs.Volta.VirtualEarth.Map map, DashboardSize size)
{
map.SetDashboardSize(size);
map.LoadMap();
}
void GetRoute()
{
var map = new Microsoft.LiveLabs.Volta.VirtualEarth.Map(mapDiv);
map.LoadMap();
map.GetRoute("Space Needle", "Microsoft");
}
void FindWhatWhere()
{
var map = new Microsoft.LiveLabs.Volta.VirtualEarth.Map(mapDiv);
map.LoadMap();
findButton.Click += delegate
{
map.DeleteAllShapes();
try
{
map.Find(txtWhat.Value, txtWhere.Value);
}
catch (System.Exception ex)
{
Window.Alert(ex.Message);
}
};
}
void Zoom()
{
var map = new Microsoft.LiveLabs.Volta.VirtualEarth.Map(mapDiv);
map.LoadMap();
zoomIn.Click += delegate { map.ZoomIn(); };
zoomOut.Click += delegate { map.ZoomOut(); };
doZoom.Click += delegate
{
int zoomValue;
if (int.TryParse(zoomLevel.Value, out zoomValue)
&& zoomValue > 0
&& zoomValue < 20)
map.SetZoomLevel(zoomValue);
};
}
void ShowHideShape()
{
var map = new Microsoft.LiveLabs.Volta.VirtualEarth.Map(mapDiv);
map.LoadMap();
var center=map.GetCenter();
Shape shape = new Shape(ShapeType.Pushpin, center);
shape.SetTitle("My pushpin");
shape.SetDescription("This is a pushpin.");
map.AddShape(shape);
doShowShape.Click += delegate { shape.Show(); };
doHideShape.Click += delegate { shape.Hide(); };
}
void DeleteShape()
{
var map = new Microsoft.LiveLabs.Volta.VirtualEarth.Map(mapDiv);
map.LoadMap();
Shape shape = new Shape(ShapeType.Pushpin, map.GetCenter());
shape.SetTitle("My pushpin");
shape.SetDescription("This is a pushpin.");
map.AddShape(shape);
deleteShapeButton.Click += delegate { if (shape != null) map.DeleteShape(shape); };
}
void DeleteAllShapes()
{
var map = new Microsoft.LiveLabs.Volta.VirtualEarth.Map(mapDiv);
map.LoadMap();
Shape shape = new Shape(ShapeType.Pushpin, map.GetCenter());
shape.SetTitle("My pushpin");
shape.SetDescription("This is a pushpin.");
map.AddShape(shape);
deleteAllShapesButton.Click += delegate { map.DeleteAllShapes(); };
}
void AddDefaultShapes()
{
var map = new Microsoft.LiveLabs.Volta.VirtualEarth.Map(mapDiv);
map.LoadMap();
addPushpin.Click += delegate
{
Shape shape = new Shape(ShapeType.Pushpin, map.GetCenter());
shape.SetTitle("My pushpin");
shape.SetDescription("This is shape number " + ++shapeCount);
map.AddShape(shape);
};
addPolyline.Click += delegate
{
LatLong ll = map.GetCenter();
double lat = ll.Latitude;
double lon = ll.Longitude;
Shape shape = new Shape(ShapeType.Polyline,
new LatLong[] { new LatLong(lat-0.1,lon-0.1)
, new LatLong(lat+0.1,lon-0.1)
, new LatLong(lat+0.1,lon)
, new LatLong(lat-0.1,lon)
, new LatLong(lat-0.1,lon+0.1)
, new LatLong(lat+0.1,lon+0.1)});
shape.SetTitle("My polyline");
shape.SetDescription("This is shape number " + ++shapeCount);
map.AddShape(shape);
};
addPolygon.Click += delegate
{
LatLong ll = map.GetCenter();
double lat = ll.Latitude;
double lon = ll.Longitude;
Shape shape = new Shape(ShapeType.Polygon,
new LatLong[] { new LatLong(lat,lon-0.15)
, new LatLong(lat+0.1,lon-0.05)
, new LatLong(lat+0.1,lon+0.05)
, new LatLong(lat,lon+0.15)
, new LatLong(lat-0.1,lon+0.05)
, new LatLong(lat-0.1,lon-0.05)});
shape.SetTitle("My polygon");
shape.SetDescription("This is shape number " + ++shapeCount);
map.AddShape(shape);
};
}
| Show Me | C# Code | ||