Esempio n. 1
0
        // Map View manipulation handlers
        public override void OnMapClicked(MapClickInfo mapClickInfo)
        {
            if (mapClickInfo.ClickType == ClickType.ClickTypeLong)
            {
                MapPos clickPos = mapClickInfo.ClickPos;

                MapPos wgs84Clickpos = controller.baseProjection.ToWgs84(clickPos);
                Log.Debug("onMapClicked " + wgs84Clickpos + " " + mapClickInfo.ClickType);

                if (startPos == null)
                {
                    // set start, or start again
                    startPos = clickPos;
                    controller.setStartMarker(clickPos);
                }
                else if (stopPos == null)
                {
                    // set stop and calculate
                    stopPos = clickPos;
                    controller.setStopMarker(clickPos);
                    controller.showRoute(startPos, stopPos);

                    // restart to force new route next time
                    startPos = null;
                    stopPos  = null;
                }
            }
        }
        // Map View manipulation handlers
        public override void OnMapClicked(MapClickInfo mapClickInfo)
        {
            if (mapClickInfo.ClickType == ClickType.ClickTypeLong)
            {
                MapPos clickPos = mapClickInfo.ClickPos;

                if (startPos == null)
                {
                    // Set start, or start again
                    startPos = clickPos;

                    if (StartPositionClicked != null) {
                        StartPositionClicked(new object(), new RouteMapEventArgs { ClickPosition = clickPos });
                    }
                }
                else if (stopPos == null)
                {
                    // Set stop and calculate
                    stopPos = clickPos;

                    if (StartPositionClicked != null)
                    {
                        StopPositionClicked(new object(), new RouteMapEventArgs {
                            ClickPosition = clickPos,
                            StartPosition = startPos,
                            StopPosition = stopPos
                        });
                    }

                    // Restart to force new route next time
                    startPos = null;
                    stopPos = null;
                }
            }
        }
 public override void OnMapClicked(MapClickInfo mapClickInfo)
 {
     // Add default marker to the click location
     var styleBuilder = new MarkerStyleBuilder ();
     styleBuilder.Size = 10;
     var marker = new Marker (mapClickInfo.ClickPos, styleBuilder.BuildStyle());
     _dataSource.Add (marker);
 }
        public override void OnMapClicked(MapClickInfo mapClickInfo)
        {
            // Add default marker to the click location
            var styleBuilder = new MarkerStyleBuilder();

            styleBuilder.Size = 10;
            var marker = new Marker(mapClickInfo.ClickPos, styleBuilder.BuildStyle());

            _dataSource.Add(marker);
        }
Esempio n. 5
0
        public override void OnMapClicked(MapClickInfo mapClickInfo)
        {
            MapPos position = mapClickInfo.ClickPos;

            var request = new ReverseGeocodingRequest(projection, position);

            var meters = 125.0f;

            request.SearchRadius = meters;

            GeocodingResultVector results = new GeocodingResultVector();

            try
            {
                results = Service.CalculateAddresses(request);
            }
            catch (Exception e)
            {
                Carto.Utils.Log.Error("Reverse geocoding failed: " + e.Message);
            }

            GeocodingResult result = null;

            int count = results.Count;

            // Scan the results list. If we found relatively close point-based match,
            // use this instead of the first result.
            // In case of POIs within buildings, this allows us to hightlight POI instead of the building

            if (count > 0)
            {
                result = results[0];
            }

            for (int i = 0; i < count; i++)
            {
                GeocodingResult other = results[i];

                // 0.8f means 125 * (1.0 - 0.9) = 12.5 meters (rank is relative distance)
                if (other.Rank > 0.9f)
                {
                    string name = other.Address.Name;
                    // Points of interest usually have names, others just have addresses
                    if (!string.IsNullOrWhiteSpace(name))
                    {
                        result = other;
                        break;
                    }
                }
            }

            ResultFound?.Invoke(result, EventArgs.Empty);
        }
Esempio n. 6
0
        public override void OnMapClicked(MapClickInfo mapClickInfo)
        {
            // Remove old click label
            if (oldClickLabel != null)
            {
                vectorDataSource.Remove(oldClickLabel);
                oldClickLabel = null;
            }

            BalloonPopupStyleBuilder styleBuilder = new BalloonPopupStyleBuilder();

            // Make sure this label is shown on top all other labels
            styleBuilder.PlacementPriority = 10;

            // Check the type of the click
            string clickMsg = null;

            if (mapClickInfo.ClickType == ClickType.ClickTypeSingle)
            {
                clickMsg = "Single map click!";
            }
            else if (mapClickInfo.ClickType == ClickType.ClickTypeLong)
            {
                clickMsg = "Long map click!";
            }
            else if (mapClickInfo.ClickType == ClickType.ClickTypeDouble)
            {
                clickMsg = "Double map click!";
            }
            else if (mapClickInfo.ClickType == ClickType.ClickTypeDual)
            {
                clickMsg = "Dual map click!";
            }

            MapPos clickPos = mapClickInfo.ClickPos;

            // Show click coordinates also
            MapPos wgs84Clickpos = mapView.Options.BaseProjection.ToWgs84(clickPos);
            //string message = string.Format("%.4f, %.4f", wgs84Clickpos.Y, wgs84Clickpos.X);
            string message = Math.Round(wgs84Clickpos.Y, 4) + ", " + Math.Round(wgs84Clickpos.X, 4);

            BalloonPopupStyle style = styleBuilder.BuildStyle();
            BalloonPopup      popup = new BalloonPopup(mapClickInfo.ClickPos, style, clickMsg, message);

            vectorDataSource.Add(popup);

            oldClickLabel = popup;
        }
        public override void OnMapClicked(MapClickInfo mapClickInfo)
        {
            base.OnMapClicked(mapClickInfo);

            MarkerStyleBuilder builder = new MarkerStyleBuilder();

            // Set random size (within reasonable limits)
            int size = GetRandomInt(15, 50);
            builder.Size = size;

            // Set random color from our list
            builder.Color = colors[GetRandomInt(0, colors.Length)];

            // Set a new style to the marker
            marker.Style = builder.BuildStyle();
        }
        public override void OnMapClicked(MapClickInfo mapClickInfo)
        {
            // Remove old click label
            if (oldClickLabel != null)
            {
                vectorDataSource.Remove(oldClickLabel);
                oldClickLabel = null;
            }

            BalloonPopupStyleBuilder styleBuilder = new BalloonPopupStyleBuilder();
            // Make sure this label is shown on top all other labels
            styleBuilder.PlacementPriority = 10;

            // Check the type of the click
            string clickMsg = null;

            if (mapClickInfo.ClickType == ClickType.ClickTypeSingle)
            {
                clickMsg = "Single map click!";
            }
            else if (mapClickInfo.ClickType == ClickType.ClickTypeLong)
            {
                clickMsg = "Long map click!";
            }
            else if (mapClickInfo.ClickType == ClickType.ClickTypeDouble)
            {
                clickMsg = "Double map click!";
            }
            else if (mapClickInfo.ClickType == ClickType.ClickTypeDual)
            {
                clickMsg = "Dual map click!";
            }

            MapPos clickPos = mapClickInfo.ClickPos;

            // Show click coordinates also
            MapPos wgs84Clickpos = mapView.Options.BaseProjection.ToWgs84(clickPos);
            //string message = string.Format("%.4f, %.4f", wgs84Clickpos.Y, wgs84Clickpos.X);
            string message = Math.Round(wgs84Clickpos.Y, 4) + ", " + Math.Round(wgs84Clickpos.X, 4);

            BalloonPopupStyle style = styleBuilder.BuildStyle();
            BalloonPopup popup = new BalloonPopup(mapClickInfo.ClickPos, style, clickMsg, message);

            vectorDataSource.Add(popup);

            oldClickLabel = popup;
        }
        public override void OnMapClicked(MapClickInfo mapClickInfo)
        {
            base.OnMapClicked(mapClickInfo);

            MarkerStyleBuilder builder = new MarkerStyleBuilder();

            // Set random size (within reasonable limits)
            int size = GetRandomInt(15, 50);

            builder.Size = size;

            // Set random color from our list
            builder.Color = colors[GetRandomInt(0, colors.Length)];

            // Set a new style to the marker
            marker.Style = builder.BuildStyle();
        }
        // Map View manipulation handlers
        public override void OnMapClicked(MapClickInfo mapClickInfo)
        {
            if (mapClickInfo.ClickType == ClickType.ClickTypeSingle)
            {
                SingleTapped?.Invoke(this, EventArgs.Empty);
            }

            if (mapClickInfo.ClickType == ClickType.ClickTypeLong)
            {
                MapPos clickPos = mapClickInfo.ClickPos;

                if (startPos == null)
                {
                    // Set start, or start again
                    startPos = clickPos;

                    if (StartPositionClicked != null)
                    {
                        StartPositionClicked(new object(), new RouteMapEventArgs {
                            ClickPosition = clickPos
                        });
                    }
                }
                else if (stopPos == null)
                {
                    // Set stop and calculate
                    stopPos = clickPos;

                    if (StartPositionClicked != null)
                    {
                        StopPositionClicked(new object(), new RouteMapEventArgs {
                            ClickPosition = clickPos,
                            StartPosition = startPos,
                            StopPosition  = stopPos
                        });
                    }

                    // Restart to force new route next time
                    startPos = null;
                    stopPos  = null;
                }
            }
        }
Esempio n. 11
0
 public override void OnMapClicked(MapClickInfo mapClickInfo)
 {
     MapClicked?.Invoke(mapClickInfo, EventArgs.Empty);
 }
 public override void OnMapClicked(MapClickInfo mapClickInfo)
 {
     Source.Clear();
 }
 public override void OnMapClicked(MapClickInfo mapClickInfo)
 {
     vectorLayer.SelectedVectorElement = null;
 }
 public override void OnMapClicked(MapClickInfo mapClickInfo)
 {
     vectorLayer.SelectedVectorElement = null;
 }