public static bool SuitableFor(Definition definition)
 {
     return definition.Channels.Any(x => x.Name == "Red") &&
         definition.Channels.Any(x => x.Name == "Green") &&
         definition.Channels.Any(x => x.Name == "Blue") &&
         !definition.Channels.Any(x => x.Name == "UV");
 }
 public static Definition Load(JObject modelElement)
 {
     Definition definition = new Definition();
     foreach (JObject channelElement in modelElement["channels"])
     {
         DMXChannel channel = DMXChannel.Load(channelElement);
         definition.Channels.Add(channel);
     }
     definition.Type = (FixtureType)Enum.Parse(typeof(FixtureType), modelElement["type"].Value<string>());
     definition.Name = modelElement["name"].Value<string>();
     if (modelElement["movements"] != null)
     {
         foreach (JObject movementAxis in modelElement["movements"])
         {
             MovementAxis axis = MovementAxis.Load(movementAxis);
             definition.Axis.Add(axis);
         }
     }
     if(modelElement["colorWheel"] != null)
     {
         foreach (JObject colorWheelEntry in modelElement["colorWheel"])
         {
             ColorWheelEntry entry = ColorWheelEntry.Load(colorWheelEntry);
             definition.ColorWheel.Add(entry);
         }
     }
     return definition;
 }
 public static Definition GetMovingFixtureDefinition(string axisName, int min, int max)
 {
     Definition definition = new Definition();
     definition.Channels.Add(new DMXChannel(axisName, definition.Channels.Count + 1));
     definition.Axis.Add(new MovementAxis(axisName, min, max));
     definition.Name = "Moving Fixture";
     return definition;
 }
 public static bool SuitableFor(Definition definition)
 {
     return definition.Channels.Any(x => x.Name == "ColorWheel") &&
         definition.ColorWheel.Count > 0 &&
         !(definition.Channels.Any(x => x.Name == "Red") &&
         definition.Channels.Any(x => x.Name == "Green") &&
         definition.Channels.Any(x => x.Name == "Blue")); // suitable if there's a colorwheel but no RGB
 }
 public static Fixture GetColorWheelFixture(IEnumerable<ColorWheelEntry> colors)
 {
     Definition definition = new Definition();
     definition.Channels.Add(new DMXChannel("ColorWheel", definition.Channels.Count + 1));
     definition.Channels.Add(new DMXChannel("Master", definition.Channels.Count + 1));
     definition.ColorWheel.AddRange(colors);
     Fixture fixture = new Fixture(definition, 1, GroupTests.GetGroup(), new Newtonsoft.Json.Linq.JObject());
     return fixture;
 }
 public static Fixture GetRGBFixture(JObject options = null)
 {
     var definition = new Definition();
     definition.Channels.Add(new DMXChannel("Red", definition.Channels.Count + 1));
     definition.Channels.Add(new DMXChannel("Green", definition.Channels.Count + 1));
     definition.Channels.Add(new DMXChannel("Blue", definition.Channels.Count + 1));
     var fixture = new Fixture(definition, 1, GroupTests.GetGroup(), options ?? new JObject());
     return fixture;
 }
        private static IEnumerable<string> GetRestrictedAxisNames(Definition definition, JObject options)
        {
            var restrictedNames = from option in options["axisRestrictions"]?.Values<JObject>() ?? Enumerable.Empty<JObject>()
                                  select option["name"].Value<string>();

            var restrictedAxis = from name in restrictedNames
                                 where definition.Axis.Any(x => x.Name == name)
                                 select name;

            return restrictedAxis;
        }
        private static IEnumerable<string> GetInvertedAxis(Definition definition, JObject options)
        {
            var invertOptions = from option in options["axisInversions"]?.Values<string>() ?? Enumerable.Empty<string>()
                                select option;

            var invertedAxis = from option in invertOptions
                               where definition.Axis.Any(x => x.Name == option)
                               select option;

            return invertedAxis;
        }
 public static Fixture Get16BitMovingFixture(params string[] axis)
 {
     var definition = new Definition();
     foreach (string axisName in axis)
     {
         definition.Axis.Add(new MovementAxis(axisName, -90, 90));
         definition.Channels.Add(new DMXChannel(axisName + "Coarse", definition.Channels.Count + 1));
         definition.Channels.Add(new DMXChannel(axisName + "Fine", definition.Channels.Count + 1));
     }
     Fixture fixture = new Fixture(definition, 1, GroupTests.GetGroup(), new Newtonsoft.Json.Linq.JObject());
     return fixture;
 }
 public Fixture(Definition definition, int startChannel, Group group, JObject options)
 {
     Definition = definition;
     Solvers = new List<FixtureSolver>();
     Settables = new Dictionary<string, Solvers.Attribute>();
     FrameSettables = new Dictionary<string, Solvers.Attribute>();
     foreach (Solvers.Attribute attribute in Definition.Channels)
     {
         Settables.Add(attribute.Name, attribute);
         FrameSettables.Add(attribute.Name, attribute);
     }
     MovementAxis = new Dictionary<string, MovementAxis>();
     foreach(var axis in Definition.Axis)
     {
         MovementAxis.Add(axis.Name, axis);
     }
     Solvers.AddRange(FixtureSolver.GetDefaultSolvers(this, options));
     Options = options;
     StartChannel = startChannel;
     Group = group;
     Group.Fixtures.Add(this);
 }
 internal static bool SuitableFor(Definition definition, JObject options)
 {
     return options["maxBrightness"]?.Value<float>() < 1f;
 }
 internal static bool SuitableFor(Definition definition, JObject options)
 {
     return GetRestrictedAxisNames(definition, options).Count() > 0;
 }
 internal static bool SuitableFor(Definition definition)
 {
     return definition.Channels.Any(x => x.Name == "PanCoarse") ||
         definition.Channels.Any(x => x.Name == "TiltCoarse");
 }
 private static IEnumerable<string> Get16BitAxisNames(Definition fixtureDefinition)
 {
     var names = from movement in fixtureDefinition.Axis
                 select movement.Name;
     return names;
 }
 internal static bool SuitableFor(Definition definition)
 {
     return definition.Type == FixtureType.LED &&
         !definition.Channels.Any(x => x.Name == "Strobe");
 }
 internal static bool SuitableFor(Definition definition)
 {
     return definition.Axis.Count > 0;
 }
 public static bool SuitableFor(Definition definition)
 {
     return definition.Channels.Any(x => x.Name == "Master") &&
         definition.Channels.Any(x => AllColors.Contains(x.Name));
 }
 public static bool SuitableFor(Definition definition, JObject options)
 {
     return GetInvertedAxis(definition, options).Count() > 0;
 }