VEShape.SetLineToGround Method
You are not viewing the latest version of the AJAX control. Bing Maps AJAX V7 is the recommended JavaScript control for Bing Maps. If you need this documentation, it is available in as a CHM or PDF download.
Specifies whether a line is drawn from the shape to the ground.
VEShape.SetLineToGround(extrude);
Parameters
Parameter | Description |
---|---|
extrude |
A Boolean value specifying whether a line is drawn from the shape to the ground. |
Return Value
Returns false if the shape is a model; otherwise does not return a value.
Remarks
This method is for Polyline and Polygon shapes.
Examples
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="https://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3"></script>
<script type="text/javascript">
var map = null;
var center = new VELatLong(43.75, -99.71);
var bumpLatLong = 0.1;
var altitude = 100;
function GetMap()
{
map = new VEMap('myMap');
map.LoadMap(center);
map.SetZoomLevel(10);
btnaddpolyline.disabled = 0;
btnzoomclose.disabled = "disabled";
}
function AddPolyline()
{
var ll = map.GetCenter();
var lat = ll.Latitude;
var lon = ll.Longitude;
var shape =
new VEShape(VEShapeType.Polyline,
[new VELatLong(lat - bumpLatLong, lon - bumpLatLong, altitude),
new VELatLong(lat + bumpLatLong, lon - bumpLatLong, altitude),
new VELatLong(lat + bumpLatLong, lon, altitude),
new VELatLong(lat - bumpLatLong, lon, altitude),
new VELatLong(lat - bumpLatLong, lon + bumpLatLong, altitude),
new VELatLong(lat + bumpLatLong, lon + bumpLatLong, altitude)]);
// Add a line to the ground if there isn't one already
var HasLineToGround = shape.GetLineToGround();
if(!HasLineToGround)
{
shape.SetLineToGround(true);
}
shape.SetTitle("My polyline");
shape.SetDescription("This is my shape");
map.AddShape(shape);
btnaddpolyline.disabled = "disabled";
btnzoomclose.disabled = 0;
}
function ZoomClose()
{
// Go 3D, then center and zoom
map.AttachEvent("oninitmode", ThreeDIsNowLoaded);
map.SetMapMode(VEMapMode.Mode3D);
}
function ThreeDIsNowLoaded()
{
// disable this event handler
map.DetachEvent("oninitmode", ThreeDIsNowLoaded);
// Zoom and center to where user can see the line to ground
map.SetHeading(0.0);
map.SetPitch(-13);
map.SetCenterAndZoom(new VELatLong(43.6530, -99.7037), 17);
// Disable button
btnzoomclose.disabled = "disabled";
}
</script>
</head>
<body onload="GetMap();">
<div id='myMap' style="position:relative; width:600px; height:400px;"></div>
<input id="btnaddpolyline" type="button" value="Click to Add a Polyline"
name="addpolyline" onclick="AddPolyline()">
<br/>
<input id="btnzoomclose" type="button" value="Click to Zoom in 3D to see the line close up"
name="zoomclose" onclick="ZoomClose()">
</body>
</html>