private void c_miAdvancedSettings_Click(object sender, EventArgs e) { Wizard wiz = new Wizard(Settings); wiz.ShowDialog(this); }
internal MainForm(string strView, string strGeoTiff, string strGeotiffName, bool bGeotiffTmp, string strKMLFile, string strKMLName, bool blKMLTmp, string strLastView, Dapple.Extract.Options.Client.ClientType eClientType, RemoteInterface oMRI, GeographicBoundingBox oAoi, string strAoiCoordinateSystem, string strMapFileName) { if (String.Compare(Path.GetExtension(strView), ViewExt, true) == 0 && File.Exists(strView)) this.openView = strView; m_strOpenGeoTiffFile = strGeoTiff; m_strOpenGeoTiffName = strGeotiffName; m_blOpenGeoTiffTmp = bGeotiffTmp; m_strOpenKMLFile = strKMLFile; m_strOpenKMLName = strKMLName; m_blOpenKMLTmp = blKMLTmp; this.lastView = strLastView; s_oMontajRemoteInterface = oMRI; // Establish the version number string used for user display, // such as the Splash and Help->About screens. // To change the Application.ProductVersion make the // changes in \WorldWind\AssemblyInfo.cs // For alpha/beta versions, include " alphaN" or " betaN" // at the end of the format string. Version ver = new Version(Application.ProductVersion); Release = string.Format(CultureInfo.InvariantCulture, "{0}.{1}.{2}", ver.Major, ver.Minor, ver.Build); if (ver.Build % 2 != 0) Release += " (BETA)"; // Name the main thread. System.Threading.Thread.CurrentThread.Name = ThreadNames.EventDispatch; // Copy/Update any configuration files and other files if needed now CurrentSettingsDirectory = Path.Combine(UserPath, "Config"); Directory.CreateDirectory(CurrentSettingsDirectory); Settings.CachePath = Path.Combine(UserPath, "Cache"); Directory.CreateDirectory(Settings.CachePath); this.metaviewerDir = Path.Combine(UserPath, "Metadata"); Directory.CreateDirectory(this.metaviewerDir); string[] cfgFiles = Directory.GetFiles(Path.Combine(DirectoryPath, "Config"), "*.xml"); foreach (string strCfgFile in cfgFiles) { string strUserCfg = Path.Combine(CurrentSettingsDirectory, Path.GetFileName(strCfgFile)); if (!File.Exists(strUserCfg)) File.Copy(strCfgFile, strUserCfg); } string[] metaFiles = Directory.GetFiles(Path.Combine(Path.Combine(DirectoryPath, "Data"), "MetaViewer"), "*.*"); foreach (string strMetaFile in metaFiles) { string strUserMeta = Path.Combine(this.metaviewerDir, Path.GetFileName(strMetaFile)); File.Copy(strMetaFile, strUserMeta, true); } // --- Set up a new user's favorites list and home view --- /*if (!File.Exists(Path.Combine(CurrentSettingsDirectory, "user.dapple_serverlist"))) { File.Copy(Path.Combine(Path.Combine(DirectoryPath, "Data"), "default.dapple_serverlist"), Path.Combine(CurrentSettingsDirectory, "user.dapple_serverlist")); }*/ HomeView.CreateDefault(); InitSettings(); if (Settings.NewCachePath.Length > 0) { try { // We want to make sure the new cache path is writable Directory.CreateDirectory(Settings.NewCachePath); if (Directory.Exists(Settings.CachePath)) Utility.FileSystem.DeleteFolderGUI(this, Settings.CachePath, "Deleting Existing Cache"); Settings.CachePath = Settings.NewCachePath; } catch { } Settings.NewCachePath = ""; } if (Settings.ConfigurationWizardAtStartup) { Wizard frm = new Wizard(Settings); frm.ShowDialog(this); Settings.ConfigurationWizardAtStartup = false; } if (Settings.ConfigurationWizardAtStartup) { // If the settings file doesn't exist, then we are using the // default settings, and the default is to show the Configuration // Wizard at startup. We only want that to happen the first time // World Wind is started, so change the setting to false(the user // can change it to true if they want). if (!File.Exists(Settings.FileName)) { Settings.ConfigurationWizardAtStartup = false; } ConfigurationWizard.Wizard wizard = new ConfigurationWizard.Wizard(Settings); wizard.TopMost = true; wizard.ShowInTaskbar = true; wizard.ShowDialog(); // TODO: should settings be saved now, in case of program crashes, // and so that XML file on disk matches in-memory settings? } //#if !DEBUG using (this.splashScreen = new Splash()) { this.splashScreen.Owner = this; this.splashScreen.Show(); Application.DoEvents(); //#endif // --- setup the list of images used for the different datatypes --- s_oImageList.ColorDepth = ColorDepth.Depth32Bit; s_oImageList.ImageSize = new Size(16, 16); s_oImageList.TransparentColor = Color.Transparent; s_oImageList.Images.Add(EnabledServerIconKey, Resources.enserver); s_oImageList.Images.Add(DisabledServerIconKey, Resources.disserver); s_oImageList.Images.Add(OfflineServerIconKey, Resources.offline); s_oImageList.Images.Add(DapIconKey, Resources.dap); s_oImageList.Images.Add(DapDatabaseIconKey, Resources.dap_database); s_oImageList.Images.Add(DapDocumentIconKey, Resources.dap_document); s_oImageList.Images.Add(DapGridIconKey, Resources.dap_grid); s_oImageList.Images.Add(DapMapIconKey, Resources.dap_map); s_oImageList.Images.Add(DapPictureIconKey, Resources.dap_picture); s_oImageList.Images.Add(DapPointIconKey, Resources.dap_point); s_oImageList.Images.Add(DapSpfIconKey, Resources.dap_spf); s_oImageList.Images.Add(DapVoxelIconKey, Resources.dap_voxel); s_oImageList.Images.Add(FolderIconKey, Resources.folder); s_oImageList.Images.Add(DapArcGisIconKey, global::Dapple.Properties.Resources.dap_arcgis); s_oImageList.Images.Add(KmlIconKey, Resources.kml); s_oImageList.Images.Add(ErrorIconKey, global::Dapple.Properties.Resources.error); s_oImageList.Images.Add(LayerIconKey, global::Dapple.Properties.Resources.layer); s_oImageList.Images.Add(LiveMapsIconKey, global::Dapple.Properties.Resources.live); s_oImageList.Images.Add(TileIconKey, global::Dapple.Properties.Resources.tile); s_oImageList.Images.Add(GeorefImageIconKey, global::Dapple.Properties.Resources.georef_image); s_oImageList.Images.Add(WmsIconKey, Resources.wms); s_oImageList.Images.Add(ArcImsIconKey, global::Dapple.Properties.Resources.arcims); s_oImageList.Images.Add(BlueMarbleIconKey, Dapple.Properties.Resources.blue_marble); s_oImageList.Images.Add(DesktopCatalogerIconKey, Dapple.Properties.Resources.dcat); c_oWorldWindow = new WorldWindow(); #if !DEBUG Utility.AbortUtility.ProgramAborting += new MethodInvoker(c_oWorldWindow.KillD3DAndWorkerThread); #endif c_oWorldWindow.AllowDrop = true; c_oWorldWindow.DragOver += new DragEventHandler(c_oWorldWindow_DragOver); c_oWorldWindow.DragDrop += new DragEventHandler(c_oWorldWindow_DragDrop); c_oWorldWindow.Resize += new EventHandler(c_oWorldWindow_Resize); InitializeComponent(); this.SuspendLayout(); c_oLayerList.ImageList = s_oImageList; /*#if DEBUG // --- Make the server tree HOOGE --- this.splitContainerMain.SplitterDistance = 400; this.splitContainerLeftMain.SplitterDistance = 400; #endif*/ this.Icon = new System.Drawing.Icon(@"app.ico"); DappleToolStripRenderer oTSR = new DappleToolStripRenderer(); c_tsSearch.Renderer = oTSR; c_tsLayers.Renderer = oTSR; c_tsOverview.Renderer = oTSR; c_tsMetadata.Renderer = oTSR; c_tsNavigation.Renderer = new BorderlessToolStripRenderer(); // set Upper and Lower limits for Cache size control, in bytes long CacheUpperLimit = (long)Settings.CacheSizeGigaBytes * 1024L * 1024L * 1024L; long CacheLowerLimit = (long)Settings.CacheSizeGigaBytes * 768L * 1024L * 1024L; //75% of upper limit try { Directory.CreateDirectory(Settings.CachePath); } catch { // We get here when people used a cache drive that since dissappeared (e.g. USB flash) // Revert to default cache directory in this case Settings.CachePath = Path.Combine(UserPath, "Cache"); Directory.CreateDirectory(Settings.CachePath); } //Set up the cache c_oWorldWindow.Cache = new Cache( Settings.CachePath, CacheLowerLimit, CacheUpperLimit, Settings.CacheCleanupInterval, Settings.TotalRunTime); #region Plugin + World Init. WorldWind.Terrain.TerrainTileService terrainTileService = new WorldWind.Terrain.TerrainTileService("http://worldwind25.arc.nasa.gov/wwelevation/wwelevation.aspx", "srtm30pluszip", 20, 150, "bil", 12, Path.Combine(Settings.CachePath, "Earth\\TerrainAccessor\\SRTM"), TimeSpan.FromMinutes(30), "Int16"); WorldWind.Terrain.TerrainAccessor terrainAccessor = new WorldWind.Terrain.NltTerrainAccessor("SRTM", -180, -90, 180, 90, terrainTileService, null); WorldWind.World world = new WorldWind.World("Earth", new Point3d(0, 0, 0), Quaternion4d.RotationYawPitchRoll(0, 0, 0), (float)6378137, System.IO.Path.Combine(c_oWorldWindow.Cache.CacheDirectory, "Earth"), terrainAccessor); c_oWorldWindow.CurrentWorld = world; c_oWorldWindow.DrawArgs.WorldCamera.CameraChanged += new EventHandler(c_oWorldWindow_CameraChanged); string strPluginsDir = Path.Combine(DirectoryPath, "Plugins"); this.scalebarPlugin = new NASA.Plugins.ScaleBarLegend(); this.scalebarPlugin.PluginLoad(this, strPluginsDir); this.scalebarPlugin.IsVisible = World.Settings.ShowScaleBar; this.starsPlugin = new Stars3D.Plugin.Stars3D(); this.starsPlugin.PluginLoad(this, Path.Combine(strPluginsDir, "Stars3D")); this.compassPlugin = new Murris.Plugins.Compass(); this.compassPlugin.PluginLoad(this, Path.Combine(strPluginsDir, "Compass")); String szGlobalCloudsCacheDir = Path.Combine(Settings.CachePath, @"Plugins\GlobalClouds"); Directory.CreateDirectory(szGlobalCloudsCacheDir); String szGlobalCloudsPluginDir = Path.Combine(CurrentSettingsDirectory, @"Plugins\GlobalClouds"); Directory.CreateDirectory(szGlobalCloudsPluginDir); if (!File.Exists(Path.Combine(szGlobalCloudsPluginDir, Murris.Plugins.GlobalCloudsLayer.serverListFileName))) { File.Copy(Path.Combine(Path.Combine(strPluginsDir, "GlobalClouds"), Murris.Plugins.GlobalCloudsLayer.serverListFileName), Path.Combine(szGlobalCloudsPluginDir, Murris.Plugins.GlobalCloudsLayer.serverListFileName)); } this.cloudsPlugin = new Murris.Plugins.GlobalClouds(szGlobalCloudsCacheDir); this.cloudsPlugin.PluginLoad(this, szGlobalCloudsPluginDir); this.skyPlugin = new Murris.Plugins.SkyGradient(); this.skyPlugin.PluginLoad(this, Path.Combine(strPluginsDir, "SkyGradient")); this.threeDConnPlugin = new ThreeDconnexion.Plugin.TDxWWInput(); this.threeDConnPlugin.PluginLoad(this, Path.Combine(strPluginsDir, "3DConnexion")); ThreadPool.QueueUserWorkItem(LoadPlacenames); c_scWorldMetadata.Panel1.Controls.Add(c_oWorldWindow); c_oWorldWindow.Dock = DockStyle.Fill; #endregion float[] verticalExaggerationMultipliers = { 0.0f, 1.0f, 1.5f, 2.0f, 3.0f, 5.0f, 7.0f, 10.0f }; foreach (float multiplier in verticalExaggerationMultipliers) { ToolStripMenuItem curItem = new ToolStripMenuItem(multiplier.ToString("f1", System.Threading.Thread.CurrentThread.CurrentCulture) + "x", null, new EventHandler(menuItemVerticalExaggerationChange)); c_miVertExaggeration.DropDownItems.Add(curItem); curItem.CheckOnClick = true; if (Math.Abs(multiplier - World.Settings.VerticalExaggeration) < 0.1f) curItem.Checked = true; } this.c_miShowCompass.Checked = World.Settings.ShowCompass; this.c_miShowDLProgress.Checked = World.Settings.ShowDownloadIndicator; this.c_miShowCrosshair.Checked = World.Settings.ShowCrosshairs; this.c_miShowInfoOverlay.Checked = World.Settings.ShowPosition; this.c_miShowGridlines.Checked = World.Settings.ShowLatLonLines; this.c_miShowGlobalClouds.Checked = World.Settings.ShowClouds; if (World.Settings.EnableSunShading) { if (!World.Settings.SunSynchedWithTime) this.c_miSunshadingEnabled.Checked = true; else this.c_miSunshadingSync.Checked = true; } else this.c_miSunshadingDisabled.Checked = true; this.c_miShowAtmoScatter.Checked = World.Settings.EnableAtmosphericScattering; this.c_miAskLastViewAtStartup.Checked = Settings.AskLastViewAtStartup; if (!Settings.AskLastViewAtStartup) this.c_miOpenLastViewAtStartup.Checked = Settings.LastViewAtStartup; #region OverviewPanel // Fix: earlier versions of Dapple set the DataPath as an absolute reference, so if Dapple was uninstalled, OMapple could not find // the file for the overview control. To fix this, switch the variable to a relative reference if the absolute one doesn't resolve. // Dapple will still work; the relative reference will be from whatever directory Dapple is being run. if (!Directory.Exists(Settings.DataPath)) Settings.DataPath = "Data"; #endregion c_oWorldWindow.MouseEnter += new EventHandler(this.c_oWorldWindow_MouseEnter); c_oWorldWindow.MouseLeave += new EventHandler(this.c_oWorldWindow_MouseLeave); c_oOverview.AOISelected += new Overview.AOISelectedDelegate(c_oOverview_AOISelected); #region Search view setup this.c_oServerList = new ServerList(); m_oModel = new DappleModel(c_oLayerList); m_oModel.SelectedNodeChanged += new EventHandler(m_oModel_SelectedNodeChanged); c_oLayerList.Attach(m_oModel); NewServerTree.View.ServerTree newServerTree = new NewServerTree.View.ServerTree(); newServerTree.Attach(m_oModel); c_oServerList.Attach(m_oModel); c_oLayerList.LayerSelectionChanged += new EventHandler(c_oLayerList_LayerSelectionChanged); m_oMetadataDisplay = new MetadataDisplayThread(this); m_oMetadataDisplay.AddBuilder(null); c_oServerList.LayerList = c_oLayerList; c_oLayerList.GoTo += new LayerList.GoToHandler(this.GoTo); c_oLayerList.ViewMetadata += new ViewMetadataHandler(m_oMetadataDisplay.AddBuilder); c_oServerList.ViewMetadata += new ViewMetadataHandler(m_oMetadataDisplay.AddBuilder); c_oServerList.LayerSelectionChanged += new EventHandler(c_oServerList_LayerSelectionChanged); this.cServerViewsTab = new JanaTab(); this.cServerViewsTab.SetImage(0, Resources.tab_tree); this.cServerViewsTab.SetImage(1, Resources.tab_list); this.cServerViewsTab.SetToolTip(0, "Server tree view"); this.cServerViewsTab.SetToolTip(1, "Server list view"); this.cServerViewsTab.SetNameAndText(0, "TreeView"); this.cServerViewsTab.SetNameAndText(1, "ListView"); this.cServerViewsTab.SetPage(0, newServerTree); this.cServerViewsTab.SetPage(1, this.c_oServerList); cServerViewsTab.PageChanged += new JanaTab.PageChangedDelegate(ServerPageChanged); c_oDappleSearch = new DappleSearchList(); c_oDappleSearch.LayerSelectionChanged += new EventHandler(c_oDappleSearch_LayerSelectionChanged); c_oDappleSearch.Attach(m_oModel, c_oLayerList); c_tcSearchViews.TabPages[0].Controls.Add(cServerViewsTab); cServerViewsTab.Dock = DockStyle.Fill; c_tcSearchViews.TabPages[1].Controls.Add(c_oDappleSearch); c_oDappleSearch.Dock = DockStyle.Fill; c_oLayerList.SetBaseLayer(new BlueMarbleBuilder()); this.ResumeLayout(false); #endregion this.PerformLayout(); while (!this.splashScreen.IsDone) System.Threading.Thread.Sleep(50); // Force initial render to avoid showing random contents of frame buffer to user. c_oWorldWindow.Render(); WorldWindow.Focus(); #region OM Forked Process configuration if (IsRunningAsDapClient) { c_oLayerList.OMFeaturesEnabled = true; this.MinimizeBox = false; if (oAoi != null && !string.IsNullOrEmpty(strAoiCoordinateSystem)) { s_oOMMapExtentNative = oAoi; s_strAoiCoordinateSystem = strAoiCoordinateSystem; s_strOpenMapFileName = strMapFileName; s_oOMMapExtentWGS84 = s_oOMMapExtentNative.Clone() as GeographicBoundingBox; s_oMontajRemoteInterface.ProjectBoundingRectangle(strAoiCoordinateSystem, ref s_oOMMapExtentWGS84.West, ref s_oOMMapExtentWGS84.South, ref s_oOMMapExtentWGS84.East, ref s_oOMMapExtentWGS84.North, Dapple.Extract.Resolution.WGS_84); } s_eClientType = eClientType; c_miLastView.Enabled = false; c_miLastView.Visible = false; c_miDappleHelp.Visible = false; c_miDappleHelp.Enabled = false; toolStripSeparator10.Visible = false; c_miOpenImage.Visible = false; c_miOpenImage.Enabled = false; c_miOpenKeyhole.Visible = false; c_miOpenKeyhole.Enabled = false; // Hide and disable the file menu c_miFile.Visible = false; c_miFile.Enabled = false; c_miOpenSavedView.Visible = false; c_miOpenSavedView.Enabled = false; c_miOpenHomeView.Visible = false; c_miOpenHomeView.Enabled = false; c_miSetHomeView.Visible = false; c_miSetHomeView.Enabled = false; c_miSaveView.Visible = false; c_miSaveView.Enabled = false; c_miSendViewTo.Visible = false; c_miSendViewTo.Enabled = false; c_miOpenKeyhole.Visible = false; c_miOpenKeyhole.Enabled = false; // Show the OM help menu c_miGetDatahelp.Enabled = true; c_miGetDatahelp.Visible = true; // Don't let the user check for updates. EVER. c_miCheckForUpdates.Visible = false; c_miCheckForUpdates.Enabled = false; } else { c_miExtractLayers.Visible = false; c_miExtractLayers.Enabled = false; } #endregion loadCountryList(); populateAoiComboBox(); LoadMRUList(); CenterNavigationToolStrip(); //#if !DEBUG c_tbSearchKeywords.Text = NO_SEARCH; } //#endif }
private void ProxyPage_Load(object sender, EventArgs e) { // Initialize from Settings this.SetSamplerState(0, SamplerStatetextBoxProxyUrl.SetSamplerState(0, SamplerStateText = Wizard.SetSamplerState(0, SamplerStateSettings.SetSamplerState(0, SamplerStateProxyUrl; this.SetSamplerState(0, SamplerStatetextBoxUsername.SetSamplerState(0, SamplerStateText = Wizard.SetSamplerState(0, SamplerStateSettings.SetSamplerState(0, SamplerStateProxyUsername; this.SetSamplerState(0, SamplerStatetextBoxPassword.SetSamplerState(0, SamplerStateText = Wizard.SetSamplerState(0, SamplerStateSettings.SetSamplerState(0, SamplerStateProxyPassword; this.SetSamplerState(0, SamplerStatecheckBoxUseProxyScript.SetSamplerState(0, SamplerStateChecked = Wizard.SetSamplerState(0, SamplerStateSettings.SetSamplerState(0, SamplerStateUseDynamicProxy; if (Wizard.SetSamplerState(0, SamplerStateSettings.SetSamplerState(0, SamplerStateUseWindowsDefaultProxy) { this.SetSamplerState(0, SamplerStateradioButtonUseWindowsDefaultProxy.SetSamplerState(0, SamplerStateChecked = true; } else { if(Wizard.SetSamplerState(0, SamplerStateSettings.SetSamplerState(0, SamplerStateProxyUrl.SetSamplerState(0, SamplerStateLength > 0 || Wizard.SetSamplerState(0, SamplerStateSettings.SetSamplerState(0, SamplerStateUseDynamicProxy) { this.SetSamplerState(0, SamplerStateradioButtonUserDefinedProxy.SetSamplerState(0, SamplerStateChecked = true; }