示例#1
0
        public PreviewPixelGrid(PreviewPoint point1, ElementNode selectedNode, double zoomLevel)
        {
            ZoomLevel    = zoomLevel;
            _topRight    = PointToZoomPoint(point1);
            _topLeft     = PointToZoomPoint(point1);
            _bottomRight = new PreviewPoint(_topLeft.X, _topLeft.Y);
            _bottomLeft  = new PreviewPoint(_bottomRight);

            int defaultStringCount     = 16;
            int defaultLightsPerString = 50;

            _strings = new List <PreviewBaseShape>();

            int childLightCount;

            if (IsPixelGridSelected(selectedNode, out childLightCount))
            {
                StringType = StringTypes.Pixel;
                foreach (ElementNode child in selectedNode.Children)
                {
                    PreviewLine line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(10, 10), childLightCount, child, ZoomLevel);
                    _strings.Add(line);
                }
                LightsPerString = childLightCount;
            }
            else if (IsStandardGridSelected(selectedNode))
            {
                StringType = StringTypes.Standard;
                foreach (ElementNode child in selectedNode.Children)
                {
                    PreviewLine line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(10, 10), defaultLightsPerString, child, ZoomLevel);
                    _strings.Add(line);
                }
            }
            else
            {
                // Just add the pixels, we don't care where they go... they get positioned in Layout()
                for (int stringNum = 0; stringNum < defaultStringCount; stringNum++)
                {
                    PreviewLine line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(10, 10), defaultLightsPerString, null, ZoomLevel);
                    _strings.Add(line);
                }
            }
            if (childLightCount == -1)
            {
                LightsPerString = defaultLightsPerString;
            }
            StringCount = _strings.Count();

            if (selectedNode.Properties.Contains(OrientationDescriptor._typeId))
            {
                var m = selectedNode.Properties.Get(OrientationDescriptor._typeId) as OrientationModule;
                if (m.Orientation == Orientation.Horizontal)
                {
                    _stringOrientation = StringOrientations.Horizontal;
                }
            }
            // Lay out the pixels
            Layout();
        }
示例#2
0
        /// <inheritdoc />
        internal sealed override void Reconfigure(ElementNode node)
        {
            int defaultStringCount     = 16;
            int defaultLightsPerString = 50;

            _strings = new List <PreviewBaseShape>();
            _pixels.Clear();

            int childLightCount;

            if (IsPixelGridSelected(node, out childLightCount))
            {
                StringType = StringTypes.Pixel;
                foreach (ElementNode child in node.Children)
                {
                    PreviewLine line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(10, 10), childLightCount, child, ZoomLevel);
                    _strings.Add(line);
                }
                LightsPerString = childLightCount;
            }
            else if (IsStandardGridSelected(node))
            {
                StringType = StringTypes.Standard;
                foreach (ElementNode child in node.Children)
                {
                    PreviewLine line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(10, 10), defaultLightsPerString, child, ZoomLevel);
                    _strings.Add(line);
                }
            }
            else
            {
                // Just add the pixels, we don't care where they go... they get positioned in Layout()
                for (int stringNum = 0; stringNum < defaultStringCount; stringNum++)
                {
                    PreviewLine line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(10, 10), defaultLightsPerString, null, ZoomLevel);
                    _strings.Add(line);
                }
            }
            if (childLightCount == -1)
            {
                LightsPerString = defaultLightsPerString;
            }
            StringCount = _strings.Count();

            if (node != null && node.Properties.Contains(OrientationDescriptor._typeId))
            {
                var m = node.Properties.Get(OrientationDescriptor._typeId) as OrientationModule;
                if (m.Orientation == Orientation.Horizontal)
                {
                    _stringOrientation = StringOrientations.Horizontal;
                }
            }
            // Lay out the pixels
            Layout();
        }