aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs349
1 files changed, 95 insertions, 254 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs
index 5c0d9145a..7f8c7d6b5 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs
@@ -46,125 +46,6 @@ namespace Tango.PPC.Jobs.Models
[JsonIgnore]
public bool PreventPropertyUpdate { get; set; }
- protected Double _cyan;
-
- /// <summary>
- /// Gets or sets the BrushStopModel cyan.
- /// </summary>
- public Double Cyan
- {
- get
- {
- return _cyan;
- }
-
- set
- {
- if (_cyan != value)
- {
- _cyan = value;
- RaisePropertyChangedAuto();
- OnVolumeChanged();
- }
- }
- }
-
- protected Double _magenta;
-
- /// <summary>
- /// Gets or sets the BrushStopModel magenta.
- /// </summary>
-
- public Double Magenta
- {
- get
- {
- return _magenta;
- }
-
- set
- {
- if (_magenta != value)
- {
- _magenta = value;
- RaisePropertyChangedAuto();
- OnVolumeChanged();
- }
- }
- }
-
- protected Double _yellow;
-
- /// <summary>
- /// Gets or sets the BrushStopModel yellow.
- /// </summary>
-
- public Double Yellow
- {
- get
- {
- return _yellow;
- }
-
- set
- {
- if (_yellow != value)
- {
- _yellow = value;
- RaisePropertyChangedAuto();
- OnVolumeChanged();
- }
- }
- }
-
- protected Double _black;
-
- /// <summary>
- /// Gets or sets the BrushStopModel black.
- /// </summary>
- public Double Black
- {
- get
- {
- return _black;
- }
-
- set
- {
- if (_black != value)
- {
- _black = value;
- RaisePropertyChangedAuto();
- OnVolumeChanged();
- }
- }
- }
-
- protected Double _violet;
-
- /// <summary>
- /// Gets or sets the BrushStopModel violet.
- /// </summary>
- public Double Violet
- {
- get
- {
- return _violet;
- }
-
- set
- {
- if (Violet != value)
- {
- _violet = value;
- RaisePropertyChangedAuto();
- OnVolumeChanged();
- }
- }
- }
-
-
-
protected Int32 _red;
/// <summary>
@@ -660,7 +541,7 @@ namespace Tango.PPC.Jobs.Models
{
if (RequiredMaxLiquidTest && (ColorSpace == ColorSpaces.Volume || ColorSpace == ColorSpaces.CMYK))
{
- var sum = GetColorNLPerCm(Cyan, LiquidTypes.Cyan) + GetColorNLPerCm(Magenta, LiquidTypes.Magenta) + GetColorNLPerCm(Yellow, LiquidTypes.Yellow) + GetColorNLPerCm(Black, LiquidTypes.Black) + GetColorNLPerCm(Violet, LiquidTypes.Violet);
+ var sum = LiquidVolumes.GetMaxNanoliterPerCM();
var maxLiq = GetTotalMaximumLiquidNlPerCMLimit();
LiquidVolumesOutOfRange = sum > GetTotalMaximumLiquidNlPerCMLimit();
@@ -692,41 +573,17 @@ namespace Tango.PPC.Jobs.Models
{
if (ColorSpace == ColorSpaces.Volume || ColorSpace == ColorSpaces.CMYK)
{
- var minCyan = GetMinLimitLiquid(LiquidTypes.Cyan);
- if (Cyan > 0 && Cyan < minCyan)
+ foreach (var liquidVolume in LiquidVolumes)
{
- LiquidVolumeBelowMinLimit = true;
- LiquidVolumeBelowMinLimitmessage = $"{Cyan} Cyan should be > {minCyan.ToString("N3")}";
- return LiquidVolumeBelowMinLimit;
- }
- var minMagenta = GetMinLimitLiquid(LiquidTypes.Magenta);
- if (Magenta > 0 && Magenta < minMagenta)
- {
- LiquidVolumeBelowMinLimit = true;
- LiquidVolumeBelowMinLimitmessage = $"{Magenta} Magenta should be > {minMagenta.ToString("N3")}";
- return LiquidVolumeBelowMinLimit;
- }
- var minYellow = GetMinLimitLiquid(LiquidTypes.Yellow);
- if (Yellow > 0 && Yellow < minYellow)
- {
- LiquidVolumeBelowMinLimit = true;
- LiquidVolumeBelowMinLimitmessage = $"{Yellow} Yellow should be > {minYellow.ToString("N3")}";
- return LiquidVolumeBelowMinLimit;
- }
- var minBlack = GetMinLimitLiquid(LiquidTypes.Black);
- if (Black > 0 && Black < minBlack)
- {
- LiquidVolumeBelowMinLimit = true;
- LiquidVolumeBelowMinLimitmessage = $"{Black} Black should be > {minBlack.ToString("N3")}";
- return LiquidVolumeBelowMinLimit;
- }
- var minViolet = GetMinLimitLiquid(LiquidTypes.Violet);
- if (Violet > 0 && Violet < minViolet)
- {
- LiquidVolumeBelowMinLimit = true;
- LiquidVolumeBelowMinLimitmessage = $"{Violet} Violet should be > {minViolet.ToString("N3")}";
- return LiquidVolumeBelowMinLimit;
+ var min = liquidVolume.GetMinLimit();
+ if (liquidVolume.Volume > 0 && liquidVolume.Volume < min)
+ {
+ LiquidVolumeBelowMinLimit = true;
+ LiquidVolumeBelowMinLimitmessage = $"{liquidVolume.IdsPack.LiquidType.Name} Cyan should be > {min.ToString("N3")}";
+ return LiquidVolumeBelowMinLimit;
+ }
}
+
LiquidVolumeBelowMinLimit = false;
LiquidVolumeBelowMinLimitmessage = "";
return false;
@@ -772,19 +629,19 @@ namespace Tango.PPC.Jobs.Models
public Double ABeforeChange { get; set; }
[JsonIgnore]
public Double BBeforeChange { get; set; }
+
[JsonIgnore]
- public Double CyanBeforeChange { get; set; }
- [JsonIgnore]
- public Double MagentaBeforeChange { get; set; }
- [JsonIgnore]
- public Double YellowBeforeChange { get; set; }
- [JsonIgnore]
- public Double BlackBeforeChange { get; set; }
- [JsonIgnore]
- public Double VioletBeforeChange { get; set; }
+ public BrushStop BrushStop { get; set; }
public bool FineTuningChanged { get; set; }
+ private LiquidVolumesCollection _liquidVolums;
+ public LiquidVolumesCollection LiquidVolumes
+ {
+ get { return _liquidVolums; }
+ set { _liquidVolums = value; RaisePropertyChangedAuto(); }
+ }
+
#endregion
#region constructors
@@ -794,13 +651,18 @@ namespace Tango.PPC.Jobs.Models
Guid = System.Guid.NewGuid().ToString();
TangoIOC.Default.Inject(this);
+
+ LiquidVolumes = new LiquidVolumesCollection();
}
public BrushStopModel(SegmentModel segmentModel) : this()
{
- InitDefaultValues();
SegmentModel = segmentModel;
+ InitLiquidVolumes();
+
+ InitDefaultValues();
+
Color = Colors.White;
var settings = SettingsManager.Default.GetOrCreate<PPCSettings>();
ColorSpace = settings.DefaultTabColorSpace == null ? ColorSpaces.Volume : (ColorSpaces)settings.DefaultTabColorSpace;
@@ -815,9 +677,13 @@ namespace Tango.PPC.Jobs.Models
public BrushStopModel(BrushStop brushStop, SegmentModel segmentModel, int version) : this()
{
+ SegmentModel = segmentModel;
+ BrushStop = brushStop;
+
+ InitLiquidVolumes();
+
InitDefaultValues();
Guid = brushStop.Guid;
- SegmentModel = segmentModel;
OffsetPercent = brushStop.OffsetPercent;
Color = brushStop.Color;
BestMatchColor = brushStop.Color;
@@ -829,33 +695,9 @@ namespace Tango.PPC.Jobs.Models
_stopindex = brushStop.StopIndex;
PreventPropertyUpdate = true;
- if (version < 2)//loaded from MS
- {
- if (brushStop.ColorSpace.Space == ColorSpaces.CMYK)
- {
- Cyan = brushStop.Cyan * 100;
- Magenta = brushStop.Magenta * 100;
- Yellow = brushStop.Yellow * 100;
- Black = brushStop.Black * 100;
- Violet = brushStop.Violet * 100;
- }
- else
- {
- Cyan = brushStop.GetVolume(LiquidTypes.Cyan);
- Magenta = brushStop.GetVolume(LiquidTypes.Magenta);
- Yellow = brushStop.GetVolume(LiquidTypes.Yellow);
- Black = brushStop.GetVolume(LiquidTypes.Black);
- Violet = brushStop.GetVolume(LiquidTypes.Violet);
- }
- }
- else
- {
- Cyan = brushStop.Cyan;
- Magenta = brushStop.Magenta;
- Yellow = brushStop.Yellow;
- Black = brushStop.Black;
- Violet = brushStop.Violet;
- }
+
+ LiquidVolumes.SetVolumesFromBrushStop(brushStop);
+
Red = brushStop.Red;
Green = brushStop.Green;
Blue = brushStop.Blue;
@@ -869,6 +711,25 @@ namespace Tango.PPC.Jobs.Models
LiquidVolumesOutOfRange = false;
}
+ public void InitLiquidVolumes()
+ {
+ LiquidVolumes.Clear();
+
+ var supportedIdsPacks = SegmentModel.Job.Machine.Configuration.GetSupportedIdsPacks(SegmentModel.Job.Rml).Where(x => x.LiquidType.HasPigment && x.LiquidType.AvailableForStandardUser).OrderBy(x => x.LiquidType.PreferredIndex).ToList();
+
+ foreach (var idsPack in supportedIdsPacks)
+ {
+ var liquidVolume = new LiquidVolumeModel(this, idsPack);
+ liquidVolume.VolumeChanged += (x, e) => OnVolumeChanged();
+ LiquidVolumes.Add(liquidVolume);
+ }
+
+ if (BrushStop != null)
+ {
+ LiquidVolumes.SetVolumesFromBrushStopSilent(BrushStop);
+ }
+ }
+
private void InitDefaultValues()
{
_hue = 0;
@@ -880,7 +741,7 @@ namespace Tango.PPC.Jobs.Models
_bestMatchL = 100;
_bestMatchA = _bestMatchB = 0;
_red = _green = _blue = 255;
- _cyan = _magenta = _yellow = _black = _violet = 0;
+ LiquidVolumes.ResetVolumeSilent();
StopIndex = 1;
Position = PositionStatus.FirstColor;
IsOutOfGamut = false;
@@ -925,11 +786,8 @@ namespace Tango.PPC.Jobs.Models
BestMatchA = newBrushStop.BestMatchA;
BestMatchB = newBrushStop.BestMatchB;
- Cyan = newBrushStop.Cyan;
- Magenta = newBrushStop.Magenta;
- Yellow = newBrushStop.Yellow;
- Black = newBrushStop.Black;
- Violet = newBrushStop.Violet;
+ LiquidVolumes.SetVolumesFromBrushStop(newBrushStop);
+
ColorCatalogsItem = newBrushStop.ColorCatalogsItem;
PreventPropertyUpdate = false;
@@ -954,11 +812,10 @@ namespace Tango.PPC.Jobs.Models
if (s.ColorSpace.Space == ColorSpaces.Volume)
{
- s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Cyan.ToInt32()).PackIndex, Cyan);
- s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Magenta.ToInt32()).PackIndex, Magenta);
- s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Yellow.ToInt32()).PackIndex, Yellow);
- s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Black.ToInt32()).PackIndex, Black);
- s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Violet.ToInt32()).PackIndex, Violet);
+ foreach (var liquidVolume in LiquidVolumes)
+ {
+ s.SetVolume(liquidVolume.IdsPack.PackIndex, liquidVolume.Volume);
+ }
}
else if (s.ColorSpace.Space == ColorSpaces.LAB)
{
@@ -1023,11 +880,7 @@ namespace Tango.PPC.Jobs.Models
cloned.BestMatchL = BestMatchL;
cloned.BestMatchA = BestMatchA;
cloned.BestMatchB = BestMatchB;
- cloned.Cyan = Cyan;
- cloned.Magenta = Magenta;
- cloned.Yellow = Yellow;
- cloned.Black = Black;
- cloned.Violet = Violet;
+ cloned.LiquidVolumes.SetVolumesFromBrushStop(this);
cloned.Hue = Hue;
cloned.Saturation = Saturation;
cloned.Brightness = Brightness;
@@ -1072,11 +925,13 @@ namespace Tango.PPC.Jobs.Models
PreventPropertyUpdate = true;
- Cyan = favoriteColor.Cyan;
- Magenta = favoriteColor.Magenta;
- Yellow = favoriteColor.Yellow;
- Black = favoriteColor.Black;
- Violet = favoriteColor.Violet;
+
+ LiquidVolumes.ResetVolume();
+ LiquidVolumes.GetLiquidVolume(LiquidTypes.Cyan).Volume = favoriteColor.Cyan;
+ LiquidVolumes.GetLiquidVolume(LiquidTypes.Magenta).Volume = favoriteColor.Magenta;
+ LiquidVolumes.GetLiquidVolume(LiquidTypes.Yellow).Volume = favoriteColor.Yellow;
+ LiquidVolumes.GetLiquidVolume(LiquidTypes.Black).Volume = favoriteColor.Black;
+
Red = favoriteColor.Red;
Green = favoriteColor.Green;
@@ -1116,11 +971,7 @@ namespace Tango.PPC.Jobs.Models
s.ColorCatalog = ColorCatalog;
s.ColorCatalogsItem = ColorCatalogsItem;
- s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Cyan.ToInt32()).PackIndex, Cyan);
- s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Magenta.ToInt32()).PackIndex, Magenta);
- s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Yellow.ToInt32()).PackIndex, Yellow);
- s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Black.ToInt32()).PackIndex, Black);
- s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Violet.ToInt32()).PackIndex, Violet);
+ LiquidVolumes.SetVolumesOnBrushStop(s);
s.L = this.L;
s.A = this.A;
@@ -1147,12 +998,8 @@ namespace Tango.PPC.Jobs.Models
else if (ColorSpace == ColorSpaces.Volume)
{
PreventPropertyUpdate = true;
- Cyan = CyanBeforeChange;
- Magenta = MagentaBeforeChange;
- Yellow = YellowBeforeChange;
- Violet = VioletBeforeChange;
+ LiquidVolumes.Undo();
PreventPropertyUpdate = false;
- Black = BlackBeforeChange;
}
}
@@ -1167,11 +1014,7 @@ namespace Tango.PPC.Jobs.Models
}
else if (ColorSpace == ColorSpaces.Volume)
{
- CyanBeforeChange = Cyan;
- MagentaBeforeChange = Magenta;
- YellowBeforeChange = Yellow;
- BlackBeforeChange = Black;
- VioletBeforeChange = Violet;
+ LiquidVolumes.SaveState();
}
}
@@ -1495,16 +1338,12 @@ namespace Tango.PPC.Jobs.Models
{
if (ColorCatalogsItem != null)
{
- _cyan = ColorCatalogsItem.Cyan;
- _magenta = ColorCatalogsItem.Magenta;
- _yellow = ColorCatalogsItem.Yellow;
- _black = ColorCatalogsItem.Black;
- _violet = 0;
- RaisePropertyChanged(nameof(Cyan));
- RaisePropertyChanged(nameof(Yellow));
- RaisePropertyChanged(nameof(Magenta));
- RaisePropertyChanged(nameof(Black));
- RaisePropertyChanged(nameof(Violet));
+ LiquidVolumes.ResetVolumeSilent();
+ LiquidVolumes.GetLiquidVolume(LiquidTypes.Cyan).SetVolumeSilent(ColorCatalogsItem.Cyan);
+ LiquidVolumes.GetLiquidVolume(LiquidTypes.Magenta).SetVolumeSilent(ColorCatalogsItem.Magenta);
+ LiquidVolumes.GetLiquidVolume(LiquidTypes.Yellow).SetVolumeSilent(ColorCatalogsItem.Yellow);
+ LiquidVolumes.GetLiquidVolume(LiquidTypes.Black).SetVolumeSilent(ColorCatalogsItem.Black);
+ LiquidVolumes.RaiseVolume();
IsOutOfGamut = false;
// RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange));
// RaisePropertyChanged(nameof(IsLiquidVolumeBelowMinLimit));
@@ -1531,11 +1370,11 @@ namespace Tango.PPC.Jobs.Models
IsBusy = true;
var output = _converter.Convert(stop, SegmentModel.Job.Machine.Configuration, SegmentModel.Job.Rml, false, false, false);
- _cyan = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Cyan).Volume);
- _yellow = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Yellow).Volume);
- _magenta = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Magenta).Volume);
- _black = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Black).Volume);
- _violet = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Violet).Volume);
+ foreach (var outputLiquid in output.SingleCoordinates.OutputLiquids)
+ {
+ LiquidVolumes.GetLiquidVolume(outputLiquid.LiquidType).SetVolumeSilent(outputLiquid.Volume);
+ }
+
IsOutOfGamut = false;
//if ( LastChangedColorSpace != ColorSpaces.RGB)
//{
@@ -1545,11 +1384,7 @@ namespace Tango.PPC.Jobs.Models
// InitColor();
// BestMatchColor = Color.FromRgb((byte)output.SingleCoordinates.Red, (byte)output.SingleCoordinates.Green, (byte)output.SingleCoordinates.Blue);
//}
- RaisePropertyChanged(nameof(Cyan));
- RaisePropertyChanged(nameof(Yellow));
- RaisePropertyChanged(nameof(Magenta));
- RaisePropertyChanged(nameof(Black));
- RaisePropertyChanged(nameof(Violet));
+ LiquidVolumes.RaiseVolume();
RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange));
RaisePropertyChanged(nameof(IsLiquidVolumeBelowMinLimit));
}
@@ -1604,15 +1439,21 @@ namespace Tango.PPC.Jobs.Models
IsBusy = true;
var output = _converter.Convert(stop, SegmentModel.Job.Machine.Configuration, SegmentModel.Job.Rml, false, false, false, ConversionType.FineTuning);
- _cyan = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Cyan).Volume);
- _yellow = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Yellow).Volume);
- _magenta = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Magenta).Volume);
- _black = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Black).Volume);
- _violet = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Violet).Volume);
- if (_black > 0 && _black < 0.5)//bug 7959 0.001 < K% < 0.5 ==> reset the K to 0.
+ var b = output.SingleCoordinates.OutputLiquids.FirstOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Black);
+
+ if (b != null)
{
- _black = 0;
+ if (b.Volume > 0 && b.Volume < 0.5)//bug 7959 0.001 < K% < 0.5 ==> reset the K to 0.
+ {
+ b.Volume = 0;
+ }
}
+
+ foreach (var outputLiquid in output.SingleCoordinates.OutputLiquids)
+ {
+ LiquidVolumes.GetLiquidVolume(outputLiquid.LiquidType).SetVolumeSilent(outputLiquid.Volume);
+ }
+
IsOutOfGamut = output.OutOfGamut;
if (IsOutOfGamut)
{