Skip to content

Commit

Permalink
usgs toolbox dotspatial migration updates
Browse files Browse the repository at this point in the history
-enable timeseries statistics in dotspatial
-template for statusmonitor
-additional demo ui components
  • Loading branch information
TongZhai committed Nov 14, 2019
1 parent 372eb03 commit 7b113b6
Show file tree
Hide file tree
Showing 15 changed files with 427 additions and 5 deletions.
28 changes: 28 additions & 0 deletions BASINSDS.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions BASINSDS/BASINSDS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="clsPluginProperties.cs" />
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
Expand Down
7 changes: 4 additions & 3 deletions BASINSDS/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions BASINSDS/MainForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,19 @@
AAAAMFN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLlN0cmluZwMAAAAGX2l0
ZW1zBV9zaXplCF92ZXJzaW9uBgAACAgCAAAACQMAAAACAAAAAgAAABEDAAAABAAAAAYEAAAAFkFwcGxp
Y2F0aW9uIEV4dGVuc2lvbnMGBQAAAAdQbHVnaW5zDQIL
</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAFBQQAAEABACoAQAAFgAAACgAAAAUAAAAKAAAAAEABAAAAAAAAAAAAEcAAABHAAAAEAAAAAAA
AAAzZgAAZmYAAGaZMwCZmTMAzMyZAMDAwABmmQAAmcyZAJmZmQCZmWYAzJmZAGaZZgCZzGYA/8zMAAAA
AAAAAAAAARARARARERAQEAAAEQEQEBEBAQEBEQAAARARAQEBEBEQEAAAEBEBEBERARAjIQAAARARARAQ
ECRVVQAAEQEQEQEBEjERJQAAVhARARAQN1SCEAAAVZEBEBEZo7dVkQAAFFQRAQEiIhEVVAAAEJVZM5VV
VVIRJQAAgRFFV0YRA1XBEQAAVSEQJIVZEBhVIQAANV1VWTJFUxAlWQAAATIyEBAWVXERdQAAQjeQEQEQ
GVUhEgAAVcEBEBEBECVXEQAAARARARARARCVUgAAEQEAEAEAEAECVQAAARERERERERERGAAAEBAQEBAQ
EBAQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
</value>
</data>
</root>
97 changes: 97 additions & 0 deletions BASINSDS/USGS/USGSPlugin.cs
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
39 changes: 39 additions & 0 deletions BASINSDS/USGS/frmTest.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions BASINSDS/USGS/frmTest.cs
Original file line number Diff line number Diff line change
@@ -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();
}
}
}
16 changes: 16 additions & 0 deletions BASINSDS/clsPluginProperties.cs
Original file line number Diff line number Diff line change
@@ -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
}
}
Loading

0 comments on commit 7b113b6

Please sign in to comment.