![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Questions & Help Needed Post any question regarding Basic4ppc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
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 |
|
|||
|
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 |
|
||||
|
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 |
|
||||
|
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. |
|
|||
|
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?
![]() |
|
||||
|
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. |
|
||||
|
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. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| D-Pad Navigation | Dave Mitchell | Questions & Help Needed | 4 | 05-02-2008 10:46 PM |
| Forum Navigation | dennishea | Questions & Help Needed | 1 | 02-15-2008 06:52 PM |
| Performance vs Memory | RandomCoder | Questions & Help Needed | 4 | 02-10-2008 04:03 PM |
| Performance on Bitmap? | Roadrunner | Questions & Help Needed | 9 | 12-09-2007 02:19 PM |
| GPS map navigation and routing | zen | Questions & Help Needed | 11 | 10-08-2007 06:44 AM |