本文整理汇总了C#中Coordinate类的典型用法代码示例。如果您正苦于以下问题:C# Coordinate类的具体用法?C# Coordinate怎么用?C# Coordinate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Coordinate类属于命名空间,在下文中一共展示了Coordinate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Announcement
public Announcement(string description, string type, string operatorName, DateTime? startDate, DateTime? endDate, Coordinate location, IEnumerable<string> modes)
{
this.OperatorName = operatorName;
this.Description = description;
this.StartDate = startDate;
this.EndDate = endDate;
this.Location = location;
this.Type = type;
this.Modes.AddRange(modes);
this.RelativeDateString = TimeConverter.ToRelativeDateString(StartDate, true);
if (modes != null)
{
if (modes.Select(x => x.ToLower()).Contains("bus"))
this.ModeImages.Add("/Images/64/W/ModeBus.png");
if (modes.Select(x => x.ToLower()).Contains("rail"))
this.ModeImages.Add("/Images/64/W/ModeRail.png");
if (modes.Select(x => x.ToLower()).Contains("taxi"))
this.ModeImages.Add("/Images/64/W/ModeTaxi.png");
if (modes.Select(x => x.ToLower()).Contains("boat"))
this.ModeImages.Add("/Images/64/W/ModeBoat.png");
if (!this.ModeImages.Any())
this.ModeImages.Add("/Images/64/W/ModeBus.png");
}
else
{
this.Modes.Add("bus");
this.ModeImages.Add("/Images/64/W/ModeBus.png");
}
}
示例2: reveal_all_tiles_near_mines_surrounding_tile_at
public void reveal_all_tiles_near_mines_surrounding_tile_at(Coordinate coordinate, IGrid _grid)
{
// minefield.reveal
for (var row = coordinate.X - 1; row <= coordinate.X + 1; row++)
for (var col = coordinate.Y - 1; col <= coordinate.Y + 1; col++)
{
var coordinate_of_tile_under_inspection = Coordinate.new_coord(row, col);
if (!coordinate_of_tile_under_inspection.Equals(coordinate))
{
if (!has_already_been_checked(coordinate_of_tile_under_inspection))
{
coordinates_checked.Add(coordinate_of_tile_under_inspection);
if (_grid.contains_tile_at(coordinate_of_tile_under_inspection) &&
!_grid.mine_on_tile_at(coordinate_of_tile_under_inspection))
{
_grid.reveal_tile_at(coordinate_of_tile_under_inspection);
if (!_grid.mines_near_tile_at(coordinate_of_tile_under_inspection))
{
reveal_all_tiles_near_mines_surrounding_tile_at(coordinate_of_tile_under_inspection, _grid);
}
}
}
}
}
}
示例3: Background
public Background(string color = null, string imageurl = null, Coordinate position = null, BackgroundRepeat repeat = null)
{
Color = color;
ImageUrl = imageurl;
Position = position;
Repeat = repeat;
}
示例4: GetSpaceInFront
public Coordinate GetSpaceInFront(Coordinate space, Direction direction)
{
if (direction == Direction.North)
{
if (space.Y + 1 >= numOfRows)
return new Coordinate(space.X, 0);
return new Coordinate(space.X, space.Y + 1);
}
else if (direction == Direction.East)
{
if (space.X + 1 >= numOfCols)
return new Coordinate(0, space.Y);
return new Coordinate(space.X + 1, space.Y);
}
else if (direction == Direction.West)
{
if (space.X - 1 < 0)
return new Coordinate(numOfCols - 1, space.Y);
return new Coordinate(space.X - 1, space.Y);
}
else
{
if (space.Y - 1 < 0)
return new Coordinate(space.X, numOfRows - 1);
return new Coordinate(space.X, space.Y - 1);
}
}
示例5: MonotoneChain
private readonly object _context; // user-defined information
/// <summary>
///
/// </summary>
/// <param name="pts"></param>
/// <param name="start"></param>
/// <param name="end"></param>
/// <param name="context"></param>
public MonotoneChain(Coordinate[] pts, int start, int end, object context)
{
_pts = pts;
_start = start;
_end = end;
_context = context;
}
示例6: PlaceShips
public void PlaceShips(IPlayerView playerView, ICollection<IVessel> ships)
{
/* This AI places ships in the upper right corner and to the left.
*
* E.g.
*
* 10 # # # # #
* 9 # # # # #
* 8 # # # #
* 7 # #
* 6 #
* 5
* 4
* 3
* 2
* 1
* 1 2 3 4 5 6 7 8 9 10
*/
Placement place;
Coordinate coord;
int xMax = playerView.GetXMax();
int yMax = playerView.GetYMax();
int i = 0;
foreach (IVessel ship in ships)
{
coord = new Coordinate(xMax - (2 * i), yMax);
place = new Placement(ship, coord, Orientation.Vertical);
playerView.PutShip(place);
i++;
}
}
示例7: PublicStopPoint
public PublicStopPoint(string name, string address, Coordinate location)
{
this.Id = Guid.NewGuid();
this.Name = name;
this.Address = address;
this.Location = location;
}
示例8: FindGeolocationAsync
/// <summary>
/// Finds the geolocation according <paramref name="coordinate"/>.
/// </summary>
/// <returns>The filled geolocation.</returns>
/// <param name="coordinate">Coordinate.</param>
/// <param name="language">Language of results in ISO code.</param>
public Task<Location> FindGeolocationAsync(Coordinate coordinate, string language)
{
if (language == null)
language = CultureInfo.CurrentUICulture.Name;
return Task.Run(() =>
{
string Country;
string State;
string AdministrativeArea;
string Locality;
string Route;
ReverseGeoLoc(coordinate.Longitude, coordinate.Latitude, language,
out Country,
out State,
out AdministrativeArea,
out Locality,
out Route);
return new Location()
{
Coordinate = coordinate,
Country = Country,
State = State,
AdministrativeArea = AdministrativeArea,
Locality = Locality,
Route = Route,
};
});
}
示例9: DistanceTo
public float DistanceTo(Coordinate c)
{
float dx = x - c.X;
float dy = y - c.Y;
float dz = z - c.Z;
return (float)Math.Sqrt(dx * dx + dy * dy + dz * dz);
}
示例10: ComputeDistance
public static void ComputeDistance(IGeometry geom, Coordinate pt, PointPairDistance ptDist)
{
if (geom is ILineString)
{
ComputeDistance((ILineString) geom, pt, ptDist);
}
else if (geom is IPolygon)
{
ComputeDistance((IPolygon) geom, pt, ptDist);
}
else if (geom is IGeometryCollection)
{
var gc = (IGeometryCollection) geom;
for (var i = 0; i < gc.NumGeometries; i++)
{
var g = gc.GetGeometryN(i);
ComputeDistance(g, pt, ptDist);
}
}
else
{
// assume geom is Point
ptDist.SetMinimum(geom.Coordinate, pt);
}
}
示例11: InsertCoordinates
async private void InsertCoordinates(Coordinate coordinate)
{
await coordinateTable.InsertAsync(coordinate);
//coordinates.Add(coordinate);
}
示例12: Locate
/// <summary>
/// Determines the topological relationship (location) of a single point
/// to a Geometry. It handles both single-element and multi-element Geometries.
/// The algorithm for multi-part Geometries is more complex, since it has
/// to take into account the boundaryDetermination rule.
/// </summary>
/// <param name="p"></param>
/// <param name="geom"></param>
/// <returns>Returns the location of the point relative to the input Geometry.</returns>
public int Locate( Coordinate p, Geometry geom )
{
if ( geom.IsEmpty() ) return Location.Exterior;
if ( geom is LineString )
{
return Locate( p, (LineString) geom );
}
if ( geom is LinearRing )
{
return Locate( p, (LinearRing) geom );
}
else if ( geom is Polygon )
{
return Locate( p, (Polygon) geom );
}
_isIn = false;
_numBoundaries = 0;
ComputeLocation( p, geom );
if ( GeometryGraph.IsInBoundary( _numBoundaries ) )
{
return Location.Boundary;
}
if ( _numBoundaries > 0 || _isIn)
{
return Location.Interior;
}
return Location.Exterior;
} // public int Locate( Coordinate p, Geometry geom )
示例13: Position
public Position(Coordinate coordinate, Accuracy accuracy, Distance altitide, DateTimeOffset timestamp)
{
Coordinate = coordinate;
Accuracy = accuracy;
Altitude = altitide;
Timestamp = timestamp;
}
示例14: RelatedResults
public RelatedResults(JsonData resultsJson)
{
if (resultsJson == null) return;
ResultAnnotations = new Annotation(resultsJson.GetValue<JsonData>("annotations"));
Score = resultsJson.GetValue<double>("score");
Kind = resultsJson.GetValue<string>("kind");
JsonData value = resultsJson.GetValue<JsonData>("value");
ValueAnnotations = new Annotation(value.GetValue<JsonData>("annotations"));
Retweeted = value.GetValue<bool>("retweeted");
InReplyToScreenName = value.GetValue<string>("in_reply_to_screen_name");
var contributors = value.GetValue<JsonData>("contributors");
Contributors =
contributors == null ?
new List<Contributor>() :
(from JsonData contributor in contributors
select new Contributor(contributor))
.ToList();
Coordinates = new Coordinate(value.GetValue<JsonData>("coordinates"));
Place = new Place(value.GetValue<JsonData>("place"));
User = new User(value.GetValue<JsonData>("user"));
RetweetCount = value.GetValue<int>("retweet_count");
IDString = value.GetValue<string>("id_str");
InReplyToUserID = value.GetValue<ulong>("in_reply_to_user_id");
Favorited = value.GetValue<bool>("favorited");
InReplyToStatusIDString = value.GetValue<string>("in_reply_to_status_id_str");
InReplyToStatusID = value.GetValue<ulong>("in_reply_to_status_id");
Source = value.GetValue<string>("source");
CreatedAt = value.GetValue<string>("created_at").GetDate(DateTime.MaxValue);
InReplyToUserIDString = value.GetValue<string>("in_reply_to_user_id_str");
Truncated = value.GetValue<bool>("truncated");
Geo = new Geo(value.GetValue<JsonData>("geo"));
Text = value.GetValue<string>("text");
}
示例15: Distance
public Double Distance(Coordinate other)
{
Double x2 = Math.Pow(m_x - other.X, 2.0);
Double y2 = Math.Pow(m_y - other.Y, 2.0);
Double distance = Math.Sqrt(x2 + y2);
return distance;
}