示例#1
0
 internal void FireMarkerDoubleClick(GeographicLocation location)
 {
     if (DoubleClick != null)
     {
         DoubleClick(this, location);
     }
 }
示例#2
0
 internal void FirePolygonClick(GeographicLocation location)
 {
     if (Click != null)
     {
         Click(this, location);
     }
 }
示例#3
0
        public GeographicLocation ComputeOffset(GeographicLocation from, double distance, double heading)
        {
            string jsonFrom = JsonConvert.SerializeObject(from);
            var    result   = (string)_host.InvokeScript("computeOffset", jsonFrom, distance, heading);

            return(JsonConvert.DeserializeObject <GeographicLocation>(result));
        }
示例#4
0
        public double ComputeHeading(GeographicLocation from, GeographicLocation to)
        {
            string jsonFrom = JsonConvert.SerializeObject(from);
            string jsonTo   = JsonConvert.SerializeObject(to);

            return((double)_host.InvokeScript("computeHeading", jsonFrom, jsonTo));
        }
示例#5
0
 internal void FireMarkerRightClick(GeographicLocation location)
 {
     if (RightClick != null)
     {
         RightClick(this, location);
     }
 }
示例#6
0
 internal void FireMarkerDragEnd(GeographicLocation location)
 {
     if (DragEnd != null)
     {
         DragEnd(this, location);
     }
 }
示例#7
0
 internal void FireGroundOverlayDoubleClick(GeographicLocation location)
 {
     if (DoubleClick != null)
     {
         DoubleClick(this, location);
     }
 }
示例#8
0
 internal void FireCircleClick(GeographicLocation location)
 {
     if (Click != null)
     {
         Click(this, location);
     }
 }
示例#9
0
        public MapOptions()
        {
            Zoom                     = 5;
            Center                   = new GeographicLocation(-26.68, 25.27); //South Africa
            MapType                  = MapTypeId.Roadmap;
            AllowScrollWheel         = true;
            KeyboardShortcutsEnabled = true;
            DraggingEnabled          = true;
            DisableDoubleClickZoom   = false;

            ShowStreetViewControl  = true;
            ShowZoomControl        = true;
            ShowScaleControl       = false;
            ShowRotateControl      = false;
            ShowPanControl         = true;
            ShowOverviewMapControl = false;
            ShowMapTypeControl     = true;
            ShowMapMakers          = false;

            ZoomControlOptions       = new ZoomControlOptions();
            StreetViewControlOptions = new StreetViewControlOptions();
            ScaleControlOptions      = new ScaleControlOptions();
            RotateControlOptions     = new RotateControlOptions();
            PanControlOptions        = new PanControlOptions();
            OverviewControlOptions   = new OverviewControlOptions();
            MapTypeControlOptions    = new MapTypeControlOptions();
        }
示例#10
0
 internal void FirePolylineRightClick(GeographicLocation location)
 {
     if (RightClick != null)
     {
         RightClick(this, location);
     }
 }
示例#11
0
 internal void FireRectangleDoubleClick(GeographicLocation location)
 {
     if (DoubleClick != null)
     {
         DoubleClick(this, location);
     }
 }
示例#12
0
 internal void FireRectangleRightClick(GeographicLocation location)
 {
     if (RightClick != null)
     {
         RightClick(this, location);
     }
 }
示例#13
0
 public void FireMapCenterChanged(double latitude, double longitude)
 {
     _center = new GeographicLocation(latitude, longitude);
     if (CenterChanged != null)
     {
         CenterChanged(_center);
     }
 }
示例#14
0
        public GeographicLocation Interpolate(GeographicLocation from, GeographicLocation to, double fraction)
        {
            string jsonFrom = JsonConvert.SerializeObject(from);
            string jsonTo   = JsonConvert.SerializeObject(to);
            var    result   = (string)_host.InvokeScript("interpolate", jsonFrom, jsonTo, fraction);

            return(JsonConvert.DeserializeObject <GeographicLocation>(result));
        }
示例#15
0
        public IMarker AddMarker(GeographicLocation location, MarkerOptions markerOptions, bool hideOthers = false)
        {
            string jsonLocation      = JsonConvert.SerializeObject(location);
            string jsonMarkerOptions = JsonConvert.SerializeObject(markerOptions);
            int    markerId          = (int)_browser.InvokeScript("addMarker", jsonLocation, jsonMarkerOptions, hideOthers, false);

            _markers[markerId] = new Marker(_browser, markerId);
            return(_markers[markerId]);
        }
示例#16
0
        public ICircle DrawCircle(GeographicLocation center, double radius, CircleOptions circleOptions, bool hideOthers = false)
        {
            string jsonLocation      = JsonConvert.SerializeObject(center);
            string jsonCircleOptions = JsonConvert.SerializeObject(circleOptions);
            int    circleId          = (int)_browser.InvokeScript("drawCircle", jsonLocation, radius, jsonCircleOptions, hideOthers);

            _circles[circleId] = new Circle(_browser, circleId);
            return(_circles[circleId]);
        }
示例#17
0
        public IInfoWindow ShowInfoWindow(string contentString, GeographicLocation location, InfoWindowOptions infoWindowOptions, bool hideOthers = false)
        {
            string jsonLocation          = JsonConvert.SerializeObject(location);
            string jsonInfoWindowOptions = JsonConvert.SerializeObject(infoWindowOptions);
            int    infoWindowId          = (int)_browser.InvokeScript("showInfoWindow", contentString, jsonLocation, null, jsonInfoWindowOptions, hideOthers, false);

            _infoWindows[infoWindowId] = new InfoWindow(_browser, infoWindowId);
            return(_infoWindows[infoWindowId]);
        }
示例#18
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);
        }
示例#19
0
 public bool IsLocationOnEdge(IPolyline polyline, GeographicLocation location, double?tolerance)
 {
     return((bool)_host.InvokeScript("isLocationOnEdge", location.Latitude, location.Longitude, polyline.PolylineId, false, tolerance));
 }
示例#20
0
 public GeocodingResponse RunGeocoder(GeographicLocation location)
 {
     return(GeocodingService.GetResponse(location));
 }
示例#21
0
        public void PanTo(GeographicLocation location)
        {
            string jsonLocation = JsonConvert.SerializeObject(location);

            _browser.InvokeScript("panToLocation", jsonLocation);
        }
示例#22
0
 public bool ContainsLocation(IPolygon polygon, GeographicLocation location)
 {
     return((bool)_host.InvokeScript("containsLocation", location.Latitude, location.Longitude, polygon.PolygonId));
 }
示例#23
0
        public static GeocodingResponse GetResponse(GeographicLocation location)
        {
            var url = new Uri(String.Format("{0}json?latlng={1},{2}&sensor=false", ApiUrl, location.Latitude, location.Longitude));

            return(Http.Get(url).As <GeocodingResponse>());
        }
示例#24
0
 public bool IsLocationOnEdge(IPolygon polygon, GeographicLocation location, double?tolerance)
 {
     return((bool)_host.InvokeScript("isLocationOnEdge", location.Latitude, location.Longitude, polygon.PolygonId, true, tolerance));
 }