Beispiel #1
0
        /// <summary>
        /// Constructor taking the full state of the surface patch computation operation
        /// </summary>
        public SurfaceElevationPatchArgument(Guid siteModelID,
                                             int oTGCellBottomLeftX,
                                             int oTGCellBottomLeftY,
                                             double cellSize,
                                             SurveyedSurfacePatchType surveyedSurfacePatchType,
                                             SubGridTreeBitmapSubGridBits processingMap,
                                             ISurveyedSurfaces includedSurveyedSurfaces)
        {
            SiteModelID              = siteModelID;
            OTGCellBottomLeftX       = oTGCellBottomLeftX;
            OTGCellBottomLeftY       = oTGCellBottomLeftY;
            CellSize                 = cellSize;
            SurveyedSurfacePatchType = surveyedSurfacePatchType;
            ProcessingMap            = processingMap == null ? new SubGridTreeBitmapSubGridBits(SubGridBitsCreationOptions.Unfilled) : new SubGridTreeBitmapSubGridBits(processingMap);

            // Prepare the list of surveyed surfaces for use by all invocations using this argument
            includedSurveyedSurfaces?.SortChronologically(surveyedSurfacePatchType == SurveyedSurfacePatchType.LatestSingleElevation);
            IncludedSurveyedSurfaces = includedSurveyedSurfaces?.Select(x => x.ID).ToArray() ?? new Guid[0];
        }
Beispiel #2
0
        private void btnListSurveyedSurfacesClick(object sender, EventArgs e)
        {
            try
            {
                if (GetSiteModelID(out Guid SiteModelID))
                {
                    ISurveyedSurfaces ss = surveyedSurfaceManager.List(SiteModelID);

                    if (ss == null || ss.Count == 0)
                    {
                        MessageBox.Show(@"No surveyed surfaces");
                    }
                    else
                    {
                        MessageBox.Show("Surveyed Surfaces:\n" + ss.Select(x => x.ToString() + "\n").Aggregate((s1, s2) => s1 + s2));
                    }
                }
            }
            catch (Exception E)
            {
                MessageBox.Show($@"Exception: {E}");
            }
        }
Beispiel #3
0
        /// <summary>
        /// Given a filter compute which of the surfaces in the list match any given time aspect
        /// of the filter, and the overall existence map of the surveyed surfaces that match the filter.
        /// ComparisonList denotes a possibly pre-filtered set of surfaces for another filter; if this is the same as the
        /// filtered set of surfaces then the overall existence map for those surfaces will not be computed as it is
        /// assumed to be the same.
        /// </summary>
        public bool ProcessSurveyedSurfacesForFilter(Guid siteModelId,
                                                     ICombinedFilter filter,
                                                     ISurveyedSurfaces comparisonList,
                                                     ISurveyedSurfaces filteredSurveyedSurfaces,
                                                     ISubGridTreeBitMask overallExistenceMap)
        {
            // Filter out any surveyed surfaces which don't match current filter (if any) - realistically, this is time filters we're thinking of here
            FilterSurveyedSurfaceDetails(filter.AttributeFilter.HasTimeFilter,
                                         filter.AttributeFilter.StartTime, filter.AttributeFilter.EndTime,
                                         filter.AttributeFilter.ExcludeSurveyedSurfaces(),
                                         filteredSurveyedSurfaces,
                                         filter.AttributeFilter.SurveyedSurfaceExclusionList);

            if (filteredSurveyedSurfaces != null)
            {
                if (filteredSurveyedSurfaces.IsSameAs(comparisonList))
                {
                    return(true);
                }

                if (filteredSurveyedSurfaces.Count > 0)
                {
                    var surveyedSurfaceExistenceMap = GetExistenceMaps().GetCombinedExistenceMap(siteModelId,
                                                                                                 filteredSurveyedSurfaces.Select(x => new Tuple <long, Guid>(Consts.EXISTENCE_SURVEYED_SURFACE_DESCRIPTOR, x.ID)).ToArray());

                    if (overallExistenceMap == null)
                    {
                        return(false);
                    }

                    overallExistenceMap.SetOp_OR(surveyedSurfaceExistenceMap);
                }
            }

            return(true);
        }
Beispiel #4
0
             ITRexSpatialMemoryCacheContext[] CacheContexts) GetIntermediary(ICombinedFilter filter)
            {
                // Construct the appropriate list of surveyed surfaces
                // Obtain local reference to surveyed surface list. If it is replaced while processing the
                // list then the local reference will still be valid allowing lock free read access to the list.
                ISurveyedSurfaces filteredSurveyedSurfaces = null;
                var surveyedSurfaceList = siteModel.SurveyedSurfaces;

                if (includeSurveyedSurfaceInformation && surveyedSurfaceList?.Count > 0)
                {
                    filteredSurveyedSurfaces = DIContext.Obtain <ISurveyedSurfaces>();

                    // Filter out any surveyed surfaces which don't match current filter (if any) - realistically, this is time filters we're thinking of here
                    surveyedSurfaceList.FilterSurveyedSurfaceDetails(filter.AttributeFilter.HasTimeFilter,
                                                                     filter.AttributeFilter.StartTime, filter.AttributeFilter.EndTime,
                                                                     filter.AttributeFilter.ExcludeSurveyedSurfaces(), filteredSurveyedSurfaces,
                                                                     filter.AttributeFilter.SurveyedSurfaceExclusionList);

                    // Ensure that the filtered surveyed surfaces are in a known ordered state
                    filteredSurveyedSurfaces.SortChronologically(filter.AttributeFilter.ReturnEarliestFilteredCellPass);
                }

                var filteredSurveyedSurfacesAsArray = filteredSurveyedSurfaces?.Count > 0 ? filteredSurveyedSurfaces.Select(s => s.ID).ToArray() : new Guid[0];

                // Get a caching context for the sub grids returned by this requester, but only if the requested grid data type supports it
                ITRexSpatialMemoryCacheContext[] subGridCacheContexts = null;

                if (_enableGeneralSubGridResultCaching &&
                    ClientLeafSubGrid.SupportsAssignationFromCachedPreProcessedClientSubGrid[(int)gridDataType])
                {
                    filter.AttributeFilter.SiteModel = siteModel;
                    var contextType1 = Utilities.IntermediaryICGridDataTypeForDataType(gridDataType, true);
                    var contextType2 = Utilities.IntermediaryICGridDataTypeForDataType(gridDataType, false);

                    var context1 = SubGridCache?.LocateOrCreateContext(siteModel.ID, contextType1,
                                                                       SpatialCacheFingerprint.ConstructFingerprint(siteModel.ID, contextType1, filter, filteredSurveyedSurfacesAsArray));
                    var context2 = SubGridCache?.LocateOrCreateContext(siteModel.ID, contextType2,
                                                                       SpatialCacheFingerprint.ConstructFingerprint(siteModel.ID, contextType2, filter, filteredSurveyedSurfacesAsArray));

                    subGridCacheContexts = new[] { context1, context2 }.Where(x => x != null).ToArray();
                }

                return(gridDataType,
                       filter,
                       filteredSurveyedSurfaces,
                       _surfaceElevationPatchRequestFactory(SubGridCache, SubGridCache?.LocateOrCreateContext(siteModel.ID, GridDataType.SurveyedSurfaceHeightAndTime,
                                                                                                              SpatialCacheFingerprint.ConstructFingerprint(siteModel.ID, GridDataType.SurveyedSurfaceHeightAndTime, null,
                                                                                                                                                           filteredSurveyedSurfaces?.Select(x => x.ID).ToArray() ?? new Guid[0]))),
                       subGridCacheContexts);
            }
Beispiel #5
0
        /// <summary>
        /// Constructor that accepts the common parameters around a set of sub grids the requester will be asked to process
        /// and initializes the requester state ready to start processing individual sub grid requests.
        /// </summary>
        public void Initialize(ISubGridsRequestArgument subGridsRequestArgument,
                               ISiteModel siteModel,
                               GridDataType gridDataType,
                               IStorageProxy storageProxy,
                               ICombinedFilter filter,
                               bool hasOverrideSpatialCellRestriction,
                               BoundingIntegerExtent2D overrideSpatialCellRestriction,
                               int maxNumberOfPassesToReturn,
                               AreaControlSet areaControlSet,
                               IFilteredValuePopulationControl populationControl,
                               ISubGridTreeBitMask pdExistenceMap,
                               ITRexSpatialMemoryCache subGridCache,
                               ITRexSpatialMemoryCacheContext[] subGridCacheContexts,
                               ISurveyedSurfaces filteredSurveyedSurfaces,
                               ISurfaceElevationPatchRequest surfaceElevationPatchRequest,
                               IOverrideParameters overrides,
                               ILiftParameters liftParams)
        {
            _siteModel    = siteModel;
            _gridDataType = gridDataType;
            _filter       = filter;

            _hasOverrideSpatialCellRestriction = hasOverrideSpatialCellRestriction;
            _overrideSpatialCellRestriction    = overrideSpatialCellRestriction;

            _retriever = DIContext.Obtain <ISubGridRetrieverFactory>().Instance(subGridsRequestArgument,
                                                                                siteModel,
                                                                                gridDataType,
                                                                                storageProxy,
                                                                                filter,
                                                                                _filterAnnex,
                                                                                hasOverrideSpatialCellRestriction,
                                                                                overrideSpatialCellRestriction,
                                                                                maxNumberOfPassesToReturn,
                                                                                areaControlSet,
                                                                                populationControl,
                                                                                pdExistenceMap,
                                                                                subGridCacheContexts,
                                                                                overrides,
                                                                                liftParams);

            _returnEarliestFilteredCellPass = _filter.AttributeFilter.ReturnEarliestFilteredCellPass;
            _processingMap = new SubGridTreeBitmapSubGridBits(SubGridBitsCreationOptions.Unfilled);

            _surfaceElevationPatchRequest = surfaceElevationPatchRequest;

            _subGridCache         = subGridCache;
            _subGridCacheContexts = subGridCacheContexts;

            _surveyedSurfacePatchType = _filter.AttributeFilter.ReturnEarliestFilteredCellPass ? SurveyedSurfacePatchType.EarliestSingleElevation : SurveyedSurfacePatchType.LatestSingleElevation;

            _filteredSurveyedSurfaces = filteredSurveyedSurfaces;
            _filteredSurveyedSurfaces?.SortChronologically(_surveyedSurfacePatchType == SurveyedSurfacePatchType.LatestSingleElevation);
            _filteredSurveyedSurfacesAsGuidArray = _filteredSurveyedSurfaces?.Select(x => x.ID).ToArray() ?? new Guid[0];

            var elevRangeDesignFilter = _filter.AttributeFilter.ElevationRangeDesign;

            if (elevRangeDesignFilter.DesignID != Guid.Empty)
            {
                var design = _siteModel.Designs.Locate(elevRangeDesignFilter.DesignID);
                if (design == null)
                {
                    _log.LogError($"ElevationRangeDesign {elevRangeDesignFilter.DesignID} is unknown in project {siteModel.ID}");
                }
                else
                {
                    _elevationRangeDesign = new DesignWrapper(elevRangeDesignFilter, design);
                }
            }

            if (_filter.SpatialFilter.IsDesignMask)
            {
                _surfaceDesignMaskDesign = _siteModel.Designs.Locate(_filter.SpatialFilter.SurfaceDesignMaskDesignUid);
            }

            _filter.AttributeFilter.SiteModel = _siteModel;
        }