public Page() { InitializeComponent(); googleMapJS = new GoogleMapJS("silverlightControl"); theMap = new Map(MapBox, googleMapJS); theMap.OnShapeClick += new EventHandler(theMap_OnShapeClick); theMap.OnViewChange += new EventHandler(theMap_OnViewChange); theMap.OnZoom += new EventHandler(theMap_OnZoom); }
public void MapInit(Map mapJsObj) { HtmlPage.Window.Eval("var " + mapJsObj.Id + " = new GMap2(document.getElementById('" + mapJsObj.Id + "'));"); HtmlPage.Window.Eval("var " + sl_control + " = document.getElementById('" + sl_control + "');"); HtmlPage.Window.Eval(mapJsObj.Id + ".enableScrollWheelZoom();"); HtmlPage.Window.Eval(mapJsObj.Id + ".ViewChangeHandler = function(){var center = "+mapJsObj.Id+".getCenter(); " + sl_control + ".Content.MapEvent.OnMapViewChange('" + mapJsObj.Id + "',center.lat(),center.lng());}"); HtmlPage.Window.Eval(mapJsObj.Id + ".ZoomChangeHandler = function(oldLevel, newLevel){" + sl_control + ".Content.MapEvent.OnZoom('" + mapJsObj.Id + "',newLevel);}"); HtmlPage.Window.Eval(mapJsObj.Id + ".ClickHandler = function(overlay, point){try{" + sl_control + ".Content.MapEvent.OnMapClick('" + mapJsObj.Id + "',point.lat(),point.lng());}catch(ex){} " + "try{overlay.ClickHandler('" + mapJsObj.Id + "');}catch(ex){}}"); HtmlPage.Window.Eval("GEvent.addListener(" + mapJsObj.Id + ", 'moveend', " + mapJsObj.Id + ".ViewChangeHandler);"); HtmlPage.Window.Eval("GEvent.addListener(" + mapJsObj.Id + ", 'zoomend', " + mapJsObj.Id + ".ZoomChangeHandler);"); HtmlPage.Window.Eval("GEvent.addListener(" + mapJsObj.Id + ", 'click', " + mapJsObj.Id + ".ClickHandler);"); }
public void MapSetStyle(MapStyle style, Map mapJsObj) { switch (style) { case MapStyle.HYBRID: HtmlPage.Window.Eval(mapJsObj.Id + ".setMapType(G_HYBRID_MAP);"); break; case MapStyle.STREET: HtmlPage.Window.Eval(mapJsObj.Id + ".setMapType(G_NORMAL_MAP);"); break; case MapStyle.SATELLITE: HtmlPage.Window.Eval(mapJsObj.Id + ".setMapType(G_SATELLITE_MAP);"); break; default: break; } }
public void MapDeleteShape(MapShapes shape, Map mapJsObj) { HtmlPage.Window.Eval(mapJsObj.Id + ".removeOverlay(" + shape.Id + ");"); }
public void MapAddShape(MapShapes shape, Map mapJsObj) { HtmlPage.Window.Eval(mapJsObj.Id + ".addOverlay(" + shape.Id + ");"); }
public void MapSetCenterZoom(LatLng center, Int32 zoom, Map mapJsObj) { HtmlPage.Window.Eval(mapJsObj.Id + ".setCenter(new GLatLng(" + center.ToString() + ")," + zoom.ToString() + ");"); }