Exemplo n.º 1
0
        private void Ellipse_MouseEnter(object sender, MouseEventArgs e)
        {
            var ellipse = (Ellipse)sender;

            // the location to display the popup
            var location = (Point)ellipse.Tag;

            // create a new wpf text blox
            var border = new Border {
                BorderBrush = Brushes.Black, BorderThickness = new Thickness(2, 2, 1, 1)
            };
            var textBlock = new TextBlock
            {
                Padding    = new Thickness(2),
                Background = Brushes.Yellow,
                Foreground = Brushes.Black,
                Text       = GeoTransform.LatLonToString(location.Y, location.X, true)
            };

            border.Child = textBlock;
            popup.Child  = border;

            // get the MapView object from the control
            var mapView = MapElementExtensions.FindChild <MapView>(Map);
            // transform
            var popupLocation = mapView.WgsToCanvas(Map, location);

            popup.Placement        = PlacementMode.RelativePoint;
            popup.PlacementTarget  = Map;
            popup.HorizontalOffset = popupLocation.X;
            popup.VerticalOffset   = popupLocation.Y;

            popup.IsOpen    = true;
            popup.StaysOpen = false;
        }
        public MapWindow()
        {
            InitializeComponent();

            // set map parameters
            Map.XMapStyle       = "silkysand";
            Map.XMapUrl         = "https://api-test.cloud.ptvgroup.com/xmap/ws/XMap";
            Map.XMapCredentials = "Insert your xToken here";

            // get the map container grid
            var grid = MapElementExtensions.FindChild <Grid>(Map);

            // get the old interactor
            var pz = Map.FindRelative <Ptv.XServer.Controls.Map.Gadgets.PanAndZoom>();

            // exchange the interactor
            grid.Children.Remove(pz);
            grid.Children.Add(customPanAndZoom);

            Map.FitInWindow = true;

            // check token
            if (!string.IsNullOrWhiteSpace(Map.XMapCredentials) && !Map.XMapCredentials.Contains("insert"))
            {
                return;
            }

            MessageBox.Show("Please adopt the Map.XMapCredentials parameter in MapWindow.xaml.cs and provide a valid token.");
            Process.GetCurrentProcess().Kill();
        }
Exemplo n.º 3
0
        private void Map_Loaded(object sender, RoutedEventArgs e)
        {
            hardwareLevel.Text = "Hardware Level: " + (RenderCapability.Tier >> 16);

            var center = new Point(8.4, 49); // KA

            InitializeBasemap();

            // Map.MouseDragMode = DragMode.SelectOnShift;
            // replace the standard pan/zoom interactor with an extended VDI interactor
            customPanAndZoom = new PanAndZoom {
                MoveWhileDragging = usePanMoveWhileDragging, UseSimpleSelectShape = usePanSimpleShape
            };
            // get the map container grid
            var grid = MapElementExtensions.FindChild <Grid>(Map);
            // get the old interactor
            var pz = Map.FindRelative <Ptv.XServer.Controls.Map.Gadgets.PanAndZoom>();

            // exchange the interactor
            grid.Children.Remove(pz);
            grid.Children.Add(customPanAndZoom);

            // create some random coordinates
            CreateCoordinates(center);

            // initialize the symbol layer
            AddSymbols();

            // set map center
            Map.SetMapLocation(center, 9);
        }
        public Window1()
        {
            InitializeComponent();

            // get the map container grid
            var grid = MapElementExtensions.FindChild <Grid>(Map);
            // get the old interactor
            var pz = Map.FindRelative <Ptv.XServer.Controls.Map.Gadgets.PanAndZoom>();

            // exchange the interactor
            grid.Children.Remove(pz);
            grid.Children.Add(customPanAndZoom);

            Map.FitInWindow = true;
        }