Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Bing Map</title>
- <script src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3"></script>
- <script type="text/javascript">
- var map;
- function OnPageLoad() {
- map = new VEMap('myMap');
- map.LoadMap();
- map.HideDashboard();
- LoadShapes();
- map.AttachEvent("onmouseover", shapeInfoOver);
- map.AttachEvent("onmouseout", shapeInfoOut);
- map.AttachEvent("onmousemove", shapeInfoOver);
- }
- var infobox = "";
- function ShowInfoBox(polygon) {
- HideInfoBox();
- map.ShowInfoBox(polygon, new VELatLong(polygon.Latitude + 5, polygon.Longitude +5), new VEPixel(0, 0));
- }
- function HideInfoBox() {
- map.HideInfoBox();
- }
- function shapeInfoOver(e) {
- var Green = new VEColor(0, 255, 0, 0.2);
- if (e.elementID != null) {
- var polygon = map.GetShapeByID(e.elementID);
- polygon.SetFillColor(Green);
- polygon.SetLineColor(new VEColor(0, 0, 0, 0.2));
- var infobox = "<TABLE WIDTH=50 ;position: absolute;top: 0px;left: 20px;padding: 0px;border: 0px;background-color: black;><TD ALIGN=center><FONT COLOR=black; SIZE=2>msg</FONT></TD></TABLE>";
- map.ClearInfoBoxStyles();
- polygon.SetDescription(infobox);
- ShowInfoBox(polygon);
- }
- }
- function shapeInfoOut(e) {
- var White = new VEColor(245, 242, 239, 0);
- if (e.elementID != null) {
- var polygon = map.GetShapeByID(e.elementID);
- polygon.SetFillColor(White);
- polygon.SetLineColor(new VEColor(0, 0, 0, 0));
- polygon.HideIcon();
- }
- }
- function LoadShapes() {
- var layer = new VEShapeLayer();
- var Green = new VEColor(0, 255, 0, 0.5);
- var White = new VEColor(245, 242, 239, 0);
- var polygon = new VEShape(VEShapeType.Polygon,
- [
- new VELatLong(41, -102),
- new VELatLong(37, -102),
- new VELatLong(37, -109),
- new VELatLong(41, -109)
- ]);
- polygon.SetTitle("Colorado");
- polygon.SetDescription(infobox);
- polygon.SetLineColor(new VEColor(0, 0, 0, 0));
- polygon.SetFillColor(White);
- layer.AddShape(polygon);
- var polygon1 = new VEShape(VEShapeType.Polygon,
- [
- new VELatLong(45, -104),
- new VELatLong(41, -104),
- new VELatLong(41, -111),
- new VELatLong(45, -111)
- ]);
- polygon1.SetTitle("Wyoming");
- polygon1.SetDescription(infobox);
- polygon1.SetLineColor(new VEColor(0, 0, 0, 0));
- polygon1.SetFillColor(White);
- layer.AddShape(polygon1);
- map.AddShapeLayer(layer);
- polygon.HideIcon();
- polygon1.HideIcon();
- }
- </script>
- </head>
- <body onload="OnPageLoad();">
- <div id="myMap" style="position:relative;width:1000px;height:400px;"></div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement