public override void Update(WorldWind.DrawArgs drawArgs) { lock (this) { if (m_oLayer != null) { if (m_oGroundOverlay.Icon.ViewRefreshMode == KMLViewRefreshMode.onStop) { double dTimeStopped; if (drawArgs.CurrentRoI.Equals(m_oLastAoI)) { dTimeStopped = (DateTime.Now - m_oLastAoIChangeTime).Seconds; } else { dTimeStopped = 0.0; m_oLastAoI = drawArgs.CurrentRoI; m_oLastAoIChangeTime = DateTime.Now; } if (dTimeStopped > m_oGroundOverlay.Icon.ViewRefreshTime && !m_oLayerAoI.Equivalent(drawArgs.CurrentRoI, 1e-6)) { try { File.Delete(m_strImageFilename); } catch (IOException) { return; } GeographicBoundingBox oRenderBox = GetNewBox(drawArgs.CurrentRoI, m_oGroundOverlay.Icon.ViewBoundScale); m_oLayer = new ImageLayer( m_oGroundOverlay.Name, drawArgs.CurrentWorld, m_oGroundOverlay.Altitude, m_strImageFilename, oRenderBox.South, oRenderBox.North, oRenderBox.West, oRenderBox.East, (byte)(m_oGroundOverlay.Color.A * ((double)m_opacity / (double)(byte.MaxValue))), drawArgs.CurrentWorld.TerrainAccessor); if (m_oGroundOverlay.Icon.IsLocalFile) { m_oLayer.ImagePath = Path.Combine(m_strKMLDirectory, m_oGroundOverlay.Icon.HRef); } else { m_oLayer.ImageUrl = m_oGroundOverlay.Icon.GetUri(oRenderBox.West, oRenderBox.South, oRenderBox.East, oRenderBox.North); } m_oLayer.Initialize(drawArgs); m_oLayerAoI = drawArgs.CurrentRoI.Clone() as GeographicBoundingBox; } } m_oLayer.Update(drawArgs); } } }
public void RefreshControl(bool randomData = false) { _mapLayer.Update(new Rectangle(0, 0, Width, Height)); if (randomData) { _netLayer.ReloadData(); } else { _netLayer.Update(new Rectangle(0, 0, Width, Height)); } _imageLayer.Update(new Rectangle(0, 0, Width, Height)); }