Beispiel #1
0
        /// <summary>
        /// Gets the intersection points (also including linear intersection end points) between crossingLine crosses the
        /// and polycurveToCross excluding start and end point of the crossingLine. This is not the same as interior intersection.
        /// </summary>
        /// <param name="crossingLine"></param>
        /// <param name="polycurveToCross"></param>
        /// <returns></returns>
        private static IPointCollection GetCrossingPoints([NotNull] ICurve crossingLine,
                                                          [NotNull] IGeometry
                                                          polycurveToCross)
        {
            // TODO: extracted from GetCrossingPointCount (various copies) -> move to ReshapeUtils

            IGeometry highLevelCrossingLine =
                GeometryUtils.GetHighLevelGeometry(crossingLine);

            // NOTE: IRelationalOperator.Crosses() does not find cases where the start point is tangential and
            //		 neither it finds cases where there is also a 1-dimensional intersection in addition to a point-intersection
            // NOTE: use GeometryUtils.GetIntersectionPoints to find also these cases where some intersections are 1-dimensional
            var intersectionPoints =
                (IPointCollection)
                IntersectionUtils.GetIntersectionPoints(polycurveToCross,
                                                        highLevelCrossingLine);

            // count the points excluding start and end point of the crossing line
            var result =
                (IPointCollection)GeometryFactory.CreateEmptyMultipoint(polycurveToCross);

            foreach (IPoint point in GeometryUtils.GetPoints(intersectionPoints))
            {
                if (GeometryUtils.AreEqualInXY(point, crossingLine.FromPoint) ||
                    GeometryUtils.AreEqualInXY(point, crossingLine.ToPoint))
                {
                    continue;
                }

                result.AddPoint(point);
            }

            return(result);
        }
Beispiel #2
0
        private static IMultipoint ReadMultipoint([NotNull] BinaryReader reader,
                                                  Ordinates ordinates)
        {
            int pointCount = checked ((int)reader.ReadUInt32());

            var geometryBuilder = new WksPointListBuilder();

            WKSPointZ[] wksZPoints =
                ReadMultipointCore(reader, ordinates, pointCount, geometryBuilder);

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

            IMultipoint result = GeometryFactory.CreateEmptyMultipoint(zAware, mAware);

            GeometryUtils.SetWKSPointZs(result, wksZPoints);

            return(result);
        }