Esempio n. 1
0
 public void Add([NotNull] Vertex vertex)
 {
     _boxTree.Add(new Pnt2D(vertex.X, vertex.Y), vertex);
 }
Esempio n. 2
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);
                }
            }
        }