Beispiel #1
0
 public void DrawGrid(bool drawGrid)
 {
     this.IsGridOn.Value = drawGrid;
     if (this.IsGridOn.Value)
     {
         PaddedGridRenderable gridParameters = new PaddedGridRenderable(this.Map.Value);
         double thickness = 1 / this.ScrollModel.ZoomLevels[this.ScrollModel.ZoomIndex].zoom;
         gridParameters.DrawingPen.Thickness = thickness < this.maxGridThickness ? thickness : this.maxGridThickness;
         DrawingGroup group = gridParameters.CreateGrid();
         this.gridLines.Children = group.Children;
     }
     else
     {
         this.gridLines.Children.Clear();
     }
 }
        public void DrawGrid(bool drawGrid)
        {
            this.IsGridOn.Value = drawGrid;
            if (this.IsGridOn.Value)
            {
                PaddedGridRenderable gridParameters = new PaddedGridRenderable(this.TilesetModel.Value);
                double thickness = 1 / this.ScrollModel.ZoomLevels[this.ScrollModel.ZoomIndex].zoom;
                gridParameters.DrawingPen.Thickness = thickness < this.maxGridThickness ? thickness : this.maxGridThickness;

                Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                {
                    DrawingGroup group      = gridParameters.CreateGrid();
                    this.gridLines.Children = group.Children;
                }), DispatcherPriority.Render);
            }
            else
            {
                this.gridLines.Children.Clear();
            }
        }
        public void DrawGrid(bool drawGrid)
        {
            this.IsGridOn.Value = drawGrid;
            if (this.IsGridOn.Value)
            {
                int columns = this.ItemImage.Value.Width / this.TileWidth.Value;
                int rows    = this.ItemImage.Value.Height / this.TileHeight.Value;

                PaddedGridRenderable gridParameters = new PaddedGridRenderable(columns, rows, this.TileWidth.Value, this.TileHeight.Value, this.OffsetX.Value, this.OffsetY.Value, this.PaddingX.Value, this.PaddingY.Value);
                double thickness = 1 / this.ZoomLevels[this.ZoomIndex.Value].zoom;
                gridParameters.DrawingPen.Thickness = thickness < this.maxGridThickness ? thickness : this.maxGridThickness;

                Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                {
                    DrawingGroup group      = gridParameters.CreateGrid();
                    this.gridLines.Children = group.Children;
                }), DispatcherPriority.Render);
            }
            else
            {
                this.gridLines.Children.Clear();
            }
        }