/// <summary> /// Stops the animation playback. /// </summary> public void StopAnimation() { if(this.animationState==AnimationState.Pending) return; if(this.currentlyAnimatingNode != null) this.currentlyAnimatingNode.ForeColor = this.treeViewLayers.ForeColor; this.currentlyAnimatingNode = null; this.animationState = AnimationState.Pending; this.animationTimer.Enabled = false; StopDownloadThread(); updateCurrentProgressBar(0,1); lock(this.downloadQueue.SyncRoot) this.downloadQueue.Clear(); this.downloadState = DownloadState.Pending; lock(this.animationFrames.SyncRoot) this.animationFrames.Clear(); this.currentAnimationFrame = 0; if(this.imageLayer != null) { this.worldWindow.CurrentWorld.RenderableObjects.Remove(this.imageLayer.Name); this.imageLayer.Dispose(); this.imageLayer = null; } this.worldWindow.Caption = ""; UpdateProgressBarFrame(0,1); this.buttonPlay.ImageIndex = 4; this.CurrentFrameInterval = startFrameInterval; this.buttonColorBar.Enabled = false; if(this.colorbar != null) { this.colorbar.Visible = false; this.colorbar.Dispose(); this.colorbar = null; } SetCaption( "" ); updateStatusBar("Stopped."); }
/// <summary> /// Fired when the legend display button is clicked. /// </summary> private void buttonColorBar_Click(object sender, System.EventArgs e) { if(this.currentlyAnimatingNode==null || this.currentlyAnimatingNode.Tag == null) return; if(colorbar == null) { colorbar = new Colorbar(this); } if(this.colorbar.Visible) { this.colorbar.Visible = false; return; } WMSLayer layer = (WMSLayer)this.currentlyAnimatingNode.Tag; if(layer.LegendUrl != null) colorbar.LoadImage(layer.LegendUrl); colorbar.Show(); }
/// <summary> /// Called when user chooses to display legendControl /// </summary> protected virtual void OnLegendClick( object sender, EventArgs e ) { if(legendControl == null) legendControl = new Colorbar(null); legendControl.LoadImage( m_legendImagePath ); }
/// <summary> /// Cleanup when layer is disabled /// </summary> public override void Dispose() { this.isInitialized = false; if(downloadThread != null) { if(downloadThread.IsAlive) { downloadThread.Abort(); } downloadThread = null; } if(m_SurfaceImage != null) { m_ParentWorld.WorldSurfaceRenderer.RemoveSurfaceImage(m_SurfaceImage.ImageFilePath); m_SurfaceImage = null; } if (this.texture!=null) { this.texture.Dispose(); this.texture = null; } if(legendControl != null) { legendControl.Dispose(); legendControl = null; } if(refreshTimer != null && refreshTimer.Enabled) { refreshTimer.Stop(); refreshTimer = null; } }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } if(colorbar != null) { colorbar.Dispose(); colorbar = null; } StopDownloadThread(); base.Dispose( disposing ); }
public void Reset() { lock(this.downloadQueue.SyncRoot) this.downloadQueue.Clear(); StopDownloadThread(); this.animationTimer.Stop(); lock(this.animationFrames.SyncRoot) { this.animationFrames.Clear(); } if(this.imageLayer != null) { this.worldWindow.CurrentWorld.RenderableObjects.Remove(this.imageLayer.Name); this.worldWindow.Invalidate(); this.imageLayer.Dispose(); this.imageLayer = null; } UpdateStatusBar( "" ); if(this.colorbar != null) { this.colorbar.Visible = false; this.colorbar.Dispose(); this.colorbar = null; } bool isAnim = false; MyWMSLayer curLayer = this.getCurrentlySelectedWMSLayer(); if(curLayer != null) { if(curLayer.Width != 0 || curLayer.Height != 0) this.groupBoxExtents.Enabled = false; else this.groupBoxExtents.Enabled = true; isAnim = curLayer.Dates != null; } foreach(Control cntrl in this.tabPageAnimation.Controls) cntrl.Enabled = isAnim; this.animationState = AnimationState.Stop; this.buttonPlay.ImageIndex = 4; this.worldWindow.Caption = ""; }
private void getColorbar(string url) { if(colorbar == null) { this.colorbar = new Colorbar(this); this.colorbar.Text = "Legend"; } this.colorbar.LoadImage(url); }