aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2025-04-28 05:52:14 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2025-04-28 05:52:14 +0300
commit40b28f82bd178b9151937ba6920d427ff0df53d8 (patch)
tree9ce64840e11fea7dcf56cf9e5dada33aade0351c /Software/Visual_Studio
parentf33925e973cfaa9be4d46abd81f63afe787c6607 (diff)
downloadTango-40b28f82bd178b9151937ba6920d427ff0df53d8.tar.gz
Tango-40b28f82bd178b9151937ba6920d427ff0df53d8.zip
Extra Inks Gradients
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest2
-rw-r--r--Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs5
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/DefaultGradientGenerationConfiguration.cs113
-rw-r--r--Software/Visual_Studio/Web/Tango.MachineService/Properties/PublishProfiles/Testing.pubxml16
4 files changed, 83 insertions, 53 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest
index d72e75011..efc5f8179 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest
@@ -16,7 +16,7 @@
Remove this element if your application requires this virtualization for backwards
compatibility.
-->
- <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
+ <!--<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />-->
</requestedPrivileges>
</security>
</trustInfo>
diff --git a/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs b/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs
index e75a740ec..8de903a46 100644
--- a/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs
+++ b/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs
@@ -158,6 +158,11 @@ namespace Tango.BL.Entities
get { return LiquidVolumes != null ? LiquidVolumes.Where(x => x.IdsPack.LiquidType.HasPigment).OrderBy(x => x.IdsPack.LiquidType.PreferredIndex).ToObservableCollection() : null; }
}
+ public void SetLiquidVolume(LiquidTypes liquidType, double volume)
+ {
+ LiquidVolumes.First(x => x.LiquidType == liquidType).Volume = volume;
+ }
+
/// <summary>
/// Gets the collection of liquid volumes with pigmented (color) and available to standard user liquid types ordered by their liquid type preferred index.
/// </summary>
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/DefaultGradientGenerationConfiguration.cs b/Software/Visual_Studio/Tango.Integration/Operation/DefaultGradientGenerationConfiguration.cs
index 9b4dbb852..31cab35a3 100644
--- a/Software/Visual_Studio/Tango.Integration/Operation/DefaultGradientGenerationConfiguration.cs
+++ b/Software/Visual_Studio/Tango.Integration/Operation/DefaultGradientGenerationConfiguration.cs
@@ -27,6 +27,17 @@ namespace Tango.Integration.Operation
public double OffsetPercent { get; set; }
}
+ private class LiquidVolumesStop
+ {
+ public Dictionary<LiquidTypes, double> Volumes { get; set; }
+ public double OffsetPercent { get; set; }
+
+ public LiquidVolumesStop()
+ {
+ Volumes = new Dictionary<LiquidTypes, double>();
+ }
+ }
+
private bool aborted;
private bool _isEnabled;
@@ -109,40 +120,41 @@ namespace Tango.Integration.Operation
{
var firstStop = clonedStops.FirstOrDefault(x => x.StopIndex == 1);
var lastStop = clonedStops.FirstOrDefault(x => x.StopIndex == 5);
- CMYK cmykfirst = GetCMYK(firstStop);
+ LiquidVolumesStop cmykfirst = GetCMYK(firstStop);
cmykfirst.OffsetPercent /= 100d;
- CMYK cmyklast = GetCMYK(lastStop);
+ LiquidVolumesStop cmyklast = GetCMYK(lastStop);
cmyklast.OffsetPercent /= 100d;
//set middle offset color
var middleOffsetStop = clonedStops.FirstOrDefault(x => x.StopIndex == 3);
if (middleOffsetStop != null)
{
- CMYK cmykmiddle = GetRelativeCMYK(cmykfirst, cmyklast, middleOffsetStop.OffsetPercent / 100d);
- middleOffsetStop.SetVolume(LiquidTypes.Cyan, cmykmiddle.C);
- middleOffsetStop.SetVolume(LiquidTypes.Magenta, cmykmiddle.M);
- middleOffsetStop.SetVolume(LiquidTypes.Yellow, cmykmiddle.Y);
- middleOffsetStop.SetVolume(LiquidTypes.Black, cmykmiddle.K);
+ LiquidVolumesStop cmykmiddle = GetRelativeCMYK(cmykfirst, cmyklast, middleOffsetStop.OffsetPercent / 100d);
+
+ foreach (var v in cmykmiddle.Volumes)
+ {
+ middleOffsetStop.SetLiquidVolume(v.Key, v.Value);
+ }
}
var firstOffsetStop = clonedStops.FirstOrDefault(x => x.StopIndex == 2);
if (firstOffsetStop != null)
{
- firstOffsetStop.SetVolume(LiquidTypes.Cyan, cmykfirst.C);
- firstOffsetStop.SetVolume(LiquidTypes.Magenta, cmykfirst.M);
- firstOffsetStop.SetVolume(LiquidTypes.Yellow, cmykfirst.Y);
- firstOffsetStop.SetVolume(LiquidTypes.Black, cmykfirst.K);
+ foreach (var v in cmykfirst.Volumes)
+ {
+ firstOffsetStop.SetLiquidVolume(v.Key, v.Value);
+ }
}
var secondOffsetStop = clonedStops.FirstOrDefault(x => x.StopIndex == 4);
if (secondOffsetStop != null)
{
- secondOffsetStop.SetVolume(LiquidTypes.Cyan, cmyklast.C);
- secondOffsetStop.SetVolume(LiquidTypes.Magenta, cmyklast.M);
- secondOffsetStop.SetVolume(LiquidTypes.Yellow, cmyklast.Y);
- secondOffsetStop.SetVolume(LiquidTypes.Black, cmyklast.K);
+ foreach (var v in cmyklast.Volumes)
+ {
+ secondOffsetStop.SetLiquidVolume(v.Key, v.Value);
+ }
}
}
}
-
+
var refStop = clonedStops.First().Clone(segment);
decimal segment_length = (decimal)segment.Length;
@@ -160,10 +172,10 @@ namespace Tango.Integration.Operation
stop.OffsetMeters = segment.Length * offset;
stop.StopIndex = stopIndex++;
- stop.SetVolume(LiquidTypes.Cyan, cmyk.C);
- stop.SetVolume(LiquidTypes.Magenta, cmyk.M);
- stop.SetVolume(LiquidTypes.Yellow, cmyk.Y);
- stop.SetVolume(LiquidTypes.Black, cmyk.K);
+ foreach (var v in cmyk.Volumes)
+ {
+ stop.SetVolume(v.Key, v.Value);
+ }
stop.SetLiquidVolumes(job.Machine.Configuration, job.Rml, processParameters);
@@ -190,32 +202,32 @@ namespace Tango.Integration.Operation
return stops;
}
- private CMYK GetRelativeCMYK(CMYK first, CMYK last, double offset)
+ private LiquidVolumesStop GetRelativeCMYK(LiquidVolumesStop first, LiquidVolumesStop last, double offset)
{
- CMYK cmyk = new CMYK();
+ LiquidVolumesStop cmyk = new LiquidVolumesStop();
+
+ foreach (var v in first.Volumes)
+ {
+ cmyk.Volumes[v.Key] = (float)((offset - first.OffsetPercent) * (last.Volumes[v.Key] - first.Volumes[v.Key]) / (last.OffsetPercent - first.OffsetPercent) + first.Volumes[v.Key]);
+ }
- cmyk.C = (float)((offset - first.OffsetPercent) * (last.C - first.C) / (last.OffsetPercent - first.OffsetPercent) + first.C);
- cmyk.M = (float)((offset - first.OffsetPercent) * (last.M - first.M) / (last.OffsetPercent - first.OffsetPercent) + first.M);
- cmyk.Y = (float)((offset - first.OffsetPercent) * (last.Y - first.Y) / (last.OffsetPercent - first.OffsetPercent) + first.Y);
- cmyk.K = (float)((offset - first.OffsetPercent) * (last.K - first.K) / (last.OffsetPercent - first.OffsetPercent) + first.K);
+ //cmyk.OffsetPercent = offset;
return cmyk;
}
-
- private CMYK GetRelativeCMYK(List<BrushStop> brushStopsCollection, double offset)
- {
- BrushStop refStop = brushStopsCollection.First().Clone();
- brushStopsCollection = brushStopsCollection.Select(x => x.Clone()).ToList();
- brushStopsCollection.ForEach(x => x.OffsetPercent = x.OffsetPercent / 100d);
+ private LiquidVolumesStop GetRelativeCMYK(List<BrushStop> brushStopsCollection, double offset)
+ {
+ BrushStop refStop = brushStopsCollection.First();
var cmykCollection = brushStopsCollection.Select(x => GetCMYK(x)).ToList();
+ cmykCollection.ForEach(x => x.OffsetPercent = x.OffsetPercent / 100d);
var stop = cmykCollection.FirstOrDefault(f => f.OffsetPercent == offset);
if (stop != null) return stop;
- CMYK before = cmykCollection.Where(w => w.OffsetPercent == cmykCollection.Min(m => m.OffsetPercent)).First();
- CMYK after = cmykCollection.Where(w => w.OffsetPercent == cmykCollection.Max(m => m.OffsetPercent)).Last();
+ LiquidVolumesStop before = cmykCollection.Where(w => w.OffsetPercent == cmykCollection.Min(m => m.OffsetPercent)).First();
+ LiquidVolumesStop after = cmykCollection.Where(w => w.OffsetPercent == cmykCollection.Max(m => m.OffsetPercent)).Last();
foreach (var gs in cmykCollection)
{
@@ -229,30 +241,27 @@ namespace Tango.Integration.Operation
}
}
- CMYK cmyk = new CMYK();
-
- cmyk.C = (float)((offset - before.OffsetPercent) * (after.C - before.C) / (after.OffsetPercent - before.OffsetPercent) + before.C);
- cmyk.M = (float)((offset - before.OffsetPercent) * (after.M - before.M) / (after.OffsetPercent - before.OffsetPercent) + before.M);
- cmyk.Y = (float)((offset - before.OffsetPercent) * (after.Y - before.Y) / (after.OffsetPercent - before.OffsetPercent) + before.Y);
- cmyk.K = (float)((offset - before.OffsetPercent) * (after.K - before.K) / (after.OffsetPercent - before.OffsetPercent) + before.K);
+ LiquidVolumesStop cmyk = new LiquidVolumesStop();
- //cmyk.C *= 100d;
- //cmyk.M *= 100d;
- //cmyk.Y *= 100d;
- //cmyk.K *= 100d;
+ foreach (var v in refStop.LiquidVolumesOrderedPigmentedForStandardUser)
+ {
+ cmyk.Volumes[v.LiquidType] = (float)((offset - before.OffsetPercent) * (after.Volumes[v.LiquidType] - before.Volumes[v.LiquidType]) / (after.OffsetPercent - before.OffsetPercent) + before.Volumes[v.LiquidType]);
+ }
+
return cmyk;
}
- private CMYK GetCMYK(BrushStop stop)
+ private LiquidVolumesStop GetCMYK(BrushStop stop)
{
- CMYK cmyk = new CMYK();
- cmyk.C = stop.GetVolume(LiquidTypes.Cyan);
- cmyk.M = stop.GetVolume(LiquidTypes.Magenta);
- cmyk.Y = stop.GetVolume(LiquidTypes.Yellow);
- cmyk.K = stop.GetVolume(LiquidTypes.Black);
- cmyk.OffsetPercent = stop.OffsetPercent;
- return cmyk;
+ LiquidVolumesStop s = new LiquidVolumesStop();
+ foreach (var v in stop.LiquidVolumesOrderedPigmentedForStandardUser)
+ {
+ s.Volumes[v.LiquidType] = v.Volume;
+ }
+
+ s.OffsetPercent = stop.OffsetPercent;
+ return s;
}
private Color GetRelativeRGB(List<BrushStop> brushStopsCollection, double offset)
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Properties/PublishProfiles/Testing.pubxml b/Software/Visual_Studio/Web/Tango.MachineService/Properties/PublishProfiles/Testing.pubxml
index 12e2de377..a34bac35d 100644
--- a/Software/Visual_Studio/Web/Tango.MachineService/Properties/PublishProfiles/Testing.pubxml
+++ b/Software/Visual_Studio/Web/Tango.MachineService/Properties/PublishProfiles/Testing.pubxml
@@ -24,5 +24,21 @@ by editing this MSBuild file. In order to learn more about this please visit htt
<UserName>$machineservice__MachineService-TEST</UserName>
<_SavePWD>True</_SavePWD>
<_DestinationType>AzureWebSite</_DestinationType>
+ <PublishDatabaseSettings>
+ <Objects xmlns="">
+ <ObjectGroup Name="Tango.BL.ObservablesContext" Order="1" Enabled="False">
+ <Destination Path="" />
+ <Object Type="DbCodeFirst">
+ <Source Path="DBContext" DbContext="Tango.BL.ObservablesContext, Tango.BL" Origin="Convention" />
+ </Object>
+ </ObjectGroup>
+ </Objects>
+ </PublishDatabaseSettings>
</PropertyGroup>
+ <ItemGroup>
+ <MSDeployParameterValue Include="$(DeployParameterPrefix)Tango.BL.ObservablesContext-Web.config Connection String" />
+ </ItemGroup>
+ <ItemGroup>
+ <_ConnectionStringsToInsert Include="Tango.BL.ObservablesContext" />
+ </ItemGroup>
</Project> \ No newline at end of file