Skip to content

Commit 01dc10f

Browse files
committed
Re-organise structure
1 parent c064ba1 commit 01dc10f

28 files changed

+863
-16
lines changed

Civil3DUtils.sln CivilDialogs.sln

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.5.33530.505
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Civil3DUtils", "Civil3DUtils\Civil3DUtils.csproj", "{6A7BE168-06FC-4D06-A8A2-1DB7DC9A1AD5}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CivilDialogs", "src\CivilDialogs\CivilDialogs.csproj", "{6A7BE168-06FC-4D06-A8A2-1DB7DC9A1AD5}"
77
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SamplePlugin", "SamplePlugin\SamplePlugin.csproj", "{D71552FB-0B03-4186-8AC4-B2161E5F80F9}"
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SamplePlugin", "src\SamplePlugin\SamplePlugin.csproj", "{D71552FB-0B03-4186-8AC4-B2161E5F80F9}"
99
EndProject
1010
Global
1111
GlobalSection(SolutionConfigurationPlatforms) = preSolution
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Civil3DUtils/Civil3DUtils.csproj src/CivilDialogs/CivilDialogs.csproj

+16-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
<ProjectGuid>{6A7BE168-06FC-4D06-A8A2-1DB7DC9A1AD5}</ProjectGuid>
88
<OutputType>Library</OutputType>
99
<AppDesignerFolder>Properties</AppDesignerFolder>
10-
<RootNamespace>Civil3DUtils</RootNamespace>
11-
<AssemblyName>Civil3DUtils</AssemblyName>
10+
<RootNamespace>CivilDialogs</RootNamespace>
11+
<AssemblyName>CivilDialogs</AssemblyName>
1212
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
1414
<Deterministic>true</Deterministic>
@@ -68,7 +68,16 @@
6868
<Reference Include="WindowsBase" />
6969
</ItemGroup>
7070
<ItemGroup>
71+
<Compile Include="Converters\BooleanYesNoConverter.cs" />
72+
<Compile Include="Helpers\LayerPropertiesTemplateSelector.cs" />
73+
<Compile Include="Helpers\LineweightHelper.cs" />
74+
<Compile Include="LayerCreateDialog.xaml.cs">
75+
<DependentUpon>LayerCreateDialog.xaml</DependentUpon>
76+
</Compile>
77+
<Compile Include="Models\LayerProperties.cs" />
78+
<Compile Include="Models\ObservableObject.cs" />
7179
<Compile Include="Properties\AssemblyInfo.cs" />
80+
<Compile Include="RelayCommand.cs" />
7281
<Compile Include="SelectAlignmentDialog.xaml.cs">
7382
<DependentUpon>SelectAlignmentDialog.xaml</DependentUpon>
7483
</Compile>
@@ -79,9 +88,14 @@
7988
<DependentUpon>SelectSurfaceDialog.xaml</DependentUpon>
8089
</Compile>
8190
<Compile Include="TransactAndForget.cs" />
91+
<Compile Include="ViewModel\LayerCreateDialogViewModel.cs" />
8292
<Compile Include="WindowExtensions.cs" />
8393
</ItemGroup>
8494
<ItemGroup>
95+
<Page Include="LayerCreateDialog.xaml">
96+
<Generator>MSBuild:Compile</Generator>
97+
<SubType>Designer</SubType>
98+
</Page>
8599
<Page Include="SelectAlignmentDialog.xaml">
86100
<Generator>MSBuild:Compile</Generator>
87101
<SubType>Designer</SubType>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System;
2+
using System.Globalization;
3+
using System.Windows.Data;
4+
5+
namespace CivilDialogs.Converters;
6+
7+
[ValueConversion(typeof(bool), typeof(string))]
8+
public class BooleanYesNoConverter: IValueConverter
9+
{
10+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
11+
{
12+
var boolValue = (bool)value;
13+
return boolValue ? "Yes" : "No";
14+
}
15+
16+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
17+
{
18+
var yesNoValue = (string)value;
19+
return yesNoValue == "Yes";
20+
}
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System.Windows;
2+
using System.Windows.Controls;
3+
using CivilDialogs.Models;
4+
5+
namespace CivilDialogs.Helpers;
6+
7+
public class LayerPropertiesTemplateSelector : DataTemplateSelector
8+
{
9+
public DataTemplate LayerNameTemplate { get; set; }
10+
public DataTemplate LayerColorTemplate { get; set; }
11+
public DataTemplate LayerLinetypeTemplate { get; set; }
12+
public DataTemplate LayerLineweightTemplate { get; set; }
13+
public DataTemplate LayerLockedTemplate { get; set; }
14+
public DataTemplate LayerOnTemplate { get; set; }
15+
public DataTemplate LayerFreezeTemplate { get; set; }
16+
public DataTemplate LayerPlotStyleTemplate { get; set; }
17+
public DataTemplate LayerPlotTemplate { get; set; }
18+
19+
public override DataTemplate SelectTemplate(object item, DependencyObject container)
20+
{
21+
return item switch
22+
{
23+
LayerNameProperty => LayerNameTemplate,
24+
LayerColorProperty => LayerColorTemplate,
25+
LayerLinetypeProperty => LayerLinetypeTemplate,
26+
LayerLineweightProperty => LayerLineweightTemplate,
27+
LayerLockedProperty => LayerLockedTemplate,
28+
LayerOnProperty => LayerOnTemplate,
29+
LayerFrozenProperty => LayerFreezeTemplate,
30+
LayerPlotStyleProperty => LayerPlotStyleTemplate,
31+
LayerPlotProperty => LayerPlotTemplate,
32+
_ => base.SelectTemplate(item, container) //throw new InvalidOperationException("was not a valid layer property")
33+
};
34+
}
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using Autodesk.AutoCAD.DatabaseServices;
2+
3+
namespace CivilDialogs.Helpers;
4+
5+
public static class LineweightHelpers
6+
{
7+
public static LineWeight LineweightStringtoLineweight(string lineweight)
8+
{
9+
return lineweight switch
10+
{
11+
"0.00 mm" => LineWeight.LineWeight000,
12+
"0.05 mm" => LineWeight.LineWeight005,
13+
"0.09 mm" => LineWeight.LineWeight009,
14+
"0.13 mm" => LineWeight.LineWeight013,
15+
"0.15 mm" => LineWeight.LineWeight015,
16+
"0.18 mm" => LineWeight.LineWeight018,
17+
"0.20 mm" => LineWeight.LineWeight020,
18+
"0.25 mm" => LineWeight.LineWeight025,
19+
"0.30 mm" => LineWeight.LineWeight030,
20+
"0.35 mm" => LineWeight.LineWeight035,
21+
"0.40 mm" => LineWeight.LineWeight040,
22+
"0.50 mm" => LineWeight.LineWeight050,
23+
"0.53 mm" => LineWeight.LineWeight053,
24+
"0.60 mm" => LineWeight.LineWeight060,
25+
"0.70 mm" => LineWeight.LineWeight070,
26+
"0.80 mm" => LineWeight.LineWeight080,
27+
"0.90 mm" => LineWeight.LineWeight090,
28+
"1.00 mm" => LineWeight.LineWeight100,
29+
"1.06 mm" => LineWeight.LineWeight106,
30+
"1.20 mm" => LineWeight.LineWeight120,
31+
"1.40 mm" => LineWeight.LineWeight140,
32+
"1.58 mm" => LineWeight.LineWeight158,
33+
"2.00 mm" => LineWeight.LineWeight200,
34+
"2.11 mm" => LineWeight.LineWeight211,
35+
"ByLayer" => LineWeight.ByLayer,
36+
"ByBlock" => LineWeight.ByBlock,
37+
"Default" => LineWeight.ByLineWeightDefault,
38+
"ByDIPs" => LineWeight.ByDIPs,
39+
_ => LineWeight.ByLayer
40+
};
41+
}
42+
}

0 commit comments

Comments
 (0)