Results 1 to 6 of 6

Thread: [RESOLVED] Build Vector image w/ zoom, pan, etc.

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2007
    Posts
    180

    Resolved [RESOLVED] Build Vector image w/ zoom, pan, etc.

    I'm building a program that imports AutoCAD DXF files, draws them on the screen, and later builds a special output file. I would like to have a window were the image will be built (using lines, arcs, circles, and possibly text), and then using the mouse be able to zoom, pan, resize, etc.

    Is this something I need to use like DirectDraw or something? Or is there a simpler way of doing this. I dont need it running at break-neck speeds, just something usable and easy to code. Right now I have it drawing on the form, but this is not the best way to do it. How should I go about doing this?



    **EDIT - It would also be handy to be able to add layers. Be able to turn on/off layers say (Layer1 = imported image, Layer2 = Computer interpreted output image)
    Last edited by MotoMan_Yz400; Apr 11th, 2008 at 10:02 AM.

  2. #2
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,712

    Re: Build Vector image w/ zoom, pan, etc.

    You could do it with GDI+, but for things like layers and complex models, you may want to look into DirectX routines, which are different, but not as overly complex as you may think.
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 2007
    Posts
    180

    Re: Build Vector image w/ zoom, pan, etc.

    So can GDI+ handle zoom and pan?

    Currently I have a "scale factor", "DeltaX" and "DeltaY" factored into my drawline command. So every time the screen needs to update to the new zoom setting or pan position, I have to clear and redraw (causing glitchiness).

    I was wondering if there is a way I can set up a window where I pass points for lines, circles, etc to and define zoom, and pan position. So that way I can deal with the redrawing on a lower level. (I think DirectX can do this with 3D, but not sure how to do it in 2D).

  4. #4
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,712

    Re: Build Vector image w/ zoom, pan, etc.

    Not automatically, you'll have to scale and translate the points yourself. With DirectX, you could effectively convert the DXF to a 3D mesh and use the 3D manipulation functions to scale and translate it.
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Feb 2007
    Posts
    180

    Re: Build Vector image w/ zoom, pan, etc.

    Well to do DirectX do I really need to make a 3D sketch even if it's a 2D vector points?

    If I did choose to go with DirectX for this, do I need to download the DirectX SDK pack? or is there something I need to call or define in my program before hand?

  6. #6
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,712

    Re: Build Vector image w/ zoom, pan, etc.

    You do if you don't want to write transformation routines to zoom and scale your collection of points. There's no difference between 2D meshes and 3D meshes these days, they use the same 3D acceleration on video cards and the same functions to manipulate them.

    Yes, you need the DirectX SDK pack. It has the DirectX assemblies you'll need to call.
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width