Пример #1
0
        private static IEnumerable <IGeometry> GetCrossings([NotNull] IGeometry g1,
                                                            [NotNull] IGeometry g2)
        {
            var polyline1 = g1 as IPolyline;
            var polyline2 = g2 as IPolyline;

            if (polyline1 != null && polyline2 != null)
            {
                // TODO get intersection matrix also?
                // 0********
                // but: dimension restriction needs to be better tested first
                yield return(IntersectionUtils.GetLineCrossings(polyline1, polyline2));
            }
            else
            {
                // TODO for line/polygon it would be more useful to get the
                // locations where the line crosses the polygon boundary (and continues)
                // Probably also for polygon/polygon
                IList <IGeometry> intersections = g1.Dimension <= g2.Dimension
                                                                         ? _crossesMatrixOther.GetIntersections(g1, g2)
                                                                         : _crossesMatrixOther.GetIntersections(g2, g1);

                foreach (IGeometry geometry in intersections)
                {
                    yield return(geometry);
                }
            }
        }
Пример #2
0
        private static IGeometry GetLineCrossings([NotNull] IFeature feature1,
                                                  [NotNull] IFeature feature2)
        {
            var shape1 = (IPolyline)feature1.Shape;
            var shape2 = (IPolyline)feature2.Shape;

            return(IntersectionUtils.GetLineCrossings(shape1, shape2));
        }