예제 #1
0
        public void Test_RequestAnalyser_EmptyExistenceMap_YieldsNoSubGrids()
        {
            var prodDataExistenceMap = new SubGridTreeSubGridExistenceBitMask();
            var PipeLine             = new SubGridPipelineProgressive <SubGridsRequestArgument, SubGridRequestsResponse>(null)
            {
                FilterSet            = new FilterSet(new CombinedFilter()),
                ProdDataExistenceMap = prodDataExistenceMap,
                OverallExistenceMap  = prodDataExistenceMap
            };

            var analyser = new RequestAnalyser(PipeLine, BoundingWorldExtent3D.Full());

            Assert.Equal(0, analyser.CountOfSubGridsThatWillBeSubmitted());
        }
예제 #2
0
        public void Test_SiteModelMetadata()
        {
            var argument = new SiteModelMetadata
            {
                ID = Guid.NewGuid(),
                SiteModelExtent      = BoundingWorldExtent3D.Full(),
                CreationDate         = DateTime.UtcNow,
                LastModifiedDate     = DateTime.UtcNow,
                MachineCount         = 10,
                DesignCount          = 5,
                SurveyedSurfaceCount = 3,
                AlignmentCount       = 1
            };

            var result = SimpleBinarizableInstanceTester.TestClass(argument, "Custom SiteModelMetadata not same after round trip serialisation");

            argument.LastModifiedDate.Should().Be(result.member.LastModifiedDate, "Dates are not equal");
        }
예제 #3
0
        public void CacheFingerprint_PopulatedArgument()
        {
            Guid id  = Guid.NewGuid();
            var  arg = new SurfaceElevationPatchArgument(id, 1, 2, 3.0, SurveyedSurfacePatchType.EarliestSingleElevation,
                                                         SubGridTreeBitmapSubGridBits.FullMask, new TRex.SurveyedSurfaces.SurveyedSurfaces
            {
                new TRex.SurveyedSurfaces.SurveyedSurface(Guid.NewGuid(), new DesignDescriptor(Guid.NewGuid(), "Folder", "FileName"), DateTime.UtcNow, BoundingWorldExtent3D.Full())
            });

            arg.CacheFingerprint().Should().NotBeNullOrEmpty();
        }
예제 #4
0
        public void FromToBinary()
        {
            Guid id  = Guid.NewGuid();
            var  arg = new SurfaceElevationPatchArgument(id, 1, 2, 3.0, SurveyedSurfacePatchType.EarliestSingleElevation,
                                                         SubGridTreeBitmapSubGridBits.FullMask, new TRex.SurveyedSurfaces.SurveyedSurfaces
            {
                new TRex.SurveyedSurfaces.SurveyedSurface(Guid.NewGuid(), new DesignDescriptor(Guid.NewGuid(), "Folder", "FileName"), DateTime.UtcNow, BoundingWorldExtent3D.Full())
            });

            TestBinarizable_ReaderWriterHelper.RoundTripSerialise(arg);
        }
예제 #5
0
        public void Creation()
        {
            Guid id  = Guid.NewGuid();
            var  arg = new SurfaceElevationPatchArgument(id, 1, 2, 3.0, SurveyedSurfacePatchType.EarliestSingleElevation,
                                                         SubGridTreeBitmapSubGridBits.FullMask, new TRex.SurveyedSurfaces.SurveyedSurfaces
            {
                new TRex.SurveyedSurfaces.SurveyedSurface(Guid.NewGuid(), new DesignDescriptor(Guid.NewGuid(), "Folder", "FileName"), DateTime.UtcNow, BoundingWorldExtent3D.Full())
            });

            arg.Should().NotBeNull();
            arg.CellSize.Should().Be(3.0);
            arg.IncludedSurveyedSurfaces.Length.Should().Be(1);
            arg.OTGCellBottomLeftX.Should().Be(1);
            arg.OTGCellBottomLeftY.Should().Be(2);
            arg.ProcessingMap.Should().BeEquivalentTo(SubGridTreeBitmapSubGridBits.FullMask);
            arg.SiteModelID.Should().NotBeEmpty();
            arg.SurveyedSurfacePatchType.Should().Be(SurveyedSurfacePatchType.EarliestSingleElevation);
        }
예제 #6
0
        public void SortChronologically()
        {
            var surveyedSurfaceUid1 = Guid.NewGuid();
            var surveyedSurfaceUid2 = Guid.NewGuid();
            var designUid           = Guid.NewGuid();
            var ss   = new TRex.SurveyedSurfaces.SurveyedSurfaces();
            var date = DateTime.UtcNow;

            ss.AddSurveyedSurfaceDetails(surveyedSurfaceUid1, new DesignDescriptor(designUid, "Folder", "FileName"), date, BoundingWorldExtent3D.Full());
            ss.AddSurveyedSurfaceDetails(surveyedSurfaceUid2, new DesignDescriptor(designUid, "Folder", "FileName"), date.AddMinutes(1), BoundingWorldExtent3D.Full());

            ss.SortChronologically(true);

            ss[0].AsAtDate.Should().Be(date.AddMinutes(1));
            ss[1].AsAtDate.Should().Be(date);

            ss.SortChronologically(false);

            ss[0].AsAtDate.Should().Be(date);
            ss[1].AsAtDate.Should().Be(date.AddMinutes(1));
        }
예제 #7
0
        public void RemoveSurveyedSurfaceDetails()
        {
            var surveyedSurfaceUid = Guid.NewGuid();
            var designUid          = Guid.NewGuid();
            var ss = new TRex.SurveyedSurfaces.SurveyedSurfaces();

            ss.AddSurveyedSurfaceDetails(surveyedSurfaceUid, new DesignDescriptor(designUid, "Folder", "FileName"), DateTime.UtcNow, BoundingWorldExtent3D.Full());

            ss.Count.Should().Be(1);

            ss.RemoveSurveyedSurface(surveyedSurfaceUid).Should().BeTrue();
            ss.Count.Should().Be(0);
        }
예제 #8
0
        public void AddSurveyedSurfaceDetails()
        {
            var surveyedSurfaceUid = Guid.NewGuid();
            var designUid          = Guid.NewGuid();
            var date = DateTime.UtcNow;
            var ss   = new TRex.SurveyedSurfaces.SurveyedSurfaces();

            ss.AddSurveyedSurfaceDetails(surveyedSurfaceUid, new DesignDescriptor(designUid, "Folder", "FileName"), date, BoundingWorldExtent3D.Full());

            ss.Count.Should().Be(1);
            ss[0].Should().BeEquivalentTo(new TRex.SurveyedSurfaces.SurveyedSurface(surveyedSurfaceUid, new DesignDescriptor(designUid, "Folder", "FileName"), date, BoundingWorldExtent3D.Full()));
        }
예제 #9
0
        public void IsSameAs()
        {
            var date  = DateTime.UtcNow;
            var guids = Enumerable.Range(0, 5).Select(x => Guid.NewGuid()).ToArray();

            var ss = MakeSurveyedSurfacesSet(date, guids);

            ss.IsSameAs(ss).Should().BeTrue();

            var ss2 = MakeSurveyedSurfacesSet(date, guids);

            ss.IsSameAs(ss2).Should().BeTrue();

            var ss3 = MakeSurveyedSurfacesSet(date);

            ss.IsSameAs(ss3).Should().BeFalse();

            var ss4 = new TRex.SurveyedSurfaces.SurveyedSurfaces();

            ss4.AddSurveyedSurfaceDetails(Guid.NewGuid(), new DesignDescriptor(Guid.NewGuid(), "Folder", "FileName"), date, BoundingWorldExtent3D.Full());
            ss.IsSameAs(ss4).Should().BeFalse();
        }
예제 #10
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());
        }
예제 #11
0
        private TRex.SurveyedSurfaces.SurveyedSurfaces MakeSurveyedSurfacesSet(DateTime date, Guid[] guids = null)
        {
            var designUid = Guid.NewGuid();
            var ss        = new TRex.SurveyedSurfaces.SurveyedSurfaces();

            ss.AddSurveyedSurfaceDetails(guids?[0] ?? Guid.NewGuid(), new DesignDescriptor(designUid, "Folder", "FileName"), date, BoundingWorldExtent3D.Full());
            ss.AddSurveyedSurfaceDetails(guids?[1] ?? Guid.NewGuid(), new DesignDescriptor(designUid, "Folder", "FileName"), date.AddMinutes(1), BoundingWorldExtent3D.Full());
            ss.AddSurveyedSurfaceDetails(guids?[2] ?? Guid.NewGuid(), new DesignDescriptor(designUid, "Folder", "FileName"), date.AddMinutes(2), BoundingWorldExtent3D.Full());
            ss.AddSurveyedSurfaceDetails(guids?[3] ?? Guid.NewGuid(), new DesignDescriptor(designUid, "Folder", "FileName"), date.AddMinutes(3), BoundingWorldExtent3D.Full());
            ss.AddSurveyedSurfaceDetails(guids?[4] ?? Guid.NewGuid(), new DesignDescriptor(designUid, "Folder", "FileName"), date.AddMinutes(4), BoundingWorldExtent3D.Full());

            return(ss);
        }
예제 #12
0
        public void BinaryReadWrite()
        {
            var ss = new TRex.SurveyedSurfaces.SurveyedSurfaces();

            ss.AddSurveyedSurfaceDetails(Guid.NewGuid(), new DesignDescriptor(Guid.NewGuid(), "Folder", "FileName"), DateTime.UtcNow, BoundingWorldExtent3D.Full());

            TestBinary_ReaderWriterHelper.RoundTripSerialise(ss);
        }
예제 #13
0
        public void Full()
        {
            var bound = BoundingWorldExtent3D.Full();

            bound.IsMaximalPlanConverage.Should().BeTrue();
        }
예제 #14
0
        public async Task Geometry_SimpleLine()
        {
            AddDesignProfilerGridRouting();

            var siteModel = DITAGFileAndSubGridRequestsWithIgniteFixture.NewEmptyModel();

            var polyline = new NFFLineworkPolyLineEntity();

            polyline.Vertices.Add(new NFFLineworkPolyLineVertexEntity(polyline, 1, 2, 3, 0));
            polyline.Vertices.Add(new NFFLineworkPolyLineVertexEntity(polyline, 2, 2, 4, 1));

            var alignment = new NFFGuidableAlignmentEntity();

            alignment.Entities.Add(polyline);

            var alignmentGuid = Guid.NewGuid();
            var testDesign    = new SVLAlignmentDesign(alignment);

            siteModel.Alignments.AddAlignmentDetails(alignmentGuid, new DesignDescriptor(alignmentGuid, "", ""), BoundingWorldExtent3D.Full());

            var mockDesignFiles = new Mock <IDesignFiles>();

            mockDesignFiles.Setup(x => x.Lock(It.IsAny <Guid>(), It.IsAny <ISiteModelBase>(), It.IsAny <double>(), out It.Ref <DesignLoadResult> .IsAny))
            .Returns(new GobbleDesignFilesLockReturns((Guid designUid, ISiteModelBase siteModel, double cellSize, out DesignLoadResult result) =>
            {
                result = DesignLoadResult.Success;
                return(testDesign);
            }));

            DIBuilder.
            Continue()
            .Add(x => x.AddSingleton(mockDesignFiles.Object))
            .Complete();

            var request  = new AlignmentDesignGeometryRequest();
            var response = await request.ExecuteAsync(new AlignmentDesignGeometryArgument
            {
                ProjectID              = siteModel.ID,
                AlignmentDesignID      = alignmentGuid,
                ConvertArcsToPolyLines = false,
                ArcChordTolerance      = 0.0
            });

            response.RequestResult.Should().Be(DesignProfilerRequestResult.OK);
            response.Vertices.Should().NotBeNull();
            response.Vertices.Length.Should().Be(1);
            response.Vertices[0].Length.Should().Be(2);
            response.Vertices[0][0].Length.Should().Be(3);
            response.Vertices[0][1].Length.Should().Be(3);

            response.Vertices[0][0].Should().BeEquivalentTo(new double[] { 1, 2, 0 });
            response.Vertices[0][1].Should().BeEquivalentTo(new double[] { 2, 2, 1 });

            response.Arcs.Should().BeNullOrEmpty();

            response.Labels.Length.Should().Be(2);

            response.Labels[0].Station.Should().BeApproximately(0.0, 0.001);
            response.Labels[0].X.Should().BeApproximately(1.0, 0.001);
            response.Labels[0].Y.Should().BeApproximately(2.0, 0.001);
            response.Labels[0].Rotation.Should().BeApproximately(Math.PI / 2, 0.001);

            response.Labels[1].Station.Should().BeApproximately(1.0, 0.001);
            response.Labels[1].X.Should().BeApproximately(2.0, 0.001);
            response.Labels[1].Y.Should().BeApproximately(2.0, 0.001);
            response.Labels[1].Rotation.Should().BeApproximately(Math.PI / 2, 0.001);
        }
예제 #15
0
        private (ISiteModel siteModelId, Guid alignmentId) ConstructSimpleArcNFFFileModel()
        {
            var siteModel = DITAGFileAndSubGridRequestsWithIgniteFixture.NewEmptyModel();

            var arc = new NFFLineworkArcEntity(0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0, true, false)
            {
                StartStation = 0
            };

            var alignment = new NFFGuidableAlignmentEntity();

            alignment.Entities.Add(arc);

            var alignmentGuid = Guid.NewGuid();
            var testDesign    = new SVLAlignmentDesign(alignment);

            siteModel.Alignments.AddAlignmentDetails(alignmentGuid, new DesignDescriptor(alignmentGuid, "", ""), BoundingWorldExtent3D.Full());

            var mockDesignFiles = new Mock <IDesignFiles>();

            mockDesignFiles.Setup(x => x.Lock(It.IsAny <Guid>(), It.IsAny <ISiteModelBase>(), It.IsAny <double>(), out It.Ref <DesignLoadResult> .IsAny))
            .Returns(new GobbleDesignFilesLockReturns((Guid designUid, ISiteModelBase siteModel, double cellSize, out DesignLoadResult result) =>
            {
                result = DesignLoadResult.Success;
                return(testDesign);
            }));

            DIBuilder.
            Continue()
            .Add(x => x.AddSingleton(mockDesignFiles.Object))
            .Complete();

            return(siteModel, alignmentGuid);
        }