예제 #1
0
파일: Glyphs.cs 프로젝트: ernado-legacy/Owl
        protected override void UpdateData()
        {
            Word.Polygons.Clear();
            var solidFigure = Figure as SolidFigure;

            if (solidFigure == null)
            {
                throw new ArgumentNullException();
            }

            foreach (Figure figure in Figures)
            {
                PointF[] points  = figure.Path.PathPoints;
                var      polygon = new Polygon();

                foreach (PointF point in points)
                {
                    polygon.AddPoint(new DataBase.Domain.Point {
                        X = point.X, Y = point.Y
                    });
                }

                Word.AddPolygon(polygon);
            }
        }
예제 #2
0
파일: Glyphs.cs 프로젝트: ernado-legacy/Owl
        /// <summary>
        /// Завершает добавление нового слова
        /// </summary>
        private void CompleteCreatingWord()
        {
            var figure = Figure as UnclosedPathFigure;

            if (figure == null)
            {
                throw new ArgumentNullException();
            }

            GraphicsPath path = figure.GeneratePath();

            var word = new Word();

            if (ParentVectorRedactor.Mode == RedactorModes.AddPolygon)
            {
                word = Redactor.Word;
            }

            var polygon = new Polygon();

            polygon.LoadPointList(figure.Points);
            word.AddPolygon(polygon);


            var number = 1;

            if (Redactor.Line.Words.Count > 0)
            {
                number = (from dbWord in Redactor.Line.Words orderby dbWord.Number descending select dbWord.Number).ToList()[0] + 1;
            }
            word.Number = number;

            if (ParentVectorRedactor.Mode == RedactorModes.AddPolygon)
            {
                Redactor.Line.AddWord(word);
            }

            var wordGlyph = new WordGlyph(word)
            {
                Figure = new SolidFigure(path), Config = ParentVectorRedactor.WordConfig
            };

            if (!Redactor.Line.Words.Contains(word))
            {
                Redactor.Line.AddWord(word);
            }

            Parent.InsertChild(wordGlyph);

            ParentVectorRedactor.ActiveGlyph = wordGlyph;
        }