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

            Direction targetDirection;

            if (HitConnector != null)
            {
                targetDirection = HitConnector.Connector.Type;
            }
            else
            {
                targetDirection = dragConnector.Connector.Type;
            }

            List <Point> linePoints = PathFinder.GetConnectionLine(fixConnector.GetInfo(), position, targetDirection);

            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);
        }
Пример #2
0
        private PathGeometry GetPathGeometry(Point position)
        {
            PathGeometry geometry = new PathGeometry();

            Direction targetDirection;

            if (HitConnector != null)
            {
                targetDirection = HitConnector.Connector.Type;
            }
            else
            {
                targetDirection = Direction.UNKNOWN;
            }

            List <Point> pathPoints = PathFinder.GetConnectionLine(sourceConnector.GetInfo(), position, targetDirection);

            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);
        }