public WordGlyph InsertNewWordGlyph(Word word) { var wordGlyph = new WordGlyph(word) { Config = ParentVectorRedactor.WordConfig }; InsertChild(wordGlyph); return(wordGlyph); }
public void InsertChild(WordGlyph glyph) { glyph.Parent = this; glyph.MainGlyph = MainGlyph; glyph.Redactor = Redactor; glyph.ParentVectorRedactor = ParentVectorRedactor; Childs.Add(glyph); if (!Line.Words.Contains(glyph.Word)) { Line.AddWord(glyph.Word); } ParentVectorRedactor.Layout.AddFigure(glyph.Figure); }
/// <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; }
/// <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; }
public WordGlyph InsertNewWordGlyph(Word word) { var wordGlyph = new WordGlyph(word) {Config = ParentVectorRedactor.WordConfig}; InsertChild(wordGlyph); return wordGlyph; }
public void InsertChild(WordGlyph glyph) { glyph.Parent = this; glyph.MainGlyph = MainGlyph; glyph.Redactor = Redactor; glyph.ParentVectorRedactor = ParentVectorRedactor; Childs.Add(glyph); if (!Line.Words.Contains(glyph.Word)) Line.AddWord(glyph.Word); ParentVectorRedactor.Layout.AddFigure(glyph.Figure); }