コード例 #1
0
        public ElementModel AddLightNode(ElementModel target, Point p, int?order = null, int?size = null)
        {
            if (target == null || target.IsRootNode)
            {
                target = FindOrCreateTargetGroupForLight();
            }
            else if (target.Lights.Any())
            {
                throw new ArgumentException("Cannot add light node to leaf element with lights.");
            }

            if (order == null)
            {
                order = GetNextOrder();
            }

            ElementModel em = new ElementModel(Uniquify($"{target.Name}", 1), order.Value, target);

            target.AddChild(em);
            _models.Add(em.Id, em);
            if (size == null)
            {
                size = em.LightSize;
            }
            else
            {
                em.LightSize = size.Value;
            }

            var light = CreateLight(p, size.Value, em.Id);

            em.AddLight(light);

            return(em);
        }
コード例 #2
0
        public ElementModel CreateNode(string name, ElementModel parent = null, bool oneBasedNaming = false)
        {
            if (parent == null)
            {
                parent = _prop.RootNode;
            }

            ElementModel em = new ElementModel(Uniquify(name, oneBasedNaming?1:2), parent);

            parent.AddChild(em);
            _models.Add(em.Id, em);
            return(em);
        }
コード例 #3
0
        private ElementModel CreateNode(string name, Guid id, ElementModel parent)
        {
            if (parent == null)
            {
                parent = _prop.RootNode;
            }
            ElementModel em = new ElementModel(Uniquify(name), parent)
            {
                Id = id
            };

            parent.AddChild(em);
            _models.Add(em.Id, em);
            return(em);
        }