Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Sat, 16 Feb 2008 17:50:01 -0800,    group: microsoft.public.dotnet.academic        back       


Bug in Sample Project - GPS Intermediate Driver WM5   
I've detected a bug in class GPSPosition.cs in method 
ParseDegreesMinutesSeconds, located in the Windows Mobile 5 SDK sample for 
GPS Intermediate Driver.

Originally, this methos is like: 

        private DegreesMinutesSeconds ParseDegreesMinutesSeconds(double val)
        {
            double degrees = (val / 100.0);
            double minutes = (Math.Abs(degrees) - 
Math.Abs((double)(int)(degrees))) * 100;
            double seconds = (Math.Abs(val) - Math.Abs((double)(int)val)) * 
60.0;

            return new DegreesMinutesSeconds((int)degrees, (int)minutes, 
seconds);
        }

Well, this implementation will cause a wrong translation of GPS coordinates 
to Degrees-Minutes-Seconnds.

My fix is shown below:

        private DegreesMinutesSeconds ParseDegreesMinutesSeconds(double val)
        {
            //double degrees = (val / 100.0);
            //double minutes = (Math.Abs(degrees) - 
Math.Abs((double)(int)(degrees))) * 100;
            //double seconds = (Math.Abs(val) - Math.Abs((double)(int)val)) 
* 60.0;

            /* MY FIX*/
            // ->
            double grados = Math.Round(val, 0);
            double minutos = Math.Round((val - grados)*60, 0);
            double segundos = Math.Round(((val - grados) * 60 - minutos) * 
60, 0);
            // <-
            return new DegreesMinutesSeconds((int)grados, (int)minutos, 
segundos);
        }

I've only taken the int part of 'val' parameter and then calculated minutes 
taking the decimal part, dividing it by 60. Simillary with seconds.

It's the right way cause i've compared my results with commercial software 
one's.

I hope it to be useful.
date: Sat, 16 Feb 2008 17:50:01 -0800   author:   el Púa el P?

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us