The following message was emailed directly to sprocketonline (Iain).
Message body follows:
i got the source today from SVN, and wants to try the
MapOverlays.
i used the following code in page load.
GLatLng point = new GLatLng(37.4419, -122.1419);
gMap2.SetCenter(point, 13);
gMap2.AddOverlay(new GMarker(point));
Here is the result in the rendered page:
gMap2_Js.addControl(new GSmallMapControl());
gMap2_Js.addControl(new GMapTypeControl());
gMap2_Js.setCenter(new GLatLng(37.4419,-122.1419),13);
gMap2_Js.addOverlay
(WCPierce.Web.UI.WebControls.GoogleMap.GMarker);
The GMarker seems not working properly.
Is it a known issue or i did something wrong?
Thanks.
Maomao
It was then followed by the following email:
Message body follows:
i've noticed that the AddOverlay in GMap2.cs is as follows,
and this might be the reason that the page is not properly
rendered.
Thanks.
Maomao
===========================================
public string AddOverlay(GOverlay overlay)
{
string str = String.Format
(Utilities.UsCulture, "{0}.addOverlay({1});", this.JsId,
overlay);
initJs.Append(str);
return str;
}//AddOverlay(GOverlay overlay)
Logged In: YES
user_id=1021541
Originator: YES
I've added the following code to GMarker:
public override string ToJavascriptConstructor()
{
string retVal = string.Format(Utilities.UsCulture, @"new GMarker({0})", this.Point.ToJavascriptConstructor());
return retVal;
}
and updated addOverlay in GMap2 to include:
String.Format(Utilities.UsCulture, "{0}.addOverlay({1});", this.JsId, Overlay.ToJavascriptConstructor());
It's not quite a comprehensive solution, but hopefully good enough for now!