Example #1
0
File: Glyphs.cs Project: ernado/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);
            }
        }
Example #2
0
File: Glyphs.cs Project: ernado/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;
        }
Example #3
0
File: Book.cs Project: ernado/Owl
 public virtual void DeletePolygon(Polygon polygon)
 {
     if (Polygons.Contains(polygon))
     {
         Polygons.Remove(polygon);
     }
 }
Example #4
0
File: Book.cs Project: ernado/Owl
 public Line()
 {
     Polygons = new List<Polygon>();
     Polygon = new Polygon();
 }
Example #5
0
File: Book.cs Project: ernado/Owl
 /// <summary>
 /// Добавить многоугольник к маске слова
 /// </summary>
 /// <param name="polygon">Многоугольник</param>
 public virtual void AddPolygon(Polygon polygon)
 {
     Polygons.Add(polygon);
 }