Пример #1
0
 private void Form1_Load(object sender, EventArgs e)
 {
     toolStripComboBox1.SelectedIndex = (int)graphLayoutOptions.layoutAlgorithm;
     toolStripComboBox2.SelectedIndex = (int)graphLayoutOptions.edgeRoutingAlgorithm;
     wpfHost.Child = GenerateWpfVisuals();
     _zoomctrl.ZoomToFill();
 }
Пример #2
0
 void Form1_Load(object sender, EventArgs e)
 {
     wpfHost.Child = GenerateWpfVisuals();
     _gArea.GenerateGraph(true);
     _gArea.SetVerticesDrag(true, true);
     _zoomctrl.ZoomToFill();
 }
Пример #3
0
        public void InitGraphArea(ref GraphAreaExample graphArea, ref ZoomControl zoomControl, Visibility visibility)
        {
            Events.ViewGraphArea = graphArea;
            ZoomControl.SetViewFinderVisibility(zoomControl, Visibility.Visible);

            zoomControl.ZoomToFill();

            LogicCoreSetup(ref graphArea);

            GraphAreaSetup(ref graphArea);

            zoomControl.ZoomToFill();
        }
        private void MasterRefresh()
        {
            GetRandomizerData();

            if (graph != null)
            {
                graph.Dispose();
            }
            graph = Grapher.CreateTransitionGraph();

            if (zoom == null)
            {
                zoom = new ZoomControl();
                ZoomControl.SetViewFinderVisibility(zoom, Visibility.Visible);
                elementHost1.Child = zoom;
            }
            zoom.Content = graph;
            zoom.Zoom    = 0.01f;

            zoomToVertexSelect.Items.Clear();
            zoomToVertexSelect.Items.AddRange(roomRandomizer ? rooms.ToArray() : areas.ToArray());

            graph.GenerateGraph(true);
            Grapher.RecolorVertices(graph);
            edgeLabelsToggled = false;
            zoom.ZoomToFill();
        }
Пример #5
0
        public virtual void GenerateButtonClick(object sender, System.EventArgs e)
        {
            this.NGramListBox.Enabled = true;

            var dataVertex = new DataVertex();

            if (this.serachTextBox.Text != string.Empty)
            {
                NGram <T> s = this.CreateNGRamFromSearchTextBox();
                if (s != NGram <T> .Empty)
                {
                    this.CurrentMarkovGraph = this.MarkovGraph.GetSubGraphFromNGram(s, this.Depth);
                    if (this.MarkovGraph.ValidNode(s))
                    {
                        this.wpfContainer.Child = this.GenerateWpfVisuals(GraphUIHelper.GenerateGraphUI(this.CurrentMarkovGraph));
                    }
                }
            }

            GraphArea.GenerateGraph(true);
            GraphArea.SetVerticesDrag(true, true);
            ZoomControl.ZoomToFill();

            this.UpdateListBox();
        }
Пример #6
0
 private void DendrogramLayout_OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     if (DendrogramLayout.IsVisible)
     {
         ZoomControl.ZoomToFill();
     }
 }
Пример #7
0
        private void UpdateGraph(NGramGraphMarkovChain <T> chain)
        {
            this.wpfContainer.Child = GenerateWpfVisuals(GraphUIHelper.GenerateGraphUI <T>(chain));

            GraphArea.GenerateGraph(true);
            GraphArea.SetVerticesDrag(true, true);
            ZoomControl.ZoomToFill();
        }
Пример #8
0
        private void UpdateGraph()
        {
            this.wpfContainer.Child = GenerateWpfVisuals(GraphUIHelper.GenerateGraphUI <T>(this.CurrentMarkovGraph));

            GraphArea.GenerateGraph(true);
            GraphArea.SetVerticesDrag(true, true);
            ZoomControl.ZoomToFill();
        }
Пример #9
0
        public void Draw(AllianceScenario allianceScenario, Powers focus)
        {
            try
            {
                _executing = true;

                var logicCore             = new AllianceScenarioGXLogicCore();
                var drawnAllianceScenario = new DrawnAllianceScenario();
                drawnAllianceScenario.FocusPower = focus;
                drawnAllianceScenario.Populate(allianceScenario);
                logicCore.Graph = drawnAllianceScenario;

                /*
                 * logicCore.DefaultLayoutAlgorithm = LayoutAlgorithmTypeEnum.FR;
                 * logicCore.DefaultLayoutAlgorithmParams = logicCore.AlgorithmFactory.CreateLayoutParameters(LayoutAlgorithmTypeEnum.FR);
                 * ((FreeFRLayoutParameters)logicCore.DefaultLayoutAlgorithmParams).IdealEdgeLength = 100;
                 * ((FreeFRLayoutParameters)logicCore.DefaultLayoutAlgorithmParams).RepulsiveMultiplier = 1.5;
                 * ((FreeFRLayoutParameters)logicCore.DefaultLayoutAlgorithmParams).Seed = 23423423;
                 */


                logicCore.DefaultLayoutAlgorithm       = LayoutAlgorithmTypeEnum.KK;
                logicCore.DefaultLayoutAlgorithmParams = logicCore.AlgorithmFactory.CreateLayoutParameters(LayoutAlgorithmTypeEnum.KK);
                ((KKLayoutParameters)logicCore.DefaultLayoutAlgorithmParams).Width            = 1000;
                ((KKLayoutParameters)logicCore.DefaultLayoutAlgorithmParams).Height           = 1000;
                ((KKLayoutParameters)logicCore.DefaultLayoutAlgorithmParams).AdjustForGravity = true;


                ////Setup optional params
                logicCore.DefaultOverlapRemovalAlgorithmParams =
                    logicCore.AlgorithmFactory.CreateOverlapRemovalParameters(OverlapRemovalAlgorithmTypeEnum.FSA);
                ((OverlapRemovalParameters)logicCore.DefaultOverlapRemovalAlgorithmParams).HorizontalGap = 50;
                ((OverlapRemovalParameters)logicCore.DefaultOverlapRemovalAlgorithmParams).VerticalGap   = 50;

                //This property sets edge routing algorithm that is used to build route paths according to algorithm logic.
                //For ex., SimpleER algorithm will try to set edge paths around vertices so no edge will intersect any vertex.
                logicCore.DefaultEdgeRoutingAlgorithm = EdgeRoutingAlgorithmTypeEnum.SimpleER;
                //This property sets async algorithms computation so methods like: Area.RelayoutGraph() and Area.GenerateGraph()
                //will run async with the UI thread. Completion of the specified methods can be catched by corresponding events:
                //Area.RelayoutFinished and Area.GenerateGraphFinished.
                logicCore.AsyncAlgorithmCompute = false;

                logicCore.EdgeCurvingEnabled   = true;
                logicCore.EnableParallelEdges  = true;
                logicCore.ParallelEdgeDistance = 50;

                //Finally assign logic core to GraphArea object
                GraphArea.LogicCore = logicCore;
                GraphArea.SetVerticesDrag(true);
                GraphArea.GenerateGraph();

                ZoomControl.ZoomToFill();
            }
            finally
            {
                _executing = false;
            }
        }
 private void FitToBounds(System.Windows.Threading.Dispatcher dispatcher, ZoomControl zoom)
 {
     if (dispatcher != null)
     {
         dispatcher.BeginInvoke(new Action(()
                                           =>
         {
             zoom.ZoomToFill();
             zoom.Mode = ZoomControlModes.Custom;
             //zoom.FitToBounds();
         }), DispatcherPriority.Loaded);
     }
     else
     {
         zoom.ZoomToFill();
         zoom.Mode = ZoomControlModes.Custom;
     }
 }
Пример #11
0
 private void ButtonRedrawOnClick(object sender, RoutedEventArgs e)
 {
     SetupGraphArea();
     Area.GenerateGraph(true, true);
     Area.SetEdgesDashStyle(EdgeDashStyle.Dash);
     Area.ShowAllEdgesArrows(false);
     Area.ShowAllEdgesLabels(true);
     ZoomControl.ZoomToFill();
 }
Пример #12
0
 public MainWindow()
 {
     InitializeComponent();
     //Customize Zoombox a bit
     //Set minimap (overview) window to be visible by default
     ZoomControl.SetViewFinderVisibility(ZoomControl, Visibility.Visible);
     //Set Fill zooming strategy so whole graph will be always visible
     ZoomControl.ZoomToFill();
     _analyzer.Execute();
     foreach (var sentence in _analyzer.Sentences)
     {
         ListBoxSentence.Items.Add(new SentenceViewModel(sentence).Text);
     }
 }
Пример #13
0
        public void Draw(Board board, FeatureMeasurementCollection featureMeasurementCollection = null)
        {
            try
            {
                _executing = true;
                DrawnMap drawnMap = new DrawnMap();
                drawnMap.Populate(board, featureMeasurementCollection);

                var logicCore = new DiplomacyGXLogicCore();
                logicCore.Graph = drawnMap;
                logicCore.ExternalLayoutAlgorithm = new AbsoluteLayoutAlgorithm(drawnMap);

                ////Setup optional params
                logicCore.DefaultOverlapRemovalAlgorithmParams =
                    logicCore.AlgorithmFactory.CreateOverlapRemovalParameters(OverlapRemovalAlgorithmTypeEnum.FSA);
                ((OverlapRemovalParameters)logicCore.DefaultOverlapRemovalAlgorithmParams).HorizontalGap = 50;
                ((OverlapRemovalParameters)logicCore.DefaultOverlapRemovalAlgorithmParams).VerticalGap   = 50;

                //This property sets edge routing algorithm that is used to build route paths according to algorithm logic.
                //For ex., SimpleER algorithm will try to set edge paths around vertices so no edge will intersect any vertex.
                logicCore.DefaultEdgeRoutingAlgorithm = EdgeRoutingAlgorithmTypeEnum.SimpleER;
                //This property sets async algorithms computation so methods like: Area.RelayoutGraph() and Area.GenerateGraph()
                //will run async with the UI thread. Completion of the specified methods can be catched by corresponding events:
                //Area.RelayoutFinished and Area.GenerateGraphFinished.
                logicCore.AsyncAlgorithmCompute = false;

                logicCore.EdgeCurvingEnabled  = true;
                logicCore.EnableParallelEdges = false;

                //Finally assign logic core to GraphArea object
                GraphArea.LogicCore = logicCore;
                GraphArea.SetVerticesDrag(true);
                GraphArea.GenerateGraph();

                ZoomControl.ZoomToFill();
            }
            finally
            {
                _executing = false;
            }
        }
Пример #14
0
        public override void FormLoad(object sender, EventArgs e)
        {
            this.DisableButtons();
            this.serachTextBox.ReadOnly = true;
            this.Size = this.Size;
            // List<string> corp = new List<string>() { "a", "b", "c", "a", "e", "f", "g", "h", "e", "f", "h", "b", "b", "c", "h", "g" };
            List <string> corp = TextCorpus.RetrieveAnyCompleteWordCorpus();

            HeterogenousNGrams <string> grams = HeterogenousNGrams <string> .BuildNGrams(1, 3, corp);

            //HomogenousNGrams<string> grams = HomogenousNGrams<string>.BuildNGrams(1, corp);

            //NGramGraphMarkovChain<string> graphHetero = new NGramGraphMarkovChain<string>(heterograms);
            NGramGraphMarkovChain <string> graph = new NGramGraphMarkovChain <string>(grams);

            this.MarkovGraph = graph;

            this.wpfContainer.Child = GenerateWpfVisuals(GraphUIHelper.GenerateGraphUI <string>(NGramGraphMarkovChain <string> .Empty(true)));
            ZoomControl.ZoomToFill();

            this.serachTextBox.ReadOnly = false;
        }
Пример #15
0
 void gArea_RelayoutFinished(object sender, EventArgs e)
 {
     _zoomctrl.ZoomToFill();
 }
Пример #16
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();
            //Customize Zoombox a bit
            //Set minimap (overview) window to be visible by default
            ZoomControl.SetViewFinderVisibility(ZoomControl, Visibility.Visible);
            //Set Fill zooming strategy so whole graph will be always visible
            ZoomControl.ZoomToFill();
            var service = new AnalyzeService();
            var file    = new DirectoryInfo(@"..\..\..\LineAnalyze.Domain\talk").EnumerateFiles("*.txt").FirstOrDefault()
                          .FullName;
            var text        = File.ReadAllText(file);
            var talks       = service.ParseTalk(text);
            var meCabTagger = MeCabTagger.Create();

            foreach (var talk in talks)
            {
                var words = service.ParseText(meCabTagger, talk.Message).ToList();
                foreach (var word in words)
                {
                    if (word.Pos != "名詞" &&
                        word.Pos != "動詞")
                    {
                        continue;
                    }

                    if (word.Base == "*")
                    {
                        continue;
                    }

                    if (word.Pos1 == "非自立")
                    {
                        continue;
                    }

                    if (!_allTalkDictionary.ContainsKey(talk.User.Name))
                    {
                        _allTalkDictionary.Add(talk.User.Name, new List <Word>());
                    }

                    _allTalkDictionary[talk.User.Name].Add(word);
                }
            }

            foreach (var userName in _allTalkDictionary.Keys)
            {
                ListBoxUser.Items.Add(userName);
            }

            var totalWord = new List <Word>();

            foreach (var item in _allTalkDictionary)
            {
                totalWord.AddRange(item.Value);
            }

            var enumerable = totalWord.GroupBy(w => w.Base).Select(x => new
            {
                RealName = x.Key,
                Count    = x.Count()
            })
                             .Where(x => x.Count > 1)
                             .OrderByDescending(x => x.Count);


            foreach (var item in enumerable)
            {
                WordViewModels.Add(new WordViewModel {
                    Base = item.RealName, Count = item.Count
                });
            }

            ListBoxWord.ItemsSource = WordViewModels;
        }
Пример #17
0
 private void Form1_Load(object sender, EventArgs e)
 {
     wpfHost.Child = GenerateWpfVisuals();
     _zoomctrl.ZoomToFill();
 }
Пример #18
0
 private void GraphLayout_OnLayoutFinished(object sender, EventArgs e)
 {
     ZoomControl.ZoomToFill();
 }