示例#1
0
        internal GoogleMapWrapper(IGoogleMapHost browser, MapOptions mapOptions, StreetViewOptions streetViewOptions, string apiKey = null, bool sensor = false, string regionString = null)
        {
            _markers        = new Dictionary <int, Marker>();
            _polygons       = new Dictionary <int, Polygon>();
            _circles        = new Dictionary <int, Circle>();
            _infoWindows    = new Dictionary <int, InfoWindow>();
            _polylines      = new Dictionary <int, Polyline>();
            _groundOverlays = new Dictionary <int, GroundOverlay>();
            _rectangles     = new Dictionary <int, Rectangle>();

            _browser = browser;

            ApiKey       = apiKey;
            Sensor       = sensor;
            RegionString = regionString;

            _mapOptions        = mapOptions;
            _streetViewOptions = streetViewOptions;
            _zoom   = mapOptions.Zoom;
            _center = mapOptions.Center;

            StringBuilder documentBuilder = new StringBuilder();

            using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(String.Format("{0}.Map.html", this.GetType().Namespace)))
            {
                using (StreamReader reader = new StreamReader(stream))
                {
                    while (!reader.EndOfStream)
                    {
                        var line = reader.ReadLine();
                        documentBuilder.AppendLine(line);

                        if (line == "<head>")
                        {
                            //Inject JQuery scripts
                            documentBuilder.AppendLine(GetScriptText());
                        }
                    }
                }
            }
            _browser.SetHostDocumentText(documentBuilder.ToString());
            _browser.RegisterScriptingObject(this);
            _documentLoaded = true;
            _streetView     = new StreetView(_browser);
            _geometry       = new Geometry(_browser);
        }
示例#2
0
 /// <summary>
 /// Creates a new Google Map
 /// </summary>
 /// <param name="host">Browser host to host Google Maps i</param>
 /// <param name="mapOptions">Customize the look of the map</param>
 /// <param name="streetViewOptions">Customize the look of the street view panormama</param>
 /// <param name="apiKey">API key (Optional, but if required visit this site: "https://code.google.com/apis/console/")</param>
 /// <param name="sensor">Whether calling from a sensor. Defaults to false.</param>
 /// <param name="regionString">Country code (ie. "za"). Defaults to NULL</param>
 /// <returns>Interface to interact with Google Maps</returns>
 public static IGoogleMapWrapper Create(IGoogleMapHost host, MapOptions mapOptions, StreetViewOptions streetViewOptions, string apiKey = null, bool sensor = false, string regionString = null)
 {
     return(new GoogleMapWrapper(host, mapOptions, streetViewOptions, apiKey, sensor, regionString));
 }
示例#3
0
 /// <summary>
 /// Creates a new Google Map
 /// </summary>
 /// <param name="host">Browser host to host Google Maps in</param>
 /// <returns>Interface to interact with Google Maps</returns>
 public static IGoogleMapWrapper Create(IGoogleMapHost host)
 {
     return(new GoogleMapWrapper(host, new MapOptions(), new StreetViewOptions()));
 }
示例#4
0
 internal GroundOverlay(IGoogleMapHost host, int groundOverlayId)
 {
     GroundOverlayId = groundOverlayId;
     _host           = host;
 }
示例#5
0
 internal InfoWindow(IGoogleMapHost host, int infoWindowId)
 {
     InfoWindowID = infoWindowId;
     _host        = host;
 }
示例#6
0
 internal Circle(IGoogleMapHost host, int circleId)
 {
     CircleId = circleId;
     _host    = host;
 }
示例#7
0
 internal Marker(IGoogleMapHost host, int markerId)
 {
     MarkerId = markerId;
     _host    = host;
 }
示例#8
0
 internal Polyline(IGoogleMapHost host, int polylineId)
 {
     PolylineId = polylineId;
     _host      = host;
 }
示例#9
0
 internal Rectangle(IGoogleMapHost host, int rectangleId)
 {
     RectangleId = rectangleId;
     _host       = host;
 }
示例#10
0
 public Geometry(IGoogleMapHost host)
 {
     _host = host;
 }
示例#11
0
 internal Polygon(IGoogleMapHost host, int polygonId)
 {
     PolygonId = polygonId;
     _host     = host;
 }
示例#12
0
 public StreetView(IGoogleMapHost host)
 {
     _host = host;
     _markers = new Dictionary<int, Marker>();
     _infoWindows = new Dictionary<int, InfoWindow>();
 }