Exemplo n.º 1
0
 private void SaveAndVerifyNotEmpty(ISiteModel model)
 {
     model.Machines.ForEach(x => model.MachinesTargetValues[x.InternalSiteModelMachineIndex]?.SaveMachineEventsToPersistentStore(model.PrimaryStorageProxy));
     model.SaveToPersistentStoreForTAGFileIngest(model.PrimaryStorageProxy);
     model.PrimaryStorageProxy.Commit();
     IsModelEmpty(model, false).Should().BeFalse();
 }
Exemplo n.º 2
0
        /// <summary>
        /// Constructor for the renderer accepting all parameters necessary for its operation
        /// </summary>
        public RebuildSiteModelComputeFuncExecutor(RebuildSiteModelRequestArgument arg)
        {
            Response = new RebuildSiteModelRequestResponse(arg.ProjectID)
            {
                RebuildResult = RebuildSiteModelResult.OK
            };

            _rebuildSiteModelRequestArgument = arg;
            if (arg != null)
            {
                _siteModel = DIContext.Obtain <ISiteModels>().GetSiteModelRaw(arg.ProjectID);
            }

            if (_siteModel == null)
            {
                Response.RebuildResult = RebuildSiteModelResult.UnableToLocateSiteModel;
                return;
            }

            _siteModel.SetStorageRepresentationToSupply(StorageMutability.Mutable);

            // Rebuilding is only supported in the context of the mutable grid for coordination
            if (_siteModel.PrimaryStorageProxy.Mutability != StorageMutability.Mutable ||
                _siteModel.PrimaryStorageProxy.ImmutableProxy == null)
            {
                throw new TRexException("Rebulding is only supported in the context of the mutable grid for coordination");
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Constructor for the sub grid retriever helper
        /// </summary>
        /// <param name="siteModel">The project this sub gris is being retrieved from</param>
        /// <param name="gridDataType">The type of client grid data sub grids to be returned by this retriever</param>
        /// <param name="storageProxy">The Ignite storage proxy to be used when requesting data from the persistent store</param>
        /// <param name="filter">The TRex spatial and attribute filtering description for the request</param>
        /// <param name="filterAnnex">An annex of data related to cell by cell filtering where the attributes related to that cell may change from cell to cell</param>
        /// <param name="hasOverrideSpatialCellRestriction">The spatially selected cells are masked by a rectangular restriction boundary</param>
        /// <param name="overrideSpatialCellRestriction"></param>
        /// <param name="prepareGridForCacheStorageIfNoSieving">The cell coordinate bounding box restricting cells involved in the request</param>
        /// <param name="maxNumberOfPassesToReturn">The maximum number of passes in a cell in a sub grid that will be considered when processing the request</param>
        /// <param name="areaControlSet">The skip/step area control set for selection of cells with sub grids for processing. Cells not identified by the control set will return null values.</param>
        /// <param name="populationControl">The delegate responsible for populating events depended on for processing the request.</param>
        /// <param name="pDExistenceMap">The production data existence map for the project the request relates to</param>
        /// <param name="overrides">The set of overriding machine event values to use</param>
        /// <param name="liftParams">The set of layer/lift analysis parameters to use</param>
        public ProgressiveVolumesSubGridRetriever(ISiteModel siteModel,
                                                  GridDataType gridDataType,
                                                  IStorageProxy storageProxy,
                                                  ICombinedFilter filter,
                                                  ICellPassAttributeFilterProcessingAnnex filterAnnex,
                                                  bool hasOverrideSpatialCellRestriction,
                                                  BoundingIntegerExtent2D overrideSpatialCellRestriction,
                                                  bool prepareGridForCacheStorageIfNoSieving,
                                                  int maxNumberOfPassesToReturn,
                                                  AreaControlSet areaControlSet,
                                                  IFilteredValuePopulationControl populationControl,
                                                  ISubGridTreeBitMask pDExistenceMap,
                                                  IOverrideParameters overrides,
                                                  ILiftParameters liftParams)
            : base(siteModel, gridDataType, filter, filterAnnex,
                   hasOverrideSpatialCellRestriction, overrideSpatialCellRestriction, prepareGridForCacheStorageIfNoSieving, maxNumberOfPassesToReturn,
                   storageProxy, areaControlSet, populationControl, pDExistenceMap, overrides, liftParams)
        {
            // Clear any time element from the supplied filter. Time constraints ar derived from the startDate and endDate parameters
            filter.AttributeFilter.HasTimeFilter = false;

            // Clear any instruction in the filter to extract the earliest value - this has no meaning in progressive calculations
            filter.AttributeFilter.ReturnEarliestFilteredCellPass = false;

            // Remove any first/last/highest/lowest aspect from the filter - this has no meaning in progressive calculations
            filter.AttributeFilter.HasElevationTypeFilter = false;

            // Remove any machine filtering - the intent here is to examine volume progression over time, machine breakdowns don't make sense at this point
            filter.AttributeFilter.HasMachineFilter = false;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Constructor for the machines events within the site model supplier as owner
        /// </summary>
        /// <param name="owner"></param>
        /// <param name="machineCount"></param>
        public MachinesProductionEventLists(ISiteModel owner, int machineCount)
        {
            Owner = owner;

            Log.LogInformation($"Creating machine ID map containing {machineCount} entries");
            internalSiteModelMachineIndexMap = new IProductionEventLists[machineCount];
        }
Exemplo n.º 5
0
        private ProgressiveVolumesSubGridRetriever MakeANewRetriever(ISiteModel siteModel)
        {
            var retriever = new ProgressiveVolumesSubGridRetriever
                                (siteModel,
                                GridDataType.ProgressiveVolumes,
                                siteModel.PrimaryStorageProxy,
                                new CombinedFilter(),
                                new CellPassAttributeFilterProcessingAnnex(),
                                false,
                                BoundingIntegerExtent2D.Inverted(),
                                true,
                                int.MaxValue,
                                new AreaControlSet(),
                                new FilteredValuePopulationControl(),
                                new SubGridTreeBitMask(),
                                new OverrideParameters(),
                                new LiftParameters()
                                );

            retriever.StartDate = new DateTime(2020, 1, 1, 0, 0, 0);
            retriever.EndDate   = new DateTime(2020, 1, 1, 1, 0, 0);
            retriever.Interval  = new TimeSpan(0, 10, 0);

            return(retriever);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Given a design used as an elevation range filter aspect, retrieve the existence map for the design and
        /// includes it in the supplied overall existence map for the query
        /// </summary>
        public static bool ProcessDesignElevationsForFilter(ISiteModel siteModel, //Guid siteModelID,
                                                            ICombinedFilter filter,
                                                            ISubGridTreeBitMask overallExistenceMap)
        {
            if (filter == null)
            {
                return(true);
            }

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

            if (filter.AttributeFilter.HasElevationRangeFilter && filter.AttributeFilter.ElevationRangeDesign.DesignID != Guid.Empty)
            {
                var designExistenceMap = DIContext.Obtain <IExistenceMaps>().GetSingleExistenceMap
                                             (siteModel.ID, Consts.EXISTENCE_MAP_DESIGN_DESCRIPTOR, filter.AttributeFilter.ElevationRangeDesign.DesignID);

                if (designExistenceMap != null)
                {
                    // Not sure this is really needed...
                    designExistenceMap.CellSize = SubGridTreeConsts.SubGridTreeDimension * siteModel.CellSize;
                    overallExistenceMap.SetOp_OR(designExistenceMap);
                }
            }

            return(true);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Remove requested machine design and layer override events for given machine
        /// </summary>
        private bool RemoveOverrideEventsForMachine(ISiteModel siteModel, IMachine machine, OverrideEventRequestArgument arg)
        {
            var changed             = false;
            var machineTargetValues = siteModel.MachinesTargetValues[machine.InternalSiteModelMachineIndex];

            //Remove design overrides
            if (!string.IsNullOrEmpty(arg.MachineDesignName))
            {
                var overrideDesignEvents = machineTargetValues.DesignOverrideEvents;
                if (RemoveOverrideEventsForMachine(arg.StartUTC, arg.EndUTC, overrideDesignEvents))
                {
                    changed = true;
                }
            }
            //Remove layer overrides
            if (arg.LayerID.HasValue)
            {
                var overrideLayerEvents = machineTargetValues.LayerOverrideEvents;
                if (RemoveOverrideEventsForMachine(arg.StartUTC, arg.EndUTC, overrideLayerEvents))
                {
                    changed = true;
                }
            }

            if (changed)
            {
                Log.LogDebug($"Saving override events: Project={arg.ProjectID}, Asset={machine.ID}, Date Range={arg.StartUTC}-{arg.EndUTC}");
                // Use the synchronous command to save the machine events to the persistent store into the deferred (asynchronous model)
                machineTargetValues.SaveMachineEventsToPersistentStore(storageProxy_Mutable);
            }

            return(changed);
        }
Exemplo n.º 8
0
        InitialiseFilterContext(ISiteModel siteModel, ICellPassAttributeFilter passFilter,
                                ICellPassAttributeFilterProcessingAnnex passFilterAnnex, ProfileCell profileCell, IDesignWrapper passFilterElevRangeDesign)
        {
            (bool executionResult, DesignProfilerRequestResult filterDesignErrorCode)result = (false, DesignProfilerRequestResult.UnknownError);

            // If the elevation range filter uses a design then the design elevations
            // for the sub grid need to be calculated and supplied to the filter

            if (passFilter.HasElevationRangeFilter && passFilterElevRangeDesign != null)
            {
                var getDesignHeightsResult = passFilterElevRangeDesign.Design.GetDesignHeightsViaLocalCompute(siteModel, passFilterElevRangeDesign.Offset, new SubGridCellAddress(profileCell.OTGCellX, profileCell.OTGCellY), siteModel.CellSize);

                result.filterDesignErrorCode = getDesignHeightsResult.errorCode;

                if (result.filterDesignErrorCode != DesignProfilerRequestResult.OK || getDesignHeightsResult.designHeights == null)
                {
                    if (result.filterDesignErrorCode == DesignProfilerRequestResult.NoElevationsInRequestedPatch)
                    {
                        _log.LogInformation(
                            "Lift filter by design. Call to RequestDesignElevationPatch failed due to no elevations in requested patch.");
                    }
                    else
                    {
                        _log.LogWarning(
                            $"Lift filter by design. Call to RequestDesignElevationPatch failed due to no TDesignProfilerRequestResult return code {result.filterDesignErrorCode}.");
                    }
                    return(result);
                }

                passFilterAnnex.InitializeElevationRangeFilter(passFilter, getDesignHeightsResult.designHeights.Cells);
            }

            result.executionResult = true;
            return(result);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Computes the CCA palette for the specified machine
        /// </summary>
        public static IPlanViewPalette ComputeCCAPalette(ISiteModel siteModel, ICellPassAttributeFilter filter, DisplayMode mode)
        {
            var machineUid = filter.MachinesList.Length > 0 ? filter.MachinesList[0] : Guid.Empty;

            var ccaMinimumPassesValue = siteModel.GetCCAMinimumPassesValue(machineUid, filter.StartTime, filter.EndTime, filter.LayerID);

            if (ccaMinimumPassesValue == 0)
            {
                return(null);
            }

            var ccaColorScale = CCAColorScaleManager.CreateCoverageScale(ccaMinimumPassesValue);

            var transitions = new Transition[ccaColorScale.TotalColors];

            for (var i = 0; i < transitions.Length; i++)
            {
                transitions[i] = new Transition(i + 1, ColorUtility.UIntToColor(ccaColorScale.ColorSegments[transitions.Length - i - 1].Color));
            }

            if (mode == DisplayMode.CCA)
            {
                return(new CCAPalette {
                    PaletteTransitions = transitions
                });
            }

            return(new CCASummaryPalette
            {
                UndercompactedColour = transitions[0].Color,
                CompactedColour = transitions[1].Color,
                OvercompactedColour = transitions[2].Color
            });
        }
Exemplo n.º 10
0
 /// <summary>
 /// Creates a new builder responsible for determining a vector of cells that are crossed by a profile line
 /// </summary>
 public ICellProfileBuilder <T> NewCellProfileBuilder(ISiteModel siteModel,
                                                      IFilterSet filterSet,
                                                      IDesignWrapper cutFillDesignWrapper,
                                                      bool slicerToolUsed)
 {
     return(new CellProfileBuilder <T>(siteModel, filterSet, cutFillDesignWrapper, slicerToolUsed));
 }
Exemplo n.º 11
0
        /// <summary>
        /// Constructs a cell profile analyzer that analyzes cells in a cell profile vector
        /// </summary>
        /// <param name="siteModel"></param>
        /// <param name="pDExistenceMap"></param>
        /// <param name="filterSet"></param>
        /// <param name="cellLiftBuilder"></param>
        /// <param name="overrides"></param>
        public CellProfileAnalyzer(ISiteModel siteModel,
                                   ISubGridTreeBitMask pDExistenceMap,
                                   IFilterSet filterSet,
                                   ICellLiftBuilder cellLiftBuilder,
                                   IOverrideParameters overrides,
                                   ILiftParameters liftParams)
            : base(siteModel, pDExistenceMap, filterSet, overrides, liftParams)
        {
            CellLiftBuilder = cellLiftBuilder;

            PassFilter = filterSet.Filters[0].AttributeFilter;
            if (PassFilter.HasElevationRangeFilter && PassFilter.ElevationRangeDesign.DesignID != Guid.Empty)
            {
                var design = siteModel.Designs.Locate(PassFilter.ElevationRangeDesign.DesignID);
                if (design == null)
                {
                    Log.LogError($"ElevationRangeDesign {PassFilter.ElevationRangeDesign.DesignID} is unknown in project {siteModel.ID}");
                }
                else
                {
                    PassFilterElevationRangeDesign = new DesignWrapper(PassFilter.ElevationRangeDesign, design);
                }
            }
            PassFilterAnnex = new CellPassAttributeFilterProcessingAnnex();
            CellFilter      = filterSet.Filters[0].SpatialFilter;
        }
Exemplo n.º 12
0
        /// <summary>
        /// Integrates the cell passes processed from TAG files into sub grids within the live site model
        /// </summary>
        /// <param name="siteModelFromDatamodel">The site model to perform the change notifications for</param>
        /// <param name="task">The 'seed' task used as a hold all for aggregated machines</param>
        /// <param name="subGridIntegrator">The integrator to use to insert the new cell passes into the live site model</param>
        /// <param name="groupedAggregatedCellPasses">The set of all cell passes from all TAG files, grouped in to a single intermediary site model</param>
        /// <param name="numTagFilesRepresented">The number of TAG files represented in the data set being integrated</param>
        /// <param name="totalPassCountInAggregation">The sum total number of cell passes integrated in the live site model</param>
        private bool IntegrateCellPassesIntoLiveSiteModel(ISiteModel siteModelFromDatamodel,
                                                          AggregatedDataIntegratorTask task,
                                                          SubGridIntegrator subGridIntegrator,
                                                          ISubGridTree groupedAggregatedCellPasses,
                                                          int numTagFilesRepresented,
                                                          out long totalPassCountInAggregation)
        {
            _log.LogInformation($"Aggregation Task Process --> Labeling aggregated cell pass with correct machine ID for {siteModelFromDatamodel.ID}");

            totalPassCountInAggregation = 0;

            // This is a dirty map for the leaf sub grids and is stored as a bitmap grid
            // with one level fewer that the sub grid tree it is representing, and
            // with cells the size of the leaf sub grids themselves. As the cell coordinates
            // we have been given are with respect to the sub grid, we must transform them
            // into coordinates relevant to the dirty bitmap sub grid tree.

            _workingModelUpdateMap = new SubGridTreeSubGridExistenceBitMask
            {
                CellSize = SubGridTreeConsts.SubGridTreeDimension * siteModelFromDatamodel.CellSize,
                ID       = siteModelFromDatamodel.ID
            };

            // Integrate the cell pass data into the main site model and commit each sub grid as it is updated
            // ... first relabel the passes with the machine IDs from the persistent datamodel

            // Compute the vector of internal site model machine indexes between the intermediary site model constructed from the TAG files,
            // and the persistent site model the data us being processed into
            (short taskInternalMachineIndex, short datamodelInternalMachineIndex)[] internalMachineIndexMap = task.IntermediaryTargetMachines
Exemplo n.º 13
0
 private ElevationStatisticsArgument SimpleElevationStatisticsArgument(ISiteModel siteModel)
 {
     return(new ElevationStatisticsArgument
     {
         ProjectID = siteModel.ID,
         Filters = new FilterSet(new CombinedFilter())
     });
 }
Exemplo n.º 14
0
        public void GetMachines_NoMachine()
        {
            ISiteModel siteModel = DIContext.Obtain <ISiteModels>().GetSiteModel(DITagFileFixture.NewSiteModelGuid, true);

            var machines = siteModel.Machines.ToList();

            machines.Count.Should().Be(0);
        }
Exemplo n.º 15
0
 /// <summary>
 /// Constructor for the renderer accepting all parameters necessary for its operation
 /// </summary>
 public GriddedReportComputeFuncExecutor(GriddedReportRequestArgument arg)
 {
     _griddedReportRequestArgument = arg;
     if (arg != null)
     {
         _siteModel = DIContext.Obtain <ISiteModels>().GetSiteModel(arg.ProjectID);
     }
 }
Exemplo n.º 16
0
 /// <summary>
 /// Creates a new builder responsible for processing cell pass, layer and other information for single cells in a profile
 /// </summary>
 public ICellLiftBuilder NewCellLiftBuilder(ISiteModel siteModel,
                                            GridDataType gridDataType,
                                            IFilteredValuePopulationControl populationControl,
                                            IFilterSet filterSet,
                                            ICellPassFastEventLookerUpper cellPassFastEventLookerUpper)
 {
     return(new CellLiftBuilder(siteModel, gridDataType, populationControl, filterSet, cellPassFastEventLookerUpper));
 }
Exemplo n.º 17
0
 /// <summary>
 /// Sends notifications to all parties interested in changes to site model state
 /// </summary>
 /// <param name="siteModelFromDatamodel">The site model to perform the change notifications for</param>
 private void UpdateSiteModelMetaData(ISiteModel siteModelFromDatamodel)
 {
     // Update the metadata for the site model
     _log.LogInformation($"Aggregation Task Process --> Updating site model metadata for {siteModelFromDatamodel.ID}");
     DIContext.Obtain <ISiteModelMetadataManager>().Update
         (siteModelID: siteModelFromDatamodel.ID, lastModifiedDate: DateTime.UtcNow, siteModelExtent: siteModelFromDatamodel.SiteModelExtent,
         machineCount: siteModelFromDatamodel.Machines.Count);
 }
Exemplo n.º 18
0
        /// <summary>
        /// Constructs a mask using all spatial filtering elements active in the supplied filter
        /// </summary>
        public static bool ConstructSubGridCellFilterMask(ISiteModel siteModel, SubGridCellAddress currentSubGridOrigin,
                                                          InterceptList intercepts,
                                                          int fromProfileCellIndex,
                                                          SubGridTreeBitmapSubGridBits mask,
                                                          ICellSpatialFilter cellFilter,
                                                          IDesign surfaceDesignMaskDesign)
        {
            ConstructSubGridSpatialAndPositionalMask(currentSubGridOrigin, intercepts, fromProfileCellIndex, mask, cellFilter, siteModel.Grid);

            // If the filter contains an alignment design mask filter then compute this and AND it with the
            // mask calculated in the step above to derive the final required filter mask

            if (cellFilter.HasAlignmentDesignMask())
            {
                if (cellFilter.AlignmentFence.IsNull()) // Should have been done in ASNode but if not
                {
                    throw new ArgumentException($"Spatial filter does not contained pre-prepared alignment fence for design {cellFilter.AlignmentDesignMaskDesignUID}");
                }

                var tree = siteModel.Grid;
                // Go over set bits and determine if they are in Design fence boundary
                mask.ForEachSetBit((x, y) =>
                {
                    tree.GetCellCenterPosition(currentSubGridOrigin.X + x, currentSubGridOrigin.Y + y, out var cx, out var cy);
                    if (!cellFilter.AlignmentFence.IncludesPoint(cx, cy))
                    {
                        mask.ClearBit(x, y); // remove interest as its not in design boundary
                    }
                });
            }

            // If the filter contains a design mask filter then compute this and AND it with the
            // mask calculated in the step above to derive the final required filter mask

            if (surfaceDesignMaskDesign != null)
            {
                var getFilterMaskResult = surfaceDesignMaskDesign.GetFilterMaskViaLocalCompute(siteModel, currentSubGridOrigin, siteModel.CellSize);

                if (getFilterMaskResult.errorCode == DesignProfilerRequestResult.OK || getFilterMaskResult.errorCode == DesignProfilerRequestResult.NoElevationsInRequestedPatch)
                {
                    if (getFilterMaskResult.filterMask == null)
                    {
                        _log.LogWarning("FilterMask null in response from surfaceDesignMaskDesign.GetFilterMask, ignoring it's contribution to filter mask");
                    }
                    else
                    {
                        mask.AndWith(getFilterMaskResult.filterMask);
                    }
                }
                else
                {
                    _log.LogError($"Call (A2) to {nameof(ConstructSubGridCellFilterMask)} returned error result {getFilterMaskResult.errorCode} for {cellFilter.SurfaceDesignMaskDesignUid}");
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 19
0
        private bool IsModelEmpty(ISiteModel model, bool expectedToBeEmpty)
        {
            var mutableCount   = IgniteMock.Mutable.MockedCacheDictionaries.Count;
            var immutableCount = IgniteMock.Immutable.MockedCacheDictionaries.Count;

            // var clear1MutableCount = IgniteMock.Mutable.MockedCacheDictionaries.Values.Sum(cache => cache.Keys.Count);
            var clear1MutableCount = 0;

            IgniteMock.Mutable.MockedCacheDictionaries.ForEach(x =>
            {
                var value           = x.Value.Keys.Count;
                clear1MutableCount += value;

                if (value > 0 && expectedToBeEmpty)
                {
                    _log.LogError($"Mutable cache {x.Key} has {value} elements within it, expected to be zero.");
                }
            });

            // var clear1ImmutableCount = IgniteMock.Immutable.MockedCacheDictionaries.Values.Sum(cache => cache.Keys.Count);
            var clear1ImmutableCount = 0;

            IgniteMock.Immutable.MockedCacheDictionaries.ForEach(x =>
            {
                var value             = x.Value.Keys.Count;
                clear1ImmutableCount += value;

                if (value > 0 && expectedToBeEmpty)
                {
                    _log.LogError($"Immutable cache {x.Key} has {value} elements within it, expected to be zero.");
                }
            });

            var clear1 = clear1MutableCount == 0 && clear1ImmutableCount == 0;

            if (expectedToBeEmpty && !clear1)
            {
                DumpModelContents($"Pre-commit empty check, mutableCount = {mutableCount}, immutableCount = {immutableCount}, clear1MutableCount = {clear1MutableCount}, clear1ImmutableCount = {clear1ImmutableCount}");
            }

            // Perform a belt and braces check to ensure there were no pending uncommitted changes.
            model.PrimaryStorageProxy.Mutability.Should().Be(StorageMutability.Mutable);
            model.PrimaryStorageProxy.ImmutableProxy.Should().NotBeNull();
            model.PrimaryStorageProxy.Commit();

            var clear2MutableCount   = IgniteMock.Mutable.MockedCacheDictionaries.Values.Sum(cache => cache.Keys.Count);
            var clear2ImmutableCount = IgniteMock.Immutable.MockedCacheDictionaries.Values.Sum(cache => cache.Keys.Count);

            var clear2 = clear2MutableCount == 0 && clear2ImmutableCount == 0;

            if (expectedToBeEmpty && !(clear1 && clear2))
            {
                DumpModelContents($"After full check, mutableCount = {mutableCount}, immutableCount = {immutableCount}, clear2MutableCount = {clear2MutableCount}, clear2ImmutableCount = {clear2ImmutableCount}");
            }

            return(clear1 && clear2);
        }
Exemplo n.º 20
0
        /*
         * /// <summary>
         * /// The version number to stamp spatial data elements with generated by this worker.
         * /// Commented out pending requirement for request based consistency requiring a sub grid version map
         * /// </summary>
         * //private long EpochVersion { get; } = DateTime.UtcNow.Ticks;
         */

        /// <summary>
        /// Constructor the initializes state ready for integration. Not that two storage proxies are provided - one to store sub grid dictionary/headers, and one to store segments
        /// so that they can be committed to the persistent store safely (ie: segments first, then headers).
        /// </summary>
        /// <param name="source">The sub grid tree from which information is being integrated</param>
        /// <param name="siteModel">The site model representing the target sub grid tree</param>
        /// <param name="target">The sub grid tree into which the data from the source sub grid tree is integrated</param>
        /// <param name="storageProxySubGrids">The storage proxy providing storage semantics for persisting integration results relating to sub grids (specifically the header/dictionary representation)</param>
        /// <param name="storageProxySubGridSegments">The storage proxy providing storage semantics for persisting integration results relating to sub grid segments</param>
        public SubGridIntegrator(IServerSubGridTree source, ISiteModel siteModel, IServerSubGridTree target,
                                 IStorageProxy storageProxySubGrids, IStorageProxy storageProxySubGridSegments)
        {
            _source                      = source;
            _siteModel                   = siteModel;
            _target                      = target;
            _storageProxySubGrids        = storageProxySubGrids;
            _storageProxySubGridSegments = storageProxySubGridSegments;
        }
Exemplo n.º 21
0
 private CMVChangeStatisticsArgument SimpleCMVChangeStatisticsArgument(ISiteModel siteModel, double[] cmvChangeValues)
 {
     return(new CMVChangeStatisticsArgument
     {
         ProjectID = siteModel.ID,
         Filters = new FilterSet(new CombinedFilter()),
         CMVChangeDetailsDataValues = cmvChangeValues
     });
 }
Exemplo n.º 22
0
        private void AddLayerEvents(ISiteModel siteModel, DateTime refDate, short bulldozerMachineIndex)
        {
            siteModel.MachinesTargetValues[bulldozerMachineIndex].LayerOverrideEvents.PutValueAtDate(refDate.AddMinutes(-90), new OverrideEvent <ushort>(refDate.AddMinutes(-60), 2));
            siteModel.MachinesTargetValues[bulldozerMachineIndex].LayerOverrideEvents.PutValueAtDate(refDate.AddMinutes(-60), new OverrideEvent <ushort>(refDate.AddMinutes(-50), 4));

            var excavator = siteModel.Machines.Locate("Excavator", false);

            siteModel.MachinesTargetValues[excavator.InternalSiteModelMachineIndex].LayerOverrideEvents.PutValueAtDate(refDate.AddMinutes(-80), new OverrideEvent <ushort>(refDate.AddMinutes(-50), 3));
        }
Exemplo n.º 23
0
        private void MakeSurveyedSurfacesSetInSiteModel(DateTime date, ISiteModel siteModel)
        {
            var designUid = Guid.NewGuid();

            siteModel.SurveyedSurfaces.AddSurveyedSurfaceDetails(Guid.NewGuid(), new DesignDescriptor(designUid, "Folder", "FileName"), date, BoundingWorldExtent3D.Full());
            siteModel.SurveyedSurfaces.AddSurveyedSurfaceDetails(Guid.NewGuid(), new DesignDescriptor(designUid, "Folder", "FileName"), date.AddMinutes(1), BoundingWorldExtent3D.Full());
            siteModel.SurveyedSurfaces.AddSurveyedSurfaceDetails(Guid.NewGuid(), new DesignDescriptor(designUid, "Folder", "FileName"), date.AddMinutes(2), BoundingWorldExtent3D.Full());
            siteModel.SurveyedSurfaces.AddSurveyedSurfaceDetails(Guid.NewGuid(), new DesignDescriptor(designUid, "Folder", "FileName"), date.AddMinutes(3), BoundingWorldExtent3D.Full());
            siteModel.SurveyedSurfaces.AddSurveyedSurfaceDetails(Guid.NewGuid(), new DesignDescriptor(designUid, "Folder", "FileName"), date.AddMinutes(4), BoundingWorldExtent3D.Full());
        }
Exemplo n.º 24
0
 private CutFillStatisticsArgument SimpleCutFillStatisticsArgument(ISiteModel siteModel, Guid designUid, double offset)
 {
     return(new CutFillStatisticsArgument
     {
         ProjectID = siteModel.ID,
         Filters = new FilterSet(new CombinedFilter()),
         ReferenceDesign = new DesignOffset(designUid, offset),
         Offsets = new double[0]
     });
 }
Exemplo n.º 25
0
        public void GetMachines_TwoMachines()
        {
            ISiteModel siteModel = DIContext.Obtain <ISiteModels>().GetSiteModel(DITagFileFixture.NewSiteModelGuid, true);
            IMachine   machine1  = siteModel.Machines.CreateNew("Test Machine Source", "", MachineType.Dozer, DeviceTypeEnum.SNM940, false, Guid.NewGuid());
            IMachine   machine2  = siteModel.Machines.CreateNew("Test Machine Source 2", "", MachineType.WheelLoader, DeviceTypeEnum.SNM941, false, Guid.NewGuid());

            var machines = siteModel.Machines.ToList();

            machines.Count.Should().Be(2);
        }
Exemplo n.º 26
0
        private void SetupTest()
        {
            var tagFiles = new[]
            {
                Path.Combine(TestHelper.CommonTestDataPath, "TestTAGFile-QMesh.tag"),
            };

            siteModel = DITAGFileAndSubGridRequestsFixture.BuildModel(tagFiles, out _);
            var boundary = new List <Fence>()
            {
                new Fence()
            };

            boundary[0].Points.Add(new FencePoint(2700.20170260547, 1225.08445683629, 0.0));
            boundary[0].Points.Add(new FencePoint(2700.16517351542, 1224.38744027628, 0.0));
            boundary[0].Points.Add(new FencePoint(2700.10136538994, 1223.16990871245, 0.0));
            boundary[0].Points.Add(new FencePoint(2889.7599542129, 1178.36648123432, 0.0));

            // Mocked ConvertCoordinates expected result.
            var neeCoords = new XYZ[boundary[0].Points.Count];

            // mock tile boundary within model extents
            //WS
            neeCoords[0].X = Math.Round(2847.26, DECIMALS);
            neeCoords[0].Y = Math.Round(1219.93, DECIMALS);
            //EN
            neeCoords[1].X = Math.Round(2879.11, DECIMALS);
            neeCoords[1].Y = Math.Round(1276.37, DECIMALS);
            //WN
            neeCoords[2].X = Math.Round(2847.26, DECIMALS);
            neeCoords[2].Y = Math.Round(1276.37, DECIMALS);
            // ES
            neeCoords[3].X = Math.Round(2879.11, DECIMALS);
            neeCoords[3].Y = Math.Round(1219.93, DECIMALS);

            var llhCoords = new XYZ[2500];

            for (int i = 0; i < 2500; i++)
            {
                llhCoords[i].X = Math.Round(2847.26 + i, DECIMALS);
                llhCoords[i].Y = Math.Round(1219.93 + i, DECIMALS);
            }

            var expectedCoordinateConversionResult  = neeCoords.ToCoreX_XYZ();
            var expectedCoordinateConversionResult2 = llhCoords.ToCoreX_XYZ();

            // LL to NEE
            var convertCoordinatesMock = new Mock <ICoreXWrapper>();

            convertCoordinatesMock.Setup(x => x.LLHToNEE(It.IsAny <string>(), It.IsAny <CoreXModels.XYZ[]>(), CoreX.Types.InputAs.Radians)).Returns(expectedCoordinateConversionResult);
            convertCoordinatesMock.Setup(x => x.NEEToLLH(It.IsAny <string>(), It.IsAny <CoreXModels.XYZ[]>(), CoreX.Types.ReturnAs.Radians)).Returns(expectedCoordinateConversionResult2);
            DIBuilder.Continue().Add(x => x.AddSingleton(convertCoordinatesMock.Object)).Complete();

            filter = new FilterSet(new CombinedFilter());
        }
Exemplo n.º 27
0
        protected ICombinedFilter ConvertFilter(FilterResult filter, ISiteModel siteModel)
        {
            if (filter == null)
            {
                return(new CombinedFilter()); //TRex doesn't like null filter
            }
            var combinedFilter = AutoMapperUtility.Automapper.Map <FilterResult, CombinedFilter>(filter);

            combinedFilter.AttributeFilter.SiteModel = siteModel;
            return(combinedFilter);
        }
Exemplo n.º 28
0
        protected TileRenderRequestArgument SimpleTileRequestArgument(ISiteModel siteModel, DisplayMode displayMode, IPlanViewPalette palette = null, CellPassAttributeFilter attributeFilter = null, VolumeComputationType volumeType = VolumeComputationType.None)
        {
            var filter = displayMode == DisplayMode.CutFill ? new FilterSet(new CombinedFilter(), new CombinedFilter()) : new FilterSet(new CombinedFilter());

            if (attributeFilter != null)
            {
                filter.Filters[0].AttributeFilter = attributeFilter;
            }

            return(new TileRenderRequestArgument(siteModel.ID, displayMode, palette, siteModel.SiteModelExtent, true, 256, 256, filter, new DesignOffset(), volumeType));
        }
Exemplo n.º 29
0
 public CSVExportSubGridProcessor(CSVExportRequestArgument requestArgument)
 {
     _maxExportRows                   = DIContext.Obtain <IConfigurationStore>().GetValueInt("MAX_EXPORT_ROWS", Consts.DEFAULT_MAX_EXPORT_ROWS);
     _requestArgument                 = requestArgument;
     _csvExportFormatter              = new CSVExportFormatter(requestArgument.UserPreferences, requestArgument.OutputType, requestArgument.RawDataAsDBase);
     _siteModel                       = DIContext.Obtain <ISiteModels>().GetSiteModel(requestArgument.ProjectID);
     _cellPassTimeString              = _coordString = _heightString = _lastDesignNameString = _lastMachineNameString =
         _machineSpeedString          = _gpsAccuracyToleranceString = _targetPassCountString = _lastPassValidCcvString =
             _lastTargetCcvString     = _lastPassValidMdpString = _lastTargetMdpString = _lastValidRmvString =
                 _lastValidFreqString = _lastValidAmpString = _lastTargetThicknessString = _lastEventMachineGearString =
                     _lastEventVibrationStateString = _lastPassValidTemperatureString = _csvExportFormatter.NullString;
 }
Exemplo n.º 30
0
 private SpeedStatisticsArgument SimpleSpeedStatisticsArgument(ISiteModel siteModel, ushort minSpeed, ushort maxSpeed)
 {
     return(new SpeedStatisticsArgument
     {
         ProjectID = siteModel.ID,
         Filters = new FilterSet(new CombinedFilter()),
         Overrides = new OverrideParameters
         {
             TargetMachineSpeed = new MachineSpeedExtendedRecord(minSpeed, maxSpeed)
         }
     });
 }
Exemplo n.º 31
0
 public static void SetSeoContent(this Controller controller, ISiteModel model)
 {
     controller.ViewBag.Title = model.Title;
     controller.ViewBag.SeoDescription = model.SeoDescription;
     controller.ViewBag.SeoKeywords = model.SeoKeywords;
 }