Пример #1
0
        public void RemoveChar(CharNotationDataSet.CharRow currentRow)
        {
            int strokeID = 0;

            while (true)
            {
                CharNotationDataSet.StrokeRow currentStroke = strokeTable.FindByIdchar_name(strokeID, currentRow.char_name);
                if (currentStroke == null)
                {
                    break;
                }
                int pointID = 0;
                while (true)
                {
                    CharNotationDataSet.PointRow currentPoint = pointTable.FindByIdstroke_idchar_name(pointID, strokeID, currentRow.char_name);
                    if (currentPoint == null)   //找不到对应点
                    {
                        break;
                    }
                    currentPoint.Delete();
                    pointID++;
                }
                currentStroke.Delete();
                strokeID++;
            }
            //删除内容框
            CharNotationDataSet.PointRow rectPoint = pointTable.FindByIdstroke_idchar_name(0, -1, currentRow.char_name);
            rectPoint.Delete();
            rectPoint = pointTable.FindByIdstroke_idchar_name(1, -1, currentRow.char_name);
            rectPoint.Delete();
            currentRow.Delete();

            isModified = true;
        }
Пример #2
0
        /// <summary>
        /// 获取当前选定行的减字
        /// </summary>
        /// <param name="charName"></param>
        /// <returns></returns>
        public Char GetChar(CharNotationDataSet.CharRow currentRow)
        {
            Char result = new Char();

            //找到当前减字,并将信息传入
            //CharNotationDataSet.CharRow currentRow = charTable.FindBychar_name(charName);
            //if (currentRow == null)
            //    return null;
            result.Name               = currentRow.name.Trim();
            result.CharName           = currentRow.char_name.Trim();
            result.RestrictTop        = currentRow.restrict_top;
            result.RestrictBottom     = currentRow.restrict_bottom;
            result.RestrictTopRect    = currentRow.rect_resrict_top;
            result.RestrictBottomRect = currentRow.rect_restrict_bottom;
            result.Segment            = currentRow.segment;
            result.IsMain             = currentRow.is_main;
            result.IsComplex          = currentRow.is_complex;

            //内容框
            CharNotationDataSet.PointRow rectPoint = pointTable.FindByIdstroke_idchar_name(0, -1, currentRow.char_name);
            result.Rect.corners[0].X = (float)rectPoint.x;
            result.Rect.corners[0].Y = (float)rectPoint.y;
            rectPoint = pointTable.FindByIdstroke_idchar_name(1, -1, currentRow.char_name);
            result.Rect.corners[1].X = (float)rectPoint.x;
            result.Rect.corners[1].Y = (float)rectPoint.y;

            //找到当前减字所属笔画,并将信息传入
            List <Stroke> strokes  = new List <Stroke>();
            int           strokeID = 0;

            while (true)
            {
                CharNotationDataSet.StrokeRow currentStroke = strokeTable.FindByIdchar_name(strokeID, currentRow.char_name);
                if (currentStroke == null)
                {
                    break;
                }
                Stroke targetStroke = new Stroke((strokeType)currentStroke.type);
                //找到当前笔画所述点,并将信息传入
                List <System.Drawing.PointF> points = new List <System.Drawing.PointF>();
                int pointID = 0;
                while (true)
                {
                    CharNotationDataSet.PointRow currentPoint = pointTable.FindByIdstroke_idchar_name(pointID, strokeID, currentRow.char_name);
                    if (currentPoint == null)   //找不到对应点
                    {
                        break;
                    }
                    System.Drawing.PointF targetPoint = new System.Drawing.PointF();
                    targetPoint.X = (float)currentPoint.x;
                    targetPoint.Y = (float)currentPoint.y;
                    points.Add(targetPoint);    //将找到的点存入列表
                    pointID++;
                }
                targetStroke.Points = points;   //将点列表存入笔画
                strokes.Add(targetStroke);
                strokeID++;
            }
            result.Strokes = strokes;

            return(result);
        }