示例#1
0
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            var input = txtInput.Text;

            if (String.IsNullOrEmpty(input))
            {
                MessageBox.Show("Vui lòng nhập vào chuỗi lập lịch!", "Cảnh báo", MessageBoxButton.OK,
                                MessageBoxImage.Warning);
            }
            else
            {
                Process.Caculate(txtInput.Text);
                elementHost1.Child = GenerateWpfVisuals();
                _gArea.GenerateGraph(true);
                _gArea.SetVerticesDrag(true, true);
                _zoomctrl.ZoomToFill();
                txtSSResult.Text = Process.a;
                if (Process.result == true)
                {
                    txtResult.Text   = "Is Conflict Serializable";
                    txtSSResult.Text = Process.serialSchedule.ToUpper();
                    DrawDTGV(txtInput.Text, txtSSResult.Text);
                }
                else
                {
                    txtResult.Text = "Is not Conflict Serializable";
                    DrawNullDTGV();
                }
            }
        }
示例#2
0
        private void GraphAreaSetup(ref GraphAreaExample graphArea)
        {
            graphArea.SetVerticesDrag(true, true);

            graphArea.GenerateGraph(true, true);

            graphArea.SetVerticesMathShape(VertexShape.Rectangle);

            graphArea.SetEdgesDashStyle(EdgeDashStyle.Dash);

            graphArea.ShowAllEdgesArrows(false);

            graphArea.ShowAllEdgesLabels(true);
        }
示例#3
0
        private void but_generate_Click(object sender, EventArgs e)
        {
            edgeCollection.Clear();

            wpfHost.Child = GenerateWpfVisuals();
            _zoomctrl.ZoomToFill();

            _gArea.GenerateGraph(true);
            _gArea.SetVerticesDrag(true, true);
            _zoomctrl.ZoomToFill();

            //_gArea.SetEdgesHighlight(true, (GraphControlType)1);

            _gArea.RelayoutGraph();
            _gArea.ShowAllEdgesArrows(false);

            isGraphReady = true;
        }
示例#4
0
 private void but_generate_Click(object sender, EventArgs e)
 {
     _gArea.GenerateGraph(true);
     _gArea.SetVerticesDrag(true, true);
     _zoomctrl.ZoomToFill();
 }
        public void DrawAllKB(FrameContainer mainFrameContainer)
        {
            try
            {
                List <Frame>  currentFrames       = mainFrameContainer.GetAllFrames();
                List <Domain> currentDomains      = mainFrameContainer.GetDomains();
                List <string> currentDomainValues = new List <string>();

                foreach (Domain domain in currentDomains)
                {
                    foreach (string value in domain.values)
                    {
                        currentDomainValues.Add(value);
                    }
                }

                EasyGraph dataGraph = new EasyGraph();//TODO: Нужно определить полем в классе.

                foreach (Frame frame in currentFrames)
                {
                    //находим корневой фрейм

                    bool isFrameInDomains = currentDomainValues.Contains(frame.name);
                    bool isFrameIsNil     = frame.isA == "null";

                    if (!isFrameInDomains && isFrameIsNil)
                    {
                        Frame nilFrame = frame;

                        DataVertex nilDataVertex = new DataVertex(nilFrame.name)
                        {
                            ID = nilFrame.Id
                        };

                        dataGraph.AddVertex(nilDataVertex);

                        DrawAllRelatedVertices(nilFrame, ref dataGraph, mainFrameContainer);
                    }
                }

                _graphArea.SetEdgesDashStyle(EdgeDashStyle.Solid);

                var logicCore = new GXLogicCoreExample()
                {
                    Graph = dataGraph
                };

                //CompoundFDP,ISOM,LinLog,
                //Sugiyama
                logicCore.DefaultLayoutAlgorithm = LayoutAlgorithmTypeEnum.LinLog;

                logicCore.DefaultLayoutAlgorithmParams = logicCore.AlgorithmFactory.CreateLayoutParameters(LayoutAlgorithmTypeEnum.LinLog);

                logicCore.DefaultOverlapRemovalAlgorithm = OverlapRemovalAlgorithmTypeEnum.FSA;

                logicCore.DefaultEdgeRoutingAlgorithm = EdgeRoutingAlgorithmTypeEnum.None;


                logicCore.AsyncAlgorithmCompute = true;

                _graphArea.LogicCore = logicCore;

                _graphArea.GenerateGraph(true, false);
            }
            catch (Exception e)
            {
                MessageBox.Show("При отрисовке что-то пошло не так :( \n" + e.ToString());
            }
        }