Advertisement
Guest User

Code

a guest
Feb 22nd, 2012
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Bing Map</title>
  4. <script src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3"></script>
  5. <script type="text/javascript">
  6.  
  7. var map;
  8.  
  9. function OnPageLoad() {
  10. map = new VEMap('myMap');
  11. map.LoadMap();
  12. map.HideDashboard();
  13. LoadShapes();
  14. map.AttachEvent("onmouseover", shapeInfoOver);
  15. map.AttachEvent("onmouseout", shapeInfoOut);
  16. map.AttachEvent("onmousemove", shapeInfoOver);
  17. }
  18. var infobox = "";
  19. function ShowInfoBox(polygon) {
  20. HideInfoBox();
  21. map.ShowInfoBox(polygon, new VELatLong(polygon.Latitude + 5, polygon.Longitude +5), new VEPixel(0, 0));
  22. }
  23.  
  24. function HideInfoBox() {
  25. map.HideInfoBox();
  26. }
  27.  
  28. function shapeInfoOver(e) {
  29. var Green = new VEColor(0, 255, 0, 0.2);
  30. if (e.elementID != null) {
  31. var polygon = map.GetShapeByID(e.elementID);
  32. polygon.SetFillColor(Green);
  33. polygon.SetLineColor(new VEColor(0, 0, 0, 0.2));
  34. 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>";
  35. map.ClearInfoBoxStyles();
  36. polygon.SetDescription(infobox);
  37. ShowInfoBox(polygon);
  38. }
  39. }
  40.  
  41. function shapeInfoOut(e) {
  42. var White = new VEColor(245, 242, 239, 0);
  43. if (e.elementID != null) {
  44. var polygon = map.GetShapeByID(e.elementID);
  45. polygon.SetFillColor(White);
  46. polygon.SetLineColor(new VEColor(0, 0, 0, 0));
  47. polygon.HideIcon();
  48. }
  49. }
  50.  
  51.  
  52. function LoadShapes() {
  53. var layer = new VEShapeLayer();
  54. var Green = new VEColor(0, 255, 0, 0.5);
  55. var White = new VEColor(245, 242, 239, 0);
  56. var polygon = new VEShape(VEShapeType.Polygon,
  57. [
  58. new VELatLong(41, -102),
  59. new VELatLong(37, -102),
  60. new VELatLong(37, -109),
  61. new VELatLong(41, -109)
  62. ]);
  63. polygon.SetTitle("Colorado");
  64.  
  65. polygon.SetDescription(infobox);
  66. polygon.SetLineColor(new VEColor(0, 0, 0, 0));
  67. polygon.SetFillColor(White);
  68. layer.AddShape(polygon);
  69.  
  70. var polygon1 = new VEShape(VEShapeType.Polygon,
  71. [
  72. new VELatLong(45, -104),
  73. new VELatLong(41, -104),
  74. new VELatLong(41, -111),
  75. new VELatLong(45, -111)
  76. ]);
  77. polygon1.SetTitle("Wyoming");
  78.  
  79. polygon1.SetDescription(infobox);
  80. polygon1.SetLineColor(new VEColor(0, 0, 0, 0));
  81. polygon1.SetFillColor(White);
  82. layer.AddShape(polygon1);
  83.  
  84. map.AddShapeLayer(layer);
  85. polygon.HideIcon();
  86. polygon1.HideIcon();
  87.  
  88. }
  89. </script>
  90. </head>
  91. <body onload="OnPageLoad();">
  92. <div id="myMap" style="position:relative;width:1000px;height:400px;"></div>
  93. </body>
  94. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement