Ejemplo n.º 1
0
        private List <Point> GetPathPoints(GridPoint[,] gridPoints)
        {
            List <Point> locations = new List <Point>();
            // you get the arrow path
            List <GridPoint> path = GraphDiagram.GetGridPath(gridPoints, GraphDiagram.GetNearGridPoint(this.initConnector), this.initConnector.Side, GraphDiagram.GetNearGridPoint(this.next));

            locations.Add(this.initConnector.AbsCenter);
            locations.Add(path[0].Location); //one must always be kept so that the beginning and end of the arrow are created
            //If the arrow path has more than one element, it seeks to minimize the sectors
            if (path.Count != 1)
            {
                int presentX = locations[1].X;
                int presentY = locations[1].Y;
                for (int i = 2; i < path.Count; i++)
                {
                    if ((path[i].Location.X != presentX) && (path[i].Location.Y != presentY))
                    {
                        locations.Add(path[i - 1].Location);
                        presentX = path[i - 1].Location.X;
                        presentY = path[i - 1].Location.Y;
                    }
                }
                locations.Add(path[path.Count - 1].Location);
            }
            locations.Add(this.next.AbsCenter);
            return(locations);
        }