예제 #1
0
 public MMTMRoutput(Control cntrl, MindMapTMR TMR, NewGoogleSearch gImSearch)
     : base(cntrl)
 {
     GImSearch = gImSearch;
     _TMR      = TMR;
     AddEntities();
     //4each 3al noun frames w n create entities w n defha w 2a3redha
     //verb frames
 }
예제 #2
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
        }
예제 #3
0
        public VerbFrameEntity(int x, int y, VerbFrame verbFrame, MindMapTMR tmr, NewGoogleSearch googleImSearch, DrawingSizeMode SizeMode)
            : base(0, 0, 70, 40, verbFrame.VerbName, "")
        {
            _tmr           = tmr;
            _SizeMode      = SizeMode;
            GoogleImSearch = googleImSearch;
            string Text = "";

            _verbFrame = verbFrame;
            if (_verbFrame.AdverbsInfo != null)
            {
                foreach (MyWordInfo mwi in _verbFrame.AdverbsInfo)
                {
                    Text += mwi.Word;
                }
            }
            Text += (_verbFrame.VerbName);

            _text = Text;
            if (IsGoogleImage())
            {
                //_bitmap = GoogleSearch.GetImage(verbFrame.VerbName);
                //_rectangle = new Rectangle(x, y, _bitmap.Width, _bitmap.Height);
                //_position = new PointF(x + _bitmap.Width / 2, y + _bitmap.Height / 2);



                IList <IImageResult> Results;
                if (_SizeMode == DrawingSizeMode.Normal)
                {
                    Results = GoogleImSearch.Search2(_text);
                }
                else
                {
                    ImageSize imsize = GetAutoSize();
                    Results = GoogleImSearch.Search2(_text, imsize);
                }
                if (Results.Count >= 1)
                {
                    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);
                }
            }
        }
예제 #4
0
        public TMRNounFrameEntity(int x, int y, NounFrame nounFrame, NewGoogleSearch googleImSearch)
            : base(0, 0, 70, 40, nounFrame.Text, "")
            //:base(0,0,70,40,nounFrame.Text)
        {
            GoogleImSearch = googleImSearch;
            _nounFrame     = nounFrame;

            string Text = "";



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

            Text += (_nounFrame.Text);
            ///////////////////////////

            _nounFrame.SearchText1 = Text;

            Text2 = nounFrame.IS_a;
            if (IsGoogleImage())
            {
                //_bitmap = GoogleSearch.GetImage(_nounFrame.SearchText1);


                IList <IImageResult> Results = GoogleImSearch.Search2(_nounFrame.SearchText1);

                if (Results.Count >= 1)
                {
                    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);
                }
            }
        }
예제 #5
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);
            }
        }