Ejemplo n.º 1
0
        protected MapTileLayerBase(ITileImageLoader tileImageLoader)
        {
            RenderTransform = new MatrixTransform();
            TileImageLoader = tileImageLoader;

            updateTimer = new DispatcherTimer {
                Interval = UpdateInterval
            };
            updateTimer.Tick += (s, e) => Update(false);

            MapPanel.InitMapElement(this);
        }
Ejemplo n.º 2
0
        public MapTileLayer(ITileImageLoader tileImageLoader)
        {
            IsHitTestVisible = false;
            RenderTransform  = new MatrixTransform();
            TileImageLoader  = tileImageLoader;

            updateTimer = new DispatcherTimer {
                Interval = UpdateInterval
            };
            updateTimer.Tick += (s, e) => UpdateTileGrid();

            MapPanel.InitMapElement(this);
        }
Ejemplo n.º 3
0
        protected MapTileLayerBase(ITileImageLoader tileImageLoader)
        {
            RenderTransform = new MatrixTransform();

            TileImageLoader          = tileImageLoader;
            TileImageLoader.Progress = new Progress <double>(p => LoadingProgress = p);

            updateTimer       = this.CreateTimer(UpdateInterval);
            updateTimer.Tick += async(s, e) => await Update();

#if WINUI || UWP
            MapPanel.InitMapElement(this);
#endif
        }
        protected internal void OnItemClicked(FrameworkElement mapItem, bool controlKey, bool shiftKey)
        {
            var item = ItemFromContainer(mapItem);

            if (SelectionMode == SelectionMode.Single)
            {
                // Single -> set only SelectedItem

                if (SelectedItem != item)
                {
                    SelectedItem = item;
                }
                else if (controlKey)
                {
                    SelectedItem = null;
                }
            }
            else if (SelectionMode == SelectionMode.Multiple || controlKey)
            {
                // Multiple or Extended with Ctrl -> toggle item in SelectedItems

                if (SelectedItems.Contains(item))
                {
                    SelectedItems.Remove(item);
                }
                else
                {
                    SelectedItems.Add(item);
                }
            }
            else if (shiftKey && SelectedItem != null)
            {
                // Extended with Shift -> select items in viewport rectangle

                var p1 = MapPanel.GetViewportPosition(ContainerFromItem(SelectedItem));
                var p2 = MapPanel.GetViewportPosition(mapItem);

                if (p1.HasValue && p2.HasValue)
                {
                    SelectItemsInRect(new Rect(p1.Value, p2.Value));
                }
            }
            else if (SelectedItem != item)
            {
                // Extended without Control or Shift -> set selected item

                SelectedItem = item;
            }
        }
Ejemplo n.º 5
0
        protected virtual void UpdateData()
        {
            MapPanel.SetLocation(this, Location);

            if (parentMap != null && Data != null && Location != null)
            {
                var scale     = parentMap.GetScale(Location);
                var transform = new Matrix(scale.X, 0d, 0d, scale.Y, 0d, 0d);

                transform.Rotate(parentMap.ViewTransform.Rotation);

                Data.Transform = new MatrixTransform {
                    Matrix = transform
                };
            }
        }
Ejemplo n.º 6
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            var parentMap = MapPanel.GetParentMap(this);

            if (parentMap != null)
            {
                // If this.Background is not explicitly set, bind it to parentMap.Background
                this.SetBindingOnUnsetProperty(BackgroundProperty, parentMap, Panel.BackgroundProperty, nameof(Background));

                // If this.Foreground is not explicitly set, bind it to parentMap.Foreground
                this.SetBindingOnUnsetProperty(ForegroundProperty, parentMap, MapBase.ForegroundProperty, nameof(Foreground));

                // If this.BorderBrush is not explicitly set, bind it to parentMap.Foreground
                this.SetBindingOnUnsetProperty(BorderBrushProperty, parentMap, MapBase.ForegroundProperty, nameof(Foreground));
            }
        }
Ejemplo n.º 7
0
        protected MapShape(Geometry data)
        {
            Data = data;

            MapPanel.InitMapElement(this);
        }
Ejemplo n.º 8
0
        public MapItem()
        {
            DefaultStyleKey = typeof(MapItem);

            MapPanel.InitMapElement(this);
        }
Ejemplo n.º 9
0
        partial void Initialize()
        {
            IsHitTestVisible = false;

            MapPanel.AddParentMapHandlers(this);
        }
 public MapPath()
 {
     MapPanel.InitMapElement(this);
 }
 public MapItem()
 {
     DefaultStyleKey = typeof(MapItem);
     MapPanel.AddParentMapHandlers(this);
 }
 public Pushpin()
 {
     DefaultStyleKey = typeof(Pushpin);
     MapPanel.AddParentMapHandlers(this);
 }
 public MapPath()
 {
     MapPanel.AddParentMapHandlers(this);
 }
 public MapContentControl()
 {
     DefaultStyleKey = typeof(MapContentControl);
     MapPanel.InitMapElement(this);
 }
Ejemplo n.º 15
0
        public Pushpin()
        {
            DefaultStyleKey = typeof(Pushpin);

            MapPanel.InitMapElement(this);
        }