Exemplo n.º 1
0
        protected override IEnumerable <SegmentProxy> GetSegmentsCore()
        {
            int pointCount = Points.Points.Count;

            for (int i = 1; i < pointCount; i++)
            {
                var segment = new WksSegmentProxy(Points, PartIndex, i - 1);
                yield return(segment);
            }
        }
Exemplo n.º 2
0
        protected override SegmentProxy GetSegmentCore(int segmentIndex)
        {
            var segment = new WksSegmentProxy(Points, PartIndex, segmentIndex);

            return(segment);
        }
Exemplo n.º 3
0
        public PartProxy([NotNull] BoxTree <SegmentProxy> boxTree,
                         int partIndex,
                         [NotNull] IPointCollection4 baseGeometry)
        {
            _partIndex       = partIndex;
            SpatialReference = ((IGeometry)baseGeometry).SpatialReference;

            _points = new WKSPointZ[baseGeometry.PointCount];
            GeometryUtils.QueryWKSPointZs(baseGeometry, _points);

            var segmentCollection = baseGeometry as ISegmentCollection;

            if (segmentCollection == null)
            {
                return;
            }

            SegmentCount = segmentCollection.SegmentCount;
            IsClosed     = ((ICurve)segmentCollection).IsClosed;

            segmentCollection.HasNonLinearSegments(ref _hasNonLinearSegs);

            if (_hasNonLinearSegs)
            {
                _nonLinearSegments = new Dictionary <int, AoSegmentProxy>();

                IEnumSegment enumSeg   = segmentCollection.EnumSegments;
                bool         recycling = enumSeg.IsRecycling;

                ISegment segment;
                int      outPartIndex    = 0;
                int      outSegmentIndex = 0;

                enumSeg.Next(out segment, ref outPartIndex, ref outSegmentIndex);

                while (segment != null)
                {
                    var          line = segment as ILine;
                    SegmentProxy segmentProxy;
                    if (line != null)
                    {
                        segmentProxy = new WksSegmentProxy(this, _partIndex, outSegmentIndex);
                    }
                    else
                    {
                        var aoSegmentProxy = new AoSegmentProxy(recycling
                                                                                                ? GeometryFactory.Clone(segment)
                                                                                                : segment,
                                                                _partIndex, outSegmentIndex);

                        _nonLinearSegments.Add(outSegmentIndex, aoSegmentProxy);
                        segmentProxy = aoSegmentProxy;
                    }

                    boxTree.Add(segmentProxy.Extent, segmentProxy);

                    if (recycling)
                    {
                        Marshal.ReleaseComObject(segment);
                    }

                    enumSeg.Next(out segment, ref outPartIndex, ref outSegmentIndex);
                }
            }
            else
            {
                int segmentCount = segmentCollection.SegmentCount;
                for (int segmentIndex = 0; segmentIndex < segmentCount; segmentIndex++)
                {
                    var wksSegmentProxy = new WksSegmentProxy(this, _partIndex, segmentIndex);

                    boxTree.Add(wksSegmentProxy.Extent, wksSegmentProxy);
                }
            }
        }