diff --git a/BASINSDS.sln b/BASINSDS.sln index 3732f1764..5fec12eab 100644 --- a/BASINSDS.sln +++ b/BASINSDS.sln @@ -37,6 +37,10 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "atcUSGSUtility-DS", "atcUSG EndProject Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "atcUSGSDF2P-DS", "atcUSGSDF2P\atcUSGSDF2P-DS.vbproj", "{4CDFEB5C-1808-44AD-9206-0049FF26FA2E}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "USGS.Plugins", "USGS.Plugins.Trial\USGS.Plugins.csproj", "{D7926BE4-E79B-4263-AF3B-351DEB860174}" +EndProject +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "atcTimeseriesStatistics-DS", "atcTimeseriesStatistics\atcTimeseriesStatistics-DS.vbproj", "{7E40E3E6-BF8E-45B5-99AF-4E11DAF039FD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -251,6 +255,30 @@ Global {4CDFEB5C-1808-44AD-9206-0049FF26FA2E}.Release|x64.Build.0 = Release|Any CPU {4CDFEB5C-1808-44AD-9206-0049FF26FA2E}.Release|x86.ActiveCfg = Release|x86 {4CDFEB5C-1808-44AD-9206-0049FF26FA2E}.Release|x86.Build.0 = Release|x86 + {D7926BE4-E79B-4263-AF3B-351DEB860174}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D7926BE4-E79B-4263-AF3B-351DEB860174}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D7926BE4-E79B-4263-AF3B-351DEB860174}.Debug|x64.ActiveCfg = Debug|Any CPU + {D7926BE4-E79B-4263-AF3B-351DEB860174}.Debug|x64.Build.0 = Debug|Any CPU + {D7926BE4-E79B-4263-AF3B-351DEB860174}.Debug|x86.ActiveCfg = Debug|Any CPU + {D7926BE4-E79B-4263-AF3B-351DEB860174}.Debug|x86.Build.0 = Debug|Any CPU + {D7926BE4-E79B-4263-AF3B-351DEB860174}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D7926BE4-E79B-4263-AF3B-351DEB860174}.Release|Any CPU.Build.0 = Release|Any CPU + {D7926BE4-E79B-4263-AF3B-351DEB860174}.Release|x64.ActiveCfg = Release|Any CPU + {D7926BE4-E79B-4263-AF3B-351DEB860174}.Release|x64.Build.0 = Release|Any CPU + {D7926BE4-E79B-4263-AF3B-351DEB860174}.Release|x86.ActiveCfg = Release|Any CPU + {D7926BE4-E79B-4263-AF3B-351DEB860174}.Release|x86.Build.0 = Release|Any CPU + {7E40E3E6-BF8E-45B5-99AF-4E11DAF039FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7E40E3E6-BF8E-45B5-99AF-4E11DAF039FD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7E40E3E6-BF8E-45B5-99AF-4E11DAF039FD}.Debug|x64.ActiveCfg = Debug|Any CPU + {7E40E3E6-BF8E-45B5-99AF-4E11DAF039FD}.Debug|x64.Build.0 = Debug|Any CPU + {7E40E3E6-BF8E-45B5-99AF-4E11DAF039FD}.Debug|x86.ActiveCfg = Debug|x86 + {7E40E3E6-BF8E-45B5-99AF-4E11DAF039FD}.Debug|x86.Build.0 = Debug|x86 + {7E40E3E6-BF8E-45B5-99AF-4E11DAF039FD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7E40E3E6-BF8E-45B5-99AF-4E11DAF039FD}.Release|Any CPU.Build.0 = Release|Any CPU + {7E40E3E6-BF8E-45B5-99AF-4E11DAF039FD}.Release|x64.ActiveCfg = Release|Any CPU + {7E40E3E6-BF8E-45B5-99AF-4E11DAF039FD}.Release|x64.Build.0 = Release|Any CPU + {7E40E3E6-BF8E-45B5-99AF-4E11DAF039FD}.Release|x86.ActiveCfg = Release|x86 + {7E40E3E6-BF8E-45B5-99AF-4E11DAF039FD}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/BASINSDS/BASINSDS.csproj b/BASINSDS/BASINSDS.csproj index 8e0a89b7c..0c45476f9 100644 --- a/BASINSDS/BASINSDS.csproj +++ b/BASINSDS/BASINSDS.csproj @@ -76,6 +76,7 @@ + Form diff --git a/BASINSDS/MainForm.Designer.cs b/BASINSDS/MainForm.Designer.cs index 88f1247c3..1f580cd15 100644 --- a/BASINSDS/MainForm.Designer.cs +++ b/BASINSDS/MainForm.Designer.cs @@ -41,13 +41,14 @@ private void InitializeComponent() this.appManager.Map = null; this.appManager.ProgressHandler = null; // - // Form1 + // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(800, 450); - this.Name = "Form1"; - this.Text = "Form1"; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Name = "MainForm"; + this.Text = "Hydrologic Toolbox"; this.ResumeLayout(false); } diff --git a/BASINSDS/MainForm.resx b/BASINSDS/MainForm.resx index be54552bd..1405ec3e0 100644 --- a/BASINSDS/MainForm.resx +++ b/BASINSDS/MainForm.resx @@ -128,6 +128,19 @@ AAAAMFN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLlN0cmluZwMAAAAGX2l0 ZW1zBV9zaXplCF92ZXJzaW9uBgAACAgCAAAACQMAAAACAAAAAgAAABEDAAAABAAAAAYEAAAAFkFwcGxp Y2F0aW9uIEV4dGVuc2lvbnMGBQAAAAdQbHVnaW5zDQIL + + + + + + AAABAAEAFBQQAAEABACoAQAAFgAAACgAAAAUAAAAKAAAAAEABAAAAAAAAAAAAEcAAABHAAAAEAAAAAAA + AAAzZgAAZmYAAGaZMwCZmTMAzMyZAMDAwABmmQAAmcyZAJmZmQCZmWYAzJmZAGaZZgCZzGYA/8zMAAAA + AAAAAAAAARARARARERAQEAAAEQEQEBEBAQEBEQAAARARAQEBEBEQEAAAEBEBEBERARAjIQAAARARARAQ + ECRVVQAAEQEQEQEBEjERJQAAVhARARAQN1SCEAAAVZEBEBEZo7dVkQAAFFQRAQEiIhEVVAAAEJVZM5VV + VVIRJQAAgRFFV0YRA1XBEQAAVSEQJIVZEBhVIQAANV1VWTJFUxAlWQAAATIyEBAWVXERdQAAQjeQEQEQ + GVUhEgAAVcEBEBEBECVXEQAAARARARARARCVUgAAEQEAEAEAEAECVQAAARERERERERERGAAAEBAQEBAQ + EBAQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= \ No newline at end of file diff --git a/BASINSDS/USGS/USGSPlugin.cs b/BASINSDS/USGS/USGSPlugin.cs new file mode 100644 index 000000000..2443dd0a6 --- /dev/null +++ b/BASINSDS/USGS/USGSPlugin.cs @@ -0,0 +1,97 @@ +using System; +using System.Windows.Forms; +using DotSpatial.Controls; +using DotSpatial.Controls.Docking; +using DotSpatial.Controls.Header; + +namespace HydrologicToolbox.USGS +{ + public class USGSPlugin : Extension + { + private const string UniqueKeyPluginStoredValueDate = "UniqueKey-PluginStoredValueDate"; + private const string AboutPanelKey = "kUSGS"; + private DateTime _storedValue; + + public override void Activate() + { + // add some menu items... + AddMenuItems(App.HeaderControl); + + // code for saving plugin settings... + App.SerializationManager.Serializing += ManagerSerializing; + App.SerializationManager.Deserializing += ManagerDeserializing; + + //AddDockingPane(); + + base.Activate(); + } + + public override void Deactivate() + { + // Do not forget to unsubscribe event handlers + App.SerializationManager.Serializing -= ManagerSerializing; + App.SerializationManager.Deserializing -= ManagerDeserializing; + + // Remove all GUI components which were added by plugin + App.DockManager.Remove(AboutPanelKey); + App.HeaderControl.RemoveAll(); + + base.Deactivate(); + } + + private void AddMenuItems(IHeaderControl header) + { + const string SampleMenuKey = "kSample1"; + + // Root menu + header.Add(new RootItem(SampleMenuKey, "USGS")); + + // Add some child menus + header.Add(new SimpleActionItem(SampleMenuKey, "Baseflow", null) { Enabled = true }); + header.Add(new SimpleActionItem(SampleMenuKey, "RECESS", OnMenuClickEventHandler)); + header.Add(new SimpleActionItem(SampleMenuKey, "RORA", OnMenuClickEventHandler)); + + // Add sub menus + header.Add(new MenuContainerItem(SampleMenuKey, "submenu1", "SWSTAT")); + header.Add(new SimpleActionItem(SampleMenuKey, "submenu1", "Integrated Design Flow", OnMenuClickEventHandler)); + header.Add(new SimpleActionItem(SampleMenuKey, "submenu1", "Frequency", OnMenuClickEventHandler)); + } + + private void OnMenuClickEventHandler(object sender, EventArgs e) + { + var act = ((SimpleActionItem) sender).Caption; + //MessageBox.Show("Clicked " + act); + switch (act) + { + case "Alpha": + case "Bravo": + var frmAbout = new frmTest(); + frmAbout.ShowDialog(); + break; + } + } + + private void AddDockingPane() + { + /* + var form = new frmTest(); + form.okButton.Click += (o, args) => App.DockManager.HidePanel(AboutPanelKey); + + var aboutPanel = new DockablePanel(AboutPanelKey, "About", form.tableLayoutPanel, DockStyle.Right); + App.DockManager.Add(aboutPanel); + */ + } + + private void ManagerDeserializing(object sender, SerializingEventArgs e) + { + var manager = (SerializationManager)sender; + _storedValue = manager.GetCustomSetting(UniqueKeyPluginStoredValueDate, DateTime.Now); + } + + private void ManagerSerializing(object sender, SerializingEventArgs e) + { + var manager = (SerializationManager)sender; + manager.SetCustomSetting(UniqueKeyPluginStoredValueDate, _storedValue); + } + } +} diff --git a/BASINSDS/USGS/frmTest.Designer.cs b/BASINSDS/USGS/frmTest.Designer.cs new file mode 100644 index 000000000..32cb07c9a --- /dev/null +++ b/BASINSDS/USGS/frmTest.Designer.cs @@ -0,0 +1,39 @@ +namespace HydrologicToolbox.USGS +{ + partial class frmTest + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Text = "frmTest"; + } + + #endregion + } +} diff --git a/BASINSDS/USGS/frmTest.cs b/BASINSDS/USGS/frmTest.cs new file mode 100644 index 000000000..faa034c07 --- /dev/null +++ b/BASINSDS/USGS/frmTest.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace HydrologicToolbox.USGS +{ + public partial class frmTest : Form + { + public frmTest() + { + InitializeComponent(); + } + } +} diff --git a/BASINSDS/clsPluginProperties.cs b/BASINSDS/clsPluginProperties.cs new file mode 100644 index 000000000..1e29efda9 --- /dev/null +++ b/BASINSDS/clsPluginProperties.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BASINSDS +{ + public class clsPluginProperties + { + public const string g_CacheDir = @"C:\BASINSDS\Cache\"; + public const string g_PathChar = @"\"; + public const string g_AppNameShort = @"Hydro Toolbox"; + //Logger.Icon = g_MapWin.ApplicationInfo.FormIcon + } +} diff --git a/atcTimeseriesStatistics/atcTimeseriesStatistics-DS.vbproj b/atcTimeseriesStatistics/atcTimeseriesStatistics-DS.vbproj new file mode 100644 index 000000000..830e89763 --- /dev/null +++ b/atcTimeseriesStatistics/atcTimeseriesStatistics-DS.vbproj @@ -0,0 +1,150 @@ + + + + Local + 9.0.30729 + 2.0 + {7E40E3E6-BF8E-45B5-99AF-4E11DAF039FD} + Debug + AnyCPU + atcTimeseriesStatistics + None + JScript + Grid + IE50 + false + Library + Binary + On + Off + atcTimeseriesStatistics + atcTimeseriesMath.%2528None%2529 + Windows + + + 3.5 + v4.5.2 + + + + + + ..\bin\Debug\BASINS\ + atcTimeseriesStatistics.xml + 285212672 + true + true + true + false + false + false + false + 1 + 42016,42017,42018,42019,42032,42353,42354,42355 + full + GISProvider="DotSpatial" + false + + + ..\Bin\Plugins\BASINS\ + atcTimeseriesStatistics.xml + 285212672 + false + true + false + true + false + false + false + 1 + 42016,42017,42018,42019,42032,42353,42354,42355 + none + false + + + true + true + true + ..\bin\Debug\BASINS\ + 285212672 + atcTimeseriesStatistics.xml + 1 + 42016,42017,42018,42019,42032,42353,42354,42355 + full + x86 + GISProvider = "DotSpatial" + false + + + true + ..\Bin\Plugins\BASINS\ + 285212672 + atcTimeseriesStatistics.xml + true + 1 + 42016,42017,42018,42019,42032,42353,42354,42355 + x86 + false + + + + ..\bin\Debug\DotSpatial.Controls.dll + False + + + ..\bin\Debug\DotSpatial.Extensions.dll + False + + + System + + + System.Drawing + + + System.Windows.Forms + + + + + + + + + + + + True + Application.myapp + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + + + {b219575f-1541-41db-9fa4-d9d7cd62b4a5} + atcControls-DS + False + + + {a9a00cad-9ead-4228-ab08-6dc3baf253aa} + atcData-DS + False + + + {67027820-9036-481e-80f6-077e5085f59d} + atcUtility-DS + False + + + {3c991ae4-9edb-4c24-baf3-42f7303d7df3} + MapWinUtility-DS + False + + + + \ No newline at end of file diff --git a/atcUSGSBaseflow/atcUSGSBaseflow-DS.vbproj b/atcUSGSBaseflow/atcUSGSBaseflow-DS.vbproj index b001b7b37..5cb83c8c7 100644 --- a/atcUSGSBaseflow/atcUSGSBaseflow-DS.vbproj +++ b/atcUSGSBaseflow/atcUSGSBaseflow-DS.vbproj @@ -274,6 +274,10 @@ {82530a5b-ff39-4b9f-8a04-881468dfc662} atcTimeseriesRDB-DS + + {7e40e3e6-bf8e-45b5-99af-4e11daf039fd} + atcTimeseriesStatistics-DS + {4cdfeb5c-1808-44ad-9206-0049ff26fa2e} atcUSGSDF2P-DS @@ -286,6 +290,10 @@ {67027820-9036-481e-80f6-077e5085f59d} atcUtility-DS + + {6c957998-836e-4355-bf12-906a034ff609} + BASINSDS + {3c991ae4-9edb-4c24-baf3-42f7303d7df3} MapWinUtility-DS diff --git a/atcUSGSBaseflow/clsUSGSBaseflowPlugin.vb b/atcUSGSBaseflow/clsUSGSBaseflowPlugin.vb index 8515a3a46..c4d905d0b 100644 --- a/atcUSGSBaseflow/clsUSGSBaseflowPlugin.vb +++ b/atcUSGSBaseflow/clsUSGSBaseflowPlugin.vb @@ -5,12 +5,14 @@ Imports MapWinUtility Imports System.Drawing #If GISProvider = "DotSpatial" Then Imports DotSpatial.Controls.Header +Imports BASINSDS #End If Public Class clsUSGSBaseflowPlugin Inherits atcData.atcDataDisplay Private pRequiredHelperPlugin As String = "Timeseries::Meteorologic Generation" 'atcMetCmp + Private pStatusMonitor As MonitorProgressStatus Public Overrides ReadOnly Property Name() As String Get @@ -226,10 +228,42 @@ Public Class clsUSGSBaseflowPlugin If frmInteractive Is Nothing Or frmInteractive.IsDisposed Then frmInteractive = New frmUSGSBaseflow() End If + If atcDataManager.DataSources Is Nothing Then + atcDataManager.Clear() + End If + Dim att = New atcDataAttributes() + atcTimeseriesStatistics.atcTimeseriesStatistics.InitializeShared() + If atcDataManager.GetPlugins(GetType(atcTimeseriesRDB.atcTimeseriesRDB)).Count = 0 Then + Dim lRDB = New atcTimeseriesRDB.atcTimeseriesRDB() + atcDataManager.DataPlugins.Add(lRDB) + End If frmInteractive.WindowState = System.Windows.Forms.FormWindowState.Normal frmInteractive.InitializeDS(Me) frmInteractive.Initialize() 'frmInteractive.Show() End Sub + + Private Sub LoadStatusMonitor() + Logger.StartToFile(clsPluginProperties.g_CacheDir & "log" & g_PathChar _ + & Format(Now, "yyyy-MM-dd") & "at" & Format(Now, "HH-mm") & "-" & clsPluginProperties.g_AppNameShort.Replace(" ", "") & ".log") + 'Logger.Icon = g_MapWin.ApplicationInfo.FormIcon + If Logger.ProgressStatus Is Nothing OrElse Not (TypeOf (Logger.ProgressStatus) Is MonitorProgressStatus) Then + 'Start running status monitor to give better progress and status indication during long-running processes + pStatusMonitor = New MonitorProgressStatus + If pStatusMonitor.StartMonitor(FindFile("Find Status Monitor", "StatusMonitor.exe"), + clsPluginProperties.g_CacheDir & "log" & g_PathChar, + System.Diagnostics.Process.GetCurrentProcess.Id) Then + 'put our status monitor (StatusMonitor.exe) between the Logger and the default MW status monitor + pStatusMonitor.InnerProgressStatus = Logger.ProgressStatus + Logger.ProgressStatus = pStatusMonitor + Logger.Status("LABEL TITLE " & clsPluginProperties.g_AppNameShort & " Status") + Logger.Status("PROGRESS TIME ON") 'Enable time-to-completion estimation + Logger.Status("") + Else + pStatusMonitor.StopMonitor() + pStatusMonitor = Nothing + End If + End If + End Sub #End If End Class diff --git a/atcUSGSBaseflow/frmUSGSBaseflow.vb b/atcUSGSBaseflow/frmUSGSBaseflow.vb index 3d3a536d4..2bd663b9f 100644 --- a/atcUSGSBaseflow/frmUSGSBaseflow.vb +++ b/atcUSGSBaseflow/frmUSGSBaseflow.vb @@ -887,14 +887,18 @@ Public Class frmUSGSBaseflow lTsGraphAll.Add(lTsGroupStock.FindData("Constituent", "FLOW")(0)) End If + Dim lAttribs As New atcDataAttributes() + lAttribs.Add("ShowForm", True) + lAttribs.Add("SaveToFile", IO.Path.Combine(OutputDir, "plot_" & aGraphType & ".png")) + Dim lTsGroupBf As atcTimeseriesGroup = lTsGroupStock.FindData("Constituent", "Baseflow") lTsGraphAll.AddRange(lTsGroupBf) If aGraphType = "Timeseries" Then - DisplayTsGraph(lTsGraphAll) + DisplayTsGraph(lTsGraphAll, lAttribs) ElseIf aGraphType = "Duration" Then Dim lTsGroupRO As atcTimeseriesGroup = lTsGroupStock.FindData("Constituent", "Runoff") lTsGraphAll.AddRange(lTsGroupRO) - DisplayDurGraph(lTsGraphAll, aPerUnitArea) + DisplayDurGraph(lTsGraphAll, aPerUnitArea, lAttribs) ElseIf aGraphType = "CDist" Then Dim lTsGroupRO As atcTimeseriesGroup = lTsGroupStock.FindData("Constituent", "Runoff") lTsGraphAll.AddRange(lTsGroupRO) diff --git a/atcUSGSBaseflow/modBaseflowUtil.vb b/atcUSGSBaseflow/modBaseflowUtil.vb index 18c1a4862..8e512a3e2 100644 --- a/atcUSGSBaseflow/modBaseflowUtil.vb +++ b/atcUSGSBaseflow/modBaseflowUtil.vb @@ -3062,6 +3062,13 @@ Public Module modBaseflowUtil 'Make sure graph can't find provisional attribute #If GISProvider = "DotSpatial" Then 'need all values + Dim lDataMin As Double = Double.MaxValue + Dim lDataMax As Double = Double.MinValue + For Each lTs As atcTimeseries In aDataGroup + lTs.Attributes.SetValue("ProvisionalValueAttribute", "X" & lTs.Attributes.GetValue("ProvisionalValueAttribute", "")) + If lTs.Attributes.GetValue("Min") < lDataMin Then lDataMin = lTs.Attributes.GetValue("Min") + If lTs.Attributes.GetValue("Max") > lDataMax Then lDataMax = lTs.Attributes.GetValue("Max") + Next #Else Dim lDataMin As Double = Double.MaxValue Dim lDataMax As Double = Double.MinValue @@ -3109,6 +3116,10 @@ Public Module modBaseflowUtil End If End If #If GISProvider = "DotSpatial" Then + 'Restore provisional attribute after graphing + For Each lTs As atcTimeseries In aDataGroup + lTs.Attributes.SetValue("ProvisionalValueAttribute", lTs.Attributes.GetValue("ProvisionalValueAttribute", "").ToString.Substring(1)) + Next #Else 'Restore provisional attribute after graphing For Each lTs As atcTimeseries In aDataGroup diff --git a/icons/Basins.ico b/icons/Basins.ico new file mode 100644 index 000000000..0fe329245 Binary files /dev/null and b/icons/Basins.ico differ diff --git a/icons/USGS.ico b/icons/USGS.ico new file mode 100644 index 000000000..76bce6431 Binary files /dev/null and b/icons/USGS.ico differ