private PathGeometry GetPathGeometry(Point position) { PathGeometry geometry = new PathGeometry(); EnumConnectorOrientation targetOrientation; if (HitConnector != null) { targetOrientation = HitConnector.Orientation; } else { targetOrientation = EnumConnectorOrientation.None; } List <Point> pathPoints = ViewModelPathFinder.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); }
public void UpdatePathGeometry() { if (Source != null && Sink != null) { PathGeometry geometry = new PathGeometry(); List <Point> linePoints = ViewModelPathFinder.GetConnectionLine(Source.GetInfo(), Sink.GetInfo(), true); 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); this.PathGeometry = geometry; } } }