<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Import 3D Model</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3"></script>
<script type="text/javascript">
var map = null;
function GetMap()
{
map = new VEMap('myMap');
map.LoadMap();
map.SetMapMode(VEMapMode.Mode3D);
}
function AddModel(type)
{
var center = map.GetCenter();
var layer = new VEShapeLayer();
var modelSpec = new VEModelSourceSpecification(VEModelFormat.OBJ, document.getElementById('txtSource').value, layer);
map.Import3DModel(modelSpec, onModelLoad, center, null, null);
// Zoom in so you can see the model
map.SetZoomLevel(16);
}
function onModelLoad(model, status)
{
if (status == VEModelStatusCode.Success)
{
alert("The 3D model has been loaded.");
}
if (status == VEModelStatusCode.InvalidURL)
{
alert("The URL given for the model data is invalid.");
}
if (status == VEModelStatusCode.Failed)
{
alert("There was a problem loading the 3D model.");
}
}
</script>
</head>
<body onload="GetMap();">
<div id='myMap' style="position:relative; width:600px; height:400px;"></div>
<input id="txtSource" type="text" value="http://dev.live.com/virtualearth/sdk/model/house.obj" name="txtSource">
<input id="btnAddModel" type="button" value="Load 3D Model"
onclick="AddModel();">
</body>
</html>