public GeoportailForm(MainApplication parentApplication) { InitializeComponent(); checkBoxIsOn.Checked = true; try { m_WorldWindow = parentApplication.WorldWindow; //Set the PROJ_LIB env var //Initialize the metadata for territories TerritoryMetadata metadata = new TerritoryMetadata(parentApplication); //Create the GeoTilesLayer geoTilesLayer = new GeoportailTilesLayer("Geoportail Tiles",metadata, parentApplication, this); geoTilesLayer.IsOn = true; //Initialize the territories to display initially InitLayerState(); lock(m_WorldWindow.CurrentWorld.RenderableObjects.ChildObjects.SyncRoot) { foreach(WorldWind.Renderable.RenderableObject ro in m_WorldWindow.CurrentWorld.RenderableObjects.ChildObjects) { if(ro is WorldWind.Renderable.RenderableObjectList && ro.Name.IndexOf("Images") >= 0) { WorldWind.Renderable.RenderableObjectList imagesList = ro as WorldWind.Renderable.RenderableObjectList; //insert it at the end of the list imagesList.ChildObjects.Insert(imagesList.ChildObjects.Count - 1, geoTilesLayer); break; } } } cacheDirectory = String.Format("{0}\\Geoportail", m_WorldWindow.Cache.CacheDirectory); if(Directory.Exists(cacheDirectory) == true) { DirectoryInfo diCache = new DirectoryInfo(cacheDirectory); //for debug, delete the entire cache //diCache.Delete(true); } //check that proj.dll is installed correctly, else set plugin to off string projDllPath = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + "\\proj.dll"; if(! File.Exists(projDllPath)) { //TODO turned off for debugging geoTilesLayer.IsOn = false; throw new Exception("'proj.dll' needs to be in the same directory where WorldWind.exe is installed"); } } catch(Exception ex) { Utility.Log.Write(ex); throw; } }
public GeoportailTilesLayer(string name, TerritoryMetadata metadata, MainApplication parentApplication, GeoportailForm geoForm) : base(name) { this.name = name; this.metadata = metadata; this.parentApplication = parentApplication; this.geoForm = geoForm; dispTerritories = new Hashtable(); EarthRadius = parentApplication.WorldWindow.CurrentWorld.EquatorialRadius; EarthHalfCirc = EarthRadius * Math.PI; EarthCircum = EarthHalfCirc * 2.0; }