Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
Archivo: Glyphs.cs Proyecto: ernado/Owl
        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>();
        }
Ejemplo n.º 3
0
Archivo: Glyphs.cs Proyecto: 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;
        }
Ejemplo n.º 4
0
Archivo: Glyphs.cs Proyecto: ernado/Owl
 public WordGlyph InsertNewWordGlyph(Word word)
 {
     var wordGlyph = new WordGlyph(word) {Config = ParentVectorRedactor.WordConfig};
     InsertChild(wordGlyph);
     return wordGlyph;
 }
Ejemplo n.º 5
0
 private DictionaryWord DictionaryHasWord(Word word)
 {
     return _dictionaryWords.Where(dictionaryWord => dictionaryWord.Name == word.Name).FirstOrDefault();
 }
Ejemplo n.º 6
0
 public DictionaryWord(Word word, Bitmap image)
 {
     Name = word.Name;
     Images = new List<Bitmap>{image};
     Words = new List<Word>{word};
 }
Ejemplo n.º 7
0
 public void AddImage(Word word,Bitmap image)
 {
     Images.Add(image);
     Words.Add(word);
 }
Ejemplo n.º 8
0
Archivo: Book.cs Proyecto: ernado/Owl
 /// <summary>
 /// Добавить слово в строчку
 /// </summary>
 /// <param name="word">Слово</param>
 public virtual void AddWord(Word word)
 {
     word.Line = this;
     Words.Add(word);
 }
Ejemplo n.º 9
0
Archivo: Book.cs Proyecto: ernado/Owl
 /// <summary>
 /// Удаляет слово в строке
 /// </summary>
 /// <param name="word">Слово</param>
 public virtual void RemoveWord(Word word)
 {
     if (Words.Contains(word))
     {
         Words.Remove(word);
     }
 }
Ejemplo n.º 10
0
        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();
                    }

            }
        }
Ejemplo n.º 11
0
        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();
        }
Ejemplo n.º 12
0
 private void UpdateElementView(Word word)
 {
     wordNameBox.Text = word.Name;
     wordNumberNumeric.Value = word.Number;
 }
Ejemplo n.º 13
0
        private void DeleteElement(Word word)
        {
            _vectorRedactor.ProcessRemove(word);

            var line = word.Line;

            line.RemoveWord(word);

            if (Word == word)
            {
                Word = null;
            }

            ProcessElementChanges(line);
        }
Ejemplo n.º 14
0
        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();
        }
Ejemplo n.º 15
0
        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);
        }
Ejemplo n.º 16
0
        }                                      //Страница, к которой принадлежит строка

        /// <summary>
        /// Добавить слово в строчку
        /// </summary>
        /// <param name="word">Слово</param>
        public virtual void AddWord(Word word)
        {
            word.Line = this;
            Words.Add(word);
        }