- Building a CAD program in WPF:
I want to build a CAD program that will have 10000 LINE
objects at a time. I'm using LineGeomery
class for drawing lines that are added to a Canvas
. I have implemented Zoom and Pan and the performance is great so far.
Only one major disappointment:
The Thickness
of the lines gets scaled while zooming. I have tried to Bind
the Thickness
property of the lines to a factor to keep them unchanged, This works but reduces the performance dramatically while zooming. Clearing and drawing new lines with new thickness on MouseWheel
is out of the question as well. This one too reduces performance and is not practical in the current method.
- Now what solutions I have?
- Stick with the current method and ignore the change in Thickness
- Do the whole job in GDI+
- Host GDI in WPF
- Use WPF Viewport3D (Will the LineThickness be invariant there?)
- Other solutions?
What other paths you would take. I'm new to WPF and programming and I'm eager to learn.
UPDATE:
This is the way I'm doing it right now. I draw 3000 Lines on the Visual Layer using Pen
an Brushes. Then on MouseWheel event I redraw all the Lines with the updated Thickness. Also I don't show the rest of the Lines to the user until he zooms so I only create 3000 out of 10000 Lines in each MouseWheel event.