Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

store drawing details for faster loading? 1

Status
Not open for further replies.

aejester

Programmer
Aug 29, 2001
52
CA
Hi,

I have created a procedure that parses a DXF file, and stores all similar types of drawing objects in seperate files. For example, all circles that are found in the dxf file are output to a 'circles' file, which contains the instructions for drawing them. Similar files are created for lines, and text etc.

Since these dxf files can contain thousands and thousands of objects to draw, when I read these files to actually draw the 'map' onto the screen it takes about 20 seconds. This is reasonable. However, after the map is loaded for the first time, I would expect that zooming in and out on the drawing would be much faster, but as of now, I've only been redrawing the entire map each and every time.

Is there any way to do this, so that I could speed up the 'redrawing' code for zooming in or out, and panning around the map. Is there some way to store 2 dimensional data in different 'regions' so that only the viewable regions are redrawn? I thought this might be possible, but some lines etc span across the entire map.

I don't know what to do, and I need to find something to speed this up or this project will be useless. If you need more information about what I'm trying to do, I can try to explain a little better, as I'm sure the above is confusing to you also.
 
Are you redrawing from the file each time, or are you downloading the file to an array?

If from file, each redraw will take the same (long) time. Should be much quicker from array. Let me know if this helps
________________________________________________________________
If you are worried about how to post, please check out FAQ222-2244 first

'There are 10 kinds of people in the world: those who understand binary, and those who don't.'
 
Presumably you are using GDI calls to draw the objects.

Have you considered recording the drawing to an enhanced metafile, and then just playing the metafile back (you can do the scaling in the playback call) each time you actually want to display the picture? Use of clipping regions might also help.

Additionally, at any given zoom level, you might want to actually play the metafile into a memory DC, and then just blit the appropriate bit of that DC onto a visible DC (this would make panning/scrolling a LOT faster)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top