Exemplo n.º 1
0
        public void Test_RequestorUtilities_CreateIntermediaries_SingleDefaultFilter_WithSurveyedSurfaces()
        {
            var ru = new RequestorUtilities();

            Guid ssGuid = Guid.NewGuid();
            ISurveyedSurfaces surveyedSurfaces = DIContext.Obtain <ISurveyedSurfaces>();

            surveyedSurfaces.AddSurveyedSurfaceDetails(ssGuid, DesignDescriptor.Null(), TRex.Common.Consts.MIN_DATETIME_AS_UTC, BoundingWorldExtent3D.Null());

            var mockGrid = new Mock <IServerSubGridTree>();

            mockGrid.Setup(x => x.CellSize).Returns(SubGridTreeConsts.DefaultCellSize);
            var mockSiteModel = new Mock <ISiteModel>();

            mockSiteModel.Setup(x => x.SurveyedSurfacesLoaded).Returns(true);
            mockSiteModel.Setup(x => x.SurveyedSurfaces).Returns(surveyedSurfaces);
            mockSiteModel.Setup(x => x.Grid).Returns(mockGrid.Object);

            ICombinedFilter filter  = new CombinedFilter();
            IFilterSet      filters = new FilterSet(filter);

            var intermediaries = ru.ConstructRequestorIntermediaries(mockSiteModel.Object, filters, true, GridDataType.Height);

            intermediaries.Length.Should().Be(1);
            intermediaries[0].Filter.Should().Be(filter);
            intermediaries[0].FilteredSurveyedSurfaces.Should().Equal(surveyedSurfaces);
            intermediaries[0].CacheContexts[0].Should().Be(_fixture.TRexSpatialMemoryCacheContext);
            intermediaries[0].surfaceElevationPatchRequest.Should().Be(_fixture.SurfaceElevationPatchRequest);
        }
Exemplo n.º 2
0
        public void Test_RequestorUtilities_CreateRequestors_DefaultFilters(int filterCount)
        {
            var ru = new RequestorUtilities();

            ISurveyedSurfaces surveyedSurfaces = DIContext.Obtain <ISurveyedSurfaces>();

            // Create two surveyed surfaces that bracket current time by one day either side and set the filter end time to be current time
            // which will cause only one surveyed surface to be filtered
            Guid ssGuid1 = Guid.NewGuid();
            var  ss1     = surveyedSurfaces.AddSurveyedSurfaceDetails(ssGuid1, DesignDescriptor.Null(), Consts.MIN_DATETIME_AS_UTC, BoundingWorldExtent3D.Null());

            var mockGrid = new Mock <IServerSubGridTree>();

            mockGrid.Setup(x => x.CellSize).Returns(SubGridTreeConsts.DefaultCellSize);

            var mockSiteModel = new Mock <ISiteModel>();

            mockSiteModel.Setup(x => x.SurveyedSurfacesLoaded).Returns(true);
            mockSiteModel.Setup(x => x.SurveyedSurfaces).Returns(surveyedSurfaces);
            mockSiteModel.Setup(x => x.Grid).Returns(mockGrid.Object);

            ICombinedFilter[] filters   = Enumerable.Range(1, filterCount).Select(x => new CombinedFilter()).ToArray();
            IFilterSet        filterSet = new FilterSet(filters);

            var intermediaries = ru.ConstructRequestorIntermediaries(mockSiteModel.Object, filterSet, true, GridDataType.Height);
            var requestors     = ru.ConstructRequestors(new SubGridsRequestArgument(), mockSiteModel.Object, new OverrideParameters(), new LiftParameters(), intermediaries, AreaControlSet.CreateAreaControlSet(), null);

            requestors.Length.Should().Be(filters.Length);

            for (var i = 0; i < requestors.Length; i++)
            {
                requestors[i].CellOverrideMask.Should().NotBe(null);
            }
        }
Exemplo n.º 3
0
        public void Test_RequestorUtilities_CreateIntermediaries_MultipleDefaultFilters_WithSurveyedSurfaces(int filterCount)
        {
            var ru = new RequestorUtilities();

            Guid ssGuid = Guid.NewGuid();
            ISurveyedSurfaces surveyedSurfaces = DIContext.Obtain <ISurveyedSurfaces>();

            surveyedSurfaces.AddSurveyedSurfaceDetails(ssGuid, DesignDescriptor.Null(), Consts.MIN_DATETIME_AS_UTC, BoundingWorldExtent3D.Null());

            var mockGrid = new Mock <IServerSubGridTree>();

            mockGrid.Setup(x => x.CellSize).Returns(SubGridTreeConsts.DefaultCellSize);

            var mockSiteModel = new Mock <ISiteModel>();

            mockSiteModel.Setup(x => x.SurveyedSurfacesLoaded).Returns(true);
            mockSiteModel.Setup(x => x.SurveyedSurfaces).Returns(surveyedSurfaces);
            mockSiteModel.Setup(x => x.Grid).Returns(mockGrid.Object);

            ICombinedFilter[] filters   = Enumerable.Range(1, filterCount).Select(x => new CombinedFilter()).ToArray();
            IFilterSet        filterSet = new FilterSet(filters);

            var intermediaries = ru.ConstructRequestorIntermediaries(mockSiteModel.Object, filterSet, true, GridDataType.Height);

            intermediaries.Length.Should().Be(filters.Length);

            for (int i = 0; i < intermediaries.Length; i++)
            {
                intermediaries[i].Filter.Should().Be(filters[i]);
                intermediaries[i].FilteredSurveyedSurfaces.Should().Equal(surveyedSurfaces);
                intermediaries[i].CacheContexts[0].Should().NotBeNull();
                intermediaries[i].surfaceElevationPatchRequest.Should().Be(_fixture.SurfaceElevationPatchRequest);
            }
        }
Exemplo n.º 4
0
        public void NewInstance()
        {
            var factory  = new SurveyedSurfaceFactory();
            var instance = factory.NewInstance(Guid.NewGuid(), DesignDescriptor.Null(), Consts.MIN_DATETIME_AS_UTC, BoundingWorldExtent3D.Null());

            instance.Should().NotBeNull();
            instance.Should().BeAssignableTo <ISurveyedSurface>();
        }
Exemplo n.º 5
0
        public void Test_RequestorUtilities_CreateIntermediaries_MultipleFilters_WithOneOfTwoSurveyedSurfacesFilteredByTime_NoSurveyedSurfaceExclusions(int filterCount)
        {
            var ru = new RequestorUtilities();

            ISurveyedSurfaces surveyedSurfaces = DIContext.Obtain <ISurveyedSurfaces>();

            // Create two surveyed surfaces that bracket current time by one day either side and set the filter end time to be current time
            // which will cause only one surveyed surface to be filtered
            Guid ssGuid1 = Guid.NewGuid();
            var  ss1     = surveyedSurfaces.AddSurveyedSurfaceDetails(ssGuid1, DesignDescriptor.Null(), DateTime.UtcNow.AddDays(-1), BoundingWorldExtent3D.Null());

            Guid ssGuid2 = Guid.NewGuid();
            var  ss2     = surveyedSurfaces.AddSurveyedSurfaceDetails(ssGuid2, DesignDescriptor.Null(), DateTime.UtcNow.AddDays(+1), BoundingWorldExtent3D.Null());

            var mockGrid = new Mock <IServerSubGridTree>();

            mockGrid.Setup(x => x.CellSize).Returns(SubGridTreeConsts.DefaultCellSize);

            var mockSiteModel = new Mock <ISiteModel>();

            mockSiteModel.Setup(x => x.SurveyedSurfacesLoaded).Returns(true);
            mockSiteModel.Setup(x => x.SurveyedSurfaces).Returns(surveyedSurfaces);
            mockSiteModel.Setup(x => x.Grid).Returns(mockGrid.Object);

            ICombinedFilter[] filters = Enumerable.Range(1, filterCount).Select(x =>
            {
                var filter = new CombinedFilter
                {
                    AttributeFilter =
                    {
                        HasTimeFilter = true,
                        StartTime     = Consts.MIN_DATETIME_AS_UTC,
                        EndTime       = DateTime.UtcNow
                    }
                };
                return(filter);
            }).ToArray();
            IFilterSet filterSet = new FilterSet(filters);

            var intermediaries = ru.ConstructRequestorIntermediaries(mockSiteModel.Object, filterSet, true, GridDataType.Height);

            intermediaries.Length.Should().Be(filters.Length);

            for (int i = 0; i < intermediaries.Length; i++)
            {
                intermediaries[i].Filter.Should().Be(filters[i]);
                intermediaries[i].FilteredSurveyedSurfaces.Should().Equal(new List <ISurveyedSurface> {
                    ss1
                });
                intermediaries[i].CacheContexts[0].Should().NotBeNull();
                intermediaries[i].surfaceElevationPatchRequest.Should().Be(_fixture.SurfaceElevationPatchRequest);
            }
        }
Exemplo n.º 6
0
        public void Remove()
        {
            var manager = new SurveyedSurfaceManager(StorageMutability.Mutable);

            var siteModelUid = Guid.NewGuid();

            manager.Add(siteModelUid, DesignDescriptor.Null(), DateTime.UtcNow, BoundingWorldExtent3D.Null(), new SubGridTreeSubGridExistenceBitMask());

            var results = manager.List(siteModelUid);

            results.Should().NotBeNull();
            results.Count.Should().Be(1);

            manager.Remove(siteModelUid, results[0].ID).Should().BeTrue();
            manager.List(siteModelUid).Count.Should().Be(0);
        }
Exemplo n.º 7
0
        public void Test_SiteModel_Serialization_NewModelWithSingleElements()
        {
            var guid      = Guid.NewGuid();
            var siteModel = new SiteModel(guid, StorageMutability.Immutable, 1.23);

            siteModel.SiteModelExtent.SetMaximalCoverage();
            siteModel.Machines.CreateNew("Test Machine", "HardwareID", MachineType.AsphaltCompactor, 0, false, Guid.NewGuid());
            siteModel.Alignments.AddAlignmentDetails(Guid.NewGuid(), DesignDescriptor.Null(), BoundingWorldExtent3D.Null());
            siteModel.Designs.AddDesignDetails(Guid.NewGuid(), DesignDescriptor.Null(), BoundingWorldExtent3D.Null());
            siteModel.SurveyedSurfaces.AddSurveyedSurfaceDetails(Guid.NewGuid(), DesignDescriptor.Null(), DateTime.UtcNow, BoundingWorldExtent3D.Null());

            var metaData = siteModel.MetaData;

            metaData.ID.Should().Be(guid);
            metaData.LastModifiedDate.Should().Be(siteModel.LastModifiedDate);
            metaData.CreationDate.Should().Be(siteModel.CreationDate);
            metaData.AlignmentCount.Should().Be(1);
            metaData.DesignCount.Should().Be(1);
            metaData.SiteModelExtent.Should().BeEquivalentTo(siteModel.SiteModelExtent);
            metaData.MachineCount.Should().Be(1);
            metaData.SurveyedSurfaceCount.Should().Be(1);
        }
Exemplo n.º 8
0
        private ISiteModel BuildModelForProductionDataAndOrSurveyedSurface(DateTime baseTime, int?totalMins, int?ssMins)
        {
            var siteModel = DITAGFileAndSubGridRequestsWithIgniteFixture.NewEmptyModel();

            if (totalMins.HasValue)
            {
                var bulldozerMachineIndex = siteModel.Machines.Locate("Bulldozer", false).InternalSiteModelMachineIndex;

                // Ensure the machine has start and stop events (don't need actual cell passes)
                siteModel.MachinesTargetValues[bulldozerMachineIndex].StartEndRecordedDataEvents.PutValueAtDate(baseTime, ProductionEventType.StartEvent);
                siteModel.MachinesTargetValues[bulldozerMachineIndex].StartEndRecordedDataEvents.PutValueAtDate(baseTime.AddMinutes(totalMins.Value), ProductionEventType.EndEvent);

                siteModel.MachinesTargetValues[bulldozerMachineIndex].SaveMachineEventsToPersistentStore(siteModel.PrimaryStorageProxy);
            }

            if (ssMins.HasValue)
            {
                siteModel.SurveyedSurfaces.AddSurveyedSurfaceDetails(Guid.NewGuid(), DesignDescriptor.Null(), baseTime.AddMinutes(ssMins.Value), BoundingWorldExtent3D.Null());
            }

            DITAGFileAndSubGridRequestsFixture.ConvertSiteModelToImmutable(siteModel);

            return(siteModel);
        }
Exemplo n.º 9
0
 public void Null()
 {
     DesignDescriptor.Null().Should().BeEquivalentTo(new DesignDescriptor());
 }
Exemplo n.º 10
0
 /// <summary>
 /// No-arg constructor
 /// </summary>
 public SurveyedSurface()
 {
     DesignDescriptor = DesignDescriptor.Null();
 }