have a canvas on which I have a set of curves stored in
private List<System.Windows.Shapes.Path> paths = new List<System.Windows.Shapes.Path>();
in it there can be several curves of which some of them can be PolyLineSegments with a very large number of points.
AFTER having drawn the curves I may have to pan/zoom the canvas. On the internet I've found this very brilliant solution:
public static class CanvasUtils
{
public static Canvas SetCoordinateSystem(this Canvas canvas, Double xMin, Double xMax, Double yMin, Double yMax)
{
var width = xMax - xMin;
var height = yMax - yMin;
var translateX = -xMin;
var translateY = height + yMin;
var group = new TransformGroup();
group.Children.Add(new TranslateTransform(translateX, -translateY));
group.Children.Add(new ScaleTransform(canvas.ActualWidth / width, canvas.ActualHeight / -height));
canvas.RenderTransform = group;
return canvas;
}
}
Unfortunately it doesn't do for me since this enlarges everything making the curve look horrible (just like looking at it through a lens), with a thick stroke. This just like a real lens zoom.
So the only solution which comes to my mind is to REPROCESS all points and transform EACH of them to the new coordinate system. But that's not very smart and time consuming. Any other more brilliant solution?
Thanks in advance Patrick