Ejemplo n.º 1
0
        public static Layer FromLayerEntity(Profile profile, LayerEntity layerEntity, IPluginService pluginService)
        {
            var layer = new Layer(profile)
            {
                Name      = layerEntity.Name,
                Order     = layerEntity.Order,
                LayerType = pluginService.GetLayerTypeByGuid(Guid.Parse(layerEntity.Guid))
            };

            return(layer);
        }
Ejemplo n.º 2
0
        public Layer(Profile profile, ProfileElement parent, string name)
        {
            LayerEntity = new LayerEntity();
            EntityId    = Guid.NewGuid();

            Profile = profile;
            Parent  = parent;
            Name    = name;

            _leds       = new List <ArtemisLed>();
            _properties = new Dictionary <string, BaseLayerProperty>();

            CreateDefaultProperties();
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     Creates a new instance of the <see cref="Layer" /> class based on the provided layer entity
        /// </summary>
        /// <param name="profile">The profile the layer belongs to</param>
        /// <param name="parent">The parent of the layer</param>
        /// <param name="layerEntity">The entity of the layer</param>
        public Layer(Profile profile, ProfileElement parent, LayerEntity layerEntity) : base(parent.Profile)
        {
            LayerEntity = layerEntity;
            EntityId    = layerEntity.Id;

            Profile    = profile;
            Parent     = parent;
            _general   = new LayerGeneralProperties();
            _transform = new LayerTransformProperties();

            _leds = new List <ArtemisLed>();

            Load();
            Initialize();
        }
Ejemplo n.º 4
0
        internal Layer(Profile profile, ProfileElement parent, LayerEntity layerEntity)
        {
            LayerEntity = layerEntity;
            Profile     = profile;
            Parent      = parent;
            General     = new LayerGeneralProperties();
            Transform   = new LayerTransformProperties();

            _layerEffects           = new List <BaseLayerEffect>();
            _leds                   = new List <ArtemisLed>();
            _expandedPropertyGroups = new List <string>();

            Load();
            Initialize();
        }
Ejemplo n.º 5
0
        /// <summary>
        ///     Creates a new instance of the <see cref="Layer" /> class and adds itself to the child collection of the provided
        ///     <paramref name="parent" />
        /// </summary>
        /// <param name="parent">The parent of the layer</param>
        /// <param name="name">The name of the layer</param>
        public Layer(ProfileElement parent, string name) : base(parent.Profile)
        {
            LayerEntity = new LayerEntity();
            EntityId    = Guid.NewGuid();

            Parent     = parent ?? throw new ArgumentNullException(nameof(parent));
            Profile    = Parent.Profile;
            Name       = name;
            Enabled    = true;
            _general   = new LayerGeneralProperties();
            _transform = new LayerTransformProperties();

            _leds = new List <ArtemisLed>();

            Initialize();
            Parent.AddChild(this, 0);
        }
Ejemplo n.º 6
0
        internal Layer(Profile profile, ProfileElement parent, LayerEntity layerEntity)
        {
            LayerEntity = layerEntity;
            EntityId    = layerEntity.Id;

            Profile = profile;
            Parent  = parent;
            Name    = layerEntity.Name;
            Order   = layerEntity.Order;

            _leds       = new List <ArtemisLed>();
            _properties = new Dictionary <string, BaseLayerProperty>();

            CreateDefaultProperties();

            switch (layerEntity.ShapeEntity?.Type)
            {
            case ShapeEntityType.Ellipse:
                LayerShape = new Ellipse(this, layerEntity.ShapeEntity);
                break;

            case ShapeEntityType.Fill:
                LayerShape = new Fill(this, layerEntity.ShapeEntity);
                break;

            case ShapeEntityType.Polygon:
                LayerShape = new Polygon(this, layerEntity.ShapeEntity);
                break;

            case ShapeEntityType.Rectangle:
                LayerShape = new Rectangle(this, layerEntity.ShapeEntity);
                break;

            case null:
                LayerShape = null;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        ///     Creates a new instance of the <see cref="Layer" /> class and adds itself to the child collection of the provided
        ///     <paramref name="parent" />
        /// </summary>
        /// <param name="parent">The parent of the layer</param>
        /// <param name="name">The name of the layer</param>
        public Layer(ProfileElement parent, string name)
        {
            LayerEntity = new LayerEntity();
            EntityId    = Guid.NewGuid();

            Parent              = parent ?? throw new ArgumentNullException(nameof(parent));
            Profile             = Parent.Profile;
            Name                = name;
            Enabled             = true;
            DisplayContinuously = true;
            General             = new LayerGeneralProperties();
            Transform           = new LayerTransformProperties();

            _layerEffects           = new List <BaseLayerEffect>();
            _leds                   = new List <ArtemisLed>();
            _expandedPropertyGroups = new List <string>();

            Initialize();
            ApplyRenderElementDefaults();

            Parent.AddChild(this);
        }