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