private PathGeometry GetPathGeometry(Point position)
        {
            PathGeometry geometry = new PathGeometry();

            ConnectionNodeOrientation targetOrientation;

            if (HitConnectionNode != null)
            {
                targetOrientation = HitConnectionNode.Orientation;
            }
            else
            {
                targetOrientation = ConnectionNodeOrientation.None;
            }

            List <Point> pathPoints = PathFinder.GetConnectionLine(sourceConnectionNode.GetInfo(), position, targetOrientation);

            if (pathPoints.Count > 0)
            {
                PathFigure figure = new PathFigure();
                figure.StartPoint = pathPoints[0];
                pathPoints.Remove(pathPoints[0]);
                figure.Segments.Add(new PolyLineSegment(pathPoints, true));
                geometry.Figures.Add(figure);
            }

            return(geometry);
        }
Пример #2
0
        private PathGeometry UpdatePathGeometry(Point position)
        {
            PathGeometry geometry = new PathGeometry();

            ConnectionNodeOrientation targetOrientation;

            if (HitConnectionNode != null)
            {
                targetOrientation = HitConnectionNode.Orientation;
            }
            else
            {
                targetOrientation = dragConnectionNode.Orientation;
            }

            List <Point> linePoints = PathFinder.GetConnectionLine(fixConnectionNode.GetInfo(), position, targetOrientation);

            if (linePoints.Count > 0)
            {
                PathFigure figure = new PathFigure();
                figure.StartPoint = linePoints[0];
                linePoints.Remove(linePoints[0]);
                figure.Segments.Add(new PolyLineSegment(linePoints, true));
                geometry.Figures.Add(figure);
            }

            return(geometry);
        }