Ejemplo n.º 1
0
        public override void Compute(CancellationToken cancellationToken)
        {
            if (VertexPositions == null || VertexPositions.Count < 3)
            {
                return;
            }
            foreach (var item in VertexPositions.Values)
            {
                cancellationToken.ThrowIfCancellationRequested();

                _minPoint.X = Math.Min(item.X, _minPoint.X);
                _minPoint.Y = Math.Min(item.Y, _minPoint.Y);
                _maxPoint.X = Math.Max(item.X, _maxPoint.X);
                _maxPoint.Y = Math.Max(item.Y, _maxPoint.Y);
            }

            EdgeRoutes.Clear();

            CalculateMatrix(cancellationToken);
            SetupPathFinder();


            foreach (var item in Graph.Edges)
            {
                ComputeER(item, cancellationToken);
            }
        }
Ejemplo n.º 2
0
        public override void Compute()
        {
            if (VertexPositions == null || VertexPositions.Count < 3)
            {
                return;
            }
            foreach (var item in VertexPositions.Values)
            {
                _minPoint.X = Math.Min(item.X, _minPoint.X);
                _minPoint.Y = Math.Min(item.Y, _minPoint.Y);
                _maxPoint.X = Math.Max(item.X, _maxPoint.X);
                _maxPoint.Y = Math.Max(item.Y, _maxPoint.Y);
            }

            EdgeRoutes.Clear();

            calculateMatrix();
            setupPathFinder();


            foreach (var item in _graph.Edges)
            {
                ComputeER(item);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Bundles edges of the graph.
        /// </summary>
        ///
        /// <param name="graph">
        /// Graph whose edges should be bundled
        /// </param>
        ///
        /// <param name="rectangle">
        /// Rectangle in which the graph is laid out.
        /// Control points of bundled edges should not fall outside of this rectangle.
        /// </param>
        public void BundleAllEdges(TGraph graph)
        {
            EdgeRoutes.Clear();

            //this.rectangle = rectangle;
            directed = true; // as we use bidirectional by default

            AddDataForAllEdges(graph.Edges);

            //Stopwatch sw = new Stopwatch();
            //sw.Start();

            FindCompatibleEdges(edgeGroupData);

            //sw.Stop();


            DivideAllEdges(subdivisionPoints);

            //sw = new Stopwatch();
            //sw.Start();

            for (var i = 0; i < iterations; i++)
            {
                MoveControlPoints(edgeGroupData);
            }

            //prevents oscillating movements
            for (var i = 0; i < 5; i++)
            {
                cooldown *= 0.5f;
                MoveControlPoints(edgeGroupData);
            }

            //sw.Stop();

            cooldown = 1f;

            if (straightening > 0)
            {
                StraightenEdgesInternally(edgeGroupData, straightening);
            }

            foreach (var e in graph.Edges)
            {
                if (!e.IsSelfLoop)
                {
                    var key   = new KeyPair(e.Source.ID, e.Target.ID);
                    var list2 = edgeGroupData[key].controlPoints.ToList();

                    //Point p1 = GeometryHelper.GetEdgeEndpointOnRectangle(VertexPositions[e.Source], VertexSizes[e.Source], list2.First());
                    //Point p2 = GeometryHelper.GetEdgeEndpointOnRectangle(VertexPositions[e.Target], VertexSizes[e.Target], list2.Last());
                    //list2.Insert(0, p1); list2.Add(p2);
                    list2.Insert(0, list2.First()); list2.Add(list2.Last());

                    EdgeRoutes.Add(e, list2.ToArray());
                }
            }
        }
Ejemplo n.º 4
0
 public override void Compute(CancellationToken cancellationToken)
 {
     EdgeRoutes.Clear();
     foreach (var item in Graph.Edges)
     {
         EdgeRoutingTest(item, cancellationToken);
     }
 }
Ejemplo n.º 5
0
 public override void Compute()
 {
     EdgeRoutes.Clear();
     foreach (var item in _graph.Edges)
     {
         EdgeRoutingTest(item);
     }
 }
Ejemplo n.º 6
0
 public override void Compute(CancellationToken cancellationToken)
 {
     EdgeRoutes.Clear();
     foreach (var edge in Graph.Edges)
     {
         EdgeRoutes.Add(edge, ComputeSingle(edge));
     }
 }