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

            _strings = new List <PreviewBaseShape>();

            if (selectedNode != null)
            {
                List <ElementNode> children = PreviewTools.GetLeafNodes(selectedNode);
                int stringCount             = PreviewTools.GetParentNodes(selectedNode).Count();
                if (stringCount >= 4)
                {
                    int spokePixelCount = 0;
                    foreach (ElementNode node in selectedNode.Children)
                    {
                        spokePixelCount = Math.Max(spokePixelCount, node.Children.Count());
                    }

                    StringType = StringTypes.Pixel;

                    foreach (ElementNode node in selectedNode.Children)
                    {
                        PreviewLine line;
                        line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(20, 20), spokePixelCount, node, ZoomLevel);

                        line.PixelColor = Color.White;
                        _strings.Add(line);
                    }
                }
            }

            if (_strings.Count == 0)
            {
                // Just add lines, they will be layed out in Layout()
                StringType = StringTypes.Standard;
                for (int i = 0; i < 8; i++)
                {
                    PreviewLine line;
                    line            = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(20, 20), 10, selectedNode, ZoomLevel);
                    line.PixelColor = Color.White;
                    line.StringType = StringTypes.Standard;
                    _strings.Add(line);
                }
            }

            Layout();
        }
示例#2
0
        /// <inheritdoc />
        internal sealed override void Reconfigure(ElementNode node)
        {
            if (node != null)
            {
                List <ElementNode> children = PreviewTools.GetLeafNodes(node);
                // is this a single node?
                if (children.Count == 0)
                {
                    StringType            = StringTypes.Standard;
                    PixelCount            = 2;
                    _pixels[0].PixelColor = Color.White;
                    if (node.IsLeaf)
                    {
                        _pixels[0].Node = node;
                    }
                    //Creating = true;
                    CreateDefaultPixels = true;
                }
                else
                {
                    StringType = StringTypes.Pixel;
                    PixelCount = children.Count;
                    // Just add the pixels, they will get layed out next
                    int pixelNum = 0;
                    foreach (ElementNode child in children)
                    {
                        {
                            PreviewPixel pixel = _pixels[pixelNum];
                            pixel.Node       = child;
                            pixel.NodeId     = child.Id;
                            pixel.PixelColor = Color.White;
                        }
                        pixelNum++;
                    }
                    //Creating = true;
                }
            }
            else
            {
                //Creating = true;
                CreateDefaultPixels = true;
                PixelCount          = 2;
            }

            if (Creating == true)
            {
                EndCreation();
            }
            Layout();
        }
示例#3
0
        public PreviewPolyLine(PreviewPoint point1, PreviewPoint point2, ElementNode selectedNode, double zoomLevel)
        {
            ZoomLevel = zoomLevel;
            AddPoint(PointToZoomPoint(point1));

            if (selectedNode != null)
            {
                List <ElementNode> children = PreviewTools.GetLeafNodes(selectedNode);
                // is this a single node?
                if (children.Count == 0)
                {
                    StringType            = StringTypes.Standard;
                    PixelCount            = 2;
                    _pixels[0].PixelColor = Color.White;
                    if (selectedNode.IsLeaf)
                    {
                        _pixels[0].Node = selectedNode;
                    }
                    Creating            = true;
                    CreateDefaultPixels = true;
                }
                else
                {
                    StringType = StringTypes.Pixel;
                    PixelCount = children.Count;
                    // Just add the pixels, they will get layed out next
                    int pixelNum = 0;
                    foreach (ElementNode child in children)
                    {
                        {
                            PreviewPixel pixel = _pixels[pixelNum];
                            pixel.Node       = child;
                            pixel.NodeId     = child.Id;
                            pixel.PixelColor = Color.White;
                        }
                        pixelNum++;
                    }
                    Creating = true;
                }
            }
            else
            {
                Creating            = true;
                CreateDefaultPixels = true;
                PixelCount          = 2;
            }

            Layout();
        }
示例#4
0
        public PreviewStar(PreviewPoint point, ElementNode selectedNode)
        {
            _topLeftPoint     = point;
            _bottomRightPoint = new PreviewPoint(point.X, point.Y);

            _pixelCount = 40;
            _pointCount = 5;
            _insideSize = 40;

            if (selectedNode != null)
            {
                //List<ElementNode> children = selectedNode.Children.ToList();
                List <ElementNode> children = PreviewTools.GetLeafNodes(selectedNode);
                // is this a single node?
                if (children.Count >= 20)
                {
                    StringType = StringTypes.Pixel;
                    // Just add the pixels, they will get layed out next
                    foreach (ElementNode child in children)
                    {
                        PreviewPixel pixel = AddPixel(10, 10);
                        pixel.Node = child;
                        //pixel.NodeId = child.Id;
                        pixel.PixelColor = Color.White;
                    }
                    _pixelCount = children.Count;
                }
            }

            if (_pixels.Count == 0)
            {
                // Just add the pixels, they will get layed out next
                for (int lightNum = 0; lightNum < _pixelCount; lightNum++)
                {
                    PreviewPixel pixel = AddPixel(10, 10);
                    pixel.PixelColor = Color.White;
                    if (selectedNode != null && selectedNode.IsLeaf)
                    {
                        pixel.Node = selectedNode;
                        //pixel.NodeId = selectedNode.Id;
                    }
                }
            }

            // Lay out the pixels
            Layout();

            //DoResize += new ResizeEvent(OnResize);
        }
示例#5
0
 /// <inheritdoc />
 internal sealed override void Reconfigure(ElementNode node)
 {
     _pixels.Clear();
     if (node != null)
     {
         List <ElementNode> children = PreviewTools.GetLeafNodes(node);
         // is this a single node?
         if (children.Count == 0)
         {
             StringType = StringTypes.Standard;
             // Just add the pixels, they will get layed out next
             for (int lightNum = 0; lightNum < _lightCount; lightNum++)
             {
                 PreviewPixel pixel = AddPixel(10, 10);
                 pixel.PixelColor = Color.White;
                 if (node.IsLeaf)
                 {
                     pixel.Node = node;
                 }
             }
         }
         else
         {
             StringType = StringTypes.Pixel;
             // Just add the pixels, they will get layed out next
             foreach (ElementNode child in children)
             {
                 PreviewPixel pixel = AddPixel(10, 10);
                 pixel.Node       = child;
                 pixel.NodeId     = child.Id;
                 pixel.PixelColor = Color.White;
             }
         }
     }
     else
     {
         // Just add the pixels, they will get layed out next
         for (int lightNum = 0; lightNum < _lightCount; lightNum++)
         {
             //Console.WriteLine("Added: " + lightNum.ToString());
             PreviewPixel pixel = AddPixel(10, 10);
             pixel.PixelColor = Color.White;
         }
     }
     // Lay out the pixels
     Layout();
 }
示例#6
0
        public PreviewStar(PreviewPoint point, ElementNode selectedNode, double zoomLevel)
        {
            ZoomLevel         = zoomLevel;
            _topLeftPoint     = PointToZoomPoint(point);
            _bottomRightPoint = PointToZoomPoint(point);

            _pixelCount = 40;
            _pointCount = 5;
            _insideSize = 40;

            if (selectedNode != null)
            {
                List <ElementNode> children = PreviewTools.GetLeafNodes(selectedNode);
                // is this a single node?
                if (children.Count >= 10)
                {
                    StringType = StringTypes.Pixel;
                    // Just add the pixels, they will get layed out next
                    foreach (ElementNode child in children)
                    {
                        PreviewPixel pixel = AddPixel(10, 10);
                        pixel.Node       = child;
                        pixel.PixelColor = Color.White;
                    }
                    _pixelCount = children.Count;
                }
            }

            if (_pixels.Count == 0)
            {
                // Just add the pixels, they will get layed out next
                for (int lightNum = 0; lightNum < _pixelCount; lightNum++)
                {
                    PreviewPixel pixel = AddPixel(10, 10);
                    pixel.PixelColor = Color.White;
                    if (selectedNode != null && selectedNode.IsLeaf)
                    {
                        pixel.Node = selectedNode;
                    }
                }
            }

            // Lay out the pixels
            Layout();
        }
示例#7
0
        public PreviewArch(PreviewPoint point1, ElementNode selectedNode, double zoomLevel)
        {
            ZoomLevel   = zoomLevel;
            TopLeft     = PointToZoomPoint(point1).ToPoint();
            BottomRight = new PreviewPoint(_topLeft.X, _topLeft.Y).ToPoint();

            int lightCount = 25;

            if (selectedNode != null)
            {
                List <ElementNode> children = PreviewTools.GetLeafNodes(selectedNode);
                // is this a single node?
                if (children.Count >= 4)
                {
                    StringType = StringTypes.Pixel;
                    lightCount = children.Count;
                    // Just add the pixels, they will get layed out next
                    foreach (ElementNode child in children)
                    {
                        {
                            PreviewPixel pixel = AddPixel(10, 10);
                            pixel.Node       = child;
                            pixel.PixelColor = Color.White;
                        }
                    }
                }
            }

            if (_pixels.Count == 0)
            {
                // Just add the pixels, they will get layed out next
                for (int lightNum = 0; lightNum < lightCount; lightNum++)
                {
                    PreviewPixel pixel = AddPixel(10, 10);
                    pixel.PixelColor = Color.White;
                    if (selectedNode != null && selectedNode.IsLeaf)
                    {
                        pixel.Node = selectedNode;
                    }
                }
            }

            // Lay out the pixels
            Layout();
        }
示例#8
0
        /// <inheritdoc />
        internal sealed override void Reconfigure(ElementNode node)
        {
            _pixels.Clear();
            var lightCount = 25;

            if (node != null)
            {
                List <ElementNode> children = PreviewTools.GetLeafNodes(node);
                // is this a single node?
                if (children.Count >= 4)
                {
                    StringType = StringTypes.Pixel;
                    lightCount = children.Count;
                    // Just add the pixels, they will get laid out next
                    foreach (ElementNode child in children)
                    {
                        {
                            PreviewPixel pixel = AddPixel(10, 10);
                            pixel.Node       = child;
                            pixel.PixelColor = Color.White;
                        }
                    }
                }
            }

            if (_pixels.Count == 0)
            {
                // Just add the pixels, they will get laid out next
                for (int lightNum = 0; lightNum < lightCount; lightNum++)
                {
                    PreviewPixel pixel = AddPixel(10, 10);
                    pixel.PixelColor = Color.White;
                    if (node != null && node.IsLeaf)
                    {
                        pixel.Node = node;
                    }
                }
            }

            // Lay out the pixels
            Layout();
        }
示例#9
0
        /// <inheritdoc />
        internal sealed override void Reconfigure(ElementNode node)
        {
            _archPixelCount = 8;
            _linePixelCount = 8;
            _pixels.Clear();
            int lightCount = _archPixelCount + _linePixelCount;

            if (node != null)
            {
                List <ElementNode> children = PreviewTools.GetLeafNodes(node);
                // is this a single node?
                if (children.Count >= 8)
                {
                    StringType      = StringTypes.Pixel;
                    _archPixelCount = children.Count / 2;
                    _linePixelCount = children.Count - _archPixelCount;
                    if (_archPixelCount + _linePixelCount > children.Count)
                    {
                        _archPixelCount -= 1;
                    }
                    else if (_archPixelCount + _linePixelCount < children.Count)
                    {
                        _linePixelCount -= 1;
                    }
                    lightCount = children.Count;
                    // Just add the pixels, they will get layed out next
                    foreach (ElementNode child in children)
                    {
                        PreviewPixel pixel = AddPixel(10, 10);
                        pixel.Node       = child;
                        pixel.PixelColor = Color.White;
                    }
                }
            }

            AddPixels(node, lightCount);

            // Lay out the pixels
            Layout();
        }
示例#10
0
        public PreviewRectangle(PreviewPoint point1, ElementNode selectedNode)
        {
            _topLeft     = point1;
            _topRight    = new PreviewPoint(point1);
            _bottomLeft  = new PreviewPoint(point1);
            _bottomRight = new PreviewPoint(point1);

            _strings = new List <PreviewBaseShape>();

            if (selectedNode != null)
            {
                List <ElementNode> children = PreviewTools.GetLeafNodes(selectedNode);
                if (children.Count >= 8)
                {
                    int increment  = children.Count / 4;
                    int pixelsLeft = children.Count;

                    StringType = StringTypes.Pixel;

                    // Just add lines, they will be layed out in Layout()
                    for (int i = 0; i < 4; i++)
                    {
                        PreviewLine line;
                        if (pixelsLeft >= increment)
                        {
                            line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(20, 20), increment, null);
                        }
                        else
                        {
                            line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(20, 20), pixelsLeft, null);
                        }
                        line.PixelColor = Color.White;
                        _strings.Add(line);

                        pixelsLeft -= increment;
                    }

                    int pixelNum = 0;
                    foreach (PreviewPixel pixel in Pixels)
                    {
                        pixel.Node   = children[pixelNum];
                        pixel.NodeId = children[pixelNum].Id;
                        pixelNum++;
                    }
                }
            }

            if (_strings.Count == 0)
            {
                // Just add lines, they will be layed out in Layout()
                for (int i = 0; i < 4; i++)
                {
                    PreviewLine line;
                    line            = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(20, 20), 10, selectedNode);
                    line.PixelColor = Color.White;
                    _strings.Add(line);
                }
            }

            Layout();

            //DoResize += new ResizeEvent(OnResize);
        }
示例#11
0
        public PreviewTriangle(PreviewPoint point1, ElementNode selectedNode, double zoomLevel)
        {
            ZoomLevel         = zoomLevel;
            _bottomRightPoint = PointToZoomPoint(point1);
            _point1           = new PreviewPoint(_bottomRightPoint);
            _point2           = new PreviewPoint(_bottomRightPoint);
            _point3           = new PreviewPoint(_bottomRightPoint);

            _strings = new List <PreviewBaseShape>();

            if (selectedNode != null)
            {
                List <ElementNode> children = PreviewTools.GetLeafNodes(selectedNode);
                if (children.Count >= 6)
                //
                {
                    int increment  = children.Count / 3;
                    int pixelsLeft = children.Count;

                    StringType = StringTypes.Pixel;

                    // Just add lines, they will be layed out in Layout()
                    for (int i = 0; i < 3; i++)
                    {
                        PreviewLine line;
                        if (pixelsLeft >= increment)
                        {
                            line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(20, 20), increment, null, ZoomLevel);
                        }
                        else
                        {
                            line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(20, 20), pixelsLeft, null, ZoomLevel);
                        }
                        line.PixelColor = Color.White;
                        _strings.Add(line);

                        pixelsLeft -= increment;
                    }

                    int pixelNum = 0;
                    foreach (PreviewPixel pixel in Pixels)
                    {
                        pixel.Node   = children[pixelNum];
                        pixel.NodeId = children[pixelNum].Id;
                        pixelNum++;
                    }
                }
            }

            if (_strings.Count == 0)
            {
                // Just add lines, they will be layed out in Layout()
                for (int i = 0; i < 3; i++)
                {
                    PreviewLine line;
                    line            = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(20, 20), 10, selectedNode, ZoomLevel);
                    line.PixelColor = Color.White;
                    _strings.Add(line);
                }
            }

            Layout();
        }
示例#12
0
        public PreviewCane(PreviewPoint point, ElementNode selectedNode)
        {
            _topLeftPoint     = point;
            _bottomRightPoint = new PreviewPoint(point.X, point.Y);
            _archLeftPoint    = new PreviewPoint(point.X, point.Y);

            _archPixelCount = 8;
            _linePixelCount = 8;

            int lightCount = _archPixelCount + _linePixelCount;

            if (selectedNode != null)
            {
                //List<ElementNode> children = selectedNode.Children.ToList();
                List <ElementNode> children = PreviewTools.GetLeafNodes(selectedNode);
                // is this a single node?
                if (children.Count >= 8)
                {
                    StringType      = StringTypes.Pixel;
                    _archPixelCount = children.Count / 2;
                    _linePixelCount = children.Count / 2;
                    if (_archPixelCount + _linePixelCount > children.Count)
                    {
                        _archPixelCount -= 1;
                    }
                    else if (_archPixelCount + _linePixelCount < children.Count)
                    {
                        _linePixelCount -= 1;
                    }
                    lightCount = children.Count;
                    // Just add the pixels, they will get layed out next
                    foreach (ElementNode child in children)
                    {
                        PreviewPixel pixel = AddPixel(10, 10);
                        pixel.Node = child;
                        //pixel.NodeId = child.Id;
                        pixel.PixelColor = Color.White;
                    }
                }
            }

            if (_pixels.Count == 0)
            {
                // Just add the pixels, they will get layed out next
                for (int lightNum = 0; lightNum < lightCount; lightNum++)
                {
                    PreviewPixel pixel = AddPixel(10, 10);
                    pixel.PixelColor = Color.White;
                    if (selectedNode != null && selectedNode.IsLeaf)
                    {
                        pixel.Node = selectedNode;
                        //pixel.NodeId = selectedNode.Id;
                    }
                }
            }

            // Lay out the pixels
            Layout();

            //DoResize += new ResizeEvent(OnResize);
        }
示例#13
0
        public PreviewRectangle(PreviewPoint point1, ElementNode selectedNode, double zoomLevel)
        {
            ZoomLevel    = zoomLevel;
            _topLeft     = PointToZoomPoint(point1);
            _topRight    = new PreviewPoint(_topLeft);
            _bottomLeft  = new PreviewPoint(_topLeft);
            _bottomRight = new PreviewPoint(_topLeft);

            _strings = new List <PreviewBaseShape>();

            if (selectedNode != null)
            {
                List <ElementNode> parents = PreviewTools.GetParentNodes(selectedNode);
                // Do we have the 4 sides of the rectangle defined in our elements?
                if (parents.Count() == 4)
                {
                    foreach (ElementNode pixelString in parents)
                    {
                        PreviewLine line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(20, 20), pixelString.Children.Count(), pixelString, ZoomLevel);
                        line.PixelColor = Color.White;
                        _strings.Add(line);
                    }
                }
                else
                {
                    List <ElementNode> children = PreviewTools.GetLeafNodes(selectedNode);
                    if (children.Count >= 8)
                    {
                        int increment  = children.Count / 4;
                        int pixelsLeft = children.Count;

                        StringType = StringTypes.Pixel;

                        // Just add lines, they will be layed out in Layout()
                        for (int i = 0; i < 4; i++)
                        {
                            PreviewLine line;
                            if (pixelsLeft >= increment)
                            {
                                line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(20, 20), increment, null, ZoomLevel);
                            }
                            else
                            {
                                line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(20, 20), pixelsLeft, null, ZoomLevel);
                            }
                            line.PixelColor = Color.White;
                            _strings.Add(line);

                            pixelsLeft -= increment;
                        }

                        int pixelNum = 0;
                        foreach (PreviewPixel pixel in Pixels)
                        {
                            pixel.Node   = children[pixelNum];
                            pixel.NodeId = children[pixelNum].Id;
                            pixelNum++;
                        }
                    }
                }
            }

            if (_strings.Count == 0)
            {
                // Just add lines, they will be layed out in Layout()
                for (int i = 0; i < 4; i++)
                {
                    PreviewLine line;
                    line            = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(20, 20), 10, selectedNode, ZoomLevel);
                    line.PixelColor = Color.White;
                    _strings.Add(line);
                }
            }

            Layout();
        }
示例#14
0
        /// <inheritdoc />
        internal sealed override void Reconfigure(ElementNode node)
        {
            _strings = new List <PreviewBaseShape>();

            if (node != null)
            {
                List <ElementNode> parents = PreviewTools.GetParentNodes(node);
                // Do we have the 4 sides of the rectangle defined in our elements?
                if (parents.Count() == 4)
                {
                    foreach (ElementNode pixelString in parents)
                    {
                        PreviewLine line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(20, 20), pixelString.Children.Count(), pixelString, ZoomLevel);
                        line.PixelColor = Color.White;
                        _strings.Add(line);
                    }
                }
                else
                {
                    List <ElementNode> children = PreviewTools.GetLeafNodes(node);
                    if (children.Count >= 8)
                    {
                        int increment  = children.Count / 4;
                        int pixelsLeft = children.Count;

                        StringType = StringTypes.Pixel;

                        // Just add lines, they will be layed out in Layout()
                        for (int i = 0; i < 4; i++)
                        {
                            PreviewLine line;
                            if (pixelsLeft >= increment)
                            {
                                line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(20, 20), increment, null, ZoomLevel);
                            }
                            else
                            {
                                line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(20, 20), pixelsLeft, null, ZoomLevel);
                            }
                            line.PixelColor = Color.White;
                            _strings.Add(line);

                            pixelsLeft -= increment;
                        }

                        int pixelNum = 0;
                        foreach (PreviewPixel pixel in Pixels)
                        {
                            pixel.Node   = children[pixelNum];
                            pixel.NodeId = children[pixelNum].Id;
                            pixelNum++;
                        }
                    }
                }
            }

            if (_strings.Count == 0)
            {
                // Just add lines, they will be layed out in Layout()
                for (int i = 0; i < 4; i++)
                {
                    PreviewLine line;
                    line            = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(20, 20), 10, node, ZoomLevel);
                    line.PixelColor = Color.White;
                    _strings.Add(line);
                }
            }

            Layout();
        }