using System; using System.Collections.ObjectModel; using System.Linq; namespace Artemis.Core.Models.Profile.LayerProperties { public class LayerProperty : BaseLayerProperty { public LayerProperty(Layer layer, BaseLayerProperty parent, string id, string name, string description) : base(layer, parent, id, name, description, typeof(T)) { } /// /// Gets or sets the value of the property without any keyframes applied /// public T Value { get => BaseValue != null ? (T) BaseValue : default; set => BaseValue = value; } /// /// Gets the value of the property with keyframes applied /// public T CurrentValue { get { var currentValue = base.GetCurrentValue(); return currentValue == null ? default : (T)currentValue; } } /// /// Gets a list of keyframes defining different values of the property in time, this list contains the strongly typed /// /// public ReadOnlyCollection> Keyframes => BaseKeyframes.Cast>().ToList().AsReadOnly(); /// /// Adds a keyframe to the property. /// /// The keyframe to remove public void AddKeyframe(Keyframe keyframe) { base.AddKeyframe(keyframe); } /// /// Removes a keyframe from the property. /// /// The keyframe to remove public void RemoveKeyframe(Keyframe keyframe) { base.RemoveKeyframe(keyframe); } } }