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);
                }
            }
Example #2
0
        /// <summary>
        /// Reads a <see cref="GeoAPI.Geometries.Coordinate"/> from the current position.
        /// It's akin to <see cref="WktShapeParser.State"/> but for
        /// a NTS Coordinate.  Only the first 2 numbers are parsed; any remaining are ignored.
        /// </summary>
        /// <param name="state"></param>
        /// <returns></returns>
        protected virtual Coordinate Coordinate(WktShapeParser.State state)
        {
            double x = m_ctx.NormX(state.NextDouble());

            m_ctx.VerifyX(x);
            double y = m_ctx.NormY(state.NextDouble());

            m_ctx.VerifyY(y);
            state.SkipNextDoubles();
            return(new Coordinate(x, y));
        }