2017-06-08 17:33:55 +02:00
|
|
|
|
namespace Microsoft.eShopOnContainers.Services.Locations.API.Model
|
2017-05-30 15:01:58 +02:00
|
|
|
|
{
|
2017-06-08 17:33:55 +02:00
|
|
|
|
using MongoDB.Bson;
|
|
|
|
|
using MongoDB.Driver.GeoJsonObjectModel;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
2017-05-30 15:01:58 +02:00
|
|
|
|
public class Locations
|
|
|
|
|
{
|
2017-06-08 17:33:55 +02:00
|
|
|
|
public ObjectId Id { get; set; }
|
|
|
|
|
public string Code { get; set; }
|
|
|
|
|
public ObjectId Parent_Id { get; set; }
|
|
|
|
|
public string Description { get; set; }
|
|
|
|
|
public double Latitude { get; set; }
|
|
|
|
|
public double Longitude { get; set; }
|
|
|
|
|
public GeoJsonPoint<GeoJson2DGeographicCoordinates> Location { get; set; }
|
|
|
|
|
public GeoJsonPolygon<GeoJson2DGeographicCoordinates> Polygon { get; set; }
|
|
|
|
|
public void SetLocation(double lon, double lat) => SetPosition(lon, lat);
|
|
|
|
|
|
|
|
|
|
private void SetPosition(double lon, double lat)
|
2017-06-01 20:16:19 +02:00
|
|
|
|
{
|
2017-06-08 17:33:55 +02:00
|
|
|
|
Latitude = lat;
|
|
|
|
|
Longitude = lon;
|
|
|
|
|
Location = new GeoJsonPoint<GeoJson2DGeographicCoordinates>(
|
|
|
|
|
new GeoJson2DGeographicCoordinates(lon, lat));
|
2017-05-30 15:01:58 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|