本文整理汇总了C#中GeoPoint类的典型用法代码示例。如果您正苦于以下问题:C# GeoPoint类的具体用法?C# GeoPoint怎么用?C# GeoPoint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GeoPoint类属于命名空间,在下文中一共展示了GeoPoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GeoDistanceBucketAggregation
public GeoDistanceBucketAggregation(string name, string field, GeoPoint origin, List<RangeAggregationParameter<uint>> ranges)
: base("geo_distance", name)
{
_field = field;
_origin = origin;
_ranges = ranges;
}
示例2: ParseGoogleEncodedPolyline
public static List<GeoPoint> ParseGoogleEncodedPolyline(String encoded)
{
var poly = new List<GeoPoint>();
int index = 0, len = encoded.Length;
int lat = 0, lng = 0;
while (index < len)
{
int b, shift = 0, result = 0;
do
{
b = encoded[index++] - 63;
result |= (b & 0x1f) << shift;
shift += 5;
} while (b >= 0x20);
int dlat = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
lat += dlat;
shift = 0;
result = 0;
do
{
b = encoded[index++] - 63;
result |= (b & 0x1f) << shift;
shift += 5;
} while (b >= 0x20);
var dlng = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
lng += dlng;
var p = new GeoPoint(lat / 1E5, lng / 1E5);
poly.Add(p);
}
return poly;
}
示例3: IsInside
public Boolean IsInside(GeoPoint point)
{
if ( point == null )
{
throw new ArgumentNullException("point");
}
GeoPoint a = NorthWestCorner;
GeoPoint b = SouthWestCorner;
GeoPoint c = NorthEastCorner;
Double bax = b.Latitude - a.Latitude;
Double bay = b.Longitude - a.Longitude;
Double cax = c.Latitude - a.Latitude;
Double cay = c.Longitude - a.Longitude;
if ( (point.Latitude - a.Latitude) * bax + (point.Longitude - a.Longitude) * bay < 0.0 )
return false;
if ( (point.Latitude - b.Latitude) * bax + (point.Longitude - b.Longitude) * bay > 0.0 )
return false;
if ( (point.Latitude - a.Latitude) * cax + (point.Longitude - a.Longitude) * cay < 0.0 )
return false;
if ( (point.Latitude - c.Latitude) * cax + (point.Longitude - c.Longitude) * cay > 0.0 )
return false;
return true;
}
示例4: shpRead
public GeoProject shpRead()
{
//IFeatureSet fs = FeatureSet.Open(shppath);
string str = fs.ProjectionString;
ProjectionInfo info = fs.Projection;
project = new GeoProject();
for (int i = 0; i < fs.Features.Count; i++) {
Geometries geometries = new Geometries();
IList<Coordinate> vertics = fs.Features[i].Coordinates;
GeoPolygon polygon = new GeoPolygon();
int circle = 1;
foreach (Coordinate vertic in vertics) {
GeoPoint point = new GeoPoint();
point.X = vertic.X;
point.Y = vertic.Y;
if (polygon.Points.Contains(point)) {
polygon.Circle = circle;
geometries.Polygons.Add(polygon);
circle++;
polygon = new GeoPolygon();
}
polygon.Points.Add(point);
}
polygon.Circle = circle;
geometries.Polygons.Add(polygon);
project.Geometries.Add(geometries);
}
return project;
}
示例5: Contains
public override bool Contains(GeoPoint location)
{
bool inside = false;
var v1 = Points[Points.Count - 1];
foreach (var v0 in Points)
{
double d1 = (location.Longitude - v0.Longitude) * (v1.Latitude - v0.Latitude);
double d2 = (location.Latitude - v0.Latitude) * (v1.Longitude - v0.Longitude);
if (location.Longitude < v1.Longitude)
{
if (v0.Longitude <= location.Longitude)
{
if (d1 > d2)
{
inside = !inside;
}
}
}
else if (location.Longitude < v0.Longitude)
{
if (d1 < d2)
{
inside = !inside;
}
}
v1 = v0; //Store previous endpoint as next startpoint
}
return inside;
}
示例6: SortGeoDistance
public SortGeoDistance(string field, DistanceUnitEnum distanceUnit, GeoPoint geoPoint)
{
_field = field;
Order = OrderEnum.asc;
Unit = distanceUnit;
GeoPoint = geoPoint;
}
示例7: GeoDecayBaseScoreFunction
protected GeoDecayBaseScoreFunction(string field, GeoPoint origin, DistanceUnit scale, string decayType)
{
_field = field;
_origin = origin;
_scale = scale;
_decayType = decayType;
}
示例8: GetSouthEastCorner
protected override GeoPoint GetSouthEastCorner()
{
GeoPoint southEastCorner = new GeoPoint(NorthWestCorner);
southEastCorner.Latitude -= LatitudeExtendDegree;
southEastCorner.Longitude += LongitudeExtendDegree;
return southEastCorner;
}
示例9: FromBodyTestAsync
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <exception cref="GeoClientException">A server side error occurred.</exception>
public async System.Threading.Tasks.Task FromBodyTestAsync(GeoPoint location, System.Threading.CancellationToken cancellationToken)
{
var url_ = string.Format("{0}/{1}", BaseUrl, "api/Geo/FromBodyTest");
using (var client_ = await CreateHttpClientAsync(cancellationToken).ConfigureAwait(false))
{
var request_ = await CreateHttpRequestMessageAsync(cancellationToken).ConfigureAwait(false);
PrepareRequest(client_, ref url_);
var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(location, new Newtonsoft.Json.JsonConverter[] { new Newtonsoft.Json.Converters.StringEnumConverter(), new JsonExceptionConverter() }));
content_.Headers.ContentType.MediaType = "application/json";
request_.Content = content_;
request_.Method = new System.Net.Http.HttpMethod("POST");
request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken).ConfigureAwait(false);
ProcessResponse(client_, response_);
var responseData_ = await response_.Content.ReadAsByteArrayAsync().ConfigureAwait(false);
var status_ = ((int)response_.StatusCode).ToString();
if (status_ == "204")
{
return;
}
else
if (status_ != "200" && status_ != "204")
throw new GeoClientException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", status_, responseData_, null);
}
}
示例10: TestMovePoint_50m_Northeast
public void TestMovePoint_50m_Northeast()
{
GeoPoint origin = new GeoPoint(112.1, 23.1);
IGeoPoint<double> point = origin.Move(50, 45);
Assert.AreEqual(point.Longtitute, 112.1010860, 1E-6);
Assert.AreEqual(point.Lattitute, 23.101086, 1E-6);
}
示例11: GeohashCellFilter
public GeohashCellFilter(string field, GeoPoint location, int precision, bool neighbors)
{
_field = field;
_location = location;
_precision = precision;
_neighbors = neighbors;
}
示例12: TestMovePoint_50m_Southwest
public void TestMovePoint_50m_Southwest()
{
GeoPoint origin = new GeoPoint(112.1, 23.1);
IGeoPoint<double> point = origin.Move(50, 225);
Assert.AreEqual(point.Longtitute, 112.0989140, 1E-6);
Assert.AreEqual(point.Lattitute, 23.098914, 1E-6);
}
示例13: edit_MGRS_TextChanged
private void edit_MGRS_TextChanged(object sender, EventArgs e)
{
if ( !_Changing )
{
String value = TambonHelper.ReplaceThaiNumerals(edt_MGRS.Text.ToUpper()).Trim();
GeoPoint geoPoint = null;
UtmPoint utmPoint = null;
try
{
_Changing = true;
if ( !TambonHelper.IsNumeric(value.Substring(0, 2)) )
{
value = ZoneForThailandMgrs(value) + value;
}
utmPoint = UtmPoint.ParseMgrsString(value);
geoPoint = new GeoPoint(utmPoint, (GeoDatum)cbx_datum.SelectedItem);
geoPoint.Datum = GeoDatum.DatumWGS84();
}
catch
{
// invalid string
utmPoint = null;
geoPoint = null;
}
SetValues(geoPoint, utmPoint, sender);
_Changing = false;
}
}
示例14: GeoDistanceRangeFilter
/// <summary>
/// Filters documents that include only hits that exists within a specific distance from a geo point.
/// </summary>
/// <param name="field">name of the field used for the geo point</param>
/// <param name="location">GeoPoint location</param>
/// <param name="from">from in distance units</param>
/// <param name="to">to in distance units</param>
public GeoDistanceRangeFilter(string field, GeoPoint location, DistanceUnit from, DistanceUnit to)
{
_field = field;
_location = location;
_from = @from;
_to = to;
}
示例15: TestDatumConversion
public void TestDatumConversion()
{
// example as of http://www.colorado.edu/geography/gcraft/notes/datum/gif/molodens.gif
GeoPoint point = new GeoPoint(30, -100, 232, GeoDatum.DatumNorthAmerican27MeanConus());
point.Datum = GeoDatum.DatumWGS84();
GeoPoint expected = new GeoPoint(30.0002239, -100.0003696, 194.816, GeoDatum.DatumWGS84());
Assert.IsTrue(expected.Equals(point));
}