Пример #1
0
        protected override void OnRender(DrawingContext dc)
        {
            base.OnRender(dc);

            if (_drawEvents == null)
            {
                var loader = new ShapeFactory3D();
                //var points = loader.Load("./test_offset3.png", out _).First().Reverse();
                var points = OffsetCalculator.Join(loader.Load("./test_islands.png", out _).Reverse()).First().ToArray();

                /*/
                 * points = new Point2Dmm[]
                 * {
                 *    new Point2Dmm(0,0),
                 *    new Point2Dmm(100, 0),
                 *    new Point2Dmm(100, 100),
                 *    new Point2Dmm(60, 100),
                 *    new Point2Dmm(80, 110),
                 *    new Point2Dmm(30, 110),
                 *    new Point2Dmm(20, 100),
                 *    new Point2Dmm(0, 100),
                 *
                 *    new Point2Dmm(0,0),
                 * };/**/
                /*/
                 * points = new Point2Dmm[]
                 * {
                 *  new Point2Dmm(70,60),
                 *  new Point2Dmm(40,20),
                 *  new Point2Dmm(120,20),
                 *  new Point2Dmm(100,60),
                 *  new Point2Dmm(105,25),
                 *  new Point2Dmm(60,25),
                 *  new Point2Dmm(140,140),
                 *  new Point2Dmm(70,140),
                 *
                 *  new Point2Dmm(70,60),
                 * };/**/
                var offset = new OffsetCalculator(points, true);

                offset.WithOffset(40);
                _drawEvents     = offset.GetUpdateSnapshots().ToArray();
                _slider.Maximum = _drawEvents.Length - 1;
                _slider.Value   = _slider.Maximum;
            }

            var snapshotToDisplay = _drawEvents[(int)_slider.Value];

            foreach (var evt in snapshotToDisplay)
            {
                evt.Draw(dc);
            }
        }