public void SetViewRect(Coordinates[] corners)
        {
            if (corners.Length != 4)
            {
                return;
            }
            bool change = false;

            if (this.cornersLast != null)
            {
                for (int i = 0; i < 4; i++)
                {
                    if (this.cornersLast[i] != corners[i])
                    {
                        change = true;
                        break;
                    }
                }
            }
            else
            {
                change = true;
            }

            if (!change)
            {
                return;
            }
            this.cornersLast   = corners;
            contextAreaChanged = true;

            overview.SetViewRect(corners);
            SkyBall.SetViewRect(corners);
        }
        private void SetWindowState(WindowsStates newState)
        {
            int diff = 0;

            switch (newState)
            {
            case WindowsStates.StatusOnly:
                pinUp.Direction = Direction.Expanding;
                pinUp1.Visible  = false;
                diff            = Height - 50;
                break;

            case WindowsStates.OneLine:
                pinUp.Direction = Direction.Expanding;
                diff            = Height - 120;
                pinUp1.Visible  = true;
                autoRestore     = true;
                break;

            case WindowsStates.MultiLine:
                pinUp.Direction = Direction.Collapsing;
                diff            = Height - 345;
                pinUp1.Visible  = true;
                autoRestore     = true;
                break;

            default:
                break;
            }
            Top                += diff;
            Height             -= diff;
            state               = newState;
            SkyBall.Space       = Earth3d.MainWindow.Space;
            SkyBall.ShowSkyball = SkyBall.Space && state != WindowsStates.StatusOnly;
            SkyBall.RefreshHint();
            contextResults.Invalidate();
        }
        private void UpdateVisibility(bool space)
        {
            if (ShowTimeline)
            {
                Timeline.Visible                      = true;
                closeBox.Visible                      = true;
                PushPin.Visible                       = true;
                this.levelLabel.Visible               = false;
                this.ConstellationLabel.Visible       = false;
                this.queueProgressBar.Visible         = false;
                this.label1.Visible                   = false;
                this.label2.Visible                   = false;
                this.label3.Visible                   = false;
                this.studyOpacity.Visible             = false;
                this.viewTarget.Visible               = false;
                this.ImageDataSetsCombo.Visible       = false;
                this.FilterCombo.Visible              = false;
                this.contextResults.Visible           = false;
                this.paginator1.Visible               = false;
                this.overview.Visible                 = false;
                this.SkyBall.Visible                  = false;
                this.layerToggle.Visible              = false;
                this.faderText.Visible                = false;
                this.trackingText.Visible             = false;
                this.trackingLabel.Visible            = false;
                this.actualSizeLabel.Visible          = false;
                this.bigSizeLabel.Visible             = false;
                this.scaleText.Visible                = false;
                this.scaleLabel.Visible               = false;
                this.scaleButton.Visible              = false;
                this.solarSystemScaleTrackbar.Visible = false;
                this.trackingTarget.Visible           = false;
                this.info.Visible                     = false;
            }
            else
            {
                this.PushPin.Visible            = false;
                this.closeBox.Visible           = false;
                this.levelLabel.Visible         = true;
                this.ConstellationLabel.Visible = true;
                this.queueProgressBar.Visible   = true;
                this.label1.Visible             = true;
                this.label2.Visible             = true;
                this.label3.Visible             = true;
                this.viewTarget.Visible         = true;
                this.ImageDataSetsCombo.Visible = true;
                this.FilterCombo.Visible        = true;
                this.paginator1.Visible         = true;
                this.SkyBall.Visible            = true;
                this.layerToggle.Visible        = true;
                this.trackingText.Visible       = true;
                this.trackingTarget.Visible     = true;
                this.info.Visible = true;



                Timeline.Visible = false;



                bool solarSystem = Earth3d.MainWindow.SolarSystemMode;
                studyOpacity.Visible   = (Earth3d.MainWindow.StudyImageset != null);
                trackingTarget.Visible = (state != WindowsStates.StatusOnly) && solarSystem;
                contextResults.Visible = state != WindowsStates.StatusOnly;

                actualSizeLabel.Visible          = solarSystem;
                bigSizeLabel.Visible             = solarSystem;
                solarSystemScaleTrackbar.Visible = solarSystem;
                scaleText.Visible = solarSystem;

                if (solarSystem)
                {
                    if (solarSystemScaleTrackbar.Value != Settings.Active.SolarSystemScale)
                    {
                        solarSystemScaleTrackbar.Value = Settings.Active.SolarSystemScale;
                    }
                }

                SkyBall.Space = space;
                if (solarSystem)
                {
                    if (SkyBall.ShowSkyball)
                    {
                        SkyBall.ShowSkyball = false;
                        SkyBall.RefreshHint();
                    }
                }
                else
                {
                    SkyBall.ShowSkyball = state != WindowsStates.StatusOnly;
                    //SkyBall.ShowSkyball = space && state != WindowsStates.StatusOnly;
                }
                overview.Visible = (state != WindowsStates.StatusOnly) && !(solarSystem || !space);

                if (Earth3d.MainWindow.Tracking && (Earth3d.MainWindow.Space))
                {
                    trackingLabel.Visible = true;
                    if (lastTracking != Earth3d.MainWindow.TrackingObject.Name)
                    {
                        trackingText.Text = Earth3d.MainWindow.TrackingObject.Name.Substring(0, Math.Min(40, Earth3d.MainWindow.TrackingObject.Name.Length));
                        lastTracking      = Earth3d.MainWindow.TrackingObject.Name;
                    }
                }
                else if (Earth3d.MainWindow.SolarSystemMode)
                {
                    trackingLabel.Visible = true;
                    if (Earth3d.MainWindow.TrackingObject != null && lastTracking != Earth3d.MainWindow.TrackingObject.Name)
                    {
                        trackingText.Text = Earth3d.MainWindow.TrackingObject.Name;
                        lastTracking      = trackingText.Text;
                        trackingTarget.Items.Clear();
                        trackingTarget.Items.Add(Earth3d.MainWindow.TrackingObject);
                        trackingTarget.Invalidate();
                    }
                    if (contextResults.Count == 0)
                    {
                        RunQuerySolarSystem();
                        contextAreaChanged = false;
                    }
                }
                else
                {
                    trackingLabel.Visible = false;
                    trackingText.Text     = "";
                }

                // COmmented to add context search to planetary mode
                //if (!(space || solarSystem) && state != WindowsStates.StatusOnly)
                //{
                //    autoRestore = true;
                //    SetWindowState(WindowsStates.StatusOnly);
                //}

                if ((space || solarSystem) && state == WindowsStates.StatusOnly && autoRestore)
                {
                    SetWindowState(WindowsStates.OneLine);
                }
            }
        }