当前位置: 首页>>代码示例>>C#>>正文


C# ICoordinate.Clone方法代码示例

本文整理汇总了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;
     }
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:12,代码来源:SelectTool.cs

示例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);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:33,代码来源:SelectTool.cs

示例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);
        }
开发者ID:gkrsu,项目名称:maparound.core,代码行数:21,代码来源:FeatureRendering.cs

示例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();
 }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:11,代码来源:TopologyValidationError.cs

示例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;
        }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:14,代码来源:DotSpatialMathTransform.cs

示例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());
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:21,代码来源:NewLineTool.cs

示例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();
 }
开发者ID:gkrsu,项目名称:maparound.core,代码行数:8,代码来源:Topology.cs

示例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);
        }
开发者ID:gkrsu,项目名称:maparound.core,代码行数:16,代码来源:GeometryEditor.cs

示例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;
        }
开发者ID:gkrsu,项目名称:maparound.core,代码行数:57,代码来源:GeometryEditor.cs


注:本文中的ICoordinate.Clone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。