Beispiel #1
0
        private static PointStyle GetCurrentVehicleStyle(string iconVirtualPath)
        {
            Stream   vehicleStream = MapSuiteSampleHelper.GetResourceStream(iconVirtualPath);
            GeoImage vehicleImage  = new GeoImage(vehicleStream);

            return(new PointStyle(vehicleImage));
        }
Beispiel #2
0
        private static PointStyle GetVehicleTrailStyle()
        {
            Stream historyStream = MapSuiteSampleHelper.GetResourceStream("trail point.png");

            historyStream.Seek(0, SeekOrigin.Begin);

            return(new PointStyle(new GeoImage(historyStream)));
        }
        private bool ApplyBingMapsKey()
        {
            bool   cancel      = false;
            string bingMapsKey = MapSuiteSampleHelper.GetBingMapsKey();

            if (!string.IsNullOrEmpty(bingMapsKey))
            {
                foreach (var bingOverlay in MapControl.Overlays.OfType <BingMapsOverlay>())
                {
                    bingOverlay.ApplicationId = bingMapsKey;
                }
            }
            else
            {
                cancel = true;
            }

            return(cancel);
        }
Beispiel #4
0
        private void TrackOverlay_MapMouseClick(object sender, MapMouseClickInteractiveOverlayEventArgs e)
        {
            PointShape           clickedPoint         = new PointShape(e.InteractionArguments.WorldX, e.InteractionArguments.WorldY);
            RectangleShape       rect                 = MapSuiteSampleHelper.GetBufferedRectangle(clickedPoint, mapModel.MapControl.CurrentResolution);
            Collection <Feature> intersectingFeatures = mapModel.MapControl.TrackOverlay.TrackShapeLayer.QueryTools.GetFeaturesIntersecting(rect, ReturningColumnsType.AllColumns);

            if (intersectingFeatures.Count > 0)
            {
                if (mapModel.MapControl.EditOverlay.EditShapesLayer.InternalFeatures.Count > 0)
                {
                    foreach (var item in mapModel.MapControl.EditOverlay.EditShapesLayer.InternalFeatures)
                    {
                        mapModel.MapControl.TrackOverlay.TrackShapeLayer.InternalFeatures.Add(item.Id, item);
                    }
                    mapModel.MapControl.EditOverlay.EditShapesLayer.InternalFeatures.Clear();
                }
                mapModel.MapControl.TrackOverlay.TrackShapeLayer.InternalFeatures.Remove(intersectingFeatures[0].Id);
                mapModel.MapControl.EditOverlay.EditShapesLayer.InternalFeatures.Add(intersectingFeatures[0]);
                mapModel.MapControl.EditOverlay.CalculateAllControlPoints();
                mapModel.MapControl.Refresh(mapModel.MapControl.TrackOverlay);
                mapModel.MapControl.Refresh(mapModel.MapControl.EditOverlay);
            }
        }
        private void WpfMap1_MapClick(object sender, MapClickWpfMapEventArgs e)
        {
            if (e.MouseButton == MapMouseButton.Left)
            {
                RectangleShape clickedArea = MapSuiteSampleHelper.GetBufferedRectangle(e.WorldLocation, mapControl.CurrentResolution);
                PopupOverlay.Popups.Clear();
                foreach (InMemoryFeatureLayer vehicleLayer in TraceOverlay.Layers.OfType <InMemoryFeatureLayer>())
                {
                    vehicleLayer.Open();
                    Collection <Feature> resultFeatures = vehicleLayer.QueryTools.GetFeaturesIntersecting(clickedArea, ReturningColumnsType.AllColumns);
                    if (resultFeatures.Count > 0)
                    {
                        Popup            popup            = new Popup(e.WorldLocation);
                        PopupUserControl popupUserControl = new PopupUserControl(resultFeatures[0]);
                        popupUserControl.PopupOverlay = PopupOverlay;

                        popup.Content = popupUserControl;
                        PopupOverlay.Popups.Add(popup);
                        PopupOverlay.Refresh();
                        break;
                    }
                }
            }
        }