public TelescopeRenderer(ISkyMap map, ISettings settings) { ascom = Ascom.Proxy; ascom.PropertyChanged += Ascom_PropertyChanged; this.map = map; this.settings = settings; }
public Plugin(ISky sky, ISkyMap map) { this.sky = sky; this.map = map; AddContextMenuItem(new ContextMenuItem("Motion track", ShowMotionTrackWindow, IsMotionTrackEnabled, () => true)); }
public Plugin(ISkyMap map, MeasureToolRenderer renderer) { this.map = map; this.renderer = renderer; AddContextMenuItem(new ContextMenuItem("Measure Tool", SwitchMeasureTool, () => true, () => true, () => renderer.IsMeasureToolOn)); }
public Plugin(ISky sky, ISkyMap map, TrackCalc trackCalc) { this.sky = sky; this.map = map; this.trackCalc = trackCalc; this.map.SelectedObjectChanged += (o) => NotifyPropertyChanged(nameof(IsMotionTrackEnabled)); this.trackCalc.Tracks.CollectionChanged += (s, e) => NotifyPropertyChanged(nameof(IsTracksListEnabled)); var contextMenuTrack = new MenuItem("$Astrarium.Plugins.Tracks.ContextMenu", new Command(ShowMotionTrackWindow)); contextMenuTrack.AddBinding(new SimpleBinding(this, nameof(IsMotionTrackEnabled), nameof(MenuItem.IsEnabled))); MenuItems.Add(MenuItemPosition.ContextMenu, contextMenuTrack); var toolsMenuTracks = new MenuItem("$Astrarium.Plugins.Tracks.ToolsMenu", new Command(ShowTracksListWindow)); var menuAddTrack = new MenuItem("$Astrarium.Plugins.Tracks.ToolsMenu.Add", new Command(ShowMotionTrackWindow)); menuAddTrack.HotKey = new KeyGesture(Key.T, ModifierKeys.Control, "Ctrl+T"); var menuTracksList = new MenuItem("$Astrarium.Plugins.Tracks.ToolsMenu.List", new Command(ShowTracksListWindow)); menuTracksList.AddBinding(new SimpleBinding(this, nameof(IsTracksListEnabled), nameof(MenuItem.IsEnabled))); menuTracksList.HotKey = new KeyGesture(Key.T, ModifierKeys.Control | ModifierKeys.Shift, "Ctrl+Shift+T"); toolsMenuTracks.SubItems.Add(menuAddTrack); toolsMenuTracks.SubItems.Add(menuTracksList); MenuItems.Add(MenuItemPosition.MainMenuTools, toolsMenuTracks); }
public PlannerPlugin(ISky sky, ISkyMap map, ISettings settings, IRecentPlansManager recentPlansManager, IPlanManagerFactory planManagerFactory) { this.sky = sky; this.map = map; this.settings = settings; this.map.SelectedObjectChanged += (x) => NotifyPropertyChanged(nameof(HasSelectedObject)); this.planManagerFactory = planManagerFactory; this.recentPlansManager = recentPlansManager; DefineSetting("PlannerDefaultSettings", new PlanningFilter(), isPermanent: true); /* Main app menu */ MenuItem plannerMenu = new MenuItem("$Planner.Menu.Planner"); MenuItem recentPlansMenu = new MenuItem("$Planner.Menu.RecentPlans"); recentPlansMenu.AddBinding(new SimpleBinding(this, nameof(RecentPlansMenuItems), nameof(MenuItem.SubItems))); recentPlansMenu.AddBinding(new SimpleBinding(this, nameof(HasRecentPlans), nameof(MenuItem.IsEnabled))); plannerMenu.SubItems = new ObservableCollection <MenuItem>(new[] { new MenuItem("$Planner.Menu.CreateNewPlan", new Command <PlanImportData>(CreateNewPlan), null), new MenuItem("$Planner.Menu.OpenPlan", new Command(OpenPlan)), recentPlansMenu, null, new MenuItem("$Planner.Menu.Defaults", new Command(ShowPlannerDefaults)) }); MenuItems.Add(MenuItemPosition.MainMenuTop, plannerMenu); /* Context menu */ MenuItem contextMenu = new MenuItem("$Planner.ContextMenu.AddToObservationPlan"); contextMenu.AddBinding(new SimpleBinding(this, nameof(HasSelectedObject), nameof(MenuItem.IsEnabled))); contextMenu.AddBinding(new SimpleBinding(this, nameof(ActivePlansMenuItems), nameof(MenuItem.SubItems))); MenuItems.Add(MenuItemPosition.ContextMenu, contextMenu); }
public FovFramesListVM(ISettings settings, ISkyMap map) { this.settings = settings; this.map = map; fovFrames = settings.Get <List <FovFrame> >("FovFrames"); CloseCommand = new Command(Close); AddCommand = new Command(AddFrame); EditCommand = new Command <FovFrame>(EditFrame); CopyCommand = new Command <FovFrame>(CopyFrame); DeleteCommand = new Command <FovFrame>(DeleteFrame); CheckedCommand = new Command <FovFrame>(CheckedFrame); }
public TriangleRaytraceRenderer(GraphicsDeviceManager graphicsDeviceManager, WorldGrid grid, int width, int height, ISkyMap skyMap) { _grid = grid; _skyMap = skyMap; _basicEffect = new BasicEffect(graphicsDeviceManager.GraphicsDevice); _graphicsDeviceManager = graphicsDeviceManager; _graphicsDeviceManager.PreferredBackBufferHeight = height; _graphicsDeviceManager.PreferredBackBufferWidth = width; #if DEBUG _graphicsDeviceManager.IsFullScreen = false; #else _graphicsDeviceManager.IsFullScreen = true; #endif _graphicsDeviceManager.ApplyChanges(); _graphicsDeviceManager.GraphicsDevice.Textures[0] = null; Vector2 center; center.X = _graphicsDeviceManager.GraphicsDevice.Viewport.Width * 0.5f; center.Y = _graphicsDeviceManager.GraphicsDevice.Viewport.Height * 0.5f; _minPos = -center; _maxPos = center; //This will create the triangles used for drawing the screen TriangleProjectionGrid projGrid = new TriangleProjectionGrid(_minPos.X, _minPos.Y, _maxPos.X, _maxPos.Y); projGrid.CreateGrid(); _vertices = projGrid.GetTriangleIndex().GetVerticesPositionColor(); ////test of moving polygon net //_orgVertices = new Vector2[_vertices.Length]; //for (int i = 0; i < _vertices.Length; i++) // _orgVertices[i] = new Vector2(_vertices[i].Position.X, _vertices[i].Position.Y); _vertexBuffer = new VertexBuffer(_graphicsDeviceManager.GraphicsDevice, typeof(VertexPositionColor), _vertices.Length, BufferUsage.WriteOnly); _vertexBuffer.SetData <VertexPositionColor>(_vertices); _indices = projGrid.GetTriangleIndex().GetIndices(); _indexBuffer = new IndexBuffer(_graphicsDeviceManager.GraphicsDevice, typeof(int), _indices.Length, BufferUsage.WriteOnly); _indexBuffer.SetData(_indices); _basicEffect.View = Matrix.CreateLookAt(new Vector3(0, 0, -1), new Vector3(0, 0, 0), Vector3.Up); _basicEffect.Projection = Matrix.CreateOrthographic(center.X * 2, center.Y * 2, 1, 2); _basicEffect.VertexColorEnabled = true; RasterizerState rasterizerState = new RasterizerState(); rasterizerState.CullMode = CullMode.None; _graphicsDeviceManager.GraphicsDevice.RasterizerState = rasterizerState; _graphicsDeviceManager.GraphicsDevice.Indices = _indexBuffer;//Same every time, only call once! (but it's not possible when 2Dtextures are drawn too) }
public Plugin(ISkyMap map, MeasureToolRenderer renderer) { this.map = map; this.renderer = renderer; var menuItem = new MenuItem("$Astrarium.Plugins.MeasureTool.ContextMenu") { Command = new Command(SwitchMeasureTool), HotKey = new KeyGesture(Key.M, ModifierKeys.Control, "Ctrl+M") }; menuItem.AddBinding(new SimpleBinding(renderer, nameof(renderer.IsMeasureToolOn), "IsChecked")); MenuItems.Add(MenuItemPosition.ContextMenu, menuItem); }
public MainVM(ISky sky, ISkyMap map, ISettings settings, ToolbarButtonsConfig toolbarButtonsConfig, ContextMenuItemsConfig contextMenuItemsConfig) { this.sky = sky; this.map = map; this.settings = settings; sky.Calculate(); MapKeyDownCommand = new Command <Key>(MapKeyDown); ZoomCommand = new Command <int>(Zoom); MapDoubleClickCommand = new Command <PointF>(MapDoubleClick); MapRightClickCommand = new Command <PointF>(MapRightClick); SetDateCommand = new Command(SetDate); SelectLocationCommand = new Command(SelectLocation); SearchObjectCommand = new Command(SearchObject); CenterOnPointCommand = new Command <PointF>(CenterOnPoint); GetObjectInfoCommand = new Command <CelestialObject>(GetObjectInfo); GetObjectEphemerisCommand = new Command <CelestialObject>(GetObjectEphemeris); CalculatePhenomenaCommand = new Command(CalculatePhenomena); LockOnObjectCommand = new Command <CelestialObject>(LockOnObject); CenterOnObjectCommand = new Command <CelestialObject>(CenterOnObject); ClearObjectsHistoryCommand = new Command(ClearObjectsHistory); ChangeSettingsCommand = new Command(ChangeSettings); sky.Context.ContextChanged += Sky_ContextChanged; sky.Calculated += () => map.Invalidate(); sky.DateTimeSyncChanged += () => NotifyPropertyChanged(nameof(DateTimeSync)); map.SelectedObjectChanged += Map_SelectedObjectChanged; map.ViewAngleChanged += Map_ViewAngleChanged; settings.SettingValueChanged += (s, v) => map.Invalidate(); Sky_ContextChanged(); Map_SelectedObjectChanged(map.SelectedObject); Map_ViewAngleChanged(map.ViewAngle); var toolbarGroups = toolbarButtonsConfig.GroupBy(b => b.Group); foreach (var group in toolbarGroups) { foreach (var button in group) { ToolbarItems.Add(button); } ToolbarItems.Add(new ToolbarSeparator()); } this.contextMenuItemsConfig = contextMenuItemsConfig; }
public CelestialGridRenderer(Sky sky, ISkyMap skyMap) : base(sky, skyMap) { Color colorGridEquatorial = Color.FromArgb(0, 64, 64); penEquatorialGrid = new Pen(Map.Antialias ? colorGridEquatorial : Color.FromArgb(200, colorGridEquatorial)); penEquatorialGrid.DashStyle = DashStyle.Dash; Color colorGridHorizontal = Color.FromArgb(0, 64, 0); penHorizontalGrid = new Pen(Map.Antialias ? colorGridHorizontal : Color.FromArgb(200, colorGridHorizontal)); penHorizontalGrid.DashStyle = DashStyle.Dash; Color colorLineEcliptic = Color.FromArgb(128, 128, 0); penEclipticLine = new Pen(Map.Antialias ? colorLineEcliptic : Color.FromArgb(200, colorLineEcliptic)); penEclipticLine.DashStyle = DashStyle.Dash; }
public FieldOfViewPlugin(ISkyMap map, ISettings settings) { this.map = map; this.settings = settings; DefineSetting("FovFrames", new List <FovFrame>(), isPermanent: true); MenuItem fovMenu = new MenuItem("$FovPlugin.Menu.FOV"); fovMenu.AddBinding(new SimpleBinding(this, nameof(FrameMenuItems), nameof(MenuItem.SubItems))); MenuItems.Add(MenuItemPosition.MainMenuTools, fovMenu); MenuItem scaleToFOVMenu = new MenuItem("$FovPlugin.ContextMenu.ScaleToFOV"); scaleToFOVMenu.AddBinding(new SimpleBinding(this, nameof(FrameContextMenuItems), nameof(MenuItem.SubItems))); scaleToFOVMenu.AddBinding(new SimpleBinding(this, nameof(IsContextMenuVisible), nameof(MenuItem.IsVisible))); MenuItems.Add(MenuItemPosition.ContextMenu, scaleToFOVMenu); }
public MainWindow(SkyMap map) { InitializeComponent(); this.map = map; var skyView = new SkyView(); skyView.SkyMap = map; skyView.MouseDoubleClick += (o, e) => GetMapDoubleClick(this)?.Execute(new PointF(e.X, e.Y)); skyView.MouseClick += SkyView_MouseClick; skyView.MouseMove += SkyView_MouseMove; skyView.MouseWheel += (o, e) => GetMapZoom(this)?.Execute(e.Delta); Host.Loaded += (o, e) => WF.Application.AddMessageFilter(this); Host.KeyDown += (o, e) => GetMapKeyDown(this)?.Execute(e); Host.Child = skyView; this.Loaded += MainWindow_Loaded; this.WindowStartupLocation = WindowStartupLocation.CenterScreen; }
public BaseSkyRenderer(Sky sky, ISkyMap skyMap) { Sky = sky; Map = skyMap; }
public ArcProjection(ISkyMap map) { Map = map; }
public Plugin(ISkyMap map, ISky sky, ISettings settings) { var menuAscom = new MenuItem("$Menu.Telescope"); this.ascom = Ascom.Proxy; this.map = map; this.sky = sky; this.settings = settings; DefineSetting("ASCOMTelescopeId", "", isPermanent: true); var menuConnectTelescope = new MenuItem("$Menu.ConnectToTelescope", new Command(ConnectTelescope)); menuConnectTelescope.AddBinding(new SimpleBinding(this, nameof(IsConnectTelescopeVisible), nameof(MenuItem.IsVisible))); var menuDisconnectTelescope = new MenuItem("$Menu.DisconnectTelescope", new Command(DisconnectTelescope)); menuDisconnectTelescope.AddBinding(new SimpleBinding(ascom, nameof(ascom.IsConnected), nameof(MenuItem.IsVisible))); menuDisconnectTelescope.AddBinding(new SimpleBinding(this, nameof(DisconnectTitle), nameof(MenuItem.Header))); var menuFindCurrentPoint = new MenuItem("$Menu.FindCurrentPoint", new Command(FindCurrentPoint)); menuFindCurrentPoint.AddBinding(new SimpleBinding(ascom, nameof(ascom.IsConnected), nameof(MenuItem.IsEnabled))); var menuAbortSlew = new MenuItem("$Menu.AbortSlew", new Command(AbortSlew)); menuAbortSlew.AddBinding(new SimpleBinding(ascom, nameof(ascom.IsSlewing), nameof(MenuItem.IsEnabled))); var menuFindHome = new MenuItem("$Menu.Home", new Command(FindHome)); menuFindHome.AddBinding(new SimpleBinding(ascom, nameof(ascom.AtHome), nameof(MenuItem.IsChecked))); menuFindHome.AddBinding(new SimpleBinding(ascom, nameof(ascom.IsConnected), nameof(MenuItem.IsEnabled))); var menuPark = new MenuItem("$Menu.Park", new Command(ParkOrUnpark)); menuPark.AddBinding(new SimpleBinding(ascom, nameof(ascom.AtPark), nameof(MenuItem.IsChecked))); menuPark.AddBinding(new SimpleBinding(ascom, nameof(ascom.IsConnected), nameof(MenuItem.IsEnabled))); var menuTrack = new MenuItem("$Menu.Track", new Command(SwitchTracking)); menuTrack.AddBinding(new SimpleBinding(ascom, nameof(ascom.IsTracking), nameof(MenuItem.IsChecked))); menuTrack.AddBinding(new SimpleBinding(ascom, nameof(ascom.IsConnected), nameof(MenuItem.IsEnabled))); var menuSetup = new MenuItem("$Menu.Setup", new Command(ShowSetupDialog)); menuSetup.AddBinding(new SimpleBinding(ascom, nameof(ascom.IsConnected), nameof(MenuItem.IsEnabled))); var menuInfo = new MenuItem("$Menu.AscomInformation", new Command(ShowInfo)); menuInfo.AddBinding(new SimpleBinding(ascom, nameof(ascom.IsConnected), nameof(MenuItem.IsEnabled))); menuAscom.SubItems.Add(menuConnectTelescope); menuAscom.SubItems.Add(menuDisconnectTelescope); menuAscom.SubItems.Add(null); menuAscom.SubItems.Add(menuFindCurrentPoint); menuAscom.SubItems.Add(menuAbortSlew); menuAscom.SubItems.Add(null); menuAscom.SubItems.Add(menuFindHome); menuAscom.SubItems.Add(menuPark); menuAscom.SubItems.Add(menuTrack); menuAscom.SubItems.Add(null); menuAscom.SubItems.Add(menuSetup); menuAscom.SubItems.Add(menuInfo); MenuItems.Add(MenuItemPosition.MainMenuTop, menuAscom); var contextMenuAscom = new MenuItem("$ContextMenu.Telescope"); contextMenuAscom.AddBinding(new SimpleBinding(this, nameof(IsContextMenuEnabled), nameof(MenuItem.IsEnabled))); var contextMenuSyncTo = new MenuItem("$ContextMenu.Telescope.Sync", new Command(SyncToPosition)); contextMenuSyncTo.AddBinding(new SimpleBinding(this, nameof(IsContextMenuEnabled), nameof(MenuItem.IsEnabled))); var contextMenuSlewTo = new MenuItem("$ContextMenu.Telescope.Slew", new Command(SlewToPosition)); contextMenuSlewTo.AddBinding(new SimpleBinding(this, nameof(IsContextMenuEnabled), nameof(MenuItem.IsEnabled))); contextMenuAscom.SubItems.Add(contextMenuSyncTo); contextMenuAscom.SubItems.Add(contextMenuSlewTo); MenuItems.Add(MenuItemPosition.ContextMenu, contextMenuAscom); ascom.PropertyChanged += Ascom_PropertyChanged; ascom.OnMessageShow += Ascom_OnMessageShow; DefineSetting("TelescopeMarkerColor", new SkyColor(Color.DarkOrange)); DefineSetting("TelescopeMarkerFont", SystemFonts.DefaultFont); DefineSetting("TelescopeMarkerLabel", true); DefineSetting("TelescopeFindCurrentPointAfterConnect", false); DefineSetting("TelescopePollingPeriod", 500m); DefineSettingsSection <AscomSettingsSection, SettingsViewModel>(); settings.SettingValueChanged += Settings_SettingValueChanged; }