Esempio n. 1
0
        private void SubdivisionCommandExecuted(object sender, ExecutedRoutedEventArgs args)
        {
            args.Handled = true;
            Window dialog = new SubdivisionTest()
            {
                Owner = this
            };

            dialog.ShowDialog();
        }
Esempio n. 2
0
        private void DrawSubdivision(Subdivision division)
        {
            // default to empty subdivision
            if (division == null)
            {
                division = new Subdivision();
            }

            _division = division;
            _division.Validate();
            SubdivisionTest.DrawSubdivision(OutputBox, FontSize, division);
        }
Esempio n. 3
0
        private void OnIntersect(object sender, RoutedEventArgs args)
        {
            args.Handled = true;

            RectD  bounds = OutputBounds;
            double x      = bounds.Left + (double)LeftUpDown.Value;
            double y      = bounds.Top + (double)TopUpDown.Value;
            double dx     = (double)WidthUpDown.Value;
            double dy     = (double)HeightUpDown.Value;

            Subdivision rectangle;

            if (sender == RectangleButton)
            {
                rectangle = Subdivision.FromLines(new LineD[] {
                    new LineD(x, y, x + dx, y),
                    new LineD(x + dx, y, x + dx, y + dy),
                    new LineD(x + dx, y + dy, x, y + dy),
                    new LineD(x, y + dy, x, y)
                });
            }
            else if (sender == DiamondButton)
            {
                rectangle = Subdivision.FromLines(new LineD[] {
                    new LineD(x + dx / 2, y, x + dx, y + dy / 2),
                    new LineD(x + dx, y + dy / 2, x + dx / 2, y + dy),
                    new LineD(x + dx / 2, y + dy, x, y + dy / 2),
                    new LineD(x, y + dy / 2, x + dx / 2, y)
                });
            }
            else
            {
                return;
            }

            rectangle.Validate();
            _division = Subdivision.Intersection(_division, rectangle, out _faceKeys);
            _division.Validate();
            SubdivisionTest.DrawSubdivision(OutputBox, FontSize, _division);
        }