Пример #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));
 }