Displaying data graphically (Ultrasonic radar) - Page 2
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22

Thread: Displaying data graphically (Ultrasonic radar)

  1. #16
    Join Date
    Feb 2012
    Posts
    11

    Re: Displaying data graphically (Ultrasonic radar)

    Hi GremlinSA, thanks to your explanations and article I finally understood the concept of double buffering (or at least I think so ).
    However I the program is still running slow :/
    I have tried your method of drawing as you wrote on your last post but the scan line went really funny and the speed was the same as it was before.
    Do you mind having a look at my code and see if I missing something? I'd really appreciate that!

    Thanks in advance!
    Last edited by Alex83UK; April 12th, 2012 at 08:44 AM.

  2. #17
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: Displaying data graphically (Ultrasonic radar)

    Do me a Favor ...

    Zip the entire project directory, Delete the Debug and Release folders from the zip (as those are recreated each time you debug or build)..

    Post it here (use the advanced posting page and use the Manage Attachments button lower down to attach the zip...) and i will download it and go through it...

    Only problem is that i dont have the Serial Device, but i'll try a serial loop to pump the data through...
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  3. #18
    Join Date
    Feb 2012
    Posts
    11

    Re: Displaying data graphically (Ultrasonic radar)

    Hi GremlinSA, I have fixed the problem which was slowing my system down - I was reading one character at a time, invoking the GUI, coming back, reading another character, invoking the GUI thread, etc. So it was taking a fair amount of time switching threads back and forth for every character.
    My system now is (almost) fully working, but I have another question for you though. I am now trying to display the detected objects (little circles or squares).
    I can display them fine, however I can only display one at each angle (the current position). How can I draw, let's say, 5 dots and then only after 5 the last one gets erased?
    To draw them I just added e.Graphics.FillEllipse(Brushes.Red, 0, radius, 5, 5) to the end of PictureBox1_Paint subroutine.

    Thanks in advance!

  4. #19
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,948

    Re: Displaying data graphically (Ultrasonic radar)

    Add another vector, in the inverse color, to erase the one BEFORE the current one. Erase one, then draw the next, in the same cycle
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  5. #20
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: Displaying data graphically (Ultrasonic radar)

    This is where layering images comes to play.. If you look at the next article in the series it describes simply how to overlap images.. (you may need to read the linked VB6 article to understand the process better)

    So in this case you have your base image that is the Sonar Grid.. This image remains static and is drawn onto the buffer at the start of each frame..

    Next you store the last 10 (or how ever many you like) scans and redraw all of them onto a new image.. set the transparency, and then draw it onto the buffer..

    if you want you could even draw each previous dot in a lighter colour giving it that same Diminishing effect from real radars..
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  6. #21
    Join Date
    Feb 2012
    Posts
    11

    Re: Displaying data graphically (Ultrasonic radar)

    Hi all,
    Just passing by to say that I've finished my project.
    Thank you very much for your help

  7. #22
    Join Date
    Mar 2013
    Posts
    1

    Re: Displaying data graphically (Ultrasonic radar)

    Quote Originally Posted by Alex83UK View Post
    Hi all,
    Just passing by to say that I've finished my project.
    Thank you very much for your help
    Dear Alex83UK, Could you share the source code for reference?
    my email: dominhson.vtv@gmail.com

Page 2 of 2 FirstFirst 12

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center