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


C# ICoordinateSequence.SetOrdinate方法代码示例

本文整理汇总了C#中ICoordinateSequence.SetOrdinate方法的典型用法代码示例。如果您正苦于以下问题:C# ICoordinateSequence.SetOrdinate方法的具体用法?C# ICoordinateSequence.SetOrdinate怎么用?C# ICoordinateSequence.SetOrdinate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICoordinateSequence的用法示例。


在下文中一共展示了ICoordinateSequence.SetOrdinate方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CopyToSequence

 private static ICoordinateSequence CopyToSequence(Coordinate[] coords, ICoordinateSequence sequence)
 {
     for (int i = 0; i < coords.Length; i++)
     {
         sequence.SetOrdinate(i, Ordinate.X, coords[i].X);
         sequence.SetOrdinate(i, Ordinate.Y, coords[i].Y);                
     }
     return sequence;
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:9,代码来源:Issue4Fixture.cs

示例2: Swap

        /// <summary>
        /// Swaps two coordinates in a sequence.
        /// </summary>
        /// <param name="seq"></param>
        /// <param name="i"></param>
        /// <param name="j"></param>
        public static void Swap(ICoordinateSequence seq, int i, int j)
        {
            if (i == j)
                return;

            for (int dim = 0; dim < seq.Dimension; dim++)
            {
                double tmp = seq.GetOrdinate(i, (Ordinates)dim);
                seq.SetOrdinate(i, (Ordinates)dim, seq.GetOrdinate(j, (Ordinates)dim));
                seq.SetOrdinate(j, (Ordinates)dim, tmp);
            }
        }
开发者ID:izambakci,项目名称:tf-net,代码行数:18,代码来源:CoordinateSequences.cs

示例3: CopyCoord

 ///<summary>
 /// Copies a coordinate of a <see cref="ICoordinateSequence"/> to another <see cref="ICoordinateSequence"/>.
 /// The sequences may have different dimensions;
 /// in this case only the common dimensions are copied.
 ///</summary>
 /// <param name="src">The sequence to copy coordinate from</param>
 /// <param name="srcPos">The index of the coordinate to copy</param>
 /// <param name="dest">The sequence to which the coordinate should be copied to</param>
 /// <param name="destPos">The index of the coordinate in <see paramref="dest"/></param>
 public static void CopyCoord(ICoordinateSequence src, int srcPos, ICoordinateSequence dest, int destPos)
 {
     int minDim = Math.Min(src.Dimension, dest.Dimension);
     for (int dim = 0; dim < minDim; dim++)
     {
         Ordinate ordinate = (Ordinate)dim;
         double value = src.GetOrdinate(srcPos, ordinate);
         dest.SetOrdinate(destPos, ordinate, value);
     }
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:19,代码来源:CoordinateSequences.cs

示例4: EnsureClosedSequence

        /// <summary>
        /// Function to return a coordinate sequence that is ensured to be closed.
        /// </summary>
        /// <param name="sequence">The base sequence</param>
        /// <param name="factory">The factory to use in case we need to create a new sequence</param>
        /// <returns>A closed coordinate sequence</returns>
        private static ICoordinateSequence EnsureClosedSequence(ICoordinateSequence sequence,
                                                                ICoordinateSequenceFactory factory)
        {
            //This sequence won't serve a valid linear ring
            if (sequence.Count < 3)
                return null;

            //The sequence is closed
            var start = sequence.GetCoordinate(0);
            var lastIndex = sequence.Count - 1;
            var end = sequence.GetCoordinate(lastIndex);
            if (start.Equals2D(end))
                return sequence;

            // The sequence is not closed
            // 1. Test for a little offset, in that case simply correct x- and y- ordinate values
            const double eps = 1E-7;
            if (start.Distance(end) < eps)
            {
                sequence.SetOrdinate(lastIndex, Ordinate.X, start.X);
                sequence.SetOrdinate(lastIndex, Ordinate.Y, start.Y);
                return sequence;
            }

            // 2. Close the sequence by adding a new point, this is heavier
            var newSequence = factory.Create(sequence.Count + 1, sequence.Ordinates);
            var ordinates = OrdinatesUtility.ToOrdinateArray(sequence.Ordinates);
            for (var i = 0; i < sequence.Count; i++)
            {
                foreach (var ordinate in ordinates)
                    newSequence.SetOrdinate(i, ordinate, sequence.GetOrdinate(i, ordinate));
            }
            foreach (var ordinate in ordinates)
                newSequence.SetOrdinate(sequence.Count, ordinate, sequence.GetOrdinate(0, ordinate));
            return newSequence;
        }
开发者ID:jaundice,项目名称:NetTopologySuite,代码行数:42,代码来源:PolygonHandler.cs

示例5: Filter

 public void Filter(ICoordinateSequence seq, int i)
 {
     seq.SetOrdinate(i, Ordinate.X, seq.GetX(i) + _xShift);
 }
开发者ID:h0st1le,项目名称:Spatial4n,代码行数:4,代码来源:NtsGeometry.cs

示例6: Transform

 public ICoordinateSequence Transform(ICoordinateSequence coordinateSequence)
 {
     var clone = new Coordinate();
     for (var i = 0; i < coordinateSequence.Count; i++)
     {
         clone.CoordinateValue = coordinateSequence.GetCoordinate(i);
         clone = Transform(clone);
         coordinateSequence.SetOrdinate(i, Ordinate.X, clone.X);
         coordinateSequence.SetOrdinate(i, Ordinate.Y, clone.Y);
         if (DimTarget > 2)
             coordinateSequence.SetOrdinate(i, Ordinate.Z, clone.Z);
     }
     return coordinateSequence;
 }
开发者ID:fivepmtechnology,项目名称:ProjNET,代码行数:14,代码来源:MathTransform.cs

示例7: Filter

 /// <summary>
 ///
 /// </summary>
 /// <param name="seq">The coordinate sequence</param>
 public void Filter(ICoordinateSequence seq, int i)
 {
     var xp = seq.GetOrdinate(i, Ordinate.X) + _trans.X;
     var yp = seq.GetOrdinate(i, Ordinate.Y) + _trans.Y;
     seq.SetOrdinate(i, Ordinate.X, xp);
     seq.SetOrdinate(i, Ordinate.Y, yp);
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:11,代码来源:CommonBitsRemover.cs

示例8: Filter

 ///<summary>
 /// Rounds the Coordinates in the sequence to match the PrecisionModel
 ///</summary>
 public void Filter(ICoordinateSequence seq, int i)
 {
     seq.SetOrdinate(i, Ordinate.X, _precModel.MakePrecise(seq.GetOrdinate(i, Ordinate.X)));
     seq.SetOrdinate(i, Ordinate.Y, _precModel.MakePrecise(seq.GetOrdinate(i, Ordinate.Y)));
 }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:8,代码来源:CoordinatePrecisionReducerFilter.cs

示例9: Filter

            public void Filter(ICoordinateSequence seq, int i)
            {
                double x = seq.GetX(i);
                double y = seq.GetY(i);

                if (_ctx.IsGeo() && _normalizeGeomCoords)
                {
                    double xNorm = DistanceUtils.NormLonDEG(x);
                    if (x != xNorm)
                    {
                        changed = true;
                        seq.SetOrdinate(i, Ordinate.X, xNorm);
                    }

                    double yNorm = DistanceUtils.NormLatDEG(y);
                    if (y != yNorm)
                    {
                        changed = true;
                        seq.SetOrdinate(i, Ordinate.Y, yNorm);
                    }
                }
                else
                {
                    _ctx.VerifyX(x);
                    _ctx.VerifyY(y);
                }
            }
开发者ID:e-tobi,项目名称:Spatial4n,代码行数:27,代码来源:NtsShapeReadWriter.cs

示例10: Filter

 public void Filter(ICoordinateSequence seq, int i)
 {
     double x = seq.GetX(i);
     double xNorm = _ctx.NormX(x);
     if (x != xNorm)
     {
         changed = true;
         seq.SetOrdinate(i, Ordinate.X, xNorm);
     }
     double y = seq.GetY(i);
     double yNorm = _ctx.NormY(y);
     if (y != yNorm)
     {
         changed = true;
         seq.SetOrdinate(i, Ordinate.Y, yNorm);
     }
 }
开发者ID:ccurrens,项目名称:Spatial4n,代码行数:17,代码来源:NtsShapeReadWriter.cs


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