コード例 #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);
        }
コード例 #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);
        }
コード例 #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
        }
コード例 #4
0
        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;
            }
        }
コード例 #5
0
ファイル: MapPath.cs プロジェクト: timunie/XAML-Map-Control
        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
                };
            }
        }
コード例 #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));
            }
        }
コード例 #7
0
        protected MapShape(Geometry data)
        {
            Data = data;

            MapPanel.InitMapElement(this);
        }
コード例 #8
0
        public MapItem()
        {
            DefaultStyleKey = typeof(MapItem);

            MapPanel.InitMapElement(this);
        }
コード例 #9
0
        partial void Initialize()
        {
            IsHitTestVisible = false;

            MapPanel.AddParentMapHandlers(this);
        }
コード例 #10
0
 public MapPath()
 {
     MapPanel.InitMapElement(this);
 }
コード例 #11
0
 public MapItem()
 {
     DefaultStyleKey = typeof(MapItem);
     MapPanel.AddParentMapHandlers(this);
 }
コード例 #12
0
 public Pushpin()
 {
     DefaultStyleKey = typeof(Pushpin);
     MapPanel.AddParentMapHandlers(this);
 }
コード例 #13
0
 public MapPath()
 {
     MapPanel.AddParentMapHandlers(this);
 }
コード例 #14
0
 public MapContentControl()
 {
     DefaultStyleKey = typeof(MapContentControl);
     MapPanel.InitMapElement(this);
 }
コード例 #15
0
        public Pushpin()
        {
            DefaultStyleKey = typeof(Pushpin);

            MapPanel.InitMapElement(this);
        }