コード例 #1
0
 public void restore()
 {
     _sketch.clearShapes();
     foreach (var pair in _shapeGeometry)
     {
         Shape            shape      = pair.Key;
         List <Substroke> substrokes = pair.Value;
         shape.AddSubstrokes(substrokes);
         _sketch.AddShape(shape);
     }
 }
コード例 #2
0
        /// <summary>
        /// Refreshes the underlying data structures corresponding to the inkStroke after the
        /// inkStroke has been modified (moved or resized)
        /// </summary>
        /// <param name="inkStroke">The Ink Stroke to modify</param>
        public void UpdateInkStroke(System.Windows.Ink.Stroke inkStroke)
        {
            // Delete the old stroke but save its shape for the new Stroke
            Sketch.Shape oldShape = GetSketchSubstrokeByInk(inkStroke).ParentShape;
            DeleteStroke(inkStroke);

            // Add the new stroke to the Sketch and put it in the old Shape
            AddStroke(inkStroke);
            Sketch.Substroke newSubstroke = GetSketchSubstrokeByInk(inkStroke);
            if (oldShape != null)
            {
                oldShape.AddSubstroke(newSubstroke);
                if (!Sketch.ShapesL.Contains(oldShape))
                {
                    Sketch.AddShape(oldShape);
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Refreshes the underlying data structures corresponding to the inkStroke after the
        /// inkStroke has been modified (moved or resized)
        /// </summary>
        /// <param name="inkStroke">The Ink Stroke to modify</param>
        public void UpdateInkStroke(System.Windows.Ink.Stroke inkStroke)
        {
            // Remove the old substroke, saving the old shape for the new substroke.
            Shape oldShape = GetSketchSubstrokeByInk(inkStroke).ParentShape;

            DeleteStroke(inkStroke);

            AddStroke(inkStroke);
            Substroke newSubstroke = GetSketchSubstrokeByInk(inkStroke);

            if (newSubstroke.ParentShape != null)
            {
                throw new Exception("jesus dear lord why does this newly"
                                    + "created substroke already have a parent Shape");
            }
            if (oldShape != null)
            {
                oldShape.AddSubstroke(newSubstroke);
                if (!Sketch.containsShape(oldShape))
                {
                    Sketch.AddShape(oldShape);
                }
            }
        }