本文整理汇总了C#中ICoordinate.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# ICoordinate.Clone方法的具体用法?C# ICoordinate.Clone怎么用?C# ICoordinate.Clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICoordinate
的用法示例。
在下文中一共展示了ICoordinate.Clone方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetClickOnExistingSelection
private void SetClickOnExistingSelection(bool set, ICoordinate worldPosition)
{
clickOnExistingSelection = set;
if (clickOnExistingSelection)
{
orgMouseDownLocation = (ICoordinate)worldPosition.Clone();
}
else
{
orgMouseDownLocation = null;
}
}
示例2: CreateSelectionPolygon
private IPolygon CreateSelectionPolygon(ICoordinate worldPosition)
{
if (MultiSelectionMode == MultiSelectionMode.Rectangle)
{
if (0 == Math.Abs(mouseDownLocation.X - worldPosition.X))
{
return null;
}
if (0 == Math.Abs(mouseDownLocation.Y - worldPosition.Y))
{
return null;
}
return CreatePolygon(Math.Min(mouseDownLocation.X, worldPosition.X),
Math.Max(mouseDownLocation.Y, worldPosition.Y),
Math.Max(mouseDownLocation.X, worldPosition.X),
Math.Min(mouseDownLocation.Y, worldPosition.Y));
}
var vertices = new List<ICoordinate>();
foreach (var point in selectPoints)
{
vertices.Add(Map.ImageToWorld(point));
}
if (vertices.Count == 1)
{
// too few points to create a polygon
return null;
}
vertices.Add((ICoordinate)worldPosition.Clone());
vertices.Add((ICoordinate)vertices[0].Clone());
ILinearRing newLinearRing = GeometryFactory.CreateLinearRing(vertices.ToArray());
return GeometryFactory.CreatePolygon(newLinearRing, null);
}
示例3: getAngle
private double getAngle(ICoordinate p1, ICoordinate p2, ICoordinate p3, bool counterClockwise)
{
p1 = (ICoordinate)p1.Clone();
p2 = (ICoordinate)p2.Clone();
p3 = (ICoordinate)p3.Clone();
// translating the origin
p1.X -= p2.X; p1.Y -= p2.Y;
p3.X -= p2.X; p3.Y -= p2.Y;
double alpha = p1.X != 0 ? Math.Atan(Math.Abs(p1.Y / p1.X)) : 0.5 * Math.PI;
double betta = p3.X != 0 ? Math.Atan(Math.Abs(p3.Y / p3.X)) : 0.5 * Math.PI;
alpha = translateAngleQuadrant(alpha, pointQuadrantNumber(p1));
betta = translateAngleQuadrant(betta, pointQuadrantNumber(p3));
if (counterClockwise)
return alpha < betta ? (betta - alpha) : (2 * Math.PI - alpha + betta);
else
return alpha > betta ? (alpha - betta) : (2 * Math.PI - betta + alpha);
}
示例4: TopologyValidationError
/// <summary>
///
/// </summary>
/// <param name="errorType"></param>
/// <param name="pt"></param>
public TopologyValidationError(TopologyValidationErrors errorType, ICoordinate pt)
{
this.errorType = errorType;
if(pt != null)
this.pt = (ICoordinate) pt.Clone();
}
示例5: Transform
public ICoordinate Transform(ICoordinate coordinate)
{
var xy = new[] {coordinate.X, coordinate.Y};
var z = new[] {coordinate.Z};
Reproject.ReprojectPoints(xy, z, Source, Target, 0, 1);
var ret = (ICoordinate)coordinate.Clone();
ret.X = xy[0];
ret.Y = xy[1];
ret.Z = z[0];
return ret;
}
示例6: AppendCurvePoint
private static ILineString AppendCurvePoint(ILineString lineString, ICoordinate worldPos)
{
List<ICoordinate> vertices = new List<ICoordinate>();
for (int i = 0; i < lineString.Coordinates.Length; i++)
{
if (1 == i)
{
// remove duplicate start points, see MouseDown
if ((lineString.Coordinates[0].X != lineString.Coordinates[1].X) &&
(lineString.Coordinates[0].Y != lineString.Coordinates[1].Y))
vertices.Add(lineString.Coordinates[i]);
}
else
{
vertices.Add(lineString.Coordinates[i]);
}
}
vertices.Add((ICoordinate)worldPos.Clone());
return GeometryFactory.CreateLineString(vertices.ToArray());
}
示例7: PlanarGraphNode
/// <summary>
/// Initializes a new instance of MapAround.Geometry.PlanarGraphNode.
/// </summary>
/// <param name="coordinate">Coordinate of a node</param>
public PlanarGraphNode(ICoordinate coordinate)
{
_coordinate = (ICoordinate)coordinate.Clone();
}
示例8: insertNodeAt
private void insertNodeAt(int patchIndex, int coordinateIndex, ICoordinate coordinate)
{
EditAction forwardAction;
EditAction backwardAction;
EditActionParameters parameters = new EditActionParameters()
{
OldGeometry = _geometry,
PatchIndex = patchIndex,
NodeIndex = coordinateIndex,
NodePosition = (ICoordinate)coordinate.Clone()
};
forwardAction = new EditAction(EditActionType.InsertNode, parameters, out backwardAction);
HistoryEntry pair = new HistoryEntry(forwardAction, backwardAction);
_geometry = _history.DoAction(pair, _geometry);
}
示例9: UpdateActiveNodePosition
/// <summary>
/// Updates the position of the active node with the specified value
/// </summary>
/// <param name="coordinate">New position of the active node</param>
/// <param name="commitIntoUndoList">A value indicating whether current update should be commited into undo list</param>
/// <returns>true if the position has been updated, false otherwise</returns>
public bool UpdateActiveNodePosition(ICoordinate coordinate, bool commitIntoUndoList)
{
if (ActivePatchIndex == -1)
return false;
if (commitIntoUndoList)
{
EditAction forwardAction;
EditAction backwardAction;
EditActionParameters parameters = new EditActionParameters()
{
OldGeometry = _geometry,
PatchIndex = _activePatchIndex,
NodeIndex = _activeCoordinateIndex,
NodePosition = (ICoordinate)coordinate.Clone()
};
// update active node with the old value
// this is necessary for properly generation of the inverse action
UpdateActiveNodePosition(oldActiveNodeCoordinate, false);
forwardAction = new EditAction(EditActionType.SetNodePosition, parameters, out backwardAction);
HistoryEntry pair = new HistoryEntry(forwardAction, backwardAction);
_geometry = _history.DoAction(pair, _geometry);
oldActiveNodeCoordinate = (ICoordinate)coordinate.Clone();
}
else
{
if (_snapper != null && _snapper.SnapMethod != null)
coordinate = _snapper.SnapMethod(coordinate);
if (_geometry is Polyline)
{
Polyline polyline = (Polyline)_geometry;
polyline.Paths[_activePatchIndex].Vertices[_activeCoordinateIndex].X = coordinate.X;
polyline.Paths[_activePatchIndex].Vertices[_activeCoordinateIndex].Y = coordinate.Y;
}
if (_geometry is Polygon)
{
Polygon polygon = (Polygon)_geometry;
polygon.Contours[_activePatchIndex].Vertices[_activeCoordinateIndex].X = coordinate.X;
polygon.Contours[_activePatchIndex].Vertices[_activeCoordinateIndex].Y = coordinate.Y;
}
}
return true;
}