public IEffectNode CreateEffectNode(Dictionary <Guid, ElementNode> elementNodes) { // Create a element node lookup of elements that are currently valid. //Currently we only have one TargetNode per effect, so removing all the extra junk that sorts though //Multiples. If it changes in the future, we can change this around. //IEnumerable<Guid> targetNodeIds = TargetNodes.Select(x => x.NodeId); //IEnumerable<Guid> validElementIds = targetNodeIds.Intersect(elementNodes.Keys); IEffectModuleInstance effect = Modules.ModuleManagement.GetEffect(TypeId); effect.InstanceId = InstanceId; effect.TimeSpan = TimeSpan; effect.StartTime = StartTime; //effect.TargetNodes = validElementIds.Select(x => elementNodes[x]).ToArray(); if (elementNodes.TryGetValue(TargetNodes.First().NodeId, out var node)) { effect.TargetNodes = new IElementNode[] { node }; } else { effect.TargetNodes = new IElementNode[] { new ProxyElementNode(TargetNodes.First().NodeId, TargetNodes.First().Name) }; } return(new EffectNode(effect, StartTime)); }
protected void SetOrientation() { var orientation = OrientationModule.GetOrientationForElement(TargetNodes.First()); switch (orientation) { case Orientation.Horizontal: StringOrientation = StringOrientation.Horizontal; break; default: StringOrientation = StringOrientation.Vertical; break; } }
protected override void _PreRender(CancellationTokenSource tokenSource = null) { _elementData = new EffectIntents(); if (TargetNodeHandling == TargetNodeSelection.Group) { if (TargetNodes.Length == 1) { var renderNodes = GetNodesToRenderOn(TargetNodes.First()); DoRendering(renderNodes, tokenSource); } else { DoRendering(TargetNodes.ToList(), tokenSource); } } else { if (TargetNodes.Length == 1) { var targetNodes = GetNodesToRenderOn(TargetNodes.First()); foreach (var elementNode in targetNodes) { var renderNodes = GetNodesToRenderOn(elementNode); DoRendering(renderNodes, tokenSource); } } else { foreach (var elementNode in TargetNodes) { var renderNodes = GetNodesToRenderOn(elementNode); DoRendering(renderNodes, tokenSource); } } } //_elementData = IntentBuilder.ConvertToStaticArrayIntents(_elementData, TimeSpan, IsDiscrete()); }
public void CacheElementEnumerator() { _cachedElements = TargetNodes.First()?.Distinct().ToList(); _elementsCached = true; }