Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Navigation Performance

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-18-2009, 03:32 PM
Saj Saj is offline
Senior Member
 
Join Date: Dec 2007
Location: Manchester, UK
Posts: 105
Default Navigation Performance

Hi

I'm trying to a draw a track of my position (every second) as current position moves in my navigation program. Latitude/longitude is stored in a structure array every 5 secs - "Dim Type(lat, lon)trackArr (100)".

As the array fills up, the performance starts to drop off rapidly such that when only 20 array elements (approx.) have been filled with lat/lon the execution of the array (see below) takes up so much time that it misses current position updates and takes ages to repond to key/screen touches.

Can anyone suggest a way around this? Is there a more efficient way of storing and displaying the track?


Sub drawTrack
For i=0 To ArrayLen(trackArr())-1
If trackArr(i).lat = "" Then
'Return - this exits sub
Exit ' jump out of for loop as the tr ck array has no values to plot
End If

'Convert Lat/Lon to screen position, see Notes p62-64 for derivation
ratioX = (trackArr(i).lon - mapLonXmin) /(mapLonXmax - mapLonXmin)
X_pix = Int(ratioX*MapWidth*zoom) +jpgXposn_onScreen0_0
ratioY = (mapLatYmax - trackArr(i).lat) /(mapLatYmax - mapLatYmin)
Y_pix = Int(ratioY*MapHeight*zoom)+ jpgYposn_onScreen0_0

'Draw track line
If xStart1=0 AND yStart1=0 Then
xEnd1 = X_pix
yEnd1 = Y_pix
xStart1 = X_pix+10 'dummy value for initialisation
yStart1 = Y_pix+10 'dummy value for initialisation
Else
xStart1 = xEnd1 'xEnd from previous iteration
yStart1 = yEnd1 'yEnd from previous iteration
xEnd1 = X_pix
yEnd1 = Y_pix
frmGPS.FLine(xStart1, yStart1 ,xEnd1, yEnd1, cRed)
frmGPS.FLine(xStart1+1, yStart1 ,xEnd1+1, yEnd1, cRed)
End If
Next

xStart1=0 'reset to prevent extraneous lines appearing when good signal and moving map with mouse at start/end of route
yStart1=0
xEnd1=0
yEnd1=0
End Sub
Reply With Quote
  #2 (permalink)  
Old 06-18-2009, 06:52 PM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 978
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

It seems like overload of the graphics, try to limit the actual drawing to the area of the screen (the part of the map that is seen on the screen).
__________________
David Erez
Ramat Hasharon, Israel
Reply With Quote
  #3 (permalink)  
Old 06-18-2009, 07:40 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,463
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

Do you have a code example (sbp file) so we could test it and look where the problem does come from ?
How often and from where do you call the drawTrack routine ?

Code:
frmGPS.FLine(xStart1, yStart1 ,xEnd1, yEnd1, cRed)
frmGPS.FLine(xStart1+
1, yStart1 ,xEnd1+1, yEnd1, cRed)
What is the 2nd line for ?
Is it to have thicker line ? If yes you could use the ImageLibEx, there you can define the line thickness.
In your case, if the line is almost horizontal, there will be no effect.

Best regards.
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide
Reply With Quote
  #4 (permalink)  
Old 06-21-2009, 11:22 AM
Saj Saj is offline
Senior Member
 
Join Date: Dec 2007
Location: Manchester, UK
Posts: 105
Default

You're right guys, I was trying to do too much drawing on the forelayer. Just drawing parts of the track that will be visible, performance is much better as I have 1 second between position updates.

Can u confirm if version 1.5 of the ImageLibEx is the latest and do you know if it is any quicker than the FLine method I have been using?

Many thanks.

-------------
Saj, UK
Reply With Quote
  #5 (permalink)  
Old 06-21-2009, 12:33 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,463
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

Yes, the latest version of ImageLibEx is 1.5, you can find the latest libraries and their version number here: ttp://www.basic4ppc.com/forum/additional-libraries/3314-dll-version-listings-2.html

I have never made any speed tests between drawing directly onto the form's forelayer or onto the form with a Drawer object or onto a bitmap with a Drawer object and copying the bitmap onto the form background.

An advatage with the Bitmap is that you can use a bitmap bigger than the screen size and copy the desired part of it onto the form,'s background. But I don't know what would be the influence on speed.

Best regards.
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide
Reply With Quote
  #6 (permalink)  
Old 06-21-2009, 04:28 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by Saj View Post
Can u confirm if version 1.5 of the ImageLibEx is the latest and do you know if it is any quicker than the FLine method I have been using?
Any drawing you do ImageLib or ImageLibEx should be faster than a Forms' own drawing methods. This is because the Forms methods repaint the changed area of the Form every time they are used whereas if you use a Drawer to draw on a Form or Bitmap the Form is only redrawn when you use a Refresh method for a Form when you have finished drawing on the Form or have assigned a Bitmap to a Form or Image control.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #7 (permalink)  
Old 07-02-2009, 01:36 PM
Saj Saj is offline
Senior Member
 
Join Date: Dec 2007
Location: Manchester, UK
Posts: 105
Default

The attachment shows an error msg I am getting with the DrawerEx library - "Object Reference Not Set to an Instance of an Object", yet the object exists (SolidBrushEx); see RHS of jpg. Can anyone see what is happening here?
Reply With Quote
  #8 (permalink)  
Old 07-02-2009, 02:08 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Line 1902 loks OK. It looks like you are trying to draw on a Form's forelayer. Have you enabled that on the Form by "FormName.ForeLayer = True"? As the problem doesn't look like line 1902 itself the problem is elsewhere and you will have to post some source that exhibits it.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #9 (permalink)  
Old 07-02-2009, 03:52 PM
Saj Saj is offline
Senior Member
 
Join Date: Dec 2007
Location: Manchester, UK
Posts: 105
Default

The forelayer is enabled in App_Start. I have noticed that ImageLibEx version 1.5 responds with 1.4 when executing ImageLibEx.DLLversion. Does that shed any light?
Reply With Quote
  #10 (permalink)  
Old 07-02-2009, 04:08 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by Saj View Post
Does that shed any light?
No, it's a typo. It is correctly reported as version 1.5 when optimised compiled which you should try as the optimising compiler is pickier than the IDE and may throw up the real source of the error, otherwise you will have to post some source that demonstrates the problem.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
D-Pad Navigation Dave Mitchell Questions (Windows Mobile) 4 05-02-2008 10:46 PM
Forum Navigation dennishea Questions (Windows Mobile) 1 02-15-2008 06:52 PM
Performance vs Memory RandomCoder Questions (Windows Mobile) 4 02-10-2008 04:03 PM
Performance on Bitmap? Roadrunner Questions (Windows Mobile) 9 12-09-2007 02:19 PM
GPS map navigation and routing zen Questions (Windows Mobile) 11 10-08-2007 06:44 AM


All times are GMT. The time now is 08:19 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0