2011-08-01 10 views
1

Windows Mobile開発では、.NetアプリケーションはGPS中間ドライバを使用して、複数のアプリケーションが1つのアプリケーションが他のアプリケーションをロックしないでGPSデバイスを使用できるようにすることができます。私はGPS中間ドライバを使用するモバイルアプリケーション(.Net Compact Framework)を持っていますし、GPS機能を除いたこのアプリケーションのWindows版もあります。今、私はWindows 7を実行しているGPS受信機を内蔵しているタブレットPCにGPS機能を組み込む必要があります。 GPS受信機への接続は、COMポートを介して確立されます。WindowsプラットフォームのGPS中間ドライバに相当するものは何ですか?

私のアプリケーションでGPS受信機を使用することができますが、PCで実行されている他のナビゲーションソフトウェアのGPS受信機をブロックすることなく、Windows用のGPS中間ドライバがありますか?

+0

私はあなたが戻ってCOMポートにだと思います。 –

+0

それは私が恐れていたものです! ;)返事をありがとう、ヘンク。これは、COMポートを介して受信機との接続を確立し、同じ受信機を使用しようとする他のナビゲーションソフトウェアでこのポートがブロックされることを意味しますか? – BruceHill

+0

それは以前のケースです...私は過去にスプリッタを使用しましたが(XP)、混在しています。 –

答えて

0

場所サービスを処理するためのオープンソースコードであるGeoFrameworkを使用してこれを解決しました。 http://geoframework.codeplex.com/と、そのサイト上で言及しているとして、GeoFrameworkは今ここで見つけることができますDotSpatialオープンソースプロジェクトの一部です:GeoFrameworkのためのウェブサイトはここにある私がGeoFrameworkで見つけhttp://dotspatial.codeplex.com/

一つの利点は、それが両方実行されるということですWindowsとWindows Mobileの両方で、WindowsとWindows Mobileプラットフォームの両方でアプリケーションを実行するという私の目標をさらに進化させましたが、コードベースは1つしかありませんでした。

コメントに記載されているように、私はクライアントが使用しているナビゲーションソフトウェアとアプリケーションの両方で問題を抱えていましたが、これらのアプリケーションの1つでは、 COMポートへの接続。私はこれを、1つの物理COMポートを2つの仮想COMポートに変換するCOMポートスプリッタを利用することで解決しました。このようにして、私のアプリケーションとナビゲーションソフトウェアは、同時に位置データを読み取ることができます。

1

です。 GeoFrameworkは、最高の無料のGPSフレームワークです。 あなたが/ Deprojectに平面の座標を投影する必要がある場合は、これらのクラスはあなたを助けることができる:

public interface IProjector 
    { 
     PointD Deproject(PointD projectedCoordinate); 
     PointD Project(PointD geographicCoordinate); 
     PointD Project(Position position); 
     PointD Project(Latitude latitude, Longitude longitude); 
    } 

[StructLayout(LayoutKind.Sequential)] 
    public struct PointD : IEquatable<PointD>, IFormattable 
    { 
     private double _x; 
     private double _y; 
     public static PointD Empty; 
     public PointD(double x, double y) 
     { 
      this._x = x; 
      this._y = y; 
     } 

     public PointD(PointD p) 
     { 
      this._x = p.X; 
      this._y = p.Y; 

     } 

     public double X 
     { 
      get 
      { 
       return this._x; 
      } 
      set 
      { 
       this._x = value; 
      } 
     } 
     public double Y 
     { 
      get 
      { 
       return this._y; 
      } 
      set 
      { 
       this._y = value; 
      } 
     } 
     public bool IsEmpty 
     { 
      get 
      { 
       return this.Equals(Empty); 
      } 
     } 
     public Point ToPoint() 
     { 
      return new Point((int)this._x, (int)this._y); 
     } 

     public void Normalize() 
     { 
      double num = Math.Sqrt((this.X * this.X) + (this.Y * this.Y)); 
      this.X /= num; 
      this.Y /= num; 
     } 

     public static PointD FromSize(Size size) 
     { 
      return new PointD((double)size.Width, (double)size.Height); 
     } 

     public static PointD FromSize(SizeF size) 
     { 
      return new PointD((double)size.Width, (double)size.Height); 
     } 

     public static bool operator ==(PointD left, PointD right) 
     { 
      return left.Equals(right); 
     } 

     public static bool operator !=(PointD left, PointD right) 
     { 
      return !left.Equals(right); 
     } 

     public static PointD operator -(PointD left, PointD right) 
     { 
      return new PointD(left.X - right.X, left.Y - right.Y); 
     } 

     public override bool Equals(object obj) 
     { 
      return ((obj is PointD) && this.Equals((PointD)obj)); 
     } 

     public override int GetHashCode() 
     { 
      return (this._x.GetHashCode()^this._y.GetHashCode()); 
     } 

     public override string ToString() 
     { 
      return this.ToString("G", CultureInfo.CurrentCulture); 
     } 

     public bool Equals(PointD other) 
     { 
      return (this._x.Equals(other.X) && this._y.Equals(other.Y)); 
     } 

     public string ToString(string format, IFormatProvider formatProvider) 
     { 
      CultureInfo info = (CultureInfo)formatProvider; 
      return (this._x.ToString(format, formatProvider) + info.TextInfo.ListSeparator + " " + this._y.ToString(format, formatProvider)); 
     } 

     static PointD() 
     { 
      Empty = new PointD(0.0, 0.0); 
     } 
    } 

public class Projector : IProjector 
    { 


     private const double DEGREEStoRADIANS = System.Math.PI/180; 
     private const double RADIANStoDEGREES = 180/System.Math.PI; 

     /* These values represent the equatorial radius of the WGS84 ellipsoid in meters. 
     * resulting in projected coordinates which are also in meters 
     */ 
     private const double WGS84SEMIMAJOR = 6378137.0; 
     private const double ONEOVERWGS84SEMIMAJOR = 1.0/WGS84SEMIMAJOR; 



     public PointD Deproject(PointD projectedCoordinate) 
     { 

      .PointD result = new PointD(); 

      // Calculate the geographic X coordinate (longitude) 
      result.X = (float)(projectedCoordinate.X * ONEOVERWGS84SEMIMAJOR/System.Math.Cos(0) * RADIANStoDEGREES); 

      // Calculate the geographic Y coordinate (latitude) 
      result.Y = (float)(projectedCoordinate.Y * ONEOVERWGS84SEMIMAJOR * RADIANStoDEGREES); 

      return result; 
     } 

     public PointD Project(PointD geographicCoordinate) 
     { 

      PointD result = new PointD(); 

      // Calculate the projected X coordinate 
      result.X = (float)(geographicCoordinate.X * DEGREEStoRADIANS * System.Math.Cos(0) * WGS84SEMIMAJOR); 

      // Calculate the projected Y coordinate 
      result.Y = (float)(geographicCoordinate.Y * DEGREEStoRADIANS * WGS84SEMIMAJOR); 

      // Return the result 
      return result;  

     } 

     public PointD Project(Position position) 
     { 
      PointD td = new PointD(); 
      td.X = ((position.Latitude.DecimalDegrees * DEGREEStoRADIANS) * System.Math.Cos(0.0)) * WGS84SEMIMAJOR; 
      td.Y = (position.Longitude.DecimalDegrees * DEGREEStoRADIANS) * WGS84SEMIMAJOR; 
      return td; 
     } 

     public PointD Project(Latitude latitude, Longitude longitude) 
     { 
      PointD td = new RTGeoFramework.Math.PointD(); 
      td.X = ((latitude.DecimalDegrees * DEGREEStoRADIANS) * System.Math.Cos(0.0)) * WGS84SEMIMAJOR; 
      td.Y = (longitude.DecimalDegrees * DEGREEStoRADIANS) * WGS84SEMIMAJOR; 
      return td; 
     } 

    } 
関連する問題