예제 #1
0
        public void SetMap(IMap_Base map)
        {
            _mapView.Map = map;
            _mapView.Focus();

            OnResize(null);
        }
예제 #2
0
        public override void SelectedTileChanged(IMap_Base sender, SelectedTileChangedEventArgs e)
        {
            MapLocation pt = e.MapPosition;

            Text = "c: " + pt.Col + " r: " + pt.Row;             // I don't think this actually prints anywhere.

            var hWidth  = DrawContentService.HWidth;
            var hHeight = DrawContentService.HHeight;

            int xc = (pt.Col - pt.Row) * hWidth;
            int yc = (pt.Col + pt.Row) * hHeight;

            _selected.Reset();
            _selected.AddLine(
                xc, yc,
                xc + hWidth, yc + hHeight);
            _selected.AddLine(
                xc + hWidth, yc + hHeight,
                xc, yc + 2 * hHeight);
            _selected.AddLine(
                xc, yc + 2 * hHeight,
                xc - hWidth, yc + hHeight);
            _selected.CloseFigure();

            ViewDrag(null, null);
            Refresh();
        }
예제 #3
0
        private void TileChange(IMap_Base mapFile, SelectedTileChangedEventArgs e)         // MapLocation newCoords)
        {
            MapLocation newCoords = e.MapPosition;
            var         dragStart = new Point(
                newCoords.Col,
                newCoords.Row);

            SetDrag(dragStart, DragEnd);

            MainWindow.Instance.StatusBarPrintPosition(newCoords.Col, newCoords.Row);
        }
예제 #4
0
        public MapView()
        {
            map = null;

            _dragStart   =
                _dragEnd = new Point(-1, -1);

            SetStyle(
                ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint,
                true);

            gridColor  = Color.FromArgb(175, 69, 100, 129);
            transBrush = new SolidBrush(gridColor);

            dashPen = new Pen(Brushes.Black, 1);
        }
예제 #5
0
        private void SetMap(IMap_Base newMap, IMap_Observer observer)
        {
            if (observer.Map != null)
            {
                observer.Map.HeightChanged       -= observer.HeightChanged;
                observer.Map.SelectedTileChanged -= observer.SelectedTileChanged;
            }

            observer.Map = newMap;
            if (newMap != null)
            {
                newMap.HeightChanged       += observer.HeightChanged;
                newMap.SelectedTileChanged += observer.SelectedTileChanged;
            }

            foreach (string key in observer.MoreObservers.Keys)
            {
                SetMap(newMap, observer.MoreObservers[key]);
            }
        }
예제 #6
0
        public void SetMap(IMap_Base map)
        {
            var maps = new IMap_Observer[]
            {
                TopRmpView.TopViewControl,
                TopRmpView.RouteViewControl,
                TileView.TileViewControl,
                RmpView.RouteViewControl,
                TopView.TopViewControl
            };

            foreach (var f in maps)
            {
                if (f != null)
                {
                    SetMap(map, f);
                }
            }

            MapViewPanel.Instance.MapView.Refresh();
        }
예제 #7
0
        public void ReviewRouteEntries(IMap_Base map)
        {
            var xMap = map as XCMapFile;

            if (xMap != null)
            {
                var entryOutside = new List <RmpEntry>();
                foreach (RmpEntry entry in xMap.Rmp)
                {
                    if (RmpFile.IsOutsideMap(
                            entry,
                            map.MapSize.Cols,
                            map.MapSize.Rows,
                            map.MapSize.Height))
                    {
                        entryOutside.Add(entry);
                    }
                }

                if (entryOutside.Count > 0)
                {
                    var result = MessageBox.Show(
                        "There are route entries outside the bounds of this Map. Do you want to remove them?",
                        "Incorrect Routes",
                        MessageBoxButtons.YesNo);

                    if (result == DialogResult.Yes)
                    {
                        foreach (var rmpEntry in entryOutside)
                        {
                            xMap.Rmp.RemoveEntry(rmpEntry);
                        }

                        xMap.MapChanged = true;
                    }
                }
            }
        }
예제 #8
0
 private void MapHeight(IMap_Base mapFile, HeightChangedEventArgs e)
 {
     Refresh();
 }
예제 #9
0
 public virtual void SelectedTileChanged(IMap_Base sender, SelectedTileChangedEventArgs e)
 {
     Refresh();
 }
예제 #10
0
 public virtual void HeightChanged(IMap_Base sender, HeightChangedEventArgs e)
 {
     Refresh();
 }
예제 #11
0
 public override void HeightChanged(IMap_Base sender, HeightChangedEventArgs e)
 {
     ClearSelected();
     FillGui();
     Refresh();
 }
예제 #12
0
 public override void SelectedTileChanged(IMap_Base sender, SelectedTileChangedEventArgs e)
 {
     Text = string.Format(
         "Position\nc:{0} r:{1}",
         e.MapPosition.Col, e.MapPosition.Row);
 }
예제 #13
0
 public override void SelectedTileChanged(IMap_Base sender, SelectedTileChangedEventArgs e)
 {
     _mapTile = (XCMapTile)e.SelectedTile;
     _lastLoc = e.MapPosition;
     Refresh();
 }
예제 #14
0
 public override void HeightChanged(IMap_Base sender, HeightChangedEventArgs e)
 {
     _lastLoc.Height = e.NewHeight;
     _mapTile        = map[_lastLoc.Row, _lastLoc.Col] as XCMapTile;
     Refresh();
 }