Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
2.33/5 (2 votes)
- 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.
Posted
Comments
S Houghtelin 24-Mar-14 8:04am    
I'm sure you have thought of this, but I would only redraw the area within view. Also allow the lines to scale while zooming and redraw the lines when the viewing area has stabilized. Do not allow the application to refresh constantly while zooming, refreshing every 40-50 milleseconds will still allow the visuals to look smooth.
Vahid Yousefzadeh 24-Mar-14 8:23am    
Thanks. I have actually done all of these except the last part. How can I prevent the screen from refreshing?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900