using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using Tango.BL.Entities;
using Tango.BL.Enumerations;
using Tango.ColorConversion;
using Tango.Core;
using Tango.Core.ExtensionMethods;
namespace Tango.Integration.Operation
{
/// <summary>
/// Represents the default <see cref="IMachineOperator"/> gradient steps generation configuration.
/// </summary>
public class DefaultGradientGenerationConfiguration : ExtendedObject, IGradientGenerationConfiguration
{
private class CMYK
{
public double C { get; set; }
public double M { get; set; }
public double Y { get; set; }
public double K { get; set; }
public double OffsetPercent { get; set; }
}
private bool aborted;
private bool _isEnabled;
/// <summary>
/// Gets or sets a value indicating whether to generate the gradient steps.
/// </summary>
public bool IsEnabled
{
get { return _isEnabled; }
set { _isEnabled = value; RaisePropertyChangedAuto(); }
}
private int _resolutionCM;
/// <summary>
/// Gets or sets the gradient steps resolution in centimeters.
/// </summary>
public int ResolutionCM
{
get { return _resolutionCM; }
set { _resolutionCM = value; RaisePropertyChangedAuto(); }
}
/// <summary>
/// Initializes a new instance of the <see cref="DefaultGradientGenerationConfiguration"/> class.
/// </summary>
public DefaultGradientGenerationConfiguration()
{
ResolutionCM = 500;
}
/// <summary>
/// Creates a collection of brush stops representing the required gradient steps.
/// </summary>
/// <param name="segment">The segment.</param>
/// <param name="job">The job</param>
/// <param name="processParameters">The process parameters.</param>
/// <param name="progress">Progress callback.</param>
/// <returns></returns>
public List<BrushStop> Generate(Segment segment, Job job, ProcessParametersTable processParameters, Action<PreparingJobProgressEventArgs> progress = null)
{
aborted = false;
List<BrushStop> stops = new List<BrushStop>();
var previousSegmentsLength = segment.GetPreviousSegments().Sum(x => x.plain