Esempio n. 1
0
        public MMViewManeger(Control cntrl, MindMapTMR TMR, bool showedgeText, GoogleImageSearchSettings gImSearchSettings, DrawingSizeMode sizeMode)
            : base(cntrl)
        {
            _conceptCombination = ConceptCmbination.None;
            SizeMode            = sizeMode;
            GImSearch           = new NewGoogleSearch(gImSearchSettings);
            _TMR         = TMR;
            ShowEdgeText = showedgeText;
            FilterMeaningRepresentationForDrawing();
            BuildAutomaticLayoutedGraph(true);

            //4each 3al noun frames w n create entities w n defha w 2a3redha
            //verb frames
        }
Esempio n. 2
0
        public NounFrameEntity(int x, int y, NounFrame nounFrame, MindMapTMR tmr, NewGoogleSearch googleImSearch, DrawingSizeMode sizeMode, ConceptCmbination conceptCombination)
            : base(0, 0, 70, 40, "", "")
        {
            _tmr           = tmr;
            _SizeMode      = sizeMode;
            GoogleImSearch = googleImSearch;
            _conceptComb   = conceptCombination;
            _nounFrame     = nounFrame;
            string Text = "";

            //if (_nounFrame.Adjective != null)
            //{
            //    foreach (ParseNode adj in _nounFrame.Adjective)
            //        Text += (adj.Text + " ");

            //}

            if (_nounFrame.AdjectivesInfo != null)
            {
                foreach (MyWordInfo mwi in _nounFrame.AdjectivesInfo)
                {
                    Text += (mwi.Word + " ");
                }
            }

            Text += (_nounFrame.Text);

            _conceptCombText       = GetConceptCombinationText();
            _nounFrame.SearchText1 = Text;


            //string _wordologyDirectoryPath = Application.ExecutablePath;
            //int index = _wordologyDirectoryPath.LastIndexOf("\\");
            //_wordologyDirectoryPath = _wordologyDirectoryPath.Substring(0, index);

            if (IsGoogleImage())
            {
                ///////////////// habal
                string strpath = "";
                //if (_nounFrame.Text == "agricultural".ToUpper())
                //    strpath = _wordologyDirectoryPath+@"\pics\agricultural.jpg";
                //else if (_nounFrame.Text == "queen".ToUpper())
                //    strpath = _wordologyDirectoryPath+@"\pics\queen.jpg";
                //else if (_nounFrame.Text == "shakespeare".ToUpper())
                //    strpath =_wordologyDirectoryPath+@"\pics\shakespeare.jpg";
                //else if (_nounFrame.Text == "living".ToUpper())
                //    strpath = _wordologyDirectoryPath+@"\pics\coins.jpg";
                //else if (_nounFrame.Text == "writer".ToUpper())
                //    strpath = _wordologyDirectoryPath+@"\pics\writer.jpg";

                ////////////////////////////

                if (strpath != "")
                {
                    _bitmap = new Bitmap(strpath);
                }
                else
                {
                    //_bitmap = GoogleSearch.GetImage(_nounFrame.SearchText1);


                    IList <IImageResult> Results;
                    if (sizeMode == DrawingSizeMode.Normal)
                    {
                        Results = GoogleImSearch.Search2(_nounFrame.SearchText1 + " " + _conceptCombText);
                    }
                    else
                    {
                        ImageSize imsize = GetAutoSize();
                        Results = GoogleImSearch.Search2(_nounFrame.SearchText1 + " " + _conceptCombText, imsize);
                    }
                    // if (Results.Count > 500000 && Results.Count < 15000000)
                    double R;
                    double.TryParse(_nounFrame.SearchText1, out R);

                    if (Results.Count >= 1 && R == 0)
                    {
                        GoogleImSearch.LoadImageFromUrl(Results[0].TbImage.Url, picbox);
                        _bitmap    = new Bitmap(picbox.Image);
                        _rectangle = new Rectangle(x, y, _bitmap.Width, _bitmap.Height);
                        _position  = new PointF(x + _bitmap.Width / 2, y + _bitmap.Height / 2);
                    }
                }
                /////////////////////////
                //_rectangle = new Rectangle(x, y, _bitmap.Width, _bitmap.Height);
                //_position = new PointF(x + _bitmap.Width / 2, y + _bitmap.Height / 2);
            }
        }