public override void Initialize(DrawArgs drawArgs) { if (m_points == null) { isInitialized = true; return; } if (m_imageUri != null) { //load image if (m_imageUri.ToLower().StartsWith("http://")) { string savePath = string.Format("{0}\\image", ConfigurationLoader.GetRenderablePathString(this)); System.IO.FileInfo file = new System.IO.FileInfo(savePath); if (!file.Exists) { //Offline check if (!World.Settings.WorkOffline) { MFW3D.Net.WebDownload download = new MFW3D.Net.WebDownload(m_imageUri); if (!file.Directory.Exists) { file.Directory.Create(); } download.DownloadFile(file.FullName, MFW3D.Net.DownloadType.Unspecified); } } //file might not have downloaded. Especially if we are offline if (!file.Exists) { m_texture = ImageHelper.LoadTexture(file.FullName); } else { m_texture = null; } } else { m_texture = ImageHelper.LoadTexture(m_imageUri); } } UpdateVertices(); isInitialized = true; }
public override void Initialize(DrawArgs drawArgs) { if (m_points == null) { Inited = true; return; } if (m_imageUri != null) { //load image if (m_imageUri.ToLower().StartsWith("http://")) { string savePath = string.Format("{0}\\image", ConfigurationLoader.GetRenderablePathString(this)); FileInfo file = new FileInfo(savePath); if (!file.Exists) { WebDownload download = new WebDownload(m_imageUri); if (!file.Directory.Exists) { file.Directory.Create(); } download.DownloadFile(file.FullName, DownloadType.Unspecified); } m_texture = ImageHelper.LoadTexture(file.FullName); } else { m_texture = ImageHelper.LoadTexture(m_imageUri); } } UpdateVertices(); Inited = true; }
public void Initialize(DrawArgs drawArgs) { try { m_Initializing = true; double centerLatitude = 0.5 * (m_GeoBB.North + m_GeoBB.South); double centerLongitude = 0.5 * (m_GeoBB.West + m_GeoBB.East); m_NwImageLayer = CreateImageLayer(m_GeoBB.North, centerLatitude, m_GeoBB.West, centerLongitude, drawArgs, String.Format("{0}\\{1}\\{2}\\{3:D4}\\{3:D4}_{4:D4}.dds", ShapeTile.CachePath, ConfigurationLoader.GetRenderablePathString(m_ShapeTileArgs.ParentShapeFileLayer), Level + 1, 2 * Row + 1, 2 * Col)); m_NeImageLayer = CreateImageLayer(m_GeoBB.North, centerLatitude, centerLongitude, m_GeoBB.East, drawArgs, String.Format("{0}\\{1}\\{2}\\{3:D4}\\{3:D4}_{4:D4}.dds", ShapeTile.CachePath, ConfigurationLoader.GetRenderablePathString(m_ShapeTileArgs.ParentShapeFileLayer), Level + 1, 2 * Row + 1, 2 * Col + 1)); m_SwImageLayer = CreateImageLayer(centerLatitude, m_GeoBB.South, m_GeoBB.West, centerLongitude, drawArgs, String.Format("{0}\\{1}\\{2}\\{3:D4}\\{3:D4}_{4:D4}.dds", ShapeTile.CachePath, ConfigurationLoader.GetRenderablePathString(m_ShapeTileArgs.ParentShapeFileLayer), Level + 1, 2 * Row, 2 * Col)); m_SeImageLayer = CreateImageLayer(centerLatitude, m_GeoBB.South, centerLongitude, m_GeoBB.East, drawArgs, String.Format("{0}\\{1}\\{2}\\{3:D4}\\{3:D4}_{4:D4}.dds", ShapeTile.CachePath, ConfigurationLoader.GetRenderablePathString(m_ShapeTileArgs.ParentShapeFileLayer), Level + 1, 2 * Row, 2 * Col + 1)); if (m_NwImageLayer != null) { m_NwImageLayer.Initialize(drawArgs); } if (m_NeImageLayer != null) { m_NeImageLayer.Initialize(drawArgs); } if (m_SwImageLayer != null) { m_SwImageLayer.Initialize(drawArgs); } if (m_SeImageLayer != null) { m_SeImageLayer.Initialize(drawArgs); } } catch (Exception ex) { Utility.Log.Write(ex); } finally { m_Initializing = false; if (m_Disposing) { Dispose(); m_Initialized = false; } else { m_Initialized = true; } } }