本文整理汇总了C#中IPosition类的典型用法代码示例。如果您正苦于以下问题:C# IPosition类的具体用法?C# IPosition怎么用?C# IPosition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPosition类属于命名空间,在下文中一共展示了IPosition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompareTo
public int CompareTo(IPosition other)
{
NaryPosition otherNary = other as NaryPosition;
if (otherNary != null)
return CompareTo(otherNary);
return 0;
}
示例2: CheckIfFigureOnTheWay
/// <summary>
/// Checks if the figure is on the way that the figures want to move
/// </summary>
/// <param name="position">Position on which the figure moves</param>
/// <param name="board">The game board</param>
/// <exception cref="InvalidPositionException"></exception>
public static void CheckIfFigureOnTheWay(IPosition position, IBoard board)
{
if (board.GetFigureAtPosition(position) != null)
{
throw new InvalidPositionException(GlobalErrorMessages.FigureOnTheWayErrorMessage);
}
}
示例3: WithinRadiusOf
public static SpatialCriteria WithinRadiusOf(this SpatialCriteriaFactory @this,
double radius,
IPosition position)
{
var coordinate = position.GetCoordinate();
return @this.WithinRadiusOf(radius, coordinate.Longitude, coordinate.Latitude);
}
示例4: MouseUp
public override void MouseUp(IPosition p, MouseButtons b)
{
if (b == MouseButtons.Left)
{
RectFinish();
}
}
示例5: RobotReportedPosition
private void RobotReportedPosition(int robotId, IPosition position, IHeading heading)
{
if (ReportedPosition != null)
{
ReportedPosition(robotId, position, heading);
}
}
示例6: Create
/// <summary>
/// Creates a new <c>PositionGeometry</c> from the supplied position (or casts
/// the supplied position if it's already an instance of <c>PositionGeometry</c>).
/// </summary>
/// <param name="p">The position the geometry should correspond to</param>
/// <returns>A newly created <c>PositionGeometry</c> instance, or the supplied
/// position if it's already an instance of <c>PositionGeometry</c></returns>
public static PositionGeometry Create(IPosition p)
{
if (p is PositionGeometry)
return (p as PositionGeometry);
else
return new PositionGeometry(p.X, p.Y);
}
示例7: AddFigure
/// <summary>
/// Add the specific figure at the specific position on the board
/// </summary>
/// <param name="figure">Figure to be added</param>
/// <param name="position">The position on which the figure should be added</param>
public void AddFigure(IFigure figure, IPosition position)
{
Validator.CheckIfObjectIsNull(figure);
Validator.CheckIfPositionValid(position);
this.board[position.Row, position.Col] = figure;
this.figurePositionsOnBoard[figure.DisplaySign] = position;
}
示例8: FindOverlapsQuery
/// <summary>
/// Creates a new <c>FindOverlapsQuery</c> (and executes it). The result of the query
/// can then be obtained through the <c>Result</c> property.
/// </summary>
/// <param name="index">The spatial index to search</param>
/// <param name="closedShape">The closed shape defining the search area.</param>
/// <param name="spatialType">The type of objects to look for.</param>
internal FindOverlapsQuery(ISpatialIndex index, IPosition[] closedShape, SpatialType spatialType)
{
m_ClosedShape = new ClosedShape(closedShape);
m_Points = new List<PointFeature>(100);
m_Result = new List<ISpatialObject>(100);
// If we are looking for points or lines, locate points that overlap. Note that
// if the user does not actually want points in the result, we still do a point
// search, since it helps with the selection of lines.
if ((spatialType & SpatialType.Point)!=0 || (spatialType & SpatialType.Line)!=0)
{
index.QueryWindow(m_ClosedShape.Extent, SpatialType.Point, OnPointFound);
// Remember the points in the result if the caller wants them
if ((spatialType & SpatialType.Point)!=0)
m_Result.AddRange(m_Points.ToArray());
}
// Find lines (this automatically includes lines connected to the points we just found)
if ((spatialType & SpatialType.Line)!=0)
index.QueryWindow(m_ClosedShape.Extent, SpatialType.Line, OnLineFound);
// Find any overlapping text
if ((spatialType & SpatialType.Text)!=0)
index.QueryWindow(m_ClosedShape.Extent, SpatialType.Text, OnTextFound);
m_Result.TrimExcess();
m_Points = null;
}
示例9: CircularArcGeometry
public CircularArcGeometry(ICircleGeometry circle, IPosition bc, IPosition ec, bool isClockwise)
{
m_Circle = circle;
m_BC = PositionGeometry.Create(bc);
m_EC = PositionGeometry.Create(ec);
m_IsClockwise = isClockwise;
}
示例10: StandardPlayFieldGenerator
/// <summary>
/// Constructor with 3 parameters
/// </summary>
/// <param name="playerPosition">Parameter of type IPosition</param>
/// <param name="rows">Parameter of type int</param>
/// <param name="cols">Parameter of type int</param>
public StandardPlayFieldGenerator(IPosition playerPosition, int rows = Constants.StandardGameLabyrinthRows, int cols = Constants.StandardGameLabyrinthCols)
{
this.playField = new ICell[rows, cols];
this.playerPosition = playerPosition;
this.rows = rows;
this.cols = cols;
}
示例11: AddFigure
public void AddFigure(IFigure figure, IPosition position)
{
Validator.CheckIfObjectIsNull(figure, GlobalErrorMessages.NullFigureErrorMessage);
Validator.CheckIfPositionValid(position, GlobalErrorMessages.PositionNotValidMessage);
this.board[position.Row, position.Col] = figure;
this.figurePositionsOnBoard[figure.DisplayName] = position;
}
示例12: Parse
public static MediaQuery Parse(string value, IPosition forPosition)
{
if (value.Contains(','))
{
var parts = value.Split(',');
var ret = new List<MediaQuery>();
foreach (var part in parts)
{
ret.Add(Parse(part.Trim(), forPosition));
}
if (ret.Count == 1) return ret[0];
return new CommaDelimitedMedia(ret, forPosition);
}
if (value.StartsWith("only ", StringComparison.InvariantCultureIgnoreCase))
{
return new OnlyMedia(ParseQuery(value.Substring("only ".Length).Trim(), forPosition), forPosition);
}
if (value.StartsWith("not ", StringComparison.InvariantCultureIgnoreCase))
{
return new NotMedia(ParseQuery(value.Substring("not ".Length).Trim(), forPosition), forPosition);
}
return ParseQuery(value, forPosition);
}
示例13: CheckIfFigureOnTheWay
public static void CheckIfFigureOnTheWay(IPosition position, IBoard board, string message)
{
if (board.GetFigureAtPosition(position) != null)
{
throw new ArgumentException(message);
}
}
示例14: CalculateDistance
public static double CalculateDistance(IPosition position1, IPosition position2)
{
var xPortion = (position2.XCoord - position1.XCoord) * (position2.XCoord - position1.XCoord);
var yPortion = (position2.YCoord - position1.YCoord) * (position2.YCoord - position1.YCoord);
return Math.Sqrt(xPortion + yPortion);
}
示例15: Goto
public void Goto(IPosition position, bool KeepRunning)
{
var distance = DistanceTo(position);
if (DistanceTo(position) > DistanceTolerance)
{
DateTime duration = DateTime.Now.AddSeconds(5);
var player = api.Entity.GetLocalPlayer();
api.ThirdParty.KeyDown(Keys.NUMPAD8);
while (DistanceTo(position) > DistanceTolerance && DateTime.Now < duration)
{
if ((ViewMode)api.Player.ViewMode != ViewMode.FirstPerson)
{
api.Player.ViewMode = (int)ViewMode.FirstPerson;
}
FaceHeading(position);
System.Threading.Thread.Sleep(30);
}
api.ThirdParty.KeyUp(Keys.NUMPAD8);
}
}