Пример #1
0
        private void Earth3d_Load(object sender, System.EventArgs e)
        {
            CheckOSVersion();
            string path = Properties.Settings.Default.ImageSetUrl;

            if (Properties.Settings.Default.ImageSetUrl.ToLower().Contains("imagesetsnew"))
            {
                Properties.Settings.Default.ImageSetUrl = "http://www.worldwidetelescope.org/wwtweb/catalog.aspx?X=ImageSets5";
            }
             
            Earth3d.MainWindow = this;
            this.dsm = new DataSetManager();
            Constellations.Containment = this.constellationCheck;

            ContextSearch.InitializeDatabase(true);

            LoadExploreRoot();
            if (explorerRoot != null)
            {
                ContextSearch.AddFolderToSearch(explorerRoot, true);
            }
            ContextSearch.AddCatalogs(true);

            BackInitDelegate initBackground = SearchInit;

            initBackground.BeginInvoke(null, null);

            this.WindowState = FormWindowState.Maximized;



            this.FormBorderStyle = TouchKiosk ? FormBorderStyle.None : FormBorderStyle.Sizable;
            TileCache.StartQueue();
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.UserPaint, true);
            Earth3d.MainWindow.Config.DomeTilt = (float)Properties.Settings.Default.DomeTilt;
            if (ProjectorServer)
            {
                ShowFullScreen(true);
                this.timer.Interval = 1000;
                this.InputTimer.Enabled = false;
                Cursor.Hide();
                Properties.Settings.Default.ShowCrosshairs = false;
                Properties.Settings.Default.SolarSystemMultiRes = true;
                NetControl.Start();

            }
            else
            {
                if (Properties.Settings.Default.ListenMode || Settings.DomeView)
                {
                    NetControl.Start();
                }
            }
            if (Settings.MasterController)
            {
                NetControl.StartStatusListner();
            }

            if (Settings.MasterController)
            {
                NetControl.LoadNodeList();
            }

            if (Earth3d.TouchKiosk)
            {
                this.menuTabs.IsVisible = false;
                this.kioskTitleBar.Visible = true;
                Properties.Settings.Default.ShowTouchControls = true;
                ShowFullScreen(true);
            }

            if (NoUi)
            {
                this.menuTabs.IsVisible = false;
                Properties.Settings.Default.ShowTouchControls = true;
                ShowFullScreen(true);
            }

            Tile.GrayscaleStyle = Properties.Settings.Default.MonochromeImageStyle;



            // This forces a init at startup does not do anything but force the static contstuctor to fire now
            LayerManager.LoadTree();

            listenUpBoysToolStripMenuItem.Checked = Properties.Settings.Default.ListenMode;
            int id = Properties.Settings.Default.StartUpLookAt;
            if (Properties.Settings.Default.StartUpLookAt == 5)
            {
                id = Properties.Settings.Default.LastLookAtMode;
            }

            if (Properties.Settings.Default.StartUpLookAt == 6)
            {
                Random rnd = new Random();
                id = rnd.Next(-1, 5);
                Properties.Settings.Default.LastLookAtMode = id;
            }

            CurrentImageSet = GetDefaultImageset((ImageSetType)id, BandPass.Visible);

            Properties.Settings.Default.SettingChanging += new System.Configuration.SettingChangingEventHandler(Default_SettingChanging);
            Properties.Settings.Default.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(Default_PropertyChanged);

            if (Properties.Settings.Default.LocalHorizonMode)
            {
                viewType = ViewTypes.AltAz;
            }
            else
            {
                viewType = ViewTypes.Equatorial;
            }
            InitSpaceNavigator();
            ReadyToRender = true;
            Refresh();

            try
            {
                fov = new FieldOfView(Properties.Settings.Default.FovTelescope, Properties.Settings.Default.FovCamera, Properties.Settings.Default.FovEyepiece);
            }
            catch
            {
            }

            SpaceTimeController.Altitude = Properties.Settings.Default.LocationAltitude;
            SpaceTimeController.Location = Coordinates.FromLatLng(Properties.Settings.Default.LocationLat, Properties.Settings.Default.LocationLng);

            TourPlayer.TourEnded += new EventHandler(TourPlayer_TourEnded);
            if (KmlMarkers == null)
            {
                KmlMarkers = new KmlLabels();
            }
            ReadyToRender = true;
            Initialized = true;
            this.Activate();
            fadeImageSet.State = false;
            fadeImageSet.State = true;
            fadeImageSet.TargetState = false;

            // Force settings 
            Properties.Settings.Default.ActualPlanetScale = true;
            Properties.Settings.Default.HighPercitionPlanets = true;
            Properties.Settings.Default.ShowMoonsAsPointSource = false;
            Properties.Settings.Default.ShowSolarSystem.TargetState = true;

            toolStripMenuItem2.Checked = Settings.MasterController;

            viewCamera.Target = SolarSystemObjects.Sun;

            if (!ProjectorServer)
            {
                webServer.Startup();

                sampConnection = new Samp();

                // Register goto
                SampMessageHandler.RegiseterMessage(new SampCoordPointAtSky(new CoordPointAtSkyDelegate(SampGoto)));
                SampMessageHandler.RegiseterMessage(new SampTableLoadVoTable(new TableLoadVoTableDelegate(SampLoadTable)));
                SampMessageHandler.RegiseterMessage(new SampImageLoadFits(new ImageLoadFitsDelegate(SampLoadFitsImage)));
                SampMessageHandler.RegiseterMessage(new SampTableHighlightRow(new TableHighlightRowDelegate(SampHighlightRow)));

                NetworkChange.NetworkAddressChanged += new NetworkAddressChangedEventHandler(NetworkChange_NetworkAddressChanged);

                MidiMapManager.Startup();

            }

            Fader.TargetState = false;

            hold = new Text3dBatch(80);
            hold.Add(new Text3d(new Vector3d(0, 0, 1), new Vector3d(0, 1, 0), " 0hr123456789-+", 80, .0001f));
            hold.Add(new Text3d(new Vector3d(0, 0, 1), new Vector3d(0, 1, 0), "JanuyFebMcApilg", 80, .0001f));
            hold.Add(new Text3d(new Vector3d(0, 0, 1), new Vector3d(0, 1, 0), "stSmOoNvDBCEdqV", 80, .0001f));
            hold.Add(new Text3d(new Vector3d(0, 0, 1), new Vector3d(0, 1, 0), "jxGHILPRTU", 80, .0001f));
            hold.PrepareBatch();

            Constellations.InitializeConstellationNames();

            if (Properties.Settings.Default.ShowClientNodeList && !ProjectorServer)
            {

                ClientNodeList.ShowNodeList();
            }

            if (DetachScreenId > -1)
            {
                FreeFloatRenderWindow(DetachScreenId);
            }

            if (!string.IsNullOrWhiteSpace(Properties.Settings.Default.RefreshToken))
            {
                WindowsLiveSignIn();
            }
        }
Пример #2
0
 private void UpdateKmlViewInfo()
 {
     KmlViewInfo.bboxNorth = Math.Max(CurrentViewCorners[0].Dec, CurrentViewCorners[1].Dec);
     KmlViewInfo.bboxSouth = Math.Min(CurrentViewCorners[2].Dec, CurrentViewCorners[3].Dec);
     KmlViewInfo.bboxEast = Math.Max(CurrentViewCorners[1].Lng, CurrentViewCorners[2].Lng);
     KmlViewInfo.bboxWest = Math.Min(CurrentViewCorners[0].Lng, CurrentViewCorners[2].Lng);
     KmlViewInfo.viewMoving = false;
     KmlViewInfo.viewJustStopped = true;
     //todo Fill in completely from camera parameters..
     if (KmlMarkers == null)
     {
         KmlMarkers = new KmlLabels();
     }
 }