示例#1
0
        /// <summary>
        /// Deletes a Stroke from our internal data structures - the Sketch and FeatureSketch
        /// </summary>
        /// Precondition: The InkStroke is in the InkCanvas's collection of strokes.
        /// Postcondition: The InkStroke has been removed to the Sketch's list of
        /// Strokes, Substrokes, and FeatureSketch.
        /// <param name="inkStroke"></param>
        public void DeleteStroke(System.Windows.Ink.Stroke inkStroke)
        {
            // Update mappings
            Substroke substroke = substrokeIdMap[ink2sketchStr[(String)inkStroke.GetPropertyData(idGuid)]];

            ink2sketchStr.Remove((String)inkStroke.GetPropertyData(idGuid));
            sketchStr2ink.Remove(substroke.Id);
            substrokeIdMap.Remove(substroke.Id);

            // Remove it from the relevant data structures (InkCanvas last)
            mFeatureSketch.RemoveSubstroke(substroke);
            mInkCanvas.Strokes.Remove(inkStroke);
        }
示例#2
0
        /// <summary>
        /// Deletes an error label when its corresponding strokes are erased.
        /// </summary>
        private void InkPicture_StrokesDeleting(object sender, InkCanvasStrokeErasingEventArgs e)
        {
            System.Windows.Ink.Stroke iStroke = e.Stroke;

            if (iStroke2Label == null)
            {
                return;
            }

            if (iStroke2Label.ContainsKey((String)iStroke.GetPropertyData(idGuid)))
            {
                System.Windows.Controls.Label label = iStroke2Label[(String)iStroke.GetPropertyData(idGuid)];

                label.Visibility = System.Windows.Visibility.Visible;
                sketchPanel.InkCanvas.Children.Remove(label);

                errorLabels.Remove(label);

                sketchPanel.InkCanvas.InvalidateArrange();
            }
        }
示例#3
0
        /// <summary>
        /// Returns a the sketch substroke corresponding to the given
        /// Ink stroke.  Returns null if no corresponding
        /// Sketch stroke exists.
        /// </summary>
        /// <param name="id">The Ink stroke</param>
        /// <returns>The corresponding Sketch substroke</returns>
        public Substroke GetSketchSubstrokeByInk(System.Windows.Ink.Stroke stroke)
        {
            String id = (String)stroke.GetPropertyData(idGuid);

            return(GetSketchSubstrokeByInkId(id));
        }