[.NET源码] GMap扩展
2015-12-21 17:25
225 查看
<无详细内容>
namespace GMap.NET
{
using System;
using System.Globalization;
/// <summary>
/// the point of coordinates
/// </summary>
[Serializable]
public struct PointLatLng
{http://www.kmnk03.com/hxpfk/bptx/349.html
public static readonly PointLatLng Empty = new PointLatLng();
private double lat;
private double lng;
private int gps_lat;
private int gps_lng;
bool NotEmpty;
public PointLatLng(double lat, double lng)
{
this.lat = lat;
this.lng = lng;
this.gps_lat = 0;
this.gps_lng = 0;
NotEmpty = true;
}http://www.kmnk03.com/hxpfk/bptx/350.html
public PointLatLng(double lat, double lng, double gps_lat, double gps_lng)
{
this.lat = lat;
this.lng = lng;
this.gps_lat = (int)Math.Round(gps_lat * 100000);
this.gps_lng = (int)Math.Round(gps_lng * 100000);
NotEmpty = true;http://www.kmnk03.com/hxpfk/bptx/351.html
}
public bool HaveGps
{
get { return gps_lng != 0; }
}
public double GpsLat
{
get { return (double)this.gps_lat / 100000.0; }
}
public double GpsLng
{
get { return (double)this.gps_lng / 100000.0; }
}
/// <summary>
/// returns true if coordinates wasn't assigned
/// </summary>http://www.kmnk03.com/hxpfk/bptx/352.html
public bool IsEmpty
{
get
{
return !NotEmpty;
}
http://www.kmnk03.com/hxpfk/bptx/353.html
}
public double Lat
{
get
{
return this.lat;
}
set
{
this.lat = value;
NotEmpty = true;
}
}
public double Lng
{http://www.kmnk03.com/hxpfk/bptx/354.html
get
{
return this.lng;
}
set
{
this.lng = value;http://www.kmnk03.com/hxpfk/bptx/355.html
NotEmpty = true;
}
}
public static PointLatLng operator +(PointLatLng pt, SizeLatLng sz)
{
return Add(pt, sz);
}
public static PointLatLng operator -(PointLatLng pt, SizeLatLng sz)
{http://www.kmnk03.com/hxpfk/bptx/356.html
return Subtract(pt, sz);
}
public static bool operator ==(PointLatLng left, PointLatLng right)
{
return ((left.Lng == right.Lng) && (left.Lat == right.Lat));
}
public static bool operator !=(PointLatLng left, PointLatLng right)
{
return !(left == right);
}
public static PointLatLng Add(PointLatLng pt, SizeLatLng sz)
{http://www.kmnk03.com/hxpfk/bptx/358.html
return new PointLatLng(pt.Lat - sz.HeightLat, pt.Lng + sz.WidthLng);
}
public static PointLatLng Subtract(PointLatLng pt, SizeLatLng sz)
{
return new PointLatLng(pt.Lat + sz.HeightLat, pt.Lng - sz.WidthLng);
}
public override bool Equals(object obj)
{
if(!(obj is PointLatLng))
{
return false;
}
PointLatLng tf = (PointLatLng)obj;
return (((tf.Lng == this.Lng) && (tf.Lat == this.Lat)) && tf.GetType().Equals(base.GetType()));
}
public void Offset(PointLatLng pos)
{http://www.kmnk03.com/hxpfk/bptx/362.html
this.Offset(pos.Lat, pos.Lng);
}
public void Offset(double lat, double lng)
{
this.Lng += lng;
this.Lat -= lat;
}
public override int GetHashCode()
{
return (this.Lng.GetHashCode() ^ this.Lat.GetHashCode());
}
public override string ToString()
{
return string.Format(CultureInfo.CurrentCulture, "{{Lat={0}, Lng=小贝}}", this.Lat, this.Lng);
}
}kmnk03.com
www.kmnk03.com
}
namespace GMap.NET
{
using System;
using System.Globalization;
/// <summary>
/// the point of coordinates
/// </summary>
[Serializable]
public struct PointLatLng
{http://www.kmnk03.com/hxpfk/bptx/349.html
public static readonly PointLatLng Empty = new PointLatLng();
private double lat;
private double lng;
private int gps_lat;
private int gps_lng;
bool NotEmpty;
public PointLatLng(double lat, double lng)
{
this.lat = lat;
this.lng = lng;
this.gps_lat = 0;
this.gps_lng = 0;
NotEmpty = true;
}http://www.kmnk03.com/hxpfk/bptx/350.html
public PointLatLng(double lat, double lng, double gps_lat, double gps_lng)
{
this.lat = lat;
this.lng = lng;
this.gps_lat = (int)Math.Round(gps_lat * 100000);
this.gps_lng = (int)Math.Round(gps_lng * 100000);
NotEmpty = true;http://www.kmnk03.com/hxpfk/bptx/351.html
}
public bool HaveGps
{
get { return gps_lng != 0; }
}
public double GpsLat
{
get { return (double)this.gps_lat / 100000.0; }
}
public double GpsLng
{
get { return (double)this.gps_lng / 100000.0; }
}
/// <summary>
/// returns true if coordinates wasn't assigned
/// </summary>http://www.kmnk03.com/hxpfk/bptx/352.html
public bool IsEmpty
{
get
{
return !NotEmpty;
}
http://www.kmnk03.com/hxpfk/bptx/353.html
}
public double Lat
{
get
{
return this.lat;
}
set
{
this.lat = value;
NotEmpty = true;
}
}
public double Lng
{http://www.kmnk03.com/hxpfk/bptx/354.html
get
{
return this.lng;
}
set
{
this.lng = value;http://www.kmnk03.com/hxpfk/bptx/355.html
NotEmpty = true;
}
}
public static PointLatLng operator +(PointLatLng pt, SizeLatLng sz)
{
return Add(pt, sz);
}
public static PointLatLng operator -(PointLatLng pt, SizeLatLng sz)
{http://www.kmnk03.com/hxpfk/bptx/356.html
return Subtract(pt, sz);
}
public static bool operator ==(PointLatLng left, PointLatLng right)
{
return ((left.Lng == right.Lng) && (left.Lat == right.Lat));
}
public static bool operator !=(PointLatLng left, PointLatLng right)
{
return !(left == right);
}
public static PointLatLng Add(PointLatLng pt, SizeLatLng sz)
{http://www.kmnk03.com/hxpfk/bptx/358.html
return new PointLatLng(pt.Lat - sz.HeightLat, pt.Lng + sz.WidthLng);
}
public static PointLatLng Subtract(PointLatLng pt, SizeLatLng sz)
{
return new PointLatLng(pt.Lat + sz.HeightLat, pt.Lng - sz.WidthLng);
}
public override bool Equals(object obj)
{
if(!(obj is PointLatLng))
{
return false;
}
PointLatLng tf = (PointLatLng)obj;
return (((tf.Lng == this.Lng) && (tf.Lat == this.Lat)) && tf.GetType().Equals(base.GetType()));
}
public void Offset(PointLatLng pos)
{http://www.kmnk03.com/hxpfk/bptx/362.html
this.Offset(pos.Lat, pos.Lng);
}
public void Offset(double lat, double lng)
{
this.Lng += lng;
this.Lat -= lat;
}
public override int GetHashCode()
{
return (this.Lng.GetHashCode() ^ this.Lat.GetHashCode());
}
public override string ToString()
{
return string.Format(CultureInfo.CurrentCulture, "{{Lat={0}, Lng=小贝}}", this.Lat, this.Lng);
}
}kmnk03.com
www.kmnk03.com
}
相关文章推荐
- 7年来都做了些什么
- 20个命令行工具监控 Linux 系统性能
- spring事务隔离级别
- CSS3-学习记录一
- 优化表的数据类型
- 老李分享:jvm内存原型剖析
- 身份证校验js,包括了第18位数字的校验
- html获取屏幕宽度及其分辨率
- hive 常用查询语句
- 类型的安全转换
- iOS常见的几种加密和比较
- HTTP Header 属性列表
- Navigation 动态加载选项,HorizontalScrollView横向选项卡
- 【C++探索之旅】第一部分第四课:内存,变量和引用
- Red Hat的云计算产品和解决方案一览
- Hibernate主键生成器
- ActiveX(一)第一个简单的Demo
- OC推箱子
- iptables基础配置
- ListView部分更新