本文整理汇总了C#中LibGeo.GeoCoord类的典型用法代码示例。如果您正苦于以下问题:C# GeoCoord类的具体用法?C# GeoCoord怎么用?C# GeoCoord使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GeoCoord类属于LibGeo命名空间,在下文中一共展示了GeoCoord类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: packCoord
// packs location into the next (usually first) 6 cells of the fields array
public void packCoord(GeoCoord loc)
{
// $PMGNWPL,3339.889,N,11736.283,W,0000155,M,WPT001,this is comment,a*7E
double Lat = loc.Lat;
string sDir = Lat < 0 ? "S" : "N";
double aLat = Math.Abs(Lat);
int iLat = (int)Math.Floor(aLat);
double latMin = aLat - iLat;
double latMinM = Math.Round(latMin * 60.0d, 3);
string format = latMinM < 10.0 ? "{0:D2}0{1:F3}" :"{0:D2}{1:F3}";
string sLat = string.Format(format, iLat, latMinM);
fields.Add(sLat);
fields.Add(sDir);
double Lng = loc.Lng;
sDir = Lng < 0 ? "W" : "E";
double aLng = Math.Abs(Lng);
int iLng = (int)Math.Floor(aLng);
double lngMin = aLng - iLng;
double lngMinM = Math.Round(lngMin * 60.0d, 3);
format = lngMinM < 10.0 ? "{0:D3}0{1:F3}" :"{0:D3}{1:F3}";
string sLng = string.Format(format, iLng, lngMinM);
fields.Add(sLng);
fields.Add(sDir);
int Elev = (int)loc.Elev;
fields.Add("" + Elev);
fields.Add("M");
}
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:31,代码来源:MagellanProtoDef.cs
示例2: TileTerra
private bool m_triedReload = false; // limits reload attempts
#endregion Fields
#region Constructors
public TileTerra(TileSetTerra ts, Scale tileScale, GeoCoord topLeft, GeoCoord bottomRight)
{
m_tileSet = ts;
m_tileScale = tileScale;
m_topLeft = topLeft.Clone();
m_bottomRight = bottomRight.Clone();
//LibSys.StatusBar.Trace("TileTerra() topLeft=" + m_topLeft.ToString() + " bottomRight=" + m_bottomRight.ToString());
}
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:14,代码来源:TileTerra.cs
示例3: Vehicle
public Vehicle(GeoCoord loc, string name, string sym, string source, string url, string desc)
: base("", loc)
{
m_label = name;
m_sym = sym;
m_source = source;
m_url = url;
m_desc = desc;
Image = null;
tick(); // set Name
}
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:12,代码来源:Vehicle.cs
示例4: TileSetTerraLayout
// Use index from TileSetTerra.m_scale to define desired scale.
// if scaleIndexHint==-1 the elev is used to find the best matching scale. See TileSetTerra.calcScaleIndex for more.
public TileSetTerraLayout(GeoCoord coverageTopLeft, GeoCoord coverageBottomRight, double elev, int scaleIndexHint, Theme theme, bool themeIsColor)
{
m_coverageTopLeft = coverageTopLeft;
m_coverageBottomRight = coverageBottomRight;
m_curTheme = theme;
m_curThemeColor = themeIsColor;
double lng = (coverageTopLeft.Lng + coverageBottomRight.Lng) / 2;
double lat = (coverageTopLeft.Lat + coverageBottomRight.Lat) / 2;
m_coverageCenter = new GeoCoord(lng, lat);
int scaleIndex;
Scale tileScale;
isValid = TileSetTerra.calcScaleIndex(m_curTheme, elev, scaleIndexHint, out scaleIndex, out tileScale);
m_tileScale = tileScale;
}
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:18,代码来源:TileSetTerraLayout.cs
示例5: DlgFavoritesAddTo
// closest is SortedList of string (name) by key=double (distance meters)
public DlgFavoritesAddTo(CamPos camPos, SortedList closest, MenuItem parentMenuItem, EventHandler eventHandler)
{
m_camPos = camPos;
m_parentMenuItem = parentMenuItem;
m_eventHandler = eventHandler;
InitializeComponent();
GeoCoord loc = new GeoCoord(m_camPos);
Distance camHD = new Distance(m_camPos.H);
int unitsCompl = camHD.UnitsCompl;
locationLabel.Text = "Location: " + loc.ToString() + " / Camera at " + camHD.ToString(unitsCompl);
nameComboBox.Text = m_camPos.Name;
for(int i=0; i < closest.Count && i < 20 ;i++)
{
string name = ((LiveObject)closest.GetByIndex(i)).Name;
nameComboBox.Items.Add(name);
}
Project.setDlgIcon(this);
}
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:22,代码来源:DlgFavoritesAddTo.cs
示例6: parseCityString
public static City parseCityString(string cityStr)
{
if(!cityStr.StartsWith("REC:"))
{
return null;
}
cityStr = cityStr.Substring(4);
String name = "";
String country = "US";
String state = "";
String county = "";
String latt = "";
String longt = "";
int importance = 0;
String dsg = null;
char[] splitter = { '|' };
string[] st = cityStr.Split(splitter);
int i = 0;
foreach(string str in st)
{
if(!str.StartsWith("//"))
{ // we can comment out lines in the box using //
System.Console.WriteLine("ZIP info=" + str);
switch(i)
{
case 0:
county = "zipcode " + str;
break;
case 1:
name = str;
break;
case 2:
state = str;
break;
case 3:
longt = str;
break;
case 4:
latt = str;
break;
default:
break;
}
}
i++;
}
/*
System.Console.WriteLine("name=\"" + name + "\"");
System.Console.WriteLine("country=\"" + country + "\"");
System.Console.WriteLine("state=\"" + state + "\"");
System.Console.WriteLine("county=\"" + county + "\"");
System.Console.WriteLine("latt=\"" + latt + "\"");
System.Console.WriteLine("longt=\"" + longt + "\"");
System.Console.WriteLine("importance=\"" + importance + "\"");
System.Console.WriteLine("dsg=\"" + dsg + "\"");
*/
double dlat = Convert.ToDouble(latt);
double dlong = Convert.ToDouble(longt);
GeoCoord loc = new GeoCoord(dlong, dlat);
//System.Console.WriteLine(name + " " + loc.toString() + " pop=" + (int)a[6]);
return new City(name, loc, country, state, county, 0, importance, dsg);
}
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:68,代码来源:ZipcodeServer.cs
示例7: split
public void split(GeoCoord midLoc)
{
GeoCoord midLocWithAlt = new GeoCoord(midLoc);
midLocWithAlt.Elev = m_wptFrom.Location.Elev;
m_track.splitLeg(this, midLocWithAlt);
}
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:7,代码来源:Leg.cs
示例8: translate
public void translate(GeoCoord to)
{
m_X = to.x();
m_Y = to.y();
m_H = to.h();
}
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:6,代码来源:GeoCoord.cs
示例9: subtract
public GeoCoord subtract(GeoCoord a, bool spans180)
{
double x = a.x();
double dx = m_X - x;
if(spans180)
{ // dx < 360.0 && Math.Abs(dx) > 180.0) {
if(x > 90.0 && m_X < -90)
{
x -= 360.0;
}
else if(m_X > 90.0 && x < -90)
{
x += 360.0;
}
dx = m_X - x;
}
double dy = m_Y - a.y();
double dz = m_H - a.h();
return new GeoCoord(dx, dy, dz);
}
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:20,代码来源:GeoCoord.cs
示例10: bearing
// returns bearing in rads. To get degrees, multiply by 180.0d / Math.PI
public double bearing(GeoCoord nextLoc)
{
double Lon1 = this.Lng * Math.PI / 180.0d;
double Lon2 = nextLoc.Lng * Math.PI / 180.0d;
double Lat1 = this.Lat * Math.PI / 180.0d;
double Lat2 = nextLoc.Lat * Math.PI / 180.0d;
double y = Math.Sin(Lon1-Lon2) * Math.Cos(Lat2);
double x = Math.Cos(Lat1) * Math.Sin(Lat2) - Math.Sin(Lat1) * Math.Cos(Lat2) * Math.Cos(Lon1 - Lon2);
// from http://www.movable-type.co.uk/scripts/LatLong.html
if (Math.Sin(Lon2 - Lon1) > 0.0)
{
return(Math.Atan2(-y, x));
}
else
{
return(2.0d * Math.PI - Math.Atan2(y, x));
}
/*
// see http://www.malaysiagis.com/related_technologies/gps/article3.cfm for the formula and some code
// see http://www.fcaglp.unlp.edu.ar/~esuarez/gmt/1997/0148.html for more
double ret = 0.0d;
double rad_bearing;
double rad_dist = Math.Acos(Math.Sin(Lat1) * Math.Sin(Lat2) + Math.Cos(Lat1) * Math.Cos(Lat2) * Math.Cos(Lon1 - Lon2));
if (Math.Sin(Lon2 - Lon1) > 0.0)
{
double t1 = Math.Sin(Lat2) - Math.Sin(Lat1) * Math.Cos(rad_dist);
double t2 = Math.Cos(Lat1) * Math.Sin(rad_dist);
double t3 = t1 / t2;
double t4 = Math.Atan(-t3 / Math.Sqrt(-t3 * t3 + 1)) + 2 * Math.Atan(1);
rad_bearing = t4;
}
else
{
double t1 = Math.Sin(Lat2) - Math.Sin(Lat1) * Math.Cos(rad_dist);
double t2 = Math.Cos(Lat1) * Math.Sin(rad_dist);
double t3 = t1 / t2;
double t4 = -t3 * t3 + 1;
double t5 = 2.0d * Math.PI - (Math.Atan(-t3 / Math.Sqrt(-t3 * t3 + 1)) + 2 * Math.Atan(1));
rad_bearing = t5;
}
ret = rad_bearing;
return ret;
*/
}
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:53,代码来源:GeoCoord.cs
示例11: resetBoundaries
/// <summary>
/// resets boundaries (TopLeft, BottomRight) so that newly added waypoints' boundaries are calculated
/// useful for reading in .loc files
/// </summary>
public static void resetBoundaries()
{
m_topLeft = new GeoCoord(180.0d, -90.0d);
m_bottomRight = new GeoCoord(-180.0d, 90.0d);
}
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:9,代码来源:WaypointsCache.cs
示例12: toScreenPoint
public Point toScreenPoint(GeoCoord loc, bool isPrint)
{
Point ret = new Point();
LonLatPt lonlat = new LonLatPt();
lonlat.Lat = loc.Lat;
lonlat.Lon = loc.Lng;
UtmPt utmpt = Projection.LonLatPtToUtmNad83Pt(lonlat);
// calculate where the point would be before the tiles are scaled to the screen:
double pX = (utmpt.X - screenUtmX) / m_metersPerPixel; // in pixels
double pY = (screenUtmY - utmpt.Y) / m_metersPerPixel;
// now scale it to the screen:
if(isPrint)
{
double offsetX = m_offsetXPrint / m_ratioXPrint;
double offsetY = m_offsetYPrint / m_ratioYPrint;
pX += offsetX;
pY += offsetY + 200;
// and scale it back:
pX *= m_ratioXPrint;
pY *= m_ratioYPrint;
}
else
{
double offsetX = m_offsetX / m_ratioX;
double offsetY = m_offsetY / m_ratioY;
pX += offsetX;
pY += offsetY + 200;
// and scale it back:
pX *= m_ratioX;
pY *= m_ratioY;
}
ret.X = (int)pX;
ret.Y = (int)pY;
return ret;
}
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:44,代码来源:TileSetTerra.cs
示例13: toGeoLocation
public GeoCoord toGeoLocation(Point point, bool isPrint)
{
GeoCoord ret = new GeoCoord(0.0d, 0.0d);
double pX, pY;
if(isPrint)
{
double offsetX = m_offsetXPrint / m_ratioXPrint;
double offsetY = m_offsetYPrint / m_ratioYPrint;
// this would be pixel screen coord if there were no scaling:
pX = point.X / m_ratioXPrint - offsetX; // tile pixels before scaling
pY = - point.Y / m_ratioYPrint + offsetY + 200;
}
else
{
double offsetX = m_offsetX / m_ratioX; // tile pixels before scaling
double offsetY = m_offsetY / m_ratioY;
// this would be pixel screen coord if there were no scaling:
pX = point.X / m_ratioX - offsetX; // tile pixels before scaling
pY = - point.Y / m_ratioY + offsetY + 200;
}
// now calculate it in meters and offset the screen UTM
pX = pX * m_metersPerPixel + screenUtmX;
pY = pY * m_metersPerPixel + screenUtmY;
UtmPt utmpt = new UtmPt();
utmpt.X = pX;
utmpt.Y = pY;
utmpt.Zone = screenUtmZone;
LonLatPt lonlat = Projection.UtmNad83PtToLonLatPt(utmpt);
ret.Lat = lonlat.Lat;
ret.Lng = lonlat.Lon;
return ret;
}
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:41,代码来源:TileSetTerra.cs
示例14: ReTileSpecial
// scaleIndex 0-24 from m_scales[]
public bool ReTileSpecial(int scaleIndex, out int total, out int toLoad, out GeoCoord topLeft, out GeoCoord bottomRight)
{
topLeft = null;
bottomRight = null;
// first check if requested scale is supported for this type of map
if(m_isSecond || !calcScale(scaleIndex))
{
total = 0;
toLoad = 0;
return false;
}
if(!m_retilingSpecial && Project.camTrackOn)
{
firstSuperframe = true;
}
m_retilingSpecial = true;
m_cameraManager.logCamtrackFrame();
// ok, we have a fair chance of rendering the map at the requested scale.
base.CameraMoved(); // provoke recalc
ReTile(scaleIndex);
m_pictureManager.ProcessCameraMove(); // need to call all layers here
setMainFormText();
total = m_hCount * m_vCount;
// count tiles that have images and need not be downloaded:
int _toLoad = total;
for(int hhh=0; hhh < m_hCount ;hhh++)
{
for(int vvv=0; vvv < m_vCount ;vvv++)
{
TileTerra tile = m_tiles[vvv, hhh];
if(tile != null && tile.backdrop != null && tile.backdrop.HasImage)
{
_toLoad--;
}
}
}
toLoad = _toLoad;
topLeft = new GeoCoord(m_cameraManager.CoverageTopLeft);
bottomRight = new GeoCoord(m_cameraManager.CoverageBottomRight);
return true;
}
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:50,代码来源:TileSetTerra.cs
示例15: insideCurrentZone
public bool insideCurrentZone(GeoCoord loc)
{
return getZone(loc) == screenUtmZone;
}
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:4,代码来源:TileSetTerra.cs
示例16: Earthquake
// may throw an exception if the data is not right
public Earthquake(string[] infos)
{
this.LiveObjectType = LiveObjectTypes.LiveObjectTypeEarthquake;
m_pixelRadius = MIN_EQ_PIXEL_RADIUS + 2;
N_LABEL_POSITIONS = 12;
/*
infos: 0 '2002/09/13 22:28:31'
infos: 1 '13.10N'
infos: 2 '93.11E'
infos: 3 '33.0'
infos: 4 '6.5'
infos: 5 'A'
infos: 6 'ANDAMAN ISLANDS, INDIA REGION'
infos: 7 'http://neic.usgs.gov/neis/bulletin/neic_jabw.html'
infos: 8 'bulletin'
*/
// time may be PDT from SCEC or HST from Hawaii - see EarthquakesCache:processQuakes0()
bool notUtc = false;
double zoneShift = 0.0d;
if(infos[0].EndsWith(" PDT"))
{
notUtc = true;
zoneShift = 8.0d;
} else if(infos[0].EndsWith(" HST"))
{
notUtc = true;
zoneShift = 10.0d; // this one (10.0d) works in winter (tested Jan 30th 2005)
if(System.TimeZone.CurrentTimeZone.IsDaylightSavingTime(DateTime.Now))
{
zoneShift = 11.0d; // supposedly works in summer (TODO: test it!)
}
}
if(notUtc)
{
string sTime = infos[0].Substring(0, infos[0].Length - 4);
DateTime localTime = Convert.ToDateTime(sTime);
// convert local time to UTC (with Daylight shift):
//DaylightTime daylightTime = new DaylightTime(...);
//if(System.TimeZone.IsDaylightSavingTime(localTime, daylightTime))
if(System.TimeZone.CurrentTimeZone.IsDaylightSavingTime(localTime))
{
m_dateTime = localTime.AddHours(zoneShift - 1.0d); // to zulu, with daylight savings
}
else
{
m_dateTime = localTime.AddHours(zoneShift); // to zulu
}
}
else // UTC from NEIC
{
m_dateTime = Convert.ToDateTime(infos[0]); // already zulu
}
double lat;
double lng;
double depth;
if(infos[1].ToLower().EndsWith("s") || infos[1].ToLower().EndsWith("n"))
{
lat = Convert.ToDouble(infos[1].Substring(0, infos[1].Length - 1));
if(infos[1].ToLower().EndsWith("s"))
{
lat = -lat;
}
lng = Convert.ToDouble(infos[2].Substring(0, infos[2].Length - 1));
if(infos[2].ToLower().EndsWith("w"))
{
lng = -lng;
}
}
else
{
lat = Convert.ToDouble(infos[1]);
lng = Convert.ToDouble(infos[2]);
}
try
{
depth = Convert.ToDouble(infos[3]) * 1000.0d;
}
catch (Exception e)
{
depth = 0.0d;
}
m_location = new GeoCoord(lng, lat, -depth);
try
{
m_magn = Convert.ToDouble(infos[4]);
}
catch (Exception e)
{
m_magn = 0.0d;
}
m_quality = infos[5];
m_comment = infos[6];
m_url = infos[7];
//.........这里部分代码省略.........
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:101,代码来源:Earthquake.cs
示例17: pushBoundaries
public static void pushBoundaries(GeoCoord loc)
{
if(loc.Lat > m_topLeft.Lat)
{
m_topLeft.Lat = loc.Lat;
}
if(loc.Lat < m_bottomRight.Lat)
{
m_bottomRight.Lat = loc.Lat;
}
if(loc.Lng < m_topLeft.Lng)
{
m_topLeft.Lng = loc.Lng;
}
if(loc.Lng > m_bottomRight.Lng)
{
m_bottomRight.Lng = loc.Lng;
}
}
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:19,代码来源:WaypointsCache.cs
示例18: getZone
internal static int getZone(GeoCoord loc)
{
LonLatPt lonlat = new LonLatPt();
lonlat.Lat = loc.Lat;
lonlat.Lon = loc.Lng;
int zone = Projection.LonLatPtToZone(lonlat);
return zone;
}
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:10,代码来源:TileSetTerra.cs
示例19: add
public GeoCoord add(GeoCoord a)
{
return new GeoCoord(m_X + a.x(), m_Y + a.y(), m_H + a.h());
}
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:4,代码来源:GeoCoord.cs
示例20: queryDisconnected
protected void queryDisconnected()
{
GeoCoord covTL = m_cameraManager.CoverageTopLeft;
GeoCoord covBR = m_cameraManager.CoverageBottomRight;
double marginY = m_retilingSpecial ? 0.0d : ((covBR.Lng - covTL.Lng) / 40.0d);
double marginX = m_retilingSpecial ? 0.0d : ((covTL.Lat - covBR.Lat) / 40.0d * m_cameraManager.xScaleFactor);
double covTL_Lng = covTL.Lng - marginX;
double covTL_Lat = covTL.Lat + marginY;
double covBR_Lng = covBR.Lng + marginX;
double covBR_Lat = covBR.Lat - marginY;
int currentZone = getZone(m_cameraManager.Location);
LonLatPt lonlat = new LonLatPt();
lonlat.Lat = covTL_Lat;
lonlat.Lon = covTL_Lng;
UtmPt utmptTL = Projection.LonLatPtToUtmNad83Pt(lonlat); // can be in other than currentZone
lonlat.Lat = covBR_Lat;
lonlat.Lon = covBR_Lng;
UtmPt utmptBR = Projection.LonLatPtToUtmNad83Pt(lonlat); // can be in other than currentZone
if(utmptTL.Zone != currentZone)
{
lonlat.Lat = m_cameraManager.Location.Lat;
lonlat.Lon = m_cameraManager.Location.Lng;
UtmPt utmptCam = Projection.LonLatPtToUtmNad83Pt(lonlat); // can be in other than currentZone
double dX = utmptBR.X - utmptCam.X;
utmptTL.X = utmptCam.X - dX;
utmptTL.Zone = currentZone;
}
else if(utmptBR.Zone != currentZone)
{
lonlat.Lat = m_cameraManager.Location.Lat;
lonlat.Lon = m_cameraManager.Location.Lng;
UtmPt utmptCam = Projection.LonLatPtToUtmNad83Pt(lonlat); // can be in other than currentZone
double dX = utmptCam.X - utmptTL.X;
utmptBR.X = utmptCam.X + dX;
utmptBR.Zone = currentZone;
}
int iScale = (int)m_tileScale;
int metersPerPixel = (1 << ((int) iScale - 10));
int factor = 200 * metersPerPixel;
if(!firstSuperframe || xEnd - xStart == 0 || m_lastFactor == 0)
{
xStart = (int)Math.Floor(utmptTL.X / factor);
yStart = (int)Math.Ceiling(utmptTL.Y / factor);
xEnd = (int)Math.Ceiling(utmptBR.X / factor);
yEnd = (int)Math.Floor(utmptBR.Y / factor);
m_lastFactor = factor;
}
else
{
xStart = xStart * m_lastFactor / factor;
yStart = yStart * m_lastFactor / factor;
xEnd = xEnd * m_lastFactor / factor;
yEnd = yEnd * m_lastFactor / factor;
firstSuperframe = false;
}
int numTilesX = xEnd - xStart;
int numTilesY = yStart - yEnd;
// we need to remember UTM coordinates for Projection operation:
m_scale = m_tileScale;
m_metersPerPixel = (1 << ((Int32) m_scale - 10));
screenUtmZone = currentZone;
screenUtmX = xStart * factor;
screenUtmY = (yStart - 1) * factor;
cleanTiles(); // dispose of previous tile array, if any
m_hCount = numTilesX;
m_vCount = numTilesY;
UtmPt utmpt = new UtmPt();
utmpt.X = xStart * factor;
utmpt.Y = yStart * factor;
utmpt.Zone = currentZone;
lonlat = Projection.UtmNad83PtToLonLatPt(utmpt);
double topLeftLat = lonlat.Lat;
double topLeftLng = lonlat.Lon;
utmpt.X = (xStart + numTilesX) * factor;
//.........这里部分代码省略.........
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:101,代码来源:TileSetTerra.cs
注:本文中的LibGeo.GeoCoord类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论