`^%fgqBz3;E
zypY`VWYg}1goK7Hr>$HfCJm_;pKI;?o2*r3d5-OQQhbGzDPtR#z=0d{_h&}7^PSf8
zb>5gD)M&Ftrs?+EygIQdKZL&Ay+5huW~Qg(^y=;BTJBYZU1$4y=WKYiF?T?MgwEt`
zT`TsR|L}eiBb-#bV0KB@XNO?X7m|OEe!um$R*<1vcj3z0E6+0PZcey)bXUf@iL7he
zsyA4hS#t{wI^H6T7(3Ke0lyCJVujWX{t((u~qp@l3TlWoH
zzfI9w__aZNhOnDxgV^fc$14>N2duI-*SXET!S?cG;RSYO0%GFg(Vy;~h>>%(s=VC@S26m4%0k2Q>`~uZ6p00i_
I>zopr0LdSn0ssI2
literal 0
HcmV?d00001
diff --git a/MESH_MAP/Images/AddInDesktop16.png b/MESH_MAP/Images/AddInDesktop16.png
new file mode 100644
index 0000000000000000000000000000000000000000..5910bbf3dcd0cb09139b0c9926e00f96131d4757
GIT binary patch
literal 524
zcmV+n0`vWeP)#SV*!XQdtWo`zW)u3-ITZ)bVS)1Hr@Kl
zz{$$UaP`DN21cm=1AtUN5Gz1JiI2g=(Ssq}!4R(tz+M1pW@cqxuV5w1AS5Nuz{e%d
z@ciLDhV#4Ef^E~*)jrVX(1?VK7tH?T6
zV6mVetE9oe&dLMU{OQ|Eumra#H^Zy{AHiV&j|FE@unXFbz5|BS4@5LRd2^9LP1=Fs
z?(<^|fByc0Yxw-(Jy;XE3zP*}8B8QO7*;|Jc<}h%4F!2wFfb;P
zxhYzAxw&0+>vq3KuWs}H(rta=aCh(dp7Z^j&-d3E1qyPfy+g$3^PX-BvM8b`0+z$sEF<`iyY2Ae<*Q&c8r=f|8OVVw3&**j?e;Ck
zVzCTK2dhb)&pH4-5R^=}QQ41M&;^P5et#gz9sk7zdQ8wtsg|iA)B@4{v}Z_qW$A36
zS|g1a!az2SYcVJTJ5US^%!I)ois|a14(e*jz5%?O4nZ^~0%zAJ4|Px%*Qkl&E^=T>
z6egvpHz0tI--L%3oLe-0T-F58R?EQ6YCCj}{U&QYu6$zv)bbcNKmd3m+_>vfks-#)
zS+k1GxYVTWHEq4Ddpn=;E4vxj;{@RoV>cvH2!lU0R_CwMvf`X*4FLOL@5)Jax6;
z@zjyXMoRSp5m`dtYk{B>43|ldep^vNO<~0$sBgFmzQ8Al#W%p^tOAj@!pP@Q82B&(
z?xq{SRhAgbf_ZT#W>f)e8~?(cDQ3_(ZOVn^KRz(!*X6hUv&46xLfHSK4s)
z{cGSW+o5wJma#18FFSjjaa9}vYo3#w*qX9np;VV%hI1#I$w)f=d;}b3hh_~hDsnr%?w?u=t}mEXYC)KkXZhqyUjxwE
z(wvcdBbC~Wuqt9
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MESH_MAP/LengthReqsBox.xaml.cs b/MESH_MAP/LengthReqsBox.xaml.cs
new file mode 100644
index 0000000..d59cd3a
--- /dev/null
+++ b/MESH_MAP/LengthReqsBox.xaml.cs
@@ -0,0 +1,80 @@
+using ActiproSoftware.Windows.Data;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace MESH_MAP
+{
+ ///
+ /// Interaction logic for LengthReqsBox.xaml
+ ///
+ public partial class LengthReqsBox : UserControl
+ {
+ List<(int, int)> reqsList;
+ int[] hailSizeBoxes = [1, 2, 4, 6, 8, 10, 15, 20, 30, 40, 50, 75, 100];
+
+ public LengthReqsBox()
+ {
+ InitializeComponent();
+
+ reqsList = [(10, 40), (30, 2)];
+
+ foreach ((int hailSize, int length) in reqsList)
+ {
+ lengthReqsListBox.Items.Add(length.ToString() + " Km of at least " + hailSize.ToString() + " mm hail");
+ }
+ }
+
+ private void AddItem(object sender, RoutedEventArgs e)
+ {
+ if (hailSizeComboBox.SelectedIndex == -1) return;
+
+ int hailSize = hailSizeBoxes[hailSizeComboBox.SelectedIndex];
+ int length = lengthBox.GetNum();
+
+ if (length == 0) return;
+
+ reqsList.Add((hailSize, length));
+ reqsList.Sort();
+
+ lengthReqsListBox.Items.Clear();
+
+ foreach ((int hs, int l) in reqsList)
+ {
+ lengthReqsListBox.Items.Add(l.ToString() + " Km of at least " + hs.ToString() + " mm hail");
+ }
+
+ lengthReqsListBox.SelectedIndex = -1;
+ }
+
+ private void DeleteItem(object sender, RoutedEventArgs e)
+ {
+ if (lengthReqsListBox.SelectedIndex == -1) return;
+
+ reqsList.RemoveAt(lengthReqsListBox.SelectedIndex);
+ lengthReqsListBox.Items.RemoveAt(lengthReqsListBox.SelectedIndex);
+
+ }
+
+ public List<(int, int)> GetReqs()
+ {
+ return reqsList;
+ }
+
+ public bool IsEmpty()
+ {
+ return reqsList.Count == 0;
+ }
+ }
+}
diff --git a/MESH_MAP/MESH_MAP.csproj b/MESH_MAP/MESH_MAP.csproj
new file mode 100644
index 0000000..da60b01
--- /dev/null
+++ b/MESH_MAP/MESH_MAP.csproj
@@ -0,0 +1,102 @@
+
+
+ net8.0-windows
+ true
+ win-x64
+ false
+ true
+ CA1416
+ True
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ C:\Program Files\ArcGIS\Pro\bin\ArcGIS.Desktop.Framework.dll
+ False
+ False
+
+
+ C:\Program Files\ArcGIS\Pro\bin\ArcGIS.Core.dll
+ False
+ False
+
+
+ C:\Program Files\ArcGIS\Pro\bin\Extensions\Core\ArcGIS.Desktop.Core.dll
+ False
+ False
+
+
+ C:\Program Files\ArcGIS\Pro\bin\Extensions\Mapping\ArcGIS.Desktop.Mapping.dll
+ False
+ False
+
+
+ C:\Program Files\ArcGIS\Pro\bin\Extensions\Catalog\ArcGIS.Desktop.Catalog.dll
+ False
+ False
+
+
+ C:\Program Files\ArcGIS\Pro\bin\Extensions\Editing\ArcGIS.Desktop.Editing.dll
+ False
+ False
+
+
+ C:\Program Files\ArcGIS\Pro\bin\Extensions\DesktopExtensions\ArcGIS.Desktop.Extensions.dll
+ False
+ False
+
+
+ C:\Program Files\ArcGIS\Pro\bin\Extensions\GeoProcessing\ArcGIS.Desktop.GeoProcessing.dll
+ False
+ False
+
+
+ C:\Program Files\ArcGIS\Pro\bin\Extensions\Layout\ArcGIS.Desktop.Layouts.dll
+ False
+ False
+
+
+ C:\Program Files\ArcGIS\Pro\bin\Extensions\KnowledgeGraph\ArcGIS.Desktop.KnowledgeGraph.dll
+ False
+ False
+
+
+ C:\Program Files\ArcGIS\Pro\bin\ArcGIS.Desktop.Shared.Wpf.dll
+ False
+ False
+
+
+ C:\Program Files\ArcGIS\Pro\bin\ArcGIS.Desktop.Ribbon.Wpf.dll
+ False
+ False
+
+
+ C:\Program Files\ArcGIS\Pro\bin\ArcGIS.Desktop.DataGrid.Contrib.Wpf.dll
+ False
+ False
+
+
+ C:\Program Files\ArcGIS\Pro\bin\ArcGIS.Desktop.Resources.dll
+ False
+ False
+
+
+ C:\Program Files\ArcGIS\Pro\bin\ESRI.ArcGIS.ItemIndex.dll
+ False
+ False
+
+
+
+
diff --git a/MESH_MAP/MESH_MAP.csproj.user b/MESH_MAP/MESH_MAP.csproj.user
new file mode 100644
index 0000000..db40920
--- /dev/null
+++ b/MESH_MAP/MESH_MAP.csproj.user
@@ -0,0 +1,32 @@
+
+
+
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+
\ No newline at end of file
diff --git a/MESH_MAP/MESH_MAP.sln b/MESH_MAP/MESH_MAP.sln
new file mode 100644
index 0000000..b7faa4a
--- /dev/null
+++ b/MESH_MAP/MESH_MAP.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.9.34728.123
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MESH_MAP", "MESH_MAP.csproj", "{0DE63514-EB3B-457C-8F5C-D9EE48C9BF5C}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {0DE63514-EB3B-457C-8F5C-D9EE48C9BF5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0DE63514-EB3B-457C-8F5C-D9EE48C9BF5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0DE63514-EB3B-457C-8F5C-D9EE48C9BF5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0DE63514-EB3B-457C-8F5C-D9EE48C9BF5C}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {B584FCC8-7096-47C4-AEE4-5FD56A4D0C9A}
+ EndGlobalSection
+EndGlobal
diff --git a/MESH_MAP/Main.xaml b/MESH_MAP/Main.xaml
new file mode 100644
index 0000000..e2af231
--- /dev/null
+++ b/MESH_MAP/Main.xaml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MESH_MAP/Main.xaml.cs b/MESH_MAP/Main.xaml.cs
new file mode 100644
index 0000000..bdfed87
--- /dev/null
+++ b/MESH_MAP/Main.xaml.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace MESH_MAP
+{
+
+ public partial class Main : ArcGIS.Desktop.Framework.Controls.ProWindow
+ {
+ public Main()
+ {
+ InitializeComponent();
+ }
+
+ private void Run(object sender, RoutedEventArgs e)
+ {
+ if (MissingInput()) return;
+
+ var lengthReqs = lengthReqsBox.GetReqs();
+ var scans = scansListBox.GetSelectedLayers();
+ var artifact_raster = artifactSelectionBox.GetSelectedLayer();
+
+
+ // TODO: Add code here to run MESH_MAP
+
+
+ }
+
+ private bool MissingInput()
+ {
+ if (scansListBox.IsEmpty())
+ {
+ MessageBox.Show("Please select at least one scan");
+ return true;
+ }
+
+ if (lengthReqsBox.IsEmpty())
+ {
+ MessageBox.Show("Please add at least one length requirement.");
+ return true;
+ }
+
+ return false;
+ }
+ }
+}
diff --git a/MESH_MAP/Mesh_Analysis.cs b/MESH_MAP/Mesh_Analysis.cs
new file mode 100644
index 0000000..1ad2dae
--- /dev/null
+++ b/MESH_MAP/Mesh_Analysis.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ArcGIS.Desktop.Mapping;
+
+namespace MESH_MAP
+{
+ static class Mesh_Analysis
+ {
+ public static void RunAnalysis(List imageLayers, FeatureLayer artifactLayer, List<(int, int)> reqsList)
+ {
+
+ }
+ }
+}
diff --git a/MESH_MAP/Module1.cs b/MESH_MAP/Module1.cs
new file mode 100644
index 0000000..68fc228
--- /dev/null
+++ b/MESH_MAP/Module1.cs
@@ -0,0 +1,48 @@
+using ArcGIS.Core.CIM;
+using ArcGIS.Core.Data;
+using ArcGIS.Core.Geometry;
+using ArcGIS.Desktop.Catalog;
+using ArcGIS.Desktop.Core;
+using ArcGIS.Desktop.Editing;
+using ArcGIS.Desktop.Extensions;
+using ArcGIS.Desktop.Framework;
+using ArcGIS.Desktop.Framework.Contracts;
+using ArcGIS.Desktop.Framework.Dialogs;
+using ArcGIS.Desktop.Framework.Threading.Tasks;
+using ArcGIS.Desktop.KnowledgeGraph;
+using ArcGIS.Desktop.Layouts;
+using ArcGIS.Desktop.Mapping;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Input;
+
+namespace MESH_MAP
+{
+ internal class Module1 : Module
+ {
+ private static Module1 _this = null;
+
+ ///
+ /// Retrieve the singleton instance to this module here
+ ///
+ public static Module1 Current => _this ??= (Module1)FrameworkApplication.FindModule("MESH_MAP_Module");
+
+ #region Overrides
+ ///
+ /// Called by Framework when ArcGIS Pro is closing
+ ///
+ /// False to prevent Pro from closing, otherwise True
+ protected override bool CanUnload()
+ {
+ //TODO - add your business logic
+ //return false to ~cancel~ Application close
+ return true;
+ }
+
+ #endregion Overrides
+
+ }
+}
diff --git a/MESH_MAP/Properties/launchSettings.json b/MESH_MAP/Properties/launchSettings.json
new file mode 100644
index 0000000..ecf87d9
--- /dev/null
+++ b/MESH_MAP/Properties/launchSettings.json
@@ -0,0 +1,8 @@
+{
+ "profiles": {
+ "MESH_MAP": {
+ "commandName": "Executable",
+ "executablePath": "C:\\Program Files\\ArcGIS\\Pro\\bin\\ArcGISPro.exe"
+ }
+ }
+}
\ No newline at end of file
diff --git a/MESH_MAP/RasterSelectionBox.xaml b/MESH_MAP/RasterSelectionBox.xaml
new file mode 100644
index 0000000..95b0296
--- /dev/null
+++ b/MESH_MAP/RasterSelectionBox.xaml
@@ -0,0 +1,11 @@
+
+
+
+
+
diff --git a/MESH_MAP/RasterSelectionBox.xaml.cs b/MESH_MAP/RasterSelectionBox.xaml.cs
new file mode 100644
index 0000000..9036b0a
--- /dev/null
+++ b/MESH_MAP/RasterSelectionBox.xaml.cs
@@ -0,0 +1,101 @@
+using ArcGIS.Desktop.Framework.Threading.Tasks;
+using ArcGIS.Desktop.Mapping;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace MESH_MAP
+{
+ ///
+ /// Interaction logic for RasterSelectionBox.xaml
+ ///
+ public partial class RasterSelectionBox : UserControl
+ {
+
+ private System.Collections.Generic.IEnumerable fLayers;
+
+ public RasterSelectionBox()
+ {
+ InitializeComponent();
+
+ //get current map
+ var map = MapView.Active.Map;
+
+ //get all raster layers on map
+ fLayers = map.GetLayersAsFlattenedList().OfType();
+
+ //add raster names to windows selection box
+ foreach (var layer in fLayers)
+ {
+ selectionBox.Items.Add(layer.Name);
+ }
+ }
+
+ public FeatureLayer GetSelectedLayer()
+ {
+ if (selectionBox.SelectedItem == null) return null;
+
+ string name = (string)selectionBox.SelectedItem;
+
+ FeatureLayer selectedVector = null;
+
+ foreach (var layer in fLayers)
+ {
+ if (layer.Name.Equals(name))
+ {
+ selectedVector = layer;
+ }
+ }
+
+ return selectedVector;
+ }
+
+
+ public async Task<(string, double[])> GetSelectedLayerData()
+ {
+ var layer = GetSelectedLayer();
+
+ if (layer == null) return (null, null);
+
+ string path = null;
+ double[] extent = null;
+
+ await QueuedTask.Run(() =>
+ {
+ path = layer.GetPath().ToString();
+
+ if (path.Substring(0, 8).Equals(@"file:///"))
+ {
+ path = path.Substring(8);
+ }
+
+ path = path.Replace("%20", " ");
+
+ try
+ {
+ if (layer == null || layer.GetFeatureClass() == null) return;
+
+ var geoExtent = layer.GetFeatureClass().GetExtent();
+ extent = [geoExtent.XMin, geoExtent.YMax, geoExtent.XMax, geoExtent.YMin];
+ }
+ catch (Exception _) { }
+
+ });
+
+ return (path, extent);
+ }
+
+ }
+}
diff --git a/MESH_MAP/RasterSelectionList.xaml b/MESH_MAP/RasterSelectionList.xaml
new file mode 100644
index 0000000..3f19a9e
--- /dev/null
+++ b/MESH_MAP/RasterSelectionList.xaml
@@ -0,0 +1,12 @@
+
+
+
+
+
diff --git a/MESH_MAP/RasterSelectionList.xaml.cs b/MESH_MAP/RasterSelectionList.xaml.cs
new file mode 100644
index 0000000..6aab373
--- /dev/null
+++ b/MESH_MAP/RasterSelectionList.xaml.cs
@@ -0,0 +1,66 @@
+using ArcGIS.Desktop.Mapping;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace MESH_MAP
+{
+ ///
+ /// Interaction logic for RasterSelectionList.xaml
+ ///
+ public partial class RasterSelectionList : UserControl
+ {
+ private IEnumerable rLayers;
+
+ public RasterSelectionList()
+ {
+ InitializeComponent();
+
+ //get current map
+ var map = MapView.Active.Map;
+
+ //get all raster layers on map
+ rLayers = map.GetLayersAsFlattenedList().OfType();
+
+ foreach (var layer in rLayers)
+ {
+ listBox.Items.Add(layer.Name);
+ }
+ }
+
+ public List GetSelectedLayers()
+ {
+
+ List selectedRasters = new List();
+
+ foreach (string name in listBox.SelectedItems)
+ {
+ foreach (var raster in rLayers)
+ {
+ if (raster.Name.Equals(name))
+ {
+ selectedRasters.Add(raster);
+ }
+ }
+ }
+
+ return selectedRasters;
+ }
+
+ public bool IsEmpty()
+ {
+ return listBox.Items.Count == 0;
+ }
+ }
+}
diff --git a/MESH_MAP/ShowMain.cs b/MESH_MAP/ShowMain.cs
new file mode 100644
index 0000000..094c2b5
--- /dev/null
+++ b/MESH_MAP/ShowMain.cs
@@ -0,0 +1,42 @@
+using ArcGIS.Core.CIM;
+using ArcGIS.Core.Data;
+using ArcGIS.Core.Geometry;
+using ArcGIS.Desktop.Catalog;
+using ArcGIS.Desktop.Core;
+using ArcGIS.Desktop.Editing;
+using ArcGIS.Desktop.Extensions;
+using ArcGIS.Desktop.Framework;
+using ArcGIS.Desktop.Framework.Contracts;
+using ArcGIS.Desktop.Framework.Dialogs;
+using ArcGIS.Desktop.Framework.Threading.Tasks;
+using ArcGIS.Desktop.KnowledgeGraph;
+using ArcGIS.Desktop.Layouts;
+using ArcGIS.Desktop.Mapping;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MESH_MAP
+{
+ internal class ShowMain : Button
+ {
+
+ private Main _main = null;
+
+ protected override void OnClick()
+ {
+ //already open?
+ if (_main != null)
+ return;
+ _main = new Main();
+ _main.Owner = FrameworkApplication.Current.MainWindow;
+ _main.Closed += (o, e) => { _main = null; };
+ _main.Show();
+ //uncomment for modal
+ //_main.ShowDialog();
+ }
+
+ }
+}
diff --git a/MESH_MAP/Utils.cs b/MESH_MAP/Utils.cs
new file mode 100644
index 0000000..82dc029
--- /dev/null
+++ b/MESH_MAP/Utils.cs
@@ -0,0 +1,199 @@
+using ArcGIS.Core.CIM;
+using ArcGIS.Desktop.Framework.Threading.Tasks;
+using ArcGIS.Desktop.Mapping;
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Security.RightsManagement;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Input;
+
+namespace MESH_MAP
+{
+ static class Utils
+ {
+
+ public static string AddinAssemblyLocation()
+ {
+ var asm = System.Reflection.Assembly.GetExecutingAssembly();
+
+ return System.IO.Path.GetDirectoryName(Uri.UnescapeDataString(new Uri(asm.Location).LocalPath));
+ }
+
+ public static (List, List, List, List) GetRasterData(List rLayers)
+ {
+ var filePaths = new List();
+ var coords = new List();
+ var scales = new List();
+ var sizes = new List();
+ //add the image file path and top left corner of each selected raster to cmd command
+ foreach (var raster in rLayers)
+ {
+ string fullSpec = string.Empty;
+ CIMDataConnection dataConnection = raster.GetDataConnection();
+ if (dataConnection is CIMStandardDataConnection)
+ {
+ CIMStandardDataConnection dataSConnection = dataConnection as CIMStandardDataConnection;
+
+ string sConnection = dataSConnection.WorkspaceConnectionString;
+
+ var wFactory = dataSConnection.WorkspaceFactory;
+ if (wFactory == WorkspaceFactory.Raster)
+ {
+ string sWorkspaceName = sConnection.Split('=')[1];
+
+ string sTable = dataSConnection.Dataset;
+
+ fullSpec = System.IO.Path.Combine(sWorkspaceName, sTable);
+ }
+ }
+
+ if (!string.IsNullOrEmpty(fullSpec) && !filePaths.Contains(fullSpec))
+ {
+ filePaths.Add(fullSpec);
+
+ var extend = raster.GetRaster().GetExtent();
+
+ coords.Add(new double[] { extend.XMin, extend.YMax });
+
+ sizes.Add(new double[] { raster.GetRaster().GetWidth(), raster.GetRaster().GetHeight() });
+
+ scales.Add(raster.GetRaster().GetMeanCellSize().Item1);
+
+ }
+ }
+
+ return (filePaths, coords, sizes, scales);
+ }
+
+ public async static void LoadShapeFiles(bool group=false)
+ {
+ var map = MapView.Active.Map;
+
+ //get the newly create shape files containing the lines and polygon regions and add them to the current arcgis project
+ await QueuedTask.Run(() =>
+ {
+ //getting directory paths
+ var pathProject = ArcGIS.Desktop.Core.Project.Current.URI;
+ string shapeFilesPath = System.IO.Path.GetDirectoryName(pathProject) + "\\TreeTagger";
+
+ List subDirectories = new List(System.IO.Directory.GetDirectories(shapeFilesPath));
+ subDirectories.RemoveAll(x => !x.Contains("Results"));
+ subDirectories.Sort();
+ string[] shapeFiles = System.IO.Directory.GetFiles(subDirectories[subDirectories.Count() - 1]);
+
+ List pointShapeFiles = new List();
+ List lineShapeFiles = new List();
+ List polygonShapeFiles = new List();
+
+ //get all not currently displayed shape files
+ try
+ {
+ foreach (var file in shapeFiles)
+ {
+
+ if (file.Contains(".shp") && !file.Contains(".lock") && !file.Contains(".xml"))
+ {
+ if (file.Contains("Point"))
+ {
+ pointShapeFiles.Add(file);
+ }
+ else if (file.Contains("Line") || file.Contains("Vector") || file.Contains("Direction"))
+ {
+ lineShapeFiles.Add(file);
+ }
+ else if (file.Contains("Outline"))
+ {
+ polygonShapeFiles.Add(file);
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ MessageBox.Show(string.Format("Couldn't load Tree Tagger Shape Files from: {0}, {1}", shapeFilesPath, e.Message));
+ return;
+ }
+
+ if (pointShapeFiles.Count == 0 && lineShapeFiles.Count == 0 && polygonShapeFiles.Count == 0)
+ {
+ MessageBox.Show("Couldn't find any shape files created by Tree Tagger");
+ return;
+ }
+
+ //add layers to project
+ try
+ {
+ ILayerContainerEdit groupContainer = group ? LayerFactory.Instance.CreateGroupLayer(map, 0, "TreeTagger") : map;
+
+ var pointSymbol = SymbolFactory.Instance.ConstructPointSymbol(ColorFactory.Instance.WhiteRGB, 5, SimpleMarkerStyle.Circle);
+
+ foreach (var sf in pointShapeFiles)
+ {
+ Uri pointFile = new(sf);
+ var pointLayer = LayerFactory.Instance.CreateLayer(pointFile, groupContainer) as FeatureLayer;
+
+ //Get the layer's current renderer
+ CIMSimpleRenderer renderer = pointLayer.GetRenderer() as CIMSimpleRenderer;
+
+ //Update the symbol of the current simple renderer
+ renderer.Symbol = pointSymbol.MakeSymbolReference();
+
+ //Update the feature layer renderer
+ pointLayer.SetRenderer(renderer);
+
+ }
+
+ //format line and polygon shape files to render correctly
+ var lineSymbol = SymbolFactory.Instance.ConstructLineSymbol(ColorFactory.Instance.RedRGB, 2, SimpleLineStyle.Solid);
+
+ foreach (var sf in lineShapeFiles)
+ {
+ Uri lineFile = new(sf);
+ var linesLayer = LayerFactory.Instance.CreateLayer(lineFile, groupContainer) as FeatureLayer;
+
+ //Get the layer's current renderer
+ CIMSimpleRenderer renderer = linesLayer.GetRenderer() as CIMSimpleRenderer;
+
+ //Update the symbol of the current simple renderer
+ renderer.Symbol = lineSymbol.MakeSymbolReference();
+
+ //Update the feature layer renderer
+ linesLayer.SetRenderer(renderer);
+ }
+
+ var outline = SymbolFactory.Instance.ConstructStroke(ColorFactory.Instance.CreateRGBColor(255, 0, 255, 30), 2.0, SimpleLineStyle.Solid);
+ var fillWithOutline = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.CreateRGBColor(255, 0, 255, 30), SimpleFillStyle.Solid, outline);
+
+ foreach (var sf in polygonShapeFiles)
+ {
+ Uri polyFile = new(sf);
+ var polygonLayer = LayerFactory.Instance.CreateLayer(polyFile, groupContainer) as FeatureLayer;
+
+ //Get the layer's current renderer
+ CIMSimpleRenderer rendererp = polygonLayer.GetRenderer() as CIMSimpleRenderer;
+
+ //Update the symbol of the current simple renderer
+ rendererp.Symbol = fillWithOutline.MakeSymbolReference();
+
+ //Update the feature layer renderer
+ polygonLayer.SetRenderer(rendererp);
+ }
+
+ }
+ catch (Exception e)
+ {
+ MessageBox.Show(string.Format("Couldn't render shape files: {0}", e.Message));
+ return;
+ }
+
+ });
+ }
+
+
+ }
+}
diff --git a/MESH_MAP/WholeNumBox.xaml b/MESH_MAP/WholeNumBox.xaml
new file mode 100644
index 0000000..26e20b9
--- /dev/null
+++ b/MESH_MAP/WholeNumBox.xaml
@@ -0,0 +1,12 @@
+
+
+
+
+
diff --git a/MESH_MAP/WholeNumBox.xaml.cs b/MESH_MAP/WholeNumBox.xaml.cs
new file mode 100644
index 0000000..47b7e05
--- /dev/null
+++ b/MESH_MAP/WholeNumBox.xaml.cs
@@ -0,0 +1,94 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace MESH_MAP
+{
+ ///
+ /// Interaction logic for WholeNumBox.xaml
+ ///
+ public partial class WholeNumBox : UserControl
+ {
+ // Dependency Property for DefaultValue
+ public static readonly DependencyProperty DefaultValueProperty =
+ DependencyProperty.Register("DefaultValue", typeof(int), typeof(WholeNumBox),
+ new PropertyMetadata(0, OnDefaultValueChanged));
+
+ public int DefaultValue
+ {
+ get { return (int)GetValue(DefaultValueProperty); }
+ set { SetValue(DefaultValueProperty, value); }
+ }
+
+ public WholeNumBox()
+ {
+ InitializeComponent();
+
+ // Set the initial value of the TextBox to the DefaultValue
+ textBox.Text = DefaultValue.ToString();
+ }
+
+ private static void OnDefaultValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ var control = (WholeNumBox)d;
+ int newValue = (int)e.NewValue;
+ control.textBox.Text = newValue.ToString();
+ }
+
+ private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
+ {
+ // Use a regular expression to check if the input is a digit
+ e.Handled = !IsTextAllowed(e.Text);
+ }
+
+ private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
+ {
+ // Further ensure only digits are present in the TextBox
+ var textBox = sender as TextBox;
+ if (!Regex.IsMatch(textBox.Text, @"^\d*$"))
+ {
+ textBox.Text = Regex.Replace(textBox.Text, @"[^\d]", "");
+ textBox.CaretIndex = textBox.Text.Length;
+ }
+ }
+
+ private static bool IsTextAllowed(string text)
+ {
+ // Only allow digits
+ return Regex.IsMatch(text, @"^\d+$");
+ }
+
+ public int GetNum()
+ {
+ // Normalize the text by removing leading zeros
+ string text = textBox.Text.TrimStart('0');
+
+ // If the result is empty, default to zero
+ if (string.IsNullOrEmpty(text))
+ {
+ return 0;
+ }
+
+ // Try to parse the integer value
+ if (int.TryParse(text, out int result))
+ {
+ return result;
+ }
+
+ // If parsing fails, return zero as a fallback
+ return 0;
+ }
+ }
+}