通过Windows Mobile开发,您的.Net应用程序可以利用GPS中间驱动程序来确保多个应用程序可以使用该GPS设备,而不需要一个应用程序锁定另一个应用程序。我有一个使用GPS Driver的移动应用程序( GPS ),我还有一个不包含.Net功能的Windows版应用程序。现在,我需要为一台运行Windows7且内置了GPS接收器的tablet PC构建GPS功能。通过com端口建立到GPS接收器的连接。
是否有Windows版的GPS中间层驱动程序允许我的应用程序使用GPS接收器,而不会阻塞PC上运行的其他导航软件的GPS接收器?
发布于 2011-08-14 04:09:57
我通过使用GeoFramework解决了这个问题,它是用于处理位置服务的开源代码。GeoFramework的网站在这里:http://geoframework.codeplex.com/,正如它在网站上提到的那样,GeoFramework现在是DotSpatial开源项目的一部分,该项目可以在这里找到:http://dotspatial.codeplex.com/
我发现GeoFramework的一个优点是它可以在Windows和Windows Mobile上运行,这让我在实现应用程序同时在Windows和Windows Mobile平台上运行的目标上又前进了一步,但只有一个代码库。
正如我在评论中提到的,我的客户端正在使用的导航软件和我的应用程序都试图打开相同的com端口,这导致其中一个应用程序无法建立到com端口的连接。我通过使用com端口拆分器解决了这个问题,它将一个物理com端口转换为两个虚拟com端口。这样,我的应用程序和导航软件都可以同时读取位置数据。
发布于 2012-08-10 03:53:09
是对的!这是一个最好的免费GeoFramework框架。如果需要投影/反投影平面中的坐标,这些类可以帮助您:
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;
}
}https://stackoverflow.com/questions/6899373
复制相似问题