private Bitmap GetImageOf(Word word, Bitmap pageImage) { if (word.Polygons == null || word.Polygons.Count <= 0) return null; var images = word.Polygons.Select( polygon => pageImage.Clone(Functions.GeneratePathFromPoints(polygon.ConvertToDrawingPoints()).GetBounds(), pageImage.PixelFormat)).ToList(); return MergeImages(images); }
public WordGlyph(Word word) { Word = word; var path = new GraphicsPath(); Figure = new SolidFigure(path); if (Word.Polygons != null && Word.Polygons.Count > 0) foreach (Polygon polygon in Word.Polygons) path.AddPath(Functions.GeneratePathFromPoints(polygon.ConvertToDrawingPoints()), false); Figures = new List<Figure>(); if (Word.Polygons != null && Word.Polygons.Count > 0) { foreach (Polygon polygon in Word.Polygons) Figures.Add(new SolidFigure(Functions.GeneratePathFromPoints(polygon.ConvertToDrawingPoints()))); } Figure.Path.CloseAllFigures(); ; Childs = new List<Glyph>(); }
/// <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; }
private DictionaryWord DictionaryHasWord(Word word) { return _dictionaryWords.Where(dictionaryWord => dictionaryWord.Name == word.Name).FirstOrDefault(); }
public DictionaryWord(Word word, Bitmap image) { Name = word.Name; Images = new List<Bitmap>{image}; Words = new List<Word>{word}; }
public void AddImage(Word word,Bitmap image) { Images.Add(image); Words.Add(word); }
/// <summary> /// Добавить слово в строчку /// </summary> /// <param name="word">Слово</param> public virtual void AddWord(Word word) { word.Line = this; Words.Add(word); }
/// <summary> /// Удаляет слово в строке /// </summary> /// <param name="word">Слово</param> public virtual void RemoveWord(Word word) { if (Words.Contains(word)) { Words.Remove(word); } }
public void ProcessActivation(Word word) { var activeGlyph = ActiveGlyph as WordGlyph; if (activeGlyph != null && activeGlyph.Word == word) return; foreach (var lineGlyph in MainGlyph.Childs.Select(child => (child as LineGlyph))) { if (lineGlyph == null) throw new NullReferenceException(); if (lineGlyph.Line == word.Line) foreach (var wordGlyph in lineGlyph.Childs.Select(child => (child as WordGlyph))) { if (wordGlyph == null) throw new NullReferenceException(); if (wordGlyph.Word == word) wordGlyph.ProcessSelection(); } } }
public void ProcessRemove(Word word) { foreach (var lineGlyph in MainGlyph.Childs.Select(child => (child as LineGlyph))) { foreach (var wordGlyph in lineGlyph.Childs.Select(child => (child as WordGlyph))) { if (wordGlyph == null) throw new NullReferenceException(); if (wordGlyph.Word != word) continue; wordGlyph.Remove(); break; } } var activeGlyph = ActiveGlyph as WordGlyph; if (activeGlyph != null && activeGlyph.Word == word) Focus(ActiveGlyph.Parent.Childs.Count > 1 ? ActiveGlyph.Parent.Childs[0] : ActiveGlyph.Parent); Invalidate(); }
private void UpdateElementView(Word word) { wordNameBox.Text = word.Name; wordNumberNumeric.Value = word.Number; }
private void DeleteElement(Word word) { _vectorRedactor.ProcessRemove(word); var line = word.Line; line.RemoveWord(word); if (Word == word) { Word = null; } ProcessElementChanges(line); }
public void LoadElement(Word word) { Word = word; var words = Line.Words as List<Word>; if ((words != null && !words.Contains(Word)) || words == null) saveBookMenuItem.Enabled = true; wordEditGroupBox.Enabled = true; documentTabControl.SelectedIndex = 3; _vectorRedactor.ProcessActivation(word); UpdateElementView(word); UpdateHeader(); }
public void LoadElement(Line line) { Line = line; Word = null; wordList.Items.Clear(); wordCountLink.Text = line.Words.Count().ToString(); var lines = Page.Lines as List<Line>; if ((lines != null && !lines.Contains(Line)) || lines == null) saveBookMenuItem.Enabled = true; lineEditGroupBox.Enabled = true; wordTabPanel.Enabled = true; documentTabControl.SelectedIndex = 2; _vectorRedactor.ProcessActivation(line); UpdateElementView(line); }
} //Страница, к которой принадлежит строка /// <summary> /// Добавить слово в строчку /// </summary> /// <param name="word">Слово</param> public virtual void AddWord(Word word) { word.Line = this; Words.Add(word); }