Add work plane property saving
This commit is contained in:
@@ -66,7 +66,7 @@ namespace DataAccess.DTOs
|
||||
TraceLogger?.AddMessage($"Current version of StructureHelper does not suppurt saving interaction diagram calculator, {limitCalculator.Name} was ignored");
|
||||
}
|
||||
string errorString = ErrorStrings.ObjectTypeIsUnknownObj(source);
|
||||
TraceLogger.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
throw new StructureHelperException(errorString);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using DataAccess.DTOs.Converters;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Loggers;
|
||||
using StructureHelperCommon.Models.WorkPlanes;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -12,23 +15,24 @@ namespace DataAccess.DTOs
|
||||
{
|
||||
public class CrossSectionFromDTOConvertStrategy : IConvertStrategy<ICrossSection, ICrossSection>
|
||||
{
|
||||
private readonly IConvertStrategy<ICrossSectionRepository, ICrossSectionRepository> convertStrategy;
|
||||
private IConvertStrategy<ICrossSectionRepository, ICrossSectionRepository> repositoryConvertStrategy;
|
||||
private IConvertStrategy<WorkPlaneProperty, WorkPlanePropertyDTO> workPlaneConvertStrategy;
|
||||
|
||||
public CrossSectionFromDTOConvertStrategy(IConvertStrategy<ICrossSectionRepository, ICrossSectionRepository> convertStrategy)
|
||||
public CrossSectionFromDTOConvertStrategy(IConvertStrategy<ICrossSectionRepository, ICrossSectionRepository> repositoryConvertStrategy,
|
||||
IConvertStrategy<WorkPlaneProperty, WorkPlanePropertyDTO> workPlaneConvertStrategy)
|
||||
{
|
||||
this.convertStrategy = convertStrategy;
|
||||
this.repositoryConvertStrategy = repositoryConvertStrategy;
|
||||
this.workPlaneConvertStrategy = workPlaneConvertStrategy;
|
||||
}
|
||||
|
||||
public CrossSectionFromDTOConvertStrategy() : this (new CrossSectionRepositoryFromDTOConvertStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
public CrossSectionFromDTOConvertStrategy() { }
|
||||
|
||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||
public IShiftTraceLogger TraceLogger { get; set; }
|
||||
|
||||
public ICrossSection Convert(ICrossSection source)
|
||||
{
|
||||
InitializeStrategies();
|
||||
try
|
||||
{
|
||||
Check();
|
||||
@@ -42,20 +46,38 @@ namespace DataAccess.DTOs
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeStrategies()
|
||||
{
|
||||
repositoryConvertStrategy ??= new CrossSectionRepositoryFromDTOConvertStrategy(ReferenceDictionary, TraceLogger);
|
||||
workPlaneConvertStrategy ??= new WorkPlanePropertyFromDTOConvertStrategy(ReferenceDictionary,TraceLogger);
|
||||
}
|
||||
|
||||
private ICrossSection GetNewCrossSection(ICrossSection source)
|
||||
{
|
||||
TraceLogger?.AddMessage("Cross-Section converting is started", TraceLogStatuses.Service);
|
||||
CrossSection newItem = new(source.Id);
|
||||
convertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||
convertStrategy.TraceLogger = TraceLogger;
|
||||
newItem.SectionRepository = GetNewCrossSectionRepository(source.SectionRepository);
|
||||
TraceLogger?.AddMessage("Cross-Section converting has been finished successfully", TraceLogStatuses.Service);
|
||||
if (source.WorkPlaneProperty is null)
|
||||
{
|
||||
TraceLogger?.AddMessage("Work plane properties is not found", TraceLogStatuses.Warning);
|
||||
newItem.WorkPlaneProperty = new WorkPlaneProperty(Guid.NewGuid());
|
||||
TraceLogger?.AddMessage("New work plane properties were generated", TraceLogStatuses.Debug);
|
||||
}
|
||||
else if (source.WorkPlaneProperty is WorkPlanePropertyDTO dto)
|
||||
{
|
||||
newItem.WorkPlaneProperty = workPlaneConvertStrategy.Convert(dto);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source.WorkPlaneProperty));
|
||||
}
|
||||
return newItem;
|
||||
}
|
||||
|
||||
private ICrossSectionRepository GetNewCrossSectionRepository(ICrossSectionRepository source)
|
||||
{
|
||||
ICrossSectionRepository newItem = convertStrategy.Convert(source);
|
||||
ICrossSectionRepository newItem = repositoryConvertStrategy.Convert(source);
|
||||
TraceLogger?.AddMessage($"Object of type <<{newItem.GetType()}>> was obtained", TraceLogStatuses.Service);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace DataAccess.DTOs.Converters
|
||||
try
|
||||
{
|
||||
Check();
|
||||
ICrossSectionNdmAnalysis newItem = GetCrossSectinNDMAnalysis(source);
|
||||
ICrossSectionNdmAnalysis newItem = GetCrossSectionNDMAnalysis(source);
|
||||
return newItem;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -46,7 +46,7 @@ namespace DataAccess.DTOs.Converters
|
||||
|
||||
}
|
||||
|
||||
private ICrossSectionNdmAnalysis GetCrossSectinNDMAnalysis(ICrossSectionNdmAnalysis source)
|
||||
private ICrossSectionNdmAnalysis GetCrossSectionNDMAnalysis(ICrossSectionNdmAnalysis source)
|
||||
{
|
||||
TraceLogger?.AddMessage("Cross-section sonverting is started");
|
||||
CrossSectionNdmAnalysis newItem = new(source.Id);
|
||||
|
||||
@@ -26,6 +26,10 @@ namespace DataAccess.DTOs
|
||||
private IHasPrimitivesProcessLogic primitivesProcessLogic = new HasPrimitivesProcessLogic(ConvertDirection.FromDTO);
|
||||
private IHasForceActionsProcessLogic actionsProcessLogic = new HasForceActionsProcessLogic(ConvertDirection.FromDTO);
|
||||
|
||||
public CrossSectionRepositoryFromDTOConvertStrategy(Dictionary<(Guid id, Type type), ISaveable> referenceDictionary, IShiftTraceLogger traceLogger) : base(referenceDictionary, traceLogger)
|
||||
{
|
||||
}
|
||||
|
||||
public override CrossSectionRepository GetNewItem(ICrossSectionRepository source)
|
||||
{
|
||||
TraceLogger?.AddMessage("Cross-Section repository" + convertStarted);
|
||||
|
||||
@@ -19,10 +19,10 @@ namespace DataAccess.DTOs
|
||||
this.materialConvertStrategy = materialConvertStrategy;
|
||||
}
|
||||
|
||||
public CrossSectionRepositoryToDTOConvertStrategy() : this(
|
||||
new HeadMaterialToDTOConvertStrategy())
|
||||
public CrossSectionRepositoryToDTOConvertStrategy(Dictionary<(Guid id, Type type), ISaveable> referenceDictionary, IShiftTraceLogger traceLogger)
|
||||
{
|
||||
|
||||
ReferenceDictionary = referenceDictionary;
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||
@@ -31,6 +31,7 @@ namespace DataAccess.DTOs
|
||||
public CrossSectionRepositoryDTO Convert(ICrossSectionRepository source)
|
||||
{
|
||||
Check();
|
||||
InitializeStrategies();
|
||||
try
|
||||
{
|
||||
CrossSectionRepositoryDTO newItem = GetNewRepository(source);
|
||||
@@ -44,6 +45,11 @@ namespace DataAccess.DTOs
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeStrategies()
|
||||
{
|
||||
materialConvertStrategy ??= new HeadMaterialToDTOConvertStrategy();
|
||||
}
|
||||
|
||||
private CrossSectionRepositoryDTO GetNewRepository(ICrossSectionRepository source)
|
||||
{
|
||||
CrossSectionRepositoryDTO newItem = new()
|
||||
|
||||
@@ -1,49 +1,32 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using DataAccess.DTOs.Converters;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.WorkPlanes;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class CrossSectionToDTOConvertStrategy : IConvertStrategy<CrossSectionDTO, ICrossSection>
|
||||
public class CrossSectionToDTOConvertStrategy : ConvertStrategy<CrossSectionDTO, ICrossSection>
|
||||
{
|
||||
private IUpdateStrategy<ICrossSection> updateStrategy; //don't use since CrossSection does not have any properties
|
||||
private IConvertStrategy<CrossSectionRepositoryDTO, ICrossSectionRepository> convertRepositoryStrategy;
|
||||
private DictionaryConvertStrategy<CrossSectionRepositoryDTO, ICrossSectionRepository> convertLogic;
|
||||
private ICheckConvertLogic<CrossSectionDTO, ICrossSection> checkLogic;
|
||||
|
||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||
public IShiftTraceLogger TraceLogger { get; set; }
|
||||
private IConvertStrategy<WorkPlanePropertyDTO, IWorkPlaneProperty> workPlanePropertyConvertStrategy;
|
||||
|
||||
public CrossSectionToDTOConvertStrategy(IUpdateStrategy<ICrossSection> updateStrategy,
|
||||
IConvertStrategy<CrossSectionRepositoryDTO, ICrossSectionRepository> convertRepositoryStrategy,
|
||||
ICheckConvertLogic<CrossSectionDTO, ICrossSection> checkLogic)
|
||||
ICheckConvertLogic<CrossSectionDTO, ICrossSection> checkLogic,
|
||||
IConvertStrategy<WorkPlanePropertyDTO, IWorkPlaneProperty> workPlanePropertyConvertStrategy)
|
||||
{
|
||||
this.updateStrategy = updateStrategy;
|
||||
this.convertRepositoryStrategy = convertRepositoryStrategy;
|
||||
this.checkLogic = checkLogic;
|
||||
this.workPlanePropertyConvertStrategy = workPlanePropertyConvertStrategy;
|
||||
}
|
||||
|
||||
public CrossSectionToDTOConvertStrategy() : this(
|
||||
new CrossSectionUpdateStrategy(),
|
||||
new CrossSectionRepositoryToDTOConvertStrategy(),
|
||||
new CheckConvertLogic<CrossSectionDTO, ICrossSection>())
|
||||
{
|
||||
public CrossSectionToDTOConvertStrategy() { }
|
||||
|
||||
}
|
||||
|
||||
public CrossSectionDTO Convert(ICrossSection source)
|
||||
{
|
||||
Check();
|
||||
CrossSectionDTO newItem = new()
|
||||
{
|
||||
Id = source.Id
|
||||
};
|
||||
convertRepositoryStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||
convertRepositoryStrategy.TraceLogger = TraceLogger;
|
||||
convertLogic = new DictionaryConvertStrategy<CrossSectionRepositoryDTO, ICrossSectionRepository>(this, convertRepositoryStrategy);
|
||||
newItem.SectionRepository = convertLogic.Convert(source.SectionRepository);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
private void Check()
|
||||
{
|
||||
@@ -51,5 +34,40 @@ namespace DataAccess.DTOs
|
||||
checkLogic.TraceLogger = TraceLogger;
|
||||
checkLogic.Check();
|
||||
}
|
||||
|
||||
public override CrossSectionDTO GetNewItem(ICrossSection source)
|
||||
{
|
||||
InitializeStrategies();
|
||||
try
|
||||
{
|
||||
GetNewItemBySource(source);
|
||||
return NewItem;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TraceErrorByEntity(this, ex.Message);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeStrategies()
|
||||
{
|
||||
updateStrategy ??= new CrossSectionUpdateStrategy();
|
||||
convertRepositoryStrategy ??= new CrossSectionRepositoryToDTOConvertStrategy(ReferenceDictionary, TraceLogger);
|
||||
checkLogic ??= new CheckConvertLogic<CrossSectionDTO, ICrossSection>();
|
||||
workPlanePropertyConvertStrategy ??= new WorkPlanePropertyToDTOConvertStrategy(ReferenceDictionary, TraceLogger);
|
||||
}
|
||||
|
||||
private void GetNewItemBySource(ICrossSection source)
|
||||
{
|
||||
Check();
|
||||
NewItem = new()
|
||||
{
|
||||
Id = source.Id
|
||||
};
|
||||
convertLogic = new DictionaryConvertStrategy<CrossSectionRepositoryDTO, ICrossSectionRepository>(this, convertRepositoryStrategy);
|
||||
NewItem.SectionRepository = convertLogic.Convert(source.SectionRepository);
|
||||
NewItem.WorkPlaneProperty = workPlanePropertyConvertStrategy.Convert(source.WorkPlaneProperty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,10 +25,10 @@ namespace DataAccess.DTOs
|
||||
public override FactoredCombinationPropertyDTO GetNewItem(IFactoredCombinationProperty source)
|
||||
{
|
||||
InitializeStrategies();
|
||||
TraceLogger.AddMessage($"Force factored combination property Id={source.Id} converting has been started");
|
||||
TraceLogger?.AddMessage($"Force factored combination property Id={source.Id} converting has been started");
|
||||
FactoredCombinationPropertyDTO newItem = new(source.Id);
|
||||
updateStrategy.Update(newItem, source);
|
||||
TraceLogger.AddMessage($"Force factored combination property Id={newItem.Id} converting has been finished");
|
||||
TraceLogger?.AddMessage($"Force factored combination property Id={newItem.Id} converting has been finished");
|
||||
return newItem;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace DataAccess.DTOs
|
||||
else
|
||||
{
|
||||
string errorString = ErrorStrings.ObjectTypeIsUnknownObj(source);
|
||||
TraceLogger.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
throw new StructureHelperException(errorString);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.WorkPlanes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs.Converters
|
||||
{
|
||||
public class WorkPlanePropertyFromDTOConvertStrategy : ConvertStrategy<WorkPlaneProperty, WorkPlanePropertyDTO>
|
||||
{
|
||||
private IUpdateStrategy<IWorkPlaneProperty> updateStrategy;
|
||||
public WorkPlanePropertyFromDTOConvertStrategy(Dictionary<(Guid id, Type type), ISaveable> referenceDictionary,
|
||||
IShiftTraceLogger traceLogger)
|
||||
: base(referenceDictionary, traceLogger)
|
||||
{ }
|
||||
|
||||
public override WorkPlaneProperty GetNewItem(WorkPlanePropertyDTO source)
|
||||
{
|
||||
InitializeStrategies();
|
||||
try
|
||||
{
|
||||
GetNewItemBySource(source);
|
||||
return NewItem;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TraceErrorByEntity(this, ex.Message);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private void GetNewItemBySource(IWorkPlaneProperty source)
|
||||
{
|
||||
NewItem = new(source.Id);
|
||||
updateStrategy.Update(NewItem, source);
|
||||
}
|
||||
|
||||
private void InitializeStrategies()
|
||||
{
|
||||
updateStrategy ??= new WorkPlanePropertyUpdateStrategy();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.WorkPlanes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs.Converters
|
||||
{
|
||||
public class WorkPlanePropertyToDTOConvertStrategy : ConvertStrategy<WorkPlanePropertyDTO, IWorkPlaneProperty>
|
||||
{
|
||||
private IUpdateStrategy<IWorkPlaneProperty> updateStrategy;
|
||||
public WorkPlanePropertyToDTOConvertStrategy(Dictionary<(Guid id, Type type), ISaveable> referenceDictionary,
|
||||
IShiftTraceLogger traceLogger)
|
||||
{
|
||||
ReferenceDictionary = referenceDictionary;
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
public override WorkPlanePropertyDTO GetNewItem(IWorkPlaneProperty source)
|
||||
{
|
||||
InitializeStrategies();
|
||||
try
|
||||
{
|
||||
GetNewItemBySource(source);
|
||||
return NewItem;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TraceErrorByEntity(this, ex.Message);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private void GetNewItemBySource(IWorkPlaneProperty source)
|
||||
{
|
||||
NewItem = new(source.Id);
|
||||
updateStrategy.Update(NewItem, source);
|
||||
}
|
||||
|
||||
private void InitializeStrategies()
|
||||
{
|
||||
updateStrategy ??= new WorkPlanePropertyUpdateStrategy();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Newtonsoft.Json;
|
||||
using StructureHelperCommon.Models.WorkPlanes;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -15,6 +16,8 @@ namespace DataAccess.DTOs
|
||||
[JsonProperty("SectionRepository")]
|
||||
public ICrossSectionRepository SectionRepository { get; set; }
|
||||
|
||||
public IWorkPlaneProperty WorkPlaneProperty { get; set; }
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
@@ -89,6 +89,7 @@ namespace DataAccess.DTOs
|
||||
{ (typeof(VisualAnalysisDTO), "VisualAnalysis") },
|
||||
{ (typeof(VisualPropertyDTO), "VisualProperty") },
|
||||
{ (typeof(UserCrackInputDataDTO), "UserCrackInputData") },
|
||||
{ (typeof(WorkPlanePropertyDTO), "WorkPlanePropertyDTO") },
|
||||
};
|
||||
return newList;
|
||||
}
|
||||
|
||||
31
DataAccess/DTOs/DTOEntities/WorkPlanePropertyDTO.cs
Normal file
31
DataAccess/DTOs/DTOEntities/WorkPlanePropertyDTO.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Newtonsoft.Json;
|
||||
using StructureHelperCommon.Models.WorkPlanes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class WorkPlanePropertyDTO : IWorkPlaneProperty
|
||||
{
|
||||
[JsonProperty("Id")]
|
||||
public Guid Id { get; }
|
||||
[JsonProperty("GridSize")]
|
||||
public double GridSize { get; set; } = 0.05;
|
||||
[JsonProperty("Width")]
|
||||
public double Width { get; set; } = 1.2;
|
||||
[JsonProperty("Height")]
|
||||
public double Height { get; set; } = 1.2;
|
||||
[JsonProperty("AxisLineThickness")]
|
||||
public double AxisLineThickness { get; set; } = 2;
|
||||
[JsonProperty("GridLineThickness")]
|
||||
public double GridLineThickness { get; set; } = 0.25;
|
||||
|
||||
public WorkPlanePropertyDTO(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/GraphsTemplates.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/LimitCurveTemplates.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/ServiceColors.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/ScrollableWorkPlane.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
|
||||
@@ -130,6 +130,30 @@
|
||||
<Setter Property="StrokeThickness" Value="1"/>
|
||||
</Style>
|
||||
|
||||
<DataTemplate x:Key="AddEntity">
|
||||
<Canvas Style="{DynamicResource ButtonResultCanvas}">
|
||||
<Canvas.Children>
|
||||
<Line X1="16" Y1="4" X2="16" Y2="26" Stroke="Black" StrokeThickness="2"/>
|
||||
<Line X1="4" Y1="16" X2="26" Y2="16" Stroke="Black" StrokeThickness="2"/>
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="CopyAnalysis">
|
||||
<Canvas Style="{DynamicResource ButtonResultCanvas}">
|
||||
<Canvas.Children>
|
||||
<Ellipse Width="16" Height="16" Fill="LightGray" Stroke="Black" StrokeThickness="1" Margin="12,12,0,0"/>
|
||||
<Ellipse Width="18" Height="18" Fill="White" Stroke="Black" StrokeThickness="1" Margin="3,3,0,0"/>
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="DeleteEntity">
|
||||
<Canvas Style="{DynamicResource ButtonResultCanvas}">
|
||||
<Canvas.Children>
|
||||
<Line X1="4" Y1="4" X2="26" Y2="26" Stroke="Black" StrokeThickness="2"/>
|
||||
<Line X1="4" Y1="26" X2="26" Y2="4" Stroke="Black" StrokeThickness="2"/>
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="OkCancelButtons">
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
@@ -544,14 +568,6 @@
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="CopyAnalysis">
|
||||
<Canvas Style="{DynamicResource ButtonResultCanvas}">
|
||||
<Canvas.Children>
|
||||
<Ellipse Width="16" Height="16" Fill="LightGray" Stroke="Black" StrokeThickness="1" Margin="12,12,0,0"/>
|
||||
<Ellipse Width="18" Height="18" Fill="White" Stroke="Black" StrokeThickness="1" Margin="3,3,0,0"/>
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="AnalysisVersions">
|
||||
<Canvas Style="{DynamicResource ButtonResultCanvas}">
|
||||
@@ -579,14 +595,6 @@
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="DeleteAnalysis">
|
||||
<Canvas Style="{DynamicResource ButtonResultCanvas}">
|
||||
<Canvas.Children>
|
||||
<Line X1="4" Y1="4" X2="26" Y2="26" Stroke="Black" StrokeThickness="2"/>
|
||||
<Line X1="4" Y1="26" X2="26" Y2="4" Stroke="Black" StrokeThickness="2"/>
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="Restore">
|
||||
<Canvas Style="{DynamicResource ButtonResultCanvas}">
|
||||
@@ -641,7 +649,7 @@
|
||||
<DataTemplate x:Key="RestoreAndDelete">
|
||||
<Canvas Style="{DynamicResource ButtonResultCanvas}">
|
||||
<Canvas.Children>
|
||||
<ContentControl ContentTemplate="{DynamicResource DeleteAnalysis}"/>
|
||||
<ContentControl ContentTemplate="{DynamicResource DeleteEntity}"/>
|
||||
<ContentControl ContentTemplate="{DynamicResource Back}"/>
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:enums="clr-namespace:StructureHelper.Infrastructure.Enums"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:infrastructure="clr-namespace:StructureHelper.Infrastructure"
|
||||
xmlns:mouseEventTriggers="clr-namespace:StructureHelper.Infrastructure.UI.Triggers.MouseEventTriggers">
|
||||
<ContextMenu x:Key="PrimitiveCRUD">
|
||||
<MenuItem Header="Edit" Command="{Binding Edit}">
|
||||
<MenuItem.Icon>
|
||||
<Image Width="16" Height="16" Source="/Windows/MainWindow/Edit.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Copy" Command="{Binding Copy}">
|
||||
<MenuItem.Icon>
|
||||
<Image Width="16" Height="16" Source="/Windows/MainWindow/Copy.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Copy To" Command="{Binding CopyTo}">
|
||||
<MenuItem.Icon>
|
||||
<Image Width="16" Height="16" Source="/Windows/MainWindow/Copy.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Delete" Command="{Binding Delete}">
|
||||
<MenuItem.Icon>
|
||||
<Image Width="16" Height="16" Source="/Windows/MainWindow/Delete.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator/>
|
||||
<MenuItem Header="To Foreground" Command="{Binding SetToFront}">
|
||||
<MenuItem.Icon>
|
||||
<Image Width="16" Height="16" Source="/Windows/MainWindow/ToForeground.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="To Background" Command="{Binding SetToBack}">
|
||||
<MenuItem.Icon>
|
||||
<Image Width="16" Height="16" Source="/Windows/MainWindow/ToBackground.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</ResourceDictionary>
|
||||
@@ -102,6 +102,9 @@
|
||||
<Compile Update="Windows\UserControls\MultiplyDouble.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Windows\UserControls\WorkPlane.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Update="Infrastructure\UI\Resources\Cracks.xaml">
|
||||
@@ -122,6 +125,9 @@
|
||||
<Page Update="Infrastructure\UI\Resources\Materials.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Infrastructure\UI\Resources\ScrollableWorkPlane.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Infrastructure\UI\Resources\ServiceColors.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
@@ -221,5 +227,8 @@
|
||||
<Page Update="Windows\UserControls\MultiplyDouble.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Windows\UserControls\WorkPlane.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -7,7 +7,7 @@
|
||||
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
|
||||
d:DataContext="{d:DesignInstance local:ForceCombinationByFactorVM}"
|
||||
mc:Ignorable="d"
|
||||
Title="Force Combination By Factor" Height="220" Width="350" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
|
||||
Title="Force Combination By Factor" Height="250" Width="350" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
|
||||
d:DataContext="{d:DesignInstance local:ForceCombinationFromFileVM}"
|
||||
mc:Ignorable="d"
|
||||
Title="Force Combination By Files" Height="280" Width="350" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
|
||||
Title="Force Combination By Files" Height="330" Width="350" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
@@ -20,8 +20,13 @@
|
||||
<ContentControl ContentTemplate="{StaticResource ResourceKey=ForceActionNameTemplate}" Content="{Binding}"/>
|
||||
<TextBlock Text="List of Files"/>
|
||||
<Grid>
|
||||
<uc:ListOfFileControl DataContext="{Binding Files}"/>
|
||||
<uc:ListOfFileControl Height="130" DataContext="{Binding Files}"/>
|
||||
</Grid>
|
||||
<Image Grid.Row="2" Height="50" Width="50" Stretch="UniformToFill" Source="/Windows/Forces/Forces.jpg" HorizontalAlignment="Left">
|
||||
<Image.ToolTip>
|
||||
<Image Height="250" Width="250" Stretch="UniformToFill" Source="/Windows/Forces/Forces.jpg"/>
|
||||
</Image.ToolTip>
|
||||
</Image>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
<TabItem Header="Force Point">
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:StructureHelper.Windows.Forces"
|
||||
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Forces"
|
||||
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
|
||||
d:DataContext="{d:DesignInstance vm:ForceCombinationViewModel}"
|
||||
mc:Ignorable="d"
|
||||
Title="Force Combination" Height="350" Width="550" MinHeight="300" MinWidth="450" MaxWidth="500" WindowStartupLocation="CenterScreen">
|
||||
@@ -12,13 +13,70 @@
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="95"/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="35"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TabControl>
|
||||
<TabItem Header="Main">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="50"/>
|
||||
</Grid.RowDefinitions>
|
||||
<!--ForceTemplates.xaml-->
|
||||
<ContentControl ContentTemplate="{StaticResource ResourceKey=ForceActionTemplate}" Content="{Binding}"/>
|
||||
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource ResourceKey=CombinationListTemplateWithButton}" Content="{Binding}"/>
|
||||
<ContentControl ContentTemplate="{StaticResource ResourceKey=ForceActionNameTemplate}" Content="{Binding}"/>
|
||||
<DockPanel Grid.Row="1" DataContext="{Binding DesignForces}">
|
||||
<ToolBarTray DockPanel.Dock="Top">
|
||||
<ToolBar>
|
||||
<Button Style="{StaticResource ToolButton24}" Command="{Binding Add}">
|
||||
<Button.ToolTip>
|
||||
<uc:ButtonToolTipEh HeaderText="Add combination"
|
||||
IconContent="{StaticResource AddEntity}"
|
||||
DescriptionText="Adds new combination of forces"/>
|
||||
</Button.ToolTip>
|
||||
<Viewbox Width="24" Height="24">
|
||||
<ContentControl ContentTemplate="{DynamicResource AddEntity}"/>
|
||||
</Viewbox>
|
||||
</Button>
|
||||
<Button Style="{StaticResource ToolButton24}" Command="{Binding Copy}">
|
||||
<Button.ToolTip>
|
||||
<uc:ButtonToolTipEh HeaderText="Copy Analysis"
|
||||
IconContent="{StaticResource CopyAnalysis}"
|
||||
DescriptionText="Creates copy of selected analysis"/>
|
||||
</Button.ToolTip>
|
||||
<Viewbox Width="24" Height="24">
|
||||
<ContentControl ContentTemplate="{DynamicResource CopyAnalysis}"/>
|
||||
</Viewbox>
|
||||
</Button>
|
||||
<Button Style="{StaticResource ToolButton24}" Command="{Binding Delete}">
|
||||
<Button.ToolTip>
|
||||
<uc:ButtonToolTipEh HeaderText="Delete Analysis"
|
||||
IconContent="{StaticResource DeleteEntity }"
|
||||
DescriptionText="Delete selected analysis"/>
|
||||
</Button.ToolTip>
|
||||
<Viewbox Width="24" Height="24">
|
||||
<ContentControl ContentTemplate="{DynamicResource DeleteEntity}"/>
|
||||
</Viewbox>
|
||||
</Button>
|
||||
</ToolBar>
|
||||
</ToolBarTray>
|
||||
<Grid>
|
||||
<ContentControl ContentTemplate="{StaticResource ResourceKey=CombinationListTemplate}" Content="{Binding}"/>
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
<Image Grid.Row="2" Height="50" Width="50" Stretch="UniformToFill" Source="/Windows/Forces/Forces.jpg" HorizontalAlignment="Left">
|
||||
<Image.ToolTip>
|
||||
<Image Height="250" Width="250" Stretch="UniformToFill" Source="/Windows/Forces/Forces.jpg"/>
|
||||
</Image.ToolTip>
|
||||
</Image>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="Force point">
|
||||
<!--ForceTemplates.xaml-->
|
||||
<ContentControl Height="80" ContentTemplate="{StaticResource ResourceKey=ForceActionPointTemplate}" Content="{Binding}" VerticalAlignment="Top"/>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
<ContentControl Grid.Row="2" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
<ContentControl ContentTemplate="{DynamicResource DeSelectAll}"/>
|
||||
</Viewbox>
|
||||
</Button>
|
||||
<Button Style="{StaticResource ToolButton24}" Command="{Binding Add}" ToolTip="Inver Selection">
|
||||
<Button Style="{StaticResource ToolButton24}" Command="{Binding Add}" ToolTip="Invert Selection">
|
||||
<Viewbox Width="24" Height="24">
|
||||
<ContentControl ContentTemplate="{DynamicResource InvertSelection}"/>
|
||||
</Viewbox>
|
||||
@@ -133,11 +133,11 @@
|
||||
<Button Style="{StaticResource ToolButton24}" Command="{Binding DeleteCommand}">
|
||||
<Button.ToolTip>
|
||||
<uc:ButtonToolTipEh HeaderText="Delete Analysis"
|
||||
IconContent="{StaticResource DeleteAnalysis }"
|
||||
IconContent="{StaticResource DeleteEntity }"
|
||||
DescriptionText="Delete selected analysis"/>
|
||||
</Button.ToolTip>
|
||||
<Viewbox Width="24" Height="24">
|
||||
<ContentControl ContentTemplate="{DynamicResource DeleteAnalysis}"/>
|
||||
<ContentControl ContentTemplate="{DynamicResource DeleteEntity}"/>
|
||||
</Viewbox>
|
||||
</Button>
|
||||
</ToolBar>
|
||||
@@ -192,7 +192,7 @@
|
||||
<MenuItem Header="Delete" Command="{Binding DeleteCommand}" ToolTip="Delete analysis">
|
||||
<MenuItem.Icon>
|
||||
<Viewbox Height="16" Width="16">
|
||||
<ContentControl ContentTemplate="{StaticResource DeleteAnalysis}"/>
|
||||
<ContentControl ContentTemplate="{StaticResource DeleteEntity}"/>
|
||||
</Viewbox>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Windows.ViewModels;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Models.WorkPlanes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -13,24 +14,25 @@ namespace StructureHelper.Windows.MainWindow
|
||||
{
|
||||
public class AxisCanvasVM : OkCancelViewModelBase, IRectangleShape
|
||||
{
|
||||
private double axisLineThickness;
|
||||
private double gridLineThickness;
|
||||
private double gridSize;
|
||||
private double width;
|
||||
private double height;
|
||||
private Color xAxisColor;
|
||||
private Color yAxisColor;
|
||||
private Color gridColor;
|
||||
private IWorkPlaneProperty workPlaneProperty;
|
||||
|
||||
public AxisCanvasVM(IWorkPlaneProperty workPlaneProperty)
|
||||
{
|
||||
this.workPlaneProperty = workPlaneProperty;
|
||||
}
|
||||
private Color xAxisColor = Colors.Red;
|
||||
private Color yAxisColor = Colors.ForestGreen;
|
||||
private Color gridColor = Colors.DarkGray;
|
||||
|
||||
/// <summary>
|
||||
/// Thickness of x-, and y- axis line
|
||||
/// </summary>
|
||||
public double AxisLineThickness
|
||||
{
|
||||
get => axisLineThickness;
|
||||
get => workPlaneProperty.AxisLineThickness;
|
||||
set
|
||||
{
|
||||
axisLineThickness = value;
|
||||
workPlaneProperty.AxisLineThickness = value;
|
||||
OnPropertyChanged(nameof(AxisLineThickness));
|
||||
}
|
||||
}
|
||||
@@ -39,10 +41,10 @@ namespace StructureHelper.Windows.MainWindow
|
||||
/// </summary>
|
||||
public double GridLineThickness
|
||||
{
|
||||
get => gridLineThickness;
|
||||
get => workPlaneProperty.GridLineThickness;
|
||||
set
|
||||
{
|
||||
gridLineThickness = value;
|
||||
workPlaneProperty.GridLineThickness = value;
|
||||
OnPropertyChanged(nameof(GridLineThickness));
|
||||
}
|
||||
}
|
||||
@@ -51,9 +53,9 @@ namespace StructureHelper.Windows.MainWindow
|
||||
/// </summary>
|
||||
public double GridSize
|
||||
{
|
||||
get => gridSize; set
|
||||
get => workPlaneProperty.GridSize; set
|
||||
{
|
||||
gridSize = value;
|
||||
workPlaneProperty.GridSize = value;
|
||||
OnPropertyChanged(nameof(GridSize));
|
||||
}
|
||||
}
|
||||
@@ -62,9 +64,9 @@ namespace StructureHelper.Windows.MainWindow
|
||||
/// </summary>
|
||||
public double Width
|
||||
{
|
||||
get => width; set
|
||||
get => workPlaneProperty.Width; set
|
||||
{
|
||||
width = value;
|
||||
workPlaneProperty.Width = value;
|
||||
OnPropertyChanged(nameof(Width));
|
||||
}
|
||||
}
|
||||
@@ -73,9 +75,9 @@ namespace StructureHelper.Windows.MainWindow
|
||||
/// </summary>
|
||||
public double Height
|
||||
{
|
||||
get => height; set
|
||||
get => workPlaneProperty.Height; set
|
||||
{
|
||||
height = value;
|
||||
workPlaneProperty.Height = value;
|
||||
OnPropertyChanged(nameof(Height));
|
||||
}
|
||||
}
|
||||
@@ -101,7 +103,8 @@ namespace StructureHelper.Windows.MainWindow
|
||||
|
||||
public Color GridColor
|
||||
{
|
||||
get => gridColor; set
|
||||
get => gridColor;
|
||||
set
|
||||
{
|
||||
gridColor = value;
|
||||
OnPropertyChanged(nameof(GridColor));
|
||||
@@ -109,17 +112,5 @@ namespace StructureHelper.Windows.MainWindow
|
||||
}
|
||||
|
||||
public Guid Id => throw new NotImplementedException();
|
||||
|
||||
public AxisCanvasVM()
|
||||
{
|
||||
AxisLineThickness = 2d;
|
||||
GridLineThickness = 0.25d;
|
||||
GridSize = 0.05d;
|
||||
Width = 1.2d;
|
||||
Height = 1.2d;
|
||||
XAxisColor = Colors.Red;
|
||||
YAxisColor = Colors.ForestGreen;
|
||||
GridColor = Colors.DarkGray;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Models.WorkPlanes;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
@@ -148,9 +149,9 @@ namespace StructureHelper.Windows.MainWindow
|
||||
|
||||
public CrossSectionViewModel ParentViewModel { get; set; }
|
||||
|
||||
public CrossSectionVisualPropertyVM()
|
||||
public CrossSectionVisualPropertyVM(IWorkPlaneProperty workPlaneProperty)
|
||||
{
|
||||
AxisCanvasVM = new();
|
||||
AxisCanvasVM = new(workPlaneProperty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
xmlns:local="clr-namespace:StructureHelper.Windows.MainWindow"
|
||||
xmlns:enums="clr-namespace:StructureHelper.Infrastructure.Enums"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance local:CrossSectionViewModel}"
|
||||
@@ -43,39 +44,6 @@
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
<ContextMenu x:Key="PrimitiveCRUD">
|
||||
<MenuItem Header="Edit" Command="{Binding Edit}">
|
||||
<MenuItem.Icon>
|
||||
<Image Width="16" Height="16" Source="/Windows/MainWindow/Edit.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Copy" Command="{Binding Copy}">
|
||||
<MenuItem.Icon>
|
||||
<Image Width="16" Height="16" Source="/Windows/MainWindow/Copy.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Copy To" Command="{Binding CopyTo}">
|
||||
<MenuItem.Icon>
|
||||
<Image Width="16" Height="16" Source="/Windows/MainWindow/Copy.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Delete" Command="{Binding Delete}">
|
||||
<MenuItem.Icon>
|
||||
<Image Width="16" Height="16" Source="/Windows/MainWindow/Delete.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator/>
|
||||
<MenuItem Header="To Foreground" Command="{Binding SetToFront}">
|
||||
<MenuItem.Icon>
|
||||
<Image Width="16" Height="16" Source="/Windows/MainWindow/ToForeground.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="To Background" Command="{Binding SetToBack}">
|
||||
<MenuItem.Icon>
|
||||
<Image Width="16" Height="16" Source="/Windows/MainWindow/ToBackground.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
<ContextMenu x:Key="AnalisesCRUD">
|
||||
<MenuItem Header="Run" Command="{Binding Run}">
|
||||
<MenuItem.Icon>
|
||||
@@ -360,157 +328,8 @@
|
||||
<i:InvokeCommandAction Command="{Binding ClearSelection}" CommandParameter="{Binding}"/>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<ScrollViewer
|
||||
DataContext="{Binding VisualProperty}"
|
||||
VerticalScrollBarVisibility="Visible"
|
||||
HorizontalScrollBarVisibility="Visible">
|
||||
<Canvas Name="WorkPlane"
|
||||
ClipToBounds="True"
|
||||
Width="{Binding Width}"
|
||||
Height="{Binding Height}">
|
||||
<Canvas.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="Add" DataContext="{Binding ParentViewModel.PrimitiveLogic}">
|
||||
<MenuItem Header="Rectangle" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/Rectangle32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Circle" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Circle}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/Circle32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Rebar" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Reinforcement}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/Rebar32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Point" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Point}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/Point.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Templates" DataContext="{Binding ParentViewModel}">
|
||||
<MenuItem Header="Add Rectangle RC Column" Command="{Binding AddColumnCase}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/RectangleColumn32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Add Circle RC Column" Command="{Binding AddRCCircleCase}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/CircleColumn32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Add RC Beam" Command="{Binding AddBeamCase}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/Beam32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Add RC slab" Command="{Binding AddSlabCase}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/Slab32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</Canvas.ContextMenu>
|
||||
<i:Interaction.Behaviors>
|
||||
<infrastructure:MouseBehaviour MouseX="{Binding PanelX, Mode=OneWayToSource}" MouseY="{Binding PanelY, Mode=OneWayToSource}"/>
|
||||
</i:Interaction.Behaviors>
|
||||
<i:Interaction.Triggers>
|
||||
<mouseEventTriggers:MouseWheelDownEventTrigger EventName="PreviewMouseWheel">
|
||||
<i:InvokeCommandAction Command="{Binding ScaleCanvasDown}"/>
|
||||
</mouseEventTriggers:MouseWheelDownEventTrigger>
|
||||
<mouseEventTriggers:MouseWheelUpEventTrigger EventName="PreviewMouseWheel">
|
||||
<i:InvokeCommandAction Command="{Binding ScaleCanvasUp}"/>
|
||||
</mouseEventTriggers:MouseWheelUpEventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<Canvas.LayoutTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform ScaleX="{Binding ScaleValue}" ScaleY="{Binding ScaleValue}"
|
||||
CenterX="{Binding ScrollPanelX}" CenterY="{Binding ScrollPanelY}"/>
|
||||
</TransformGroup>
|
||||
</Canvas.LayoutTransform>
|
||||
<Canvas.Background>
|
||||
<VisualBrush TileMode="Tile"
|
||||
Viewport="{Binding CanvasViewportSize}" ViewportUnits="Absolute"
|
||||
Viewbox="{Binding CanvasViewportSize}" ViewboxUnits="Absolute">
|
||||
<VisualBrush.Visual>
|
||||
<Rectangle
|
||||
Height="{Binding GridSize}"
|
||||
Width="{Binding GridSize}"
|
||||
Stroke="{Binding GridColorBrush}"
|
||||
StrokeThickness="{Binding GridLineThickness}"/>
|
||||
</VisualBrush.Visual>
|
||||
</VisualBrush>
|
||||
</Canvas.Background>
|
||||
<!--Horizontal axis line-->
|
||||
<TextBlock Canvas.Left="0" Canvas.Top="{Binding HalfOfHeight}"
|
||||
Margin="0,0,0,0" Text="X" FontSize="{Binding MainTextFontSize}"
|
||||
Background="AliceBlue"
|
||||
Foreground="{Binding XAxisColorBrush}">
|
||||
<TextBlock.RenderTransform>
|
||||
<ScaleTransform ScaleX="{Binding TextScaleValue}" ScaleY="{Binding TextScaleValue}"/>
|
||||
</TextBlock.RenderTransform>
|
||||
</TextBlock>
|
||||
<TextBlock Canvas.Left="{Binding Width}" Canvas.Top="{Binding HalfOfHeight}"
|
||||
Margin="-0.02,0,0,0" Text="X" FontSize="{Binding MainTextFontSize}"
|
||||
Background="AliceBlue"
|
||||
Foreground="{Binding XAxisColorBrush}">
|
||||
<TextBlock.RenderTransform>
|
||||
<ScaleTransform ScaleX="{Binding TextScaleValue}" ScaleY="{Binding TextScaleValue}" />
|
||||
</TextBlock.RenderTransform>
|
||||
</TextBlock>
|
||||
<Line
|
||||
X1="0" X2="{Binding Width}"
|
||||
Y1="{Binding HalfOfHeight}" Y2="{Binding HalfOfHeight}"
|
||||
Stroke="{Binding XAxisColorBrush}"
|
||||
StrokeThickness="{Binding AxisLineThickness}"/>
|
||||
<!--Vertical axis line-->
|
||||
<TextBlock Canvas.Left="{Binding HalfOfWidth}" Canvas.Top="0"
|
||||
Margin="0.01,0,0,0" Text="Y" FontSize="{Binding MainTextFontSize}"
|
||||
Background="AliceBlue"
|
||||
Foreground="{Binding YAxisColorBrush}">
|
||||
<TextBlock.RenderTransform>
|
||||
<ScaleTransform ScaleX="{Binding TextScaleValue}" ScaleY="{Binding TextScaleValue}"/>
|
||||
</TextBlock.RenderTransform>
|
||||
</TextBlock>
|
||||
<TextBlock Canvas.Left="{Binding HalfOfWidth}" Canvas.Top="{Binding Height}"
|
||||
Margin="0.01,-0.05,0,0" Text="Y" FontSize="{Binding MainTextFontSize}"
|
||||
Background="AliceBlue"
|
||||
Foreground="{Binding YAxisColorBrush}">
|
||||
<TextBlock.RenderTransform>
|
||||
<ScaleTransform ScaleX="{Binding TextScaleValue}" ScaleY="{Binding TextScaleValue}" />
|
||||
</TextBlock.RenderTransform>
|
||||
</TextBlock>
|
||||
<Line
|
||||
X1="{Binding HalfOfWidth}" X2="{Binding HalfOfWidth}"
|
||||
Y1="0" Y2="{Binding Height}"
|
||||
Stroke="{Binding YAxisColorBrush}"
|
||||
StrokeThickness="{Binding AxisLineThickness}"/>
|
||||
<ItemsControl
|
||||
DataContext="{Binding ParentViewModel.PrimitiveLogic}"
|
||||
ItemsSource="{Binding Items}"
|
||||
ContextMenu="{StaticResource PrimitiveCRUD}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<Canvas/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemContainerStyle>
|
||||
<Style TargetType="ContentPresenter">
|
||||
<Setter Property="Canvas.ZIndex" Value="{Binding ZIndex}"/>
|
||||
<Setter Property="Canvas.Left" Value="{Binding PrimitiveLeft}"/>
|
||||
<Setter Property="Canvas.Top" Value="{Binding PrimitiveTop}"/>
|
||||
<Setter Property="Visibility" Value="{Binding IsVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||
<EventSetter Event="MouseDown" Handler="ContentPresenter_MouseLeftButtonDown"/>
|
||||
</Style>
|
||||
</ItemsControl.ItemContainerStyle>
|
||||
</ItemsControl>
|
||||
</Canvas>
|
||||
</ScrollViewer>
|
||||
<uc:WorkPlane ViewModel="{Binding}"/>
|
||||
<!--<ContentControl ContentTemplate="{StaticResource WorkPlane}" Content="{Binding VisualProperty}"/>-->
|
||||
</Border>
|
||||
</Grid>
|
||||
<StatusBar Grid.Row="1">
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace StructureHelper.Windows.MainWindow
|
||||
public CrossSectionViewModel(ICrossSection section)
|
||||
{
|
||||
Section = section;
|
||||
VisualProperty = new CrossSectionVisualPropertyVM()
|
||||
VisualProperty = new CrossSectionVisualPropertyVM(Section.WorkPlaneProperty)
|
||||
{
|
||||
ScaleValue = 500d,
|
||||
ParentViewModel = this
|
||||
@@ -300,7 +300,7 @@ namespace StructureHelper.Windows.MainWindow
|
||||
// GlobalRepository.Actions.Create(item);
|
||||
//}
|
||||
return primitives;
|
||||
|
||||
//WorkPlane
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,46 +12,46 @@
|
||||
<DockPanel>
|
||||
<ToolBarTray DockPanel.Dock="Top">
|
||||
<ToolBar>
|
||||
<Button Style="{StaticResource ToolButton}"
|
||||
<Button Style="{StaticResource ToolButton24}"
|
||||
Command="{Binding FileOpen}">
|
||||
<Button.ToolTip>
|
||||
<uc:ButtonToolTipEh HeaderText="Open file"
|
||||
IconContent="{StaticResource FileOpen}"
|
||||
DescriptionText="Open exsisting project from file"/>
|
||||
</Button.ToolTip>
|
||||
<Viewbox>
|
||||
<Viewbox Height="24" Width="24">
|
||||
<ContentControl ContentTemplate="{DynamicResource FileOpen}"/>
|
||||
</Viewbox>
|
||||
</Button>
|
||||
<Button Style="{StaticResource ToolButton}" Command="{Binding Delete}">
|
||||
<Button Style="{StaticResource ToolButton24}" Command="{Binding Delete}">
|
||||
<Button.ToolTip>
|
||||
<uc:ButtonToolTipEh HeaderText="Delete reference to file"
|
||||
IconContent="{StaticResource DeleteAnalysis }"
|
||||
IconContent="{StaticResource DeleteEntity }"
|
||||
DescriptionText="Deletes selected reference to file"/>
|
||||
</Button.ToolTip>
|
||||
<Viewbox>
|
||||
<ContentControl ContentTemplate="{DynamicResource DeleteAnalysis}"/>
|
||||
<Viewbox Height="24" Width="24">
|
||||
<ContentControl ContentTemplate="{DynamicResource DeleteEntity}"/>
|
||||
</Viewbox>
|
||||
</Button>
|
||||
<Button Style="{StaticResource ToolButton}"
|
||||
<Button Style="{StaticResource ToolButton24}"
|
||||
Command="{Binding ShowSettings}">
|
||||
<Button.ToolTip>
|
||||
<uc:ButtonToolTipEh HeaderText="Settings"
|
||||
IconContent="{StaticResource Settings}"
|
||||
DescriptionText="Shows settings of import of file"/>
|
||||
</Button.ToolTip>
|
||||
<Viewbox>
|
||||
<Viewbox Height="24" Width="24">
|
||||
<ContentControl ContentTemplate="{DynamicResource Settings}"/>
|
||||
</Viewbox>
|
||||
</Button>
|
||||
<Button Style="{StaticResource ToolButton}" Visibility="Hidden"
|
||||
<Button Style="{StaticResource ToolButton24}" Visibility="Hidden"
|
||||
Command="{Binding ShowDocument}">
|
||||
<Button.ToolTip>
|
||||
<uc:ButtonToolTipEh HeaderText="View file"
|
||||
IconContent="{StaticResource Report}"
|
||||
DescriptionText="Shows file data if it is possible"/>
|
||||
</Button.ToolTip>
|
||||
<Viewbox>
|
||||
<Viewbox Height="24" Width="24">
|
||||
<ContentControl ContentTemplate="{DynamicResource Report}"/>
|
||||
</Viewbox>
|
||||
</Button>
|
||||
|
||||
166
StructureHelper/Windows/UserControls/WorkPlane.xaml
Normal file
166
StructureHelper/Windows/UserControls/WorkPlane.xaml
Normal file
@@ -0,0 +1,166 @@
|
||||
<UserControl x:Class="StructureHelper.Windows.UserControls.WorkPlane"
|
||||
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:StructureHelper.Windows.UserControls"
|
||||
xmlns:enums="clr-namespace:StructureHelper.Infrastructure.Enums"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:infrastructure="clr-namespace:StructureHelper.Infrastructure"
|
||||
xmlns:mouseEventTriggers="clr-namespace:StructureHelper.Infrastructure.UI.Triggers.MouseEventTriggers"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<ScrollViewer
|
||||
DataContext="{Binding VisualProperty}"
|
||||
VerticalScrollBarVisibility="Visible"
|
||||
HorizontalScrollBarVisibility="Visible">
|
||||
<Canvas Name="WorkPlaneName"
|
||||
ClipToBounds="True"
|
||||
Width="{Binding Width}"
|
||||
Height="{Binding Height}">
|
||||
<Canvas.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="Add" DataContext="{Binding ParentViewModel.PrimitiveLogic}">
|
||||
<MenuItem Header="Rectangle" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/Rectangle32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Circle" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Circle}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/Circle32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Rebar" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Reinforcement}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/Rebar32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Point" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Point}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/Point32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Templates" DataContext="{Binding ParentViewModel}">
|
||||
<MenuItem Header="Add Rectangle RC Column" Command="{Binding AddColumnCase}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/RectangleColumn32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Add Circle RC Column" Command="{Binding AddRCCircleCase}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/CircleColumn32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Add RC Beam" Command="{Binding AddBeamCase}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/Beam32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Add RC slab" Command="{Binding AddSlabCase}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/Slab32.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</Canvas.ContextMenu>
|
||||
<i:Interaction.Behaviors>
|
||||
<infrastructure:MouseBehaviour MouseX="{Binding PanelX, Mode=OneWayToSource}" MouseY="{Binding PanelY, Mode=OneWayToSource}"/>
|
||||
</i:Interaction.Behaviors>
|
||||
<i:Interaction.Triggers>
|
||||
<mouseEventTriggers:MouseWheelDownEventTrigger EventName="PreviewMouseWheel">
|
||||
<i:InvokeCommandAction Command="{Binding ScaleCanvasDown}"/>
|
||||
</mouseEventTriggers:MouseWheelDownEventTrigger>
|
||||
<mouseEventTriggers:MouseWheelUpEventTrigger EventName="PreviewMouseWheel">
|
||||
<i:InvokeCommandAction Command="{Binding ScaleCanvasUp}"/>
|
||||
</mouseEventTriggers:MouseWheelUpEventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<Canvas.LayoutTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform ScaleX="{Binding ScaleValue}" ScaleY="{Binding ScaleValue}"
|
||||
CenterX="{Binding ScrollPanelX}" CenterY="{Binding ScrollPanelY}"/>
|
||||
</TransformGroup>
|
||||
</Canvas.LayoutTransform>
|
||||
<Canvas.Background>
|
||||
<VisualBrush TileMode="Tile"
|
||||
Viewport="{Binding CanvasViewportSize}" ViewportUnits="Absolute"
|
||||
Viewbox="{Binding CanvasViewportSize}" ViewboxUnits="Absolute">
|
||||
<VisualBrush.Visual>
|
||||
<Rectangle
|
||||
Height="{Binding GridSize}"
|
||||
Width="{Binding GridSize}"
|
||||
Stroke="{Binding GridColorBrush}"
|
||||
StrokeThickness="{Binding GridLineThickness}"/>
|
||||
</VisualBrush.Visual>
|
||||
</VisualBrush>
|
||||
</Canvas.Background>
|
||||
<!--Horizontal axis line-->
|
||||
<TextBlock Canvas.Left="0" Canvas.Top="{Binding HalfOfHeight}"
|
||||
Margin="0,0,0,0" Text="X" FontSize="{Binding MainTextFontSize}"
|
||||
Background="AliceBlue"
|
||||
Foreground="{Binding XAxisColorBrush}">
|
||||
<TextBlock.RenderTransform>
|
||||
<ScaleTransform ScaleX="{Binding TextScaleValue}" ScaleY="{Binding TextScaleValue}"/>
|
||||
</TextBlock.RenderTransform>
|
||||
</TextBlock>
|
||||
<TextBlock Canvas.Left="{Binding Width}" Canvas.Top="{Binding HalfOfHeight}"
|
||||
Margin="-0.02,0,0,0" Text="X" FontSize="{Binding MainTextFontSize}"
|
||||
Background="AliceBlue"
|
||||
Foreground="{Binding XAxisColorBrush}">
|
||||
<TextBlock.RenderTransform>
|
||||
<ScaleTransform ScaleX="{Binding TextScaleValue}" ScaleY="{Binding TextScaleValue}" />
|
||||
</TextBlock.RenderTransform>
|
||||
</TextBlock>
|
||||
<Line
|
||||
X1="0" X2="{Binding Width}"
|
||||
Y1="{Binding HalfOfHeight}" Y2="{Binding HalfOfHeight}"
|
||||
Stroke="{Binding XAxisColorBrush}"
|
||||
StrokeThickness="{Binding AxisLineThickness}"/>
|
||||
<!--Vertical axis line-->
|
||||
<TextBlock Canvas.Left="{Binding HalfOfWidth}" Canvas.Top="0"
|
||||
Margin="0.01,0,0,0" Text="Y" FontSize="{Binding MainTextFontSize}"
|
||||
Background="AliceBlue"
|
||||
Foreground="{Binding YAxisColorBrush}">
|
||||
<TextBlock.RenderTransform>
|
||||
<ScaleTransform ScaleX="{Binding TextScaleValue}" ScaleY="{Binding TextScaleValue}"/>
|
||||
</TextBlock.RenderTransform>
|
||||
</TextBlock>
|
||||
<TextBlock Canvas.Left="{Binding HalfOfWidth}" Canvas.Top="{Binding Height}"
|
||||
Margin="0.01,-0.05,0,0" Text="Y" FontSize="{Binding MainTextFontSize}"
|
||||
Background="AliceBlue"
|
||||
Foreground="{Binding YAxisColorBrush}">
|
||||
<TextBlock.RenderTransform>
|
||||
<ScaleTransform ScaleX="{Binding TextScaleValue}" ScaleY="{Binding TextScaleValue}" />
|
||||
</TextBlock.RenderTransform>
|
||||
</TextBlock>
|
||||
<Line
|
||||
X1="{Binding HalfOfWidth}" X2="{Binding HalfOfWidth}"
|
||||
Y1="0" Y2="{Binding Height}"
|
||||
Stroke="{Binding YAxisColorBrush}"
|
||||
StrokeThickness="{Binding AxisLineThickness}"/>
|
||||
<ItemsControl
|
||||
DataContext="{Binding ParentViewModel.PrimitiveLogic}"
|
||||
ItemsSource="{Binding Items}"
|
||||
ContextMenu="{StaticResource PrimitiveCRUD}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<Canvas/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemContainerStyle>
|
||||
<Style TargetType="ContentPresenter">
|
||||
<Setter Property="Canvas.ZIndex" Value="{Binding ZIndex}"/>
|
||||
<Setter Property="Canvas.Left" Value="{Binding PrimitiveLeft}"/>
|
||||
<Setter Property="Canvas.Top" Value="{Binding PrimitiveTop}"/>
|
||||
<Setter Property="Visibility" Value="{Binding IsVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||
<EventSetter Event="MouseDown" Handler="ContentPresenter_MouseLeftButtonDown"/>
|
||||
</Style>
|
||||
</ItemsControl.ItemContainerStyle>
|
||||
</ItemsControl>
|
||||
</Canvas>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
52
StructureHelper/Windows/UserControls/WorkPlane.xaml.cs
Normal file
52
StructureHelper/Windows/UserControls/WorkPlane.xaml.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for WorkPlane.xaml
|
||||
/// </summary>
|
||||
public partial class WorkPlane : UserControl
|
||||
{
|
||||
|
||||
|
||||
public CrossSectionViewModel ViewModel
|
||||
{
|
||||
get { return (CrossSectionViewModel)GetValue(ViewModelProperty); }
|
||||
set { SetValue(ViewModelProperty, value); }
|
||||
}
|
||||
|
||||
// Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty ViewModelProperty =
|
||||
DependencyProperty.Register(nameof(ViewModel), typeof(CrossSectionViewModel), typeof(WorkPlane), new PropertyMetadata(null));
|
||||
|
||||
|
||||
|
||||
public WorkPlane()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void ContentPresenter_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
var contentPresenter = sender as ContentPresenter;
|
||||
var item = contentPresenter?.Content as PrimitiveBase;
|
||||
ViewModel.PrimitiveLogic.SelectedItem = item;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,17 @@ namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
where T : ISaveable
|
||||
where V : ISaveable
|
||||
{
|
||||
protected ConvertStrategy(Dictionary<(Guid id, Type type), ISaveable> referenceDictionary, IShiftTraceLogger traceLogger)
|
||||
{
|
||||
ReferenceDictionary = referenceDictionary;
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
public ConvertStrategy()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||
public IShiftTraceLogger TraceLogger { get; set; }
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace StructureHelperCommon.Models.WorkPlanes
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements properties of work plane
|
||||
/// </summary>
|
||||
public interface IWorkPlaneProperty : ISaveable, IRectangleShape
|
||||
{
|
||||
/// <summary>
|
||||
/// Size of grid of work plane
|
||||
/// </summary>
|
||||
double GridSize { get; set; }
|
||||
/// <summary>
|
||||
/// Thickness of axis line
|
||||
/// </summary>
|
||||
double AxisLineThickness { get; set; }
|
||||
/// <summary>
|
||||
/// Thickness of lines of main grid
|
||||
/// </summary>
|
||||
double GridLineThickness { get; set; }
|
||||
}
|
||||
}
|
||||
24
StructureHelperCommon/Models/WorkPlanes/WorkPlaneProperty.cs
Normal file
24
StructureHelperCommon/Models/WorkPlanes/WorkPlaneProperty.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace StructureHelperCommon.Models.WorkPlanes
|
||||
{
|
||||
public class WorkPlaneProperty : IWorkPlaneProperty
|
||||
{
|
||||
public Guid Id { get; }
|
||||
public double GridSize { get; set; } = 0.05;
|
||||
public double Height { get; set; } = 1.2;
|
||||
public double Width { get; set; } = 1.2;
|
||||
public double AxisLineThickness { get; set; } = 2;
|
||||
public double GridLineThickness { get; set; } = 0.25;
|
||||
|
||||
public WorkPlaneProperty(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.WorkPlanes
|
||||
{
|
||||
public class WorkPlanePropertyUpdateStrategy : IUpdateStrategy<IWorkPlaneProperty>
|
||||
{
|
||||
public void Update(IWorkPlaneProperty targetObject, IWorkPlaneProperty sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject);
|
||||
CheckObject.IsNull(sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.AxisLineThickness = sourceObject.AxisLineThickness;
|
||||
targetObject.GridSize = sourceObject.GridSize;
|
||||
targetObject.GridLineThickness = sourceObject.GridLineThickness;
|
||||
targetObject.Height = sourceObject.Height;
|
||||
targetObject.Width = sourceObject.Width;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.WorkPlanes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -12,6 +13,7 @@ namespace StructureHelperLogics.Models.CrossSections
|
||||
public ICrossSectionRepository SectionRepository { get; set; } = new CrossSectionRepository();
|
||||
|
||||
public Guid Id { get; private set; }
|
||||
public IWorkPlaneProperty WorkPlaneProperty { get; set; } = new WorkPlaneProperty(Guid.NewGuid());
|
||||
|
||||
public CrossSection(Guid id)
|
||||
{
|
||||
|
||||
@@ -1,35 +1,37 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Models.WorkPlanes;
|
||||
using StructureHelperCommon.Services;
|
||||
|
||||
namespace StructureHelperLogics.Models.CrossSections
|
||||
{
|
||||
public class CrossSectionCloneStrategy : ICloneStrategy<ICrossSection>
|
||||
{
|
||||
private ICloneStrategy<ICrossSectionRepository> repositoryCloneStrategy;
|
||||
private IUpdateStrategy<IWorkPlaneProperty> workPlaneUpdateStrategy;
|
||||
private CrossSection targetObject;
|
||||
|
||||
public CrossSectionCloneStrategy(ICloneStrategy<ICrossSectionRepository> repositoryCloneStrategy)
|
||||
public CrossSectionCloneStrategy(ICloneStrategy<ICrossSectionRepository> repositoryCloneStrategy,
|
||||
IUpdateStrategy<IWorkPlaneProperty> workPlaneUpdateStrategy)
|
||||
{
|
||||
this.repositoryCloneStrategy = repositoryCloneStrategy;
|
||||
this.workPlaneUpdateStrategy = workPlaneUpdateStrategy;
|
||||
}
|
||||
|
||||
public CrossSectionCloneStrategy(ICloningStrategy cloningStrategy) : this (new CrossSectionRepositoryCloneStrategy(cloningStrategy))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public CrossSectionCloneStrategy() : this (new DeepCloningStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
public CrossSectionCloneStrategy() { }
|
||||
|
||||
public ICrossSection GetClone(ICrossSection sourceObject)
|
||||
{
|
||||
repositoryCloneStrategy ??= new CrossSectionRepositoryCloneStrategy(new DeepCloningStrategy());
|
||||
ICrossSectionRepository newRepository = repositoryCloneStrategy.GetClone(sourceObject.SectionRepository);
|
||||
targetObject = new()
|
||||
{
|
||||
SectionRepository = newRepository
|
||||
};
|
||||
CheckObject.IsNull(targetObject.WorkPlaneProperty);
|
||||
CheckObject.IsNull(sourceObject.WorkPlaneProperty);
|
||||
workPlaneUpdateStrategy ??= new WorkPlanePropertyUpdateStrategy();
|
||||
workPlaneUpdateStrategy.Update(targetObject.WorkPlaneProperty, sourceObject.WorkPlaneProperty);
|
||||
return targetObject;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,9 +16,9 @@ namespace StructureHelperLogics.Models.CrossSections
|
||||
|
||||
public void Update(ICrossSectionRepository targetObject, ICrossSectionRepository sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject, sourceObject);
|
||||
CheckObject.IsNull(targetObject);
|
||||
CheckObject.IsNull(sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.WorkPlanes;
|
||||
using StructureHelperCommon.Services;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives.Logics;
|
||||
@@ -13,27 +14,47 @@ namespace StructureHelperLogics.Models.CrossSections
|
||||
public class CrossSectionUpdateStrategy : IUpdateStrategy<ICrossSection>
|
||||
{
|
||||
private IUpdateStrategy<ICrossSectionRepository> repositoryUpdateStrategy;
|
||||
private IUpdateStrategy<IWorkPlaneProperty> workPlaneUpdateStrategy;
|
||||
|
||||
public CrossSectionUpdateStrategy(IUpdateStrategy<ICrossSectionRepository> repositoryUpdateStrategy)
|
||||
public CrossSectionUpdateStrategy(IUpdateStrategy<ICrossSectionRepository> repositoryUpdateStrategy,
|
||||
IUpdateStrategy<IWorkPlaneProperty> workPlaneUpdateStrategy)
|
||||
{
|
||||
this.repositoryUpdateStrategy = repositoryUpdateStrategy;
|
||||
this.workPlaneUpdateStrategy = workPlaneUpdateStrategy;
|
||||
}
|
||||
|
||||
public CrossSectionUpdateStrategy() : this (
|
||||
new CrossSectionRepositoryUpdateStrategy()
|
||||
)
|
||||
{
|
||||
|
||||
}
|
||||
public CrossSectionUpdateStrategy() { }
|
||||
|
||||
public void Update(ICrossSection targetObject, ICrossSection sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject, sourceObject);
|
||||
CheckObject.IsNull(targetObject);
|
||||
CheckObject.IsNull(sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
UpdateRepository(targetObject, sourceObject);
|
||||
UpdateWorkPlane(targetObject, sourceObject);
|
||||
}
|
||||
|
||||
private void UpdateWorkPlane(ICrossSection targetObject, ICrossSection sourceObject)
|
||||
{
|
||||
if (sourceObject.WorkPlaneProperty is null)
|
||||
{
|
||||
targetObject.WorkPlaneProperty = new WorkPlaneProperty(Guid.NewGuid());
|
||||
return;
|
||||
}
|
||||
targetObject.WorkPlaneProperty ??= new WorkPlaneProperty(Guid.NewGuid());
|
||||
workPlaneUpdateStrategy ??= new WorkPlanePropertyUpdateStrategy();
|
||||
workPlaneUpdateStrategy.Update(targetObject.WorkPlaneProperty, sourceObject.WorkPlaneProperty);
|
||||
}
|
||||
|
||||
private void UpdateRepository(ICrossSection targetObject, ICrossSection sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject.SectionRepository);
|
||||
CheckObject.IsNull(sourceObject.SectionRepository);
|
||||
targetObject.SectionRepository.Calculators.Clear();
|
||||
targetObject.SectionRepository.Primitives.Clear();
|
||||
targetObject.SectionRepository.ForceActions.Clear();
|
||||
targetObject.SectionRepository.HeadMaterials.Clear();
|
||||
repositoryUpdateStrategy ??= new CrossSectionRepositoryUpdateStrategy();
|
||||
repositoryUpdateStrategy.Update(targetObject.SectionRepository, sourceObject.SectionRepository);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.WorkPlanes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -10,5 +11,6 @@ namespace StructureHelperLogics.Models.CrossSections
|
||||
public interface ICrossSection : ISaveable, ICloneable
|
||||
{
|
||||
ICrossSectionRepository SectionRepository { get; set; }
|
||||
IWorkPlaneProperty WorkPlaneProperty { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user