Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        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());
            }
        }