Files
wg_cpso/CPSO/Forms/61_Settings/ViewAnnotationSettings.cs
2026-03-25 18:20:24 +08:00

244 lines
9.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
using CaeGlobals;
using DynamicTypeDescriptor;
using System.Drawing.Design;
namespace CPSO.Settings
{
[Serializable]
public class ViewAnnotationSettings : IViewSettings, IReset
{
// Variables
private AnnotationSettings _annotationSettings;
private DynamicCustomTypeDescriptor _dctd = null;
// Color spectrum values
[Category("Design")]
[OrderedDisplayName(0, 10, "Background type")]
[Description("Select the background type.")]
public AnnotationBackgroundType BackgroundType
{
get { return _annotationSettings.BackgroundType; }
set { _annotationSettings.BackgroundType = value; }
}
//
[Category("Design")]
[OrderedDisplayName(1, 10, "Draw a border rectangle")]
[Description("Draw a border rectangle around the legend.")]
public bool DrawBorder
{
get { return _annotationSettings.DrawBorder; }
set { _annotationSettings.DrawBorder = value; }
}
//
[Category("Design")]
[OrderedDisplayName(2, 10, "Number format")]
[Description("Select the number format.")]
public AnnotationNumberFormat LegendNumberFormat
{
get { return _annotationSettings.NumberFormat; }
set { _annotationSettings.NumberFormat = value; }
}
//
[Category("Design")]
[OrderedDisplayName(3, 10, "Number of significant digits")]
[Description("Set the number of significant digits (2 ... 8).")]
public int NumberOfSignificantDigits
{
get { return _annotationSettings.NumberOfSignificantDigits; }
set { _annotationSettings.NumberOfSignificantDigits = value; }
}
//
[Category("Node annotation")]
[OrderedDisplayName(0, 10, "Show node id")]
[Description("Show node id in the annotation.")]
public bool ShowNodeId
{
get { return _annotationSettings.ShowNodeId; }
set { _annotationSettings.ShowNodeId = value; }
}
//
[Category("Node annotation")]
[OrderedDisplayName(1, 10, "Show coordinates")]
[Description("Show coordintates in the annotation.")]
public bool ShowCoordinates
{
get { return _annotationSettings.ShowCoordinates; }
set { _annotationSettings.ShowCoordinates = value; }
}
//
[Category("Edge/Surface annotation")]
[OrderedDisplayName(0, 10, "Show edge/surface id")]
[Description("Show edge/surface id in the annotation.")]
public bool ShowEdgeSurId
{
get { return _annotationSettings.ShowEdgeSurId; }
set { _annotationSettings.ShowEdgeSurId = value; }
}
//
[Category("Edge/Surface annotation")]
[OrderedDisplayName(1, 10, "Show edge/surface type")]
[Description("Show edge/surface type in the annotation.")]
public bool ShowEdgeSurType
{
get { return _annotationSettings.ShowEdgeSurType; }
set { _annotationSettings.ShowEdgeSurType = value; }
}
//
[Category("Edge/Surface annotation")]
[OrderedDisplayName(2, 10, "Show edge/surface topology")]
[Description("Show edge/surface topology in the annotation.")]
public bool ShowEdgeSurTopology
{
get { return _annotationSettings.ShowEdgeSurTopology; }
set { _annotationSettings.ShowEdgeSurTopology = value; }
}
//
[Category("Edge/Surface annotation")]
[OrderedDisplayName(3, 10, "Show edge/surface size")]
[Description("Show edge/surface size in the annotation.")]
public bool ShowEdgeLength
{
get { return _annotationSettings.ShowEdgeSurSize; }
set { _annotationSettings.ShowEdgeSurSize = value; }
}
//
[Category("Edge/Surface annotation")]
[OrderedDisplayName(4, 10, "Show maximum value")]
[Description("Show maximum value in the annotation.")]
public bool ShowEdgeMax
{
get { return _annotationSettings.ShowEdgeSurMax; }
set { _annotationSettings.ShowEdgeSurMax = value; }
}
//
[Category("Edge/Surface annotation")]
[OrderedDisplayName(5, 10, "Show minimum value")]
[Description("Show minimum value in the annotation.")]
public bool ShowEdgeMin
{
get { return _annotationSettings.ShowEdgeSurMin; }
set { _annotationSettings.ShowEdgeSurMin = value; }
}
//
[Category("Edge/Surface annotation")]
[OrderedDisplayName(6, 10, "Show sum value")]
[Description("Show summed value by nodes in the annotation.")]
public bool ShowEdgeSum
{
get { return _annotationSettings.ShowEdgeSurSum; }
set { _annotationSettings.ShowEdgeSurSum = value; }
}
//
[Category("Edge/Surface annotation")]
[OrderedDisplayName(7, 10, "Show average value")]
[Description("Show average value by nodes in the annotation.")]
public bool ShowEdgeAvg
{
get { return _annotationSettings.ShowEdgeSurAvg; }
set { _annotationSettings.ShowEdgeSurAvg = value; }
}
//
[Category("Part annotation")]
[OrderedDisplayName(0, 10, "Show part name")]
[Description("Show part name in the annotation.")]
public bool ShowPartName
{
get { return _annotationSettings.ShowPartName; }
set { _annotationSettings.ShowPartName = value; }
}
//
[Category("Part annotation")]
[OrderedDisplayName(1, 10, "Show part id")]
[Description("Show part id in the annotation.")]
public bool ShowPartId
{
get { return _annotationSettings.ShowPartId; }
set { _annotationSettings.ShowPartId = value; }
}
//
[Category("Part annotation")]
[OrderedDisplayName(2, 10, "Show part type")]
[Description("Show part type in the annotation.")]
public bool ShowPartType
{
get { return _annotationSettings.ShowPartType; }
set { _annotationSettings.ShowPartType = value; }
}
//
[Category("Part annotation")]
[OrderedDisplayName(3, 10, "Show number of elements")]
[Description("Show part number of elements in the annotation.")]
public bool ShowPartNumberOfElements
{
get { return _annotationSettings.ShowPartNumberOfElements; }
set { _annotationSettings.ShowPartNumberOfElements = value; }
}
//
[Category("Part annotation")]
[OrderedDisplayName(4, 10, "Show number of nodes")]
[Description("Show part number of nodes in the annotation.")]
public bool ShowPartNumberOfNodes
{
get { return _annotationSettings.ShowPartNumberOfNodes; }
set { _annotationSettings.ShowPartNumberOfNodes = value; }
}
//
[Category("Part annotation")]
[OrderedDisplayName(5, 10, "Show volume/area")]
[Description("Show part volume/area in the annotation.")]
public bool ShowPartVolumeArea
{
get { return _annotationSettings.ShowPartVolumeArea; }
set { _annotationSettings.ShowPartVolumeArea = value; }
}
// Constructors
public ViewAnnotationSettings(AnnotationSettings annotationSettings)
{
_annotationSettings = annotationSettings;
_dctd = ProviderInstaller.Install(this);
//
_dctd.RenameBooleanPropertyToYesNo(nameof(DrawBorder));
//
_dctd.RenameBooleanPropertyToYesNo(nameof(ShowNodeId));
_dctd.RenameBooleanPropertyToYesNo(nameof(ShowCoordinates));
//
_dctd.RenameBooleanPropertyToYesNo(nameof(ShowEdgeSurId));
_dctd.RenameBooleanPropertyToYesNo(nameof(ShowEdgeSurType));
_dctd.RenameBooleanPropertyToYesNo(nameof(ShowEdgeSurTopology));
_dctd.RenameBooleanPropertyToYesNo(nameof(ShowEdgeLength));
_dctd.RenameBooleanPropertyToYesNo(nameof(ShowEdgeMax));
_dctd.RenameBooleanPropertyToYesNo(nameof(ShowEdgeMin));
_dctd.RenameBooleanPropertyToYesNo(nameof(ShowEdgeSum));
_dctd.RenameBooleanPropertyToYesNo(nameof(ShowEdgeAvg));
//
_dctd.RenameBooleanPropertyToYesNo(nameof(ShowPartName));
_dctd.RenameBooleanPropertyToYesNo(nameof(ShowPartId));
_dctd.RenameBooleanPropertyToYesNo(nameof(ShowPartType));
_dctd.RenameBooleanPropertyToYesNo(nameof(ShowPartNumberOfElements));
_dctd.RenameBooleanPropertyToYesNo(nameof(ShowPartNumberOfNodes));
_dctd.RenameBooleanPropertyToYesNo(nameof(ShowPartVolumeArea));
}
// Methods
public ISettings GetBase()
{
return _annotationSettings;
}
public void Reset()
{
_annotationSettings.Reset();
}
}
}