コード例 #1
0
            public override SegmentsPlane ReadPlane()
            {
                if (!_enumValid)
                {
                    return(null);
                }

                int currentPart = Assert.NotNull(_segmentsEnum.Current).PartIndex;
                int patchIndex  = _indexedMultiPatch.GetPatchIndex(currentPart);

                int endPart = currentPart;

                var geometryCollection =
                    (IGeometryCollection)_indexedMultiPatch.BaseGeometry;
                var maybeOuterRing = geometryCollection.Geometry[patchIndex] as IRing;

                if (maybeOuterRing != null)
                {
                    var  multiPatch  = (IMultiPatch)geometryCollection;
                    bool isBeginning = false;
                    multiPatch.GetRingType(maybeOuterRing, ref isBeginning);
                    if (isBeginning)
                    {
                        int followingRingCount =
                            multiPatch.FollowingRingCount[maybeOuterRing];
                        endPart += followingRingCount;
                    }
                }

                int segmentCount    = _indexedMultiPatch.GetPartSegmentCount(currentPart);
                var surfaceSegments = new List <SegmentProxy>(segmentCount)
                {
                    _segmentsEnum.Current
                };

                while ((_enumValid = _segmentsEnum.MoveNext()) &&
                       Assert.NotNull(_segmentsEnum.Current).PartIndex <= endPart)
                {
                    surfaceSegments.Add(_segmentsEnum.Current);
                }

                return(new SegmentsPlane(surfaceSegments,
                                         esriGeometryType.esriGeometryMultiPatch));
            }
コード例 #2
0
        public static List <int> GetInnerRingPartIndexes(
            [NotNull] IIndexedMultiPatch indexedMultiPatch,
            int outerRingPartIndex)
        {
            IMultiPatch multiPatch = indexedMultiPatch.BaseGeometry;

            int outerRingIndex = indexedMultiPatch.GetPatchIndex(outerRingPartIndex);

            var geometryCollection = (IGeometryCollection)multiPatch;
            var outerRing          = (IRing)geometryCollection.Geometry[outerRingIndex];

            int followingRingCount = multiPatch.FollowingRingCount[outerRing];

            // following rings must follow the outer ring directly
            var result = new List <int>(followingRingCount);

            for (int index = 0; index < followingRingCount; index++)
            {
                result.Add(index + outerRingPartIndex + 1);
            }

            return(result);
        }