Ejemplo n.º 1
0
        public static IPolygon GetVisilityPolygon(IPointCollection points)
        {
            IGeometryBridge2  geometryBridge2  = new GeometryEnvironmentClass();
            IPointCollection4 pointCollection4 = new PolygonClass();

            WKSPointZ[] aWKSPoints = new WKSPointZ[points.PointCount];

            for (int i = 0; i < aWKSPoints.Length; i++)
            {
                aWKSPoints[i] = PointToWKSPoint(points.Point[i]);
            }

            geometryBridge2.SetWKSPointZs(pointCollection4, ref aWKSPoints);

            var     geometry = pointCollection4 as IGeometry;
            IZAware zAware   = geometry as IZAware;

            zAware.ZAware = true;

            var result = pointCollection4 as IPolygon;

            result.SpatialReference = points.Point[0].SpatialReference;

            return(result);
        }
Ejemplo n.º 2
0
        public static void AddPaths([NotNull] IList <Linestring> linestringsToAdd,
                                    [NotNull] IPolyline toResult)
        {
            Func <Pnt3D, WKSPointZ> createPoint;

            if (GeometryUtils.IsZAware(toResult))
            {
                createPoint = p => WKSPointZUtils.CreatePoint(p.X, p.Y, p.Z);
            }
            else
            {
                createPoint = p => WKSPointZUtils.CreatePoint(p.X, p.Y, double.NaN);
            }

            IPath pathTemplate = GeometryFactory.CreateEmptyPath(toResult);

            foreach (Linestring resultLinestring in linestringsToAdd)
            {
                var pathPoints = new WKSPointZ[resultLinestring.SegmentCount + 1];

                var i = 0;
                foreach (Line3D line3D in resultLinestring)
                {
                    pathPoints[i++] = createPoint(line3D.StartPoint);
                }

                Pnt3D last = resultLinestring[resultLinestring.SegmentCount - 1].EndPoint;
                pathPoints[i] = createPoint(last);

                IPath path = GeometryFactory.Clone(pathTemplate);
                GeometryUtils.AddWKSPointZs((IPointCollection4)path, pathPoints);
                ((IGeometryCollection)toResult).AddGeometry(path);
            }
        }
Ejemplo n.º 3
0
        private static double GetArea([NotNull] IEnumerable <WKSPointZ> points)
        {
            double area  = 0;
            var    last  = new WKSPointZ();
            var    first = true;
            double y0    = 0;

            // y-offset of the co-ordinate system, so that ym does not get to large (will be Y of first point)
            foreach (WKSPointZ point in points)
            {
                if (first)
                {
                    y0    = point.Y;
                    first = false;
                }
                else
                {
                    double dx = point.X - last.X;
                    double ym = (point.Y + last.Y) / 2 - y0;

                    area += dx * ym;
                }

                last = point;
            }

            return(area);
        }
Ejemplo n.º 4
0
 private bool Disjoint3D(WKSPointZ wksPoint, IPoint point)
 {
     return(!GeometryUtils.IsSamePoint(
                wksPoint.X, wksPoint.Y, wksPoint.Z,
                point.X, point.Y, point.Z,
                _xyTolerance, _zTolerance));
 }
Ejemplo n.º 5
0
        public void CanCalculateSmallTris()
        {
            var p0 = new WKSPointZ {
                X = 679845.1814, Y = 253110.2683, Z = 447.21000000000004
            };
            var p1 = new WKSPointZ {
                X = 679845.468, Y = 253110.3961, Z = 447.21000000000004
            };
            var p2 = new WKSPointZ {
                X = 679845.4679, Y = 253110.3961, Z = 447.21000000000004
            };

            var q2 = new WKSPointZ {
                X = 679845.46795, Y = 253110.3961, Z = 447.21000000000004
            };

            foreach (double f in new[] { 0.001, 0.03, 0.5, 1, 7, 15, 76, 1000 })
            {
                ValidateTri(Scale(new List <WKSPointZ> {
                    p0, p1, p2, p0
                }, f), true);
                ValidateTri(Scale(new List <WKSPointZ> {
                    p0, p1, q2, p0
                }, f), false);
            }
        }
Ejemplo n.º 6
0
        private static void ValidateForm([NotNull] IIndexedMultiPatch indexedMultiPatch,
                                         [NotNull] IEnumerable <WKSPointZ> projected)
        {
            var  pre      = new WKSPointZ();
            bool notFirst = false;
            IEnumerator <SegmentProxy> segments =
                indexedMultiPatch.GetSegments().GetEnumerator();

            foreach (WKSPointZ wksPoint in projected)
            {
                Assert.AreEqual(0, wksPoint.Z);

                if (notFirst)
                {
                    double dx     = wksPoint.X - pre.X;
                    double dy     = wksPoint.Y - pre.Y;
                    double length = Math.Sqrt(dx * dx + dy * dy);

                    Assert.IsTrue(segments.MoveNext());
                    Assert.IsNotNull(segments.Current);

                    const bool as3D          = true;
                    IPnt       start         = segments.Current.GetStart(as3D);
                    IPnt       end           = segments.Current.GetEnd(as3D);
                    double     segDx         = end.X - start.X;
                    double     segDy         = end.Y - start.Y;
                    double     segDz         = end[2] - start[2];
                    double     segmentLength = Math.Sqrt(segDx * segDx + segDy * segDy + segDz * segDz);
                    Assert.IsTrue(Math.Abs(segmentLength - length) < 1.0e-8);
                }

                pre      = wksPoint;
                notFirst = true;
            }
        }
Ejemplo n.º 7
0
        public static double GetXyDistanceSquared(WKSPointZ a, WKSPointZ b)
        {
            double dx = a.X - b.X;
            double dy = a.Y - b.Y;

            return(dx * dx + dy * dy);
        }
Ejemplo n.º 8
0
        protected override int ExecuteCore(IRow row, int tableIndex)
        {
            var feature = row as IFeature;

            if (feature == null)
            {
                return(NoError);
            }

            var multiPatch = feature.Shape as IMultiPatch;

            if (multiPatch == null)
            {
                return(NoError);
            }

            var errorCount = 0;

            VerticalFaceProvider verticalFaceProvider = GetPlaneProvider(feature);

            VerticalFace verticalFace;

            while ((verticalFace = verticalFaceProvider.ReadFace()) != null)
            {
                Plane plane = verticalFace.Plane;

                WKSPointZ normal          = plane.GetNormalVector();
                double    verticalCosinus = Math.Abs(normal.Z);

                if (verticalCosinus > _nearCosinus)
                {
                    continue;
                }

                if (verticalCosinus <= _toleranceSinus)
                {
                    continue;
                }

                double height         = verticalFace.Height;
                double toleranceSinus = _xyTolerance / height;

                if (verticalCosinus <= toleranceSinus)
                {
                    continue;
                }

                double nonVerticalAngle = Math.Asin(verticalCosinus);

                string    description   = GetIssueDescription(nonVerticalAngle);
                IGeometry errorGeometry = verticalFaceProvider.GetErrorGeometry();

                errorCount += ReportError(description, errorGeometry,
                                          Codes[Code.NotSufficientlyVertical],
                                          TestUtils.GetShapeFieldName(row),
                                          row);
            }

            return(errorCount);
        }
Ejemplo n.º 9
0
        public void CanReadWriteMultipointXy()
        {
            var points = new WKSPointZ[4];

            points[0] = new WKSPointZ {
                X = 2600000, Y = 1200000, Z = double.NaN
            };
            points[1] = new WKSPointZ {
                X = 2600030, Y = 1200020, Z = double.NaN
            };
            points[2] = new WKSPointZ {
                X = 2600020, Y = 1200030, Z = double.NaN
            };
            points[3] = new WKSPointZ {
                X = 2600040, Y = 1200040, Z = double.NaN
            };

            ISpatialReference sr =
                SpatialReferenceUtils.CreateSpatialReference(WellKnownHorizontalCS.LV95);

            IMultipoint multipoint = GeometryFactory.CreateMultipoint(points, sr);

            GeometryUtils.MakeNonZAware(multipoint);

            WkbGeometryWriter writer = new WkbGeometryWriter();

            byte[] wkb = writer.WriteMultipoint(multipoint);

            // ArcObjects
            byte[] arcObjectsWkb = GeometryUtils.ToWkb(multipoint);
            Assert.AreEqual(wkb, arcObjectsWkb);

            // Wkx
            byte[] wkx = ToChristianSchwarzWkb(ToWkxMultipoint(points, Ordinates.Xy));
            Assert.AreEqual(wkx, wkb);

            // Bonus test: Geom
            WkbGeomWriter     geomWriter = new WkbGeomWriter();
            Multipoint <IPnt> multipnt   = GeometryConversionUtils.CreateMultipoint(multipoint);

            byte[] wkbGeom = geomWriter.WriteMultipoint(multipnt, Ordinates.Xy);
            Assert.AreEqual(wkb, wkbGeom);

            WkbGeometryReader reader = new WkbGeometryReader();

            IMultipoint restored = reader.ReadMultipoint(new MemoryStream(wkb));

            Assert.IsTrue(GeometryUtils.AreEqual(multipoint, restored));

            // Geom
            WkbGeomReader geomReader = new WkbGeomReader();

            Multipoint <IPnt> deserializedPnts =
                geomReader.ReadMultiPoint(new MemoryStream(wkbGeom));

            Assert.IsTrue(
                GeomRelationUtils.AreMultipointsEqualXY(multipnt, deserializedPnts,
                                                        double.Epsilon));
        }
Ejemplo n.º 10
0
        public override double GetDirectionAt(double fraction)
        {
            WKSPointZ from = FromPoint;
            WKSPointZ to   = ToPoint;
            double    dir  = Math.Atan2(to.Y - from.Y, to.X - from.X);

            return(dir);
        }
Ejemplo n.º 11
0
        private static WKSPointZ[] GetPointArray([NotNull] IPointCollection4 points)
        {
            var pointArray = new WKSPointZ[points.PointCount];

            GeometryUtils.QueryWKSPointZs(points, pointArray);

            return(pointArray);
        }
Ejemplo n.º 12
0
        private static Pnt GetPoint(WKSPointZ wks, bool as3D)
        {
            Pnt p = !as3D
                                        ? (Pnt) new Pnt2D(wks.X, wks.Y)
                                        : new Pnt3D(wks.X, wks.Y, wks.Z);

            return(p);
        }
            private bool IsConnected(WKSPointZ x, WKSPointZ y)
            {
                double dx             = x.X - y.X;
                double dy             = x.Y - y.Y;
                double dz             = x.Z - y.Z;
                double distanceSquare = dx * dx + dy * dy + dz * dz;

                return(distanceSquare <= _connectedTolerance * _connectedTolerance);
            }
Ejemplo n.º 14
0
 private static WKSPointZ Factor(WKSPointZ p0, WKSPointZ p1, double factor)
 {
     return(new WKSPointZ
     {
         X = p0.X + factor * (p1.X - p0.X),
         Y = p0.Y + factor * (p1.Y - p0.Y),
         Z = p0.Z + factor * (p1.Z - p0.Z)
     });
 }
Ejemplo n.º 15
0
        private static WKSPointZ[] CreateSquare(
            double lowerLeftX, double lowerLeftY, double sideLength,
            int pointsPerSide, bool clockWise, double z)
        {
            pointsPerSide = Math.Max(1, pointsPerSide);
            var points = new WKSPointZ[4 * pointsPerSide];

            double dist = sideLength / pointsPerSide;

            for (var i = 0; i < pointsPerSide; i++)
            {
                //if (clockWise)
                //{
                points[i].X = lowerLeftX;
                points[i].Y = lowerLeftY + i * dist;
                points[i].Z = z;

                points[i + pointsPerSide].X = lowerLeftX + i * dist;
                points[i + pointsPerSide].Y = lowerLeftY + sideLength;
                points[i + pointsPerSide].Z = z;

                points[i + 2 * pointsPerSide].X = lowerLeftX + sideLength;
                points[i + 2 * pointsPerSide].Y = lowerLeftY + sideLength - i * dist;
                points[i + 2 * pointsPerSide].Z = z;

                points[i + 3 * pointsPerSide].X = lowerLeftX + sideLength - i * dist;
                points[i + 3 * pointsPerSide].Y = lowerLeftY;
                points[i + 3 * pointsPerSide].Z = z;
                //}
                //else
                //{
                //    points[i].X = lowerLeftX + i * dist;
                //    points[i].Y = lowerLeftY;
                //    points[i].Z = z;

                //    points[i + pointsPerSide].X = lowerLeftX + sideLength;
                //    points[i + pointsPerSide].Y = lowerLeftY + i * dist;
                //    points[i + pointsPerSide].Z = z;

                //    points[i + 2 * pointsPerSide].X = lowerLeftX + sideLength - i * dist;
                //    points[i + 2 * pointsPerSide].Y = lowerLeftY + sideLength;
                //    points[i + 2 * pointsPerSide].Z = z;

                //    points[i + 3 * pointsPerSide].X = lowerLeftX;
                //    points[i + 3 * pointsPerSide].Y = lowerLeftY + sideLength - i * dist;
                //    points[i + 3 * pointsPerSide].Z = z;
                //}
            }

            if (!clockWise)
            {
                Array.Reverse(points);
            }

            return(points);
        }
Ejemplo n.º 16
0
        public IPnt GetPoint(int pointIndex, bool clone = false)
        {
            int actualIndex = _reverseOrder
                                                  ? _actualStartIndex - pointIndex
                                                  : _actualStartIndex + pointIndex;

            WKSPointZ wksPoint = _wksPoints[actualIndex];

            return(new Pnt3D(wksPoint.X, wksPoint.Y, wksPoint.Z));
        }
Ejemplo n.º 17
0
        private bool Disjoint3D(WKSPointZ wksPoint, IGeometry geometry)
        {
            _pointTemplate.PutCoords(wksPoint.X, wksPoint.Y);
            _pointTemplate.Z = wksPoint.Z;

            bool disjoint =
                ((IRelationalOperator3D)geometry).Disjoint3D(_pointTemplate);

            return(disjoint);
        }
Ejemplo n.º 18
0
        public static Pnt CreatePoint3D(WKSPointZ wksPoint)
        {
            Pnt result = Pnt.Create(3);

            result.X  = wksPoint.X;
            result.Y  = wksPoint.Y;
            result[2] = wksPoint.Z;

            return(result);
        }
Ejemplo n.º 19
0
        public void CanReadWriteSinglePartPolylineXy()
        {
            var points = new WKSPointZ[4];

            points[0] = new WKSPointZ {
                X = 2600000, Y = 1200000, Z = double.NaN
            };
            points[1] = new WKSPointZ {
                X = 2600030, Y = 1200020, Z = double.NaN
            };
            points[2] = new WKSPointZ {
                X = 2600020, Y = 1200030, Z = double.NaN
            };
            points[3] = new WKSPointZ {
                X = 2600040, Y = 1200040, Z = double.NaN
            };

            IPolyline polyline = GeometryFactory.CreatePolyline(points, null);

            GeometryUtils.MakeNonZAware(polyline);

            GeometryUtils.Simplify(polyline);

            WkbGeometryWriter writer = new WkbGeometryWriter();

            byte[] wkb = writer.WritePolyline(polyline);

            // ArcObjects
            byte[] arcObjectsWkb = GeometryUtils.ToWkb(polyline);
            Assert.AreEqual(wkb, arcObjectsWkb);

            // Wkx
            byte[] wkx = ToChristianSchwarzWkb(ToWkxLineString(points, Ordinates.Xy));
            Assert.AreEqual(wkx, wkb);

            // Bonus test: Geom
            WkbGeomWriter  geomWriter    = new WkbGeomWriter();
            MultiPolycurve multiPlycurve = GeometryConversionUtils.CreateMultiPolycurve(polyline);

            byte[] wkbGeom = geomWriter.WriteMultiLinestring(multiPlycurve, Ordinates.Xy);
            Assert.AreEqual(wkb, wkbGeom);

            WkbGeometryReader reader = new WkbGeometryReader();

            IPolyline restored = reader.ReadPolyline(new MemoryStream(wkb));

            Assert.IsTrue(GeometryUtils.AreEqual(polyline, restored));

            // Geom
            WkbGeomReader geomReader = new WkbGeomReader();

            Assert.IsTrue(
                multiPlycurve.Equals(geomReader.ReadMultiPolycurve(new MemoryStream(wkbGeom))));
        }
Ejemplo n.º 20
0
        public static WKSPointVA CreateWksPointVa(WKSPointZ wksPointZ)
        {
            var wksPoint = new WKSPointVA
            {
                m_x = wksPointZ.X,
                m_y = wksPointZ.Y,
                m_z = wksPointZ.Z
            };

            return(wksPoint);
        }
Ejemplo n.º 21
0
        public static WKSPointZ GetNormed(WKSPointZ v)
        {
            double f = Math.Sqrt(v.X * v.X + v.Y * v.Y + v.Z * v.Z);

            WKSPointZ result;

            result.X = v.X / f;
            result.Y = v.Y / f;
            result.Z = v.Z / f;

            return(result);
        }
Ejemplo n.º 22
0
        public override IPnt GetPointAt(double fraction, bool as3D)
        {
            WKSPointZ from = FromPoint;
            WKSPointZ to   = ToPoint;

            Pnt p0 = GetPoint(from, as3D);
            Pnt p1 = GetPoint(to, as3D);

            IPnt at = p0 + fraction * (p1 - p0);

            return(at);
        }
Ejemplo n.º 23
0
        public void GetCoordinates(int pointIndex, out double x, out double y, out double z)
        {
            int actualIndex = _reverseOrder
                                                  ? _actualStartIndex - pointIndex
                                                  : _actualStartIndex + pointIndex;

            WKSPointZ wksPoint = _wksPoints[actualIndex];

            x = wksPoint.X;
            y = wksPoint.Y;
            z = wksPoint.Z;
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Calculates the cross product of two vectors.
        /// </summary>
        /// <param name="u">The first vector.</param>
        /// <param name="v">The second vector.</param>
        /// <returns></returns>
        public static WKSPointZ GetVectorProduct(WKSPointZ u, WKSPointZ v)
        {
            WKSPointZ result;

            result.X = u.Y * v.Z - u.Z * v.Y;

            result.Y = u.Z * v.X - u.X * v.Z;

            // result.Z = u.Y * v.Y - u.Y * v.X;
            result.Z = u.X * v.Y - u.Y * v.X;

            return(result);
        }
Ejemplo n.º 25
0
        public void CanReadWriteMultipointXyz()
        {
            var points = new WKSPointZ[4];

            points[0] = new WKSPointZ {
                X = 2600000, Y = 1200000, Z = 456
            };
            points[1] = new WKSPointZ {
                X = 2600030, Y = 1200020, Z = 457
            };
            points[2] = new WKSPointZ {
                X = 2600020, Y = 1200030, Z = 459
            };
            points[3] = new WKSPointZ {
                X = 2600010, Y = 1200010, Z = 416
            };

            ISpatialReference sr =
                SpatialReferenceUtils.CreateSpatialReference(WellKnownHorizontalCS.LV95);

            IMultipoint multipoint = GeometryFactory.CreateMultipoint(points, sr);

            WkbGeometryWriter writer = new WkbGeometryWriter();

            byte[] wkb = writer.WriteMultipoint(multipoint);

            // Wkx
            byte[] wkx = ToChristianSchwarzWkb(ToWkxMultipoint(points, Ordinates.Xyz));
            Assert.AreEqual(wkx, wkb);

            // Bonus test: Geom
            WkbGeomWriter     geomWriter = new WkbGeomWriter();
            Multipoint <IPnt> multipnt   = GeometryConversionUtils.CreateMultipoint(multipoint);

            byte[] wkbGeom = geomWriter.WriteMultipoint(multipnt, Ordinates.Xyz);
            Assert.AreEqual(wkb, wkbGeom);

            WkbGeometryReader reader = new WkbGeometryReader();

            IMultipoint restored = reader.ReadMultipoint(new MemoryStream(wkb));

            Assert.IsTrue(GeometryUtils.AreEqual(multipoint, restored));

            // Geom
            WkbGeomReader geomReader = new WkbGeomReader();

            Multipoint <IPnt> deserializedPnts =
                geomReader.ReadMultiPoint(new MemoryStream(wkbGeom));

            Assert.IsTrue(multipnt.Equals(deserializedPnts));
        }
            GetPerpendicularSegmentPairs()
            {
                for (var baseIndex = 0; baseIndex < _sortedHorizontalSegments.Count; baseIndex++)
                {
                    AzimuthSegment baseSegment = _sortedHorizontalSegments[baseIndex];

                    double baseAzimuth = baseSegment.Azimuth;

                    WKSPointZ baseStart =
                        QaGeometryUtils.GetWksPoint(baseSegment.Segment.GetStart(true));

                    WKSPointZ baseEnd =
                        QaGeometryUtils.GetWksPoint(baseSegment.Segment.GetEnd(true));

                    double exactPerpendicularAzimuth = baseAzimuth + Math.PI / 2;
                    double minSearchAzimuth          = exactPerpendicularAzimuth - NearAngleRad;
                    double maxSearchAzimuth          = exactPerpendicularAzimuth + NearAngleRad;

                    for (int perpendicularIndex = baseIndex + 1;
                         perpendicularIndex < _sortedHorizontalSegments.Count;
                         perpendicularIndex++)
                    {
                        AzimuthSegment candidate = _sortedHorizontalSegments[perpendicularIndex];

                        if (candidate.Azimuth <= minSearchAzimuth)
                        {
                            continue;
                        }

                        if (candidate.Azimuth >= maxSearchAzimuth)
                        {
                            break;
                        }

                        WKSPointZ candidateStart =
                            QaGeometryUtils.GetWksPoint(candidate.Segment.GetStart(true));

                        WKSPointZ candidateEnd =
                            QaGeometryUtils.GetWksPoint(candidate.Segment.GetEnd(true));

                        if (IsConnected(baseStart, candidateStart) ||
                            IsConnected(baseStart, candidateEnd) ||
                            IsConnected(baseEnd, candidateStart) ||
                            IsConnected(baseEnd, candidateEnd))
                        {
                            yield return(new PerpendicularSegmentPair(baseSegment, candidate));
                        }
                    }
                }
            }
Ejemplo n.º 27
0
        /// <summary>
        /// Advances the vertex index of coordsToAdvance starting at currentIndex until
        /// the point at the index matches coordinateToMatch. All intermediate points are
        /// added to changedCoords.
        /// </summary>
        /// <param name="coordsToAdvance">The list of coordinates (sorted) to go through
        /// until a coordinate matches <paramref name="coordinateToMatch"/>.</param>
        /// <param name="index">The index to start at which shall be incremented unit the coordinates match.</param>
        /// <param name="coordinateToMatch">The target coordinate.</param>
        /// <param name="comparer">The comparer.</param>
        /// <param name="changedCoords">The list of coordinates that do not match.</param>
        /// <param name="addChangesToResult">Whether the changed points should be added to changedCoords</param>
        /// <param name="reportDuplicateVertices">Whether duplicate vertices in the coordsToAdvance should be reported or not.</param>
        /// <returns>Whether a match was found or not.</returns>
        private bool AdvanceIndexUntilMatch(
            [NotNull] WKSPointZ[] coordsToAdvance,
            ref int index,
            WKSPointZ coordinateToMatch,
            [NotNull] IComparer <WKSPointZ> comparer,
            [NotNull] ICollection <WKSPointZ> changedCoords,
            bool addChangesToResult,
            bool reportDuplicateVertices)
        {
            WKSPointZ currentCoord = coordsToAdvance[index];

            while (comparer.Compare(coordinateToMatch, currentCoord) >= 0 &&
                   index < coordsToAdvance.Length)
            {
                // check if within the tolerance - performance could be improved if comparer could directly handle
                // the tolerance.
                bool useTolerance = Math.Abs(_xyTolerance) > double.Epsilon ||
                                    (!double.IsNaN(_zTolerance) &&
                                     Math.Abs(_zTolerance) > double.Epsilon);

                if (useTolerance &&
                    GeometryUtils.IsSamePoint(currentCoord, coordinateToMatch,
                                              _xyTolerance, _zTolerance))
                {
                    return(true);
                }

                if (addChangesToResult)
                {
                    // except if it's a duplicate that should not be reported
                    bool sameAsPrevious = WKSPointZUtils.ArePointsEqual(
                        coordsToAdvance, index, index - 1,
                        _xyTolerance, _zTolerance);

                    if (!sameAsPrevious || reportDuplicateVertices)
                    {
                        changedCoords.Add(currentCoord);
                    }
                }

                ++index;

                if (index < coordsToAdvance.Length)
                {
                    currentCoord = coordsToAdvance[index];
                }
            }

            return(false);
        }
Ejemplo n.º 28
0
        private static IEnumerable <IPointList> GetAsPointList(
            [NotNull] ICollection <IRing> rings)
        {
            foreach (IRing ring in rings)
            {
                IPointCollection4 pointCollection = (IPointCollection4)ring;

                WKSPointZ[] pointArray = new WKSPointZ[pointCollection.PointCount];

                GeometryUtils.QueryWKSPointZs(pointCollection, pointArray);

                yield return(new WksPointZPointList(pointArray, 0, pointCollection.PointCount));
            }
        }
Ejemplo n.º 29
0
        private static IPoint ReadPoint(BinaryReader reader, Ordinates ordinates)
        {
            WKSPointZ wksPointZ = ReadPointCore(reader, ordinates, new WksPointZFactory());

            bool zAware = ordinates == Ordinates.Xyz || ordinates == Ordinates.Xyzm;

            IPoint result = GeometryFactory.CreatePoint(wksPointZ);

            if (zAware)
            {
                GeometryUtils.MakeZAware(result);
            }

            return(result);
        }
Ejemplo n.º 30
0
        private static Point ToWkxPoint(WKSPointZ wksPoint,
                                        Ordinates ordinates)
        {
            switch (ordinates)
            {
            case Ordinates.Xy:
                return(new Point(wksPoint.X, wksPoint.Y));

            case Ordinates.Xyz:
                return(new Point(wksPoint.X, wksPoint.Y, wksPoint.Z));

            default:
                throw new NotImplementedException();
            }
        }