Skip to content

Commit

Permalink
Created ArcGIS Add-in and Added wpf UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel-Butt committed Jun 10, 2024
1 parent a7fe85b commit bae1e90
Show file tree
Hide file tree
Showing 24 changed files with 1,093 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ test_images/
simple_images/
python/__pycache__
python/.idea/
MESH_MAP/.vs/
MESH_MAP/obj/
MESH_MAP/bin/
37 changes: 37 additions & 0 deletions MESH_MAP/Config.daml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<ArcGIS defaultAssembly="MESH_MAP.dll" defaultNamespace="MESH_MAP" xmlns="http://schemas.esri.com/DADF/Registry" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.esri.com/DADF/Registry file:///C:/Program%20Files/ArcGIS/Pro/bin/ArcGIS.Desktop.Framework.xsd">
<AddInInfo id="{76eb8072-5f60-4738-b2c3-fafad2f851d3}" version="1.0" desktopVersion="3.3.52636" product="ArcGISPro">
<Name>MESH-MAP</Name>
<Description>Maximum Estimated Size of Hail - Monitoring and Analysis Program</Description>
<Image>Images\AddinDesktop32.png</Image>
<Author>Daniel Butt</Author>
<Company>CSSL</Company>
<Date>6/10/2024 10:35:44 AM</Date>
<Subject>Framework</Subject>
<!-- Note subject can be one or more of these topics:
Content, Framework, Editing, Geodatabase, Geometry, Geoprocessing, Layouts, Map Authoring, Map Exploration -->
</AddInInfo>
<modules>
<insertModule id="MESH_MAP_Module" className="Module1" autoLoad="false" caption="Module1">
<!-- uncomment to have the control hosted on a separate tab-->
<tabs>
<tab id="MESH_MAP_Tab1" caption="MESH-MAP">
<group refID="MESH_MAP"/>
</tab>
</tabs>
<groups>
<!-- comment this out if you have no controls on the Addin tab to avoid
an empty group-->
<group id="MESH_MAP" caption="MESH-MAP" appearsOnAddInTab="false">
<!-- host controls within groups -->
<button refID="MESH_MAP_Main" size="large" />
</group>
</groups>
<controls>
<!-- add your controls here -->
<button id="MESH_MAP_Main" caption="Analyse" className="ShowMain" loadOnClick="true" smallImage="GenericButtonPurple16" largeImage="GenericButtonPurple32">
<tooltip heading="Analyse MESH">Analyse MESH scan to detect hail swaths<disabledText /></tooltip>
</button>
</controls>
</insertModule>
</modules>
</ArcGIS>
Binary file added MESH_MAP/DarkImages/AddInDesktop16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MESH_MAP/DarkImages/AddInDesktop32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MESH_MAP/Images/AddInDesktop16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MESH_MAP/Images/AddInDesktop32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
100 changes: 100 additions & 0 deletions MESH_MAP/LengthReqsBox.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<UserControl x:Class="MESH_MAP.LengthReqsBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:MESH_MAP"
mc:Ignorable="d"
d:DesignHeight="150" d:DesignWidth="520">
<Grid>
<Rectangle HorizontalAlignment="Left" Height="150" Fill="#F7F8F8" VerticalAlignment="Top" Width="520"/>
<ListBox x:Name="lengthReqsListBox" Margin="5,5,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Width="350" Height="110"/>
<Button Content="Add" HorizontalAlignment="Left" Margin="100,125,0,0" VerticalAlignment="Top" Width="50" Click="AddItem"/>
<Button Content="Delete" HorizontalAlignment="Left" Margin="200,125,0,0" VerticalAlignment="Top" Width="50" Click="DeleteItem"/>
<Label Content="Hail Size" FontSize="14" HorizontalAlignment="Left" Margin="369,24,0,0" VerticalAlignment="Top"/>
<Label Content="Length" FontSize="14" HorizontalAlignment="Left" Margin="448,24,0,0" VerticalAlignment="Top"/>
<local:WholeNumBox x:Name="lengthBox" HorizontalAlignment="Left" Margin="454,53,0,0" VerticalAlignment="Top" Width="40" Height="22" RenderTransformOrigin="0.514,0.655" DefaultValue="10"/>
<Label Content="Km" FontSize="12" HorizontalAlignment="Left" Margin="491,53,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.143,0.519"/>
<ComboBox x:Name="hailSizeComboBox" Margin="360,53,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Width="80" Height="20" SelectedIndex="5">
<ComboBoxItem>
<StackPanel Orientation="Horizontal">
<Rectangle Stroke="#000000" Width="10" Height="10" Fill="#0099ff"/>
<TextBlock Margin="5,0,0,0" Text="1 mm"/>
</StackPanel>
</ComboBoxItem>
<ComboBoxItem>
<StackPanel Orientation="Horizontal">
<Rectangle Stroke="#000000" Width="10" Height="10" Fill="#00ff66"/>
<TextBlock Margin="5,0,0,0" Text="2 mm"/>
</StackPanel>
</ComboBoxItem>
<ComboBoxItem>
<StackPanel Orientation="Horizontal">
<Rectangle Stroke="#000000" Width="10" Height="10" Fill="#00cc00"/>
<TextBlock Margin="5,0,0,0" Text="4 mm"/>
</StackPanel>
</ComboBoxItem>
<ComboBoxItem>
<StackPanel Orientation="Horizontal">
<Rectangle Stroke="#000000" Width="10" Height="10" Fill="#009900"/>
<TextBlock Margin="5,0,0,0" Text="6 mm"/>
</StackPanel>
</ComboBoxItem>
<ComboBoxItem>
<StackPanel Orientation="Horizontal">
<Rectangle Stroke="#000000" Width="10" Height="10" Fill="#006600"/>
<TextBlock Margin="5,0,0,0" Text="8 mm"/>
</StackPanel>
</ComboBoxItem>
<ComboBoxItem>
<StackPanel Orientation="Horizontal">
<Rectangle Stroke="#000000" Width="10" Height="10" Fill="#ffff33"/>
<TextBlock Margin="5,0,0,0" Text="10 mm"/>
</StackPanel>
</ComboBoxItem>
<ComboBoxItem>
<StackPanel Orientation="Horizontal">
<Rectangle Stroke="#000000" Width="10" Height="10" Fill="#ffcc00"/>
<TextBlock Margin="5,0,0,0" Text="15 mm"/>
</StackPanel>
</ComboBoxItem>
<ComboBoxItem>
<StackPanel Orientation="Horizontal">
<Rectangle Stroke="#000000" Width="10" Height="10" Fill="#ff9900"/>
<TextBlock Margin="5,0,0,0" Text="20 mm"/>
</StackPanel>
</ComboBoxItem>
<ComboBoxItem>
<StackPanel Orientation="Horizontal">
<Rectangle Stroke="#000000" Width="10" Height="10" Fill="#ff6600"/>
<TextBlock Margin="5,0,0,0" Text="30 mm"/>
</StackPanel>
</ComboBoxItem>
<ComboBoxItem>
<StackPanel Orientation="Horizontal">
<Rectangle Stroke="#000000" Width="10" Height="10" Fill="#ff0000"/>
<TextBlock Margin="5,0,0,0" Text="40 mm"/>
</StackPanel>
</ComboBoxItem>
<ComboBoxItem>
<StackPanel Orientation="Horizontal">
<Rectangle Stroke="#000000" Width="10" Height="10" Fill="#ff0299"/>
<TextBlock Margin="5,0,0,0" Text="50 mm"/>
</StackPanel>
</ComboBoxItem>
<ComboBoxItem>
<StackPanel Orientation="Horizontal">
<Rectangle Stroke="#000000" Width="10" Height="10" Fill="#9933cc"/>
<TextBlock Margin="5,0,0,0" Text="75 mm"/>
</StackPanel>
</ComboBoxItem>
<ComboBoxItem>
<StackPanel Orientation="Horizontal">
<Rectangle Stroke="#000000" Width="10" Height="10" Fill="#660099"/>
<TextBlock Margin="5,0,0,0" Text="100 mm"/>
</StackPanel>
</ComboBoxItem>
</ComboBox>

</Grid>
</UserControl>
80 changes: 80 additions & 0 deletions MESH_MAP/LengthReqsBox.xaml.cs
Original file line number Diff line number Diff line change
@@ -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
{
/// <summary>
/// Interaction logic for LengthReqsBox.xaml
/// </summary>
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;
}
}
}
102 changes: 102 additions & 0 deletions MESH_MAP/MESH_MAP.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<NoWarn>CA1416</NoWarn>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<None Remove="Config.daml" />
</ItemGroup>
<ItemGroup>
<Content Include="Config.daml" />
<Content Include="Images\AddInDesktop16.png" />
<Content Include="Images\AddInDesktop32.png" />
<Content Include="DarkImages\AddInDesktop16.png" />
<Content Include="DarkImages\AddInDesktop32.png" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\launchSettings.json" />
</ItemGroup>
<ItemGroup>
<Reference Include="ArcGIS.Desktop.Framework">
<HintPath>C:\Program Files\ArcGIS\Pro\bin\ArcGIS.Desktop.Framework.dll</HintPath>
<CopyLocal>False</CopyLocal>
<Private>False</Private>
</Reference>
<Reference Include="ArcGIS.Core">
<HintPath>C:\Program Files\ArcGIS\Pro\bin\ArcGIS.Core.dll</HintPath>
<CopyLocal>False</CopyLocal>
<Private>False</Private>
</Reference>
<Reference Include="ArcGIS.Desktop.Core">
<HintPath>C:\Program Files\ArcGIS\Pro\bin\Extensions\Core\ArcGIS.Desktop.Core.dll</HintPath>
<CopyLocal>False</CopyLocal>
<Private>False</Private>
</Reference>
<Reference Include="ArcGIS.Desktop.Mapping">
<HintPath>C:\Program Files\ArcGIS\Pro\bin\Extensions\Mapping\ArcGIS.Desktop.Mapping.dll</HintPath>
<CopyLocal>False</CopyLocal>
<Private>False</Private>
</Reference>
<Reference Include="ArcGIS.Desktop.Catalog">
<HintPath>C:\Program Files\ArcGIS\Pro\bin\Extensions\Catalog\ArcGIS.Desktop.Catalog.dll</HintPath>
<CopyLocal>False</CopyLocal>
<Private>False</Private>
</Reference>
<Reference Include="ArcGIS.Desktop.Editing">
<HintPath>C:\Program Files\ArcGIS\Pro\bin\Extensions\Editing\ArcGIS.Desktop.Editing.dll</HintPath>
<CopyLocal>False</CopyLocal>
<Private>False</Private>
</Reference>
<Reference Include="ArcGIS.Desktop.Extensions">
<HintPath>C:\Program Files\ArcGIS\Pro\bin\Extensions\DesktopExtensions\ArcGIS.Desktop.Extensions.dll</HintPath>
<CopyLocal>False</CopyLocal>
<Private>False</Private>
</Reference>
<Reference Include="ArcGIS.Desktop.GeoProcessing">
<HintPath>C:\Program Files\ArcGIS\Pro\bin\Extensions\GeoProcessing\ArcGIS.Desktop.GeoProcessing.dll</HintPath>
<CopyLocal>False</CopyLocal>
<Private>False</Private>
</Reference>
<Reference Include="ArcGIS.Desktop.Layouts">
<HintPath>C:\Program Files\ArcGIS\Pro\bin\Extensions\Layout\ArcGIS.Desktop.Layouts.dll</HintPath>
<CopyLocal>False</CopyLocal>
<Private>False</Private>
</Reference>
<Reference Include="ArcGIS.Desktop.KnowledgeGraph">
<HintPath>C:\Program Files\ArcGIS\Pro\bin\Extensions\KnowledgeGraph\ArcGIS.Desktop.KnowledgeGraph.dll</HintPath>
<CopyLocal>False</CopyLocal>
<Private>False</Private>
</Reference>
<Reference Include="ArcGIS.Desktop.Shared.Wpf">
<HintPath>C:\Program Files\ArcGIS\Pro\bin\ArcGIS.Desktop.Shared.Wpf.dll</HintPath>
<CopyLocal>False</CopyLocal>
<Private>False</Private>
</Reference>
<Reference Include="ArcGIS.Desktop.Ribbon.Wpf">
<HintPath>C:\Program Files\ArcGIS\Pro\bin\ArcGIS.Desktop.Ribbon.Wpf.dll</HintPath>
<CopyLocal>False</CopyLocal>
<Private>False</Private>
</Reference>
<Reference Include="ArcGIS.Desktop.DataGrid.Contrib.Wpf">
<HintPath>C:\Program Files\ArcGIS\Pro\bin\ArcGIS.Desktop.DataGrid.Contrib.Wpf.dll</HintPath>
<CopyLocal>False</CopyLocal>
<Private>False</Private>
</Reference>
<Reference Include="ArcGIS.Desktop.Resources">
<HintPath>C:\Program Files\ArcGIS\Pro\bin\ArcGIS.Desktop.Resources.dll</HintPath>
<CopyLocal>False</CopyLocal>
<Private>False</Private>
</Reference>
<Reference Include="ESRI.ArcGIS.ItemIndex">
<HintPath>C:\Program Files\ArcGIS\Pro\bin\ESRI.ArcGIS.ItemIndex.dll</HintPath>
<CopyLocal>False</CopyLocal>
<Private>False</Private>
</Reference>
</ItemGroup>
<Import Project="C:\Program Files\ArcGIS\Pro\bin\Esri.ProApp.SDK.Desktop.targets" Condition="Exists('C:\Program Files\ArcGIS\Pro\bin\Esri.ProApp.SDK.Desktop.targets') AND !Exists('Esri.ArcGISPro.Extensions.targets')" />
</Project>
32 changes: 32 additions & 0 deletions MESH_MAP/MESH_MAP.csproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
<ItemGroup>
<Compile Update="LengthReqsBox.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="RasterSelectionList.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="WholeNumBox.xaml.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Page Update="LengthReqsBox.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Main.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="RasterSelectionBox.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="RasterSelectionList.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="WholeNumBox.xaml">
<SubType>Designer</SubType>
</Page>
</ItemGroup>
</Project>
25 changes: 25 additions & 0 deletions MESH_MAP/MESH_MAP.sln
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit bae1e90

Please sign in to comment.