private void RunQuery()
        {
            if (cornersLast != null && !String.IsNullOrEmpty(constellation))
            {
                contextResults.Clear();
                paginator1.CurrentPage = 1;
                paginator1.TotalPages  = 1;

                //Place[] results = ContextSearch.FindConteallationObjects(Constellations.Abbreviation(constellation), cornersLast, (Classification)FilterCombo.Tag);

                Vector3d cornerUl = Coordinates.RADecTo3d(cornersLast[0].RA, cornersLast[0].Dec, 1);
                Vector3d cornerLR = Coordinates.RADecTo3d(cornersLast[2].RA, cornersLast[2].Dec, 1);
                Vector3d dist     = Vector3d.Subtract(cornerLR, cornerUl);
                IPlace[] results  = ContextSearch.FindConteallationObjectsInCone("SolarSystem", Earth3d.MainWindow.RA, Earth3d.MainWindow.Dec, (float)dist.Length() / 2.0f, (Classification)FilterCombo.Tag);
                if (results != null)
                {
                    contextResults.AddRange(results);
                }
                results = ContextSearch.FindConteallationObjectsInCone("Community", Earth3d.MainWindow.RA, Earth3d.MainWindow.Dec, (float)dist.Length() / 2.0f, (Classification)FilterCombo.Tag);
                if (results != null)
                {
                    contextResults.AddRange(results);
                }

                results = ContextSearch.FindConteallationObjectsInCone(Constellations.Abbreviation(constellation), Earth3d.MainWindow.RA, Earth3d.MainWindow.Dec, (float)dist.Length() / 2.0f, (Classification)FilterCombo.Tag);
                if (results != null)
                {
                    contextResults.AddRange(results);
                }
                contextResults.Invalidate();
                //paginator1.CurrentPage = 0;
                //paginator1.TotalPages = contextResults.PageCount;
            }
        }
 private void overview_Click(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(constellation))
     {
         IPlace target = Constellations.ConstellationCentroids[Constellations.Abbreviation(constellation)];
         Earth3d.MainWindow.GotoTarget(target, false, false, true);
     }
 }
        public static void AddPlaceToContextSearch(IPlace place)
        {
            if (place.Classification == Classification.Constellation)
            {
                String constellationID = Constellations.Abbreviation(place.Name);
                place.Constellation = constellationID;
                constellationObjects["Constellations"].Add(place);
            }
            else if (place.Classification == Classification.SolarSystem)
            {
                String constellationID = Constellations.Containment.FindConstellationForPoint(place.RA, place.Dec);
                place.Constellation = constellationID;
                if (constellationObjects["SolarSystem"].Find(delegate(IPlace target) { return(place.Name == target.Name); }) == null)
                {
                    constellationObjects["SolarSystem"].Add(place);
                }
            }
            else
            {
                String constellationID = "Error";

                if (place.Type == ImageSetType.Planet)
                {
                    if (place.Target == SolarSystemObjects.Undefined)
                    {
                        constellationID = "Mars";
                    }
                    else
                    {
                        constellationID = place.Target.ToString();
                    }
                }
                else if (place.Type == ImageSetType.Earth)
                {
                    constellationID = "Earth";
                }
                else
                {
                    constellationID = Constellations.Containment.FindConstellationForPoint(place.RA, place.Dec);
                }

                if (constellationID != "Error")
                {
                    place.Constellation = constellationID;
                    if (constellationObjects.ContainsKey(constellationID))
                    {
                        constellationObjects[constellationID].Add(place);
                    }
                }
            }
        }
        private void searchTimer_Tick(object sender, EventArgs e)
        {
            if (contextAreaChanged && cornersLast != null && !String.IsNullOrEmpty(constellation))
            {
                contextResults.Clear();

                Place[] results = ContextSearch.FindConteallationObjects(Constellations.Abbreviation(constellation), cornersLast, Classification.Unfiltered);
                if (results != null)
                {
                    contextResults.AddRange(results);
                }
                contextResults.Refresh();
                paginator1.CurrentPage = 0;
                paginator1.TotalPages  = contextResults.PageCount;
            }

            contextAreaChanged = false;
        }
示例#5
0
        internal static TourPlace FromAstroObjectsRow(AstroObjectsDataset.spGetAstroObjectsRow row)
        {
            TourPlace newPlace = new TourPlace();

            string seperator = "";

            string name = "";

            if (!row.IsPopularName1Null() && !String.IsNullOrEmpty(row.PopularName1))
            {
                name      = ProperCaps(row.PopularName1);
                seperator = ";";
            }

            if (!row.IsMessierNameNull() && !String.IsNullOrEmpty(row.MessierName))
            {
                name      = name + seperator + row.MessierName;
                seperator = ";";
            }

            if (!row.IsNGCNameNull() && !String.IsNullOrEmpty(row.NGCName))
            {
                name      = name + seperator + row.NGCName;
                seperator = ";";
            }

            newPlace.name           = name;
            newPlace.Type           = ImageSetType.Sky;
            newPlace.Lat            = row.Dec2000;
            newPlace.Lng            = row.Ra2000 / 15;
            newPlace.constellation  = Constellations.Abbreviation(row.ConstellationName);
            newPlace.Classification = Classification.Galaxy; //(Classification)Enum.Parse(typeof(Classification), place.Attributes["Classification"].Value);
            newPlace.magnitude      = row.IsVisualMagnitudeNull() ? row.VisualMagnitude : 0;
            newPlace.AngularSize    = 0;                     // todo fix this
            newPlace.ZoomLevel      = .00009;
            return(newPlace);
        }
示例#6
0
        public SearchCriteria(string searchString)
        {
            searchString = searchString.Trim().ToLower();
            Target       = searchString;
            MagnitudeMin = -100.0;
            MagnitudeMax = 100.0;



            List <string> keywords = new List <string>(searchString.ToLower().Split(new char[] { ' ' }));

            if (keywords.Count > 1)
            {
                for (int i = keywords.Count - 1; i > -1; i--)
                {
                    if (keywords[i] == ">" && i > 0 && i < keywords.Count - 1)
                    {
                        if (keywords[i - 1] == "m" || keywords[i - 1] == "mag" || keywords[i - 1] == "magnitude")
                        {
                            try
                            {
                                MagnitudeMin = Convert.ToDouble(keywords[i + 1]);
                            }
                            catch
                            {
                            }
                            keywords.RemoveAt(i + 1);
                            keywords.RemoveAt(i);
                            keywords.RemoveAt(i - 1);
                            i -= 2;
                            continue;
                        }
                    }

                    if (keywords[i] == "<" && i > 0 && i < keywords.Count - 2)
                    {
                        if (keywords[i - 1] == "m" || keywords[i - 1] == "mag" || keywords[i - 1] == "magnitude")
                        {
                            try
                            {
                                MagnitudeMax = Convert.ToDouble(keywords[i + 1]);
                            }
                            catch
                            {
                            }
                            keywords.RemoveAt(i + 1);
                            keywords.RemoveAt(i);
                            keywords.RemoveAt(i - 1);
                            i -= 2;
                            continue;
                        }
                    }
                    bool brokeOut = false;

                    foreach (string classId in Enum.GetNames(typeof(Classification)))
                    {
                        if (keywords[i] == classId.ToLower())
                        {
                            Classification |= (Classification)Enum.Parse(typeof(Classification), classId);
                            keywords.RemoveAt(i);
                            brokeOut = true;
                            break;
                        }
                    }

                    if (brokeOut)
                    {
                        continue;
                    }

                    if (Constellations.Abbreviations.ContainsKey(keywords[i].ToUpper()))
                    {
                        Constellation = keywords[i].ToUpper();
                        keywords.RemoveAt(i);
                        continue;
                    }

                    if (Constellations.FullNames.ContainsKey(keywords[i].ToUpper()))
                    {
                        Constellation = Constellations.Abbreviation(keywords[i].ToUpper());
                        keywords.RemoveAt(i);
                        continue;
                    }
                }
                //keywords.Add(searchString);
                Keywords = keywords;
                string spacer = "";
                Target = "";
                foreach (string keyword in Keywords)
                {
                    Target += spacer + keyword;
                    spacer  = " ";
                }
            }
            else
            {
                Keywords = null;
            }

            if (Classification == 0)
            {
                Classification = Classification.Unfiltered;
            }
        }