Exemple #1
0
        public ReshapeResultFilter(
            [CanBeNull] List <IEnvelope> allowedExtents,
            [CanBeNull] IEnumerable <IFeature> unallowedOverlapGeometries,
            bool useMinimalTolerance)
        {
            _allowedExtents = allowedExtents;

            if (unallowedOverlapGeometries != null)
            {
                _targetUnionPoly = ReshapeUtils.CreateUnionPolygon(
                    GdbObjectUtils.GetGeometries(unallowedOverlapGeometries),
                    useMinimalTolerance);
            }
        }
Exemple #2
0
        public ReshapeResultFilter(
            [CanBeNull] List <IEnvelope> allowedExtents,
            [CanBeNull] IEnumerable <IFeature> unallowedOverlapGeometries,
            bool useMinimalTolerance)
        {
            // Set allowed extents only if there are any. Otherwise everything will be filtered.
            _allowedExtents = allowedExtents?.Count > 0 ? allowedExtents : null;

            if (unallowedOverlapGeometries != null)
            {
                _targetUnionPoly = ReshapeUtils.CreateUnionPolygon(
                    GdbObjectUtils.GetGeometries(unallowedOverlapGeometries),
                    useMinimalTolerance);
            }
        }
Exemple #3
0
        public SubcurveFilter PrepareFilter(
            [NotNull] IList <IPolyline> preprocessedSourceLines,
            [NotNull] IList <IGeometry> targetGeometries,
            bool useMinimalTolerance,
            [NotNull] ReshapeCurveFilterOptions filterOptions)
        {
            _useMinimalTolerance = useMinimalTolerance;
            _filterOptions       = filterOptions;

            ReleaseFilterObjects();

            if (filterOptions.OnlyInVisibleExtent)
            {
                Assert.NotNull(_extentProvider);
                _currentlyVisibleExtents = new List <IEnvelope>();

                // add the lens window extents
                _currentlyVisibleExtents.AddRange(
                    _extentProvider.GetVisibleLensWindowExtents());

                // plus the main map window
                _currentlyVisibleExtents.Add(_extentProvider.GetCurrentExtent());
            }

            if (filterOptions.ExcludeOutsideTolerance)
            {
                // NOTE: Buffer lines / outlines -> otherwise we miss lines for individual reshapes
                //		 and clip on extent (pre-process) before buffering to improve performance

                var sourceOutline =
                    (IPolyline)GeometryUtils.UnionGeometries(preprocessedSourceLines);

                const int logInfoPointCountThreshold = 10000;
                var       bufferNotifications        = new NotificationCollection();

                if (AdjustUtils.TryBuffer(sourceOutline,
                                          filterOptions.ExcludeTolerance,
                                          logInfoPointCountThreshold,
                                          "Calculating reshape line tolerance buffer...",
                                          bufferNotifications,
                                          out _mustBeWithinSourceBuffer))
                {
                    ExclusionOutsideSourceBufferLine =
                        GeometryFactory.CreatePolyline(
                            Assert.NotNull(_mustBeWithinSourceBuffer));
                }
                else
                {
                    _msg.WarnFormat(
                        "Unable to calculate reshape line tolerance buffer: {0}",
                        bufferNotifications.Concatenate(". "));
                }

                Marshal.ReleaseComObject(sourceOutline);
            }

            if (filterOptions.ExcludeResultingInOverlaps)
            {
                _targetUnionPoly = ReshapeUtils.CreateUnionPolygon(
                    targetGeometries, _useMinimalTolerance);
            }

            return(this);
        }