Ejemplo n.º 1
0
        private void RunQuerySolarSystem()
        {
            if (contextResults.Items.Count > 0)
            {
                IPlace pl = contextResults.Items[0] as IPlace;
                if (pl != null)
                {
                    if (pl.Classification == Classification.SolarSystem)
                    {
                        return;
                    }
                }
            }
            contextResults.Clear();
            paginator1.CurrentPage = 1;
            paginator1.TotalPages  = 1;

            IPlace[] results = ContextSearch.FindAllObjects("SolarSystem", Classification.SolarSystem);
            if (results != null)
            {
                contextResults.AddRange(results);
            }

            contextResults.Invalidate();
        }
Ejemplo n.º 2
0
        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;
            }
        }
Ejemplo n.º 3
0
        private void SearchView_Click(object sender, EventArgs e)
        {
            Coordinates[] corners = Earth3d.MainWindow.CurrentViewCorners;

            if (corners != null && !String.IsNullOrEmpty(Earth3d.MainWindow.Constellation))
            {
                IPlace[] results = ContextSearch.FindConteallationObjects(Earth3d.MainWindow.Constellation, corners, Classification.Unfiltered);
                searchResults.Clear();
                if (results != null)
                {
                    searchResults.AddRange(results);
                    searchResults.Refresh();
                }
            }
            UpdateMarkers();
        }
Ejemplo n.º 4
0
        private void RunQueryPlanet(string planet)
        {
            if (cornersLast != null && !String.IsNullOrEmpty(planet))
            {
                contextResults.Clear();
                paginator1.CurrentPage = 1;
                paginator1.TotalPages  = 1;
                float    searchDistance = (float)Math.Min((0.4617486132350 * ((4.0 * (Earth3d.MainWindow.ZoomFactor / 180)) + 0.000001)), 1.4142135623730950488016887242097);
                IPlace[] results        = ContextSearch.FindConteallationObjectsInCone(planet, Earth3d.MainWindow.ViewLong / 15, Earth3d.MainWindow.ViewLat, searchDistance, (Classification)FilterCombo.Tag);

                if (results != null)
                {
                    contextResults.AddRange(results);
                }
                contextResults.Invalidate();
            }
        }
Ejemplo n.º 5
0
        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;
        }
Ejemplo n.º 6
0
        private void FindCurrentObject()
        {
            Point       loc         = Earth3d.MainWindow.RenderWindow.PointToClient(this.PointToScreen(new Point(300, 88)));
            IPlace      closetPlace = null;
            Coordinates result      = new Coordinates(0, 0);

            if (Earth3d.MainWindow.SolarSystemMode)
            {
                Point     pt = loc;
                Vector3d  PickRayOrig;
                Vector3d  PickRayDir;
                Rectangle rect = Earth3d.MainWindow.RenderWindow.ClientRectangle;

                Earth3d.MainWindow.TransformStarPickPointToWorldSpace(pt, rect.Width, rect.Height, out PickRayOrig, out PickRayDir);
                Vector3d temp = new Vector3d(PickRayOrig);
                temp.Subtract(Earth3d.MainWindow.viewCamera.ViewTarget);

                //closetPlace = Grids.FindClosestObject(temp , new Vector3d(PickRayDir));
                CallFindClosestObject(temp, new Vector3d(PickRayDir));
            }
            else
            {
                // TODO fix this for earth, plantes, panoramas
                result = Earth3d.MainWindow.GetCoordinatesForScreenPoint(loc.X, loc.Y);
                string constellation = Earth3d.MainWindow.ConstellationCheck.FindConstellationForPoint(result.RA, result.Dec);
                //Place[] resultList = ContextSearch.FindClosestMatches(constellation, result.RA, result.Dec, ZoomFactor / 600, 5);
                closetPlace = ContextSearch.FindClosestMatch(constellation, result.RA, result.Dec, Earth3d.MainWindow.DegreesPerPixel * 80);

                if (closetPlace == null)
                {
                    // closetPlace = Grids.FindClosestMatch(constellation, result.RA, result.Dec, Earth3d.MainWindow.DegreesPerPixel * 80);
                    CallFindClosestMatch(constellation, result.RA, result.Dec, Earth3d.MainWindow.DegreesPerPixel * 80);
                    noPlaceDefault = new TourPlace(Language.GetLocalizedText(90, "No Object"), result.Dec, result.RA, Classification.Unidentified, constellation, ImageSetType.Sky, -1);
                    //Earth3d.MainWindow.SetLabelText(null, false);
                    return;
                }
                else
                {
                    Earth3d.MainWindow.SetLabelText(closetPlace, false);
                }
                Target = closetPlace;
            }
        }