Exemple #1
0
 /// <summary>
 /// Copies properties from other instance
 /// </summary>
 /// <param name="other">Other Eyepiece instance</param>
 public void CopyFrom(Eyepiece other)
 {
     Id          = other.Id;
     Name        = other.Name;
     FieldOfView = other.FieldOfView;
     FocalLength = other.FocalLength;
 }
Exemple #2
0
        /// <summary>
        /// Gets Field Of View parameters as seen by eye with telescope equipped by eyepiece and Barlow lens or reducer
        /// </summary>
        /// <param name="telescope">Telesope parameters</param>
        /// <param name="eyepiece">Eyepiece parameters</param>
        /// <param name="lens">Barlow lens or reducer parameters</param>
        /// <returns>
        /// Field Of View parameters as seen by eye with equipment provided
        /// </returns>
        public static TelescopeFieldOfView GetTelescopeView(Telescope telescope, Eyepiece eyepiece, Lens lens)
        {
            float focalLength    = telescope.FocalLength * (lens != null ? lens.Value : 1);
            float focalRatio     = telescope.FocalLength / telescope.Aperture;
            float dawesLimit     = GetDawesLimit(telescope.Aperture);
            float magnitudeLimit = GetManitudeLimit(telescope.Aperture);
            float magnification  = focalLength / eyepiece.FocalLength;
            float fov            = eyepiece.FieldOfView / magnification;
            float exitPupil      = telescope.Aperture / magnification;

            return(new TelescopeFieldOfView()
            {
                FocalRatio = focalRatio,
                ExitPupil = exitPupil,
                DawesLimit = dawesLimit,
                Magnification = magnification,
                Size = fov,
                VisualMagnitudeLimit = magnitudeLimit
            });
        }
Exemple #3
0
 private void EditEquipment(Type equipmentType, bool isNew)
 {
     if (equipmentType == typeof(Telescope))
     {
         var vm = ViewManager.CreateViewModel <TelescopeVM>();
         vm.Telescopes = Telescopes;
         if (!isNew)
         {
             vm.Telescope.CopyFrom(Telescope);
         }
         if (ViewManager.ShowDialog(vm) ?? false)
         {
             if (isNew)
             {
                 Telescopes.Add(vm.Telescope);
             }
             TelescopeId = Guid.Empty;
             TelescopeId = vm.Telescope.Id;
             Telescope.CopyFrom(vm.Telescope);
             _Equipment.Telescopes = new ObservableCollection <Telescope>(Telescopes.OrderBy(t => t.Name));
             NotifyPropertyChanged(nameof(Telescopes), nameof(TelescopeId), nameof(Telescope));
             Calculate();
             SaveEquipment();
         }
     }
     else if (equipmentType == typeof(Eyepiece))
     {
         var vm = ViewManager.CreateViewModel <EyepieceVM>();
         vm.Eyepieces = Eyepieces;
         if (!isNew)
         {
             vm.Eyepiece.CopyFrom(Eyepiece);
         }
         if (ViewManager.ShowDialog(vm) ?? false)
         {
             if (isNew)
             {
                 Eyepieces.Add(vm.Eyepiece);
             }
             EyepieceId = Guid.Empty;
             EyepieceId = vm.Eyepiece.Id;
             Eyepiece.CopyFrom(vm.Eyepiece);
             _Equipment.Eyepieces = new ObservableCollection <Eyepiece>(Eyepieces.OrderBy(t => t.Name));
             NotifyPropertyChanged(nameof(Eyepieces), nameof(EyepieceId), nameof(Eyepiece));
             Calculate();
             SaveEquipment();
         }
     }
     else if (equipmentType == typeof(Camera))
     {
         var vm = ViewManager.CreateViewModel <CameraVM>();
         vm.Cameras = Cameras;
         if (!isNew)
         {
             vm.Camera.CopyFrom(Camera);
         }
         if (ViewManager.ShowDialog(vm) ?? false)
         {
             if (isNew)
             {
                 Cameras.Add(vm.Camera);
             }
             CameraId = Guid.Empty;
             CameraId = vm.Camera.Id;
             Camera.CopyFrom(vm.Camera);
             _Equipment.Cameras = new ObservableCollection <Camera>(Cameras.OrderBy(t => t.Name));
             NotifyPropertyChanged(nameof(Cameras), nameof(CameraId), nameof(Camera));
             Calculate();
             SaveEquipment();
         }
     }
     else if (equipmentType == typeof(Binocular))
     {
         var vm = ViewManager.CreateViewModel <BinocularVM>();
         vm.Binoculars = Binoculars;
         if (!isNew)
         {
             vm.Binocular.CopyFrom(Binocular);
         }
         if (ViewManager.ShowDialog(vm) ?? false)
         {
             if (isNew)
             {
                 Binoculars.Add(vm.Binocular);
             }
             BinocularId = Guid.Empty;
             BinocularId = vm.Binocular.Id;
             Binocular.CopyFrom(vm.Binocular);
             _Equipment.Binoculars = new ObservableCollection <Binocular>(Binoculars.OrderBy(t => t.Name));
             NotifyPropertyChanged(nameof(Binoculars), nameof(BinocularId), nameof(Binocular));
             Calculate();
             SaveEquipment();
         }
     }
 }