Exemple #1
0
        private void EndFromView_Click(object sender, EventArgs e)
        {
            Vector2d pnt = Earth3d.MainWindow.GetEarthCoordinates();

            EndLat.Text = Coordinates.FormatDMS(pnt.Y);
            EndLng.Text = Coordinates.FormatDMS(pnt.X);
        }
        private void GoToLatLong_Load(object sender, System.EventArgs e)
        {
            Dictionary <string, DataSet> datasets = DataSetManager.GetDataSets();

            foreach (DataSet d in datasets.Values)
            {
                if (d.Sky == sky)
                {
                    this.DataSetList.Items.Add(d);
                }
            }
            this.DataSetList.SelectedIndex = lastSelectedDatasetIndex;

            this.Categorys.SelectedIndex = lastSelectedIndexCatagorys;
            this.txtLat.Text             = Latitude.ToString();
            this.txtLong.Text            = Longitude.ToString();
            this.txtName.Text            = LocationName;
            this.txtAltitude.Text        = Altitude.ToString();
            if (sky)
            {
                this.lblLatitude.Text  = Language.GetLocalizedText(262, "Declination");
                this.lblLongitude.Text = Language.GetLocalizedText(263, "Right Ascension");
            }

            this.txtLat.Text  = Coordinates.FormatDMS(Latitude);
            this.txtLong.Text = Coordinates.FormatDMS(Longitude);
            if (Earth3d.MainWindow.CurrentImageSet.DataSetType == ImageSetType.Earth)
            {
                FromEarthView.Visible = true;
            }
        }
 private void fromView_Click(object sender, EventArgs e)
 {
     ra.Text   = Coordinates.FormatHMS(Earth3d.MainWindow.RA);
     dec.Text  = Coordinates.FormatDMS(Earth3d.MainWindow.Dec);
     mag.Text  = editTarget.Magnitude.ToString();
     zoom.Text = Coordinates.FormatDMS(Earth3d.MainWindow.ZoomFactor / 6);
 }
        private void GetFromView_Click(object sender, EventArgs e)
        {
            Vector2d point = Earth3d.MainWindow.GetEarthCoordinates();


            Lattitude.Text = Coordinates.FormatDMS(point.Y);
            Longitude.Text = Coordinates.FormatDMS(point.X);
            Altitude.Text  = Earth3d.MainWindow.GetEarthAltitude().ToString();
        }
Exemple #5
0
 public override string ToString()
 {
     if (string.IsNullOrEmpty(Name))
     {
         return(Coordinates.FormatDMS((((((RA)) / 360) * 24.0 + 12) % 24)) + ", " + Coordinates.FormatDMS(Dec) + ", " + PointType.ToString());
     }
     else
     {
         return(Name + ", " + PointType.ToString());
     }
 }
        private void PlacesList_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            TourPlace p = (TourPlace)this.PlacesList.SelectedItem;

            if (p != null)
            {
                this.txtName.Text = p.Name;

                this.txtLat.Text      = Coordinates.FormatDMS(p.Lat);
                this.txtLong.Text     = Coordinates.FormatDMS(p.Lng);
                this.txtAltitude.Text = p.Elevation.ToString();
            }
        }
Exemple #7
0
        private void TelescopeTimer_Tick(object sender, EventArgs e)
        {
            try
            {
                if (telescopeConnected)
                {
                    if (scope != null && scope.Connected)
                    {
                        if (scope.Slewing)
                        {
                            ScopeStatus.Text = Language.GetLocalizedText(399, "Telescope Status - Slewing");
                        }
                        else if (scope.AtPark)
                        {
                            ScopeStatus.Text = Language.GetLocalizedText(400, "Telescope Status - Parked");
                        }
                        else if (scope.Tracking)
                        {
                            ScopeStatus.Text = Language.GetLocalizedText(401, "Telescope Status - Tracking");
                        }
                        else
                        {
                            ScopeStatus.Text = Language.GetLocalizedText(388, "Telescope Status");
                        }
                        TelescopeRa  = scope.RightAscension;
                        TelescopeDec = scope.Declination;
                        TelescopeAlt = scope.Altitude;
                        TelescopeAz  = scope.Azimuth;

                        altText.Text = Coordinates.FormatDMS(TelescopeAlt);
                        azText.Text  = Coordinates.FormatDMS(TelescopeAz);
                        decText.Text = Coordinates.FormatDMS(TelescopeDec);
                        raText.Text  = Coordinates.FormatDMS(TelescopeRa);

                        if (TrackScope.Checked)
                        {
                            Earth3d.MainWindow.GotoTarget(new TourPlace("None", TelescopeDec, TelescopeRa, Classification.BlackHole, Earth3d.MainWindow.Constellation, ImageSetType.Sky, 0), true, true, false);
                            //Earth3d.MainWindow.RA = TelescopeRa;
                            //Earth3d.MainWindow.Dec = TelescopeDec;
                        }
                    }
                    if (scope != null)
                    {
                        SetControlEnableState(scope.Connected);
                    }
                }
            }
            catch
            {
            }
        }
Exemple #8
0
        private void UpdateProperties()
        {
            ignoreChanges          = true;
            this.latText.Text      = Coordinates.FormatDMS(Properties.Settings.Default.LocationLat);
            this.lngText.Text      = Coordinates.FormatDMS(Properties.Settings.Default.LocationLng);
            this.locationName.Text = Properties.Settings.Default.LocationName;
            this.Altitude.Text     = Properties.Settings.Default.LocationAltitude.ToString() + "m";
            localHorizon.Checked   = Properties.Settings.Default.LocalHorizonMode;

            showUtcTime.Checked = Properties.Settings.Default.ShowUTCTime;

            showMinorPlanets.Checked = Properties.Settings.Default.SolarSystemMinorPlanets.TargetState;
            ignoreChanges            = false;
        }
Exemple #9
0
        private void ChooseLocation_Click(object sender, EventArgs e)
        {
            LocationSetup dialog = new LocationSetup();

            dialog.Sky = false;

            dialog.Latitude     = Coordinates.Parse(this.latText.Text);
            dialog.Longitude    = Coordinates.Parse(this.lngText.Text);
            dialog.LocationName = this.locationName.Text;
            dialog.Altitude     = Convert.ToDouble(this.Altitude.Text.Replace("m", "").Replace("'", ""));

            if (dialog.ShowDialog(this) == DialogResult.OK)
            {
                this.latText.Text            = Coordinates.FormatDMS(Properties.Settings.Default.LocationLat = dialog.Latitude);
                this.lngText.Text            = Coordinates.FormatDMS(Properties.Settings.Default.LocationLng = dialog.Longitude);
                this.locationName.Text       = Properties.Settings.Default.LocationName = dialog.LocationName;
                this.Altitude.Text           = (Properties.Settings.Default.LocationAltitude = dialog.Altitude).ToString() + "m";
                SpaceTimeController.Altitude = Properties.Settings.Default.LocationAltitude;
                SpaceTimeController.Location = Coordinates.FromLatLng(Properties.Settings.Default.LocationLat, Properties.Settings.Default.LocationLng);
            }
        }
        private void LoadTargetValues()
        {
            names.Text = UiTools.GetNamesStringFromArray(editTarget.Names);
            ra.Text    = Coordinates.FormatHMS(editTarget.RA);
            dec.Text   = Coordinates.FormatDMS(editTarget.Dec);
            mag.Text   = editTarget.Magnitude.ToString();
            zoom.Text  = Coordinates.FormatDMS(editTarget.ZoomLevel / 6);
            // todo localize and format
            DistanceValue.Text = editTarget.Distance.ToString();
            string fullName = "";

            if (Constellations.FullNames.ContainsKey(editTarget.Constellation))
            {
                fullName = Constellations.FullNames[editTarget.Constellation];
            }

            constellation.Items.Add("Undefined/Not Applicable");
            constellation.SelectedIndex = 0;
            foreach (string name in Constellations.FullNames.Values)
            {
                int index = constellation.Items.Add(name);
                if (name == fullName)
                {
                    constellation.SelectedIndex = index;
                }
            }
            SortedList <string, string> list = new SortedList <string, string>();

            foreach (string s in Enum.GetNames(typeof(Classification)))
            {
                list.Add(s, s);
            }

            foreach (string s in list.Values)
            {
                classification.Items.Add(s);
            }
            classification.SelectedIndex = classification.Items.IndexOf(editTarget.Classification.ToString());
        }
        private void UpdateLiveValuesPlanet()
        {
            raText.Text   = Coordinates.FormatDMS(target.Lng);
            decText.Text  = Coordinates.FormatDMSWide(target.Lat);
            raLabel.Text  = "Lng:";
            decLabel.Text = "Lat:";
            Coordinates altAz = Coordinates.EquitorialToHorizon(Coordinates.FromRaDec(target.RA, target.Dec), SpaceTimeController.Location, SpaceTimeController.Now);

            altText.Hide();
            azText.Hide();
            altLabel.Hide();
            azLabel.Hide();
            riseLabel.Hide();
            setLabel.Hide();
            transitLabel.Hide();
            transitText.Hide();
            magnitudeLabel.Hide();
            distanceLabel.Hide();
            magnitudeValue.Hide();
            riseText.Hide();
            setText.Hide();
            transitText.Hide();
            distanceValue.Hide();
        }
        public override IPlace FindClosest(Coordinates target, float distance, IPlace defaultPlace, bool astronomical)
        {
            Vector3d searchPoint = Coordinates.GeoTo3dDouble(target.Lat, target.Lng);

            //searchPoint = -searchPoint;
            Vector3d dist;

            if (defaultPlace != null)
            {
                Vector3d testPoint = Coordinates.RADecTo3d(defaultPlace.RA, -defaultPlace.Dec, -1.0);
                dist     = searchPoint - testPoint;
                distance = (float)dist.Length();
            }

            int closestItem = -1;
            int index       = 0;

            foreach (Vector3 point in positions)
            {
                dist = searchPoint - new Vector3d(point);
                if (dist.Length() < distance)
                {
                    distance    = (float)dist.Length();
                    closestItem = index;
                }
                index++;
            }


            if (closestItem == -1)
            {
                return(defaultPlace);
            }

            Coordinates pnt = Coordinates.CartesianToSpherical2(positions[closestItem]);

            string name = table.Rows[closestItem].ColumnData[this.nameColumn].ToString();

            if (nameColumn == startDateColumn || nameColumn == endDateColumn)
            {
                name = SpreadSheetLayer.ParseDate(name).ToString("u");
            }

            if (String.IsNullOrEmpty(name))
            {
                name = string.Format("RA={0}, Dec={1}", Coordinates.FormatHMS(pnt.RA), Coordinates.FormatDMS(pnt.Dec));
            }
            TourPlace place = new TourPlace(name, pnt.Lat, pnt.RA, Classification.Unidentified, "", ImageSetType.Sky, -1);

            Dictionary <String, String> rowData = new Dictionary <string, string>();

            for (int i = 0; i < table.Columns.Count; i++)
            {
                string colValue = table.Rows[closestItem][i].ToString();
                if (i == startDateColumn || i == endDateColumn)
                {
                    colValue = SpreadSheetLayer.ParseDate(colValue).ToString("u");
                }

                if (!rowData.ContainsKey(table.Column[i].Name) && !string.IsNullOrEmpty(table.Column[i].Name))
                {
                    rowData.Add(table.Column[i].Name, colValue);
                }
                else
                {
                    rowData.Add("Column" + i.ToString(), colValue);
                }
            }
            place.Tag = rowData;
            if (Viewer != null)
            {
                Viewer.LabelClicked(closestItem);
            }
            return(place);
        }
Exemple #13
0
        public IPlace HoverCheck(Vector3 searchPoint, IPlace defaultPlace, float distance)
        {
            searchPoint = -searchPoint;
            Vector3 dist;

            if (defaultPlace != null)
            {
                Vector3 testPoint = Coordinates.RADecTo3d(defaultPlace.RA, -defaultPlace.Dec, -1.0).Vector311;
                dist     = searchPoint - testPoint;
                distance = dist.Length();
            }

            int closestItem = -1;
            int index       = 0;

            foreach (Vector3 point in positions)
            {
                dist = searchPoint - point;
                if (dist.Length() < distance)
                {
                    distance    = dist.Length();
                    closestItem = index;
                }
                index++;
            }

            lastHoverIndex = closestItem;

            if (closestItem == -1)
            {
                return(defaultPlace);
            }

            Coordinates pnt  = Coordinates.CartesianToSpherical(positions[closestItem]);
            string      name = this.names[closestItem];

            if (String.IsNullOrEmpty(name))
            {
                name = string.Format("RA={0}, Dec={1}", Coordinates.FormatHMS(pnt.RA), Coordinates.FormatDMS(pnt.Dec));
            }
            TourPlace place = new TourPlace(name, pnt.Dec, pnt.RA, Classification.Unidentified, "", ImageSetType.Sky, -1);

            return(place);
        }
 private void FromEarthView_Click(object sender, EventArgs e)
 {
     txtLat.Text  = Coordinates.FormatDMS(Earth3d.MainWindow.ViewLat);
     txtLong.Text = Coordinates.FormatDMS(Earth3d.MainWindow.ViewLong);
 }