Пример #1
0
        private void OpenWorld(string worldXmlFile)
        {
            if (this.worldWindow.CurrentWorld != null)
            {
                try
                {
                    // this.worldWindow.ResetToolbar();
                }
                catch
                { }
                try
                {
                    foreach (PluginInfo p in this.compiler.Plugins)
                    {
                        try
                        {
                            if (p.Plugin.IsLoaded)
                            {
                                p.Plugin.Unload();
                            }
                        }
                        catch
                        { }
                    }
                }
                catch
                { }

                try
                {
                    this.worldWindow.CurrentWorld.Dispose();
                }
                catch
                { }
            }
            if (this.gotoDialog != null)
            {
                this.gotoDialog.Dispose();
                this.gotoDialog = null;
            }
            if (this.rapidFireModisManager != null)
            {
                this.rapidFireModisManager.Dispose();
                this.rapidFireModisManager = null;
            }
            if (this.animatedEarthMananger != null)
            {
                this.animatedEarthMananger.Dispose();
                this.animatedEarthMananger = null;
            }
            if (this.wmsBrowser != null)
            {
                this.wmsBrowser.Dispose();
                this.wmsBrowser = null;
            }
            worldWindow.CurrentWorld = WorldWind.ConfigurationLoader.Load(worldXmlFile, worldWindow.Cache);
            this.splashScreen.SetText("Initializing menus...");
            InitializePluginCompiler();
            foreach (RenderableObject worldRootObject in this.worldWindow.CurrentWorld.RenderableObjects.ChildObjects)
            {
                this.AddLayerMenuButtons(this.worldWindow, worldRootObject);
            }
            this.AddInternalPluginMenuButtons();
        }
Пример #2
0
		/// <summary>
		/// Loads a new planet
		/// </summary>
		private void OpenWorld(string worldXmlFile)
		{
			
			if(this.worldWindow.CurrentWorld != null)
			{
				try
				{
					this.worldWindow.ResetToolbar();
				}
				catch
				{}

				try
				{
					foreach(PluginInfo p in this.compiler.Plugins)
					{
						try
						{
							if(p.Plugin.IsLoaded)
								p.Plugin.Unload();
						}
						catch
						{}
					}
				}
				catch
				{}
				
				try
				{
					this.worldWindow.CurrentWorld.Dispose();
				}
				catch
				{}
				
			}


			if(this.gotoDialog != null)
			{
				this.gotoDialog.Dispose();
				this.gotoDialog = null;
			}

			if(this.rapidFireModisManager != null)
			{
				this.rapidFireModisManager.Dispose();
				this.rapidFireModisManager = null;
			}

			if(this.animatedEarthMananger != null)
			{
				this.animatedEarthMananger.Dispose();
				this.animatedEarthMananger = null;
			}

			if(this.wmsBrowser != null)
			{
				this.wmsBrowser.Dispose();
				this.wmsBrowser = null;
			}

			//currentWorld = world;

		//	TerrainAccessor terrainAccessor = null;
		//	if(worldDescriptor.HasTerrainAccessor())
		//		terrainAccessor = this.getTerrainAccessorFromXML(worldDescriptor.TerrainAccessor);

			worldWindow.CurrentWorld = WorldWind.ConfigurationLoader.Load(worldXmlFile, worldWindow.Cache);


		/*	if(this.currentWorld.HasLayerDirectory())
			{
				string dirPath = worldDescriptor.LayerDirectory.Value;
				if(!Path.IsPathRooted(dirPath))
					if (worldDescriptor.LayerDirectory.Value.IndexOf("//") < 0) // ?
						dirPath = Path.Combine(  Settings.ConfigPath, dirPath );

				ArrayList nodes = new ArrayList();
				foreach (string layerSetFile in Directory.GetFiles( dirPath, "*.xml" ))
				{
					try
					{
						
						LayerSet.LayerSetDoc curLayerSetDoc = new LayerSet.LayerSetDoc();
						LayerSet.Type_LayerSet curLayerSet = new LayerSet.Type_LayerSet(curLayerSetDoc.Load(layerSetFile));

						RenderableObject wwroi = getRenderableObjectListFromLayerSet(this.worldWindow.CurrentWorld, curLayerSet, layerSetFile);
						world.RenderableObjects.Add( wwroi );
					}
					catch (Exception caught)
					{
						// Altova throws System.Exception
						splashScreen.SetError(
							String.Format(CultureInfo.CurrentCulture, "The file '{0}' is invalid: {1}",
							Path.GetFileName(layerSetFile), caught.Message) );
					}
				}

				this.layerTreeNodes = (TreeNode[])nodes.ToArray(typeof(TreeNode));
			}
*/
			
			this.splashScreen.SetText("Initializing menus...");
				
			InitializePluginCompiler();

			foreach(RenderableObject worldRootObject in this.worldWindow.CurrentWorld.RenderableObjects.ChildObjects)
			{
				this.AddLayerMenuButtons(this.worldWindow, worldRootObject);
			}

			this.AddInternalPluginMenuButtons();

			this.menuItemModisHotSpots.Enabled = worldWindow.CurrentWorld.IsEarth;
			this.menuItemAnimatedEarth.Enabled = worldWindow.CurrentWorld.IsEarth;
		

		}