本文整理汇总了C#中LibGeo.GeoCoord类的典型用法代码示例。如果您正苦于以下问题:C# GeoCoord类的具体用法?C# GeoCoord怎么用?C# GeoCoord使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GeoCoord类属于LibGeo命名空间,在下文中一共展示了GeoCoord类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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");
}
示例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());
}
示例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
}
示例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;
}
示例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);
}
示例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);
}
示例7: split
public void split(GeoCoord midLoc)
{
GeoCoord midLocWithAlt = new GeoCoord(midLoc);
midLocWithAlt.Elev = m_wptFrom.Location.Elev;
m_track.splitLeg(this, midLocWithAlt);
}
示例8: translate
public void translate(GeoCoord to)
{
m_X = to.x();
m_Y = to.y();
m_H = to.h();
}
示例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);
}
示例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;
*/
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例15: insideCurrentZone
public bool insideCurrentZone(GeoCoord loc)
{
return getZone(loc) == screenUtmZone;
}