public GroundOverlay(string url, LatLngBounds bounds, GroundOverlayOptions options) { this.url = url; this.bounds = bounds; this.Options = options; }
public override string ToString() { StringBuilder sb = new StringBuilder(); if (anchor != null) { // TODO :: Old classes conversion -> TO ASP.NET //if (anchor.GetType().IsAssignableFrom(typeof(Marker))) //{ // anchor = ((Marker) anchor).ToMarker(this.mapId); //} //else if (anchor.GetType() == typeof(Polygon)) //{ // anchor = ((Polygon)anchor).ToPolygon(this.mapId); //} //else if (anchor.GetType() == typeof(Polyline)) //{ // anchor = ((Polyline)anchor).ToPolyline(this.mapId); //} if (anchor is Marker) { Marker marker = (Marker)anchor; sb.Append(marker.ToString()); // Create Window if (!string.IsNullOrEmpty(Id)) { sb.AppendFormat("var {0}=new {2}({1});", Id, Options, ClassName); } else { sb.AppendFormat("new {1}({0});", Options, ClassName); } // Assign event if (!KeepOpenWindows) { sb.AppendFormat("google.maps.event.addListener({0},'{1}',function(){{closeWindows('{3}');{2}.open({3},{0});}});", marker.Id, _markerEvent, Id, mapId); } else { sb.AppendFormat("google.maps.event.addListener({0},'{1}',function(){{{2}.open({3},{0});}});", marker.Id, _markerEvent, Id, mapId); } if (OpenOnLoad) { if (!KeepOpenWindows) { sb.AppendFormat("closeWindows('{0}');", mapId); } sb.AppendFormat("{0}.open({1},{2});", Id, mapId, marker.Id); } } else if (anchor.GetType() == typeof(Polygon)) { Polygon polygon = (Polygon)anchor; polygon.Options.Clickable = true; LatLngBounds latLngBounds = new LatLngBounds(polygon); Options.Position = latLngBounds.GetCenter(); // Create poly sb.AppendFormat("{0}{1};", polygon.ToStringPath(), polygon); // Create Window if (!string.IsNullOrEmpty(Id)) { sb.AppendFormat("var {0}=new {2}({1});", Id, Options, ClassName); } else { sb.AppendFormat("new {1}({0});", Options, ClassName); } // Assign event if (!KeepOpenWindows) { sb.AppendFormat("google.maps.event.addListener({0},'{1}',function(){{closeWindows('{3}');{2}.open({3});}});", polygon.Id, _polygonEvent, Id, mapId); } else { sb.AppendFormat("google.maps.event.addListener({0},'{1}',function(){{{2}.open({3});}});", polygon.Id, _polygonEvent, Id, mapId); } if (OpenOnLoad) { if (!KeepOpenWindows) { sb.AppendFormat("closeWindows('{0}');", mapId); } sb.AppendFormat("{0}.open({1});", Id, mapId); } } else if (anchor.GetType() == typeof(Polyline)) { Polyline polyline = (Polyline)anchor; polyline.Options.Clickable = true; LatLngBounds latLngBounds = new LatLngBounds(polyline); Options.Position = latLngBounds.GetCenter(); // Create poly sb.AppendFormat("{0}{1};", polyline.ToStringPath(), polyline); // Create Window if (!string.IsNullOrEmpty(Id)) { sb.AppendFormat("var {0}=new {2}({1});", Id, Options, ClassName); } else { sb.AppendFormat("new {1}({0});", Options, ClassName); } // Assign event if (!KeepOpenWindows) { sb.AppendFormat( "google.maps.event.addListener({0},'{1}',function(){{closeWindows('{3}');{2}.open({3});}});", polyline.Id, _polylineEvent, Id, mapId); } else { sb.AppendFormat( "google.maps.event.addListener({0},'{1}',function(){{{2}.open({3});}});", polyline.Id, _polylineEvent, Id, mapId); } if (OpenOnLoad) { if (!KeepOpenWindows) { sb.AppendFormat("closeWindows('{0}');", mapId); } sb.AppendFormat("{0}.open({1});", Id, mapId); } } } if (anchor == null) { if (!string.IsNullOrEmpty(Id)) { sb.AppendFormat("var {0}=new {2}({1});", Id, Options, ClassName); } else { sb.AppendFormat("new {1}({0});", Options, ClassName); } if (!KeepOpenWindows) { sb.AppendFormat("closeWindows('{0}');", mapId); } sb.AppendFormat("{0}.open({1});", Id, mapId); } if (!string.IsNullOrEmpty(mapId) && !string.IsNullOrEmpty(Id)) { sb.AppendFormat("GMapsProperties['{0}']['windowArray'].push(['{1}',{1}]);", mapId, Id); } // Events if (!string.IsNullOrEmpty(OpenFunction)) { sb.AppendFormat("google.maps.event.addListener({0},'domready',{1});", Id, OpenFunction); } if (!string.IsNullOrEmpty(CloseFunction)) { sb.AppendFormat("google.maps.event.addListener({0},'closeclick',{1});", Id, CloseFunction); } return(sb.ToString()); }