예제 #1
0
        private PathGeometry GetPathGeometry(Point position)
        {
            PathGeometry geometry = new PathGeometry();

            ConnectorOrientation targetOrientation;

            if (HitConnector != null)
            {
                targetOrientation = HitConnector.Orientation;
            }
            else
            {
                targetOrientation = ConnectorOrientation.None;
            }

            List <Point> pathPoints = PathFinderHelper.GetPathFinder(this.designerCanvas.PathFinder).GetConnectionLine(sourceConnector.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();

            ConnectorOrientation targetOrientation;

            if (HitConnector != null)
            {
                targetOrientation = HitConnector.Orientation;
            }
            else
            {
                targetOrientation = dragConnector.Orientation;
            }

            List <Point> linePoints = PathFinderHelper.GetPathFinder(this.connection.pathFinder).GetConnectionLine(fixConnector.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);
        }
예제 #3
0
        private void UpdatePathGeometry()
        {
            if (Source != null && Sink != null)
            {
                PathGeometry geometry = new PathGeometry();
                pointsList = PathFinderHelper.GetPathFinder(this.pathFinder).GetConnectionLine(Source.GetInfo(), Sink.GetInfo(), true);
                if (pointsList.Count > 0)
                {
                    PathFigure figure = new PathFigure();
                    figure.IsClosed   = false;
                    figure.StartPoint = pointsList[0];
                    pointsList.Remove(pointsList[0]);
                    figure.Segments.Add(new PolyLineSegment(pointsList, true));
                    geometry.Figures.Add(figure);

                    this.PathGeometry = geometry;
                    this.Points       = pointsList;
                }
            }
        }