Esempio n. 1
0
        /// <summary>
        /// Layouts the edge betweend the given points. This method is used to calculate a path that is displayed
        /// when any of the anchors is changed (via drag&drop).
        /// </summary>
        /// <param name="startPoint"></param>
        /// <param name="endPoint"></param>
        /// <param name="rMode">Routing mode. TODO: Not yet supported.</param>
        /// <returns></returns>
        public virtual EdgePointCollection CalcLayoutEdge(PointD startPoint, PointD endPoint, RoutingMode rMode)
        {
            EdgePointCollection points = new EdgePointCollection();

            /*if (rMode == RoutingMode.Orthogonal)
             * {
             *  try
             *  {
             *      // calculate points between start and end
             *      List<PointD> calcPoints = OrthogonalEdgeRouter.GetConnectionLineSimple(this, this.FromShape, startPoint, this.ToShape, endPoint, GetLinkPlacement(this.ToShape.AbsoluteBounds, endPoint));
             *
             *      foreach (PointD p in calcPoints)
             *          points.Add(new EdgePoint(p.X, p.Y));
             *  }
             *  catch
             *  {
             *      points.Add(new EdgePoint(startPoint));
             *      points.Add(new EdgePoint(endPoint));
             *  }
             * }
             * else
             * {*/
            points.Add(new EdgePoint(startPoint));
            points.Add(new EdgePoint(endPoint));
            //}
            return(points);
        }
Esempio n. 2
0
        /// <summary>
        /// Layouts the edge betweend the given points.
        /// </summary>
        /// <param name="startPoint"></param>
        /// <param name="endPoint"></param>
        /// <param name="rMode">Routing mode.</param>
        /// <returns></returns>
        public virtual EdgePointCollection LayoutEdge(PointD startPoint, PointD endPoint, RoutingMode rMode)
        {
            EdgePointCollection points = new EdgePointCollection();

            if (rMode == RoutingMode.Orthogonal)
            {
                try
                {
                    // calculate points between start and end
                    List <PointD> calcPoints = OrthogonalEdgeRouter.GetConnectionLine(this, this.FromShape, startPoint, this.ToShape, endPoint);

                    foreach (PointD p in calcPoints)
                    {
                        points.Add(new EdgePoint(p.X, p.Y));
                    }
                }
                catch
                {
                    points.Add(new EdgePoint(startPoint));
                    points.Add(new EdgePoint(endPoint));
                }
            }
            else
            {
                points.Add(new EdgePoint(startPoint));
                points.Add(new EdgePoint(endPoint));
            }
            return(points);
        }
        /// <summary>
        /// Layouts an edge between the given points.
        /// </summary>
        /// <param name="startPoint">Start point.</param>
        /// <param name="endPoint">End point.</param>
        /// <param name="rMode">Routing mode.</param>
        /// <returns>Edge point collection.</returns>
        public override EdgePointCollection LayoutEdge(PointD startPoint, PointD endPoint, RoutingMode rMode)
        {
            double middle = startPoint.X + (endPoint.X - startPoint.X) / 2.0;

            EdgePointCollection points = new EdgePointCollection();
            points.Add(new EdgePoint(startPoint));
            points.Add(new EdgePoint(middle, startPoint.Y));
            points.Add(new EdgePoint(middle, endPoint.Y));
            points.Add(new EdgePoint(endPoint));
            
            return points;
        }
Esempio n. 4
0
        /// <summary>
        /// Layouts an edge between the given points.
        /// </summary>
        /// <param name="startPoint">Start point.</param>
        /// <param name="endPoint">End point.</param>
        /// <param name="rMode">Routing mode.</param>
        /// <returns>Edge point collection.</returns>
        public override EdgePointCollection LayoutEdge(PointD startPoint, PointD endPoint, RoutingMode rMode)
        {
            double middle = startPoint.X + (endPoint.X - startPoint.X) / 2.0;

            EdgePointCollection points = new EdgePointCollection();

            points.Add(new EdgePoint(startPoint));
            points.Add(new EdgePoint(middle, startPoint.Y));
            points.Add(new EdgePoint(middle, endPoint.Y));
            points.Add(new EdgePoint(endPoint));

            return(points);
        }
Esempio n. 5
0
        public static EdgePointCollection ConvertFromRelativeEdgePoints(EdgePointCollection col, PointD relativeTo)
        {
            EdgePointCollection retCol = new EdgePointCollection();

            foreach (EdgePoint p in col)
            {
                PointD ret = new PointD();
                ret.X = p.X + relativeTo.X;
                ret.Y = p.Y + relativeTo.Y;

                EdgePoint point = new EdgePoint(ret, p.PointType);
                retCol.Add(point);
            }

            return(retCol);
        }
        public static EdgePointCollection ConvertFromRelativeEdgePoints(EdgePointCollection col, PointD relativeTo)
        {
            EdgePointCollection retCol = new EdgePointCollection();

            foreach (EdgePoint p in col)
            {
                PointD ret = new PointD();
                ret.X = p.X + relativeTo.X;
                ret.Y = p.Y + relativeTo.Y;

                EdgePoint point = new EdgePoint(ret, p.PointType);
                retCol.Add(point);
            }

            return retCol;
        }
        /// <summary>
        /// Layouts the edge betweend the given points. This method is used to calculate a path that is displayed
        /// when any of the anchors is changed (via drag&drop).
        /// </summary>
        /// <param name="startPoint"></param>
        /// <param name="endPoint"></param>
        /// <param name="rMode">Routing mode. TODO: Not yet supported.</param>
        /// <returns></returns>
        public virtual EdgePointCollection CalcLayoutEdge(PointD startPoint, PointD endPoint, RoutingMode rMode)
        {
            EdgePointCollection points = new EdgePointCollection();
            /*if (rMode == RoutingMode.Orthogonal)
            {
                try
                {
                    // calculate points between start and end
                    List<PointD> calcPoints = OrthogonalEdgeRouter.GetConnectionLineSimple(this, this.FromShape, startPoint, this.ToShape, endPoint, GetLinkPlacement(this.ToShape.AbsoluteBounds, endPoint));

                    foreach (PointD p in calcPoints)
                        points.Add(new EdgePoint(p.X, p.Y));
                }
                catch
                {
                    points.Add(new EdgePoint(startPoint));
                    points.Add(new EdgePoint(endPoint));
                }
            }
            else
            {*/
                points.Add(new EdgePoint(startPoint));
                points.Add(new EdgePoint(endPoint));
            //}
            return points;
        }