From 738ce5c4336c1602ae8abf9175a55b8745684ab1 Mon Sep 17 00:00:00 2001 From: Evgeny Redikultsev Date: Sat, 30 Aug 2025 13:58:12 +0500 Subject: [PATCH] Add graphic primitives --- .../BeamShearSectionPrimitive.cs | 5 +- .../ConcentratedForcePrimitive.cs | 34 ++++++- .../DistributedLoadPrimitive.cs | 60 ++++++++++++ .../GraphicalPrimitives/IGraphicPrimitive.cs | 10 +- .../InclinedSectionPrimitive.cs | 2 + .../StirrupByDensityPrimitive.cs | 4 +- .../StirrupByInclinedRebarPrimitive.cs | 2 + .../StirrupByRebarPrimitive.cs | 5 +- .../UI/Resources/BeamShearTemplate.xaml | 59 +++++++++++- .../ActionToGraphicPrimitiveConvertLogic.cs | 88 +++++++++++++++++ .../BeamShears/InclinedSectionViewerView.xaml | 22 ++++- .../InclinedSectionViewerView.xaml.cs | 2 +- ...ResultToGraphicalPrimitivesConvertLogic.cs | 15 ++- .../Graphs/SaveCopyFWElementViewModel.cs | 24 +++++ .../Windows/UserControls/WorkPlane.xaml.cs | 12 --- .../WorkPlanes/PrimitiveTemplateSelector.cs | 2 + .../WorkPlanes/WorkPlaneConfigViewModel.cs | 6 -- .../WorkPlanes/WorkPlaneRoot.xaml | 95 ++++++++++++------- .../WorkPlanes/WorkPlaneRoot.xaml.cs | 6 +- .../WorkPlanes/WorkPlaneRootViewModel.cs | 7 +- 20 files changed, 367 insertions(+), 93 deletions(-) create mode 100644 StructureHelper/Infrastructure/UI/GraphicalPrimitives/DistributedLoadPrimitive.cs create mode 100644 StructureHelper/Windows/BeamShears/ActionToGraphicPrimitiveConvertLogic.cs create mode 100644 StructureHelper/Windows/Graphs/SaveCopyFWElementViewModel.cs diff --git a/StructureHelper/Infrastructure/UI/GraphicalPrimitives/BeamShearSectionPrimitive.cs b/StructureHelper/Infrastructure/UI/GraphicalPrimitives/BeamShearSectionPrimitive.cs index feb2c8c..22ff3b5 100644 --- a/StructureHelper/Infrastructure/UI/GraphicalPrimitives/BeamShearSectionPrimitive.cs +++ b/StructureHelper/Infrastructure/UI/GraphicalPrimitives/BeamShearSectionPrimitive.cs @@ -14,9 +14,6 @@ namespace StructureHelper.Infrastructure.UI.GraphicalPrimitives private IBeamShearSection beamShearSection; private IInclinedSection inclinedSection; - - public double CenterX { get; set; } = 0; - public double CenterY { get; set; } = 0; public double FullDepth => inclinedSection.FullDepth; public double WebWidth => inclinedSection.WebWidth; public double ReinforcementArea => inclinedSection.BeamShearSection.ReinforcementArea; @@ -35,6 +32,8 @@ namespace StructureHelper.Infrastructure.UI.GraphicalPrimitives public PrimitiveVisualPropertyViewModel VisualProperty {get;} + public string Name => beamShearSection.Name; + public BeamShearSectionPrimitive(IBeamShearSection beamShearSection, IInclinedSection inclinedSection) { this.beamShearSection = beamShearSection; diff --git a/StructureHelper/Infrastructure/UI/GraphicalPrimitives/ConcentratedForcePrimitive.cs b/StructureHelper/Infrastructure/UI/GraphicalPrimitives/ConcentratedForcePrimitive.cs index a00aada..d0e18d4 100644 --- a/StructureHelper/Infrastructure/UI/GraphicalPrimitives/ConcentratedForcePrimitive.cs +++ b/StructureHelper/Infrastructure/UI/GraphicalPrimitives/ConcentratedForcePrimitive.cs @@ -1,5 +1,8 @@ using StructureHelper.Windows.UserControls; +using StructureHelperCommon.Infrastructures.Exceptions; using StructureHelperCommon.Models.Forces; +using StructureHelperCommon.Models.Shapes; +using StructureHelperLogics.Models.BeamShears; using System; using System.Windows.Media; using PrimitiveVisualProperty = StructureHelperCommon.Models.VisualProperties.PrimitiveVisualProperty; @@ -9,24 +12,47 @@ namespace StructureHelper.Infrastructure.UI.GraphicalPrimitives public class ConcentratedForcePrimitive : IGraphicalPrimitive { private IConcentratedForce concentratedForce; - private readonly double scaleFactor; + private IInclinedSection inclinedSection; public double ScaleFactor { get { - if (concentratedForce.ForceValue.Qy > 0) { return -1; } - return 1; + double forceValue = concentratedForce.ForceValue.Qy; + return forceValue / MaxForce; } } + public double TranslateX => concentratedForce.ForceCoordinate; + public double TranslateY => GetAbsoluteLevel(); + + public PrimitiveVisualPropertyViewModel VisualProperty { get; } = new(new PrimitiveVisualProperty(Guid.Empty)); public IConcentratedForce ConcentratedForce => concentratedForce; - public ConcentratedForcePrimitive(IConcentratedForce concentratedForce) + public string Name => concentratedForce.Name; + + public double MaxForce { get; set; } = 1e6; + + public ConcentratedForcePrimitive(IConcentratedForce concentratedForce, IInclinedSection inclinedSection) { this.concentratedForce = concentratedForce; + this.inclinedSection = inclinedSection; VisualProperty.Color = (Color)ColorConverter.ConvertFromString("Black"); } + + private double GetAbsoluteLevel() + { + double height; + IShape shape = inclinedSection.BeamShearSection.Shape; + if (shape is IRectangleShape rectangle) { height = rectangle.Height; } + else if (shape is ICircleShape circle) { height = circle.Diameter; } + else + { + throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(shape) + $": concentrated force {concentratedForce.Name} shape"); + } + double level = (concentratedForce.RelativeLoadLevel + 0.5) * height; + return level; + } } } diff --git a/StructureHelper/Infrastructure/UI/GraphicalPrimitives/DistributedLoadPrimitive.cs b/StructureHelper/Infrastructure/UI/GraphicalPrimitives/DistributedLoadPrimitive.cs new file mode 100644 index 0000000..125e2e8 --- /dev/null +++ b/StructureHelper/Infrastructure/UI/GraphicalPrimitives/DistributedLoadPrimitive.cs @@ -0,0 +1,60 @@ +using StructureHelper.Windows.UserControls; +using StructureHelperCommon.Infrastructures.Exceptions; +using StructureHelperCommon.Models.Forces; +using StructureHelperCommon.Models.Shapes; +using StructureHelperLogics.Models.BeamShears; +using System; +using System.Windows.Media; +using PrimitiveVisualProperty = StructureHelperCommon.Models.VisualProperties.PrimitiveVisualProperty; + +namespace StructureHelper.Infrastructure.UI.GraphicalPrimitives +{ + public class DistributedLoadPrimitive : IGraphicalPrimitive + { + private IDistributedLoad distributedLoad; + private IInclinedSection inclinedSection; + + public double ScaleFactor + { + get + { + double forceValue = distributedLoad.LoadValue.Qy; + return -1 * forceValue / MaxForce; + } + } + + public double TranslateX => distributedLoad.StartCoordinate; + public double TranslateY => GetAbsoluteLevel(); + public double Length => distributedLoad.EndCoordinate - distributedLoad.StartCoordinate; + + + public PrimitiveVisualPropertyViewModel VisualProperty { get; } = new(new PrimitiveVisualProperty(Guid.Empty)); + public IDistributedLoad DistributedLoad => distributedLoad; + + public string Name => distributedLoad.Name; + + public double MaxForce { get; set; } = 1e6; + + public DistributedLoadPrimitive(IDistributedLoad distributedLoad, IInclinedSection inclinedSection) + { + this.distributedLoad = distributedLoad; + this.inclinedSection = inclinedSection; + VisualProperty.Color = (Color)ColorConverter.ConvertFromString("LightBlue"); + VisualProperty.FactoredOpacity = 90; + } + + private double GetAbsoluteLevel() + { + double height; + IShape shape = inclinedSection.BeamShearSection.Shape; + if (shape is IRectangleShape rectangle) { height = rectangle.Height; } + else if (shape is ICircleShape circle) { height = circle.Diameter; } + else + { + throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(shape) + $": distributed load {distributedLoad.Name} shape"); + } + double level = (distributedLoad.RelativeLoadLevel + 0.5) * height; + return level; + } + } +} diff --git a/StructureHelper/Infrastructure/UI/GraphicalPrimitives/IGraphicPrimitive.cs b/StructureHelper/Infrastructure/UI/GraphicalPrimitives/IGraphicPrimitive.cs index 13556de..f105f1b 100644 --- a/StructureHelper/Infrastructure/UI/GraphicalPrimitives/IGraphicPrimitive.cs +++ b/StructureHelper/Infrastructure/UI/GraphicalPrimitives/IGraphicPrimitive.cs @@ -1,16 +1,10 @@ -using FieldVisualizer.Entities.Values.Primitives; -using StructureHelper.Windows.UserControls; -using StructureHelperCommon.Models.VisualProperties; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using StructureHelper.Windows.UserControls; namespace StructureHelper.Infrastructure.UI.GraphicalPrimitives { public interface IGraphicalPrimitive { + string Name { get; } PrimitiveVisualPropertyViewModel VisualProperty { get; } } } diff --git a/StructureHelper/Infrastructure/UI/GraphicalPrimitives/InclinedSectionPrimitive.cs b/StructureHelper/Infrastructure/UI/GraphicalPrimitives/InclinedSectionPrimitive.cs index 983baee..b432680 100644 --- a/StructureHelper/Infrastructure/UI/GraphicalPrimitives/InclinedSectionPrimitive.cs +++ b/StructureHelper/Infrastructure/UI/GraphicalPrimitives/InclinedSectionPrimitive.cs @@ -28,6 +28,8 @@ namespace StructureHelper.Infrastructure.UI.GraphicalPrimitives public PrimitiveVisualPropertyViewModel VisualProperty { get; } = new(new PrimitiveVisualProperty(Guid.Empty)); + public string Name => "Inclined section"; + public InclinedSectionPrimitive(IBeamShearSectionLogicResult source) { this.source = source; diff --git a/StructureHelper/Infrastructure/UI/GraphicalPrimitives/StirrupByDensityPrimitive.cs b/StructureHelper/Infrastructure/UI/GraphicalPrimitives/StirrupByDensityPrimitive.cs index 3e62171..d722642 100644 --- a/StructureHelper/Infrastructure/UI/GraphicalPrimitives/StirrupByDensityPrimitive.cs +++ b/StructureHelper/Infrastructure/UI/GraphicalPrimitives/StirrupByDensityPrimitive.cs @@ -8,8 +8,6 @@ namespace StructureHelper.Infrastructure.UI.GraphicalPrimitives { public IStirrupByDensity StirrupByDensity { get; } - public double CenterX => 0; - public double CenterY => 0; public double StartPoinX => StirrupByDensity.StartCoordinate; public double BottomPointY => InclinedSection.FullDepth - InclinedSection.EffectiveDepth; public double TopPointY => InclinedSection.FullDepth; @@ -20,6 +18,8 @@ namespace StructureHelper.Infrastructure.UI.GraphicalPrimitives public PrimitiveVisualPropertyViewModel VisualProperty { get; } + public string Name => StirrupByDensity.Name; + public StirrupByDensityPrimitive(IStirrupByDensity stirrupByDensity, IInclinedSection inclinedSection) { StirrupByDensity = stirrupByDensity; diff --git a/StructureHelper/Infrastructure/UI/GraphicalPrimitives/StirrupByInclinedRebarPrimitive.cs b/StructureHelper/Infrastructure/UI/GraphicalPrimitives/StirrupByInclinedRebarPrimitive.cs index 48117bb..d267ae6 100644 --- a/StructureHelper/Infrastructure/UI/GraphicalPrimitives/StirrupByInclinedRebarPrimitive.cs +++ b/StructureHelper/Infrastructure/UI/GraphicalPrimitives/StirrupByInclinedRebarPrimitive.cs @@ -23,6 +23,8 @@ namespace StructureHelper.Infrastructure.UI.GraphicalPrimitives public PrimitiveVisualPropertyViewModel VisualProperty { get; } + public string Name => StirrupByInclinedRebar.Name; + public StirrupByInclinedRebarPrimitive(IStirrupByInclinedRebar stirrupByInclinedRebar, IInclinedSection inclinedSection) { StirrupByInclinedRebar = stirrupByInclinedRebar; diff --git a/StructureHelper/Infrastructure/UI/GraphicalPrimitives/StirrupByRebarPrimitive.cs b/StructureHelper/Infrastructure/UI/GraphicalPrimitives/StirrupByRebarPrimitive.cs index 212a838..83f6ce6 100644 --- a/StructureHelper/Infrastructure/UI/GraphicalPrimitives/StirrupByRebarPrimitive.cs +++ b/StructureHelper/Infrastructure/UI/GraphicalPrimitives/StirrupByRebarPrimitive.cs @@ -11,8 +11,6 @@ namespace StructureHelper.Infrastructure.UI.GraphicalPrimitives private readonly IStirrupByDensity stirrupByDensity; public IStirrupByRebar StirrupByRebar { get; } - public double CenterX => 0; - public double CenterY => 0; public double StartPoinX => StirrupByRebar.StartCoordinate; public double BottomPointY => InclinedSection.FullDepth - InclinedSection.EffectiveDepth; public double TopPointY => InclinedSection.FullDepth; @@ -20,11 +18,12 @@ namespace StructureHelper.Infrastructure.UI.GraphicalPrimitives public double Depth => InclinedSection.EffectiveDepth; public double Density => Math.Round(stirrupByDensity.StirrupDensity); - public IInclinedSection InclinedSection => inclinedSection; public PrimitiveVisualPropertyViewModel VisualProperty { get; } + public string Name => StirrupByRebar.Name; + public StirrupByRebarPrimitive(IStirrupByRebar stirrupByRebar, IInclinedSection inclinedSection) { this.StirrupByRebar = stirrupByRebar; diff --git a/StructureHelper/Infrastructure/UI/Resources/BeamShearTemplate.xaml b/StructureHelper/Infrastructure/UI/Resources/BeamShearTemplate.xaml index 09ff19f..df4eb13 100644 --- a/StructureHelper/Infrastructure/UI/Resources/BeamShearTemplate.xaml +++ b/StructureHelper/Infrastructure/UI/Resources/BeamShearTemplate.xaml @@ -343,8 +343,12 @@ + - + @@ -377,6 +381,7 @@ @@ -389,5 +394,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/StructureHelper/Windows/BeamShears/ActionToGraphicPrimitiveConvertLogic.cs b/StructureHelper/Windows/BeamShears/ActionToGraphicPrimitiveConvertLogic.cs new file mode 100644 index 0000000..71cc2a1 --- /dev/null +++ b/StructureHelper/Windows/BeamShears/ActionToGraphicPrimitiveConvertLogic.cs @@ -0,0 +1,88 @@ +using StructureHelper.Infrastructure.UI.GraphicalPrimitives; +using StructureHelperCommon.Infrastructures.Interfaces; +using StructureHelperCommon.Models.Forces; +using StructureHelperLogics.Models.BeamShears; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelper.Windows.BeamShears +{ + internal class ActionToGraphicPrimitiveConvertLogic : IObjectConvertStrategy, IBeamShearAction> + { + private IInclinedSection inclinedSection; + private List graphicalPrimitives; + private double maxConcentratedForceValue = 1e6; + private double maxDistributedLoadValue = 1e6; + + public ActionToGraphicPrimitiveConvertLogic(IInclinedSection inclinedSection) + { + this.inclinedSection = inclinedSection; + } + + public List Convert(IBeamShearAction source) + { + SetMaxForce(source); + SetMaxDistributedForce(source); + graphicalPrimitives = new(); + var supportInternalAction = source.SupportAction.SupportForce.ForceTuple; + graphicalPrimitives.Add(GetConcentratedForcePrimitive(supportInternalAction, "Support reaction")); + foreach (var item in source.SupportAction.ShearLoads) + { + if (item is IDistributedLoad distributedLoad) + { + graphicalPrimitives.Add(GetDistributedLoadPrimitive(distributedLoad)); + } + else if (item is IConcentratedForce concentratedForce) + { + graphicalPrimitives.Add(GetConcentratedForcePrimitive(concentratedForce)); + } + } + return graphicalPrimitives; + } + + private void SetMaxDistributedForce(IBeamShearAction source) + { + var forceList = source.SupportAction.ShearLoads + .Where(x => x is IDistributedLoad) + .Select(x => Math.Abs((x as IDistributedLoad).LoadValue.Qy)) + .ToList(); + maxDistributedLoadValue = forceList.Max(); + } + + private IGraphicalPrimitive GetDistributedLoadPrimitive(IDistributedLoad distributedLoad) + { + DistributedLoadPrimitive distributedLoadPrimitive = new(distributedLoad, inclinedSection) { MaxForce = maxDistributedLoadValue }; + return distributedLoadPrimitive; + } + + private ConcentratedForcePrimitive GetConcentratedForcePrimitive(IForceTuple supportInternalAction, string name) + { + ConcentratedForce force = new(Guid.Empty) { Name = name }; + force.ForceValue.Qy = supportInternalAction.Qy; + force.RelativeLoadLevel = -0.5; + force.ForceCoordinate = 0; + ConcentratedForcePrimitive concentratedForcePrimitive = new(force, inclinedSection) { MaxForce = maxConcentratedForceValue}; + return concentratedForcePrimitive; + } + + private ConcentratedForcePrimitive GetConcentratedForcePrimitive(IConcentratedForce concentratedForce) + { + ConcentratedForcePrimitive concentratedForcePrimitive = new(concentratedForce, inclinedSection) { MaxForce = maxConcentratedForceValue }; + return concentratedForcePrimitive; + } + + private void SetMaxForce(IBeamShearAction source) + { + var forceList = source.SupportAction.ShearLoads + .Where(x => x is IConcentratedForce) + .Select(x => Math.Abs((x as IConcentratedForce).ForceValue.Qy)) + .ToList(); + forceList.Add(Math.Abs(source.ExternalForce.ForceTuple.Nz)); + forceList.Add(Math.Abs(source.SupportAction.SupportForce.ForceTuple.Qy)); + maxConcentratedForceValue = forceList.Max(); + } + } +} diff --git a/StructureHelper/Windows/BeamShears/InclinedSectionViewerView.xaml b/StructureHelper/Windows/BeamShears/InclinedSectionViewerView.xaml index 706a8b5..1820732 100644 --- a/StructureHelper/Windows/BeamShears/InclinedSectionViewerView.xaml +++ b/StructureHelper/Windows/BeamShears/InclinedSectionViewerView.xaml @@ -7,8 +7,26 @@ xmlns:ucwp="clr-namespace:StructureHelper.Windows.UserControls.WorkPlanes" mc:Ignorable="d" d:DataContext="{d:DesignInstance local:InclinedSectionViewerViewModel}" - Title="Inclined Section Viewer" Height="650" Width="1000" WindowStartupLocation="CenterScreen"> + Title="Inclined Section Viewer" Height="650" Width="1000" MinHeight="600" MinWidth="500" WindowStartupLocation="CenterScreen"> - + + + + + + + + + + + + + + + + + + + diff --git a/StructureHelper/Windows/BeamShears/InclinedSectionViewerView.xaml.cs b/StructureHelper/Windows/BeamShears/InclinedSectionViewerView.xaml.cs index 0aacba6..406d4f7 100644 --- a/StructureHelper/Windows/BeamShears/InclinedSectionViewerView.xaml.cs +++ b/StructureHelper/Windows/BeamShears/InclinedSectionViewerView.xaml.cs @@ -23,9 +23,9 @@ namespace StructureHelper.Windows.BeamShears private InclinedSectionViewerViewModel viewModel; public InclinedSectionViewerView(InclinedSectionViewerViewModel viewModel) { - InitializeComponent(); this.viewModel = viewModel; this.DataContext = this.viewModel; + InitializeComponent(); } public InclinedSectionViewerView(IBeamShearSectionLogicResult sectionResult) : this(new InclinedSectionViewerViewModel(sectionResult)) { diff --git a/StructureHelper/Windows/BeamShears/SectionResultToGraphicalPrimitivesConvertLogic.cs b/StructureHelper/Windows/BeamShears/SectionResultToGraphicalPrimitivesConvertLogic.cs index d9ec536..00434d4 100644 --- a/StructureHelper/Windows/BeamShears/SectionResultToGraphicalPrimitivesConvertLogic.cs +++ b/StructureHelper/Windows/BeamShears/SectionResultToGraphicalPrimitivesConvertLogic.cs @@ -1,5 +1,4 @@ using StructureHelper.Infrastructure.UI.GraphicalPrimitives; -using StructureHelperCommon.Infrastructures.Exceptions; using StructureHelperCommon.Infrastructures.Interfaces; using StructureHelperCommon.Models.Forces; using StructureHelperLogics.Models.BeamShears; @@ -10,6 +9,7 @@ namespace StructureHelper.Windows.BeamShears { public class SectionResultToGraphicalPrimitivesConvertLogic : IObjectConvertStrategy, IBeamShearSectionLogicResult> { + private IObjectConvertStrategy, IBeamShearAction> actionLogic; private IObjectConvertStrategy, IStirrup> stirrupLogic; private IInclinedSection inclinedSection; @@ -17,23 +17,22 @@ namespace StructureHelper.Windows.BeamShears { inclinedSection = source.InputData.InclinedSection; InitializeStrategies(); - List graphicalPrimitives = new List(); + List graphicalPrimitives = new(); BeamShearSectionPrimitive beamShearSectionPrimitive = new(source.ResultInputData.InclinedSection.BeamShearSection, inclinedSection); graphicalPrimitives.Add(beamShearSectionPrimitive); - var supportInternalAction = source.ResultInputData.BeamShearAction.SupportAction.SupportForce.ForceTuple; - ConcentratedForce SupportForce = new(Guid.Empty); - SupportForce.ForceValue.Qy = supportInternalAction.Qy; - ConcentratedForcePrimitive concentratedForcePrimitive = new(SupportForce); - graphicalPrimitives.Add((concentratedForcePrimitive)); + graphicalPrimitives.AddRange(actionLogic.Convert(source.ResultInputData.BeamShearAction)); graphicalPrimitives.AddRange(stirrupLogic.Convert(source.ResultInputData.Stirrup)); InclinedSectionPrimitive inclinedSectionPrimitive = new(source); - graphicalPrimitives.Add((inclinedSectionPrimitive)); + graphicalPrimitives.Add(inclinedSectionPrimitive); return graphicalPrimitives; } + + private void InitializeStrategies() { stirrupLogic ??= new StirrupToGraphicPrimitiveConvertLogic(inclinedSection); + actionLogic ??= new ActionToGraphicPrimitiveConvertLogic(inclinedSection); } } } diff --git a/StructureHelper/Windows/Graphs/SaveCopyFWElementViewModel.cs b/StructureHelper/Windows/Graphs/SaveCopyFWElementViewModel.cs new file mode 100644 index 0000000..f0cde09 --- /dev/null +++ b/StructureHelper/Windows/Graphs/SaveCopyFWElementViewModel.cs @@ -0,0 +1,24 @@ +using StructureHelper.Infrastructure; +using System.Windows; +using System.Windows.Input; + +namespace StructureHelper.Windows.Graphs +{ + public class SaveCopyFWElementViewModel : ViewModelBase + { + private IFrameWorkElementServiseLogic frameWorkElementServiseLogic = new FrameWorkElementServiseLogic(); + private RelayCommand saveImageCommand; + private RelayCommand copyToClipboardCommand; + + public ICommand SaveAsImageCommand + { + get => saveImageCommand ??= new RelayCommand(o => frameWorkElementServiseLogic.SaveImageToFile(FrameWorkElement)); + } + + public ICommand CopyToClipboardCommand + { + get => copyToClipboardCommand ??= new RelayCommand(o => frameWorkElementServiseLogic.CopyImageToClipboard(FrameWorkElement)); + } + public FrameworkElement FrameWorkElement { get; set; } + } +} diff --git a/StructureHelper/Windows/UserControls/WorkPlane.xaml.cs b/StructureHelper/Windows/UserControls/WorkPlane.xaml.cs index e5eaba0..289725b 100644 --- a/StructureHelper/Windows/UserControls/WorkPlane.xaml.cs +++ b/StructureHelper/Windows/UserControls/WorkPlane.xaml.cs @@ -2,21 +2,9 @@ using StructureHelper.Infrastructure.UI.DataContexts; using StructureHelper.Windows.Graphs; using StructureHelper.Windows.MainWindow; -using StructureHelper.Windows.ViewModels.Materials; -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 StructureHelper.Windows.UserControls { diff --git a/StructureHelper/Windows/UserControls/WorkPlanes/PrimitiveTemplateSelector.cs b/StructureHelper/Windows/UserControls/WorkPlanes/PrimitiveTemplateSelector.cs index bdc0fef..4b4e644 100644 --- a/StructureHelper/Windows/UserControls/WorkPlanes/PrimitiveTemplateSelector.cs +++ b/StructureHelper/Windows/UserControls/WorkPlanes/PrimitiveTemplateSelector.cs @@ -12,6 +12,7 @@ namespace StructureHelper.Windows.UserControls.WorkPlanes public DataTemplate StirrupByDensityTemplate { get; set; } public DataTemplate StirrupByInclinedRebarTemplate { get; set; } public DataTemplate ConcentratedForceTemplate { get; set; } + public DataTemplate DistributedLoadTemplate { get; set; } public override DataTemplate SelectTemplate(object item, DependencyObject container) { @@ -23,6 +24,7 @@ namespace StructureHelper.Windows.UserControls.WorkPlanes StirrupByDensityPrimitive => StirrupByDensityTemplate, StirrupByInclinedRebarPrimitive => StirrupByInclinedRebarTemplate, ConcentratedForcePrimitive => ConcentratedForceTemplate, + DistributedLoadPrimitive => DistributedLoadTemplate, _ => base.SelectTemplate(item, container) }; } diff --git a/StructureHelper/Windows/UserControls/WorkPlanes/WorkPlaneConfigViewModel.cs b/StructureHelper/Windows/UserControls/WorkPlanes/WorkPlaneConfigViewModel.cs index 26add45..37f0f5e 100644 --- a/StructureHelper/Windows/UserControls/WorkPlanes/WorkPlaneConfigViewModel.cs +++ b/StructureHelper/Windows/UserControls/WorkPlanes/WorkPlaneConfigViewModel.cs @@ -1,11 +1,5 @@ using StructureHelper.Infrastructure; using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; using System.Windows; using System.Windows.Media; diff --git a/StructureHelper/Windows/UserControls/WorkPlanes/WorkPlaneRoot.xaml b/StructureHelper/Windows/UserControls/WorkPlanes/WorkPlaneRoot.xaml index 4eb681a..ab4040a 100644 --- a/StructureHelper/Windows/UserControls/WorkPlanes/WorkPlaneRoot.xaml +++ b/StructureHelper/Windows/UserControls/WorkPlanes/WorkPlaneRoot.xaml @@ -4,13 +4,33 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:StructureHelper.Windows.UserControls.WorkPlanes" + xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls" mc:Ignorable="d" d:DataContext="{d:DesignInstance local:WorkPlaneRootViewModel}" d:DesignHeight="450" d:DesignWidth="800"> - - + + + @@ -18,69 +38,72 @@ - - - - - - + + + + + + - - + - - + + - - + - - + - - - - - - - + + + + + + + - - + - + - - - - - - + + + + + + diff --git a/StructureHelper/Windows/UserControls/WorkPlanes/WorkPlaneRoot.xaml.cs b/StructureHelper/Windows/UserControls/WorkPlanes/WorkPlaneRoot.xaml.cs index 3e5e84a..43cf594 100644 --- a/StructureHelper/Windows/UserControls/WorkPlanes/WorkPlaneRoot.xaml.cs +++ b/StructureHelper/Windows/UserControls/WorkPlanes/WorkPlaneRoot.xaml.cs @@ -1,4 +1,5 @@ -using System; +using StructureHelper.Windows.Graphs; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -21,6 +22,8 @@ namespace StructureHelper.Windows.UserControls.WorkPlanes public partial class WorkPlaneRoot : UserControl { private Point? _lastPanPoint; + public SaveCopyFWElementViewModel SaveCopyViewModel { get; } = new(); + public WorkPlaneRoot() { InitializeComponent(); @@ -28,6 +31,7 @@ namespace StructureHelper.Windows.UserControls.WorkPlanes this.MouseDown += WorkPlaneRoot_MouseDown; this.MouseMove += WorkPlaneRoot_MouseMove; this.MouseUp += WorkPlaneRoot_MouseUp; + SaveCopyViewModel.FrameWorkElement = WorkPlaneGrid; } diff --git a/StructureHelper/Windows/UserControls/WorkPlanes/WorkPlaneRootViewModel.cs b/StructureHelper/Windows/UserControls/WorkPlanes/WorkPlaneRootViewModel.cs index 8deddec..6984abf 100644 --- a/StructureHelper/Windows/UserControls/WorkPlanes/WorkPlaneRootViewModel.cs +++ b/StructureHelper/Windows/UserControls/WorkPlanes/WorkPlaneRootViewModel.cs @@ -1,9 +1,5 @@ using StructureHelper.Infrastructure; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using StructureHelper.Windows.Graphs; namespace StructureHelper.Windows.UserControls.WorkPlanes { @@ -11,5 +7,6 @@ namespace StructureHelper.Windows.UserControls.WorkPlanes { public WorkPlaneConfigViewModel WorkPlaneConfig { get; } = new(); public PrimitiveCollectionViewModel PrimitiveCollection { get; } = new(); + //public SaveCopyFWElementViewModel SaveCopyViewModel { get; } = new(); } }