예제 #1
0
        public LocalAreaViewResult FindLocalSystems(ScreenSize screenSize)
        {
            if (screenSize == null) throw new ArgumentNullException("screenSize");

            var currentUser = _securityManager.GetCurrentUserAccount();
            if (currentUser == null) throw new CurrentUserNotFoundException();
            var localAreaView = new LocalAreaView(currentUser.FocusCoordinates, screenSize);
            var solarSystems = _solarSystems.FindSystemsInLocalArea(localAreaView);

            var screenCornerX = localAreaView.FocusCoordinates.X - ((screenSize.Width - 1) / 2);
            var screenCornerY = localAreaView.FocusCoordinates.Y - ((screenSize.Height - 1) / 2);

            var relative = solarSystems.Select(s => new RelativeSolarSystem
                {
                    Coordinates = s.Coordinates,
                    Name = s.Name,
                    SolarSystemID = s.SolarSystemID,
                    ScreenOffset = new ScreenOffSet
                    {
                        X = (int)(s.Coordinates.X - screenCornerX),
                        Y = (int)(s.Coordinates.Y - screenCornerY)
                    }
                });

            return new LocalAreaViewResult(currentUser.FocusCoordinates, screenSize, relative);
        }
예제 #2
0
        public LocalAreaView(Coordinates focusCoordinates, ScreenSize screenSize)
        {
            if (focusCoordinates == null) throw new ArgumentNullException("focusCoordinates");
            if (screenSize == null) throw new ArgumentNullException("screenSize");

            FocusCoordinates = focusCoordinates;
            ScreenSize = screenSize;
        }